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, 2009, 2010 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 of the License, or
14 ;; (at your option) any later version.
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. If not, see <http://www.gnu.org/licenses/>.
30 (unless (fboundp 'declare-function
) (defmacro declare-function
(&rest r
))))
34 (when (featurep 'xemacs
)
35 (require 'easy-mmode
))) ; for `define-minor-mode'
37 (defvar tool-bar-mode
)
38 (defvar gnus-tmp-header
)
51 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
52 (autoload 'gnus-cache-write-active
"gnus-cache")
53 (autoload 'gnus-mailing-list-insinuate
"gnus-ml" nil t
)
54 (autoload 'turn-on-gnus-mailing-list-mode
"gnus-ml" nil t
)
55 (autoload 'gnus-pick-line-number
"gnus-salt" nil t
)
56 (autoload 'mm-uu-dissect
"mm-uu")
57 (autoload 'gnus-article-outlook-deuglify-article
"deuglify"
58 "Deuglify broken Outlook (Express) articles and redisplay."
60 (autoload 'gnus-article-outlook-unwrap-lines
"deuglify" nil t
)
61 (autoload 'gnus-article-outlook-repair-attribution
"deuglify" nil t
)
62 (autoload 'gnus-article-outlook-rearrange-citation
"deuglify" nil t
)
64 (defcustom gnus-kill-summary-on-exit t
65 "*If non-nil, kill the summary buffer when you exit from it.
66 If nil, the summary will become a \"*Dead Summary*\" buffer, and
67 it will be killed sometime later."
68 :group
'gnus-summary-exit
71 (defcustom gnus-summary-next-group-on-exit t
72 "If non-nil, go to the next unread newsgroup on summary exit.
73 See `gnus-group-goto-unread'."
74 :link
'(custom-manual "(gnus)Group Maneuvering")
75 :group
'gnus-summary-exit
76 :version
"23.1" ;; No Gnus
79 (defcustom gnus-summary-stop-at-end-of-message nil
80 "If non-nil, don't select the next message when using `SPC'."
81 :link
'(custom-manual "(gnus)Group Maneuvering")
82 :group
'gnus-summary-maneuvering
85 (defcustom gnus-fetch-old-headers nil
86 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
87 If an unread article in the group refers to an older, already
88 read (or just marked as read) article, the old article will not
89 normally be displayed in the Summary buffer. If this variable is
90 t, Gnus will attempt to grab the headers to the old articles, and
91 thereby build complete threads. If it has the value `some', all
92 old headers will be fetched but only enough headers to connect
93 otherwise loose threads will be displayed. This variable can
94 also be a number. In that case, no more than that number of old
95 headers will be fetched. If it has the value `invisible', all
96 old headers will be fetched, but none will be displayed.
98 The server has to support NOV for any of this to work.
100 This feature can seriously impact performance it ignores all
101 locally cached header entries. Setting it to t for groups for a
102 server that doesn't expire articles (such as news.gmane.org),
103 leads to very slow summary generation."
105 :type
'(choice (const :tag
"off" nil
)
110 (sexp :menu-tag
"other" t
)))
112 (defcustom gnus-refer-thread-limit
500
113 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
114 If t, fetch all the available old headers."
116 :type
'(choice number
117 (sexp :menu-tag
"other" t
)))
119 (defcustom gnus-summary-make-false-root
'adopt
120 "*nil means that Gnus won't gather loose threads.
121 If the root of a thread has expired or been read in a previous
122 session, the information necessary to build a complete thread has been
123 lost. Instead of having many small sub-threads from this original thread
124 scattered all over the summary buffer, Gnus can gather them.
126 If non-nil, Gnus will try to gather all loose sub-threads from an
127 original thread into one large thread.
129 If this variable is non-nil, it should be one of `none', `adopt',
132 If this variable is `none', Gnus will not make a false root, but just
133 present the sub-threads after another.
134 If this variable is `dummy', Gnus will create a dummy root that will
135 have all the sub-threads as children.
136 If this variable is `adopt', Gnus will make one of the \"children\"
137 the parent and mark all the step-children as such.
138 If this variable is `empty', the \"children\" are printed with empty
139 subject fields. (Or rather, they will be printed with a string
140 given by the `gnus-summary-same-subject' variable.)"
142 :type
'(choice (const :tag
"off" nil
)
148 (defcustom gnus-summary-make-false-root-always nil
149 "Always make a false dummy root."
154 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
155 "*A regexp to match subjects to be excluded from loose thread gathering.
156 As loose thread gathering is done on subjects only, that means that
157 there can be many false gatherings performed. By rooting out certain
158 common subjects, gathering might become saner."
162 (defcustom gnus-summary-gather-subject-limit nil
163 "*Maximum length of subject comparisons when gathering loose threads.
164 Use nil to compare full subjects. Setting this variable to a low
165 number will help gather threads that have been corrupted by
166 newsreaders chopping off subject lines, but it might also mean that
167 unrelated articles that have subject that happen to begin with the
168 same few characters will be incorrectly gathered.
170 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
173 :type
'(choice (const :tag
"off" nil
)
175 (sexp :menu-tag
"on" t
)))
177 (defcustom gnus-simplify-subject-functions nil
178 "List of functions taking a string argument that simplify subjects.
179 The functions are applied recursively.
181 Useful functions to put in this list include:
182 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
183 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
185 :type
'(repeat function
))
187 (defcustom gnus-simplify-ignored-prefixes nil
188 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
190 :type
'(choice (const :tag
"off" nil
)
193 (defcustom gnus-build-sparse-threads nil
194 "*If non-nil, fill in the gaps in threads.
195 If `some', only fill in the gaps that are needed to tie loose threads
196 together. If `more', fill in all leaf nodes that Gnus can find. If
197 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
199 :type
'(choice (const :tag
"off" nil
)
202 (sexp :menu-tag
"all" t
)))
204 (defcustom gnus-summary-thread-gathering-function
205 'gnus-gather-threads-by-subject
206 "*Function used for gathering loose threads.
207 There are two pre-defined functions: `gnus-gather-threads-by-subject',
208 which only takes Subjects into consideration; and
209 `gnus-gather-threads-by-references', which compared the References
210 headers of the articles to find matches."
212 :type
'(radio (function-item gnus-gather-threads-by-subject
)
213 (function-item gnus-gather-threads-by-references
)
214 (function :tag
"other")))
216 (defcustom gnus-summary-same-subject
""
217 "*String indicating that the current article has the same subject as the previous.
218 This variable will only be used if the value of
219 `gnus-summary-make-false-root' is `empty'."
220 :group
'gnus-summary-format
223 (defcustom gnus-summary-goto-unread t
224 "*If t, many commands will go to the next unread article.
225 This applies to marking commands as well as other commands that
226 \"naturally\" select the next article, like, for instance, `SPC' at
227 the end of an article.
229 If nil, the marking commands do NOT go to the next unread article
230 \(they go to the next article instead). If `never', commands that
231 usually go to the next unread article, will go to the next article,
232 whether it is read or not."
233 :group
'gnus-summary-marks
234 :link
'(custom-manual "(gnus)Setting Marks")
235 :type
'(choice (const :tag
"off" nil
)
237 (sexp :menu-tag
"on" t
)))
239 (defcustom gnus-summary-default-score
0
240 "*Default article score level.
241 All scores generated by the score files will be added to this score.
242 If this variable is nil, scoring will be disabled."
243 :group
'gnus-score-default
244 :type
'(choice (const :tag
"disable")
247 (defcustom gnus-summary-default-high-score
0
248 "*Default threshold for a high scored article.
249 An article will be highlighted as high scored if its score is greater
252 :group
'gnus-score-default
255 (defcustom gnus-summary-default-low-score
0
256 "*Default threshold for a low scored article.
257 An article will be highlighted as low scored if its score is smaller
260 :group
'gnus-score-default
263 (defcustom gnus-summary-zcore-fuzz
0
264 "*Fuzziness factor for the zcore in the summary buffer.
265 Articles with scores closer than this to `gnus-summary-default-score'
267 :group
'gnus-summary-format
270 (defcustom gnus-simplify-subject-fuzzy-regexp nil
271 "*Strings to be removed when doing fuzzy matches.
272 This can either be a regular expression or list of regular expressions
273 that will be removed from subject strings if fuzzy subject
274 simplification is selected."
276 :type
'(repeat regexp
))
278 (defcustom gnus-show-threads t
279 "*If non-nil, display threads in summary mode."
283 (defcustom gnus-thread-hide-subtree nil
284 "*If non-nil, hide all threads initially.
285 This can be a predicate specifier which says which threads to hide.
286 If threads are hidden, you have to run the command
287 `gnus-summary-show-thread' by hand or select an article."
289 :type
'(radio (sexp :format
"Non-nil\n"
290 :match
(lambda (widget value
)
291 (not (or (consp value
) (functionp value
))))
294 (sexp :tag
"Predicate specifier")))
296 (defcustom gnus-thread-hide-killed t
297 "*If non-nil, hide killed threads automatically."
301 (defcustom gnus-thread-ignore-subject t
302 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
303 If nil, articles that have different subjects from their parents will
304 start separate threads."
308 (defcustom gnus-thread-operation-ignore-subject t
309 "*If non-nil, subjects will be ignored when doing thread commands.
310 This affects commands like `gnus-summary-kill-thread' and
311 `gnus-summary-lower-thread'.
313 If this variable is nil, articles in the same thread with different
314 subjects will not be included in the operation in question. If this
315 variable is `fuzzy', only articles that have subjects that are fuzzily
316 equal will be included."
318 :type
'(choice (const :tag
"off" nil
)
322 (defcustom gnus-thread-indent-level
4
323 "*Number that says how much each sub-thread should be indented."
327 (defcustom gnus-auto-extend-newsgroup t
328 "*If non-nil, extend newsgroup forward and backward when requested."
329 :group
'gnus-summary-choose
332 (defcustom gnus-auto-select-first t
333 "If non-nil, select an article on group entry.
334 An article is selected automatically when entering a group
335 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
336 `gnus-summary-catchup-and-goto-next-group'.
338 Which article is selected is controlled by the variable
339 `gnus-auto-select-subject'.
341 If you want to prevent automatic selection of articles in some
342 newsgroups, set the variable to nil in `gnus-select-group-hook'."
343 ;; Commands include...
344 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
345 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
346 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
347 :group
'gnus-group-select
348 :type
'(choice (const :tag
"none" nil
)
349 (sexp :menu-tag
"first" t
)))
351 (defcustom gnus-auto-select-subject
'unread
352 "*Says what subject to place under point when entering a group.
354 This variable can either be the symbols `first' (place point on the
355 first subject), `unread' (place point on the subject line of the first
356 unread article), `best' (place point on the subject line of the
357 higest-scored article), `unseen' (place point on the subject line of
358 the first unseen article), `unseen-or-unread' (place point on the subject
359 line of the first unseen article or, if all article have been seen, on the
360 subject line of the first unread article), or a function to be called to
361 place point on some subject line."
363 :group
'gnus-group-select
364 :type
'(choice (const best
)
368 (const unseen-or-unread
)))
370 (defcustom gnus-auto-select-next t
371 "*If non-nil, offer to go to the next group from the end of the previous.
372 If the value is t and the next newsgroup is empty, Gnus will exit
373 summary mode and go back to group mode. If the value is neither nil
374 nor t, Gnus will select the following unread newsgroup. In
375 particular, if the value is the symbol `quietly', the next unread
376 newsgroup will be selected without any confirmation, and if it is
377 `almost-quietly', the next group will be selected without any
378 confirmation if you are located on the last article in the group.
379 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
380 will go to the next group without confirmation."
381 :group
'gnus-summary-maneuvering
382 :type
'(choice (const :tag
"off" nil
)
384 (const almost-quietly
)
385 (const slightly-quietly
)
386 (sexp :menu-tag
"on" t
)))
388 (defcustom gnus-auto-select-same nil
389 "*If non-nil, select the next article with the same subject.
390 If there are no more articles with the same subject, go to
391 the first unread article."
392 :group
'gnus-summary-maneuvering
395 (defcustom gnus-auto-select-on-ephemeral-exit
'next-noselect
396 "What article should be selected after exiting an ephemeral group.
397 Valid values include:
400 Select the next article.
402 Select the next unread article.
404 Move the cursor to the next article. This is the default.
405 `next-unread-noselect'
406 Move the cursor to the next unread article.
408 If it has any other value or there is no next (unread) article, the
409 article selected before entering to the ephemeral group will appear."
410 :version
"23.1" ;; No Gnus
411 :group
'gnus-summary-maneuvering
412 :type
'(choice :format
"%{%t%}:\n %[Value Menu%] %v"
413 (const next
) (const next-unread
)
414 (const next-noselect
) (const next-unread-noselect
)
415 (sexp :tag
"other" :value nil
)))
417 (defcustom gnus-auto-goto-ignores
'unfetched
418 "*Says how to handle unfetched articles when maneuvering.
420 This variable can either be the symbols nil (maneuver to any
421 article), `undownloaded' (maneuvering while unplugged ignores articles
422 that have not been fetched), `always-undownloaded' (maneuvering always
423 ignores articles that have not been fetched), `unfetched' (maneuvering
424 ignores articles whose headers have not been fetched).
426 NOTE: The list of unfetched articles will always be nil when plugged
427 and, when unplugged, a subset of the undownloaded article list."
429 :group
'gnus-summary-maneuvering
430 :type
'(choice (const :tag
"None" nil
)
431 (const :tag
"Undownloaded when unplugged" undownloaded
)
432 (const :tag
"Undownloaded" always-undownloaded
)
433 (const :tag
"Unfetched" unfetched
)))
435 (defcustom gnus-summary-check-current nil
436 "*If non-nil, consider the current article when moving.
437 The \"unread\" movement commands will stay on the same line if the
438 current article is unread."
439 :group
'gnus-summary-maneuvering
442 (defcustom gnus-auto-center-summary
2
443 "*If non-nil, always center the current summary buffer.
444 In particular, if `vertical' do only vertical recentering. If non-nil
445 and non-`vertical', do both horizontal and vertical recentering."
446 :group
'gnus-summary-maneuvering
447 :type
'(choice (const :tag
"none" nil
)
449 (integer :tag
"height")
450 (sexp :menu-tag
"both" t
)))
452 (defvar gnus-auto-center-group t
453 "*If non-nil, always center the group buffer.")
455 (defcustom gnus-show-all-headers nil
456 "*If non-nil, don't hide any headers."
457 :group
'gnus-article-hiding
458 :group
'gnus-article-headers
461 (defcustom gnus-summary-ignore-duplicates nil
462 "*If non-nil, ignore articles with identical Message-ID headers."
466 (defcustom gnus-single-article-buffer t
467 "*If non-nil, display all articles in the same buffer.
468 If nil, each group will get its own article buffer."
469 :group
'gnus-article-various
472 (defcustom gnus-break-pages t
473 "*If non-nil, do page breaking on articles.
474 The page delimiter is specified by the `gnus-page-delimiter'
476 :group
'gnus-article-various
479 (defcustom gnus-move-split-methods nil
480 "*Variable used to suggest where articles are to be moved to.
481 It uses the same syntax as the `gnus-split-methods' variable.
482 However, whereas `gnus-split-methods' specifies file names as targets,
483 this variable specifies group names."
484 :group
'gnus-summary-mail
485 :type
'(repeat (choice (list :value
(fun) function
)
486 (cons :value
("" "") regexp
(repeat string
))
489 (defcustom gnus-move-group-prefix-function
'gnus-group-real-prefix
490 "Function used to compute default prefix for article move/copy/etc prompts.
491 The function should take one argument, a group name, and return a
492 string with the suggested prefix."
493 :group
'gnus-summary-mail
496 ;; FIXME: Although the custom type is `character' for the following variables,
497 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
499 (defcustom gnus-unread-mark ?
;Whitespace
500 "*Mark used for unread articles."
501 :group
'gnus-summary-marks
504 (defcustom gnus-ticked-mark ?
!
505 "*Mark used for ticked articles."
506 :group
'gnus-summary-marks
509 (defcustom gnus-dormant-mark ??
510 "*Mark used for dormant articles."
511 :group
'gnus-summary-marks
514 (defcustom gnus-del-mark ?r
515 "*Mark used for del'd articles."
516 :group
'gnus-summary-marks
519 (defcustom gnus-read-mark ?R
520 "*Mark used for read articles."
521 :group
'gnus-summary-marks
524 (defcustom gnus-expirable-mark ?E
525 "*Mark used for expirable articles."
526 :group
'gnus-summary-marks
529 (defcustom gnus-killed-mark ?K
530 "*Mark used for killed articles."
531 :group
'gnus-summary-marks
534 (defcustom gnus-spam-mark ?$
535 "*Mark used for spam articles."
537 :group
'gnus-summary-marks
540 (defcustom gnus-souped-mark ?F
541 "*Mark used for souped articles."
542 :group
'gnus-summary-marks
545 (defcustom gnus-kill-file-mark ?X
546 "*Mark used for articles killed by kill files."
547 :group
'gnus-summary-marks
550 (defcustom gnus-low-score-mark ?Y
551 "*Mark used for articles with a low score."
552 :group
'gnus-summary-marks
555 (defcustom gnus-catchup-mark ?C
556 "*Mark used for articles that are caught up."
557 :group
'gnus-summary-marks
560 (defcustom gnus-replied-mark ?A
561 "*Mark used for articles that have been replied to."
562 :group
'gnus-summary-marks
565 (defcustom gnus-forwarded-mark ?F
566 "*Mark used for articles that have been forwarded."
568 :group
'gnus-summary-marks
571 (defcustom gnus-recent-mark ?N
572 "*Mark used for articles that are recent."
574 :group
'gnus-summary-marks
577 (defcustom gnus-cached-mark ?
*
578 "*Mark used for articles that are in the cache."
579 :group
'gnus-summary-marks
582 (defcustom gnus-saved-mark ?S
583 "*Mark used for articles that have been saved."
584 :group
'gnus-summary-marks
587 (defcustom gnus-unseen-mark ?.
588 "*Mark used for articles that haven't been seen."
590 :group
'gnus-summary-marks
593 (defcustom gnus-no-mark ?
;Whitespace
594 "*Mark used for articles that have no other secondary mark."
596 :group
'gnus-summary-marks
599 (defcustom gnus-ancient-mark ?O
600 "*Mark used for ancient articles."
601 :group
'gnus-summary-marks
604 (defcustom gnus-sparse-mark ?Q
605 "*Mark used for sparsely reffed articles."
606 :group
'gnus-summary-marks
609 (defcustom gnus-canceled-mark ?G
610 "*Mark used for canceled articles."
611 :group
'gnus-summary-marks
614 (defcustom gnus-duplicate-mark ?M
615 "*Mark used for duplicate articles."
616 :group
'gnus-summary-marks
619 (defcustom gnus-undownloaded-mark ?-
620 "*Mark used for articles that weren't downloaded."
622 :group
'gnus-summary-marks
625 (defcustom gnus-downloaded-mark ?
+
626 "*Mark used for articles that were downloaded."
627 :group
'gnus-summary-marks
630 (defcustom gnus-downloadable-mark ?%
631 "*Mark used for articles that are to be downloaded."
632 :group
'gnus-summary-marks
635 (defcustom gnus-unsendable-mark ?
=
636 "*Mark used for articles that won't be sent."
637 :group
'gnus-summary-marks
640 (defcustom gnus-score-over-mark ?
+
641 "*Score mark used for articles with high scores."
642 :group
'gnus-summary-marks
645 (defcustom gnus-score-below-mark ?-
646 "*Score mark used for articles with low scores."
647 :group
'gnus-summary-marks
650 (defcustom gnus-empty-thread-mark ?
;Whitespace
651 "*There is no thread under the article."
652 :group
'gnus-summary-marks
655 (defcustom gnus-not-empty-thread-mark ?
=
656 "*There is a thread under the article."
657 :group
'gnus-summary-marks
660 (defcustom gnus-view-pseudo-asynchronously nil
661 "*If non-nil, Gnus will view pseudo-articles asynchronously."
662 :group
'gnus-extract-view
665 (defcustom gnus-auto-expirable-marks
666 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
667 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
668 gnus-souped-mark gnus-duplicate-mark
)
669 "*The list of marks converted into expiration if a group is auto-expirable."
672 :type
'(repeat character
))
674 (defcustom gnus-inhibit-user-auto-expire t
675 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
680 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
681 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
682 If nil, the expirable marks will be unchanged except that the marks
683 will be removed when copying or moving articles to a group that has
684 not turned auto-expire on. If non-nil, articles that have been read
685 will be marked as expirable when being copied or moved to a group in
686 which auto-expire is turned on."
689 :group
'gnus-summary-marks
)
691 (defcustom gnus-view-pseudos nil
692 "*If `automatic', pseudo-articles will be viewed automatically.
693 If `not-confirm', pseudos will be viewed automatically, and the user
694 will not be asked to confirm the command."
695 :group
'gnus-extract-view
696 :type
'(choice (const :tag
"off" nil
)
698 (const not-confirm
)))
700 (defcustom gnus-view-pseudos-separately t
701 "*If non-nil, one pseudo-article will be created for each file to be viewed.
702 If nil, all files that use the same viewing command will be given as a
703 list of parameters to that command."
704 :group
'gnus-extract-view
707 (defcustom gnus-insert-pseudo-articles t
708 "*If non-nil, insert pseudo-articles when decoding articles."
709 :group
'gnus-extract-view
712 (defcustom gnus-summary-dummy-line-format
714 "*The format specification for the dummy roots in the summary buffer.
715 It works along the same lines as a normal formatting string,
716 with some simple extensions.
720 General format specifiers can also be used.
721 See `(gnus)Formatting Variables'."
722 :link
'(custom-manual "(gnus)Formatting Variables")
723 :group
'gnus-threading
726 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
727 "*The format specification for the summary mode line.
728 It works along the same lines as a normal formatting string,
729 with some simple extensions:
732 %p Unprefixed group name
733 %A Current article number
734 %z Current article score
736 %U Number of unread articles in the group
737 %e Number of unselected articles in the group
738 %Z A string with unread/unselected article counts
739 %g Shortish group name
740 %S Subject of the current article
742 %s Current score file name
743 %d Number of dormant articles
744 %r Number of articles that have been marked as read in this session
745 %E Number of articles expunged by the score files"
746 :group
'gnus-summary-format
749 (defcustom gnus-list-identifiers nil
750 "Regexp that matches list identifiers to be removed from subject.
751 This can also be a list of regexps."
753 :group
'gnus-summary-format
754 :group
'gnus-article-hiding
755 :type
'(choice (const :tag
"none" nil
)
757 (repeat :value
(".*") regexp
)))
759 (defcustom gnus-summary-mark-below
0
760 "*Mark all articles with a score below this variable as read.
761 This variable is local to each summary buffer and usually set by the
763 :group
'gnus-score-default
766 (defun gnus-widget-reversible-match (widget value
)
767 "Ignoring WIDGET, convert VALUE to internal form.
768 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
772 (eq (length value
) 2)
773 (eq (nth 0 value
) 'not
)
774 (symbolp (nth 1 value
)))))
776 (defun gnus-widget-reversible-to-internal (widget value
)
777 "Ignoring WIDGET, convert VALUE to internal form.
778 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
779 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
783 (list (nth 1 value
) t
)))
785 (defun gnus-widget-reversible-to-external (widget value
)
786 "Ignoring WIDGET, convert VALUE to external form.
787 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
788 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
791 (list 'not
(nth 0 value
))
794 (define-widget 'gnus-widget-reversible
'group
795 "A `group' that convert values."
796 :match
'gnus-widget-reversible-match
797 :value-to-internal
'gnus-widget-reversible-to-internal
798 :value-to-external
'gnus-widget-reversible-to-external
)
800 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
801 "*List of functions used for sorting articles in the summary buffer.
803 Each function takes two articles and returns non-nil if the first
804 article should be sorted before the other. If you use more than one
805 function, the primary sort function should be the last. You should
806 probably always include `gnus-article-sort-by-number' in the list of
807 sorting functions -- preferably first. Also note that sorting by date
808 is often much slower than sorting by number, and the sorting order is
809 very similar. (Sorting by date means sorting by the time the message
810 was sent, sorting by number means sorting by arrival time.)
812 Each item can also be a list `(not F)' where F is a function;
813 this reverses the sort order.
815 Ready-made functions include `gnus-article-sort-by-number',
816 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
817 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
818 and `gnus-article-sort-by-score'.
820 When threading is turned on, the variable `gnus-thread-sort-functions'
821 controls how articles are sorted."
822 :group
'gnus-summary-sort
823 :type
'(repeat (gnus-widget-reversible
824 (choice (function-item gnus-article-sort-by-number
)
825 (function-item gnus-article-sort-by-author
)
826 (function-item gnus-article-sort-by-subject
)
827 (function-item gnus-article-sort-by-date
)
828 (function-item gnus-article-sort-by-score
)
829 (function-item gnus-article-sort-by-random
)
830 (function :tag
"other"))
831 (boolean :tag
"Reverse order"))))
834 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
835 "*List of functions used for sorting threads in the summary buffer.
836 By default, threads are sorted by article number.
838 Each function takes two threads and returns non-nil if the first
839 thread should be sorted before the other. If you use more than one
840 function, the primary sort function should be the last. You should
841 probably always include `gnus-thread-sort-by-number' in the list of
842 sorting functions -- preferably first. Also note that sorting by date
843 is often much slower than sorting by number, and the sorting order is
844 very similar. (Sorting by date means sorting by the time the message
845 was sent, sorting by number means sorting by arrival time.)
847 Each list item can also be a list `(not F)' where F is a
848 function; this specifies reversed sort order.
850 Ready-made functions include `gnus-thread-sort-by-number',
851 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
852 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
853 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
854 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
855 and `gnus-thread-sort-by-total-score' (see
856 `gnus-thread-score-function').
858 When threading is turned off, the variable
859 `gnus-article-sort-functions' controls how articles are sorted."
860 :group
'gnus-summary-sort
862 (gnus-widget-reversible
863 (choice (function-item gnus-thread-sort-by-number
)
864 (function-item gnus-thread-sort-by-author
)
865 (function-item gnus-thread-sort-by-recipient
)
866 (function-item gnus-thread-sort-by-subject
)
867 (function-item gnus-thread-sort-by-date
)
868 (function-item gnus-thread-sort-by-score
)
869 (function-item gnus-thread-sort-by-most-recent-number
)
870 (function-item gnus-thread-sort-by-most-recent-date
)
871 (function-item gnus-thread-sort-by-random
)
872 (function-item gnus-thread-sort-by-total-score
)
873 (function :tag
"other"))
874 (boolean :tag
"Reverse order"))))
876 (defcustom gnus-thread-score-function
'+
877 "*Function used for calculating the total score of a thread.
879 The function is called with the scores of the article and each
880 subthread and should then return the score of the thread.
882 Some functions you can use are `+', `max', or `min'."
883 :group
'gnus-summary-sort
886 (defcustom gnus-summary-expunge-below nil
887 "All articles that have a score less than this variable will be expunged.
888 This variable is local to the summary buffers."
889 :group
'gnus-score-default
890 :type
'(choice (const :tag
"off" nil
)
893 (defcustom gnus-thread-expunge-below nil
894 "All threads that have a total score less than this variable will be expunged.
895 See `gnus-thread-score-function' for en explanation of what a
898 This variable is local to the summary buffers."
899 :group
'gnus-threading
900 :group
'gnus-score-default
901 :type
'(choice (const :tag
"off" nil
)
904 (defcustom gnus-summary-mode-hook nil
905 "*A hook for Gnus summary mode.
906 This hook is run before any variables are set in the summary buffer."
907 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
908 :group
'gnus-summary-various
911 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
912 (when (featurep 'xemacs
)
913 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-summary-menu-add
)
914 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-setup-summary-toolbar
)
915 (add-hook 'gnus-summary-mode-hook
916 'gnus-xmas-switch-horizontal-scrollbar-off
))
918 (defcustom gnus-summary-menu-hook nil
919 "*Hook run after the creation of the summary mode menu."
920 :group
'gnus-summary-visual
923 (defcustom gnus-summary-exit-hook nil
924 "*A hook called on exit from the summary buffer.
925 It will be called with point in the group buffer."
926 :group
'gnus-summary-exit
929 (defcustom gnus-summary-prepare-hook nil
930 "*A hook called after the summary buffer has been generated.
931 If you want to modify the summary buffer, you can use this hook."
932 :group
'gnus-summary-various
935 (defcustom gnus-summary-prepared-hook nil
936 "*A hook called as the last thing after the summary buffer has been generated."
937 :group
'gnus-summary-various
940 (defcustom gnus-summary-generate-hook nil
941 "*A hook run just before generating the summary buffer.
942 This hook is commonly used to customize threading variables and the
944 :group
'gnus-summary-various
947 (defcustom gnus-select-group-hook nil
948 "*A hook called when a newsgroup is selected.
950 If you'd like to simplify subjects like the
951 `gnus-summary-next-same-subject' command does, you can use the
954 (add-hook gnus-select-group-hook
956 (mapcar (lambda (header)
957 (mail-header-set-subject
959 (gnus-simplify-subject
960 (mail-header-subject header) 're-only)))
961 gnus-newsgroup-headers)))"
962 :group
'gnus-group-select
965 (defcustom gnus-select-article-hook nil
966 "*A hook called when an article is selected."
967 :group
'gnus-summary-choose
968 :options
'(gnus-agent-fetch-selected-article)
971 (defcustom gnus-visual-mark-article-hook
972 (list 'gnus-highlight-selected-summary
)
973 "*Hook run after selecting an article in the summary buffer.
974 It is meant to be used for highlighting the article in some way. It
975 is not run if `gnus-visual' is nil."
976 :group
'gnus-summary-visual
979 (defcustom gnus-parse-headers-hook nil
980 "*A hook called before parsing the headers."
984 (defcustom gnus-exit-group-hook nil
985 "*A hook called when exiting summary mode.
986 This hook is not called from the non-updating exit commands like `Q'."
990 (defcustom gnus-summary-update-hook
991 (list 'gnus-summary-highlight-line
)
992 "*A hook called when a summary line is changed.
993 The hook will not be called if `gnus-visual' is nil.
995 The default function `gnus-summary-highlight-line' will
996 highlight the line according to the `gnus-summary-highlight'
998 :group
'gnus-summary-visual
1001 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
1002 "*A hook called when an article is selected for the first time.
1003 The hook is intended to mark an article as read (or unread)
1004 automatically when it is selected."
1005 :group
'gnus-summary-choose
1008 (defcustom gnus-group-no-more-groups-hook nil
1009 "*A hook run when returning to group mode having no more (unread) groups."
1010 :group
'gnus-group-select
1013 (defcustom gnus-ps-print-hook nil
1014 "*A hook run before ps-printing something from Gnus."
1015 :group
'gnus-summary
1018 (defcustom gnus-summary-article-move-hook nil
1019 "*A hook called after an article is moved, copied, respooled, or crossposted."
1021 :group
'gnus-summary
1024 (defcustom gnus-summary-article-delete-hook nil
1025 "*A hook called after an article is deleted."
1027 :group
'gnus-summary
1030 (defcustom gnus-summary-article-expire-hook nil
1031 "*A hook called after an article is expired."
1033 :group
'gnus-summary
1036 (defcustom gnus-summary-display-arrow
1037 (and (fboundp 'display-graphic-p
)
1038 (display-graphic-p))
1039 "*If non-nil, display an arrow highlighting the current article."
1041 :group
'gnus-summary
1044 (defcustom gnus-summary-selected-face
'gnus-summary-selected
1045 "Face used for highlighting the current article in the summary buffer."
1046 :group
'gnus-summary-visual
1049 (defvar gnus-tmp-downloaded nil
)
1051 (defcustom gnus-summary-highlight
1052 '(((eq mark gnus-canceled-mark
)
1053 . gnus-summary-cancelled
)
1054 ((and uncached
(> score default-high
))
1055 . gnus-summary-high-undownloaded
)
1056 ((and uncached
(< score default-low
))
1057 . gnus-summary-low-undownloaded
)
1059 . gnus-summary-normal-undownloaded
)
1060 ((and (> score default-high
)
1061 (or (eq mark gnus-dormant-mark
)
1062 (eq mark gnus-ticked-mark
)))
1063 . gnus-summary-high-ticked
)
1064 ((and (< score default-low
)
1065 (or (eq mark gnus-dormant-mark
)
1066 (eq mark gnus-ticked-mark
)))
1067 . gnus-summary-low-ticked
)
1068 ((or (eq mark gnus-dormant-mark
)
1069 (eq mark gnus-ticked-mark
))
1070 . gnus-summary-normal-ticked
)
1071 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
1072 . gnus-summary-high-ancient
)
1073 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
1074 . gnus-summary-low-ancient
)
1075 ((eq mark gnus-ancient-mark
)
1076 . gnus-summary-normal-ancient
)
1077 ((and (> score default-high
) (eq mark gnus-unread-mark
))
1078 . gnus-summary-high-unread
)
1079 ((and (< score default-low
) (eq mark gnus-unread-mark
))
1080 . gnus-summary-low-unread
)
1081 ((eq mark gnus-unread-mark
)
1082 . gnus-summary-normal-unread
)
1083 ((> score default-high
)
1084 . gnus-summary-high-read
)
1085 ((< score default-low
)
1086 . gnus-summary-low-read
)
1088 . gnus-summary-normal-read
))
1089 "*Controls the highlighting of summary buffer lines.
1091 A list of (FORM . FACE) pairs. When deciding how a particular
1092 summary line should be displayed, each form is evaluated. The content
1093 of the face field after the first true form is used. You can change
1094 how those summary lines are displayed, by editing the face field.
1096 You can use the following variables in the FORM field.
1098 score: The article's score.
1099 default: The default article score.
1100 default-high: The default score for high scored articles.
1101 default-low: The default score for low scored articles.
1102 below: The score below which articles are automatically marked as read.
1103 mark: The article's mark.
1104 uncached: Non-nil if the article is uncached."
1105 :group
'gnus-summary-visual
1106 :type
'(repeat (cons (sexp :tag
"Form" nil
)
1108 (put 'gnus-summary-highlight
'risky-local-variable t
)
1110 (defcustom gnus-alter-header-function nil
1111 "Function called to allow alteration of article header structures.
1112 The function is called with one parameter, the article header vector,
1113 which it may alter in any way."
1114 :type
'(choice (const :tag
"None" nil
)
1116 :group
'gnus-summary
)
1118 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
1119 "Function used to decode a string with encoded words.")
1121 (defvar gnus-decode-encoded-address-function
1122 'mail-decode-encoded-address-string
1123 "Function used to decode addresses with encoded words.")
1125 (defcustom gnus-extra-headers
'(To Newsgroups
)
1126 "*Extra headers to parse."
1128 :group
'gnus-summary
1129 :type
'(repeat symbol
))
1131 (defcustom gnus-ignored-from-addresses
1132 (and user-mail-address
1133 (not (string= user-mail-address
""))
1134 (regexp-quote user-mail-address
))
1135 "*From headers that may be suppressed in favor of To headers.
1136 This can be a regexp or a list of regexps."
1138 :group
'gnus-summary
1139 :type
'(choice regexp
1140 (repeat :tag
"Regexp List" regexp
)))
1142 (defsubst gnus-ignored-from-addresses
()
1143 (gmm-regexp-concat gnus-ignored-from-addresses
))
1145 (defcustom gnus-summary-to-prefix
"-> "
1146 "*String prefixed to the To field in the summary line when
1147 using `gnus-ignored-from-addresses'."
1149 :group
'gnus-summary
1152 (defcustom gnus-summary-newsgroup-prefix
"=> "
1153 "*String prefixed to the Newsgroup field in the summary
1154 line when using `gnus-ignored-from-addresses'."
1156 :group
'gnus-summary
1159 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1160 "List of charsets that should be ignored.
1161 When these charsets are used in the \"charset\" parameter, the
1162 default charset will be used instead."
1164 :type
'(repeat symbol
)
1165 :group
'gnus-charset
)
1167 (defcustom gnus-newsgroup-maximum-articles nil
1168 "The maximum number of articles a newsgroup.
1169 If this is a number, old articles in a newsgroup exceeding this number
1170 are silently ignored. If it is nil, no article is ignored. Note that
1171 setting this variable to a number might prevent you from reading very
1173 :group
'gnus-group-select
1175 :type
'(choice (const :tag
"No limit" nil
)
1178 (gnus-define-group-parameter
1182 "Return the ignored charsets of GROUP."
1183 :variable gnus-group-ignored-charsets-alist
1185 '(("alt\\.chinese\\.text" iso-8859-1
))
1187 "Alist of regexps (to match group names) and charsets that should be ignored.
1188 When these charsets are used in the \"charset\" parameter, the
1189 default charset will be used instead."
1190 :variable-group gnus-charset
1191 :variable-type
'(repeat (cons (regexp :tag
"Group")
1193 :parameter-type
'(choice :tag
"Ignored charsets"
1196 :parameter-document
"\
1197 List of charsets that should be ignored.
1199 When these charsets are used in the \"charset\" parameter, the
1200 default charset will be used instead.")
1202 (defcustom gnus-group-highlight-words-alist nil
1203 "Alist of group regexps and highlight regexps.
1204 This variable uses the same syntax as `gnus-emphasis-alist'."
1206 :type
'(repeat (cons (regexp :tag
"Group")
1207 (repeat (list (regexp :tag
"Highlight regexp")
1208 (number :tag
"Group for entire word" 0)
1209 (number :tag
"Group for displayed part" 0)
1211 gnus-emphasis-highlight-words
)))))
1212 :group
'gnus-summary-visual
)
1214 (defcustom gnus-summary-show-article-charset-alist
1216 "Alist of number and charset.
1217 The article will be shown with the charset corresponding to the
1219 For example: ((1 . cn-gb-2312) (2 . big5))."
1221 :type
'(repeat (cons (number :tag
"Argument" 1)
1222 (symbol :tag
"Charset")))
1223 :group
'gnus-charset
)
1225 (defcustom gnus-preserve-marks t
1226 "Whether marks are preserved when moving, copying and respooling messages."
1229 :group
'gnus-summary-marks
)
1231 (defcustom gnus-propagate-marks t
1232 "If non-nil, do not propagate marks to the backends."
1233 :version
"23.1" ;; No Gnus
1235 :group
'gnus-summary-marks
)
1237 (defcustom gnus-alter-articles-to-read-function nil
1238 "Function to be called to alter the list of articles to be selected."
1239 :type
'(choice (const nil
) function
)
1240 :group
'gnus-summary
)
1242 (defcustom gnus-orphan-score nil
1243 "*All orphans get this score added. Set in the score file."
1244 :group
'gnus-score-default
1245 :type
'(choice (const nil
)
1248 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1249 "*A regexp to match MIME parts when saving multiple parts of a
1250 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1251 This regexp will be used by default when prompting the user for which
1252 type of files to save."
1253 :group
'gnus-summary
1256 (defcustom gnus-read-all-available-headers nil
1257 "Whether Gnus should parse all headers made available to it.
1258 This is mostly relevant for slow back ends where the user may
1259 wish to widen the summary buffer to include all headers
1260 that were fetched. Say, for nnultimate groups."
1262 :group
'gnus-summary
1263 :type
'(choice boolean regexp
))
1265 (defcustom gnus-summary-pipe-output-default-command nil
1266 "Command (and optional arguments) used to pipe article to subprocess.
1267 This will be used as the default command if it is non-nil. The value
1268 will be updated if you modify it when executing the command
1269 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1270 :version
"23.1" ;; No Gnus
1271 :group
'gnus-summary
1272 :type
'(radio (const :tag
"None" nil
) (string :tag
"Command")))
1274 (defcustom gnus-summary-muttprint-program
"muttprint"
1275 "Command (and optional arguments) used to run Muttprint.
1276 The value will be updated if you modify it when executing the command
1277 `gnus-summary-muttprint'."
1279 :group
'gnus-summary
1282 (defcustom gnus-article-loose-mime t
1283 "If non-nil, don't require MIME-Version header.
1284 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1285 supply the MIME-Version header or deliberately strip it from the mail.
1286 If non-nil (the default), Gnus will treat some articles as MIME
1287 even if the MIME-Version header is missing."
1290 :group
'gnus-article-mime
)
1292 (defcustom gnus-article-emulate-mime t
1293 "If non-nil, use MIME emulation for uuencode and the like.
1294 This means that Gnus will search message bodies for text that look
1295 like uuencoded bits, yEncoded bits, and so on, and present that using
1296 the normal Gnus MIME machinery."
1299 :group
'gnus-article-mime
)
1301 ;;; Internal variables
1303 (defvar gnus-summary-display-cache nil
)
1304 (defvar gnus-article-mime-handles nil
)
1305 (defvar gnus-article-decoded-p nil
)
1306 (defvar gnus-article-charset nil
)
1307 (defvar gnus-article-ignored-charsets nil
)
1308 (defvar gnus-scores-exclude-files nil
)
1309 (defvar gnus-page-broken nil
)
1311 (defvar gnus-original-article nil
)
1312 (defvar gnus-article-internal-prepare-hook nil
)
1313 (defvar gnus-newsgroup-process-stack nil
)
1315 (defvar gnus-thread-indent-array nil
)
1316 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1317 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1318 "Function called to sort the articles within a thread after it has been gathered together.")
1320 (defvar gnus-summary-save-parts-type-history nil
)
1321 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1323 ;; Avoid highlighting in kill files.
1324 (defvar gnus-summary-inhibit-highlight nil
)
1325 (defvar gnus-newsgroup-selected-overlay nil
)
1326 (defvar gnus-inhibit-limiting nil
)
1327 (defvar gnus-newsgroup-adaptive-score-file nil
)
1328 (defvar gnus-current-score-file nil
)
1329 (defvar gnus-current-move-group nil
)
1330 (defvar gnus-current-copy-group nil
)
1331 (defvar gnus-current-crosspost-group nil
)
1332 (defvar gnus-newsgroup-display nil
)
1334 (defvar gnus-newsgroup-dependencies nil
)
1335 (defvar gnus-newsgroup-adaptive nil
)
1336 (defvar gnus-summary-display-article-function nil
)
1337 (defvar gnus-summary-highlight-line-function nil
1338 "Function called after highlighting a summary line.")
1340 (defvar gnus-summary-line-format-alist
1341 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1342 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1343 (?s gnus-tmp-subject-or-nil ?s
)
1344 (?n gnus-tmp-name ?s
)
1345 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1347 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1349 (?F gnus-tmp-from ?s
)
1350 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1351 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1352 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1353 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1354 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1355 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1356 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1357 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1358 (?L gnus-tmp-lines ?s
)
1359 (?O gnus-tmp-downloaded ?c
)
1360 (?I gnus-tmp-indentation ?s
)
1361 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1362 (?R gnus-tmp-replied ?c
)
1363 (?\
[ gnus-tmp-opening-bracket ?c
)
1364 (?\
] gnus-tmp-closing-bracket ?c
)
1365 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1366 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1367 (?i gnus-tmp-score ?d
)
1368 (?z gnus-tmp-score-char ?c
)
1369 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1370 (?U gnus-tmp-unread ?c
)
1371 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1373 (?t
(gnus-summary-number-of-articles-in-thread
1374 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1376 (?e
(gnus-summary-number-of-articles-in-thread
1377 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1379 (?u gnus-tmp-user-defined ?s
)
1380 (?P
(gnus-pick-line-number) ?d
)
1381 (?B gnus-tmp-thread-tree-header-string ?s
)
1382 (user-date (gnus-user-date
1383 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1384 "An alist of format specifications that can appear in summary lines.
1385 These are paired with what variables they correspond with, along with
1386 the type of the variable (string, integer, character, etc).")
1388 (defvar gnus-summary-dummy-line-format-alist
1389 `((?S gnus-tmp-subject ?s
)
1390 (?N gnus-tmp-number ?d
)
1391 (?u gnus-tmp-user-defined ?s
)))
1393 (defvar gnus-summary-mode-line-format-alist
1394 `((?G gnus-tmp-group-name ?s
)
1395 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1396 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1397 (?A gnus-tmp-article-number ?d
)
1398 (?Z gnus-tmp-unread-and-unselected ?s
)
1399 (?V gnus-version ?s
)
1400 (?U gnus-tmp-unread-and-unticked ?d
)
1401 (?S gnus-tmp-subject ?s
)
1402 (?e gnus-tmp-unselected ?d
)
1403 (?u gnus-tmp-user-defined ?s
)
1404 (?d
(length gnus-newsgroup-dormant
) ?d
)
1405 (?t
(length gnus-newsgroup-marked
) ?d
)
1406 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1407 (?r
(length gnus-newsgroup-reads
) ?d
)
1408 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1409 (?E gnus-newsgroup-expunged-tally ?d
)
1410 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1412 ;; This is here rather than in gnus-art for compilation reasons.
1413 (defvar gnus-article-mode-line-format-alist
1414 (nconc '((?w
(gnus-article-wash-status) ?s
)
1415 (?m
(gnus-article-mime-part-status) ?s
))
1416 gnus-summary-mode-line-format-alist
))
1418 (defvar gnus-last-search-regexp nil
1419 "Default regexp for article search command.")
1421 (defvar gnus-last-shell-command nil
1422 "Default shell command on article.")
1424 (defvar gnus-newsgroup-agentized nil
1425 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1426 (defvar gnus-newsgroup-begin nil
)
1427 (defvar gnus-newsgroup-end nil
)
1428 (defvar gnus-newsgroup-last-rmail nil
)
1429 (defvar gnus-newsgroup-last-mail nil
)
1430 (defvar gnus-newsgroup-last-folder nil
)
1431 (defvar gnus-newsgroup-last-file nil
)
1432 (defvar gnus-newsgroup-last-directory nil
)
1433 (defvar gnus-newsgroup-auto-expire nil
)
1434 (defvar gnus-newsgroup-active nil
)
1436 (defvar gnus-newsgroup-data nil
)
1437 (defvar gnus-newsgroup-data-reverse nil
)
1438 (defvar gnus-newsgroup-limit nil
)
1439 (defvar gnus-newsgroup-limits nil
)
1440 (defvar gnus-summary-use-undownloaded-faces nil
)
1442 (defvar gnus-newsgroup-unreads nil
1443 "Sorted list of unread articles in the current newsgroup.")
1445 (defvar gnus-newsgroup-unselected nil
1446 "Sorted list of unselected unread articles in the current newsgroup.")
1448 (defvar gnus-newsgroup-reads nil
1449 "Alist of read articles and article marks in the current newsgroup.")
1451 (defvar gnus-newsgroup-expunged-tally nil
)
1453 (defvar gnus-newsgroup-marked nil
1454 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1456 (defvar gnus-newsgroup-spam-marked nil
1457 "List of ranges of articles that have been marked as spam.")
1459 (defvar gnus-newsgroup-killed nil
1460 "List of ranges of articles that have been through the scoring process.")
1462 (defvar gnus-newsgroup-cached nil
1463 "Sorted list of articles that come from the article cache.")
1465 (defvar gnus-newsgroup-saved nil
1466 "List of articles that have been saved.")
1468 (defvar gnus-newsgroup-kill-headers nil
)
1470 (defvar gnus-newsgroup-replied nil
1471 "List of articles that have been replied to in the current newsgroup.")
1473 (defvar gnus-newsgroup-forwarded nil
1474 "List of articles that have been forwarded in the current newsgroup.")
1476 (defvar gnus-newsgroup-recent nil
1477 "List of articles that have are recent in the current newsgroup.")
1479 (defvar gnus-newsgroup-expirable nil
1480 "Sorted list of articles in the current newsgroup that can be expired.")
1482 (defvar gnus-newsgroup-processable nil
1483 "List of articles in the current newsgroup that can be processed.")
1485 (defvar gnus-newsgroup-downloadable nil
1486 "Sorted list of articles in the current newsgroup that can be processed.")
1488 (defvar gnus-newsgroup-unfetched nil
1489 "Sorted list of articles in the current newsgroup whose headers have
1490 not been fetched into the agent.
1492 This list will always be a subset of gnus-newsgroup-undownloaded.")
1494 (defvar gnus-newsgroup-undownloaded nil
1495 "List of articles in the current newsgroup that haven't been downloaded.")
1497 (defvar gnus-newsgroup-unsendable nil
1498 "List of articles in the current newsgroup that won't be sent.")
1500 (defvar gnus-newsgroup-bookmarks nil
1501 "List of articles in the current newsgroup that have bookmarks.")
1503 (defvar gnus-newsgroup-dormant nil
1504 "Sorted list of dormant articles in the current newsgroup.")
1506 (defvar gnus-newsgroup-unseen nil
1507 "List of unseen articles in the current newsgroup.")
1509 (defvar gnus-newsgroup-seen nil
1510 "Range of seen articles in the current newsgroup.")
1512 (defvar gnus-newsgroup-articles nil
1513 "List of articles in the current newsgroup.")
1515 (defvar gnus-newsgroup-scored nil
1516 "List of scored articles in the current newsgroup.")
1518 (defvar gnus-newsgroup-headers nil
1519 "List of article headers in the current newsgroup.")
1521 (defvar gnus-newsgroup-threads nil
)
1523 (defvar gnus-newsgroup-prepared nil
1524 "Whether the current group has been prepared properly.")
1526 (defvar gnus-newsgroup-ancient nil
1527 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1529 (defvar gnus-newsgroup-sparse nil
)
1531 (defvar gnus-current-article nil
)
1532 (defvar gnus-article-current nil
)
1533 (defvar gnus-current-headers nil
)
1534 (defvar gnus-have-all-headers nil
)
1535 (defvar gnus-last-article nil
)
1536 (defvar gnus-newsgroup-history nil
)
1537 (defvar gnus-newsgroup-charset nil
)
1538 (defvar gnus-newsgroup-ephemeral-charset nil
)
1539 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1541 (defvar gnus-article-before-search nil
)
1543 (defvar gnus-summary-local-variables
1544 '(gnus-newsgroup-name
1545 gnus-newsgroup-begin gnus-newsgroup-end
1546 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1547 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1548 gnus-newsgroup-last-directory
1549 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1550 gnus-newsgroup-unselected gnus-newsgroup-marked
1551 gnus-newsgroup-spam-marked
1552 gnus-newsgroup-reads gnus-newsgroup-saved
1553 gnus-newsgroup-replied gnus-newsgroup-forwarded
1554 gnus-newsgroup-recent
1555 gnus-newsgroup-expirable
1556 gnus-newsgroup-processable gnus-newsgroup-killed
1557 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1558 gnus-newsgroup-unfetched
1559 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1560 gnus-newsgroup-seen gnus-newsgroup-articles
1561 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1562 gnus-newsgroup-headers gnus-newsgroup-threads
1563 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1564 gnus-current-article gnus-current-headers gnus-have-all-headers
1565 gnus-last-article gnus-article-internal-prepare-hook
1566 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1567 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1568 gnus-thread-expunge-below
1569 gnus-score-alist gnus-current-score-file
1570 (gnus-summary-expunge-below . global
)
1571 (gnus-summary-mark-below . global
)
1572 (gnus-orphan-score . global
)
1573 gnus-newsgroup-active gnus-scores-exclude-files
1574 gnus-newsgroup-history gnus-newsgroup-ancient
1575 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1576 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1577 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1578 (gnus-newsgroup-expunged-tally .
0)
1579 gnus-cache-removable-articles gnus-newsgroup-cached
1580 gnus-newsgroup-data gnus-newsgroup-data-reverse
1581 gnus-newsgroup-limit gnus-newsgroup-limits
1582 gnus-newsgroup-charset gnus-newsgroup-display
1583 gnus-summary-use-undownloaded-faces
)
1584 "Variables that are buffer-local to the summary buffers.")
1586 (defvar gnus-newsgroup-variables nil
1587 "A list of variables that have separate values in different newsgroups.
1588 A list of newsgroup (summary buffer) local variables, or cons of
1589 variables and their default expressions to be evalled (when the default
1590 values are not nil), that should be made global while the summary buffer
1593 Note: The default expressions will be evaluated (using function `eval')
1594 before assignment to the local variable rather than just assigned to it.
1595 If the default expression is the symbol `global', that symbol will not
1596 be evaluated but the global value of the local variable will be used
1599 These variables can be used to set variables in the group parameters
1600 while still allowing them to affect operations done in other buffers.
1603 \(setq gnus-newsgroup-variables
1604 '(message-use-followup-to
1605 (gnus-visible-headers .
1606 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1610 ;; Bind features so that require will believe that gnus-sum has
1611 ;; already been loaded (avoids infinite recursion)
1612 (let ((features (cons 'gnus-sum features
)))
1613 (require 'gnus-art
)))
1617 (defvar gnus-decode-encoded-word-methods
1618 '(mail-decode-encoded-word-string)
1619 "List of methods used to decode encoded words.
1621 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1622 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1623 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1624 whose names match REGEXP.
1627 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1628 mail-decode-encoded-word-string
1629 (\"chinese\" . rfc1843-decode-string))")
1631 (defvar gnus-decode-encoded-word-methods-cache nil
)
1633 (defun gnus-multi-decode-encoded-word-string (string)
1634 "Apply the functions from `gnus-encoded-word-methods' that match."
1635 (unless (and gnus-decode-encoded-word-methods-cache
1636 (eq gnus-newsgroup-name
1637 (car gnus-decode-encoded-word-methods-cache
)))
1638 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1639 (dolist (method gnus-decode-encoded-word-methods
)
1640 (if (symbolp method
)
1641 (nconc gnus-decode-encoded-word-methods-cache
(list method
))
1642 (if (and gnus-newsgroup-name
1643 (string-match (car method
) gnus-newsgroup-name
))
1644 (nconc gnus-decode-encoded-word-methods-cache
1645 (list (cdr method
)))))))
1646 (dolist (method (cdr gnus-decode-encoded-word-methods-cache
) string
)
1647 (setq string
(funcall method string
))))
1649 ;; Subject simplification.
1651 (defun gnus-simplify-whitespace (str)
1652 "Remove excessive whitespace from STR."
1654 (while (string-match "[ \t][ \t]+" str
)
1655 (setq str
(concat (substring str
0 (match-beginning 0))
1657 (substring str
(match-end 0)))))
1659 (when (string-match "^[ \t]+" str
)
1660 (setq str
(substring str
(match-end 0))))
1662 (when (string-match "[ \t]+$" str
)
1663 (setq str
(substring str
0 (match-beginning 0))))
1666 (defun gnus-simplify-all-whitespace (str)
1667 "Remove all whitespace from STR."
1668 (while (string-match "[ \t\n]+" str
)
1669 (setq str
(replace-match "" nil nil str
)))
1672 (defsubst gnus-simplify-subject-re
(subject)
1673 "Remove \"Re:\" from subject lines."
1674 (if (string-match message-subject-re-regexp subject
)
1675 (substring subject
(match-end 0))
1678 (defun gnus-simplify-subject (subject &optional re-only
)
1679 "Remove `Re:' and words in parentheses.
1680 If RE-ONLY is non-nil, strip leading `Re:'s only."
1681 (let ((case-fold-search t
)) ;Ignore case.
1682 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1683 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1684 (setq subject
(substring subject
(match-end 0))))
1685 ;; Remove uninteresting prefixes.
1686 (when (and (not re-only
)
1687 gnus-simplify-ignored-prefixes
1688 (string-match gnus-simplify-ignored-prefixes subject
))
1689 (setq subject
(substring subject
(match-end 0))))
1690 ;; Remove words in parentheses from end.
1692 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1693 (setq subject
(substring subject
0 (match-beginning 0)))))
1694 ;; Return subject string.
1697 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1699 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1700 (goto-char (point-min))
1701 (while (re-search-forward regexp nil t
)
1702 (replace-match (or newtext
""))))
1704 (defun gnus-simplify-buffer-fuzzy ()
1705 "Simplify string in the buffer fuzzily.
1706 The string in the accessible portion of the current buffer is simplified.
1707 It is assumed to be a single-line subject.
1708 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1709 matter is removed. Additional things can be deleted by setting
1710 `gnus-simplify-subject-fuzzy-regexp'."
1711 (let ((case-fold-search t
)
1713 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1715 (while (not (eq modified-tick
(buffer-modified-tick)))
1716 (setq modified-tick
(buffer-modified-tick))
1718 ((listp gnus-simplify-subject-fuzzy-regexp
)
1719 (mapc 'gnus-simplify-buffer-fuzzy-step
1720 gnus-simplify-subject-fuzzy-regexp
))
1721 (gnus-simplify-subject-fuzzy-regexp
1722 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1723 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1724 (gnus-simplify-buffer-fuzzy-step
1725 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1726 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1728 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1729 (gnus-simplify-buffer-fuzzy-step " +" " ")
1730 (gnus-simplify-buffer-fuzzy-step " $")
1731 (gnus-simplify-buffer-fuzzy-step "^ +")))
1733 (defun gnus-simplify-subject-fuzzy (subject)
1734 "Simplify a subject string fuzzily.
1735 See `gnus-simplify-buffer-fuzzy' for details."
1737 (gnus-set-work-buffer)
1738 (let ((case-fold-search t
))
1739 ;; Remove uninteresting prefixes.
1740 (when (and gnus-simplify-ignored-prefixes
1741 (string-match gnus-simplify-ignored-prefixes subject
))
1742 (setq subject
(substring subject
(match-end 0))))
1744 (inline (gnus-simplify-buffer-fuzzy))
1747 (defsubst gnus-simplify-subject-fully
(subject)
1748 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1750 (gnus-simplify-subject-functions
1751 (gnus-map-function gnus-simplify-subject-functions subject
))
1752 ((null gnus-summary-gather-subject-limit
)
1753 (gnus-simplify-subject-re subject
))
1754 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1755 (gnus-simplify-subject-fuzzy subject
))
1756 ((numberp gnus-summary-gather-subject-limit
)
1757 (truncate-string-to-width (gnus-simplify-subject-re subject
)
1758 gnus-summary-gather-subject-limit
))
1762 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1763 "Check whether two subjects are equal.
1764 If optional argument SIMPLE-FIRST is t, first argument is already
1767 ((null simple-first
)
1768 (equal (gnus-simplify-subject-fully s1
)
1769 (gnus-simplify-subject-fully s2
)))
1772 (gnus-simplify-subject-fully s2
)))))
1774 (defun gnus-summary-bubble-group ()
1775 "Increase the score of the current group.
1776 This is a handy function to add to `gnus-summary-exit-hook' to
1777 increase the score of each group you read."
1778 (gnus-group-add-score gnus-newsgroup-name
))
1782 ;;; Gnus summary mode
1785 (put 'gnus-summary-mode
'mode-class
'special
)
1787 (defvar gnus-article-commands-menu
)
1789 ;; Non-orthogonal keys
1791 (gnus-define-keys gnus-summary-mode-map
1792 " " gnus-summary-next-page
1793 "\177" gnus-summary-prev-page
1794 [delete] gnus-summary-prev-page
1795 [backspace] gnus-summary-prev-page
1796 "\r" gnus-summary-scroll-up
1797 "\M-\r" gnus-summary-scroll-down
1798 "n" gnus-summary-next-unread-article
1799 "p" gnus-summary-prev-unread-article
1800 "N" gnus-summary-next-article
1801 "P" gnus-summary-prev-article
1802 "\M-\C-n" gnus-summary-next-same-subject
1803 "\M-\C-p" gnus-summary-prev-same-subject
1804 "\M-n" gnus-summary-next-unread-subject
1805 "\M-p" gnus-summary-prev-unread-subject
1806 "." gnus-summary-first-unread-article
1807 "," gnus-summary-best-unread-article
1808 "\M-s" gnus-summary-search-article-forward
1809 "\M-r" gnus-summary-search-article-backward
1810 "\M-S" gnus-summary-repeat-search-article-forward
1811 "\M-R" gnus-summary-repeat-search-article-backward
1812 "<" gnus-summary-beginning-of-article
1813 ">" gnus-summary-end-of-article
1814 "j" gnus-summary-goto-article
1815 "^" gnus-summary-refer-parent-article
1816 "\M-^" gnus-summary-refer-article
1817 "u" gnus-summary-tick-article-forward
1818 "!" gnus-summary-tick-article-forward
1819 "U" gnus-summary-tick-article-backward
1820 "d" gnus-summary-mark-as-read-forward
1821 "D" gnus-summary-mark-as-read-backward
1822 "E" gnus-summary-mark-as-expirable
1823 "\M-u" gnus-summary-clear-mark-forward
1824 "\M-U" gnus-summary-clear-mark-backward
1825 "k" gnus-summary-kill-same-subject-and-select
1826 "\C-k" gnus-summary-kill-same-subject
1827 "\M-\C-k" gnus-summary-kill-thread
1828 "\M-\C-l" gnus-summary-lower-thread
1829 "e" gnus-summary-edit-article
1830 "#" gnus-summary-mark-as-processable
1831 "\M-#" gnus-summary-unmark-as-processable
1832 "\M-\C-t" gnus-summary-toggle-threads
1833 "\M-\C-s" gnus-summary-show-thread
1834 "\M-\C-h" gnus-summary-hide-thread
1835 "\M-\C-f" gnus-summary-next-thread
1836 "\M-\C-b" gnus-summary-prev-thread
1837 [(meta down)] gnus-summary-next-thread
1838 [(meta up)] gnus-summary-prev-thread
1839 "\M-\C-u" gnus-summary-up-thread
1840 "\M-\C-d" gnus-summary-down-thread
1841 "&" gnus-summary-execute-command
1842 "c" gnus-summary-catchup-and-exit
1843 "\C-w" gnus-summary-mark-region-as-read
1844 "\C-t" gnus-summary-toggle-truncation
1845 "?" gnus-summary-mark-as-dormant
1846 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1847 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1848 "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number
1849 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1850 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1851 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1852 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1853 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1854 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1855 "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date
1856 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1857 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1858 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1859 "=" gnus-summary-expand-window
1860 "\C-x\C-s" gnus-summary-reselect-current-group
1861 "\M-g" gnus-summary-rescan-group
1862 "\C-c\C-r" gnus-summary-caesar-message
1863 "f" gnus-summary-followup
1864 "F" gnus-summary-followup-with-original
1865 "C" gnus-summary-cancel-article
1866 "r" gnus-summary-reply
1867 "R" gnus-summary-reply-with-original
1868 "\C-c\C-f" gnus-summary-mail-forward
1869 "o" gnus-summary-save-article
1870 "\C-o" gnus-summary-save-article-mail
1871 "|" gnus-summary-pipe-output
1872 "\M-k" gnus-summary-edit-local-kill
1873 "\M-K" gnus-summary-edit-global-kill
1875 "\C-c\C-d" gnus-summary-describe-group
1876 "q" gnus-summary-exit
1877 "Q" gnus-summary-exit-no-update
1878 "\C-c\C-i" gnus-info-find-node
1879 gnus-mouse-2 gnus-mouse-pick-article
1880 [follow-link] mouse-face
1881 "m" gnus-summary-mail-other-window
1882 "a" gnus-summary-post-news
1883 "x" gnus-summary-limit-to-unread
1884 "s" gnus-summary-isearch-article
1885 "t" gnus-summary-toggle-header
1886 "g" gnus-summary-show-article
1887 "l" gnus-summary-goto-last-article
1888 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1889 "\C-d" gnus-summary-enter-digest-group
1890 "\M-\C-d" gnus-summary-read-document
1891 "\M-\C-e" gnus-summary-edit-parameters
1892 "\M-\C-a" gnus-summary-customize-parameters
1894 "*" gnus-cache-enter-article
1895 "\M-*" gnus-cache-remove-article
1896 "\M-&" gnus-summary-universal-argument
1897 "\C-l" gnus-recenter
1898 "I" gnus-summary-increase-score
1899 "L" gnus-summary-lower-score
1900 "\M-i" gnus-symbolic-argument
1901 "h" gnus-summary-select-article-buffer
1903 "b" gnus-article-view-part
1904 "\M-t" gnus-summary-toggle-display-buttonized
1906 "V" gnus-summary-score-map
1907 "X" gnus-uu-extract-map
1908 "S" gnus-summary-send-map)
1910 ;; Sort of orthogonal keymap
1911 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1912 "t" gnus-summary-tick-article-forward
1913 "!" gnus-summary-tick-article-forward
1914 "d" gnus-summary-mark-as-read-forward
1915 "r" gnus-summary-mark-as-read-forward
1916 "c" gnus-summary-clear-mark-forward
1917 " " gnus-summary-clear-mark-forward
1918 "e" gnus-summary-mark-as-expirable
1919 "x" gnus-summary-mark-as-expirable
1920 "?" gnus-summary-mark-as-dormant
1921 "b" gnus-summary-set-bookmark
1922 "B" gnus-summary-remove-bookmark
1923 "#" gnus-summary-mark-as-processable
1924 "\M-#" gnus-summary-unmark-as-processable
1925 "S" gnus-summary-limit-include-expunged
1926 "C" gnus-summary-catchup
1927 "H" gnus-summary-catchup-to-here
1928 "h" gnus-summary-catchup-from-here
1929 "\C-c" gnus-summary-catchup-all
1930 "k" gnus-summary-kill-same-subject-and-select
1931 "K" gnus-summary-kill-same-subject
1932 "P" gnus-uu-mark-map)
1934 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1935 "c" gnus-summary-clear-above
1936 "u" gnus-summary-tick-above
1937 "m" gnus-summary-mark-above
1938 "k" gnus-summary-kill-below)
1940 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1941 "/" gnus-summary-limit-to-subject
1942 "n" gnus-summary-limit-to-articles
1943 "b" gnus-summary-limit-to-bodies
1944 "h" gnus-summary-limit-to-headers
1945 "w" gnus-summary-pop-limit
1946 "s" gnus-summary-limit-to-subject
1947 "a" gnus-summary-limit-to-author
1948 "u" gnus-summary-limit-to-unread
1949 "m" gnus-summary-limit-to-marks
1950 "M" gnus-summary-limit-exclude-marks
1951 "v" gnus-summary-limit-to-score
1952 "*" gnus-summary-limit-include-cached
1953 "D" gnus-summary-limit-include-dormant
1954 "T" gnus-summary-limit-include-thread
1955 "d" gnus-summary-limit-exclude-dormant
1956 "t" gnus-summary-limit-to-age
1957 "." gnus-summary-limit-to-unseen
1958 "x" gnus-summary-limit-to-extra
1959 "p" gnus-summary-limit-to-display-predicate
1960 "E" gnus-summary-limit-include-expunged
1961 "c" gnus-summary-limit-exclude-childless-dormant
1962 "C" gnus-summary-limit-mark-excluded-as-read
1963 "o" gnus-summary-insert-old-articles
1964 "N" gnus-summary-insert-new-articles
1965 "S" gnus-summary-limit-to-singletons
1966 "r" gnus-summary-limit-to-replied
1967 "R" gnus-summary-limit-to-recipient
1968 "A" gnus-summary-limit-to-address)
1970 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1971 "n" gnus-summary-next-unread-article
1972 "p" gnus-summary-prev-unread-article
1973 "N" gnus-summary-next-article
1974 "P" gnus-summary-prev-article
1975 "\C-n" gnus-summary-next-same-subject
1976 "\C-p" gnus-summary-prev-same-subject
1977 "\M-n" gnus-summary-next-unread-subject
1978 "\M-p" gnus-summary-prev-unread-subject
1979 "f" gnus-summary-first-unread-article
1980 "b" gnus-summary-best-unread-article
1981 "j" gnus-summary-goto-article
1982 "g" gnus-summary-goto-subject
1983 "l" gnus-summary-goto-last-article
1984 "o" gnus-summary-pop-article)
1986 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1987 "k" gnus-summary-kill-thread
1988 "E" gnus-summary-expire-thread
1989 "l" gnus-summary-lower-thread
1990 "i" gnus-summary-raise-thread
1991 "T" gnus-summary-toggle-threads
1992 "t" gnus-summary-rethread-current
1993 "^" gnus-summary-reparent-thread
1994 "\M-^" gnus-summary-reparent-children
1995 "s" gnus-summary-show-thread
1996 "S" gnus-summary-show-all-threads
1997 "h" gnus-summary-hide-thread
1998 "H" gnus-summary-hide-all-threads
1999 "n" gnus-summary-next-thread
2000 "p" gnus-summary-prev-thread
2001 "u" gnus-summary-up-thread
2002 "o" gnus-summary-top-thread
2003 "d" gnus-summary-down-thread
2004 "#" gnus-uu-mark-thread
2005 "\M-#" gnus-uu-unmark-thread)
2007 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2008 "g" gnus-summary-prepare
2009 "c" gnus-summary-insert-cached-articles
2010 "d" gnus-summary-insert-dormant-articles
2011 "t" gnus-summary-insert-ticked-articles)
2013 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2014 "c" gnus-summary-catchup-and-exit
2015 "C" gnus-summary-catchup-all-and-exit
2016 "E" gnus-summary-exit-no-update
2017 "Q" gnus-summary-exit
2018 "Z" gnus-summary-exit
2019 "n" gnus-summary-catchup-and-goto-next-group
2020 "p" gnus-summary-catchup-and-goto-prev-group
2021 "R" gnus-summary-reselect-current-group
2022 "G" gnus-summary-rescan-group
2023 "N" gnus-summary-next-group
2024 "s" gnus-summary-save-newsrc
2025 "P" gnus-summary-prev-group)
2027 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2028 " " gnus-summary-next-page
2029 "n" gnus-summary-next-page
2030 "\177" gnus-summary-prev-page
2031 [delete] gnus-summary-prev-page
2032 "p" gnus-summary-prev-page
2033 "\r" gnus-summary-scroll-up
2034 "\M-\r" gnus-summary-scroll-down
2035 "<" gnus-summary-beginning-of-article
2036 ">" gnus-summary-end-of-article
2037 "b" gnus-summary-beginning-of-article
2038 "e" gnus-summary-end-of-article
2039 "^" gnus-summary-refer-parent-article
2040 "r" gnus-summary-refer-parent-article
2041 "D" gnus-summary-enter-digest-group
2042 "R" gnus-summary-refer-references
2043 "T" gnus-summary-refer-thread
2044 "g" gnus-summary-show-article
2045 "s" gnus-summary-isearch-article
2046 "P" gnus-summary-print-article
2047 "S" gnus-sticky-article
2048 "M" gnus-mailing-list-insinuate
2049 "t" gnus-article-babel
)
2051 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
2052 "b" gnus-article-add-buttons
2053 "B" gnus-article-add-buttons-to-head
2054 "o" gnus-article-treat-overstrike
2055 "e" gnus-article-emphasize
2056 "w" gnus-article-fill-cited-article
2057 "Q" gnus-article-fill-long-lines
2058 "L" gnus-article-toggle-truncate-lines
2059 "C" gnus-article-capitalize-sentences
2060 "c" gnus-article-remove-cr
2061 "q" gnus-article-de-quoted-unreadable
2062 "6" gnus-article-de-base64-unreadable
2063 "Z" gnus-article-decode-HZ
2064 "A" gnus-article-treat-ansi-sequences
2065 "h" gnus-article-wash-html
2066 "u" gnus-article-unsplit-urls
2067 "s" gnus-summary-force-verify-and-decrypt
2068 "f" gnus-article-display-x-face
2069 "l" gnus-summary-stop-page-breaking
2070 "r" gnus-summary-caesar-message
2071 "m" gnus-summary-morse-message
2072 "t" gnus-summary-toggle-header
2073 "g" gnus-treat-smiley
2074 "v" gnus-summary-verbose-headers
2075 "a" gnus-article-strip-headers-in-body
;; mnemonic: wash archive
2076 "p" gnus-article-verify-x-pgp-sig
2077 "d" gnus-article-treat-dumbquotes
2078 "i" gnus-summary-idna-message
)
2080 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map
)
2081 ;; mnemonic: deuglif*Y*
2082 "u" gnus-article-outlook-unwrap-lines
2083 "a" gnus-article-outlook-repair-attribution
2084 "c" gnus-article-outlook-rearrange-citation
2085 "f" gnus-article-outlook-deuglify-article
) ;; mnemonic: full deuglify
2087 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
2088 "a" gnus-article-hide
2089 "h" gnus-article-hide-headers
2090 "b" gnus-article-hide-boring-headers
2091 "s" gnus-article-hide-signature
2092 "c" gnus-article-hide-citation
2093 "C" gnus-article-hide-citation-in-followups
2094 "l" gnus-article-hide-list-identifiers
2095 "B" gnus-article-strip-banner
2096 "P" gnus-article-hide-pem
2097 "\C-c" gnus-article-hide-citation-maybe
)
2099 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
2100 "a" gnus-article-highlight
2101 "h" gnus-article-highlight-headers
2102 "c" gnus-article-highlight-citation
2103 "s" gnus-article-highlight-signature
)
2105 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map
)
2106 "f" gnus-article-treat-fold-headers
2107 "u" gnus-article-treat-unfold-headers
2108 "n" gnus-article-treat-fold-newsgroups
)
2110 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map
)
2111 "x" gnus-article-display-x-face
2112 "d" gnus-article-display-face
2113 "s" gnus-treat-smiley
2114 "D" gnus-article-remove-images
2115 "f" gnus-treat-from-picon
2116 "m" gnus-treat-mail-picon
2117 "n" gnus-treat-newsgroups-picon
)
2119 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
2120 "w" gnus-article-decode-mime-words
2121 "c" gnus-article-decode-charset
2122 "v" gnus-mime-view-all-parts
2123 "b" gnus-article-view-part
)
2125 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
2126 "z" gnus-article-date-ut
2127 "u" gnus-article-date-ut
2128 "l" gnus-article-date-local
2129 "p" gnus-article-date-english
2130 "e" gnus-article-date-lapsed
2131 "o" gnus-article-date-original
2132 "i" gnus-article-date-iso8601
2133 "s" gnus-article-date-user
)
2135 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
2136 "t" gnus-article-remove-trailing-blank-lines
2137 "l" gnus-article-strip-leading-blank-lines
2138 "m" gnus-article-strip-multiple-blank-lines
2139 "a" gnus-article-strip-blank-lines
2140 "A" gnus-article-strip-all-blank-lines
2141 "s" gnus-article-strip-leading-space
2142 "e" gnus-article-strip-trailing-space
2143 "w" gnus-article-remove-leading-whitespace
)
2145 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
2147 "f" gnus-summary-fetch-faq
2148 "d" gnus-summary-describe-group
2149 "h" gnus-summary-describe-briefly
2150 "i" gnus-info-find-node
2151 "c" gnus-group-fetch-charter
2152 "C" gnus-group-fetch-control
)
2154 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
2155 "e" gnus-summary-expire-articles
2156 "\M-\C-e" gnus-summary-expire-articles-now
2157 "\177" gnus-summary-delete-article
2158 [delete] gnus-summary-delete-article
2159 [backspace] gnus-summary-delete-article
2160 "m" gnus-summary-move-article
2161 "r" gnus-summary-respool-article
2162 "w" gnus-summary-edit-article
2163 "c" gnus-summary-copy-article
2164 "B" gnus-summary-crosspost-article
2165 "q" gnus-summary-respool-query
2166 "t" gnus-summary-respool-trace
2167 "i" gnus-summary-import-article
2168 "I" gnus-summary-create-article
2169 "p" gnus-summary-article-posted-p)
2171 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2172 "o" gnus-summary-save-article
2173 "m" gnus-summary-save-article-mail
2174 "F" gnus-summary-write-article-file
2175 "r" gnus-summary-save-article-rmail
2176 "f" gnus-summary-save-article-file
2177 "b" gnus-summary-save-article-body-file
2178 "B" gnus-summary-write-article-body-file
2179 "h" gnus-summary-save-article-folder
2180 "v" gnus-summary-save-article-vm
2181 "p" gnus-summary-pipe-output
2182 "P" gnus-summary-muttprint
2183 "s" gnus-soup-add-article)
2185 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2186 "b" gnus-summary-display-buttonized
2187 "m" gnus-summary-repair-multipart
2188 "v" gnus-article-view-part
2189 "o" gnus-article-save-part
2190 "O" gnus-article-save-part-and-strip
2191 "r" gnus-article-replace-part
2192 "d" gnus-article-delete-part
2193 "t" gnus-article-view-part-as-type
2194 "j" gnus-article-jump-to-part
2195 "c" gnus-article-copy-part
2196 "C" gnus-article-view-part-as-charset
2197 "e" gnus-article-view-part-externally
2198 "H" gnus-article-browse-html-article
2199 "E" gnus-article-encrypt-body
2200 "i" gnus-article-inline-part
2201 "|" gnus-article-pipe-part)
2203 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2204 "p" gnus-summary-mark-as-processable
2205 "u" gnus-summary-unmark-as-processable
2206 "U" gnus-summary-unmark-all-processable
2207 "v" gnus-uu-mark-over
2208 "s" gnus-uu-mark-series
2209 "r" gnus-uu-mark-region
2210 "g" gnus-uu-unmark-region
2211 "R" gnus-uu-mark-by-regexp
2212 "G" gnus-uu-unmark-by-regexp
2213 "t" gnus-uu-mark-thread
2214 "T" gnus-uu-unmark-thread
2215 "a" gnus-uu-mark-all
2216 "b" gnus-uu-mark-buffer
2217 "S" gnus-uu-mark-sparse
2218 "k" gnus-summary-kill-process-mark
2219 "y" gnus-summary-yank-process-mark
2220 "w" gnus-summary-save-process-mark
2221 "i" gnus-uu-invert-processable)
2223 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2224 ;;"x" gnus-uu-extract-any
2225 "m" gnus-summary-save-parts
2226 "u" gnus-uu-decode-uu
2227 "U" gnus-uu-decode-uu-and-save
2228 "s" gnus-uu-decode-unshar
2229 "S" gnus-uu-decode-unshar-and-save
2230 "o" gnus-uu-decode-save
2231 "O" gnus-uu-decode-save
2232 "b" gnus-uu-decode-binhex
2233 "B" gnus-uu-decode-binhex
2234 "Y" gnus-uu-decode-yenc
2235 "p" gnus-uu-decode-postscript
2236 "P" gnus-uu-decode-postscript-and-save)
2239 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2240 "u" gnus-uu-decode-uu-view
2241 "U" gnus-uu-decode-uu-and-save-view
2242 "s" gnus-uu-decode-unshar-view
2243 "S" gnus-uu-decode-unshar-and-save-view
2244 "o" gnus-uu-decode-save-view
2245 "O" gnus-uu-decode-save-view
2246 "b" gnus-uu-decode-binhex-view
2247 "B" gnus-uu-decode-binhex-view
2248 "p" gnus-uu-decode-postscript-view
2249 "P" gnus-uu-decode-postscript-and-save-view)
2251 (defvar gnus-article-post-menu nil)
2253 (defconst gnus-summary-menu-maxlen 20)
2255 (defun gnus-summary-menu-split (menu)
2256 ;; If we have lots of elements, divide them into groups of 20
2257 ;; and make a pane (or submenu) for each one.
2258 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2259 (let ((menu menu) sublists next
2262 ;; Pull off the next gnus-summary-menu-maxlen elements
2263 ;; and make them the next element of sublist.
2264 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2266 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2268 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2269 (aref (car (last menu)) 0)) menu)
2273 (nreverse sublists))
2274 ;; Few elements--put them all in one pane.
2277 (defun gnus-summary-make-menu-bar ()
2278 (gnus-turn-off-edit-menu 'summary)
2280 (unless (boundp 'gnus-summary-misc-menu)
2283 gnus-summary-kill-menu gnus-summary-mode-map ""
2288 ["Customize" gnus-score-customize t])
2289 (gnus-make-score-map 'increase)
2290 (gnus-make-score-map 'lower)
2292 ["Kill below" gnus-summary-kill-below t]
2293 ["Mark above" gnus-summary-mark-above t]
2294 ["Tick above" gnus-summary-tick-above t]
2295 ["Clear above" gnus-summary-clear-above t])
2296 ["Current score" gnus-summary-current-score t]
2297 ["Set score" gnus-summary-set-score t]
2298 ["Switch current score file..." gnus-score-change-score-file t]
2299 ["Set mark below..." gnus-score-set-mark-below t]
2300 ["Set expunge below..." gnus-score-set-expunge-below t]
2301 ["Edit current score file" gnus-score-edit-current-scores t]
2302 ["Edit score file..." gnus-score-edit-file t]
2303 ["Trace score" gnus-score-find-trace t]
2304 ["Find words" gnus-score-find-favourite-words t]
2305 ["Rescore buffer" gnus-summary-rescore t]
2306 ["Increase score..." gnus-summary-increase-score t]
2307 ["Lower score..." gnus-summary-lower-score t]))))
2309 ;; Define both the Article menu in the summary buffer and the
2310 ;; equivalent Commands menu in the article buffer here for
2314 ["All" gnus-article-hide t]
2315 ["Headers" gnus-article-hide-headers t]
2316 ["Signature" gnus-article-hide-signature t]
2317 ["Citation" gnus-article-hide-citation t]
2318 ["List identifiers" gnus-article-hide-list-identifiers t]
2319 ["Banner" gnus-article-strip-banner t]
2320 ["Boring headers" gnus-article-hide-boring-headers t])
2322 ["All" gnus-article-highlight t]
2323 ["Headers" gnus-article-highlight-headers t]
2324 ["Signature" gnus-article-highlight-signature t]
2325 ["Citation" gnus-article-highlight-citation t])
2327 ["Words" gnus-article-decode-mime-words t]
2328 ["Charset" gnus-article-decode-charset t]
2329 ["QP" gnus-article-de-quoted-unreadable t]
2330 ["Base64" gnus-article-de-base64-unreadable t]
2331 ["View MIME buttons" gnus-summary-display-buttonized t]
2332 ["View all" gnus-mime-view-all-parts t]
2333 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2334 ["Encrypt body" gnus-article-encrypt-body
2335 :active (not (gnus-group-read-only-p))
2336 ,@(if (featurep 'xemacs) nil
2337 '(:help "Encrypt the message body on disk"))]
2338 ["Extract all parts..." gnus-summary-save-parts t]
2340 ["Repair multipart" gnus-summary-repair-multipart t]
2341 ["Pipe part..." gnus-article-pipe-part t]
2342 ["Inline part" gnus-article-inline-part t]
2343 ["View part as type..." gnus-article-view-part-as-type t]
2344 ["Encrypt body" gnus-article-encrypt-body
2345 :active (not (gnus-group-read-only-p))
2346 ,@(if (featurep 'xemacs) nil
2347 '(:help "Encrypt the message body on disk"))]
2348 ["View part externally" gnus-article-view-part-externally t]
2349 ["View HTML parts in browser" gnus-article-browse-html-article t]
2350 ["View part with charset..." gnus-article-view-part-as-charset t]
2351 ["Copy part" gnus-article-copy-part t]
2352 ["Save part..." gnus-article-save-part t]
2353 ["View part" gnus-article-view-part t]))
2355 ["Local" gnus-article-date-local t]
2356 ["ISO8601" gnus-article-date-iso8601 t]
2357 ["UT" gnus-article-date-ut t]
2358 ["Original" gnus-article-date-original t]
2359 ["Lapsed" gnus-article-date-lapsed t]
2360 ["User-defined" gnus-article-date-user t])
2362 ["Remove images" gnus-article-remove-images t]
2363 ["Toggle smiley" gnus-treat-smiley t]
2364 ["Show X-Face" gnus-article-display-x-face t]
2365 ["Show picons in From" gnus-treat-from-picon t]
2366 ["Show picons in mail headers" gnus-treat-mail-picon t]
2367 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2368 ("View as different encoding"
2369 ,@(gnus-summary-menu-split
2372 ;; Since easymenu under Emacs doesn't allow
2373 ;; lambda forms for menu commands, we should
2374 ;; provide intern'ed function symbols.
2375 (let ((command (intern (format "\
2376 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2380 (let ((gnus-summary-show-article-charset-alist
2382 (gnus-summary-show-article 1))))
2383 `[,(symbol-name cs) ,command t]))
2384 (sort (if (fboundp 'coding-system-list)
2385 (coding-system-list)
2386 (mapcar 'car mm-mime-mule-charset-alist))
2390 ["Leading" gnus-article-strip-leading-blank-lines t]
2391 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2392 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2393 ["All of the above" gnus-article-strip-blank-lines t]
2394 ["All" gnus-article-strip-all-blank-lines t]
2395 ["Leading space" gnus-article-strip-leading-space t]
2396 ["Trailing space" gnus-article-strip-trailing-space t]
2397 ["Leading space in headers"
2398 gnus-article-remove-leading-whitespace t])
2399 ["Overstrike" gnus-article-treat-overstrike t]
2400 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2401 ["Emphasis" gnus-article-emphasize t]
2402 ["Word wrap" gnus-article-fill-cited-article t]
2403 ["Fill long lines" gnus-article-fill-long-lines t]
2404 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2405 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2406 ["Remove CR" gnus-article-remove-cr t]
2407 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2408 ["Base64" gnus-article-de-base64-unreadable t]
2409 ["Rot 13" gnus-summary-caesar-message
2410 ,@(if (featurep 'xemacs) '(t)
2411 '(:help "\"Caesar rotate\" article by 13"))]
2412 ["De-IDNA" gnus-summary-idna-message t]
2413 ["Morse decode" gnus-summary-morse-message t]
2414 ["Unix pipe..." gnus-summary-pipe-message t]
2415 ["Add buttons" gnus-article-add-buttons t]
2416 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2417 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2418 ["Verbose header" gnus-summary-verbose-headers t]
2419 ["Toggle header" gnus-summary-toggle-header t]
2420 ["Unfold headers" gnus-article-treat-unfold-headers t]
2421 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2422 ["Html" gnus-article-wash-html t]
2423 ["Unsplit URLs" gnus-article-unsplit-urls t]
2424 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2425 ["Decode HZ" gnus-article-decode-HZ t]
2426 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2427 ("(Outlook) Deuglify"
2428 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2429 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2430 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2431 ["Full (Outlook) deuglify"
2432 gnus-article-outlook-deuglify-article t])
2435 ["Save in default format..." gnus-summary-save-article
2436 ,@(if (featurep 'xemacs) '(t)
2437 '(:help "Save article using default method"))]
2438 ["Save in file..." gnus-summary-save-article-file
2439 ,@(if (featurep 'xemacs) '(t)
2440 '(:help "Save article in file"))]
2441 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2442 ["Save in MH folder..." gnus-summary-save-article-folder t]
2443 ["Save in VM folder..." gnus-summary-save-article-vm t]
2444 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2445 ["Save body in file..." gnus-summary-save-article-body-file t]
2446 ["Pipe through a filter..." gnus-summary-pipe-output t]
2447 ["Add to SOUP packet" gnus-soup-add-article t]
2448 ["Print with Muttprint..." gnus-summary-muttprint t]
2449 ["Print" gnus-summary-print-article
2450 ,@(if (featurep 'xemacs) '(t)
2451 '(:help "Generate and print a PostScript image"))])
2452 ("Copy, move,... (Backend)"
2453 ,@(if (featurep 'xemacs) nil
2454 '(:help "Copying, moving, expiring articles..."))
2455 ["Respool article..." gnus-summary-respool-article t]
2456 ["Move article..." gnus-summary-move-article
2457 (gnus-check-backend-function
2458 'request-move-article gnus-newsgroup-name)]
2459 ["Copy article..." gnus-summary-copy-article t]
2460 ["Crosspost article..." gnus-summary-crosspost-article
2461 (gnus-check-backend-function
2462 'request-replace-article gnus-newsgroup-name)]
2463 ["Import file..." gnus-summary-import-article
2464 (gnus-check-backend-function
2465 'request-accept-article gnus-newsgroup-name)]
2466 ["Create article..." gnus-summary-create-article
2467 (gnus-check-backend-function
2468 'request-accept-article gnus-newsgroup-name)]
2469 ["Check if posted" gnus-summary-article-posted-p t]
2470 ["Edit article" gnus-summary-edit-article
2471 (not (gnus-group-read-only-p))]
2472 ["Delete article" gnus-summary-delete-article
2473 (gnus-check-backend-function
2474 'request-expire-articles gnus-newsgroup-name)]
2475 ["Query respool" gnus-summary-respool-query t]
2476 ["Trace respool" gnus-summary-respool-trace t]
2477 ["Delete expirable articles" gnus-summary-expire-articles-now
2478 (gnus-check-backend-function
2479 'request-expire-articles gnus-newsgroup-name)])
2481 ["Uudecode" gnus-uu-decode-uu
2482 ,@(if (featurep 'xemacs) '(t)
2483 '(:help "Decode uuencoded article(s)"))]
2484 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2485 ["Unshar" gnus-uu-decode-unshar t]
2486 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2487 ["Save" gnus-uu-decode-save t]
2488 ["Binhex" gnus-uu-decode-binhex t]
2489 ["Postscript" gnus-uu-decode-postscript t]
2490 ["All MIME parts" gnus-summary-save-parts t])
2492 ["Enter article" gnus-cache-enter-article t]
2493 ["Remove article" gnus-cache-remove-article t])
2494 ["Translate" gnus-article-babel t]
2495 ["Select article buffer" gnus-summary-select-article-buffer t]
2496 ["Make article buffer sticky" gnus-sticky-article t]
2497 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2498 ["Isearch article..." gnus-summary-isearch-article t]
2499 ["Beginning of the article" gnus-summary-beginning-of-article t]
2500 ["End of the article" gnus-summary-end-of-article t]
2501 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2502 ["Fetch referenced articles" gnus-summary-refer-references t]
2503 ["Fetch current thread" gnus-summary-refer-thread t]
2504 ["Fetch article with id..." gnus-summary-refer-article t]
2505 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2506 ["Redisplay" gnus-summary-show-article t]
2507 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2509 gnus-summary-article-menu gnus-summary-mode-map ""
2510 (cons "Article" innards))
2512 (if (not (keymapp gnus-summary-article-menu))
2514 gnus-article-commands-menu gnus-article-mode-map ""
2515 (cons "Commands" innards))
2516 ;; in Emacs, don't share menu.
2517 (setq gnus-article-commands-menu
2518 (copy-keymap gnus-summary-article-menu))
2519 (define-key gnus-article-mode-map [menu-bar commands]
2520 (cons "Commands" gnus-article-commands-menu))))
2523 gnus-summary-thread-menu gnus-summary-mode-map ""
2525 ["Find all messages in thread" gnus-summary-refer-thread t]
2526 ["Toggle threading" gnus-summary-toggle-threads t]
2527 ["Hide threads" gnus-summary-hide-all-threads t]
2528 ["Show threads" gnus-summary-show-all-threads t]
2529 ["Hide thread" gnus-summary-hide-thread t]
2530 ["Show thread" gnus-summary-show-thread t]
2531 ["Go to next thread" gnus-summary-next-thread t]
2532 ["Go to previous thread" gnus-summary-prev-thread t]
2533 ["Go down thread" gnus-summary-down-thread t]
2534 ["Go up thread" gnus-summary-up-thread t]
2535 ["Top of thread" gnus-summary-top-thread t]
2536 ["Mark thread as read" gnus-summary-kill-thread t]
2537 ["Mark thread as expired" gnus-summary-expire-thread t]
2538 ["Lower thread score" gnus-summary-lower-thread t]
2539 ["Raise thread score" gnus-summary-raise-thread t]
2540 ["Rethread current" gnus-summary-rethread-current t]))
2543 gnus-summary-post-menu gnus-summary-mode-map ""
2545 ["Send a message (mail or news)" gnus-summary-post-news
2546 ,@(if (featurep 'xemacs) '(t)
2547 '(:help "Compose a new message (mail or news)"))]
2548 ["Followup" gnus-summary-followup
2549 ,@(if (featurep 'xemacs) '(t)
2550 '(:help "Post followup to this article"))]
2551 ["Followup and yank" gnus-summary-followup-with-original
2552 ,@(if (featurep 'xemacs) '(t)
2553 '(:help "Post followup to this article, quoting its contents"))]
2554 ["Supersede article" gnus-summary-supersede-article t]
2555 ["Cancel article" gnus-summary-cancel-article
2556 ,@(if (featurep 'xemacs) '(t)
2557 '(:help "Cancel an article you posted"))]
2558 ["Reply" gnus-summary-reply t]
2559 ["Reply and yank" gnus-summary-reply-with-original t]
2560 ["Wide reply" gnus-summary-wide-reply t]
2561 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2562 ,@(if (featurep 'xemacs) '(t)
2563 '(:help "Mail a reply, quoting this article"))]
2564 ["Very wide reply" gnus-summary-very-wide-reply t]
2565 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2566 ,@(if (featurep 'xemacs) '(t)
2567 '(:help "Mail a very wide reply, quoting this article"))]
2568 ["Mail forward" gnus-summary-mail-forward t]
2569 ["Post forward" gnus-summary-post-forward t]
2570 ["Digest and mail" gnus-uu-digest-mail-forward t]
2571 ["Digest and post" gnus-uu-digest-post-forward t]
2572 ["Resend message" gnus-summary-resend-message t]
2573 ["Resend message edit" gnus-summary-resend-message-edit t]
2574 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2575 ["Send a mail" gnus-summary-mail-other-window t]
2576 ["Create a local message" gnus-summary-news-other-window t]
2577 ["Uuencode and post" gnus-uu-post-news
2578 ,@(if (featurep 'xemacs) '(t)
2579 '(:help "Post a uuencoded article"))]
2580 ["Followup via news" gnus-summary-followup-to-mail t]
2581 ["Followup via news and yank"
2582 gnus-summary-followup-to-mail-with-original t]
2583 ["Strip signature on reply"
2586 (if (not (memq message-cite-function
2587 '(message-cite-original-without-signature
2588 message-cite-original)))
2589 ;; Stupid workaround for XEmacs not honoring :visible.
2590 (message "Can't toggle this value of `message-cite-function'")
2591 (setq message-cite-function
2592 (if (eq message-cite-function
2593 'message-cite-original-without-signature)
2594 'message-cite-original
2595 'message-cite-original-without-signature))))
2596 ;; XEmacs barfs on :visible.
2597 ,@(if (featurep 'xemacs) nil
2598 '(:visible (memq message-cite-function
2599 '(message-cite-original-without-signature
2600 message-cite-original))))
2602 :selected (eq message-cite-function
2603 'message-cite-original-without-signature)
2604 ,@(if (featurep 'xemacs) nil
2605 '(:help "Strip signature from cited article when replying."))]
2607 ;;["Send" gnus-summary-send-draft t]
2608 ;;["Send bounced" gnus-resend-bounced-mail t])
2612 ((not (keymapp gnus-summary-post-menu))
2613 (setq gnus-article-post-menu gnus-summary-post-menu))
2614 ((not gnus-article-post-menu)
2615 ;; Don't share post menu.
2616 (setq gnus-article-post-menu
2617 (copy-keymap gnus-summary-post-menu))))
2618 (define-key gnus-article-mode-map [menu-bar post]
2619 (cons "Post" gnus-article-post-menu))
2622 gnus-summary-misc-menu gnus-summary-mode-map ""
2625 ["Mark as read" gnus-summary-mark-as-read-forward t]
2626 ["Mark same subject and select"
2627 gnus-summary-kill-same-subject-and-select t]
2628 ["Mark same subject" gnus-summary-kill-same-subject t]
2629 ["Catchup" gnus-summary-catchup
2630 ,@(if (featurep 'xemacs) '(t)
2631 '(:help "Mark unread articles in this group as read"))]
2632 ["Catchup all" gnus-summary-catchup-all t]
2633 ["Catchup to here" gnus-summary-catchup-to-here t]
2634 ["Catchup from here" gnus-summary-catchup-from-here t]
2635 ["Catchup region" gnus-summary-mark-region-as-read
2636 (gnus-mark-active-p)]
2637 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2639 ["Tick" gnus-summary-tick-article-forward t]
2640 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2641 ["Remove marks" gnus-summary-clear-mark-forward t]
2642 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2643 ["Set bookmark" gnus-summary-set-bookmark t]
2644 ["Remove bookmark" gnus-summary-remove-bookmark t])
2646 ["Marks..." gnus-summary-limit-to-marks t]
2647 ["Subject..." gnus-summary-limit-to-subject t]
2648 ["Author..." gnus-summary-limit-to-author t]
2649 ["Recipient..." gnus-summary-limit-to-recipient t]
2650 ["Address..." gnus-summary-limit-to-address t]
2651 ["Age..." gnus-summary-limit-to-age t]
2652 ["Extra..." gnus-summary-limit-to-extra t]
2653 ["Score..." gnus-summary-limit-to-score t]
2654 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2655 ["Unread" gnus-summary-limit-to-unread t]
2656 ["Unseen" gnus-summary-limit-to-unseen t]
2657 ["Singletons" gnus-summary-limit-to-singletons t]
2658 ["Replied" gnus-summary-limit-to-replied t]
2659 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2660 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2661 ["Pop limit" gnus-summary-pop-limit t]
2662 ["Show dormant" gnus-summary-limit-include-dormant t]
2663 ["Hide childless dormant"
2664 gnus-summary-limit-exclude-childless-dormant t]
2665 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2666 ["Hide marked" gnus-summary-limit-exclude-marks t]
2667 ["Show expunged" gnus-summary-limit-include-expunged t])
2669 ["Set mark" gnus-summary-mark-as-processable t]
2670 ["Remove mark" gnus-summary-unmark-as-processable t]
2671 ["Remove all marks" gnus-summary-unmark-all-processable t]
2672 ["Invert marks" gnus-uu-invert-processable t]
2673 ["Mark above" gnus-uu-mark-over t]
2674 ["Mark series" gnus-uu-mark-series t]
2675 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2676 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2677 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2678 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2679 ["Mark all" gnus-uu-mark-all t]
2680 ["Mark buffer" gnus-uu-mark-buffer t]
2681 ["Mark sparse" gnus-uu-mark-sparse t]
2682 ["Mark thread" gnus-uu-mark-thread t]
2683 ["Unmark thread" gnus-uu-unmark-thread t]
2684 ("Process Mark Sets"
2685 ["Kill" gnus-summary-kill-process-mark t]
2686 ["Yank" gnus-summary-yank-process-mark
2687 gnus-newsgroup-process-stack]
2688 ["Save" gnus-summary-save-process-mark t]
2689 ["Run command on marked..." gnus-summary-universal-argument t]))
2692 ["Page forward" gnus-summary-next-page
2693 ,@(if (featurep 'xemacs) '(t)
2694 '(:help "Show next page of article"))]
2695 ["Page backward" gnus-summary-prev-page
2696 ,@(if (featurep 'xemacs) '(t)
2697 '(:help "Show previous page of article"))]
2698 ["Line forward" gnus-summary-scroll-up t])
2700 ["Next unread article" gnus-summary-next-unread-article t]
2701 ["Previous unread article" gnus-summary-prev-unread-article t]
2702 ["Next article" gnus-summary-next-article t]
2703 ["Previous article" gnus-summary-prev-article t]
2704 ["Next unread subject" gnus-summary-next-unread-subject t]
2705 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2706 ["Next article same subject" gnus-summary-next-same-subject t]
2707 ["Previous article same subject" gnus-summary-prev-same-subject t]
2708 ["First unread article" gnus-summary-first-unread-article t]
2709 ["Best unread article" gnus-summary-best-unread-article t]
2710 ["Go to subject number..." gnus-summary-goto-subject t]
2711 ["Go to article number..." gnus-summary-goto-article t]
2712 ["Go to the last article" gnus-summary-goto-last-article t]
2713 ["Pop article off history" gnus-summary-pop-article t])
2715 ["Sort by number" gnus-summary-sort-by-number t]
2716 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2717 ["Sort by author" gnus-summary-sort-by-author t]
2718 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2719 ["Sort by subject" gnus-summary-sort-by-subject t]
2720 ["Sort by date" gnus-summary-sort-by-date t]
2721 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2722 ["Sort by score" gnus-summary-sort-by-score t]
2723 ["Sort by lines" gnus-summary-sort-by-lines t]
2724 ["Sort by characters" gnus-summary-sort-by-chars t]
2725 ["Randomize" gnus-summary-sort-by-random t]
2726 ["Original sort" gnus-summary-sort-by-original t])
2728 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2729 ["Describe group" gnus-summary-describe-group t]
2730 ["Fetch charter" gnus-group-fetch-charter
2731 ,@(if (featurep 'xemacs) nil
2732 '(:help "Display the charter of the current group"))]
2733 ["Fetch control message" gnus-group-fetch-control
2734 ,@(if (featurep 'xemacs) nil
2735 '(:help "Display the archived control message for the current group"))]
2736 ["Read manual" gnus-info-find-node t])
2738 ["Pick and read" gnus-pick-mode t]
2739 ["Binary" gnus-binary-mode t])
2741 ["Regenerate" gnus-summary-prepare t]
2742 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2743 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2744 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2745 ["Toggle threading" gnus-summary-toggle-threads t])
2746 ["See old articles" gnus-summary-insert-old-articles t]
2747 ["See new articles" gnus-summary-insert-new-articles t]
2748 ["Filter articles..." gnus-summary-execute-command t]
2749 ["Run command on articles..." gnus-summary-universal-argument t]
2750 ["Search articles forward..." gnus-summary-search-article-forward t]
2751 ["Search articles backward..." gnus-summary-search-article-backward t]
2752 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2753 ["Expand window" gnus-summary-expand-window t]
2754 ["Expire expirable articles" gnus-summary-expire-articles
2755 (gnus-check-backend-function
2756 'request-expire-articles gnus-newsgroup-name)]
2757 ["Edit local kill file" gnus-summary-edit-local-kill t]
2758 ["Edit main kill file" gnus-summary-edit-global-kill t]
2759 ["Edit group parameters" gnus-summary-edit-parameters t]
2760 ["Customize group parameters" gnus-summary-customize-parameters t]
2761 ["Send a bug report" gnus-bug t]
2763 ["Catchup and exit" gnus-summary-catchup-and-exit
2764 ,@(if (featurep 'xemacs) '(t)
2765 '(:help "Mark unread articles in this group as read, then exit"))]
2766 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2767 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2768 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2769 ["Exit group" gnus-summary-exit
2770 ,@(if (featurep 'xemacs) '(t)
2771 '(:help "Exit current group, return to group selection mode"))]
2772 ["Exit group without updating" gnus-summary-exit-no-update t]
2773 ["Exit and goto next group" gnus-summary-next-group t]
2774 ["Exit and goto prev group" gnus-summary-prev-group t]
2775 ["Reselect group" gnus-summary-reselect-current-group t]
2776 ["Rescan group" gnus-summary-rescan-group t]
2777 ["Update dribble" gnus-summary-save-newsrc t])))
2779 (gnus-run-hooks 'gnus-summary-menu-hook)))
2781 (defvar gnus-summary-tool-bar-map nil)
2783 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2784 ;; affect _new_ message buffers. We might add a function that walks thru all
2785 ;; summary-mode buffers and force the update.
2786 (defun gnus-summary-tool-bar-update (&optional symbol value)
2787 "Update summary mode toolbar.
2788 Setter function for custom variables."
2789 (setq-default gnus-summary-tool-bar-map nil)
2791 ;; When used as ":set" function:
2792 (set-default symbol value))
2793 (when (gnus-buffer-live-p gnus-summary-buffer)
2794 (with-current-buffer gnus-summary-buffer
2795 (gnus-summary-make-tool-bar))))
2797 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2798 'gnus-summary-tool-bar-gnome
2799 'gnus-summary-tool-bar-retro)
2800 "Specifies the Gnus summary tool bar.
2802 It can be either a list or a symbol refering to a list. See
2803 `gmm-tool-bar-from-list' for the format of the list. The
2804 default key map is `gnus-summary-mode-map'.
2806 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2807 `gnus-summary-tool-bar-retro'."
2808 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2809 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2810 (repeat :tag "User defined list" gmm-tool-bar-item)
2812 :version "23.1" ;; No Gnus
2813 :initialize 'custom-initialize-default
2814 :set 'gnus-summary-tool-bar-update
2815 :group 'gnus-summary)
2817 (defcustom gnus-summary-tool-bar-gnome
2818 '((gnus-summary-post-news "mail/compose" nil)
2819 (gnus-summary-insert-new-articles "mail/inbox" nil
2820 :visible (or (not gnus-agent)
2822 (gnus-summary-reply-with-original "mail/reply")
2823 (gnus-summary-reply "mail/reply" nil :visible nil)
2824 (gnus-summary-followup-with-original "mail/reply-all")
2825 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2826 (gnus-summary-mail-forward "mail/forward")
2827 (gnus-summary-save-article "mail/save")
2828 (gnus-summary-search-article-forward "search" nil :visible nil)
2829 (gnus-summary-print-article "print")
2830 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2831 ;; Some new commands that may need more suitable icons:
2832 (gnus-summary-save-newsrc "save" nil :visible nil)
2833 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2834 (gnus-summary-prev-article "left-arrow")
2835 (gnus-summary-next-article "right-arrow")
2836 (gnus-summary-next-page "next-page")
2837 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2839 ;; Maybe some sort-by-... could be added:
2840 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2841 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2842 (gnus-summary-mark-as-expirable
2844 :visible (gnus-check-backend-function 'request-expire-articles
2845 gnus-newsgroup-name))
2846 (gnus-summary-mark-as-spam
2848 :visible (and (fboundp 'spam-group-ham-contents-p)
2849 (spam-group-ham-contents-p gnus-newsgroup-name))
2850 :help "Mark as spam")
2851 (gnus-summary-mark-as-read-forward
2853 :visible (and (fboundp 'spam-group-spam-contents-p)
2854 (spam-group-spam-contents-p gnus-newsgroup-name)))
2856 (gnus-summary-exit "exit")
2857 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2858 (gnus-info-find-node "help"))
2859 "List of functions for the summary tool bar (GNOME style).
2861 See `gmm-tool-bar-from-list' for the format of the list."
2862 :type '(repeat gmm-tool-bar-item)
2863 :version "23.1" ;; No Gnus
2864 :initialize 'custom-initialize-default
2865 :set 'gnus-summary-tool-bar-update
2866 :group 'gnus-summary)
2868 (defcustom gnus-summary-tool-bar-retro
2869 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2870 (gnus-summary-next-unread-article "gnus/next-ur")
2871 (gnus-summary-post-news "gnus/post")
2872 (gnus-summary-followup-with-original "gnus/fuwo")
2873 (gnus-summary-followup "gnus/followup")
2874 (gnus-summary-reply-with-original "gnus/reply-wo")
2875 (gnus-summary-reply "gnus/reply")
2876 (gnus-summary-caesar-message "gnus/rot13")
2877 (gnus-uu-decode-uu "gnus/uu-decode")
2878 (gnus-summary-save-article-file "gnus/save-aif")
2879 (gnus-summary-save-article "gnus/save-art")
2880 (gnus-uu-post-news "gnus/uu-post")
2881 (gnus-summary-catchup "gnus/catchup")
2882 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2883 (gnus-summary-exit "gnus/exit-summ")
2884 ;; Some new command that may need more suitable icons:
2885 (gnus-summary-print-article "gnus/print" nil :visible nil)
2886 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2887 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2888 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2889 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2890 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2891 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2893 (gnus-info-find-node "gnus/help" nil :visible nil))
2894 "List of functions for the summary tool bar (retro look).
2896 See `gmm-tool-bar-from-list' for the format of the list."
2897 :type '(repeat gmm-tool-bar-item)
2898 :version "23.1" ;; No Gnus
2899 :initialize 'custom-initialize-default
2900 :set 'gnus-summary-tool-bar-update
2901 :group 'gnus-summary)
2903 (defcustom gnus-summary-tool-bar-zap-list t
2904 "List of icon items from the global tool bar.
2905 These items are not displayed in the Gnus summary mode tool bar.
2907 See `gmm-tool-bar-from-list' for the format of the list."
2908 :type 'gmm-tool-bar-zap-list
2909 :version "23.1" ;; No Gnus
2910 :initialize 'custom-initialize-default
2911 :set 'gnus-summary-tool-bar-update
2912 :group 'gnus-summary)
2914 (defvar image-load-path)
2915 (defvar tool-bar-map)
2917 (defun gnus-summary-make-tool-bar (&optional force)
2918 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2919 When FORCE, rebuild the tool bar."
2920 (when (and (not (featurep 'xemacs))
2921 (boundp 'tool-bar-mode)
2923 (or (not gnus-summary-tool-bar-map) force))
2925 (gmm-image-load-path-for-library "gnus"
2928 (image-load-path (cons (car load-path)
2929 (when (boundp 'image-load-path)
2931 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2932 gnus-summary-tool-bar-zap-list
2933 'gnus-summary-mode-map)))
2935 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2937 (setq gnus-summary-tool-bar-map map))))
2938 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2940 (defun gnus-score-set-default (var value)
2941 "A version of set that updates the GNU Emacs menu-bar."
2943 ;; It is the message that forces the active status to be updated.
2946 (defun gnus-make-score-map (type)
2947 "Make a summary score map of type TYPE."
2950 (let ((headers '(("author" "from" string)
2951 ("subject" "subject" string)
2952 ("article body" "body" string)
2953 ("article head" "head" string)
2954 ("xref" "xref" string)
2955 ("extra header" "extra" string)
2956 ("lines" "lines" number)
2957 ("followups to author" "followup" string)))
2958 (types '((number ("less than" <)
2961 (string ("substring" s)
2965 (perms '(("temporary" (current-time-string))
2973 (if (eq type 'lower)
2978 (setq header (car headers))
2984 (let ((ts (cdr (assoc (nth 2 header) types)))
3000 'gnus-summary-score-entry
3002 (if (or (string= (nth 1 header)
3004 (string= (nth 1 header)
3007 (list 'gnus-summary-header
3009 (list 'quote (nth 1 (car ts)))
3010 (list 'gnus-score-delta-default
3017 (list (nreverse outp))))
3020 (list (nreverse outt))))
3022 (setq headers (cdr headers)))
3023 (list (nreverse outh))))))))
3026 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3027 (defvar bookmark-make-record-function)
3030 (defun gnus-summary-mode (&optional group)
3031 "Major mode for reading articles.
3033 All normal editing commands are switched off.
3034 \\<gnus-summary-mode-map>
3035 Each line in this buffer represents one article. To read an
3036 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3037 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3040 You can also post articles and send mail from this buffer. To
3041 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3042 of an article, type `\\[gnus-summary-reply]'.
3044 There are approx. one gazillion commands you can execute in this
3045 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3047 The following commands are available:
3049 \\{gnus-summary-mode-map}"
3051 (kill-all-local-variables)
3052 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3053 (gnus-summary-make-local-variables))
3054 (gnus-summary-make-local-variables)
3055 (setq gnus-newsgroup-name group)
3056 (when (gnus-visual-p 'summary-menu 'menu)
3057 (gnus-summary-make-menu-bar)
3058 (gnus-summary-make-tool-bar))
3059 (gnus-make-thread-indent-array)
3060 (gnus-simplify-mode-line)
3061 (setq major-mode 'gnus-summary-mode)
3062 (setq mode-name "Summary")
3063 (use-local-map gnus-summary-mode-map)
3064 (buffer-disable-undo)
3065 (setq buffer-read-only t ;Disable modification
3066 show-trailing-whitespace nil)
3067 (setq truncate-lines t)
3068 (add-to-invisibility-spec '(gnus-sum . t))
3069 (gnus-summary-set-display-table)
3070 (gnus-set-default-directory)
3071 (make-local-variable 'gnus-summary-line-format)
3072 (make-local-variable 'gnus-summary-line-format-spec)
3073 (make-local-variable 'gnus-summary-dummy-line-format)
3074 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3075 (make-local-variable 'gnus-summary-mark-positions)
3076 (gnus-make-local-hook 'pre-command-hook)
3077 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3078 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3079 (turn-on-gnus-mailing-list-mode)
3080 (mm-enable-multibyte)
3081 (set (make-local-variable 'bookmark-make-record-function)
3082 'gnus-summary-bookmark-make-record)
3083 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3084 (gnus-update-summary-mark-positions))
3086 (defun gnus-summary-make-local-variables ()
3087 "Make all the local summary buffer variables."
3089 (dolist (local gnus-summary-local-variables)
3092 (if (eq (cdr local) 'global)
3093 ;; Copy the global value of the variable.
3094 (setq global (symbol-value (car local)))
3095 ;; Use the value from the list.
3096 (setq global (eval (cdr local))))
3097 (set (make-local-variable (car local)) global))
3098 ;; Simple nil-valued local variable.
3099 (set (make-local-variable local) nil)))))
3101 (defun gnus-summary-clear-local-variables ()
3102 (let ((locals gnus-summary-local-variables))
3104 (if (consp (car locals))
3105 (and (symbolp (caar locals))
3106 (set (caar locals) nil))
3107 (and (symbolp (car locals))
3108 (set (car locals) nil)))
3109 (setq locals (cdr locals)))))
3111 ;; Summary data functions.
3113 (defmacro gnus-data-number (data)
3116 (defmacro gnus-data-set-number (data number)
3117 `(setcar ,data ,number))
3119 (defmacro gnus-data-mark (data)
3122 (defmacro gnus-data-set-mark (data mark)
3123 `(setcar (nthcdr 1 ,data) ,mark))
3125 (defmacro gnus-data-pos (data)
3128 (defmacro gnus-data-set-pos (data pos)
3129 `(setcar (nthcdr 2 ,data) ,pos))
3131 (defmacro gnus-data-header (data)
3134 (defmacro gnus-data-set-header (data header)
3135 `(setf (nth 3 ,data) ,header))
3137 (defmacro gnus-data-level (data)
3140 (defmacro gnus-data-unread-p (data)
3141 `(= (nth 1 ,data) gnus-unread-mark))
3143 (defmacro gnus-data-read-p (data)
3144 `(/= (nth 1 ,data) gnus-unread-mark))
3146 (defmacro gnus-data-pseudo-p (data)
3147 `(consp (nth 3 ,data)))
3149 (defmacro gnus-data-find (number)
3150 `(assq ,number gnus-newsgroup-data))
3152 (defmacro gnus-data-find-list (number &optional data)
3153 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3154 (memq (assq ,number bdata)
3157 (defmacro gnus-data-make (number mark pos header level)
3158 `(list ,number ,mark ,pos ,header ,level))
3160 (defun gnus-data-enter (after-article number mark pos header level offset)
3161 (let ((data (gnus-data-find-list after-article)))
3163 (error "No such article: %d" after-article))
3164 (setcdr data (cons (gnus-data-make number mark pos header level)
3166 (setq gnus-newsgroup-data-reverse nil)
3167 (gnus-data-update-list (cddr data) offset)))
3169 (defun gnus-data-enter-list (after-article list &optional offset)
3171 (let ((data (and after-article (gnus-data-find-list after-article)))
3175 (let ((odata gnus-newsgroup-data))
3176 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3178 (gnus-data-update-list odata offset)))
3179 ;; Find the last element in the list to be spliced into the main
3181 (setq list (last list))
3184 (setcdr list gnus-newsgroup-data)
3185 (setq gnus-newsgroup-data ilist)
3187 (gnus-data-update-list (cdr list) offset)))
3188 (setcdr list (cdr data))
3191 (gnus-data-update-list (cdr list) offset))))
3192 (setq gnus-newsgroup-data-reverse nil))))
3194 (defun gnus-data-remove (article &optional offset)
3195 (let ((data gnus-newsgroup-data))
3196 (if (= (gnus-data-number (car data)) article)
3198 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3199 gnus-newsgroup-data-reverse nil)
3201 (gnus-data-update-list gnus-newsgroup-data offset)))
3203 (when (= (gnus-data-number (cadr data)) article)
3204 (setcdr data (cddr data))
3206 (gnus-data-update-list (cdr data) offset))
3208 gnus-newsgroup-data-reverse nil))
3209 (setq data (cdr data))))))
3211 (defmacro gnus-data-list (backward)
3213 (or gnus-newsgroup-data-reverse
3214 (setq gnus-newsgroup-data-reverse
3215 (reverse gnus-newsgroup-data)))
3216 gnus-newsgroup-data))
3218 (defun gnus-data-update-list (data offset)
3219 "Add OFFSET to the POS of all data entries in DATA."
3220 (setq gnus-newsgroup-data-reverse nil)
3222 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3223 (setq data (cdr data))))
3225 (defun gnus-summary-article-pseudo-p (article)
3226 "Say whether this article is a pseudo article or not."
3227 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3229 (defmacro gnus-summary-article-sparse-p (article)
3230 "Say whether this article is a sparse article or not."
3231 `(memq ,article gnus-newsgroup-sparse))
3233 (defmacro gnus-summary-article-ancient-p (article)
3234 "Say whether this article is a sparse article or not."
3235 `(memq ,article gnus-newsgroup-ancient))
3237 (defun gnus-article-parent-p (number)
3238 "Say whether this article is a parent or not."
3239 (let ((data (gnus-data-find-list number)))
3240 (and (cdr data) ; There has to be an article after...
3241 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3242 (gnus-data-level (nth 1 data))))))
3244 (defun gnus-article-children (number)
3245 "Return a list of all children to NUMBER."
3246 (let* ((data (gnus-data-find-list number))
3247 (level (gnus-data-level (car data)))
3249 (setq data (cdr data))
3251 (= (gnus-data-level (car data)) (1+ level)))
3252 (push (gnus-data-number (car data)) children)
3253 (setq data (cdr data)))
3256 (defmacro gnus-summary-skip-intangible ()
3257 "If the current article is intangible, then jump to a different article."
3258 '(let ((to (get-text-property (point) 'gnus-intangible)))
3259 (and to (gnus-summary-goto-subject to))))
3261 (defmacro gnus-summary-article-intangible-p ()
3262 "Say whether this article is intangible or not."
3263 '(get-text-property (point) 'gnus-intangible))
3265 (defun gnus-article-read-p (article)
3266 "Say whether ARTICLE is read or not."
3267 (not (or (memq article gnus-newsgroup-marked)
3268 (memq article gnus-newsgroup-spam-marked)
3269 (memq article gnus-newsgroup-unreads)
3270 (memq article gnus-newsgroup-unselected)
3271 (memq article gnus-newsgroup-dormant))))
3273 ;; Some summary mode macros.
3275 (defmacro gnus-summary-article-number ()
3276 "The article number of the article on the current line.
3277 If there isn't an article number here, then we return the current
3280 (gnus-summary-skip-intangible)
3281 (or (get-text-property (point) 'gnus-number)
3282 (gnus-summary-last-subject))))
3284 (defmacro gnus-summary-article-header (&optional number)
3285 "Return the header of article NUMBER."
3286 `(gnus-data-header (gnus-data-find
3287 ,(or number '(gnus-summary-article-number)))))
3289 (defmacro gnus-summary-thread-level (&optional number)
3290 "Return the level of thread that starts with article NUMBER."
3291 `(if (and (eq gnus-summary-make-false-root 'dummy)
3292 (get-text-property (point) 'gnus-intangible))
3294 (gnus-data-level (gnus-data-find
3295 ,(or number '(gnus-summary-article-number))))))
3297 (defmacro gnus-summary-article-mark (&optional number)
3298 "Return the mark of article NUMBER."
3299 `(gnus-data-mark (gnus-data-find
3300 ,(or number '(gnus-summary-article-number)))))
3302 (defmacro gnus-summary-article-pos (&optional number)
3303 "Return the position of the line of article NUMBER."
3304 `(gnus-data-pos (gnus-data-find
3305 ,(or number '(gnus-summary-article-number)))))
3307 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3308 (defmacro gnus-summary-article-subject (&optional number)
3309 "Return current subject string or nil if nothing."
3312 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3313 '(gnus-data-header (assq (gnus-summary-article-number)
3314 gnus-newsgroup-data)))))
3317 (mail-header-subject headers))))
3319 (defmacro gnus-summary-article-score (&optional number)
3320 "Return current article score."
3321 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3322 gnus-newsgroup-scored))
3323 gnus-summary-default-score 0))
3325 (defun gnus-summary-article-children (&optional number)
3326 "Return a list of article numbers that are children of article NUMBER."
3327 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3328 (level (gnus-data-level (car data)))
3330 (while (and (setq data (cdr data))
3331 (> (setq l (gnus-data-level (car data))) level))
3332 (and (= (1+ level) l)
3333 (push (gnus-data-number (car data))
3335 (nreverse children)))
3337 (defun gnus-summary-article-parent (&optional number)
3338 "Return the article number of the parent of article NUMBER."
3339 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3340 (gnus-data-list t)))
3341 (level (gnus-data-level (car data))))
3343 () ; This is a root.
3344 ;; We search until we find an article with a level less than
3345 ;; this one. That function has to be the parent.
3346 (while (and (setq data (cdr data))
3347 (not (< (gnus-data-level (car data)) level))))
3348 (and data (gnus-data-number (car data))))))
3350 (defun gnus-unread-mark-p (mark)
3351 "Say whether MARK is the unread mark."
3352 (= mark gnus-unread-mark))
3354 (defun gnus-read-mark-p (mark)
3355 "Say whether MARK is one of the marks that mark as read.
3356 This is all marks except unread, ticked, dormant, and expirable."
3357 (not (or (= mark gnus-unread-mark)
3358 (= mark gnus-ticked-mark)
3359 (= mark gnus-spam-mark)
3360 (= mark gnus-dormant-mark)
3361 (= mark gnus-expirable-mark))))
3363 (defmacro gnus-article-mark (number)
3364 "Return the MARK of article NUMBER.
3365 This macro should only be used when computing the mark the \"first\"
3366 time; i.e., when generating the summary lines. After that,
3367 `gnus-summary-article-mark' should be used to examine the
3370 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3371 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3372 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3373 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3374 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3375 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3376 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3377 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3378 gnus-ancient-mark))))
3380 ;; Saving hidden threads.
3382 (defmacro gnus-save-hidden-threads (&rest forms)
3383 "Save hidden threads, eval FORMS, and restore the hidden threads."
3384 (let ((config (make-symbol "config")))
3385 `(let ((,config (gnus-hidden-threads-configuration)))
3389 (gnus-restore-hidden-threads-configuration ,config)))))
3390 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3391 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3393 (defun gnus-data-compute-positions ()
3394 "Compute the positions of all articles."
3395 (setq gnus-newsgroup-data-reverse nil)
3396 (let ((data gnus-newsgroup-data))
3398 (gnus-save-hidden-threads
3399 (gnus-summary-show-all-threads)
3400 (goto-char (point-min))
3402 (while (get-text-property (point) 'gnus-intangible)
3404 (gnus-data-set-pos (car data) (+ (point) 3))
3405 (setq data (cdr data))
3406 (forward-line 1))))))
3408 (defun gnus-hidden-threads-configuration ()
3409 "Return the current hidden threads configuration."
3412 (goto-char (point-min))
3414 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3415 (push (save-excursion (forward-line 0) (point)) config))
3419 (defun gnus-restore-hidden-threads-configuration (config)
3420 "Restore hidden threads configuration from CONFIG."
3422 (let (point (inhibit-read-only t))
3423 (while (setq point (pop config))
3425 (gnus-summary-hide-thread)))))
3427 ;; Various summary mode internalish functions.
3429 (defun gnus-mouse-pick-article (e)
3432 (gnus-summary-next-page nil t))
3434 (defun gnus-summary-set-display-table ()
3435 "Change the display table.
3436 Odd characters have a tendency to mess
3437 up nicely formatted displays - we make all possible glyphs
3438 display only a single character."
3440 ;; We start from the standard display table, if any.
3441 (let ((table (or (copy-sequence standard-display-table)
3442 (make-display-table)))
3444 ;; Nix out all the control chars...
3445 (while (>= (setq i (1- i)) 0)
3446 (gnus-put-display-table i [??] table))
3447 ;; ... but not newline and cr, of course. (cr is necessary for the
3448 ;; selective display).
3449 (gnus-put-display-table ?\n nil table)
3450 (gnus-put-display-table ?\r nil table)
3451 ;; We keep TAB as well.
3452 (gnus-put-display-table ?\t nil table)
3453 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3454 ;; Emacs 23 (unicode), that are not set already.
3455 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3458 (while (>= (setq i (1- i)) 127)
3459 ;; Only modify if the entry is nil.
3460 (unless (gnus-get-display-table i table)
3461 (gnus-put-display-table i [??] table))))
3462 (setq buffer-display-table table)))
3464 (defun gnus-summary-set-article-display-arrow (pos)
3465 "Update the overlay arrow to point to line at position POS."
3466 (when gnus-summary-display-arrow
3467 (make-local-variable 'overlay-arrow-position)
3468 (make-local-variable 'overlay-arrow-string)
3472 (unless overlay-arrow-position
3473 (setq overlay-arrow-position (make-marker)))
3474 (setq overlay-arrow-string "=>"
3475 overlay-arrow-position (set-marker overlay-arrow-position
3477 (current-buffer))))))
3479 (defun gnus-summary-setup-buffer (group)
3480 "Initialize summary buffer."
3481 (let ((buffer (gnus-summary-buffer-name group))
3482 (dead-name (concat "*Dead Summary "
3483 (gnus-group-decoded-name group) "*")))
3484 ;; If a dead summary buffer exists, we kill it.
3485 (when (gnus-buffer-live-p dead-name)
3486 (gnus-kill-buffer dead-name))
3487 (if (get-buffer buffer)
3490 (setq gnus-summary-buffer (current-buffer))
3491 (not gnus-newsgroup-prepared))
3492 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3493 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3494 (gnus-summary-mode group)
3496 (gnus-carpal-setup-buffer 'summary))
3497 (when (gnus-group-quit-config group)
3498 (set (make-local-variable 'gnus-single-article-buffer) nil))
3499 (make-local-variable 'gnus-article-buffer)
3500 (make-local-variable 'gnus-article-current)
3501 (make-local-variable 'gnus-original-article-buffer)
3502 (setq gnus-newsgroup-name group)
3503 ;; Set any local variables in the group parameters.
3504 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3507 (defun gnus-set-global-variables ()
3508 "Set the global equivalents of the buffer-local variables.
3509 They are set to the latest values they had. These reflect the summary
3510 buffer that was in action when the last article was fetched."
3511 (when (eq major-mode 'gnus-summary-mode)
3512 (setq gnus-summary-buffer (current-buffer))
3513 (let ((name gnus-newsgroup-name)
3514 (marked gnus-newsgroup-marked)
3515 (spam gnus-newsgroup-spam-marked)
3516 (unread gnus-newsgroup-unreads)
3517 (headers gnus-current-headers)
3518 (data gnus-newsgroup-data)
3519 (summary gnus-summary-buffer)
3520 (article-buffer gnus-article-buffer)
3521 (original gnus-original-article-buffer)
3522 (gac gnus-article-current)
3523 (reffed gnus-reffed-article-number)
3524 (score-file gnus-current-score-file)
3525 (default-charset gnus-newsgroup-charset)
3527 (let ((locals gnus-newsgroup-variables))
3529 (if (consp (car locals))
3530 (push (eval (caar locals)) vlist)
3531 (push (eval (car locals)) vlist))
3532 (setq locals (cdr locals)))
3533 (setq vlist (nreverse vlist)))
3534 (with-current-buffer gnus-group-buffer
3535 (setq gnus-newsgroup-name name
3536 gnus-newsgroup-marked marked
3537 gnus-newsgroup-spam-marked spam
3538 gnus-newsgroup-unreads unread
3539 gnus-current-headers headers
3540 gnus-newsgroup-data data
3541 gnus-article-current gac
3542 gnus-summary-buffer summary
3543 gnus-article-buffer article-buffer
3544 gnus-original-article-buffer original
3545 gnus-reffed-article-number reffed
3546 gnus-current-score-file score-file
3547 gnus-newsgroup-charset default-charset)
3548 (let ((locals gnus-newsgroup-variables))
3550 (if (consp (car locals))
3551 (set (caar locals) (pop vlist))
3552 (set (car locals) (pop vlist)))
3553 (setq locals (cdr locals))))
3554 ;; The article buffer also has local variables.
3555 (when (gnus-buffer-live-p gnus-article-buffer)
3556 (set-buffer gnus-article-buffer)
3557 (setq gnus-summary-buffer summary))))))
3559 (defun gnus-summary-article-unread-p (article)
3560 "Say whether ARTICLE is unread or not."
3561 (memq article gnus-newsgroup-unreads))
3563 (defun gnus-summary-first-article-p (&optional article)
3564 "Return whether ARTICLE is the first article in the buffer."
3565 (if (not (setq article (or article (gnus-summary-article-number))))
3567 (eq article (caar gnus-newsgroup-data))))
3569 (defun gnus-summary-last-article-p (&optional article)
3570 "Return whether ARTICLE is the last article in the buffer."
3571 (if (not (setq article (or article (gnus-summary-article-number))))
3572 ;; All non-existent numbers are the last article. :-)
3574 (not (cdr (gnus-data-find-list article)))))
3576 (defun gnus-make-thread-indent-array (&optional n)
3578 (progn (setq n 200) nil)
3579 (null gnus-thread-indent-array)
3580 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3581 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3582 gnus-thread-indent-array-level gnus-thread-indent-level)
3584 (aset gnus-thread-indent-array n
3585 (make-string (* n gnus-thread-indent-level) ? ))
3588 (defun gnus-update-summary-mark-positions ()
3589 "Compute where the summary marks are to go."
3591 (when (gnus-buffer-exists-p gnus-summary-buffer)
3592 (set-buffer gnus-summary-buffer))
3593 (let ((spec gnus-summary-line-format-spec)
3596 (gnus-set-work-buffer)
3597 (let ((gnus-tmp-unread ?Z)
3598 (gnus-replied-mark ?Z)
3599 (gnus-score-below-mark ?Z)
3600 (gnus-score-over-mark ?Z)
3601 (gnus-undownloaded-mark ?Z)
3602 (gnus-summary-line-format-spec spec)
3603 (gnus-newsgroup-downloadable '(0))
3604 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3605 case-fold-search ignores)
3606 ;; Here, all marks are bound to Z.
3607 (gnus-summary-insert-line header
3608 0 nil t gnus-tmp-unread t nil "" nil 1)
3609 (goto-char (point-min))
3610 ;; Memorize the positions of the same characters as dummy marks.
3611 (while (re-search-forward "[A-D]" nil t)
3612 (push (point) ignores))
3614 ;; We use A-D as dummy marks in order to know column positions
3615 ;; where marks should be inserted.
3616 (setq gnus-tmp-unread ?A
3617 gnus-replied-mark ?B
3618 gnus-score-below-mark ?C
3619 gnus-score-over-mark ?C
3620 gnus-undownloaded-mark ?D)
3621 (gnus-summary-insert-line header
3622 0 nil t gnus-tmp-unread t nil "" nil 1)
3623 ;; Ignore characters which aren't dummy marks.
3625 (delete-region (goto-char (1- p)) p)
3627 (goto-char (point-min))
3628 (setq pos (list (cons 'unread
3629 (and (search-forward "A" nil t)
3630 (- (point) (point-min) 1)))))
3631 (goto-char (point-min))
3632 (push (cons 'replied (and (search-forward "B" nil t)
3633 (- (point) (point-min) 1)))
3635 (goto-char (point-min))
3636 (push (cons 'score (and (search-forward "C" nil t)
3637 (- (point) (point-min) 1)))
3639 (goto-char (point-min))
3640 (push (cons 'download (and (search-forward "D" nil t)
3641 (- (point) (point-min) 1)))
3643 (setq gnus-summary-mark-positions pos))))
3645 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3646 "Insert a dummy root in the summary buffer."
3648 (gnus-add-text-properties
3649 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3650 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3652 (defun gnus-summary-extract-address-component (from)
3653 (or (car (funcall gnus-extract-address-components from))
3656 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3657 (let ((mail-parse-charset gnus-newsgroup-charset)
3658 (ignored-from-addresses (gnus-ignored-from-addresses))
3659 ; Is it really necessary to do this next part for each summary line?
3660 ; Luckily, doesn't seem to slow things down much.
3661 (mail-parse-ignored-charsets
3662 (with-current-buffer gnus-summary-buffer
3663 gnus-newsgroup-ignored-charsets)))
3665 (and ignored-from-addresses
3666 (string-match ignored-from-addresses gnus-tmp-from)
3667 (let ((extra-headers (mail-header-extra header))
3671 ((setq to (cdr (assq 'To extra-headers)))
3672 (concat gnus-summary-to-prefix
3674 (gnus-summary-extract-address-component
3675 (funcall gnus-decode-encoded-address-function to)))))
3678 (cdr (assq 'Newsgroups extra-headers))
3680 (memq 'Newsgroups gnus-extra-headers)
3681 (eq (car (gnus-find-method-for-group
3682 gnus-newsgroup-name)) 'nntp)
3683 (gnus-group-real-name gnus-newsgroup-name))))
3684 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3685 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3687 (defun gnus-summary-insert-line (gnus-tmp-header
3688 gnus-tmp-level gnus-tmp-current
3689 undownloaded gnus-tmp-unread gnus-tmp-replied
3690 gnus-tmp-expirable gnus-tmp-subject-or-nil
3691 &optional gnus-tmp-dummy gnus-tmp-score
3693 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3694 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3696 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3697 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3698 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3699 (gnus-tmp-score-char
3700 (if (or (null gnus-summary-default-score)
3701 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3702 gnus-summary-zcore-fuzz))
3704 (if (< gnus-tmp-score gnus-summary-default-score)
3705 gnus-score-below-mark gnus-score-over-mark)))
3706 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3708 (cond (gnus-tmp-process gnus-process-mark)
3709 ((memq gnus-tmp-current gnus-newsgroup-cached)
3711 (gnus-tmp-replied gnus-replied-mark)
3712 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3713 gnus-forwarded-mark)
3714 ((memq gnus-tmp-current gnus-newsgroup-saved)
3716 ((memq gnus-tmp-number gnus-newsgroup-recent)
3718 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3721 (gnus-tmp-downloaded
3723 gnus-undownloaded-mark)
3724 (gnus-newsgroup-agentized
3725 gnus-downloaded-mark)
3728 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3731 ((string-match "<[^>]+> *$" gnus-tmp-from)
3732 (let ((beg (match-beginning 0)))
3733 (or (and (string-match "^\".+\"" gnus-tmp-from)
3734 (substring gnus-tmp-from 1 (1- (match-end 0))))
3735 (substring gnus-tmp-from 0 beg))))
3736 ((string-match "(.+)" gnus-tmp-from)
3737 (substring gnus-tmp-from
3738 (1+ (match-beginning 0)) (1- (match-end 0))))
3740 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3741 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3742 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3743 (inhibit-read-only t))
3744 (when (string= gnus-tmp-name "")
3745 (setq gnus-tmp-name gnus-tmp-from))
3746 (unless (numberp gnus-tmp-lines)
3747 (setq gnus-tmp-lines -1))
3748 (if (= gnus-tmp-lines -1)
3749 (setq gnus-tmp-lines "?")
3750 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3752 (gnus-put-text-property
3754 (progn (eval gnus-summary-line-format-spec) (point))
3755 'gnus-number gnus-tmp-number)
3756 (error (gnus-message 5 "Error updating the summary line")))
3757 (when (gnus-visual-p 'summary-highlight 'highlight)
3759 (gnus-run-hooks 'gnus-summary-update-hook)
3762 (defun gnus-summary-update-line (&optional dont-update)
3763 "Update summary line after change."
3764 (when (and gnus-summary-default-score
3765 (not gnus-summary-inhibit-highlight))
3766 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3767 (article (gnus-summary-article-number))
3768 (score (gnus-summary-article-score article)))
3770 (if (and gnus-summary-mark-below
3771 (< (gnus-summary-article-score)
3772 gnus-summary-mark-below))
3773 ;; This article has a low score, so we mark it as read.
3774 (when (memq article gnus-newsgroup-unreads)
3775 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3776 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3777 ;; This article was previously marked as read on account
3778 ;; of a low score, but now it has risen, so we mark it as
3780 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3781 (gnus-summary-update-mark
3782 (if (or (null gnus-summary-default-score)
3783 (<= (abs (- score gnus-summary-default-score))
3784 gnus-summary-zcore-fuzz))
3786 (if (< score gnus-summary-default-score)
3787 gnus-score-below-mark gnus-score-over-mark))
3789 ;; Do visual highlighting.
3790 (when (gnus-visual-p 'summary-highlight 'highlight)
3791 (gnus-run-hooks 'gnus-summary-update-hook)))))
3793 (defvar gnus-tmp-new-adopts nil)
3795 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3796 "Return the number of articles in THREAD.
3797 This may be 0 in some cases -- if none of the articles in
3798 the thread are to be displayed."
3800 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3802 ((not (listp thread))
3804 ((and (consp thread) (cdr thread))
3807 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3810 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3813 (when (and level (zerop level) gnus-tmp-new-adopts)
3816 'gnus-summary-number-of-articles-in-thread
3817 gnus-tmp-new-adopts))))
3819 (if (> number 1) gnus-not-empty-thread-mark
3820 gnus-empty-thread-mark)
3823 (defsubst gnus-summary-line-message-size (head)
3824 "Return pretty-printed version of message size.
3825 This function is intended to be used in
3826 `gnus-summary-line-format-alist'."
3827 (let ((c (or (mail-header-chars head) -1)))
3828 (cond ((< c 0) "n/a") ; chars not available
3829 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3830 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3831 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3832 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3835 (defun gnus-summary-set-local-parameters (group)
3836 "Go through the local params of GROUP and set all variable specs in that list."
3837 (let ((vars '(quit-config))) ; Ignore quit-config.
3838 (dolist (elem (gnus-group-find-parameter group))
3839 (and (consp elem) ; Has to be a cons.
3840 (consp (cdr elem)) ; The cdr has to be a list.
3841 (symbolp (car elem)) ; Has to be a symbol in there.
3842 (not (memq (car elem) vars))
3844 (push (car elem) vars)
3845 ;; Variables like `gnus-show-threads' that are globally
3846 ;; bound, if used as group parameters, need to get to be
3847 ;; buffer-local, whereas just parameters like `gcc-self',
3848 ;; `timestamp', etc. should not be bound as variables.
3849 (if (boundp (car elem))
3850 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3851 (eval (nth 1 elem))))))))
3853 (defun gnus-summary-read-group (group &optional show-all no-article
3854 kill-buffer no-display backward
3856 "Start reading news in newsgroup GROUP.
3857 If SHOW-ALL is non-nil, already read articles are also listed.
3858 If NO-ARTICLE is non-nil, no article is selected initially.
3859 If NO-DISPLAY, don't generate a summary buffer."
3863 (let ((gnus-auto-select-next nil))
3864 (or (gnus-summary-read-group-1
3865 group show-all no-article
3866 kill-buffer no-display
3869 select-articles nil)))))
3870 (eq gnus-auto-select-next 'quietly))
3871 (set-buffer gnus-group-buffer)
3872 ;; The entry function called above goes to the next
3873 ;; group automatically, so we go two groups back
3874 ;; if we are searching for the previous group.
3876 (gnus-group-prev-unread-group 2))
3877 (if (not (equal group (gnus-group-group-name)))
3878 (setq group (gnus-group-group-name))
3882 (defun gnus-summary-read-group-1 (group show-all no-article
3883 kill-buffer no-display
3884 &optional select-articles)
3885 ;; Killed foreign groups can't be entered.
3886 ;; (when (and (not (gnus-group-native-p group))
3887 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3888 ;; (error "Dead non-native groups can't be entered"))
3889 (gnus-message 5 "Retrieving newsgroup: %s..."
3890 (gnus-group-decoded-name group))
3891 (let* ((new-group (gnus-summary-setup-buffer group))
3892 (quit-config (gnus-group-quit-config group))
3893 (did-select (and new-group (gnus-select-newsgroup
3894 group show-all select-articles))))
3896 ;; This summary buffer exists already, so we just select it.
3898 (gnus-set-global-variables)
3900 (gnus-kill-or-deaden-summary kill-buffer))
3901 (gnus-configure-windows 'summary 'force)
3902 (gnus-set-mode-line 'summary)
3903 (gnus-summary-position-point)
3906 ;; We couldn't select this group.
3908 (when (and (eq major-mode 'gnus-summary-mode)
3909 (not (equal (current-buffer) kill-buffer)))
3910 (kill-buffer (current-buffer))
3911 (if (not quit-config)
3913 ;; Update the info -- marks might need to be removed,
3915 (gnus-summary-update-info)
3916 (set-buffer gnus-group-buffer)
3917 (gnus-group-jump-to-group group)
3918 (gnus-group-next-unread-group 1))
3919 (gnus-handle-ephemeral-exit quit-config)))
3920 (let ((grpinfo (gnus-get-info group)))
3921 (if (null (gnus-info-read grpinfo))
3922 (gnus-message 3 "Group %s contains no messages"
3923 (gnus-group-decoded-name group))
3924 (gnus-message 3 "Can't select group")))
3926 ;; The user did a `C-g' while prompting for number of articles,
3927 ;; so we exit this group.
3928 ((eq did-select 'quit)
3929 (and (eq major-mode 'gnus-summary-mode)
3930 (not (equal (current-buffer) kill-buffer))
3931 (kill-buffer (current-buffer)))
3933 (gnus-kill-or-deaden-summary kill-buffer))
3934 (if (not quit-config)
3936 (set-buffer gnus-group-buffer)
3937 (gnus-group-jump-to-group group)
3938 (gnus-configure-windows 'group 'force))
3939 (gnus-handle-ephemeral-exit quit-config))
3940 ;; Finally signal the quit.
3942 ;; The group was successfully selected.
3944 (gnus-set-global-variables)
3945 ;; Save the active value in effect when the group was entered.
3946 (setq gnus-newsgroup-active
3948 (gnus-active gnus-newsgroup-name)))
3949 ;; You can change the summary buffer in some way with this hook.
3950 (gnus-run-hooks 'gnus-select-group-hook)
3951 (when (memq 'summary (gnus-update-format-specifications
3952 nil 'summary 'summary-mode 'summary-dummy))
3953 ;; The format specification for the summary line was updated,
3954 ;; so we need to update the mark positions as well.
3955 (gnus-update-summary-mark-positions))
3956 ;; Do score processing.
3957 (when gnus-use-scoring
3958 (gnus-possibly-score-headers))
3959 ;; Check whether to fill in the gaps in the threads.
3960 (when gnus-build-sparse-threads
3961 (gnus-build-sparse-threads))
3962 ;; Find the initial limit.
3964 (let ((gnus-newsgroup-dormant nil))
3965 (gnus-summary-initial-limit show-all))
3966 (gnus-summary-initial-limit show-all))
3967 ;; Generate the summary buffer.
3969 (gnus-summary-prepare))
3970 (when gnus-use-trees
3971 (gnus-tree-open group)
3972 (setq gnus-summary-highlight-line-function
3973 'gnus-tree-highlight-article))
3974 ;; If the summary buffer is empty, but there are some low-scored
3975 ;; articles or some excluded dormants, we include these in the
3977 (when (and (zerop (buffer-size))
3979 (cond (gnus-newsgroup-dormant
3980 (gnus-summary-limit-include-dormant))
3981 ((and gnus-newsgroup-scored show-all)
3982 (gnus-summary-limit-include-expunged t))))
3983 ;; Function `gnus-apply-kill-file' must be called in this hook.
3984 (gnus-run-hooks 'gnus-apply-kill-hook)
3985 (if (and (zerop (buffer-size))
3988 ;; This newsgroup is empty.
3989 (gnus-summary-catchup-and-exit nil t)
3990 (gnus-message 6 "No unread news")
3992 (gnus-kill-or-deaden-summary kill-buffer))
3993 ;; Return nil from this function.
3995 ;; Hide conversation thread subtrees. We cannot do this in
3996 ;; gnus-summary-prepare-hook since kill processing may not
3997 ;; work with hidden articles.
3998 (gnus-summary-maybe-hide-threads)
4000 (gnus-kill-or-deaden-summary kill-buffer))
4001 (gnus-summary-auto-select-subject)
4002 ;; Show first unread article if requested.
4003 (if (and (not no-article)
4005 gnus-newsgroup-unreads
4006 gnus-auto-select-first)
4008 (gnus-configure-windows 'summary)
4009 (let ((art (gnus-summary-article-number)))
4010 (unless (and (not gnus-plugged)
4011 (or (memq art gnus-newsgroup-undownloaded)
4012 (memq art gnus-newsgroup-downloadable)))
4013 (gnus-summary-goto-article art))))
4014 ;; Don't select any articles.
4015 (gnus-summary-position-point)
4016 (gnus-configure-windows 'summary 'force)
4017 (gnus-set-mode-line 'summary))
4018 (when (and gnus-auto-center-group
4019 (get-buffer-window gnus-group-buffer t))
4020 ;; Gotta use windows, because recenter does weird stuff if
4021 ;; the current buffer ain't the displayed window.
4022 (let ((owin (selected-window)))
4023 (select-window (get-buffer-window gnus-group-buffer t))
4024 (when (gnus-group-goto-group group)
4026 (select-window owin)))
4027 ;; Mark this buffer as "prepared".
4028 (setq gnus-newsgroup-prepared t)
4029 (gnus-run-hooks 'gnus-summary-prepared-hook)
4030 (unless (gnus-ephemeral-group-p group)
4031 (gnus-group-update-group group))
4034 (defun gnus-summary-auto-select-subject ()
4035 "Select the subject line on initial group entry."
4036 (goto-char (point-min))
4038 ((eq gnus-auto-select-subject 'best)
4039 (gnus-summary-best-unread-subject))
4040 ((eq gnus-auto-select-subject 'unread)
4041 (gnus-summary-first-unread-subject))
4042 ((eq gnus-auto-select-subject 'unseen)
4043 (gnus-summary-first-unseen-subject))
4044 ((eq gnus-auto-select-subject 'unseen-or-unread)
4045 (gnus-summary-first-unseen-or-unread-subject))
4046 ((eq gnus-auto-select-subject 'first)
4049 ((functionp gnus-auto-select-subject)
4050 (funcall gnus-auto-select-subject))))
4052 (defun gnus-summary-prepare ()
4053 "Generate the summary buffer."
4055 (let ((inhibit-read-only t))
4057 (setq gnus-newsgroup-data nil
4058 gnus-newsgroup-data-reverse nil)
4059 (gnus-run-hooks 'gnus-summary-generate-hook)
4060 ;; Generate the buffer, either with threads or without.
4061 (when gnus-newsgroup-headers
4062 (gnus-summary-prepare-threads
4063 (if gnus-show-threads
4064 (gnus-sort-gathered-threads
4065 (funcall gnus-summary-thread-gathering-function
4067 (gnus-cut-threads (gnus-make-threads)))))
4068 ;; Unthreaded display.
4069 (gnus-sort-articles gnus-newsgroup-headers))))
4070 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4071 ;; Call hooks for modifying summary buffer.
4072 (goto-char (point-min))
4073 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4075 (defsubst gnus-general-simplify-subject (subject)
4076 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4079 ;; Truncate the subject.
4080 (gnus-simplify-subject-functions
4081 (gnus-map-function gnus-simplify-subject-functions subject))
4082 ((numberp gnus-summary-gather-subject-limit)
4083 (setq subject (gnus-simplify-subject-re subject))
4084 (if (> (length subject) gnus-summary-gather-subject-limit)
4085 (substring subject 0 gnus-summary-gather-subject-limit)
4087 ;; Fuzzily simplify it.
4088 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4089 (gnus-simplify-subject-fuzzy subject))
4090 ;; Just remove the leading "Re:".
4092 (gnus-simplify-subject-re subject))))
4094 (if (and gnus-summary-gather-exclude-subject
4095 (string-match gnus-summary-gather-exclude-subject subject))
4096 nil ; This article shouldn't be gathered
4099 (defun gnus-summary-simplify-subject-query ()
4100 "Query where the respool algorithm would put this article."
4102 (gnus-summary-select-article)
4103 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4105 (defun gnus-gather-threads-by-subject (threads)
4106 "Gather threads by looking at Subject headers."
4107 (if (not gnus-summary-make-false-root)
4109 (let ((hashtb (gnus-make-hashtable 1024))
4112 subject hthread whole-subject)
4114 (setq subject (gnus-general-simplify-subject
4115 (setq whole-subject (mail-header-subject
4118 (if (setq hthread (gnus-gethash subject hashtb))
4120 ;; We enter a dummy root into the thread, if we
4121 ;; haven't done that already.
4122 (unless (stringp (caar hthread))
4123 (setcar hthread (list whole-subject (car hthread))))
4124 ;; We add this new gathered thread to this gathered
4126 (setcdr (car hthread)
4127 (nconc (cdar hthread) (list (car threads))))
4128 ;; Remove it from the list of threads.
4129 (setcdr prev (cdr threads))
4130 (setq threads prev))
4131 ;; Enter this thread into the hash table.
4132 (gnus-sethash subject
4133 (if gnus-summary-make-false-root-always
4135 ;; If you want a dummy root above all
4137 (setcar threads (list whole-subject
4143 (setq threads (cdr threads)))
4146 (defun gnus-gather-threads-by-references (threads)
4147 "Gather threads by looking at References headers."
4148 (let ((idhashtb (gnus-make-hashtable 1024))
4149 (thhashtb (gnus-make-hashtable 1024))
4152 ids references id gthread gid entered ref)
4154 (when (setq references (mail-header-references (caar threads)))
4155 (setq id (mail-header-id (caar threads))
4156 ids (inline (gnus-split-references references))
4158 (while (setq ref (pop ids))
4159 (setq ids (delete ref ids))
4160 (if (not (setq gid (gnus-gethash ref idhashtb)))
4162 (gnus-sethash ref id idhashtb)
4163 (gnus-sethash id threads thhashtb))
4164 (setq gthread (gnus-gethash gid thhashtb))
4166 ;; We enter a dummy root into the thread, if we
4167 ;; haven't done that already.
4168 (unless (stringp (caar gthread))
4169 (setcar gthread (list (mail-header-subject (caar gthread))
4171 ;; We add this new gathered thread to this gathered
4173 (setcdr (car gthread)
4174 (nconc (cdar gthread) (list (car threads)))))
4175 ;; Add it into the thread hash table.
4176 (gnus-sethash id gthread thhashtb)
4178 ;; Remove it from the list of threads.
4179 (setcdr prev (cdr threads))
4180 (setq threads prev))))
4182 (setq threads (cdr threads)))
4185 (defun gnus-sort-gathered-threads (threads)
4186 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4187 (let ((result threads))
4189 (when (stringp (caar threads))
4190 (setcdr (car threads)
4191 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4192 (setq threads (cdr threads)))
4195 (defun gnus-thread-loop-p (root thread)
4196 "Say whether ROOT is in THREAD."
4197 (let ((stack (list thread))
4200 (while (setq thread (pop stack))
4201 (setq th (cdr thread))
4203 (not (eq (caar th) root)))
4206 ;; We have found a loop.
4208 (setcdr thread (delq (car th) (cdr thread)))
4209 (if (boundp (setq ref-dep (intern "none"
4210 gnus-newsgroup-dependencies)))
4211 (setcdr (symbol-value ref-dep)
4212 (nconc (cdr (symbol-value ref-dep))
4214 (set ref-dep (list nil (car th))))
4217 ;; Push all the subthreads onto the stack.
4218 (push (cdr thread) stack)))
4221 (defun gnus-make-threads ()
4222 "Go through the dependency hashtb and find the roots. Return all threads."
4224 (while (catch 'infloop
4227 ;; Deal with self-referencing References loops.
4228 (when (and (car (symbol-value refs))
4235 (car (symbol-value refs)) thread))
4236 (cdr (symbol-value refs)))))))
4239 (unless (car (symbol-value refs))
4240 ;; These threads do not refer back to any other
4241 ;; articles, so they're roots.
4242 (setq threads (append (cdr (symbol-value refs)) threads))))
4243 gnus-newsgroup-dependencies)))
4246 ;; Build the thread tree.
4247 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4248 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4250 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4251 if it was already present.
4253 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4254 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4255 Message-IDs will be renamed to a unique Message-ID before being
4258 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4259 (let* ((id (mail-header-id header))
4260 (id-dep (and id (intern id dependencies)))
4261 parent-id ref ref-dep ref-header replaced)
4262 ;; Enter this `header' in the `dependencies' table.
4266 ;; The first two cases do the normal part: enter a new `header'
4267 ;; in the `dependencies' table.
4268 ((not (boundp id-dep))
4269 (set id-dep (list header)))
4270 ((null (car (symbol-value id-dep)))
4271 (setcar (symbol-value id-dep) header))
4273 ;; From here the `header' was already present in the
4274 ;; `dependencies' table.
4276 ;; Overrides an existing entry;
4277 ;; just set the header part of the entry.
4278 (setcar (symbol-value id-dep) header)
4281 ;; Renames the existing `header' to a unique Message-ID.
4282 ((not gnus-summary-ignore-duplicates)
4283 ;; An article with this Message-ID has already been seen.
4284 ;; We rename the Message-ID.
4285 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4287 (mail-header-set-id header id))
4289 ;; The last case ignores an existing entry, except it adds any
4290 ;; additional Xrefs (in case the two articles came from different
4292 ;; Also sets `header' to `nil' meaning that the `dependencies'
4293 ;; table was *not* modified.
4295 (mail-header-set-xref
4296 (car (symbol-value id-dep))
4297 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4299 (or (mail-header-xref header) "")))
4302 (when (and header (not replaced))
4303 ;; First check that we are not creating a References loop.
4304 (setq parent-id (gnus-parent-id (mail-header-references header)))
4305 (setq ref parent-id)
4307 (setq ref-dep (intern-soft ref dependencies))
4309 (setq ref-header (car (symbol-value ref-dep))))
4310 (if (string= id ref)
4311 ;; Yuk! This is a reference loop. Make the article be a
4314 (mail-header-set-references (car (symbol-value id-dep)) "none")
4316 (setq parent-id nil))
4317 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4318 (setq ref-dep (intern (or parent-id "none") dependencies))
4319 (if (boundp ref-dep)
4320 (setcdr (symbol-value ref-dep)
4321 (nconc (cdr (symbol-value ref-dep))
4322 (list (symbol-value id-dep))))
4323 (set ref-dep (list nil (symbol-value id-dep)))))
4326 (defun gnus-extract-message-id-from-in-reply-to (string)
4327 (if (string-match "<[^>]+>" string)
4328 (substring string (match-beginning 0) (match-end 0))
4331 (defun gnus-build-sparse-threads ()
4332 (let ((headers gnus-newsgroup-headers)
4333 (mail-parse-charset gnus-newsgroup-charset)
4334 (gnus-summary-ignore-duplicates t)
4335 header references generation relations
4336 subject child end new-child date)
4337 ;; First we create an alist of generations/relations, where
4338 ;; generations is how much we trust the relation, and the relation
4340 (gnus-message 7 "Making sparse threads...")
4342 (nnheader-set-temp-buffer " *gnus sparse threads*")
4343 (while (setq header (pop headers))
4344 (when (and (setq references (mail-header-references header))
4345 (not (string= references "")))
4347 (setq child (mail-header-id header)
4348 subject (mail-header-subject header)
4349 date (mail-header-date header)
4351 (while (search-backward ">" nil t)
4352 (setq end (1+ (point)))
4353 (when (search-backward "<" nil t)
4354 (setq new-child (buffer-substring (point) end))
4355 (push (list (incf generation)
4356 child (setq child new-child)
4360 (push (list (1+ generation) child nil subject) relations))
4362 (kill-buffer (current-buffer)))
4363 ;; Sort over trustworthiness.
4364 (dolist (relation (sort relations 'car-less-than-car))
4365 (when (gnus-dependencies-add-header
4366 (make-full-mail-header
4367 gnus-reffed-article-number
4368 (nth 3 relation) "" (or (nth 4 relation) "")
4370 (or (nth 2 relation) "") 0 0 "")
4371 gnus-newsgroup-dependencies nil)
4372 (push gnus-reffed-article-number gnus-newsgroup-limit)
4373 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4374 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4375 gnus-newsgroup-reads)
4376 (decf gnus-reffed-article-number)))
4377 (gnus-message 7 "Making sparse threads...done")))
4379 (defun gnus-build-old-threads ()
4380 ;; Look at all the articles that refer back to old articles, and
4381 ;; fetch the headers for the articles that aren't there. This will
4382 ;; build complete threads - if the roots haven't been expired by the
4384 (let ((mail-parse-charset gnus-newsgroup-charset)
4388 (when (not (car (symbol-value refs)))
4389 (setq heads (cdr (symbol-value refs)))
4391 (if (memq (mail-header-number (caar heads))
4392 gnus-newsgroup-dormant)
4393 (setq heads (cdr heads))
4394 (setq id (symbol-name refs))
4395 (while (and (setq id (gnus-build-get-header id))
4396 (not (car (gnus-id-to-thread id)))))
4397 (setq heads nil)))))
4398 gnus-newsgroup-dependencies)))
4400 (defsubst gnus-remove-odd-characters (string)
4401 "Translate STRING into something that doesn't contain weird characters."
4402 (mm-subst-char-in-string
4404 (mm-subst-char-in-string ?\n ?\- string t) t))
4406 ;; This function has to be called with point after the article number
4407 ;; on the beginning of the line.
4408 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4409 (let ((eol (point-at-eol))
4410 (buffer (current-buffer))
4411 header references in-reply-to)
4413 ;; overview: [num subject from date id refs chars lines misc]
4416 (narrow-to-region (point) eol)
4421 (make-full-mail-header
4423 (condition-case () ; subject
4424 (gnus-remove-odd-characters
4425 (funcall gnus-decode-encoded-word-function
4426 (setq x (nnheader-nov-field))))
4428 (condition-case () ; from
4429 (gnus-remove-odd-characters
4430 (funcall gnus-decode-encoded-address-function
4431 (setq x (nnheader-nov-field))))
4433 (nnheader-nov-field) ; date
4434 (nnheader-nov-read-message-id number) ; id
4435 (setq references (nnheader-nov-field)) ; refs
4436 (nnheader-nov-read-integer) ; chars
4437 (nnheader-nov-read-integer) ; lines
4439 (if (looking-at "Xref: ")
4440 (goto-char (match-end 0)))
4441 (nnheader-nov-field)) ; Xref
4442 (nnheader-nov-parse-extra)))) ; extra
4446 (when (and (string= references "")
4447 (setq in-reply-to (mail-header-extra header))
4448 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4449 (mail-header-set-references
4450 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4452 (when gnus-alter-header-function
4453 (funcall gnus-alter-header-function header))
4454 (gnus-dependencies-add-header header dependencies force-new)))
4456 (defun gnus-build-get-header (id)
4457 "Look through the buffer of NOV lines and find the header to ID.
4458 Enter this line into the dependencies hash table, and return
4459 the id of the parent article (if any)."
4460 (let ((deps gnus-newsgroup-dependencies)
4463 (with-current-buffer nntp-server-buffer
4464 (let ((case-fold-search nil))
4465 (goto-char (point-min))
4466 (while (and (not found)
4467 (search-forward id nil t))
4469 (setq found (looking-at
4470 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4471 (regexp-quote id))))
4472 (or found (beginning-of-line 2)))
4476 (setq header (gnus-nov-parse-line
4477 (read (current-buffer)) deps))
4478 (gnus-parent-id (mail-header-references header))))))
4480 (let ((number (mail-header-number header)))
4481 (push number gnus-newsgroup-limit)
4482 (push header gnus-newsgroup-headers)
4483 (if (memq number gnus-newsgroup-unselected)
4485 (setq gnus-newsgroup-unreads
4486 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4488 (setq gnus-newsgroup-unselected
4489 (delq number gnus-newsgroup-unselected)))
4490 (push number gnus-newsgroup-ancient)))))))
4492 (defun gnus-build-all-threads ()
4493 "Read all the headers."
4494 (let ((gnus-summary-ignore-duplicates t)
4495 (mail-parse-charset gnus-newsgroup-charset)
4496 (dependencies gnus-newsgroup-dependencies)
4498 (with-current-buffer nntp-server-buffer
4499 (let ((case-fold-search nil))
4500 (goto-char (point-min))
4503 (setq article (read (current-buffer))
4504 header (gnus-nov-parse-line article dependencies)))
4506 (with-current-buffer gnus-summary-buffer
4507 (push header gnus-newsgroup-headers)
4508 (if (memq (setq article (mail-header-number header))
4509 gnus-newsgroup-unselected)
4511 (setq gnus-newsgroup-unreads
4512 (gnus-add-to-sorted-list
4513 gnus-newsgroup-unreads article))
4514 (setq gnus-newsgroup-unselected
4515 (delq article gnus-newsgroup-unselected)))
4516 (push article gnus-newsgroup-ancient)))
4517 (forward-line 1)))))))
4519 (defun gnus-summary-update-article-line (article header)
4520 "Update the line for ARTICLE using HEADER."
4521 (let* ((id (mail-header-id header))
4522 (thread (gnus-id-to-thread id)))
4524 (error "Article in no thread"))
4525 ;; Update the thread.
4526 (setcar thread header)
4527 (gnus-summary-goto-subject article)
4528 (let* ((datal (gnus-data-find-list article))
4530 (inhibit-read-only t)
4531 (level (gnus-summary-thread-level)))
4533 (let ((inserted (- (point)
4535 (gnus-summary-insert-line
4537 (memq article gnus-newsgroup-undownloaded)
4538 (gnus-article-mark article)
4539 (memq article gnus-newsgroup-replied)
4540 (memq article gnus-newsgroup-expirable)
4541 ;; Only insert the Subject string when it's different
4542 ;; from the previous Subject string.
4547 (mail-header-subject
4550 (gnus-data-find-list
4552 (gnus-data-list t)))))
4553 ;; Error on the side of excessive subjects.
4555 (mail-header-subject header)))
4557 (mail-header-subject header))
4558 nil (cdr (assq article gnus-newsgroup-scored))
4559 (memq article gnus-newsgroup-processable))
4562 (gnus-data-update-list
4564 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4566 (defun gnus-summary-update-article (article &optional iheader)
4567 "Update ARTICLE in the summary buffer."
4568 (set-buffer gnus-summary-buffer)
4569 (let* ((header (gnus-summary-article-header article))
4570 (id (mail-header-id header))
4571 (data (gnus-data-find article))
4572 (thread (gnus-id-to-thread id))
4573 (references (mail-header-references header))
4577 (when (and references
4578 (not (equal "" references)))
4581 (inhibit-read-only t)
4587 (delq thread parent)))
4588 (if (gnus-summary-insert-subject id header)
4589 ;; Set the (possibly) new article number in the data structure.
4590 (gnus-data-set-number data (gnus-id-to-article id))
4594 (defun gnus-rebuild-thread (id &optional line)
4595 "Rebuild the thread containing ID.
4596 If LINE, insert the rebuilt thread starting on line LINE."
4597 (let ((inhibit-read-only t)
4598 old-pos current thread data)
4599 (if (not gnus-show-threads)
4600 (setq thread (list (car (gnus-id-to-thread id))))
4601 ;; Get the thread this article is part of.
4602 (setq thread (gnus-remove-thread id)))
4603 (setq old-pos (point-at-bol))
4604 (setq current (save-excursion
4605 (and (re-search-backward "[\r\n]" nil t)
4606 (gnus-summary-article-number))))
4607 ;; If this is a gathered thread, we have to go some re-gathering.
4608 (when (stringp (car thread))
4609 (let ((subject (car thread))
4611 (setq thread (cdr thread))
4613 (unless (memq (setq thr (gnus-id-to-thread
4615 (mail-header-id (caar thread)))))
4618 (setq thread (cdr thread)))
4619 ;; We now have all (unique) roots.
4620 (if (= (length roots) 1)
4621 ;; All the loose roots are now one solid root.
4622 (setq thread (car roots))
4623 (setq thread (cons subject (gnus-sort-threads roots))))))
4625 ;; We then insert this thread into the summary buffer.
4627 (goto-char (point-min))
4628 (forward-line (1- line)))
4629 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4630 (if gnus-show-threads
4631 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4632 (gnus-summary-prepare-unthreaded thread))
4633 (setq data (nreverse gnus-newsgroup-data))
4634 (setq threads gnus-newsgroup-threads))
4635 ;; We splice the new data into the data structure.
4636 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4637 ;;!!! then we want to insert at the beginning of the buffer.
4638 ;;!!! That happens to be true with Gnus now, but that may
4639 ;;!!! change in the future. Perhaps.
4640 (gnus-data-enter-list
4641 (if line nil current) data (- (point) old-pos))
4642 (setq gnus-newsgroup-threads
4643 (nconc threads gnus-newsgroup-threads))
4644 (gnus-data-compute-positions))))
4646 (defun gnus-number-to-header (number)
4647 "Return the header for article NUMBER."
4648 (let ((headers gnus-newsgroup-headers))
4650 (not (= number (mail-header-number (car headers)))))
4655 (defun gnus-parent-headers (in-headers &optional generation)
4656 "Return the headers of the GENERATIONeth parent of HEADERS."
4658 (setq generation 1))
4660 (headers in-headers)
4663 (not (zerop generation))
4664 (setq references (mail-header-references headers)))
4665 (setq headers (if (and references
4666 (setq parent (gnus-parent-id references)))
4667 (car (gnus-id-to-thread parent))
4670 (and (not (eq headers in-headers))
4673 (defun gnus-id-to-thread (id)
4674 "Return the (sub-)thread where ID appears."
4675 (gnus-gethash id gnus-newsgroup-dependencies))
4677 (defun gnus-id-to-article (id)
4678 "Return the article number of ID."
4679 (let ((thread (gnus-id-to-thread id)))
4682 (mail-header-number (car thread)))))
4684 (defun gnus-id-to-header (id)
4685 "Return the article headers of ID."
4686 (car (gnus-id-to-thread id)))
4688 (defun gnus-article-displayed-root-p (article)
4689 "Say whether ARTICLE is a root(ish) article."
4690 (let ((level (gnus-summary-thread-level article))
4691 (refs (mail-header-references (gnus-summary-article-header article)))
4697 ((null (gnus-parent-id refs)) t)
4699 (null (setq particle (gnus-id-to-article
4700 (gnus-parent-id refs))))
4701 (null (gnus-summary-thread-level particle)))))))
4703 (defun gnus-root-id (id)
4704 "Return the id of the root of the thread where ID appears."
4706 (while (and id (setq prev (car (gnus-id-to-thread id))))
4708 id (gnus-parent-id (mail-header-references prev))))
4711 (defun gnus-articles-in-thread (thread)
4712 "Return the list of articles in THREAD."
4713 (cons (mail-header-number (car thread))
4714 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4716 (defun gnus-remove-thread (id &optional dont-remove)
4717 "Remove the thread that has ID in it."
4718 (let (headers thread last-id)
4719 ;; First go up in this thread until we find the root.
4720 (setq last-id (gnus-root-id id)
4721 headers (message-flatten-list (gnus-id-to-thread last-id)))
4722 ;; We have now found the real root of this thread. It might have
4723 ;; been gathered into some loose thread, so we have to search
4724 ;; through the threads to find the thread we wanted.
4725 (let ((threads gnus-newsgroup-threads)
4728 (setq sub (car threads))
4729 (if (stringp (car sub))
4730 ;; This is a gathered thread, so we look at the roots
4731 ;; below it to find whether this article is in this
4734 (setq sub (cdr sub))
4736 (when (member (caar sub) headers)
4737 (setq thread (car threads)
4740 (setq sub (cdr sub))))
4741 ;; It's an ordinary thread, so we check it.
4742 (when (eq (car sub) (car headers))
4745 (setq threads (cdr threads)))
4746 ;; If this article is in no thread, then it's a root.
4749 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4750 (setq thread (gnus-id-to-thread last-id)))
4753 thread ; We return this thread.
4755 (if (stringp (car thread))
4757 ;; If we use dummy roots, then we have to remove the
4758 ;; dummy root as well.
4759 (when (eq gnus-summary-make-false-root 'dummy)
4760 ;; We go to the dummy root by going to
4761 ;; the first sub-"thread", and then one line up.
4762 (gnus-summary-goto-article
4763 (mail-header-number (caadr thread)))
4766 (gnus-data-compute-positions))
4767 (setq thread (cdr thread))
4769 (gnus-remove-thread-1 (car thread))
4770 (setq thread (cdr thread))))
4771 (gnus-remove-thread-1 thread))))))))
4773 (defun gnus-remove-thread-1 (thread)
4774 "Remove the thread THREAD recursively."
4775 (let ((number (mail-header-number (pop thread)))
4777 (setq thread (reverse thread))
4779 (gnus-remove-thread-1 (pop thread)))
4780 (when (setq d (gnus-data-find number))
4781 (goto-char (gnus-data-pos d))
4782 (gnus-summary-show-thread)
4788 (gnus-delete-line)))))))
4790 (defun gnus-sort-threads-recursive (threads func)
4791 (sort (mapcar (lambda (thread)
4794 (gnus-sort-threads-recursive (cdr thread) func))))
4797 (defun gnus-sort-threads-loop (threads func)
4798 (let* ((superthread (cons nil threads))
4799 (stack (list (cons superthread threads)))
4800 remaining-threads thread)
4802 (setq remaining-threads (cdr (car stack)))
4803 (if remaining-threads
4804 (progn (setq thread (car remaining-threads))
4805 (setcdr (car stack) (cdr remaining-threads))
4807 (push (cons thread (cdr thread)) stack)))
4808 (setq thread (caar stack))
4809 (setcdr thread (sort (cdr thread) func))
4813 (defun gnus-sort-threads (threads)
4815 (if (not gnus-thread-sort-functions)
4817 (gnus-message 8 "Sorting threads...")
4820 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4821 (gnus-sort-threads-recursive
4822 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4823 ;; Even after binding max-lisp-eval-depth, the recursive
4824 ;; sorter might fail for very long threads. In that case,
4825 ;; try using a (less well-tested) non-recursive sorter.
4826 (error (gnus-message 9 "Sorting threads with loop...")
4827 (gnus-sort-threads-loop
4828 threads (gnus-make-sort-function
4829 gnus-thread-sort-functions))))
4830 (gnus-message 8 "Sorting threads...done"))))
4832 (defun gnus-sort-articles (articles)
4834 (when gnus-article-sort-functions
4835 (gnus-message 7 "Sorting articles...")
4837 (setq gnus-newsgroup-headers
4838 (sort articles (gnus-make-sort-function
4839 gnus-article-sort-functions)))
4840 (gnus-message 7 "Sorting articles...done"))))
4842 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4843 (defmacro gnus-thread-header (thread)
4844 "Return header of first article in THREAD.
4845 Note that THREAD must never, ever be anything else than a variable -
4846 using some other form will lead to serious barfage."
4847 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4848 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4849 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4852 (defsubst gnus-article-sort-by-number (h1 h2)
4853 "Sort articles by article number."
4854 (< (mail-header-number h1)
4855 (mail-header-number h2)))
4857 (defun gnus-thread-sort-by-number (h1 h2)
4858 "Sort threads by root article number."
4859 (gnus-article-sort-by-number
4860 (gnus-thread-header h1) (gnus-thread-header h2)))
4862 (defsubst gnus-article-sort-by-random (h1 h2)
4863 "Sort articles randomly."
4866 (defun gnus-thread-sort-by-random (h1 h2)
4867 "Sort threads randomly."
4868 (gnus-article-sort-by-random
4869 (gnus-thread-header h1) (gnus-thread-header h2)))
4871 (defsubst gnus-article-sort-by-lines (h1 h2)
4872 "Sort articles by article Lines header."
4873 (< (mail-header-lines h1)
4874 (mail-header-lines h2)))
4876 (defun gnus-thread-sort-by-lines (h1 h2)
4877 "Sort threads by root article Lines header."
4878 (gnus-article-sort-by-lines
4879 (gnus-thread-header h1) (gnus-thread-header h2)))
4881 (defsubst gnus-article-sort-by-chars (h1 h2)
4882 "Sort articles by octet length."
4883 (< (mail-header-chars h1)
4884 (mail-header-chars h2)))
4886 (defun gnus-thread-sort-by-chars (h1 h2)
4887 "Sort threads by root article octet length."
4888 (gnus-article-sort-by-chars
4889 (gnus-thread-header h1) (gnus-thread-header h2)))
4891 (defsubst gnus-article-sort-by-author (h1 h2)
4892 "Sort articles by root author."
4894 (let ((extract (funcall
4895 gnus-extract-address-components
4896 (mail-header-from h1))))
4897 (or (car extract) (cadr extract) ""))
4898 (let ((extract (funcall
4899 gnus-extract-address-components
4900 (mail-header-from h2))))
4901 (or (car extract) (cadr extract) ""))))
4903 (defun gnus-thread-sort-by-author (h1 h2)
4904 "Sort threads by root author."
4905 (gnus-article-sort-by-author
4906 (gnus-thread-header h1) (gnus-thread-header h2)))
4908 (defsubst gnus-article-sort-by-recipient (h1 h2)
4909 "Sort articles by recipient."
4911 (let ((extract (funcall
4912 gnus-extract-address-components
4913 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4914 (or (car extract) (cadr extract)))
4915 (let ((extract (funcall
4916 gnus-extract-address-components
4917 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4918 (or (car extract) (cadr extract)))))
4920 (defun gnus-thread-sort-by-recipient (h1 h2)
4921 "Sort threads by root recipient."
4922 (gnus-article-sort-by-recipient
4923 (gnus-thread-header h1) (gnus-thread-header h2)))
4925 (defsubst gnus-article-sort-by-subject (h1 h2)
4926 "Sort articles by root subject."
4928 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4929 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4931 (defun gnus-thread-sort-by-subject (h1 h2)
4932 "Sort threads by root subject."
4933 (gnus-article-sort-by-subject
4934 (gnus-thread-header h1) (gnus-thread-header h2)))
4936 (defsubst gnus-article-sort-by-date (h1 h2)
4937 "Sort articles by root article date."
4939 (gnus-date-get-time (mail-header-date h1))
4940 (gnus-date-get-time (mail-header-date h2))))
4942 (defun gnus-thread-sort-by-date (h1 h2)
4943 "Sort threads by root article date."
4944 (gnus-article-sort-by-date
4945 (gnus-thread-header h1) (gnus-thread-header h2)))
4947 (defsubst gnus-article-sort-by-score (h1 h2)
4948 "Sort articles by root article score.
4949 Unscored articles will be counted as having a score of zero."
4950 (> (or (cdr (assq (mail-header-number h1)
4951 gnus-newsgroup-scored))
4952 gnus-summary-default-score 0)
4953 (or (cdr (assq (mail-header-number h2)
4954 gnus-newsgroup-scored))
4955 gnus-summary-default-score 0)))
4957 (defun gnus-thread-sort-by-score (h1 h2)
4958 "Sort threads by root article score."
4959 (gnus-article-sort-by-score
4960 (gnus-thread-header h1) (gnus-thread-header h2)))
4962 (defun gnus-thread-sort-by-total-score (h1 h2)
4963 "Sort threads by the sum of all scores in the thread.
4964 Unscored articles will be counted as having a score of zero."
4965 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4967 (defun gnus-thread-total-score (thread)
4968 ;; This function find the total score of THREAD.
4973 (if (stringp (car thread))
4974 (apply gnus-thread-score-function 0
4975 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4976 (gnus-thread-total-score-1 thread)))
4978 (gnus-thread-total-score-1 (list thread)))))
4980 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4981 "Sort threads such that the thread with the most recently arrived article comes first."
4982 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4984 (defun gnus-thread-highest-number (thread)
4985 "Return the highest article number in THREAD."
4986 (apply 'max (mapcar (lambda (header)
4987 (mail-header-number header))
4988 (message-flatten-list thread))))
4990 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4991 "Sort threads such that the thread with the most recently dated article comes first."
4992 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4994 ; Since this is called not only to sort the top-level threads, but
4995 ; also in recursive sorts to order the articles within a thread, each
4996 ; article will be processed many times. Thus it speeds things up
4997 ; quite a bit to use gnus-date-get-time, which caches the time value.
4998 (defun gnus-thread-latest-date (thread)
4999 "Return the highest article date in THREAD."
5001 (mapcar (lambda (header) (gnus-float-time
5003 (mail-header-date header))))
5004 (message-flatten-list thread))))
5006 (defun gnus-thread-total-score-1 (root)
5007 ;; This function find the total score of the thread below ROOT.
5008 (setq root (car root))
5009 (apply gnus-thread-score-function
5011 (mapcar 'gnus-thread-total-score
5012 (cdr (gnus-id-to-thread (mail-header-id root))))
5013 (when (> (mail-header-number root) 0)
5014 (list (or (cdr (assq (mail-header-number root)
5015 gnus-newsgroup-scored))
5016 gnus-summary-default-score 0))))
5017 (list gnus-summary-default-score)
5020 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5021 (defvar gnus-tmp-prev-subject nil)
5022 (defvar gnus-tmp-false-parent nil)
5023 (defvar gnus-tmp-root-expunged nil)
5024 (defvar gnus-tmp-dummy-line nil)
5026 (defun gnus-extra-header (type &optional header)
5027 "Return the extra header of TYPE."
5028 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5031 (defvar gnus-tmp-thread-tree-header-string "")
5033 (defcustom gnus-sum-thread-tree-root "> "
5034 "With %B spec, used for the root of a thread.
5035 If nil, use subject instead."
5037 :type '(radio (const :format "%v " nil) string)
5038 :group 'gnus-thread)
5040 (defcustom gnus-sum-thread-tree-false-root "> "
5041 "With %B spec, used for a false root of a thread.
5042 If nil, use subject instead."
5044 :type '(radio (const :format "%v " nil) string)
5045 :group 'gnus-thread)
5047 (defcustom gnus-sum-thread-tree-single-indent ""
5048 "With %B spec, used for a thread with just one message.
5049 If nil, use subject instead."
5051 :type '(radio (const :format "%v " nil) string)
5052 :group 'gnus-thread)
5054 (defcustom gnus-sum-thread-tree-vertical "| "
5055 "With %B spec, used for drawing a vertical line."
5058 :group 'gnus-thread)
5060 (defcustom gnus-sum-thread-tree-indent " "
5061 "With %B spec, used for indenting."
5064 :group 'gnus-thread)
5066 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5067 "With %B spec, used for a leaf with brothers."
5070 :group 'gnus-thread)
5072 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5073 "With %B spec, used for a leaf without brothers."
5076 :group 'gnus-thread)
5078 (defcustom gnus-summary-display-while-building nil
5079 "If non-nil, show and update the summary buffer as it's being built.
5080 If the value is t, update the buffer after every line is inserted. If
5081 the value is an integer (N), update the display every N lines."
5084 :type '(choice (const :tag "off" nil)
5086 (const :tag "frequently" t)))
5088 (defun gnus-summary-prepare-threads (threads)
5089 "Prepare summary buffer from THREADS and indentation LEVEL.
5090 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5091 or a straight list of headers."
5092 (gnus-message 7 "Generating summary...")
5094 (setq gnus-newsgroup-threads threads)
5097 (let ((gnus-tmp-level 0)
5098 (default-score (or gnus-summary-default-score 0))
5099 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5100 (building-line-count gnus-summary-display-while-building)
5101 (building-count (integerp gnus-summary-display-while-building))
5102 thread number subject stack state gnus-tmp-gathered beg-match
5103 new-roots gnus-tmp-new-adopts thread-end simp-subject
5104 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5105 gnus-tmp-replied gnus-tmp-subject-or-nil
5106 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5107 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5108 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5111 (setq gnus-tmp-prev-subject nil
5112 gnus-tmp-thread-tree-header-string "")
5114 (if (vectorp (car threads))
5115 ;; If this is a straight (sic) list of headers, then a
5116 ;; threaded summary display isn't required, so we just create
5117 ;; an unthreaded one.
5118 (gnus-summary-prepare-unthreaded threads)
5120 ;; Do the threaded display.
5122 (if gnus-summary-display-while-building
5123 (switch-to-buffer (buffer-name)))
5124 (while (or threads stack gnus-tmp-new-adopts new-roots)
5126 (if (and (= gnus-tmp-level 0)
5129 (not gnus-tmp-false-parent)
5130 (or gnus-tmp-new-adopts new-roots))
5131 (if gnus-tmp-new-adopts
5132 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5133 thread (list (car gnus-tmp-new-adopts))
5134 gnus-tmp-header (caar thread)
5135 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5137 (setq thread (list (car new-roots))
5138 gnus-tmp-header (caar thread)
5139 new-roots (cdr new-roots))))
5142 ;; If there are some threads, we do them before the
5143 ;; threads on the stack.
5144 (setq thread threads
5145 gnus-tmp-header (caar thread))
5146 ;; There were no current threads, so we pop something off
5148 (setq state (car stack)
5149 gnus-tmp-level (car state)
5150 tree-stack (cadr state)
5151 thread (caddr state)
5153 gnus-tmp-header (caar thread))))
5155 (setq gnus-tmp-false-parent nil)
5156 (setq gnus-tmp-root-expunged nil)
5157 (setq thread-end nil)
5159 (if (stringp gnus-tmp-header)
5160 ;; The header is a dummy root.
5162 ((eq gnus-summary-make-false-root 'adopt)
5163 ;; We let the first article adopt the rest.
5164 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5166 (setq gnus-tmp-gathered
5168 (lambda (h) (mail-header-number (car h)))
5171 (setq thread (cons (list (caar thread)
5174 (setq gnus-tmp-level -1
5175 gnus-tmp-false-parent t))
5176 ((eq gnus-summary-make-false-root 'empty)
5177 ;; We print adopted articles with empty subject fields.
5178 (setq gnus-tmp-gathered
5180 (lambda (h) (mail-header-number (car h)))
5183 (setq gnus-tmp-level -1))
5184 ((eq gnus-summary-make-false-root 'dummy)
5185 ;; We remember that we probably want to output a dummy
5187 (setq gnus-tmp-dummy-line gnus-tmp-header)
5188 (setq gnus-tmp-prev-subject gnus-tmp-header))
5190 ;; We do not make a root for the gathered
5191 ;; sub-threads at all.
5192 (setq gnus-tmp-level -1)))
5194 (setq number (mail-header-number gnus-tmp-header)
5195 subject (mail-header-subject gnus-tmp-header)
5196 simp-subject (gnus-simplify-subject-fully subject))
5199 ;; If the thread has changed subject, we might want to make
5200 ;; this subthread into a root.
5201 ((and (null gnus-thread-ignore-subject)
5202 (not (zerop gnus-tmp-level))
5203 gnus-tmp-prev-subject
5204 (not (string= gnus-tmp-prev-subject simp-subject)))
5205 (setq new-roots (nconc new-roots (list (car thread)))
5207 gnus-tmp-header nil))
5208 ;; If the article lies outside the current limit,
5209 ;; then we do not display it.
5210 ((not (memq number gnus-newsgroup-limit))
5211 (setq gnus-tmp-gathered
5213 (lambda (h) (mail-header-number (car h)))
5216 (setq gnus-tmp-new-adopts (if (cdar thread)
5217 (append gnus-tmp-new-adopts
5219 gnus-tmp-new-adopts)
5221 gnus-tmp-header nil)
5222 (when (zerop gnus-tmp-level)
5223 (setq gnus-tmp-root-expunged t)))
5224 ;; Perhaps this article is to be marked as read?
5225 ((and gnus-summary-mark-below
5226 (< (or (cdr (assq number gnus-newsgroup-scored))
5228 gnus-summary-mark-below)
5229 ;; Don't touch sparse articles.
5230 (not (gnus-summary-article-sparse-p number))
5231 (not (gnus-summary-article-ancient-p number)))
5232 (setq gnus-newsgroup-unreads
5233 (delq number gnus-newsgroup-unreads))
5234 (if gnus-newsgroup-auto-expire
5235 (setq gnus-newsgroup-expirable
5236 (gnus-add-to-sorted-list
5237 gnus-newsgroup-expirable number))
5238 (push (cons number gnus-low-score-mark)
5239 gnus-newsgroup-reads))))
5241 (when gnus-tmp-header
5242 ;; We may have an old dummy line to output before this
5244 (when (and gnus-tmp-dummy-line
5247 (mail-header-subject gnus-tmp-header)))
5248 (gnus-summary-insert-dummy-line
5249 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5250 (setq gnus-tmp-dummy-line nil))
5252 ;; Compute the mark.
5253 (setq gnus-tmp-unread (gnus-article-mark number))
5255 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5256 gnus-tmp-header gnus-tmp-level)
5257 gnus-newsgroup-data)
5259 ;; Actually insert the line.
5261 gnus-tmp-subject-or-nil
5263 ((and gnus-thread-ignore-subject
5264 gnus-tmp-prev-subject
5265 (not (string= gnus-tmp-prev-subject simp-subject)))
5267 ((zerop gnus-tmp-level)
5268 (if (and (eq gnus-summary-make-false-root 'empty)
5269 (memq number gnus-tmp-gathered)
5270 gnus-tmp-prev-subject
5271 (string= gnus-tmp-prev-subject simp-subject))
5272 gnus-summary-same-subject
5274 (t gnus-summary-same-subject)))
5275 (if (and (eq gnus-summary-make-false-root 'adopt)
5276 (= gnus-tmp-level 1)
5277 (memq number gnus-tmp-gathered))
5278 (setq gnus-tmp-opening-bracket ?\<
5279 gnus-tmp-closing-bracket ?\>)
5280 (setq gnus-tmp-opening-bracket ?\[
5281 gnus-tmp-closing-bracket ?\]))
5282 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5283 (gnus-make-thread-indent-array
5284 (max (* 2 (length gnus-thread-indent-array))
5287 gnus-tmp-indentation
5288 (aref gnus-thread-indent-array gnus-tmp-level)
5289 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5290 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5291 gnus-summary-default-score 0)
5293 (if (or (null gnus-summary-default-score)
5294 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5295 gnus-summary-zcore-fuzz))
5297 (if (< gnus-tmp-score gnus-summary-default-score)
5298 gnus-score-below-mark gnus-score-over-mark))
5300 (cond ((memq number gnus-newsgroup-processable)
5302 ((memq number gnus-newsgroup-cached)
5304 ((memq number gnus-newsgroup-replied)
5306 ((memq number gnus-newsgroup-forwarded)
5307 gnus-forwarded-mark)
5308 ((memq number gnus-newsgroup-saved)
5310 ((memq number gnus-newsgroup-recent)
5312 ((memq number gnus-newsgroup-unseen)
5316 (cond ((memq number gnus-newsgroup-undownloaded)
5317 gnus-undownloaded-mark)
5318 (gnus-newsgroup-agentized
5319 gnus-downloaded-mark)
5322 gnus-tmp-from (mail-header-from gnus-tmp-header)
5325 ((string-match "<[^>]+> *$" gnus-tmp-from)
5326 (setq beg-match (match-beginning 0))
5327 (or (and (string-match "^\".+\"" gnus-tmp-from)
5328 (substring gnus-tmp-from 1 (1- (match-end 0))))
5329 (substring gnus-tmp-from 0 beg-match)))
5330 ((string-match "(.+)" gnus-tmp-from)
5331 (substring gnus-tmp-from
5332 (1+ (match-beginning 0)) (1- (match-end 0))))
5336 gnus-tmp-thread-tree-header-string
5338 ((not gnus-show-threads) "")
5339 ((zerop gnus-tmp-level)
5340 (cond ((cdar thread)
5341 (or gnus-sum-thread-tree-root subject))
5342 (gnus-tmp-new-adopts
5343 (or gnus-sum-thread-tree-false-root subject))
5345 (or gnus-sum-thread-tree-single-indent subject))))
5347 (concat (apply 'concat
5348 (mapcar (lambda (item)
5350 gnus-sum-thread-tree-vertical
5351 gnus-sum-thread-tree-indent))
5352 (cdr (reverse tree-stack))))
5354 gnus-sum-thread-tree-leaf-with-other
5355 gnus-sum-thread-tree-single-leaf)))))
5356 (when (string= gnus-tmp-name "")
5357 (setq gnus-tmp-name gnus-tmp-from))
5358 (unless (numberp gnus-tmp-lines)
5359 (setq gnus-tmp-lines -1))
5360 (if (= gnus-tmp-lines -1)
5361 (setq gnus-tmp-lines "?")
5362 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5363 (gnus-put-text-property
5365 (progn (eval gnus-summary-line-format-spec) (point))
5366 'gnus-number number)
5369 (gnus-run-hooks 'gnus-summary-update-hook)
5372 (setq gnus-tmp-prev-subject simp-subject)))
5374 (when (nth 1 thread)
5375 (push (list (max 0 gnus-tmp-level)
5376 (copy-sequence tree-stack)
5379 (push (if (nth 1 thread) 1 0) tree-stack)
5380 (incf gnus-tmp-level)
5381 (setq threads (if thread-end nil (cdar thread)))
5382 (if gnus-summary-display-while-building
5385 ;; use a set frequency
5386 (setq building-line-count (1- building-line-count))
5387 (when (= building-line-count 0)
5389 (setq building-line-count
5390 gnus-summary-display-while-building)))
5394 (setq gnus-tmp-level 0)))))
5395 (gnus-message 7 "Generating summary...done"))
5397 (defun gnus-summary-prepare-unthreaded (headers)
5398 "Generate an unthreaded summary buffer based on HEADERS."
5399 (let (header number mark)
5404 ;; We may have to root out some bad articles...
5405 (when (memq (setq number (mail-header-number
5406 (setq header (pop headers))))
5407 gnus-newsgroup-limit)
5408 ;; Mark article as read when it has a low score.
5409 (when (and gnus-summary-mark-below
5410 (< (or (cdr (assq number gnus-newsgroup-scored))
5411 gnus-summary-default-score 0)
5412 gnus-summary-mark-below)
5413 (not (gnus-summary-article-ancient-p number)))
5414 (setq gnus-newsgroup-unreads
5415 (delq number gnus-newsgroup-unreads))
5416 (if gnus-newsgroup-auto-expire
5417 (push number gnus-newsgroup-expirable)
5418 (push (cons number gnus-low-score-mark)
5419 gnus-newsgroup-reads)))
5421 (setq mark (gnus-article-mark number))
5422 (push (gnus-data-make number mark (1+ (point)) header 0)
5423 gnus-newsgroup-data)
5424 (gnus-summary-insert-line
5426 (memq number gnus-newsgroup-undownloaded)
5427 mark (memq number gnus-newsgroup-replied)
5428 (memq number gnus-newsgroup-expirable)
5429 (mail-header-subject header) nil
5430 (cdr (assq number gnus-newsgroup-scored))
5431 (memq number gnus-newsgroup-processable))))))
5433 (defun gnus-summary-remove-list-identifiers ()
5434 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5435 (let ((regexp (if (consp gnus-list-identifiers)
5436 (mapconcat 'identity gnus-list-identifiers " *\\|")
5437 gnus-list-identifiers))
5440 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5441 (dolist (header gnus-newsgroup-headers)
5442 (setq subject (mail-header-subject header)
5444 (while (string-match regexp subject)
5446 (concat (substring subject 0 (match-beginning 1))
5447 (substring subject (match-end 0)))
5450 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5452 (concat (substring subject 0 (match-beginning 1))
5453 (substring subject (match-end 1)))))
5454 (mail-header-set-subject header subject))))))
5456 (defun gnus-fetch-headers (articles)
5457 "Fetch headers of ARTICLES."
5458 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5459 (gnus-message 5 "Fetching headers for %s..." name)
5462 (setq gnus-headers-retrieved-by
5463 (gnus-retrieve-headers
5464 articles gnus-newsgroup-name
5465 ;; We might want to fetch old headers, but
5466 ;; not if there is only 1 article.
5468 (not (eq gnus-fetch-old-headers 'some))
5469 (not (numberp gnus-fetch-old-headers)))
5470 (> (length articles) 1))
5471 gnus-fetch-old-headers))))
5472 (gnus-get-newsgroup-headers-xover
5473 articles nil nil gnus-newsgroup-name t)
5474 (gnus-get-newsgroup-headers))
5475 (gnus-message 5 "Fetching headers for %s...done" name))))
5477 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5478 "Select newsgroup GROUP.
5479 If READ-ALL is non-nil, all articles in the group are selected.
5480 If SELECT-ARTICLES, only select those articles from GROUP."
5481 (let* ((entry (gnus-group-entry group))
5482 ;;!!! Dirty hack; should be removed.
5483 (gnus-summary-ignore-duplicates
5484 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5486 gnus-summary-ignore-duplicates))
5487 (info (nth 2 entry))
5488 charset articles fetched-articles cached)
5490 (unless (gnus-check-server
5491 (set (make-local-variable 'gnus-current-select-method)
5492 (gnus-find-method-for-group group)))
5493 (error "Couldn't open server"))
5494 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5496 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5497 (gnus-activate-group group) ; Or we can activate it...
5498 (progn ; Or we bug out.
5499 (when (equal major-mode 'gnus-summary-mode)
5500 (gnus-kill-buffer (current-buffer)))
5502 "Couldn't activate group %s: %s"
5503 (mm-decode-coding-string group charset)
5504 (mm-decode-coding-string (gnus-status-message group) charset))))
5506 (unless (gnus-request-group group t)
5507 (when (equal major-mode 'gnus-summary-mode)
5508 (gnus-kill-buffer (current-buffer)))
5509 (error "Couldn't request group %s: %s"
5510 (mm-decode-coding-string group charset)
5511 (mm-decode-coding-string (gnus-status-message group) charset)))
5514 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5516 (setq gnus-summary-use-undownloaded-faces
5517 (gnus-agent-find-parameter
5519 'agent-enable-undownloaded-faces)))
5521 (setq gnus-newsgroup-name group
5522 gnus-newsgroup-unselected nil
5523 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5525 (let ((display (gnus-group-find-parameter group 'display)))
5526 (setq gnus-newsgroup-display
5528 ((not (zerop (or (car-safe read-all) 0)))
5529 ;; The user entered the group with C-u SPC/RET, let's show
5535 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5537 ;; The following is probably the "correct" solution, but
5538 ;; it makes Gnus fetch all headers and then limit the
5539 ;; articles (which is slow), so instead we hack the
5540 ;; select-articles parameter instead. -- Simon Josefsson
5543 ;; (gnus-byte-compile
5544 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5546 (setq select-articles
5547 (gnus-uncompress-range
5548 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5552 (cdr (gnus-active group)))))
5557 (gnus-summary-setup-default-charset)
5559 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5560 (when (gnus-virtual-group-p group)
5561 (setq cached gnus-newsgroup-cached))
5563 (setq gnus-newsgroup-unreads
5564 (gnus-sorted-ndifference
5565 (gnus-sorted-ndifference gnus-newsgroup-unreads
5566 gnus-newsgroup-marked)
5567 gnus-newsgroup-dormant))
5569 (setq gnus-newsgroup-processable nil)
5571 (gnus-update-read-articles group gnus-newsgroup-unreads)
5573 ;; Adjust and set lists of article marks.
5575 (gnus-adjust-marked-articles info))
5576 (if (setq articles select-articles)
5577 (setq gnus-newsgroup-unselected
5578 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5579 (setq articles (gnus-articles-to-read group read-all)))
5583 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5585 ((eq articles 0) nil)
5587 ;; Init the dependencies hash table.
5588 (setq gnus-newsgroup-dependencies
5589 (gnus-make-hashtable (length articles)))
5590 (gnus-set-global-variables)
5591 ;; Retrieve the headers and read them in.
5593 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5595 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5597 (setq gnus-newsgroup-cached cached))
5599 ;; Suppress duplicates?
5600 (when gnus-suppress-duplicates
5601 (gnus-dup-suppress-articles))
5603 ;; Set the initial limit.
5604 (setq gnus-newsgroup-limit (copy-sequence articles))
5605 ;; Remove canceled articles from the list of unread articles.
5606 (setq fetched-articles
5607 (mapcar (lambda (headers) (mail-header-number headers))
5608 gnus-newsgroup-headers))
5609 (setq gnus-newsgroup-articles fetched-articles)
5610 (setq gnus-newsgroup-unreads
5611 (gnus-sorted-nintersection
5612 gnus-newsgroup-unreads fetched-articles))
5613 (gnus-compute-unseen-list)
5615 ;; Removed marked articles that do not exist.
5616 (gnus-update-missing-marks
5617 (gnus-sorted-difference articles fetched-articles))
5618 ;; We might want to build some more threads first.
5619 (when (and gnus-fetch-old-headers
5620 (eq gnus-headers-retrieved-by 'nov))
5621 (if (eq gnus-fetch-old-headers 'invisible)
5622 (gnus-build-all-threads)
5623 (gnus-build-old-threads)))
5624 ;; Let the Gnus agent mark articles as read.
5626 (gnus-agent-get-undownloaded-list))
5627 ;; Remove list identifiers from subject
5628 (when gnus-list-identifiers
5629 (gnus-summary-remove-list-identifiers))
5630 ;; Check whether auto-expire is to be done in this group.
5631 (setq gnus-newsgroup-auto-expire
5632 (gnus-group-auto-expirable-p group))
5633 ;; Set up the article buffer now, if necessary.
5634 (unless (and gnus-single-article-buffer
5635 (equal gnus-article-buffer "*Article*"))
5636 (gnus-article-setup-buffer))
5637 ;; First and last article in this newsgroup.
5638 (when gnus-newsgroup-headers
5639 (setq gnus-newsgroup-begin
5640 (mail-header-number (car gnus-newsgroup-headers))
5643 (gnus-last-element gnus-newsgroup-headers))))
5644 ;; GROUP is successfully selected.
5645 (or gnus-newsgroup-headers t)))))
5647 (defun gnus-compute-unseen-list ()
5648 ;; The `seen' marks are treated specially.
5649 (if (not gnus-newsgroup-seen)
5650 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5651 (setq gnus-newsgroup-unseen
5652 (gnus-inverse-list-range-intersection
5653 gnus-newsgroup-articles gnus-newsgroup-seen))))
5655 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5657 (defun gnus-summary-display-make-predicate (display)
5658 (require 'gnus-agent)
5659 (when (= (length display) 1)
5660 (setq display (car display)))
5661 (unless gnus-summary-display-cache
5662 (dolist (elem (append '((unread . unread)
5665 gnus-article-mark-lists))
5666 (push (cons (cdr elem)
5668 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5669 gnus-summary-display-cache)))
5670 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5671 (gnus-category-predicate-cache gnus-summary-display-cache))
5672 (gnus-get-predicate display)))
5674 ;; Uses the dynamically bound `number' variable.
5676 (defun gnus-article-marked-p (type &optional article)
5677 (let ((article (or article number)))
5680 (memq article gnus-newsgroup-marked))
5682 (memq article gnus-newsgroup-spam-marked))
5684 (memq article gnus-newsgroup-unsendable))
5685 ((eq type 'undownload)
5686 (memq article gnus-newsgroup-undownloaded))
5687 ((eq type 'download)
5688 (memq article gnus-newsgroup-downloadable))
5690 (memq article gnus-newsgroup-unreads))
5692 (memq article gnus-newsgroup-reads))
5694 (memq article gnus-newsgroup-dormant) )
5696 (memq article gnus-newsgroup-expirable))
5698 (memq article gnus-newsgroup-replied))
5700 (memq article gnus-newsgroup-killed))
5701 ((eq type 'bookmark)
5702 (assq article gnus-newsgroup-bookmarks))
5704 (assq article gnus-newsgroup-scored))
5706 (memq article gnus-newsgroup-saved))
5708 (memq article gnus-newsgroup-cached))
5710 (memq article gnus-newsgroup-forwarded))
5712 (not (memq article gnus-newsgroup-unseen)))
5714 (memq article gnus-newsgroup-recent))
5717 (defun gnus-articles-to-read (group &optional read-all)
5718 "Find out what articles the user wants to read."
5720 ;; Select all articles if `read-all' is non-nil, or if there
5721 ;; are no unread articles.
5723 (and (zerop (length gnus-newsgroup-marked))
5724 (zerop (length gnus-newsgroup-unreads)))
5725 ;; Fetch all if the predicate is non-nil.
5726 gnus-newsgroup-display)
5727 ;; We want to select the headers for all the articles in
5728 ;; the group, so we select either all the active
5729 ;; articles in the group, or (if that's nil), the
5730 ;; articles in the cache.
5732 (if gnus-newsgroup-maximum-articles
5733 (let ((active (gnus-active group)))
5734 (gnus-uncompress-range
5735 (cons (max (car active)
5737 gnus-newsgroup-maximum-articles
5740 (gnus-uncompress-range (gnus-active group)))
5741 (gnus-cache-articles-in-group group))
5742 ;; Select only the "normal" subset of articles.
5744 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5745 gnus-newsgroup-unreads)))
5746 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5747 (scored (length scored-list))
5748 (number (length articles))
5749 (marked (+ (length gnus-newsgroup-marked)
5750 (length gnus-newsgroup-dormant)))
5755 ((numberp gnus-newsgroup-display)
5756 gnus-newsgroup-display)
5760 ((and (or (<= scored marked) (= scored number))
5761 (numberp gnus-large-newsgroup)
5762 (> number gnus-large-newsgroup))
5763 (let* ((cursor-in-echo-area nil)
5764 (initial (gnus-parameter-large-newsgroup-initial
5765 gnus-newsgroup-name))
5769 "How many articles from %s (%s %d): "
5770 (gnus-group-decoded-name gnus-newsgroup-name)
5771 (if initial "max" "default")
5774 (cons (number-to-string initial)
5776 (if (string-match "^[ \t]*$" input) number input)))
5777 ((and (> scored marked) (< scored number)
5778 (> (- scored number) 20))
5781 (format "%s %s (%d scored, %d total): "
5782 "How many articles from"
5783 (gnus-group-decoded-name group)
5785 (if (string-match "^[ \t]*$" input)
5789 (message "Quit getting the articles to read")
5791 (setq select (if (stringp select) (string-to-number select) select))
5792 (if (or (null select) (zerop select))
5794 (if (and (not (zerop scored)) (<= (abs select) scored))
5796 (setq articles (sort scored-list '<))
5797 (setq number (length articles)))
5798 (setq articles (copy-sequence articles)))
5800 (when (< (abs select) number)
5802 ;; Select the N oldest articles.
5803 (setcdr (nthcdr (1- (abs select)) articles) nil)
5804 ;; Select the N most recent articles.
5805 (setq articles (nthcdr (- number select) articles))))
5806 (setq gnus-newsgroup-unselected
5807 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5808 (when gnus-alter-articles-to-read-function
5811 (funcall gnus-alter-articles-to-read-function
5812 gnus-newsgroup-name articles)
5816 (defun gnus-killed-articles (killed articles)
5819 (when (inline (gnus-member-of-range (car articles) killed))
5820 (push (car articles) out))
5821 (setq articles (cdr articles)))
5824 (defun gnus-uncompress-marks (marks)
5825 "Uncompress the mark ranges in MARKS."
5826 (let ((uncompressed '(score bookmark))
5829 (if (memq (caar marks) uncompressed)
5830 (push (car marks) out)
5831 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5832 (setq marks (cdr marks)))
5835 (defun gnus-article-mark-to-type (mark)
5836 "Return the type of MARK."
5837 (or (cadr (assq mark gnus-article-special-mark-lists))
5840 (defun gnus-article-unpropagatable-p (mark)
5841 "Return whether MARK should be propagated to back end."
5842 (memq mark gnus-article-unpropagated-mark-lists))
5844 (defun gnus-adjust-marked-articles (info)
5845 "Set all article lists and remove all marks that are no longer valid."
5846 (let* ((marked-lists (gnus-info-marks info))
5847 (active (gnus-active (gnus-info-group info)))
5850 (types gnus-article-mark-lists)
5851 marks var articles article mark mark-type
5854 (dolist (marks marked-lists)
5855 (setq mark (car marks)
5856 mark-type (gnus-article-mark-to-type mark)
5857 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5859 ;; We set the variable according to the type of the marks list,
5860 ;; and then adjust the marks to a subset of the active articles.
5862 ;; Adjust "simple" lists - compressed yet unsorted
5863 ((eq mark-type 'list)
5864 ;; Simultaneously uncompress and clip to active range
5865 ;; See gnus-uncompress-range for a description of possible marks
5867 (if (not (cadr marks))
5869 (setq articles (if (numberp (cddr marks))
5875 (while (setq article (pop articles))
5876 (cond ((consp article)
5877 (setq bgn (max (car article) min)
5878 end (min (cdr article) max))
5880 (setq l (setcdr l (cons bgn nil))
5882 ((and (<= min article)
5884 (setq l (setcdr l (cons article nil))))))
5885 (set var (cdr lh)))))
5887 ((eq mark-type 'tuple)
5888 (set var (setq articles (cdr marks)))
5889 (when (not (listp (cdr (symbol-value var))))
5890 (set var (list (symbol-value var))))
5891 (when (not (listp (cdr articles)))
5892 (setq articles (list articles)))
5894 (when (or (not (consp (setq article (pop articles))))
5895 (< (car article) min)
5896 (> (car article) max))
5897 (set var (delq article (symbol-value var))))))
5898 ;; Adjust ranges (sloppily).
5899 ((eq mark-type 'range)
5902 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5903 ;; It should be (seen (NUM1 . NUM2)).
5904 (when (numberp (cddr marks))
5905 (setcdr marks (list (cdr marks))))
5906 (setq articles (cdr marks))
5907 (while (and articles
5908 (or (and (consp (car articles))
5909 (> min (cdar articles)))
5910 (and (numberp (car articles))
5911 (> min (car articles)))))
5913 (set var articles))))))))
5915 (defun gnus-update-missing-marks (missing)
5916 "Go through the list of MISSING articles and remove them from the mark lists."
5919 ;; Go through all types.
5920 (dolist (elem gnus-article-mark-lists)
5921 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5922 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5923 (when (symbol-value var)
5924 ;; This list has articles. So we delete all missing
5925 ;; articles from it.
5928 (set var (delq (pop m) (symbol-value var))))))))))
5930 (defun gnus-update-marks ()
5931 "Enter the various lists of marked articles into the newsgroup info list."
5932 (let ((types gnus-article-mark-lists)
5933 (info (gnus-get-info gnus-newsgroup-name))
5934 type list newmarked symbol delta-marks)
5936 ;; Add all marks lists to the list of marks lists.
5937 (while (setq type (pop types))
5938 (setq list (symbol-value
5940 (intern (format "gnus-newsgroup-%s" (car type))))))
5943 ;; Get rid of the entries of the articles that have the
5945 (when (and (eq (cdr type) 'score)
5949 (prev (cons nil list))
5952 (if (or (not (consp (car arts)))
5953 (= (cdar arts) gnus-summary-default-score))
5954 (setcdr prev (cdr arts))
5956 (setq arts (cdr arts)))
5957 (setq list (cdr all)))))
5959 (when (eq (cdr type) 'seen)
5960 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5962 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5963 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5965 (when (and (gnus-check-backend-function
5966 'request-set-mark gnus-newsgroup-name)
5967 (not (gnus-article-unpropagatable-p (cdr type))))
5968 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5969 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5970 (add (gnus-remove-from-range
5971 (gnus-copy-sequence list) old)))
5973 (push (list add 'add (list (cdr type))) delta-marks))
5975 (push (list del 'del (list (cdr type))) delta-marks))))
5978 (push (cons (cdr type) list) newmarked)))
5981 (unless (gnus-check-group gnus-newsgroup-name)
5982 (error "Can't open server for %s" gnus-newsgroup-name))
5983 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5985 ;; Enter these new marks into the info of the group.
5987 (setcar (nthcdr 3 info) newmarked)
5988 ;; Add the marks lists to the end of the info.
5990 (setcdr (nthcdr 2 info) (list newmarked))))
5992 ;; Cut off the end of the info if there's nothing else there.
5996 (when (nthcdr (decf i) info)
5997 (setcdr (nthcdr i info) nil)))))))
5999 (defun gnus-set-mode-line (where)
6000 "Set the mode line of the article or summary buffers.
6001 If WHERE is `summary', the summary mode line format will be used."
6002 ;; Is this mode line one we keep updated?
6003 (when (and (memq where gnus-updated-mode-lines)
6005 (intern (format "gnus-%s-mode-line-format-spec" where))))
6007 ;; We evaluate this in the summary buffer since these
6008 ;; variables are buffer-local to that buffer.
6009 (with-current-buffer gnus-summary-buffer
6010 ;; We bind all these variables that are used in the `eval' form
6012 (let* ((mformat (symbol-value
6014 (format "gnus-%s-mode-line-format-spec" where))))
6015 (gnus-tmp-group-name (gnus-mode-string-quote
6016 (gnus-group-decoded-name
6017 gnus-newsgroup-name)))
6018 (gnus-tmp-article-number (or gnus-current-article 0))
6019 (gnus-tmp-unread gnus-newsgroup-unreads)
6020 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
6021 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
6022 (gnus-tmp-unread-and-unselected
6023 (cond ((and (zerop gnus-tmp-unread-and-unticked)
6024 (zerop gnus-tmp-unselected))
6026 ((zerop gnus-tmp-unselected)
6027 (format "{%d more}" gnus-tmp-unread-and-unticked))
6028 (t (format "{%d(+%d) more}"
6029 gnus-tmp-unread-and-unticked
6030 gnus-tmp-unselected))))
6032 (if (and gnus-current-headers
6033 (vectorp gnus-current-headers))
6034 (gnus-mode-string-quote
6035 (mail-header-subject gnus-current-headers))
6037 bufname-length max-len
6038 gnus-tmp-header) ;; passed as argument to any user-format-funcs
6039 (setq mode-string (eval mformat))
6040 (setq bufname-length (if (string-match "%b" mode-string)
6043 (if (eq where 'summary)
6045 (get-buffer gnus-article-buffer))))
6048 (setq max-len (max 4 (if gnus-mode-non-string-length
6050 gnus-mode-non-string-length
6052 (length mode-string))))
6053 ;; We might have to chop a bit of the string off...
6054 (when (> (length mode-string) max-len)
6056 (concat (truncate-string-to-width mode-string (- max-len 3))
6058 ;; Pad the mode string a bit.
6059 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
6060 ;; Update the mode line.
6061 (setq mode-line-buffer-identification
6062 (gnus-mode-line-buffer-identification (list mode-string)))
6063 (set-buffer-modified-p t))))
6065 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6066 "Go through the HEADERS list and add all Xrefs to a hash table.
6067 The resulting hash table is returned, or nil if no Xrefs were found."
6068 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6069 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6070 (xref-hashtb (gnus-make-hashtable))
6071 start group entry number xrefs header)
6073 (setq header (pop headers))
6074 (when (and (setq xrefs (mail-header-xref header))
6075 (not (memq (setq number (mail-header-number header))
6078 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6079 (setq start (match-end 0))
6080 (setq group (if prefix
6081 (concat prefix (substring xrefs (match-beginning 1)
6083 (substring xrefs (match-beginning 1) (match-end 1))))
6085 (string-to-number (substring xrefs (match-beginning 2)
6087 (if (setq entry (gnus-gethash group xref-hashtb))
6088 (setcdr entry (cons number (cdr entry)))
6089 (gnus-sethash group (cons number nil) xref-hashtb)))))
6090 (and start xref-hashtb)))
6092 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6093 "Look through all the headers and mark the Xrefs as read."
6094 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6095 name info xref-hashtb idlist method nth4)
6096 (with-current-buffer gnus-group-buffer
6097 (when (setq xref-hashtb
6098 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6101 (unless (string= from-newsgroup (setq name (symbol-name group)))
6102 (setq idlist (symbol-value group))
6103 ;; Dead groups are not updated.
6105 (setq info (gnus-get-info name))
6106 (when (stringp (setq nth4 (gnus-info-method info)))
6107 (setq nth4 (gnus-server-to-method nth4))))
6108 ;; Only do the xrefs if the group has the same
6109 ;; select method as the group we have just read.
6110 (or (gnus-methods-equal-p
6111 nth4 (gnus-find-method-for-group from-newsgroup))
6113 (equal nth4 (setq method (gnus-find-method-for-group
6115 (and (equal (car nth4) (car method))
6116 (equal (nth 1 nth4) (nth 1 method))))
6117 gnus-use-cross-reference
6118 (or (not (eq gnus-use-cross-reference t))
6120 ;; Only do cross-references on subscribed
6121 ;; groups, if that is what is wanted.
6122 (<= (gnus-info-level info) gnus-level-subscribed))
6123 (gnus-group-make-articles-read name idlist))))
6126 (defun gnus-compute-read-articles (group articles)
6127 (let* ((entry (gnus-group-entry group))
6128 (info (nth 2 entry))
6129 (active (gnus-active group))
6132 ;; First peel off all invalid article numbers.
6134 (let ((ids articles)
6136 (while (setq id (pop ids))
6137 (when (and first (> id (cdr active)))
6138 ;; We'll end up in this situation in one particular
6139 ;; obscure situation. If you re-scan a group and get
6140 ;; a new article that is cross-posted to a different
6141 ;; group that has not been re-scanned, you might get
6142 ;; crossposted article that has a higher number than
6143 ;; Gnus believes possible. So we re-activate this
6144 ;; group as well. This might mean doing the
6145 ;; crossposting thingy will *increase* the number
6146 ;; of articles in some groups. Tsk, tsk.
6147 (setq active (or (gnus-activate-group group) active)))
6148 (when (or (> id (cdr active))
6149 (< id (car active)))
6150 (setq articles (delq id articles))))))
6151 ;; If the read list is nil, we init it.
6153 (null (gnus-info-read info))
6155 (setq ninfo (cons 1 (1- (car active))))
6156 (setq ninfo (gnus-info-read info)))
6157 ;; Then we add the read articles to the range.
6159 ninfo (setq articles (sort articles '<))))))
6161 (defun gnus-group-make-articles-read (group articles)
6162 "Update the info of GROUP to say that ARTICLES are read."
6164 (entry (gnus-group-entry group))
6165 (info (nth 2 entry))
6166 (active (gnus-active group))
6169 (setq range (gnus-compute-read-articles group articles))
6170 (with-current-buffer gnus-group-buffer
6173 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6174 (gnus-info-set-read ',info ',(gnus-info-read info))
6175 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6176 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6177 (gnus-group-update-group ,group t))))
6178 ;; Add the read articles to the range.
6179 (gnus-info-set-read info range)
6180 (gnus-request-set-mark group (list (list range 'add '(read))))
6181 ;; Then we have to re-compute how many unread
6182 ;; articles there are in this group.
6186 (setq num (- (1+ (cdr active)) (car active))))
6187 ((not (listp (cdr range)))
6188 (setq num (- (cdr active) (- (1+ (cdr range))
6192 (if (numberp (car range))
6194 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6195 (setq range (cdr range)))
6196 (setq num (- (cdr active) num))))
6197 ;; Update the number of unread articles.
6199 ;; Update the group buffer.
6200 (unless (gnus-ephemeral-group-p group)
6201 (gnus-group-update-group group t))))))
6203 (defvar gnus-newsgroup-none-id 0)
6205 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6206 (let ((cur nntp-server-buffer)
6209 (with-current-buffer gnus-summary-buffer
6210 gnus-newsgroup-dependencies)))
6211 headers id end ref number
6212 (mail-parse-charset gnus-newsgroup-charset)
6213 (mail-parse-ignored-charsets
6214 (save-current-buffer (condition-case nil
6215 (set-buffer gnus-summary-buffer)
6217 gnus-newsgroup-ignored-charsets)))
6218 (with-current-buffer nntp-server-buffer
6219 ;; Translate all TAB characters into SPACE characters.
6220 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6221 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6222 (ietf-drums-unfold-fws)
6223 (gnus-run-hooks 'gnus-parse-headers-hook)
6224 (let ((case-fold-search t)
6225 in-reply-to header p lines chars)
6226 (goto-char (point-min))
6227 ;; Search to the beginning of the next header. Error messages
6228 ;; do not begin with 2 or 3.
6229 (while (re-search-forward "^[23][0-9]+ " nil t)
6232 ;; This implementation of this function, with nine
6233 ;; search-forwards instead of the one re-search-forward and
6234 ;; a case (which basically was the old function) is actually
6235 ;; about twice as fast, even though it looks messier. You
6236 ;; can't have everything, I guess. Speed and elegance
6237 ;; doesn't always go hand in hand.
6243 (setq number (read cur))
6246 (narrow-to-region (point)
6247 (or (and (search-forward "\n.\n" nil t)
6253 (if (search-forward "\nsubject:" nil t)
6254 (funcall gnus-decode-encoded-word-function
6255 (nnheader-header-value))
6260 (if (search-forward "\nfrom:" nil t)
6261 (funcall gnus-decode-encoded-address-function
6262 (nnheader-header-value))
6267 (if (search-forward "\ndate:" nil t)
6268 (nnheader-header-value) ""))
6272 (setq id (if (re-search-forward
6273 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6274 ;; We do it this way to make sure the Message-ID
6275 ;; is (somewhat) syntactically valid.
6276 (buffer-substring (match-beginning 1)
6278 ;; If there was no message-id, we just fake one
6279 ;; to make subsequent routines simpler.
6280 (nnheader-generate-fake-message-id number))))
6284 (if (search-forward "\nreferences:" nil t)
6288 (nnheader-header-value)
6293 (search-backward ">" end t)
6296 (search-backward "<" end t)
6298 ;; Get the references from the in-reply-to header if there
6299 ;; were no references and the in-reply-to header looks
6301 (if (and (search-forward "\nin-reply-to:" nil t)
6302 (setq in-reply-to (nnheader-header-value))
6303 (string-match "<[^>]+>" in-reply-to))
6305 (setq ref (substring in-reply-to (match-beginning 0)
6307 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6308 (setq ref2 (substring in-reply-to (match-beginning 0)
6310 (when (> (length ref2) (length ref))
6317 (if (search-forward "\nchars: " nil t)
6318 (if (numberp (setq chars (ignore-errors (read cur))))
6324 (if (search-forward "\nlines: " nil t)
6325 (if (numberp (setq lines (ignore-errors (read cur))))
6331 (and (search-forward "\nxref:" nil t)
6332 (nnheader-header-value)))
6334 (when gnus-extra-headers
6335 (let ((extra gnus-extra-headers)
6339 (when (search-forward
6340 (concat "\n" (symbol-name (car extra)) ":") nil t)
6341 (push (cons (car extra) (nnheader-header-value))
6345 (when (equal id ref)
6348 (when gnus-alter-header-function
6349 (funcall gnus-alter-header-function header)
6350 (setq id (mail-header-id header)
6351 ref (gnus-parent-id (mail-header-references header))))
6354 (gnus-dependencies-add-header
6355 header dependencies force-new))
6356 (push header headers))
6357 (goto-char (point-max))
6359 (nreverse headers)))))
6361 ;; Goes through the xover lines and returns a list of vectors
6362 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6363 force-new dependencies
6364 group also-fetch-heads)
6365 "Parse the news overview data in the server buffer.
6366 Return a list of headers that match SEQUENCE (see
6367 `nntp-retrieve-headers')."
6368 ;; Get the Xref when the users reads the articles since most/some
6369 ;; NNTP servers do not include Xrefs when using XOVER.
6370 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6371 (let ((mail-parse-charset gnus-newsgroup-charset)
6372 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6373 (cur nntp-server-buffer)
6374 (dependencies (or dependencies gnus-newsgroup-dependencies))
6376 ((eq gnus-read-all-available-headers t)
6378 ((and (stringp gnus-read-all-available-headers)
6380 (string-match gnus-read-all-available-headers group))
6383 number headers header)
6384 (with-current-buffer nntp-server-buffer
6385 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6386 ;; Allow the user to mangle the headers before parsing them.
6387 (gnus-run-hooks 'gnus-parse-headers-hook)
6388 (goto-char (point-min))
6389 (gnus-parse-without-error
6390 (while (and (or sequence allp)
6392 (setq number (read cur))
6394 (while (and sequence
6395 (< (car sequence) number))
6396 (setq sequence (cdr sequence))))
6399 (eq number (car sequence))))
6401 (setq sequence (cdr sequence))
6402 (setq header (inline
6403 (gnus-nov-parse-line
6404 number dependencies force-new)))))
6405 (push header headers))
6407 ;; A common bug in inn is that if you have posted an article and
6408 ;; then retrieves the active file, it will answer correctly --
6409 ;; the new article is included. However, a NOV entry for the
6410 ;; article may not have been generated yet, so this may fail.
6411 ;; We work around this problem by retrieving the last few
6412 ;; headers using HEAD.
6413 (if (or (not also-fetch-heads)
6415 ;; We (probably) got all the headers.
6417 (let ((gnus-nov-is-evil t))
6420 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6421 (gnus-get-newsgroup-headers))))))))
6423 (defun gnus-article-get-xrefs ()
6424 "Fill in the Xref value in `gnus-current-headers', if necessary.
6425 This is meant to be called in `gnus-article-internal-prepare-hook'."
6426 (let ((headers (with-current-buffer gnus-summary-buffer
6427 gnus-current-headers)))
6428 (or (not gnus-use-cross-reference)
6430 (and (mail-header-xref headers)
6431 (not (string= (mail-header-xref headers) "")))
6432 (let ((case-fold-search t)
6435 (nnheader-narrow-to-headers)
6436 (goto-char (point-min))
6437 (when (or (and (not (eobp))
6438 (eq (downcase (char-after)) ?x)
6439 (looking-at "Xref:"))
6440 (search-forward "\nXref:" nil t))
6441 (goto-char (1+ (match-end 0)))
6442 (setq xref (buffer-substring (point) (point-at-eol)))
6443 (mail-header-set-xref headers xref)))))))
6445 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6446 "Find article ID and insert the summary line for that article.
6447 OLD-HEADER can either be a header or a line number to insert
6448 the subject line on."
6449 (let* ((line (and (numberp old-header) old-header))
6450 (old-header (and (vectorp old-header) old-header))
6451 (header (cond ((and old-header use-old-header)
6454 (gnus-number-to-header id))
6455 (gnus-number-to-header id))
6457 (gnus-read-header id))))
6458 (number (and (numberp id) id))
6461 ;; Rebuild the thread that this article is part of and go to the
6462 ;; article we have fetched.
6463 (when (and (not gnus-show-threads)
6466 (setq d (gnus-data-find (mail-header-number old-header))))
6467 (goto-char (gnus-data-pos d))
6473 (gnus-delete-line))))))
6474 ;; Remove list identifiers from subject.
6475 (when gnus-list-identifiers
6476 (let ((gnus-newsgroup-headers (list header)))
6477 (gnus-summary-remove-list-identifiers)))
6479 (mail-header-set-number header (mail-header-number old-header)))
6480 (setq gnus-newsgroup-sparse
6481 (delq (setq number (mail-header-number header))
6482 gnus-newsgroup-sparse))
6483 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6484 (push number gnus-newsgroup-limit)
6485 (gnus-rebuild-thread (mail-header-id header) line)
6486 (gnus-summary-goto-subject number nil t))
6487 (when (and (numberp number)
6489 ;; We have to update the boundaries even if we can't fetch the
6490 ;; article if ID is a number -- so that the next `P' or `N'
6491 ;; command will fetch the previous (or next) article even
6492 ;; if the one we tried to fetch this time has been canceled.
6493 (when (> number gnus-newsgroup-end)
6494 (setq gnus-newsgroup-end number))
6495 (when (< number gnus-newsgroup-begin)
6496 (setq gnus-newsgroup-begin number))
6497 (setq gnus-newsgroup-unselected
6498 (delq number gnus-newsgroup-unselected)))
6499 ;; Report back a success?
6500 (and header (mail-header-number header))))
6502 ;;; Process/prefix in the summary buffer
6504 (defun gnus-summary-work-articles (n)
6505 "Return a list of articles to be worked upon.
6506 The prefix argument, the list of process marked articles, and the
6507 current article will be taken into consideration."
6508 (with-current-buffer gnus-summary-buffer
6511 ;; A numerical prefix has been given.
6512 (setq n (prefix-numeric-value n))
6513 (let ((backward (< n 0))
6514 (n (abs (prefix-numeric-value n)))
6519 (push (setq article (gnus-summary-article-number))
6522 (gnus-summary-find-prev nil article)
6523 (gnus-summary-find-next nil article)))
6525 (nreverse articles)))
6526 ((and (gnus-region-active-p) (mark))
6527 (message "region active")
6528 ;; Work on the region between point and mark.
6529 (let ((max (max (point) (mark)))
6532 (goto-char (min (point) (mark)))
6535 (push (setq article (gnus-summary-article-number)) articles)
6536 (gnus-summary-find-next nil article)
6538 (nreverse articles))))
6539 (gnus-newsgroup-processable
6540 ;; There are process-marked articles present.
6541 ;; Save current state.
6542 (gnus-summary-save-process-mark)
6544 (reverse gnus-newsgroup-processable))
6546 ;; Just return the current article.
6547 (list (gnus-summary-article-number))))))
6549 (defmacro gnus-summary-iterate (arg &rest forms)
6550 "Iterate over the process/prefixed articles and do FORMS.
6551 ARG is the interactive prefix given to the command. FORMS will be
6552 executed with point over the summary line of the articles."
6553 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6554 `(let ((,articles (gnus-summary-work-articles ,arg)))
6556 (gnus-summary-goto-subject (car ,articles))
6560 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6561 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6563 (defun gnus-summary-save-process-mark ()
6564 "Push the current set of process marked articles on the stack."
6566 (push (copy-sequence gnus-newsgroup-processable)
6567 gnus-newsgroup-process-stack))
6569 (defun gnus-summary-kill-process-mark ()
6570 "Push the current set of process marked articles on the stack and unmark."
6572 (gnus-summary-save-process-mark)
6573 (gnus-summary-unmark-all-processable))
6575 (defun gnus-summary-yank-process-mark ()
6576 "Pop the last process mark state off the stack and restore it."
6578 (unless gnus-newsgroup-process-stack
6579 (error "Empty mark stack"))
6580 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6582 (defun gnus-summary-process-mark-set (set)
6583 "Make SET into the current process marked articles."
6584 (gnus-summary-unmark-all-processable)
6585 (mapc 'gnus-summary-set-process-mark set))
6587 ;;; Searching and stuff
6589 (defun gnus-summary-search-group (&optional backward use-level)
6590 "Search for next unread newsgroup.
6591 If optional argument BACKWARD is non-nil, search backward instead."
6592 (with-current-buffer gnus-group-buffer
6593 (when (gnus-group-search-forward
6594 backward nil (if use-level (gnus-group-group-level) nil))
6595 (gnus-group-group-name))))
6597 (defun gnus-summary-best-group (&optional exclude-group)
6598 "Find the name of the best unread group.
6599 If EXCLUDE-GROUP, do not go to this group."
6600 (with-current-buffer gnus-group-buffer
6602 (gnus-group-best-unread-group exclude-group))))
6604 (defun gnus-summary-find-next (&optional unread article backward)
6606 (gnus-summary-find-prev unread article)
6607 (let* ((dummy (gnus-summary-article-intangible-p))
6608 (article (or article (gnus-summary-article-number)))
6609 (data (gnus-data-find-list article))
6611 (when (and (not dummy)
6612 (or (not gnus-summary-check-current)
6614 (not (gnus-data-unread-p (car data)))))
6615 (setq data (cdr data)))
6620 (unless (memq (gnus-data-number (car data))
6622 ((eq gnus-auto-goto-ignores
6623 'always-undownloaded)
6624 gnus-newsgroup-undownloaded)
6627 ((eq gnus-auto-goto-ignores
6629 gnus-newsgroup-unfetched)
6630 ((eq gnus-auto-goto-ignores
6632 gnus-newsgroup-undownloaded)))
6633 (when (gnus-data-unread-p (car data))
6634 (setq result (car data)
6636 (setq data (cdr data)))
6639 (goto-char (gnus-data-pos result))
6640 (gnus-data-number result)))))
6642 (defun gnus-summary-find-prev (&optional unread article)
6643 (let* ((eobp (eobp))
6644 (article (or article (gnus-summary-article-number)))
6645 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6647 (when (and (not eobp)
6648 (or (not gnus-summary-check-current)
6650 (not (gnus-data-unread-p (car data)))))
6651 (setq data (cdr data)))
6656 (unless (memq (gnus-data-number (car data))
6658 ((eq gnus-auto-goto-ignores
6659 'always-undownloaded)
6660 gnus-newsgroup-undownloaded)
6663 ((eq gnus-auto-goto-ignores
6665 gnus-newsgroup-unfetched)
6666 ((eq gnus-auto-goto-ignores
6668 gnus-newsgroup-undownloaded)))
6669 (when (gnus-data-unread-p (car data))
6670 (setq result (car data)
6672 (setq data (cdr data)))
6675 (goto-char (gnus-data-pos result))
6676 (gnus-data-number result))))
6678 (defun gnus-summary-find-subject (subject &optional unread backward article)
6679 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6680 (article (or article (gnus-summary-article-number)))
6681 (articles (gnus-data-list backward))
6682 (arts (gnus-data-find-list article articles))
6684 (when (or (not gnus-summary-check-current)
6686 (not (gnus-data-unread-p (car arts))))
6687 (setq arts (cdr arts)))
6689 (and (or (not unread)
6690 (gnus-data-unread-p (car arts)))
6691 (vectorp (gnus-data-header (car arts)))
6693 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6694 (setq result (car arts)
6696 (setq arts (cdr arts)))
6698 (goto-char (gnus-data-pos result))
6699 (gnus-data-number result))))
6701 (defun gnus-summary-search-forward (&optional unread subject backward)
6702 "Search forward for an article.
6703 If UNREAD, look for unread articles. If SUBJECT, look for
6704 articles with that subject. If BACKWARD, search backward instead."
6705 (cond (subject (gnus-summary-find-subject subject unread backward))
6706 (backward (gnus-summary-find-prev unread))
6707 (t (gnus-summary-find-next unread))))
6709 (defun gnus-recenter (&optional n)
6710 "Center point in window and redisplay frame.
6711 Also do horizontal recentering."
6713 (when (and gnus-auto-center-summary
6714 (not (eq gnus-auto-center-summary 'vertical)))
6715 (gnus-horizontal-recenter))
6716 (if (fboundp 'recenter-top-bottom)
6717 (recenter-top-bottom n)
6720 (put 'gnus-recenter 'isearch-scroll t)
6722 (defun gnus-forward-line-ignore-invisible (n)
6723 "Move N lines forward (backward if N is negative).
6724 Like forward-line, but skip over (and don't count) invisible lines."
6726 (while (and (> n 0) (not done))
6727 ;; If the following character is currently invisible,
6728 ;; skip all characters with that same `invisible' property value.
6729 (while (gnus-invisible-p (point))
6730 (goto-char (gnus-next-char-property-change (point))))
6735 (while (and (< n 0) (not done))
6737 (if (bobp) (setq done t)
6739 (while (and (not (bobp)) (gnus-invisible-p (1- (point))))
6740 (goto-char (gnus-previous-char-property-change (point))))))))
6742 (defun gnus-summary-recenter ()
6743 "Center point in the summary window.
6744 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6745 displayed, no centering will be performed."
6746 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6747 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6749 ;; The user has to want it.
6750 (when gnus-auto-center-summary
6751 (let* ((top (cond ((< (window-height) 4) 0)
6752 ((< (window-height) 7) 1)
6753 (t (if (numberp gnus-auto-center-summary)
6754 gnus-auto-center-summary
6755 (/ (1- (window-height)) 2)))))
6756 (height (1- (window-height)))
6757 (bottom (save-excursion
6758 (goto-char (point-max))
6759 (gnus-forward-line-ignore-invisible (- height))
6761 (window (get-buffer-window (current-buffer))))
6762 (when (get-buffer-window gnus-article-buffer)
6763 ;; Only do recentering when the article buffer is displayed,
6764 ;; Set the window start to either `bottom', which is the biggest
6765 ;; possible valid number, or the second line from the top,
6766 ;; whichever is the least.
6767 (let ((top-pos (save-excursion
6768 (gnus-forward-line-ignore-invisible (- top))
6770 (if (> bottom top-pos)
6771 ;; Keep the second line from the top visible
6772 (set-window-start window top-pos)
6773 ;; Try to keep the bottom line visible; if it's partially
6774 ;; obscured, either scroll one more line to make it fully
6775 ;; visible, or revert to using TOP-POS.
6777 (goto-char (point-max))
6778 (gnus-forward-line-ignore-invisible -1)
6779 (let ((last-line-start (point)))
6781 (set-window-start window (point) t)
6782 (when (not (pos-visible-in-window-p last-line-start window))
6783 (gnus-forward-line-ignore-invisible 1)
6784 (set-window-start window (min (point) top-pos) t)))))))
6785 ;; Do horizontal recentering while we're at it.
6786 (when (and (get-buffer-window (current-buffer) t)
6787 (not (eq gnus-auto-center-summary 'vertical)))
6788 (let ((selected (selected-window)))
6789 (select-window (get-buffer-window (current-buffer) t))
6790 (gnus-summary-position-point)
6791 (gnus-horizontal-recenter)
6792 (select-window selected))))))
6794 (defun gnus-summary-jump-to-group (newsgroup)
6795 "Move point to NEWSGROUP in group mode buffer."
6796 ;; Keep update point of group mode buffer if visible.
6797 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6798 (save-window-excursion
6799 ;; Take care of tree window mode.
6800 (when (get-buffer-window gnus-group-buffer)
6801 (pop-to-buffer gnus-group-buffer))
6802 (gnus-group-jump-to-group newsgroup))
6804 ;; Take care of tree window mode.
6805 (if (get-buffer-window gnus-group-buffer 0)
6806 (pop-to-buffer gnus-group-buffer)
6807 (set-buffer gnus-group-buffer))
6808 (gnus-group-jump-to-group newsgroup))))
6810 ;; This function returns a list of article numbers based on the
6811 ;; difference between the ranges of read articles in this group and
6812 ;; the range of active articles.
6813 (defun gnus-list-of-unread-articles (group)
6814 (let* ((read (gnus-info-read (gnus-get-info group)))
6815 (active (or (gnus-active group) (gnus-activate-group group)))
6816 (last (or (cdr active)
6817 (error "Group %s couldn't be activated " group)))
6818 (bottom (if gnus-newsgroup-maximum-articles
6820 (- last gnus-newsgroup-maximum-articles -1))
6823 ;; If none are read, then all are unread.
6826 ;; If the range of read articles is a single range, then the
6827 ;; first unread article is the article after the last read
6828 ;; article. Sounds logical, doesn't it?
6829 (if (and (not (listp (cdr read)))
6830 (or (< (car read) bottom)
6831 (progn (setq read (list read))
6833 (setq first (max bottom (1+ (cdr read))))
6834 ;; `read' is a list of ranges.
6835 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6838 (setq first bottom))
6841 (while (< first nlast)
6842 (setq unread (cons first unread)
6844 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6845 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6846 (setq read (cdr read)))))
6847 ;; And add the last unread articles.
6848 (while (<= first last)
6849 (setq unread (cons first unread)
6851 ;; Return the list of unread articles.
6852 (delq 0 (nreverse unread))))
6854 (defun gnus-list-of-read-articles (group)
6855 "Return a list of unread, unticked and non-dormant articles."
6856 (let* ((info (gnus-get-info group))
6857 (marked (gnus-info-marks info))
6858 (active (gnus-active group)))
6860 (gnus-list-range-difference
6861 (gnus-list-range-difference
6862 (gnus-sorted-complement
6863 (gnus-uncompress-range
6864 (if gnus-newsgroup-maximum-articles
6865 (cons (max (car active)
6867 gnus-newsgroup-maximum-articles
6871 (gnus-list-of-unread-articles group))
6872 (cdr (assq 'dormant marked)))
6873 (cdr (assq 'tick marked))))))
6875 ;; This function returns a sequence of article numbers based on the
6876 ;; difference between the ranges of read articles in this group and
6877 ;; the range of active articles.
6878 (defun gnus-sequence-of-unread-articles (group)
6879 (let* ((read (gnus-info-read (gnus-get-info group)))
6880 (active (or (gnus-active group) (gnus-activate-group group)))
6882 (bottom (if gnus-newsgroup-maximum-articles
6884 (- last gnus-newsgroup-maximum-articles -1))
6887 ;; If none are read, then all are unread.
6890 ;; If the range of read articles is a single range, then the
6891 ;; first unread article is the article after the last read
6892 ;; article. Sounds logical, doesn't it?
6893 (if (and (not (listp (cdr read)))
6894 (or (< (car read) bottom)
6895 (progn (setq read (list read))
6897 (setq first (max bottom (1+ (cdr read))))
6898 ;; `read' is a list of ranges.
6899 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6902 (setq first bottom))
6905 (push (cons first nlast) unread))
6906 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6907 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6908 (setq read (cdr read)))))
6909 ;; And add the last unread articles.
6910 (cond ((not (and first last))
6913 (push (cons first last) unread))
6915 (push first unread)))
6916 ;; Return the sequence of unread articles.
6917 (delq 0 (nreverse unread))))
6919 ;; Various summary commands
6921 (defun gnus-summary-select-article-buffer ()
6922 "Reconfigure windows to show article buffer."
6924 (if (not (gnus-buffer-live-p gnus-article-buffer))
6925 (error "There is no article buffer for this summary buffer")
6926 (gnus-configure-windows 'article)
6927 (select-window (get-buffer-window gnus-article-buffer))))
6929 (defun gnus-summary-universal-argument (arg)
6930 "Perform any operation on all articles that are process/prefixed."
6932 (let ((articles (gnus-summary-work-articles arg))
6939 (substitute-command-keys
6940 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6942 (gnus-error 1 "Undefined key")
6945 (gnus-summary-goto-subject (setq article (pop articles)))
6946 (let (gnus-newsgroup-processable)
6947 (command-execute func))
6948 (gnus-summary-remove-process-mark article)))))
6949 (gnus-summary-position-point))
6951 (defun gnus-summary-toggle-truncation (&optional arg)
6952 "Toggle truncation of summary lines.
6953 With ARG, turn line truncation on if ARG is positive."
6955 (setq truncate-lines
6956 (if (null arg) (not truncate-lines)
6957 (> (prefix-numeric-value arg) 0)))
6960 (defun gnus-summary-find-for-reselect ()
6961 "Return the number of an article to stay on across a reselect.
6962 The current article is considered, then following articles, then previous
6963 articles. An article is sought which is not cancelled and isn't a temporary
6964 insertion from another group. If there's no such then return a dummy 0."
6966 (dolist (rev '(nil t))
6967 (unless found ; don't demand the reverse list if we don't need it
6968 (let ((data (gnus-data-find-list
6969 (gnus-summary-article-number) (gnus-data-list rev))))
6970 (while (and data (not found))
6971 (if (and (< 0 (gnus-data-number (car data)))
6972 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6973 (setq found (gnus-data-number (car data))))
6974 (setq data (cdr data))))))
6977 (defun gnus-summary-reselect-current-group (&optional all rescan)
6978 "Exit and then reselect the current newsgroup.
6979 The prefix argument ALL means to select all articles."
6981 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6982 (error "Ephemeral groups can't be reselected"))
6983 (let ((current-subject (gnus-summary-find-for-reselect))
6984 (group gnus-newsgroup-name))
6985 (setq gnus-newsgroup-begin nil)
6986 (gnus-summary-exit nil 'leave-hidden)
6987 ;; We have to adjust the point of group mode buffer because
6988 ;; point was moved to the next unread newsgroup by exiting.
6989 (gnus-summary-jump-to-group group)
6992 (gnus-group-get-new-news-this-group 1)))
6993 (gnus-group-read-group all t)
6994 (gnus-summary-goto-subject current-subject nil t)))
6996 (defun gnus-summary-rescan-group (&optional all)
6997 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6999 (gnus-summary-reselect-current-group all t))
7001 (defun gnus-summary-update-info (&optional non-destructive)
7003 (let ((group gnus-newsgroup-name))
7005 (when gnus-newsgroup-kill-headers
7006 (setq gnus-newsgroup-killed
7007 (gnus-compress-sequence
7009 (gnus-list-range-intersection
7010 gnus-newsgroup-unselected gnus-newsgroup-killed)
7011 gnus-newsgroup-unreads)
7013 (unless (listp (cdr gnus-newsgroup-killed))
7014 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
7015 (let ((headers gnus-newsgroup-headers))
7016 ;; Set the new ranges of read articles.
7017 (with-current-buffer gnus-group-buffer
7018 (gnus-undo-force-boundary))
7019 (gnus-update-read-articles
7020 group (gnus-sorted-union
7021 gnus-newsgroup-unreads gnus-newsgroup-unselected))
7022 ;; Set the current article marks.
7023 (let ((gnus-newsgroup-scored
7024 (if (and (not gnus-save-score)
7025 (not non-destructive))
7027 gnus-newsgroup-scored)))
7029 (gnus-update-marks)))
7030 ;; Do the cross-ref thing.
7031 (when gnus-use-cross-reference
7032 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
7033 ;; Do not switch windows but change the buffer to work.
7034 (set-buffer gnus-group-buffer)
7035 (unless (gnus-ephemeral-group-p group)
7036 (gnus-group-update-group group)))))))
7038 (defun gnus-summary-save-newsrc (&optional force)
7039 "Save the current number of read/marked articles in the dribble buffer.
7040 The dribble buffer will then be saved.
7041 If FORCE (the prefix), also save the .newsrc file(s)."
7043 (gnus-summary-update-info t)
7045 (gnus-save-newsrc-file)
7046 (gnus-dribble-save)))
7048 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
7050 (defun gnus-summary-exit (&optional temporary leave-hidden)
7051 "Exit reading current newsgroup, and then return to group selection mode.
7052 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
7054 (gnus-set-global-variables)
7055 (when (gnus-buffer-live-p gnus-article-buffer)
7056 (with-current-buffer gnus-article-buffer
7057 (mm-destroy-parts gnus-article-mime-handles)
7058 ;; Set it to nil for safety reason.
7059 (setq gnus-article-mime-handle-alist nil)
7060 (setq gnus-article-mime-handles nil)))
7061 (gnus-kill-save-kill-buffer)
7062 (gnus-async-halt-prefetch)
7063 (let* ((group gnus-newsgroup-name)
7064 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
7065 (gnus-group-is-exiting-p t)
7068 (buf (current-buffer)))
7070 ;; Do adaptive scoring, and possibly save score files.
7071 (when gnus-newsgroup-adaptive
7072 (gnus-score-adaptive))
7073 (when gnus-use-scoring
7075 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
7076 ;; If we have several article buffers, we kill them at exit.
7077 (unless gnus-single-article-buffer
7078 (when (gnus-buffer-live-p gnus-article-buffer)
7079 (with-current-buffer gnus-article-buffer
7080 ;; Don't kill sticky article buffers
7081 (unless (eq major-mode 'gnus-sticky-article-mode)
7082 (gnus-kill-buffer gnus-article-buffer)
7083 (setq gnus-article-current nil))))
7084 (gnus-kill-buffer gnus-original-article-buffer))
7085 (when gnus-use-cache
7086 (gnus-cache-possibly-remove-articles)
7087 (gnus-cache-save-buffers))
7088 (gnus-async-prefetch-remove-group group)
7089 (when gnus-suppress-duplicates
7090 (gnus-dup-enter-articles))
7091 (when gnus-use-trees
7092 (gnus-tree-close group))
7093 (when gnus-use-cache
7094 (gnus-cache-write-active))
7095 ;; Remove entries for this group.
7096 (nnmail-purge-split-history (gnus-group-real-name group))
7097 ;; Make all changes in this group permanent.
7099 (gnus-run-hooks 'gnus-exit-group-hook)
7100 (gnus-summary-update-info))
7101 (gnus-close-group group)
7102 ;; Make sure where we were, and go to next newsgroup.
7103 (set-buffer gnus-group-buffer)
7105 (gnus-group-jump-to-group group))
7106 (gnus-run-hooks 'gnus-summary-exit-hook)
7107 (unless (or quit-config
7108 (not gnus-summary-next-group-on-exit)
7109 ;; If this group has disappeared from the summary
7110 ;; buffer, don't skip forwards.
7111 (not (string= group (gnus-group-group-name))))
7112 (gnus-group-next-unread-group 1))
7113 (setq group-point (point))
7117 (if (not gnus-kill-summary-on-exit)
7119 (gnus-deaden-summary)
7121 ;; We set all buffer-local variables to nil. It is unclear why
7122 ;; this is needed, but if we don't, buffer-local variables are
7123 ;; not garbage-collected, it seems. This would the lead to en
7124 ;; ever-growing Emacs.
7125 (gnus-summary-clear-local-variables)
7126 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7127 (gnus-summary-clear-local-variables))
7128 (when (get-buffer gnus-article-buffer)
7129 (bury-buffer gnus-article-buffer))
7130 ;; Return to group mode buffer.
7131 (when (eq mode 'gnus-summary-mode)
7132 (gnus-kill-buffer buf)))
7133 (setq gnus-current-select-method gnus-select-method)
7134 (set-buffer gnus-group-buffer)
7136 (gnus-handle-ephemeral-exit quit-config)
7137 (goto-char group-point)
7138 ;; If gnus-group-buffer is already displayed, make sure we also move
7139 ;; the cursor in the window that displays it.
7140 (let ((win (get-buffer-window (current-buffer) 0)))
7141 (if win (set-window-point win (point))))
7142 (unless leave-hidden
7143 (gnus-configure-windows 'group 'force)))
7144 ;; Clear the current group name.
7146 (setq gnus-newsgroup-name nil)))))
7148 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7149 (defun gnus-summary-exit-no-update (&optional no-questions)
7150 "Quit reading current newsgroup without updating read article info."
7152 (let* ((group gnus-newsgroup-name)
7153 (gnus-group-is-exiting-p t)
7154 (gnus-group-is-exiting-without-update-p t)
7155 (quit-config (gnus-group-quit-config group)))
7156 (when (or no-questions
7158 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7159 (gnus-async-halt-prefetch)
7160 (run-hooks 'gnus-summary-prepare-exit-hook)
7161 (when (gnus-buffer-live-p gnus-article-buffer)
7162 (with-current-buffer gnus-article-buffer
7163 (mm-destroy-parts gnus-article-mime-handles)
7164 ;; Set it to nil for safety reason.
7165 (setq gnus-article-mime-handle-alist nil)
7166 (setq gnus-article-mime-handles nil)))
7167 ;; If we have several article buffers, we kill them at exit.
7168 (unless gnus-single-article-buffer
7169 (gnus-kill-buffer gnus-article-buffer)
7170 (gnus-kill-buffer gnus-original-article-buffer)
7171 (setq gnus-article-current nil))
7172 (if (not gnus-kill-summary-on-exit)
7173 (gnus-deaden-summary)
7174 (gnus-close-group group)
7175 (gnus-summary-clear-local-variables)
7176 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7177 (gnus-summary-clear-local-variables))
7178 (gnus-kill-buffer gnus-summary-buffer))
7179 (unless gnus-single-article-buffer
7180 (setq gnus-article-current nil))
7181 (when gnus-use-trees
7182 (gnus-tree-close group))
7183 (gnus-async-prefetch-remove-group group)
7184 (when (get-buffer gnus-article-buffer)
7185 (bury-buffer gnus-article-buffer))
7186 ;; Return to the group buffer.
7187 (gnus-configure-windows 'group 'force)
7188 ;; Clear the current group name.
7189 (setq gnus-newsgroup-name nil)
7190 (unless (gnus-ephemeral-group-p group)
7191 (gnus-group-update-group group))
7192 (when (equal (gnus-group-group-name) group)
7193 (gnus-group-next-unread-group 1))
7195 (gnus-handle-ephemeral-exit quit-config)))))
7197 (defun gnus-handle-ephemeral-exit (quit-config)
7198 "Handle movement when leaving an ephemeral group.
7199 The state which existed when entering the ephemeral is reset."
7200 (if (not (buffer-name (car quit-config)))
7201 (gnus-configure-windows 'group 'force)
7202 (set-buffer (car quit-config))
7203 (cond ((eq major-mode 'gnus-summary-mode)
7204 (gnus-set-global-variables))
7205 ((eq major-mode 'gnus-article-mode)
7206 (save-current-buffer
7207 ;; The `gnus-summary-buffer' variable may point
7208 ;; to the old summary buffer when using a single
7210 (unless (gnus-buffer-live-p gnus-summary-buffer)
7211 (set-buffer gnus-group-buffer))
7212 (set-buffer gnus-summary-buffer)
7213 (gnus-set-global-variables))))
7214 (if (or (eq (cdr quit-config) 'article)
7215 (eq (cdr quit-config) 'pick))
7216 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7217 (gnus-configure-windows 'pick 'force)
7218 (gnus-configure-windows (cdr quit-config) 'force))
7219 (gnus-configure-windows (cdr quit-config) 'force))
7220 (when (eq major-mode 'gnus-summary-mode)
7221 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7222 next-unread-noselect))
7223 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7225 (gnus-summary-next-subject 1 nil t))
7226 ((eq gnus-auto-select-on-ephemeral-exit
7227 'next-unread-noselect)
7228 (gnus-summary-next-subject 1 t t))))
7229 ;; Hide the article buffer which displays the article different
7230 ;; from the one that the cursor points to in the summary buffer.
7231 (gnus-configure-windows 'summary 'force))
7232 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7233 (gnus-summary-next-subject 1))
7234 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7235 (gnus-summary-next-subject 1 t))))
7236 (gnus-summary-recenter)
7237 (gnus-summary-position-point))))
7241 (defvar gnus-dead-summary-mode-map
7242 (let ((map (make-keymap)))
7243 (suppress-keymap map)
7244 (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
7245 (dolist (key '("\C-d" "\r" "\177" [delete]))
7246 (define-key map key
'gnus-summary-wake-up-the-dead
))
7247 (dolist (key '("q" "Q"))
7248 (define-key map key
'bury-buffer
))
7251 (define-minor-mode gnus-dead-summary-mode
7252 "Minor mode for Gnus summary buffers."
7253 :lighter
" Dead" :keymap gnus-dead-summary-mode-map
7254 (unless (derived-mode-p 'gnus-summary-mode
)
7255 (setq gnus-dead-summary-mode nil
)))
7257 (defun gnus-deaden-summary ()
7258 "Make the current summary buffer into a dead summary buffer."
7259 ;; Kill any previous dead summary buffer.
7260 (when (and gnus-dead-summary
7261 (buffer-name gnus-dead-summary
))
7262 (with-current-buffer gnus-dead-summary
7263 (when gnus-dead-summary-mode
7264 (kill-buffer (current-buffer)))))
7265 ;; Make this the current dead summary.
7266 (setq gnus-dead-summary
(current-buffer))
7267 (gnus-dead-summary-mode 1)
7268 (let ((name (buffer-name)))
7269 (when (string-match "Summary" name
)
7271 (concat (substring name
0 (match-beginning 0)) "Dead "
7272 (substring name
(match-beginning 0)))
7276 (defun gnus-kill-or-deaden-summary (buffer)
7277 "Kill or deaden the summary BUFFER."
7279 (when (and (buffer-name buffer
)
7280 (not gnus-single-article-buffer
))
7281 (with-current-buffer buffer
7282 (gnus-kill-buffer gnus-article-buffer
)
7283 (gnus-kill-buffer gnus-original-article-buffer
)))
7286 (gnus-kill-summary-on-exit
7287 (when (and gnus-use-trees
7288 (gnus-buffer-exists-p buffer
))
7289 (with-current-buffer buffer
7290 (gnus-tree-close gnus-newsgroup-name
)))
7291 (gnus-kill-buffer buffer
))
7292 ;; Deaden the buffer.
7293 ((gnus-buffer-exists-p buffer
)
7294 (with-current-buffer buffer
7295 (gnus-deaden-summary))))))
7297 (defun gnus-summary-wake-up-the-dead (&rest args
)
7298 "Wake up the dead summary buffer."
7300 (gnus-dead-summary-mode -
1)
7301 (let ((name (buffer-name)))
7302 (when (string-match "Dead " name
)
7304 (concat (substring name
0 (match-beginning 0))
7305 (substring name
(match-end 0)))
7307 (gnus-message 3 "This dead summary is now alive again"))
7309 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7310 (defun gnus-summary-fetch-faq (&optional faq-dir
)
7311 "Fetch the FAQ for the current group.
7312 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7316 (when current-prefix-arg
7318 "FAQ dir: " (and (listp gnus-group-faq-directory
)
7320 gnus-group-faq-directory
))))))
7321 (let (gnus-faq-buffer)
7322 (when (setq gnus-faq-buffer
7323 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
7324 (gnus-configure-windows 'summary-faq
))))
7326 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7327 (defun gnus-summary-describe-group (&optional force
)
7328 "Describe the current newsgroup."
7330 (gnus-group-describe-group force gnus-newsgroup-name
))
7332 (defun gnus-summary-describe-briefly ()
7333 "Describe summary mode commands briefly."
7335 (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")))
7337 ;; Walking around group mode buffer from summary mode.
7339 (defun gnus-summary-next-group (&optional no-article target-group backward
)
7340 "Exit current newsgroup and then select next unread newsgroup.
7341 If prefix argument NO-ARTICLE is non-nil, no article is selected
7342 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7343 previous group instead."
7345 ;; Stop pre-fetching.
7346 (gnus-async-halt-prefetch)
7347 (let ((current-group gnus-newsgroup-name
)
7348 (current-buffer (current-buffer))
7350 ;; First we semi-exit this group to update Xrefs and all variables.
7351 ;; We can't do a real exit, because the window conf must remain
7352 ;; the same in case the user is prompted for info, and we don't
7353 ;; want the window conf to change before that...
7354 (gnus-summary-exit t
)
7355 (while (not entered
)
7356 ;; Then we find what group we are supposed to enter.
7357 (set-buffer gnus-group-buffer
)
7358 (gnus-group-jump-to-group current-group
)
7361 (if (eq gnus-keep-same-level
'best
)
7362 (gnus-summary-best-group gnus-newsgroup-name
)
7363 (gnus-summary-search-group backward gnus-keep-same-level
))))
7364 (if (not target-group
)
7365 ;; There are no further groups, so we return to the group
7368 (gnus-message 5 "Returning to the group buffer")
7370 (when (gnus-buffer-live-p current-buffer
)
7371 (set-buffer current-buffer
)
7372 (gnus-summary-exit))
7373 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
7374 ;; We try to enter the target group.
7375 (gnus-group-jump-to-group target-group
)
7376 (let ((unreads (gnus-group-group-unread)))
7377 (if (and (or (eq t unreads
)
7378 (and unreads
(not (zerop unreads
))))
7379 (gnus-summary-read-group
7380 target-group nil no-article
7381 (and (buffer-name current-buffer
) current-buffer
)
7384 (setq current-group target-group
7385 target-group nil
)))))))
7387 (defun gnus-summary-prev-group (&optional no-article
)
7388 "Exit current newsgroup and then select previous unread newsgroup.
7389 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7391 (gnus-summary-next-group no-article nil t
))
7393 ;; Walking around summary lines.
7395 (defun gnus-summary-first-subject (&optional unread undownloaded unseen
)
7396 "Go to the first subject satisfying any non-nil constraint.
7397 If UNREAD is non-nil, the article should be unread.
7398 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7399 If UNSEEN is non-nil, the article should be unseen.
7400 Returns the article selected or nil if there are no matching articles."
7404 ((null gnus-newsgroup-data
)
7405 (gnus-message 3 "No articles in the group")
7407 ;; Pick the first article.
7408 ((not (or unread undownloaded unseen
))
7409 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
7410 (gnus-data-number (car gnus-newsgroup-data
)))
7411 ;; Find the first unread article.
7413 (let ((data gnus-newsgroup-data
))
7415 (let ((num (gnus-data-number (car data
))))
7416 (or (memq num gnus-newsgroup-unfetched
)
7417 (not (or (and unread
7418 (memq num gnus-newsgroup-unreads
))
7420 (memq num gnus-newsgroup-undownloaded
))
7422 (memq num gnus-newsgroup-unseen
)))))))
7423 (setq data
(cdr data
)))
7427 (goto-char (gnus-data-pos (car data
)))
7428 (gnus-data-number (car data
)))
7429 (gnus-message 3 "No more%s articles"
7430 (let* ((r (when unread
" unread"))
7431 (d (when undownloaded
" undownloaded"))
7432 (s (when unseen
" unseen"))
7433 (l (delq nil
(list r d s
))))
7434 (cond ((= 3 (length l
))
7435 (concat r
"," d
", or" s
))
7437 (concat (car l
) ", or" (cadr l
)))
7444 (gnus-summary-position-point))))))
7446 (defun gnus-summary-next-subject (n &optional unread dont-display
)
7447 "Go to next N'th summary line.
7448 If N is negative, go to the previous N'th subject line.
7449 If UNREAD is non-nil, only unread articles are selected.
7450 The difference between N and the actual number of steps taken is
7453 (let ((backward (< n
0))
7457 (gnus-summary-find-prev unread
)
7458 (gnus-summary-find-next unread
)))
7459 (unless (zerop (setq n
(1- n
)))
7460 (gnus-summary-show-thread)))
7462 (gnus-message 7 "No more%s articles"
7463 (if unread
" unread" "")))
7464 (unless dont-display
7465 (gnus-summary-recenter)
7466 (gnus-summary-position-point))
7469 (defun gnus-summary-next-unread-subject (n)
7470 "Go to next N'th unread summary line."
7472 (gnus-summary-next-subject n t
))
7474 (defun gnus-summary-prev-subject (n &optional unread
)
7475 "Go to previous N'th summary line.
7476 If optional argument UNREAD is non-nil, only unread article is selected."
7478 (gnus-summary-next-subject (- n
) unread
))
7480 (defun gnus-summary-prev-unread-subject (n)
7481 "Go to previous N'th unread summary line."
7483 (gnus-summary-next-subject (- n
) t
))
7485 (defun gnus-summary-goto-subjects (articles)
7486 "Insert the subject header for ARTICLES in the current buffer."
7488 (dolist (article articles
)
7489 (gnus-summary-goto-subject article t
)))
7490 (gnus-summary-limit (append articles gnus-newsgroup-limit
))
7491 (gnus-summary-position-point))
7493 (defun gnus-summary-goto-subject (article &optional force silent
)
7494 "Go to the subject line of ARTICLE.
7495 If FORCE, also allow jumping to articles not currently shown."
7496 (interactive "nArticle number: ")
7497 (unless (numberp article
)
7498 (error "Article %s is not a number" article
))
7500 (data (gnus-data-find article
)))
7501 ;; We read in the article if we have to.
7504 (gnus-summary-insert-subject
7506 (if (or (numberp force
) (vectorp force
)) force
)
7508 (setq data
(gnus-data-find article
)))
7513 (gnus-message 3 "Can't find article %d" article
))
7515 (let ((pt (gnus-data-pos data
)))
7517 (gnus-summary-set-article-display-arrow pt
))
7518 (gnus-summary-position-point)
7521 ;; Walking around summary lines with displaying articles.
7523 (defun gnus-summary-expand-window (&optional arg
)
7524 "Make the summary buffer take up the entire Emacs frame.
7525 Given a prefix, will force an `article' buffer configuration."
7528 (gnus-configure-windows 'article
'force
)
7529 (gnus-configure-windows 'summary
'force
)))
7531 (defun gnus-summary-display-article (article &optional all-header
)
7532 "Display ARTICLE in article buffer."
7533 (unless (and (gnus-buffer-live-p gnus-article-buffer
)
7534 (with-current-buffer gnus-article-buffer
7535 (eq major-mode
'gnus-article-mode
)))
7536 (gnus-article-setup-buffer))
7537 (gnus-set-global-variables)
7538 (with-current-buffer gnus-article-buffer
7539 (setq gnus-article-charset gnus-newsgroup-charset
)
7540 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets
)
7541 (mm-enable-multibyte))
7545 (if gnus-summary-display-article-function
7546 (funcall gnus-summary-display-article-function article all-header
)
7547 (gnus-article-prepare article all-header
))
7548 (gnus-run-hooks 'gnus-select-article-hook
)
7549 (when (and gnus-current-article
7550 (not (zerop gnus-current-article
)))
7551 (gnus-summary-goto-subject gnus-current-article
))
7552 (gnus-summary-recenter)
7553 (when (and gnus-use-trees gnus-show-threads
)
7554 (gnus-possibly-generate-tree article
)
7555 (gnus-highlight-selected-tree article
))
7556 ;; Successfully display article.
7557 (gnus-article-set-window-start
7558 (cdr (assq article gnus-newsgroup-bookmarks
))))))
7560 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
7561 "Select the current article.
7562 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7563 non-nil, the article will be re-fetched even if it already present in
7564 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7566 ;; Make sure we are in the summary buffer to work around bbdb bug.
7567 (unless (eq major-mode
'gnus-summary-mode
)
7568 (set-buffer gnus-summary-buffer
))
7569 (let ((article (or article
(gnus-summary-article-number)))
7570 (all-headers (not (not all-headers
))) ;Must be t or nil.
7571 gnus-summary-display-article-function
)
7573 (gnus-summary-article-pseudo-p article
)
7574 (error "This is a pseudo-article"))
7575 (with-current-buffer gnus-summary-buffer
7576 (if (or (and gnus-single-article-buffer
7577 (or (null gnus-current-article
)
7578 (null gnus-article-current
)
7579 (null (get-buffer gnus-article-buffer
))
7580 (not (eq article
(cdr gnus-article-current
)))
7581 (not (equal (car gnus-article-current
)
7582 gnus-newsgroup-name
))))
7583 (and (not gnus-single-article-buffer
)
7584 (or (null gnus-current-article
)
7585 (not (eq gnus-current-article article
))))
7587 ;; The requested article is different from the current article.
7589 (gnus-summary-display-article article all-headers
)
7590 (when (gnus-buffer-live-p gnus-article-buffer
)
7591 (with-current-buffer gnus-article-buffer
7592 (if (not gnus-article-decoded-p
) ;; a local variable
7593 (mm-disable-multibyte))))
7594 (gnus-article-set-window-start
7595 (cdr (assq article gnus-newsgroup-bookmarks
)))
7599 (defun gnus-summary-force-verify-and-decrypt ()
7600 "Display buttons for signed/encrypted parts and verify/decrypt them."
7602 (let ((mm-verify-option 'known
)
7603 (mm-decrypt-option 'known
)
7604 (gnus-article-emulate-mime t
)
7605 (gnus-buttonized-mime-types (append (list "multipart/signed"
7606 "multipart/encrypted")
7607 gnus-buttonized-mime-types
)))
7608 (gnus-summary-select-article nil
'force
)))
7610 (defun gnus-summary-set-current-mark (&optional current-mark
)
7611 "Obsolete function."
7614 (defun gnus-summary-next-article (&optional unread subject backward push
)
7615 "Select the next article.
7616 If UNREAD, only unread articles are selected.
7617 If SUBJECT, only articles with SUBJECT are selected.
7618 If BACKWARD, the previous article is selected instead of the next."
7620 ;; Make sure we are in the summary buffer.
7621 (unless (eq major-mode
'gnus-summary-mode
)
7622 (set-buffer gnus-summary-buffer
))
7624 ;; Is there such an article?
7625 ((and (gnus-summary-search-forward unread subject backward
)
7626 (or (gnus-summary-display-article (gnus-summary-article-number))
7627 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
7628 (gnus-summary-position-point))
7629 ;; If not, we try the first unread, if that is wanted.
7631 gnus-auto-select-same
7632 (gnus-summary-first-unread-article))
7633 (gnus-summary-position-point)
7634 (gnus-message 6 "Wrapped"))
7635 ;; Try to get next/previous article not displayed in this group.
7636 ((and gnus-auto-extend-newsgroup
7637 (not unread
) (not subject
))
7638 (gnus-summary-goto-article
7639 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
7640 nil
(count-lines (point-min) (point))))
7641 ;; Go to next/previous group.
7643 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
7644 (gnus-summary-jump-to-group gnus-newsgroup-name
))
7645 (let ((cmd (if (featurep 'xemacs
)
7647 last-command-event
))
7649 (with-current-buffer gnus-group-buffer
7652 (if (eq gnus-keep-same-level
'best
)
7653 (gnus-summary-best-group gnus-newsgroup-name
)
7654 (gnus-summary-search-group backward gnus-keep-same-level
))))
7655 ;; For some reason, the group window gets selected. We change
7657 (select-window (get-buffer-window (current-buffer)))
7658 ;; Select next unread newsgroup automagically.
7660 ((or (not gnus-auto-select-next
)
7662 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
7663 ((or (eq gnus-auto-select-next
'quietly
)
7664 (and (eq gnus-auto-select-next
'slightly-quietly
)
7666 (and (eq gnus-auto-select-next
'almost-quietly
)
7667 (gnus-summary-last-article-p)))
7669 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
7671 (gnus-message 7 "No more%s articles (%s)..."
7672 (if unread
" unread" "")
7673 (if group
(concat "selecting " group
)
7675 (gnus-summary-next-group nil group backward
)))
7677 (when (gnus-key-press-event-p last-input-event
)
7678 (gnus-summary-walk-group-buffer
7679 gnus-newsgroup-name cmd unread backward point
))))))))
7681 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
7682 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
7683 (?\C-p
(gnus-group-prev-unread-group 1))))
7684 (cursor-in-echo-area t
)
7685 keve key group ended prompt
)
7686 (with-current-buffer gnus-group-buffer
7689 (if (eq gnus-keep-same-level
'best
)
7690 (gnus-summary-best-group gnus-newsgroup-name
)
7691 (gnus-summary-search-group backward gnus-keep-same-level
))))
7695 "No more%s articles%s " (if unread
" unread" "")
7697 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
7698 (format " (Type %s for %s [%s])"
7699 (single-key-description cmd
)
7700 (gnus-group-decoded-name group
)
7701 (gnus-group-unread group
))
7702 (format " (Type %s to exit %s)"
7703 (single-key-description cmd
)
7704 (gnus-group-decoded-name gnus-newsgroup-name
)))))
7705 ;; Confirm auto selection.
7706 (setq key
(car (setq keve
(gnus-read-event-char prompt
)))
7709 ((assq key keystrokes
)
7710 (let ((obuf (current-buffer)))
7711 (switch-to-buffer gnus-group-buffer
)
7713 (gnus-group-jump-to-group group
))
7714 (eval (cadr (assq key keystrokes
)))
7715 (setq group
(gnus-group-group-name))
7716 (switch-to-buffer obuf
))
7720 (gnus-ephemeral-group-p gnus-newsgroup-name
))
7722 (gnus-summary-next-group nil group backward
)))
7724 (push (cdr keve
) unread-command-events
))))))
7726 (defun gnus-summary-next-unread-article ()
7727 "Select unread article after current one."
7729 (gnus-summary-next-article
7730 (or (not (eq gnus-summary-goto-unread
'never
))
7731 (gnus-summary-last-article-p (gnus-summary-article-number)))
7732 (and gnus-auto-select-same
7733 (gnus-summary-article-subject))))
7735 (defun gnus-summary-prev-article (&optional unread subject
)
7736 "Select the article before the current one.
7737 If UNREAD is non-nil, only unread articles are selected."
7739 (gnus-summary-next-article unread subject t
))
7741 (defun gnus-summary-prev-unread-article ()
7742 "Select unread article before current one."
7744 (gnus-summary-prev-article
7745 (or (not (eq gnus-summary-goto-unread
'never
))
7746 (gnus-summary-first-article-p (gnus-summary-article-number)))
7747 (and gnus-auto-select-same
7748 (gnus-summary-article-subject))))
7750 (defun gnus-summary-next-page (&optional lines circular stop
)
7751 "Show next page of the selected article.
7752 If at the end of the current article, select the next article.
7753 LINES says how many lines should be scrolled up.
7755 If CIRCULAR is non-nil, go to the start of the article instead of
7756 selecting the next article when reaching the end of the current
7759 If STOP is non-nil, just stop when reaching the end of the message.
7761 Also see the variable `gnus-article-skip-boring'."
7763 (setq gnus-summary-buffer
(current-buffer))
7764 (gnus-set-global-variables)
7765 (let ((article (gnus-summary-article-number))
7766 (article-window (get-buffer-window gnus-article-buffer t
))
7768 ;; If the buffer is empty, we have no article.
7770 (error "No article to select"))
7771 (gnus-configure-windows 'article
)
7772 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
7773 (if (and (eq gnus-summary-goto-unread
'never
)
7774 (not (gnus-summary-last-article-p article
)))
7775 (gnus-summary-next-article)
7776 (gnus-summary-next-unread-article))
7777 (if (or (null gnus-current-article
)
7778 (null gnus-article-current
)
7779 (/= article
(cdr gnus-article-current
))
7780 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7781 ;; Selected subject is different from current article's.
7782 (gnus-summary-display-article article
)
7783 (when article-window
7784 (gnus-eval-in-buffer-window gnus-article-buffer
7785 (setq endp
(or (gnus-article-next-page lines
)
7786 (gnus-article-only-boring-p))))
7788 (cond ((or stop gnus-summary-stop-at-end-of-message
)
7789 (gnus-message 3 "End of message"))
7791 (gnus-summary-beginning-of-article))
7793 (gnus-message 3 "End of message"))
7795 (if (and (eq gnus-summary-goto-unread
'never
)
7796 (not (gnus-summary-last-article-p article
)))
7797 (gnus-summary-next-article)
7798 (gnus-summary-next-unread-article))))))))
7799 (gnus-summary-recenter)
7800 (gnus-summary-position-point)))
7802 (defun gnus-summary-prev-page (&optional lines move
)
7803 "Show previous page of selected article.
7804 Argument LINES specifies lines to be scrolled down.
7805 If MOVE, move to the previous unread article if point is at
7806 the beginning of the buffer."
7808 (let ((article (gnus-summary-article-number))
7809 (article-window (get-buffer-window gnus-article-buffer t
))
7811 (gnus-configure-windows 'article
)
7812 (if (or (null gnus-current-article
)
7813 (null gnus-article-current
)
7814 (/= article
(cdr gnus-article-current
))
7815 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7816 ;; Selected subject is different from current article's.
7817 (gnus-summary-display-article article
)
7818 (gnus-summary-recenter)
7819 (when article-window
7820 (gnus-eval-in-buffer-window gnus-article-buffer
7821 (setq endp
(gnus-article-prev-page lines
)))
7822 (when (and move endp
)
7824 (gnus-message 3 "Beginning of message"))
7826 (if (and (eq gnus-summary-goto-unread
'never
)
7827 (not (gnus-summary-first-article-p article
)))
7828 (gnus-summary-prev-article)
7829 (gnus-summary-prev-unread-article))))))))
7830 (gnus-summary-position-point))
7832 (defun gnus-summary-prev-page-or-article (&optional lines
)
7833 "Show previous page of selected article.
7834 Argument LINES specifies lines to be scrolled down.
7835 If at the beginning of the article, go to the next article."
7837 (gnus-summary-prev-page lines t
))
7839 (defun gnus-summary-scroll-up (lines)
7840 "Scroll up (or down) one line current article.
7841 Argument LINES specifies lines to be scrolled up (or down if negative)."
7843 (gnus-configure-windows 'article
)
7844 (gnus-summary-show-thread)
7845 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
7846 (gnus-eval-in-buffer-window gnus-article-buffer
7848 (when (gnus-article-next-page lines
)
7849 (gnus-message 3 "End of message")))
7851 (gnus-article-prev-page (- lines
))))))
7852 (gnus-summary-recenter)
7853 (gnus-summary-position-point))
7855 (defun gnus-summary-scroll-down (lines)
7856 "Scroll down (or up) one line current article.
7857 Argument LINES specifies lines to be scrolled down (or up if negative)."
7859 (gnus-summary-scroll-up (- lines
)))
7861 (defun gnus-summary-next-same-subject ()
7862 "Select next article which has the same subject as current one."
7864 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
7866 (defun gnus-summary-prev-same-subject ()
7867 "Select previous article which has the same subject as current one."
7869 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
7871 (defun gnus-summary-next-unread-same-subject ()
7872 "Select next unread article which has the same subject as current one."
7874 (gnus-summary-next-article t
(gnus-summary-article-subject)))
7876 (defun gnus-summary-prev-unread-same-subject ()
7877 "Select previous unread article which has the same subject as current one."
7879 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
7881 (defun gnus-summary-first-unread-article ()
7882 "Select the first unread article.
7883 Return nil if there are no unread articles."
7886 (when (gnus-summary-first-subject t
)
7887 (gnus-summary-show-thread)
7888 (gnus-summary-first-subject t
)
7889 (gnus-summary-display-article (gnus-summary-article-number)))
7890 (gnus-summary-position-point)))
7892 (defun gnus-summary-first-unread-subject ()
7893 "Place the point on the subject line of the first unread article.
7894 Return nil if there are no unread articles."
7897 (when (gnus-summary-first-subject t
)
7898 (gnus-summary-show-thread)
7899 (gnus-summary-first-subject t
))
7900 (gnus-summary-position-point)))
7902 (defun gnus-summary-first-unseen-subject ()
7903 "Place the point on the subject line of the first unseen article.
7904 Return nil if there are no unseen articles."
7907 (when (gnus-summary-first-subject nil nil t
)
7908 (gnus-summary-show-thread)
7909 (gnus-summary-first-subject nil nil t
))
7910 (gnus-summary-position-point)))
7912 (defun gnus-summary-first-unseen-or-unread-subject ()
7913 "Place the point on the subject line of the first unseen article or,
7914 if all article have been seen, on the subject line of the first unread
7918 (unless (when (gnus-summary-first-subject nil nil t
)
7919 (gnus-summary-show-thread)
7920 (gnus-summary-first-subject nil nil t
))
7921 (when (gnus-summary-first-subject t
)
7922 (gnus-summary-show-thread)
7923 (gnus-summary-first-subject t
)))
7924 (gnus-summary-position-point)))
7926 (defun gnus-summary-first-article ()
7927 "Select the first article.
7928 Return nil if there are no articles."
7931 (when (gnus-summary-first-subject)
7932 (gnus-summary-show-thread)
7933 (gnus-summary-first-subject)
7934 (gnus-summary-display-article (gnus-summary-article-number)))
7935 (gnus-summary-position-point)))
7937 (defun gnus-summary-best-unread-article (&optional arg
)
7938 "Select the unread article with the highest score.
7939 If given a prefix argument, select the next unread article that has a
7940 score higher than the default score."
7942 (let ((article (if arg
7943 (gnus-summary-better-unread-subject)
7944 (gnus-summary-best-unread-subject))))
7946 (gnus-summary-goto-article article
)
7947 (error "No unread articles"))))
7949 (defun gnus-summary-best-unread-subject ()
7950 "Select the unread subject with the highest score."
7952 (let ((best -
1000000)
7953 (data gnus-newsgroup-data
)
7956 (and (gnus-data-unread-p (car data
))
7958 (gnus-summary-article-score (gnus-data-number (car data
))))
7961 article
(gnus-data-number (car data
))))
7962 (setq data
(cdr data
)))
7964 (gnus-summary-goto-subject article
))
7965 (gnus-summary-position-point)
7968 (defun gnus-summary-better-unread-subject ()
7969 "Select the first unread subject that has a score over the default score."
7971 (let ((data gnus-newsgroup-data
)
7973 (while (and (setq article
(gnus-data-number (car data
)))
7974 (or (gnus-data-read-p (car data
))
7975 (not (> (gnus-summary-article-score article
)
7976 gnus-summary-default-score
))))
7977 (setq data
(cdr data
)))
7979 (gnus-summary-goto-subject article
))
7980 (gnus-summary-position-point)
7983 (defun gnus-summary-last-subject ()
7984 "Go to the last displayed subject line in the group."
7985 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
7987 (gnus-summary-goto-subject article
))))
7989 (defun gnus-summary-goto-article (article &optional all-headers force
)
7990 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7991 If ALL-HEADERS is non-nil, no header lines are hidden.
7992 If FORCE, go to the article even if it isn't displayed. If FORCE
7993 is a number, it is the line the article is to be displayed on."
7997 "Article number or Message-ID: "
7998 (mapcar (lambda (number) (list (int-to-string number
)))
7999 gnus-newsgroup-limit
))
8003 (if (and (stringp article
)
8004 (string-match "@\\|%40" article
))
8005 (gnus-summary-refer-article article
)
8006 (when (stringp article
)
8007 (setq article
(string-to-number article
)))
8008 (if (gnus-summary-goto-subject article force
)
8009 (gnus-summary-display-article article all-headers
)
8010 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
8011 (gnus-summary-position-point)))
8013 (defun gnus-summary-goto-last-article ()
8014 "Go to the previously read article."
8017 (when gnus-last-article
8018 (gnus-summary-goto-article gnus-last-article nil t
))
8019 (gnus-summary-position-point)))
8021 (defun gnus-summary-pop-article (number)
8022 "Pop one article off the history and go to the previous.
8023 NUMBER articles will be popped off."
8026 (setq gnus-newsgroup-history
8027 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
8029 (gnus-summary-goto-article (car to
) nil t
)
8030 (error "Article history empty")))
8031 (gnus-summary-position-point))
8033 ;; Summary commands and functions for limiting the summary buffer.
8035 (defun gnus-summary-limit-to-articles (n)
8036 "Limit the summary buffer to the next N articles.
8037 If not given a prefix, use the process marked articles instead."
8040 (let ((articles (gnus-summary-work-articles n
)))
8041 (setq gnus-newsgroup-processable nil
)
8042 (gnus-summary-limit articles
))
8043 (gnus-summary-position-point)))
8045 (defun gnus-summary-pop-limit (&optional total
)
8046 "Restore the previous limit.
8047 If given a prefix, remove all limits."
8050 (setq gnus-newsgroup-limits
8051 (list (mapcar (lambda (h) (mail-header-number h
))
8052 gnus-newsgroup-headers
))))
8053 (unless gnus-newsgroup-limits
8054 (error "No limit to pop"))
8056 (gnus-summary-limit nil
'pop
)
8057 (gnus-summary-position-point)))
8059 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
8060 "Limit the summary buffer to articles that have subjects that match a regexp.
8061 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
8063 (list (read-string (if current-prefix-arg
8064 "Exclude subject (regexp): "
8065 "Limit to subject (regexp): "))
8066 nil current-prefix-arg
))
8068 (setq header
"subject"))
8069 (when (not (equal "" subject
))
8071 (let ((articles (gnus-summary-find-matching
8072 (or header
"subject") subject
'all nil nil
8075 (error "Found no matches for \"%s\"" subject
))
8076 (gnus-summary-limit articles
))
8077 (gnus-summary-position-point))))
8079 (defun gnus-summary-limit-to-author (from &optional not-matching
)
8080 "Limit the summary buffer to articles that have authors that match a regexp.
8081 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8083 (list (read-string (if current-prefix-arg
8084 "Exclude author (regexp): "
8085 "Limit to author (regexp): "))
8086 current-prefix-arg
))
8087 (gnus-summary-limit-to-subject from
"from" not-matching
))
8089 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching
)
8090 "Limit the summary buffer to articles with the given RECIPIENT.
8092 If NOT-MATCHING, exclude RECIPIENT.
8094 To and Cc headers are checked. You need to include them in
8095 `nnmail-extra-headers'."
8096 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8098 (list (read-string (format "%s recipient (regexp): "
8099 (if current-prefix-arg
"Exclude" "Limit to")))
8100 current-prefix-arg
))
8101 (when (not (equal "" recipient
))
8103 (if (memq 'To nnmail-extra-headers
)
8104 (gnus-summary-find-matching
8105 (cons 'extra
'To
) recipient
'all nil nil
8108 1 "`To' isn't present in `nnmail-extra-headers'")
8112 (if (memq 'Cc nnmail-extra-headers
)
8113 (gnus-summary-find-matching
8114 (cons 'extra
'Cc
) recipient
'all nil nil
8117 1 "`Cc' isn't present in `nnmail-extra-headers'")
8122 ;; We need the numbers that are in both lists:
8124 (and (memq a to
) a
))
8128 (error "Found no matches for \"%s\"" recipient
))
8129 (gnus-summary-limit articles
))
8130 (gnus-summary-position-point))))
8132 (defun gnus-summary-limit-to-address (address &optional not-matching
)
8133 "Limit the summary buffer to articles with the given ADDRESS.
8135 If NOT-MATCHING, exclude ADDRESS.
8137 To, Cc and From headers are checked. You need to include `To' and `Cc'
8138 in `nnmail-extra-headers'."
8140 (list (read-string (format "%s address (regexp): "
8141 (if current-prefix-arg
"Exclude" "Limit to")))
8142 current-prefix-arg
))
8143 (when (not (equal "" address
))
8145 (if (memq 'To nnmail-extra-headers
)
8146 (gnus-summary-find-matching
8147 (cons 'extra
'To
) address
'all nil nil
8150 1 "`To' isn't present in `nnmail-extra-headers'")
8154 (if (memq 'Cc nnmail-extra-headers
)
8155 (gnus-summary-find-matching
8156 (cons 'extra
'Cc
) address
'all nil nil
8159 1 "`Cc' isn't present in `nnmail-extra-headers'")
8163 (gnus-summary-find-matching "from" address
8164 'all nil nil not-matching
))
8167 ;; We need the numbers that are in all lists:
8171 (mapcar (lambda (a) (car (memq a from
))) to
))
8173 (mapcar (lambda (a) (car (memq a from
))) cc
)
8174 (mapcar (lambda (a) (car (memq a from
)))
8175 (mapcar (lambda (a) (car (memq a to
)))
8177 (nconc (if (eq to t
) nil to
)
8178 (if (eq cc t
) nil cc
)
8181 (error "Found no matches for \"%s\"" address
))
8182 (gnus-summary-limit articles
))
8183 (gnus-summary-position-point))))
8185 (defun gnus-summary-limit-strange-charsets-predicate (header)
8186 (when (fboundp 'char-charset
)
8187 (let ((string (concat (mail-header-subject header
)
8188 (mail-header-from header
)))
8190 (dotimes (i (1- (length string
)))
8191 (setq charset
(format "%s" (char-charset (aref string
(1+ i
)))))
8192 (when (string-match "unicode\\|big\\|japanese" charset
)
8196 (defun gnus-summary-limit-to-predicate (predicate)
8197 "Limit to articles where PREDICATE returns non-nil.
8198 PREDICATE will be called with the header structures of the
8200 (let ((articles nil
)
8201 (case-fold-search t
))
8202 (dolist (header gnus-newsgroup-headers
)
8203 (when (funcall predicate header
)
8204 (push (mail-header-number header
) articles
)))
8205 (gnus-summary-limit (nreverse articles
))))
8207 (defun gnus-summary-limit-to-age (age &optional younger-p
)
8208 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8209 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8210 articles that are younger than AGE days."
8212 (let ((younger current-prefix-arg
)
8215 (while (not days-got
)
8216 (setq days
(if younger
8217 (read-string "Limit to articles younger than (in days, older when negative): ")
8219 "Limit to articles older than (in days, younger when negative): ")))
8220 (when (> (length days
) 0)
8221 (setq days
(read days
)))
8226 (setq younger
(not younger
))
8227 (setq days
(* days -
1))))
8228 (message "Please enter a number.")
8230 (list days younger
)))
8232 (let ((data gnus-newsgroup-data
)
8233 (cutoff (days-to-time age
))
8234 articles d date is-younger
)
8235 (while (setq d
(pop data
))
8236 (when (and (vectorp (gnus-data-header d
))
8237 (setq date
(mail-header-date (gnus-data-header d
))))
8238 (setq is-younger
(time-less-p
8239 (time-since (gnus-date-get-time date
))
8244 (push (gnus-data-number d
) articles
))))
8245 (gnus-summary-limit (nreverse articles
)))
8246 (gnus-summary-position-point)))
8248 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
8249 "Limit the summary buffer to articles that match an 'extra' header."
8253 (gnus-completing-read-with-default
8254 (symbol-name (car gnus-extra-headers
))
8255 (if current-prefix-arg
8256 "Exclude extra header"
8257 "Limit extra header")
8259 (cons (symbol-name x
) x
))
8264 (read-string (format "%s header %s (regexp): "
8265 (if current-prefix-arg
"Exclude" "Limit to")
8267 current-prefix-arg
)))
8268 (when (not (equal "" regexp
))
8270 (let ((articles (gnus-summary-find-matching
8271 (cons 'extra header
) regexp
'all nil nil
8274 (error "Found no matches for \"%s\"" regexp
))
8275 (gnus-summary-limit articles
))
8276 (gnus-summary-position-point))))
8278 (defun gnus-summary-limit-to-display-predicate ()
8279 "Limit the summary buffer to the predicated in the `display' group parameter."
8281 (unless gnus-newsgroup-display
8282 (error "There is no `display' group parameter"))
8284 (dolist (number gnus-newsgroup-articles
)
8285 (when (funcall gnus-newsgroup-display
)
8286 (push number articles
)))
8287 (gnus-summary-limit articles
))
8288 (gnus-summary-position-point))
8290 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
8292 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
"Emacs 20.4")
8294 (defun gnus-summary-limit-to-unread (&optional all
)
8295 "Limit the summary buffer to articles that are not marked as read.
8296 If ALL is non-nil, limit strictly to unread articles."
8299 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
8300 (gnus-summary-limit-to-marks
8301 ;; Concat all the marks that say that an article is read and have
8303 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8304 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8305 gnus-low-score-mark gnus-expirable-mark
8306 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8307 gnus-duplicate-mark gnus-souped-mark
)
8310 (defun gnus-summary-limit-to-headers (match &optional reverse
)
8311 "Limit the summary buffer to articles that have headers that match MATCH.
8312 If REVERSE (the prefix), limit to articles that don't match."
8313 (interactive "sMatch headers (regexp): \nP")
8314 (gnus-summary-limit-to-bodies match reverse t
))
8316 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp
)
8317 "Limit the summary buffer to articles that have bodies that match MATCH.
8318 If REVERSE (the prefix), limit to articles that don't match."
8319 (interactive "sMatch body (regexp): \nP")
8320 (let ((articles nil
)
8321 (gnus-select-article-hook nil
) ;Disable hook.
8322 (gnus-article-prepare-hook nil
)
8323 (gnus-use-article-prefetch nil
)
8324 (gnus-keep-backlog nil
)
8325 (gnus-break-pages nil
)
8326 (gnus-summary-display-arrow nil
)
8327 (gnus-updated-mode-lines nil
)
8328 (gnus-auto-center-summary nil
)
8329 (gnus-display-mime-function nil
))
8330 (dolist (data gnus-newsgroup-data
)
8331 (let (gnus-mark-article-hook)
8332 (gnus-summary-select-article t t nil
(gnus-data-number data
)))
8333 (with-current-buffer gnus-article-buffer
8335 (let* ((case-fold-search t
)
8337 (re-search-backward match nil t
)
8338 (re-search-forward match nil t
))))
8339 (when (or (and found
8343 (push (gnus-data-number data
) articles
)))))
8345 (message "No messages matched")
8346 (gnus-summary-limit articles
)))
8347 (gnus-summary-position-point))
8349 (defun gnus-summary-limit-to-singletons (&optional threadsp
)
8350 "Limit the summary buffer to articles that aren't part on any thread.
8351 If THREADSP (the prefix), limit to articles that are in threads."
8353 (let ((articles nil
)
8356 (dolist (thread gnus-newsgroup-threads
)
8357 (if (stringp (car thread
))
8358 (dolist (thread (cdr thread
))
8359 (push thread threads
))
8360 (push thread threads
)))
8361 (dolist (thread threads
)
8362 (setq thread-articles
(gnus-articles-in-thread thread
))
8363 (when (or (and threadsp
8364 (> (length thread-articles
) 1))
8366 (= (length thread-articles
) 1)))
8367 (setq articles
(nconc thread-articles articles
))))
8369 (message "No messages matched")
8370 (gnus-summary-limit articles
))
8371 (gnus-summary-position-point)))
8373 (defun gnus-summary-limit-to-replied (&optional unreplied
)
8374 "Limit the summary buffer to replied articles.
8375 If UNREPLIED (the prefix), limit to unreplied articles."
8379 (gnus-set-difference gnus-newsgroup-articles
8380 gnus-newsgroup-replied
))
8381 (gnus-summary-limit gnus-newsgroup-replied
))
8382 (gnus-summary-position-point))
8384 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
8385 (make-obsolete 'gnus-summary-delete-marked-with
8386 'gnus-summary-limit-exclude-marks
"Emacs 20.4")
8388 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
8389 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8390 If REVERSE, limit the summary buffer to articles that are marked
8391 with MARKS. MARKS can either be a string of marks or a list of marks.
8392 Returns how many articles were removed."
8393 (interactive "sMarks: ")
8394 (gnus-summary-limit-to-marks marks t
))
8396 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
8397 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8398 If REVERSE (the prefix), limit the summary buffer to articles that are
8399 not marked with MARKS. MARKS can either be a string of marks or a
8401 Returns how many articles were removed."
8402 (interactive "sMarks: \nP")
8404 (let ((data gnus-newsgroup-data
)
8405 (marks (if (listp marks
) marks
8406 (append marks nil
))) ; Transform to list.
8409 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
8410 (memq (gnus-data-mark (car data
)) marks
))
8411 (push (gnus-data-number (car data
)) articles
))
8412 (setq data
(cdr data
)))
8413 (gnus-summary-limit articles
))
8414 (gnus-summary-position-point)))
8416 (defun gnus-summary-limit-to-score (score)
8417 "Limit to articles with score at or above SCORE."
8418 (interactive "NLimit to articles with score of at least: ")
8419 (let ((data gnus-newsgroup-data
)
8422 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
8424 (push (gnus-data-number (car data
)) articles
))
8425 (setq data
(cdr data
)))
8427 (gnus-summary-limit articles
)
8428 (gnus-summary-position-point))))
8430 (defun gnus-summary-limit-to-unseen ()
8431 "Limit to unseen articles."
8434 (gnus-summary-limit gnus-newsgroup-unseen
)
8435 (gnus-summary-position-point)))
8437 (defun gnus-summary-limit-include-thread (id)
8438 "Display all the hidden articles that is in the thread with ID in it.
8439 When called interactively, ID is the Message-ID of the current
8441 (interactive (list (mail-header-id (gnus-summary-article-header))))
8442 (let ((articles (gnus-articles-in-thread
8443 (gnus-id-to-thread (gnus-root-id id
)))))
8445 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
8446 (gnus-summary-limit-include-matching-articles
8448 (regexp-quote (gnus-simplify-subject-re
8449 (mail-header-subject (gnus-id-to-header id
)))))
8450 (gnus-summary-position-point))))
8452 (defun gnus-summary-limit-include-matching-articles (header regexp
)
8453 "Display all the hidden articles that have HEADERs that match REGEXP."
8454 (interactive (list (read-string "Match on header: ")
8455 (read-string "Regexp: ")))
8456 (let ((articles (gnus-find-matching-articles header regexp
)))
8458 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
8459 (gnus-summary-position-point))))
8461 (defun gnus-summary-insert-dormant-articles ()
8462 "Insert all the dormant articles for this group into the current buffer."
8464 (let ((gnus-verbose (max 6 gnus-verbose
)))
8465 (if (not gnus-newsgroup-dormant
)
8466 (gnus-message 3 "No dormant articles for this group")
8467 (gnus-summary-goto-subjects gnus-newsgroup-dormant
))))
8469 (defun gnus-summary-insert-ticked-articles ()
8470 "Insert ticked articles for this group into the current buffer."
8472 (let ((gnus-verbose (max 6 gnus-verbose
)))
8473 (if (not gnus-newsgroup-marked
)
8474 (gnus-message 3 "No ticked articles for this group")
8475 (gnus-summary-goto-subjects gnus-newsgroup-marked
))))
8477 (defun gnus-summary-limit-include-dormant ()
8478 "Display all the hidden articles that are marked as dormant.
8479 Note that this command only works on a subset of the articles currently
8480 fetched for this group."
8482 (unless gnus-newsgroup-dormant
8483 (error "There are no dormant articles in this group"))
8485 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
8486 (gnus-summary-position-point)))
8488 (defun gnus-summary-limit-exclude-dormant ()
8489 "Hide all dormant articles."
8492 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
8493 (gnus-summary-position-point)))
8495 (defun gnus-summary-limit-exclude-childless-dormant ()
8496 "Hide all dormant articles that have no children."
8498 (let ((data (gnus-data-list t
))
8499 articles d children
)
8500 ;; Find all articles that are either not dormant or have
8502 (while (setq d
(pop data
))
8503 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
8505 (gnus-article-children (gnus-data-number d
)))
8508 (when (memq (car children
) articles
)
8513 (push (gnus-data-number d
) articles
)))
8516 (gnus-summary-limit articles
)
8517 (gnus-summary-position-point))))
8519 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
8520 "Mark all unread excluded articles as read.
8521 If ALL, mark even excluded ticked and dormants as read."
8523 (setq gnus-newsgroup-limit
(sort gnus-newsgroup-limit
'<))
8524 (let ((articles (gnus-sorted-ndifference
8526 (mapcar (lambda (h) (mail-header-number h
))
8527 gnus-newsgroup-headers
)
8529 gnus-newsgroup-limit
))
8531 (setq gnus-newsgroup-unreads
8532 (gnus-sorted-intersection gnus-newsgroup-unreads
8533 gnus-newsgroup-limit
))
8535 (setq gnus-newsgroup-dormant nil
8536 gnus-newsgroup-marked nil
8537 gnus-newsgroup-reads
8539 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
8540 gnus-newsgroup-reads
))
8541 (while (setq article
(pop articles
))
8542 (unless (or (memq article gnus-newsgroup-dormant
)
8543 (memq article gnus-newsgroup-marked
))
8544 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
8546 (defun gnus-summary-limit (articles &optional pop
)
8548 ;; We pop the previous limit off the stack and use that.
8549 (setq articles
(car gnus-newsgroup-limits
)
8550 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
8551 ;; We use the new limit, so we push the old limit on the stack.
8552 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
8554 (setq gnus-newsgroup-limit articles
)
8555 (let ((total (length gnus-newsgroup-data
))
8556 (data (gnus-data-find-list (gnus-summary-article-number)))
8557 (gnus-summary-mark-below nil
) ; Inhibit this.
8559 ;; This will do all the work of generating the new summary buffer
8560 ;; according to the new limit.
8561 (gnus-summary-prepare)
8562 ;; Hide any threads, possibly.
8563 (gnus-summary-maybe-hide-threads)
8564 ;; Try to return to the article you were at, or one in the
8567 ;; We try to find some article after the current one.
8569 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
8572 (setq data
(cdr data
))))
8574 ;; If there is no data, that means that we were after the last
8575 ;; article. The same goes when we can't find any articles
8576 ;; after the current one.
8577 (goto-char (point-max))
8578 (gnus-summary-find-prev))
8579 (gnus-set-mode-line 'summary
)
8580 ;; We return how many articles were removed from the summary
8581 ;; buffer as a result of the new limit.
8582 (- total
(length gnus-newsgroup-data
))))
8584 (defsubst gnus-invisible-cut-children
(threads)
8587 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
8592 (defsubst gnus-cut-thread
(thread)
8593 "Go forwards in the thread until we find an article that we want to display."
8594 (when (or (eq gnus-fetch-old-headers
'some
)
8595 (eq gnus-fetch-old-headers
'invisible
)
8596 (numberp gnus-fetch-old-headers
)
8597 (eq gnus-build-sparse-threads
'some
)
8598 (eq gnus-build-sparse-threads
'more
))
8599 ;; Deal with old-fetched headers and sparse threads.
8603 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
8604 (gnus-summary-article-ancient-p
8605 (mail-header-number (car thread
))))
8606 (if (or (<= (length (cdr thread
)) 1)
8607 (eq gnus-fetch-old-headers
'invisible
))
8608 (setq gnus-newsgroup-limit
8609 (delq (mail-header-number (car thread
))
8610 gnus-newsgroup-limit
)
8611 thread
(cadr thread
))
8612 (when (gnus-invisible-cut-children (cdr thread
))
8613 (let ((th (cdr thread
)))
8615 (if (memq (mail-header-number (caar th
))
8616 gnus-newsgroup-limit
)
8617 (setq thread
(car th
)
8619 (setq th
(cdr th
))))))))))
8622 (defun gnus-cut-threads (threads)
8623 "Cut off all uninteresting articles from the beginning of THREADS."
8624 (when (or (eq gnus-fetch-old-headers
'some
)
8625 (eq gnus-fetch-old-headers
'invisible
)
8626 (numberp gnus-fetch-old-headers
)
8627 (eq gnus-build-sparse-threads
'some
)
8628 (eq gnus-build-sparse-threads
'more
))
8631 (setcar th
(gnus-cut-thread (car th
)))
8632 (setq th
(cdr th
)))))
8633 ;; Remove nixed out threads.
8636 (defun gnus-summary-initial-limit (&optional show-if-empty
)
8637 "Figure out what the initial limit is supposed to be on group entry.
8638 This entails weeding out unwanted dormants, low-scored articles,
8639 fetch-old-headers verbiage, and so on."
8640 ;; Most groups have nothing to remove.
8641 (unless (or gnus-inhibit-limiting
8642 (and (null gnus-newsgroup-dormant
)
8643 (eq gnus-newsgroup-display
'gnus-not-ignore
)
8644 (not (eq gnus-fetch-old-headers
'some
))
8645 (not (numberp gnus-fetch-old-headers
))
8646 (not (eq gnus-fetch-old-headers
'invisible
))
8647 (null gnus-summary-expunge-below
)
8648 (not (eq gnus-build-sparse-threads
'some
))
8649 (not (eq gnus-build-sparse-threads
'more
))
8650 (null gnus-thread-expunge-below
)
8651 (not gnus-use-nocem
)))
8652 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
8653 (setq gnus-newsgroup-limit nil
)
8656 (unless (car (symbol-value node
))
8657 ;; These threads have no parents -- they are roots.
8658 (let ((nodes (cdr (symbol-value node
)))
8661 (if (and gnus-thread-expunge-below
8662 (< (gnus-thread-total-score (car nodes
))
8663 gnus-thread-expunge-below
))
8664 (gnus-expunge-thread (pop nodes
))
8665 (setq thread
(pop nodes
))
8666 (gnus-summary-limit-children thread
))))))
8667 gnus-newsgroup-dependencies
)
8668 ;; If this limitation resulted in an empty group, we might
8669 ;; pop the previous limit and use it instead.
8670 (when (and (not gnus-newsgroup-limit
)
8672 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
8673 gnus-newsgroup-limit
))
8675 (defun gnus-summary-limit-children (thread)
8676 "Return 1 if this subthread is visible and 0 if it is not."
8677 ;; First we get the number of visible children to this thread. This
8678 ;; is done by recursing down the thread using this function, so this
8679 ;; will really go down to a leaf article first, before slowly
8680 ;; working its way up towards the root.
8682 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth
))
8685 (apply '+ (mapcar 'gnus-summary-limit-children
8688 (number (mail-header-number (car thread
)))
8691 (not (memq number gnus-newsgroup-marked
))
8693 ;; If this article is dormant and has absolutely no visible
8694 ;; children, then this article isn't visible.
8695 (and (memq number gnus-newsgroup-dormant
)
8697 ;; If this is "fetch-old-headered" and there is no
8698 ;; visible children, then we don't want this article.
8699 (and (or (eq gnus-fetch-old-headers
'some
)
8700 (numberp gnus-fetch-old-headers
))
8701 (gnus-summary-article-ancient-p number
)
8703 ;; If this is "fetch-old-headered" and `invisible', then
8704 ;; we don't want this article.
8705 (and (eq gnus-fetch-old-headers
'invisible
)
8706 (gnus-summary-article-ancient-p number
))
8707 ;; If this is a sparsely inserted article with no children,
8708 ;; we don't want it.
8709 (and (eq gnus-build-sparse-threads
'some
)
8710 (gnus-summary-article-sparse-p number
)
8712 ;; If we use expunging, and this article is really
8713 ;; low-scored, then we don't want this article.
8714 (when (and gnus-summary-expunge-below
8716 (or (cdr (assq number gnus-newsgroup-scored
))
8717 gnus-summary-default-score
))
8718 gnus-summary-expunge-below
))
8719 ;; We increase the expunge-tally here, but that has
8720 ;; nothing to do with the limits, really.
8721 (incf gnus-newsgroup-expunged-tally
)
8722 ;; We also mark as read here, if that's wanted.
8723 (when (and gnus-summary-mark-below
8724 (< score gnus-summary-mark-below
))
8725 (setq gnus-newsgroup-unreads
8726 (delq number gnus-newsgroup-unreads
))
8727 (if gnus-newsgroup-auto-expire
8728 (push number gnus-newsgroup-expirable
)
8729 (push (cons number gnus-low-score-mark
)
8730 gnus-newsgroup-reads
)))
8732 ;; Do the `display' group parameter.
8733 (and gnus-newsgroup-display
8734 (not (funcall gnus-newsgroup-display
)))
8735 ;; Check NoCeM things.
8736 (when (and gnus-use-nocem
8737 (gnus-nocem-unwanted-article-p
8738 (mail-header-id (car thread
))))
8739 (setq gnus-newsgroup-unreads
8740 (delq number gnus-newsgroup-unreads
))
8742 ;; Nope, invisible article.
8744 ;; Ok, this article is to be visible, so we add it to the limit
8746 (push number gnus-newsgroup-limit
)
8749 (defun gnus-expunge-thread (thread)
8750 "Mark all articles in THREAD as read."
8751 (let* ((number (mail-header-number (car thread
))))
8752 (incf gnus-newsgroup-expunged-tally
)
8753 ;; We also mark as read here, if that's wanted.
8754 (setq gnus-newsgroup-unreads
8755 (delq number gnus-newsgroup-unreads
))
8756 (if gnus-newsgroup-auto-expire
8757 (push number gnus-newsgroup-expirable
)
8758 (push (cons number gnus-low-score-mark
)
8759 gnus-newsgroup-reads
)))
8760 ;; Go recursively through all subthreads.
8761 (mapcar 'gnus-expunge-thread
(cdr thread
)))
8763 ;; Summary article oriented commands
8765 (defun gnus-summary-refer-parent-article (n)
8766 "Refer parent article N times.
8767 If N is negative, go to ancestor -N instead.
8768 The difference between N and the number of articles fetched is returned."
8772 (when (not (natnump n
))
8777 (setq header
(gnus-summary-article-header))
8778 (if (and (eq (mail-header-number header
)
8779 (cdr gnus-article-current
))
8780 (equal gnus-newsgroup-name
8781 (car gnus-article-current
)))
8782 ;; If we try to find the parent of the currently
8783 ;; displayed article, then we take a look at the actual
8784 ;; References header, since this is slightly more
8785 ;; reliable than the References field we got from the
8787 (with-current-buffer gnus-original-article-buffer
8788 (nnheader-narrow-to-headers)
8789 (unless (setq ref
(message-fetch-field "references"))
8790 (when (setq ref
(message-fetch-field "in-reply-to"))
8791 (setq ref
(gnus-extract-message-id-from-in-reply-to ref
))))
8794 ;; It's not the current article, so we take a bet on
8795 ;; the value we got from the server.
8796 (mail-header-references header
)))
8798 (not (equal ref
"")))
8799 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
8800 (gnus-message 1 "Couldn't find parent"))
8801 (gnus-message 1 "No references in article %d"
8802 (gnus-summary-article-number))
8805 (gnus-summary-position-point)
8808 (defun gnus-summary-refer-references ()
8809 "Fetch all articles mentioned in the References header.
8810 Return the number of articles fetched."
8812 (let ((ref (mail-header-references (gnus-summary-article-header)))
8813 (current (gnus-summary-article-number))
8817 (error "No References in the current article")
8818 ;; For each Message-ID in the References header...
8819 (while (string-match "<[^>]*>" ref
)
8821 ;; ... fetch that article.
8822 (gnus-summary-refer-article
8823 (prog1 (match-string 0 ref
)
8824 (setq ref
(substring ref
(match-end 0))))))
8825 (gnus-summary-goto-subject current
)
8826 (gnus-summary-position-point)
8829 (defun gnus-summary-refer-thread (&optional limit
)
8830 "Fetch all articles in the current thread.
8831 If LIMIT (the numerical prefix), fetch that many old headers instead
8832 of what's specified by the `gnus-refer-thread-limit' variable."
8834 (let ((id (mail-header-id (gnus-summary-article-header)))
8835 (limit (if limit
(prefix-numeric-value limit
)
8836 gnus-refer-thread-limit
)))
8837 (unless (eq gnus-fetch-old-headers
'invisible
)
8838 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
8839 ;; Retrieve the headers and read them in.
8840 (if (eq (if (numberp limit
)
8841 (gnus-retrieve-headers
8843 (+ (mail-header-number
8844 (gnus-summary-article-header))
8846 gnus-newsgroup-end
))
8847 gnus-newsgroup-name
(* limit
2))
8848 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8850 (gnus-retrieve-headers (list gnus-newsgroup-end
)
8851 gnus-newsgroup-name limit
))
8853 (gnus-build-all-threads)
8854 (error "Can't fetch thread from back ends that don't support NOV"))
8855 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
8856 (gnus-summary-limit-include-thread id
)))
8858 (defun gnus-summary-refer-article (message-id)
8859 "Fetch an article specified by MESSAGE-ID."
8860 (interactive "sMessage-ID: ")
8861 (when (and (stringp message-id
)
8862 (not (zerop (length message-id
))))
8863 (setq message-id
(gnus-replace-in-string message-id
" " ""))
8864 ;; Construct the correct Message-ID if necessary.
8865 ;; Suggested by tale@pawl.rpi.edu.
8866 (unless (string-match "^<" message-id
)
8867 (setq message-id
(concat "<" message-id
)))
8868 (unless (string-match ">$" message-id
)
8869 (setq message-id
(concat message-id
">")))
8870 ;; People often post MIDs from URLs, so unhex it:
8871 (unless (string-match "@" message-id
)
8872 (setq message-id
(gnus-url-unhex-string message-id
)))
8873 (let* ((header (gnus-id-to-header message-id
))
8875 (gnus-summary-article-sparse-p
8876 (mail-header-number header
))
8877 (memq (mail-header-number header
)
8878 gnus-newsgroup-limit
)))
8881 ;; If the article is present in the buffer we just go to it.
8883 (or (not (gnus-summary-article-sparse-p
8884 (mail-header-number header
)))
8887 (gnus-summary-goto-article
8888 (mail-header-number header
) nil t
)
8890 (gnus-summary-update-article (mail-header-number header
)))))
8892 ;; We fetch the article.
8894 (dolist (gnus-override-method (gnus-refer-article-methods))
8895 (when (and (gnus-check-server gnus-override-method
)
8896 ;; Fetch the header,
8897 (setq number
(gnus-summary-insert-subject message-id
)))
8898 ;; and display the article.
8899 (gnus-summary-select-article nil nil nil number
)
8901 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
8903 (defun gnus-refer-article-methods ()
8904 "Return a list of referable methods."
8906 ;; No method, so we default to current and native.
8907 ((null gnus-refer-article-method
)
8908 (list gnus-current-select-method gnus-select-method
))
8910 ((eq 'current gnus-refer-article-method
)
8911 (list gnus-current-select-method
))
8912 ;; List of select methods.
8913 ((not (and (symbolp (car gnus-refer-article-method
))
8914 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
8916 (dolist (method gnus-refer-article-method
)
8917 (push (if (eq 'current method
)
8918 gnus-current-select-method
8922 ;; One single select method.
8924 (list gnus-refer-article-method
))))
8926 (defun gnus-summary-edit-parameters ()
8927 "Edit the group parameters of the current group."
8929 (gnus-group-edit-group gnus-newsgroup-name
'params
))
8931 (defun gnus-summary-customize-parameters ()
8932 "Customize the group parameters of the current group."
8934 (gnus-group-customize gnus-newsgroup-name
))
8936 (defun gnus-summary-enter-digest-group (&optional force
)
8937 "Enter an nndoc group based on the current article.
8938 If FORCE, force a digest interpretation. If not, try
8939 to guess what the document format is."
8941 (let ((conf gnus-current-window-configuration
))
8942 (save-window-excursion
8944 (let (gnus-article-prepare-hook
8945 gnus-display-mime-function
8947 (gnus-summary-select-article))))
8948 (setq gnus-current-window-configuration conf
)
8949 (let* ((name (format "%s-%d"
8950 (gnus-group-prefixed-name
8951 gnus-newsgroup-name
(list 'nndoc
""))
8952 (with-current-buffer gnus-summary-buffer
8953 gnus-current-article
)))
8954 (ogroup gnus-newsgroup-name
)
8955 (params (append (gnus-info-params (gnus-get-info ogroup
))
8956 (list (cons 'to-group ogroup
))
8957 (list (cons 'parent-group ogroup
))
8958 (list (cons 'save-article-group ogroup
))))
8959 (case-fold-search t
)
8960 (buf (current-buffer))
8962 (with-current-buffer gnus-original-article-buffer
8963 ;; Have the digest group inherit the main mail address of
8964 ;; the parent article.
8965 (when (setq to-address
(or (gnus-fetch-field "reply-to")
8966 (gnus-fetch-field "from")))
8969 (list (cons 'to-address
8970 (funcall gnus-decode-encoded-address-function
8972 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
8973 (insert-buffer-substring gnus-original-article-buffer
)
8974 ;; Remove lines that may lead nndoc to misinterpret the
8977 (goto-char (point-min))
8978 (or (search-forward "\n\n" nil t
) (point)))
8979 (goto-char (point-min))
8980 (delete-matching-lines "^Path:\\|^From ")
8983 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
8984 (gnus-newsgroup-ephemeral-ignored-charsets
8985 gnus-newsgroup-ignored-charsets
))
8986 (gnus-group-read-ephemeral-group
8987 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
8989 ,(if force
'mbox
'guess
)))
8991 `((adapt-file .
,(gnus-score-file-name gnus-newsgroup-name
8993 ;; Make all postings to this group go to the parent group.
8994 (nconc (gnus-info-params (gnus-get-info name
))
8996 ;; Couldn't select this doc group.
8997 (switch-to-buffer buf
)
8998 (gnus-set-global-variables)
8999 (gnus-configure-windows 'summary
)
9000 (gnus-message 3 "Article couldn't be entered?"))
9001 (kill-buffer dig
)))))
9003 (defun gnus-summary-read-document (n)
9004 "Open a new group based on the current article(s).
9005 This will allow you to read digests and other similar
9006 documents as newsgroups.
9007 Obeys the standard process/prefix convention."
9009 (let* ((ogroup gnus-newsgroup-name
)
9010 (params (append (gnus-info-params (gnus-get-info ogroup
))
9011 (list (cons 'to-group ogroup
))))
9012 group egroup groups vgroup
)
9013 (dolist (article (gnus-summary-work-articles n
))
9014 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
9015 (gnus-summary-remove-process-mark article
)
9016 (when (gnus-summary-display-article article
)
9017 (save-excursion ;;What for?
9019 (insert-buffer-substring gnus-original-article-buffer
)
9020 ;; Remove some headers that may lead nndoc to make
9022 (message-narrow-to-head)
9023 (goto-char (point-min))
9024 (delete-matching-lines "^Path:\\|^From ")
9027 (gnus-group-read-ephemeral-group
9028 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
9029 (nndoc-article-type guess
))
9032 ;; Make all postings to this group go to the parent group.
9033 (nconc (gnus-info-params (gnus-get-info egroup
))
9035 (push egroup groups
))
9036 ;; Couldn't select this doc group.
9037 (gnus-error 3 "Article couldn't be entered"))))))
9038 ;; Now we have selected all the documents.
9041 (error "None of the articles could be interpreted as documents"))
9042 ((gnus-group-read-ephemeral-group
9043 (setq vgroup
(format
9044 "nnvirtual:%s-%s" gnus-newsgroup-name
9045 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
9046 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
9048 (cons (current-buffer) 'summary
)))
9050 (error "Couldn't select virtual nndoc group")))))
9052 (defun gnus-summary-isearch-article (&optional regexp-p
)
9053 "Do incremental search forward on the current article.
9054 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
9056 (gnus-summary-select-article)
9057 (gnus-configure-windows 'article
)
9058 (gnus-eval-in-buffer-window gnus-article-buffer
9061 (isearch-forward regexp-p
))))
9063 (defun gnus-summary-repeat-search-article-forward ()
9064 "Repeat the previous search forwards."
9066 (unless gnus-last-search-regexp
9067 (error "No previous search"))
9068 (gnus-summary-search-article-forward gnus-last-search-regexp
))
9070 (defun gnus-summary-repeat-search-article-backward ()
9071 "Repeat the previous search backwards."
9073 (unless gnus-last-search-regexp
9074 (error "No previous search"))
9075 (gnus-summary-search-article-forward gnus-last-search-regexp t
))
9077 (defun gnus-summary-search-article-forward (regexp &optional backward
)
9078 "Search for an article containing REGEXP forward.
9079 If BACKWARD, search backward instead."
9082 (format "Search article %s (regexp%s): "
9083 (if current-prefix-arg
"backward" "forward")
9084 (if gnus-last-search-regexp
9085 (concat ", default " gnus-last-search-regexp
)
9087 current-prefix-arg
))
9088 (if (string-equal regexp
"")
9089 (setq regexp
(or gnus-last-search-regexp
""))
9090 (setq gnus-last-search-regexp regexp
)
9091 (setq gnus-article-before-search gnus-current-article
))
9092 ;; Intentionally set gnus-last-article.
9093 (setq gnus-last-article gnus-article-before-search
)
9094 (let ((gnus-last-article gnus-last-article
))
9095 (if (gnus-summary-search-article regexp backward
)
9096 (gnus-summary-show-thread)
9097 (signal 'search-failed
(list regexp
)))))
9099 (defun gnus-summary-search-article-backward (regexp)
9100 "Search for an article containing REGEXP backward."
9103 (format "Search article backward (regexp%s): "
9104 (if gnus-last-search-regexp
9105 (concat ", default " gnus-last-search-regexp
)
9107 (gnus-summary-search-article-forward regexp
'backward
))
9109 (defun gnus-summary-search-article (regexp &optional backward
)
9110 "Search for an article containing REGEXP.
9111 Optional argument BACKWARD means do search for backward.
9112 `gnus-select-article-hook' is not called during the search."
9113 ;; We have to require this here to make sure that the following
9114 ;; dynamic binding isn't shadowed by autoloading.
9115 (require 'gnus-async
)
9117 (let ((gnus-select-article-hook nil
) ;Disable hook.
9118 (gnus-article-prepare-hook nil
)
9119 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
9120 (gnus-use-article-prefetch nil
)
9121 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
9122 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
9124 (gnus-keep-backlog nil
)
9125 (gnus-break-pages nil
)
9126 (gnus-summary-display-arrow nil
)
9127 (gnus-updated-mode-lines nil
)
9128 (gnus-auto-center-summary nil
)
9129 (sum (current-buffer))
9130 (gnus-display-mime-function nil
)
9133 (gnus-save-hidden-threads
9134 (gnus-summary-select-article)
9135 (set-buffer gnus-article-buffer
)
9136 (goto-char (window-point (get-buffer-window (current-buffer))))
9140 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
9142 (re-search-backward regexp nil t
)
9143 (re-search-forward regexp nil t
))
9144 ;; We found the regexp.
9149 (get-buffer-window (current-buffer))
9153 (get-buffer-window (current-buffer))
9156 (setq point
(point)))
9157 ;; We didn't find it, so we go to the next article.
9160 (while (eq found
'not
)
9161 (if (not (if backward
(gnus-summary-find-prev)
9162 (gnus-summary-find-next)))
9163 ;; No more articles.
9165 ;; Select the next article and adjust point.
9166 (unless (gnus-summary-article-sparse-p
9167 (gnus-summary-article-number))
9169 (gnus-summary-select-article)
9170 (set-buffer gnus-article-buffer
)
9172 (goto-char (if backward
(point-max) (point-min))))))))
9173 (gnus-message 7 ""))
9174 ;; Return whether we found the regexp.
9175 (when (eq found
'found
)
9177 (gnus-summary-show-thread)
9178 (gnus-summary-goto-subject gnus-current-article
)
9179 (gnus-summary-position-point)
9182 (defun gnus-find-matching-articles (header regexp
)
9183 "Return a list of all articles that match REGEXP on HEADER.
9184 This search includes all articles in the current group that Gnus has
9185 fetched headers for, whether they are displayed or not."
9186 (let ((articles nil
)
9187 ;; Can't eta-reduce because it's a macro.
9188 (func `(lambda (h) (,(intern (concat "mail-header-" header
)) h
)))
9189 (case-fold-search t
))
9190 (dolist (header gnus-newsgroup-headers
)
9191 (when (string-match regexp
(funcall func header
))
9192 (push (mail-header-number header
) articles
)))
9193 (nreverse articles
)))
9195 (defun gnus-summary-find-matching (header regexp
&optional backward unread
9196 not-case-fold not-matching
)
9197 "Return a list of all articles that match REGEXP on HEADER.
9198 The search stars on the current article and goes forwards unless
9199 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9200 If UNREAD is non-nil, only unread articles will
9201 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9202 in the comparisons. If NOT-MATCHING, return a list of all articles that
9203 not match REGEXP on HEADER."
9204 (let ((case-fold-search (not not-case-fold
))
9207 (if (eq (car header
) 'extra
)
9210 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
9212 (error "%s is an invalid header" header
))
9213 (unless (fboundp (intern (concat "mail-header-" header
)))
9214 (error "%s is not a valid header" header
))
9215 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
9216 (dolist (d (if (eq backward
'all
)
9218 (gnus-data-find-list
9219 (gnus-summary-article-number)
9220 (gnus-data-list backward
))))
9221 (when (and (or (not unread
) ; We want all articles...
9222 (gnus-data-unread-p d
)) ; Or just unreads.
9223 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
9227 (funcall func
(gnus-data-header d
))))
9228 (string-match regexp
9229 (funcall func
(gnus-data-header d
)))))
9230 (push (gnus-data-number d
) articles
))) ; Success!
9231 (nreverse articles
)))
9233 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
9234 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9235 If HEADER is an empty string (or nil), the match is done on the entire
9236 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9238 (list (let ((completion-ignore-case t
))
9241 (mapcar (lambda (header) (list (format "%s" header
)))
9243 '("Number" "Subject" "From" "Lines" "Date"
9244 "Message-ID" "Xref" "References" "Body")
9245 gnus-extra-headers
))
9246 nil
'require-match
))
9247 (read-string "Regexp: ")
9248 (read-key-sequence "Command: ")
9249 current-prefix-arg
))
9250 (when (equal header
"Body")
9252 ;; Hidden thread subtrees must be searched as well.
9253 (gnus-summary-show-all-threads)
9254 ;; We don't want to change current point nor window configuration.
9256 (save-window-excursion
9258 gnus-treat-strip-trailing-blank-lines
9259 gnus-treat-strip-leading-blank-lines
9260 gnus-treat-strip-multiple-blank-lines
9261 gnus-treat-hide-boring-headers
9262 gnus-treat-fold-newsgroups
9263 gnus-article-prepare-hook
)
9264 (gnus-message 6 "Executing %s..." (key-description command
))
9265 ;; We'd like to execute COMMAND interactively so as to give arguments.
9266 (gnus-execute header regexp
9267 `(call-interactively ',(key-binding command
))
9269 (gnus-message 6 "Executing %s...done" (key-description command
))))))
9271 (defun gnus-summary-beginning-of-article ()
9272 "Scroll the article back to the beginning."
9274 (gnus-summary-select-article)
9275 (gnus-configure-windows 'article
)
9276 (gnus-eval-in-buffer-window gnus-article-buffer
9278 (goto-char (point-min))
9279 (when gnus-break-pages
9280 (gnus-narrow-to-page))))
9282 (defun gnus-summary-end-of-article ()
9283 "Scroll to the end of the article."
9285 (gnus-summary-select-article)
9286 (gnus-configure-windows 'article
)
9287 (gnus-eval-in-buffer-window gnus-article-buffer
9289 (goto-char (point-max))
9291 (when gnus-break-pages
9292 (gnus-narrow-to-page))))
9294 (defun gnus-summary-print-truncate-and-quote (string &optional len
)
9295 "Truncate to LEN and quote all \"(\"'s in STRING."
9296 (gnus-replace-in-string (if (and len
(> (length string
) len
))
9297 (substring string
0 len
)
9301 (defun gnus-summary-print-article (&optional filename n
)
9302 "Generate and print a PostScript image of the process-marked (mail) articles.
9304 If used interactively, print the current article if none are
9305 process-marked. With prefix arg, prompt the user for the name of the
9308 When used from Lisp, accept two optional args FILENAME and N. N means
9309 to print the next N articles. If N is negative, print the N previous
9310 articles. If N is nil and articles have been marked with the process
9311 mark, print these instead.
9313 If the optional first argument FILENAME is nil, send the image to the
9314 printer. If FILENAME is a string, save the PostScript image in a file with
9315 that name. If FILENAME is a number, prompt the user for the name of the file
9317 (interactive (list (ps-print-preprint current-prefix-arg
)))
9318 (dolist (article (gnus-summary-work-articles n
))
9319 (gnus-summary-select-article nil nil
'pseudo article
)
9320 (gnus-eval-in-buffer-window gnus-article-buffer
9321 (gnus-print-buffer))
9322 (gnus-summary-remove-process-mark article
))
9323 (ps-despool filename
))
9325 (defun gnus-print-buffer ()
9326 (let ((buffer (generate-new-buffer " *print*")))
9329 (copy-to-buffer buffer
(point-min) (point-max))
9331 (gnus-remove-text-with-property 'gnus-decoration
)
9332 (when (gnus-visual-p 'article-highlight
'highlight
)
9333 ;; Copy-to-buffer doesn't copy overlay. So redo
9335 (let ((gnus-article-buffer buffer
))
9336 (gnus-article-highlight-citation t
)
9337 (gnus-article-highlight-signature)
9338 (gnus-article-emphasize)
9339 (gnus-article-delete-invisible-text)))
9340 (let ((ps-left-header
9343 (gnus-summary-print-truncate-and-quote
9344 (mail-header-subject gnus-current-headers
)
9347 (gnus-summary-print-truncate-and-quote
9348 (mail-header-from gnus-current-headers
)
9352 "/pagenumberstring load"
9354 (mail-header-date gnus-current-headers
) ")"))))
9355 (gnus-run-hooks 'gnus-ps-print-hook
)
9357 (if ps-print-color-p
9358 (ps-spool-buffer-with-faces)
9359 (ps-spool-buffer)))))
9360 (kill-buffer buffer
))))
9362 (defun gnus-summary-show-article (&optional arg
)
9363 "Force redisplaying of the current article.
9364 If ARG (the prefix) is a number, show the article with the charset
9365 defined in `gnus-summary-show-article-charset-alist', or the charset
9367 If ARG (the prefix) is non-nil and not a number, show the raw article
9368 without any article massaging functions being run. Normally, the key
9369 strokes are `C-u g'."
9373 (gnus-summary-show-article t
)
9374 (let ((gnus-newsgroup-charset
9375 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
9376 (mm-read-coding-system
9377 "View as charset: " ;; actually it is coding system.
9378 (with-current-buffer gnus-article-buffer
9379 (mm-detect-coding-region (point) (point-max))))))
9380 (gnus-newsgroup-ignored-charsets 'gnus-all
))
9381 (gnus-summary-select-article nil
'force
)
9382 (let ((deps gnus-newsgroup-dependencies
)
9384 (with-current-buffer gnus-original-article-buffer
9386 (message-narrow-to-head)
9387 (setq head
(buffer-string))
9388 (goto-char (point-min))
9389 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t
)
9390 (goto-char (point-max))
9392 (setq lines
(1- (count-lines (point) (point-max))))))
9394 (insert (format "211 %d Article retrieved.\n"
9395 (cdr gnus-article-current
)))
9397 (if lines
(insert (format "Lines: %d\n" lines
)))
9399 (let ((nntp-server-buffer (current-buffer)))
9400 (setq header
(car (gnus-get-newsgroup-headers deps t
))))))
9401 (gnus-data-set-header
9402 (gnus-data-find (cdr gnus-article-current
))
9404 (gnus-summary-update-article-line
9405 (cdr gnus-article-current
) header
)
9406 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
9407 (gnus-summary-update-secondary-mark (cdr gnus-article-current
))))))
9409 ;; Select the article the normal way.
9410 (gnus-summary-select-article nil
'force
))
9412 ;; We have to require this here to make sure that the following
9413 ;; dynamic binding isn't shadowed by autoloading.
9414 (require 'gnus-async
)
9416 ;; Bind the article treatment functions to nil.
9417 (let ((gnus-have-all-headers t
)
9418 gnus-article-prepare-hook
9419 gnus-article-decode-hook
9420 gnus-display-mime-function
9422 ;; Destroy any MIME parts.
9423 (when (gnus-buffer-live-p gnus-article-buffer
)
9424 (with-current-buffer gnus-article-buffer
9425 (mm-destroy-parts gnus-article-mime-handles
)
9426 ;; Set it to nil for safety reason.
9427 (setq gnus-article-mime-handle-alist nil
)
9428 (setq gnus-article-mime-handles nil
)))
9429 (gnus-summary-select-article nil
'force
))))
9430 (gnus-summary-goto-subject gnus-current-article
)
9431 (gnus-summary-position-point))
9433 (defun gnus-summary-show-raw-article ()
9434 "Show the raw article without any article massaging functions being run."
9436 (gnus-summary-show-article t
))
9438 (defun gnus-summary-verbose-headers (&optional arg
)
9439 "Toggle permanent full header display.
9440 If ARG is a positive number, turn header display on.
9441 If ARG is a negative number, turn header display off."
9443 (setq gnus-show-all-headers
9444 (cond ((or (not (numberp arg
))
9446 (not gnus-show-all-headers
))
9449 (gnus-summary-show-article))
9451 (defun gnus-summary-toggle-header (&optional arg
)
9452 "Show the headers if they are hidden, or hide them if they are shown.
9453 If ARG is a positive number, show the entire header.
9454 If ARG is a negative number, hide the unwanted header lines."
9456 (let ((window (and (gnus-buffer-live-p gnus-article-buffer
)
9457 (get-buffer-window gnus-article-buffer t
))))
9458 (with-current-buffer gnus-article-buffer
9460 (article-narrow-to-head)
9461 (let* ((inhibit-read-only t
)
9462 (inhibit-point-motion-hooks t
)
9463 (hidden (if (numberp arg
)
9465 (or (not (looking-at "[^ \t\n]+:"))
9466 (gnus-article-hidden-text-p 'headers
))))
9468 (delete-region (point-min) (point-max))
9469 (with-current-buffer gnus-original-article-buffer
9470 (goto-char (setq s
(point-min)))
9471 (setq e
(if (search-forward "\n\n" nil t
)
9474 (insert-buffer-substring gnus-original-article-buffer s e
)
9475 (run-hooks 'gnus-article-decode-hook
)
9477 (let ((gnus-treat-hide-headers nil
)
9478 (gnus-treat-hide-boring-headers nil
))
9479 (gnus-delete-wash-type 'headers
)
9480 (gnus-treat-article 'head
))
9481 (gnus-treat-article 'head
))
9484 (set-window-start window
(goto-char (point-min))))
9485 (if gnus-break-pages
9486 (gnus-narrow-to-page)
9487 (when (gnus-visual-p 'page-marker
)
9488 (let ((inhibit-read-only t
))
9489 (gnus-remove-text-with-property 'gnus-prev
)
9490 (gnus-remove-text-with-property 'gnus-next
))))
9491 (gnus-set-mode-line 'article
)))))
9493 (defun gnus-summary-show-all-headers ()
9494 "Make all header lines visible."
9496 (gnus-summary-toggle-header 1))
9498 (defun gnus-summary-caesar-message (&optional arg
)
9499 "Caesar rotate the current article by 13.
9500 With a non-numerical prefix, also rotate headers. A numerical
9501 prefix specifies how many places to rotate each letter forward."
9503 (gnus-summary-select-article)
9504 (let ((mail-header-separator ""))
9505 (gnus-eval-in-buffer-window gnus-article-buffer
9508 (let ((start (window-start))
9509 (inhibit-read-only t
))
9510 (if (equal arg
'(4))
9511 (message-caesar-buffer-body nil t
)
9512 (message-caesar-buffer-body arg
))
9513 (set-window-start (get-buffer-window (current-buffer)) start
)))))
9514 ;; Create buttons and stuff...
9515 (gnus-treat-article nil
))
9517 (declare-function idna-to-unicode
"ext:idna" (str))
9519 (defun gnus-summary-idna-message (&optional arg
)
9520 "Decode IDNA encoded domain names in the current articles.
9521 IDNA encoded domain names looks like `xn--bar'. If a string
9522 remain unencoded after running this function, it is likely an
9523 invalid IDNA string (`xn--bar' is invalid).
9525 You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
9526 installed for this command to work."
9528 (if (not (and (condition-case nil
(require 'idna
)
9530 (mm-coding-system-p 'utf-8
)
9531 (executable-find (symbol-value 'idna-program
))))
9533 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9534 (gnus-summary-select-article)
9535 (let ((mail-header-separator ""))
9536 (gnus-eval-in-buffer-window gnus-article-buffer
9539 (let ((start (window-start))
9541 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t
)
9542 (replace-match (idna-to-unicode (match-string 1))))
9543 (set-window-start (get-buffer-window (current-buffer)) start
)))))))
9545 (defun gnus-summary-morse-message (&optional arg
)
9546 "Morse decode the current article."
9548 (gnus-summary-select-article)
9549 (let ((mail-header-separator ""))
9550 (gnus-eval-in-buffer-window gnus-article-buffer
9554 (let ((pos (window-start))
9555 (inhibit-read-only t
))
9556 (goto-char (point-min))
9557 (when (message-goto-body)
9558 (gnus-narrow-to-body))
9559 (goto-char (point-min))
9560 (while (search-forward "·" (point-max) t
)
9561 (replace-match "."))
9562 (unmorse-region (point-min) (point-max))
9564 (set-window-start (get-buffer-window (current-buffer)) pos
)))))))
9566 (defun gnus-summary-stop-page-breaking ()
9567 "Stop page breaking in the current article."
9569 (gnus-summary-select-article)
9570 (gnus-eval-in-buffer-window gnus-article-buffer
9572 (when (gnus-visual-p 'page-marker
)
9573 (let ((inhibit-read-only t
))
9574 (gnus-remove-text-with-property 'gnus-prev
)
9575 (gnus-remove-text-with-property 'gnus-next
))
9576 (setq gnus-page-broken nil
))))
9578 (defun gnus-summary-move-article (&optional n to-newsgroup
9579 select-method action
)
9580 "Move the current article to a different newsgroup.
9581 If N is a positive number, move the N next articles.
9582 If N is a negative number, move the N previous articles.
9583 If N is nil and any articles have been marked with the process mark,
9584 move those articles instead.
9585 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9586 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9587 re-spool using this method.
9589 When called interactively with TO-NEWSGROUP being nil, the value of
9590 the variable `gnus-move-split-methods' is used for finding a default
9591 for the target newsgroup.
9593 For this function to work, both the current newsgroup and the
9594 newsgroup that you want to move to have to support the `request-move'
9595 and `request-accept' functions.
9597 ACTION can be either `move' (the default), `crosspost' or `copy'."
9600 (setq action
'move
))
9601 ;; Check whether the source group supports the required functions.
9602 (cond ((and (eq action
'move
)
9603 (not (gnus-check-backend-function
9604 'request-move-article gnus-newsgroup-name
)))
9605 (error "The current group does not support article moving"))
9606 ((and (eq action
'crosspost
)
9607 (not (gnus-check-backend-function
9608 'request-replace-article gnus-newsgroup-name
)))
9609 (error "The current group does not support article editing")))
9610 (let ((articles (gnus-summary-work-articles n
))
9611 (prefix (if (gnus-check-backend-function
9612 'request-move-article gnus-newsgroup-name
)
9613 (funcall gnus-move-group-prefix-function
9614 gnus-newsgroup-name
)
9616 (names '((move "Move" "Moving")
9617 (copy "Copy" "Copying")
9618 (crosspost "Crosspost" "Crossposting")))
9619 (copy-buf (save-excursion
9620 (nnheader-set-temp-buffer " *copy article*")))
9621 art-group to-method new-xref article to-groups
9622 articles-to-update-marks encoded
)
9623 (unless (assq action names
)
9624 (error "Unknown action %s" action
))
9625 ;; Read the newsgroup name.
9626 (when (and (not to-newsgroup
)
9627 (not select-method
))
9628 (if (and gnus-move-split-methods
9630 (and (memq gnus-current-article articles
)
9631 (gnus-buffer-live-p gnus-original-article-buffer
))))
9632 ;; When `gnus-move-split-methods' is non-nil, we have to
9633 ;; select an article to give `gnus-read-move-group-name' an
9634 ;; opportunity to suggest an appropriate default. However,
9635 ;; we needn't render or mark the article.
9636 (let ((gnus-display-mime-function nil
)
9637 (gnus-article-prepare-hook nil
)
9638 (gnus-mark-article-hook nil
))
9639 (gnus-summary-select-article nil nil nil
(car articles
))))
9640 (setq to-newsgroup
(gnus-read-move-group-name
9641 (cadr (assq action names
))
9643 (intern (format "gnus-current-%s-group" action
)))
9645 encoded to-newsgroup
9646 to-method
(gnus-server-to-method (gnus-group-method to-newsgroup
)))
9647 (set (intern (format "gnus-current-%s-group" action
))
9648 (mm-decode-coding-string
9650 (gnus-group-name-charset to-method to-newsgroup
))))
9652 (setq to-method
(or select-method
9653 (gnus-server-to-method
9654 (gnus-group-method to-newsgroup
)))))
9658 (mm-encode-coding-string
9660 (gnus-group-name-charset to-method to-newsgroup
)))))
9661 ;; Check the method we are to move this article to...
9662 (unless (gnus-check-backend-function
9663 'request-accept-article
(car to-method
))
9664 (error "%s does not support article copying" (car to-method
)))
9665 (unless (gnus-check-server to-method
)
9666 (error "Can't open server %s" (car to-method
)))
9667 (gnus-message 6 "%s to %s: %s..."
9668 (caddr (assq action names
))
9669 (or (car select-method
)
9670 (gnus-group-decoded-name to-newsgroup
))
9673 (setq article
(pop articles
))
9677 ;; Move the article.
9679 ;; Remove this article from future suppression.
9680 (gnus-dup-unsuppress-article article
)
9681 (let* ((from-method (gnus-find-method-for-group
9682 gnus-newsgroup-name
))
9683 (to-method (or select-method
9684 (gnus-find-method-for-group to-newsgroup
)))
9685 (move-is-internal (gnus-method-equal from-method to-method
)))
9686 (gnus-request-move-article
9687 article
; Article to move
9688 gnus-newsgroup-name
; From newsgroup
9689 (nth 1 (gnus-find-method-for-group
9690 gnus-newsgroup-name
)) ; Server
9691 (list 'gnus-request-accept-article
9692 to-newsgroup
(list 'quote select-method
)
9693 (not articles
) t
) ; Accept form
9694 (not articles
) ; Only save nov last time
9695 move-is-internal
))) ; is this move internal?
9696 ;; Copy the article.
9698 (with-current-buffer copy-buf
9699 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9701 (nnheader-narrow-to-headers)
9702 (dolist (hdr gnus-copy-article-ignored-headers
)
9703 (message-remove-header hdr t
)))
9704 (gnus-request-accept-article
9705 to-newsgroup select-method
(not articles
) t
))))
9706 ;; Crosspost the article.
9707 ((eq action
'crosspost
)
9708 (let ((xref (message-tokenize-header
9709 (mail-header-xref (gnus-summary-article-header article
))
9711 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
9712 ":" (number-to-string article
)))
9714 (setq xref
(list (system-name))))
9717 (mapconcat 'identity
9718 (delete "Xref:" (delete new-xref xref
))
9721 (with-current-buffer copy-buf
9722 ;; First put the article in the destination group.
9723 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9724 (when (consp (setq art-group
9725 (gnus-request-accept-article
9726 to-newsgroup select-method
(not articles
) t
)))
9727 (setq new-xref
(concat new-xref
" " (car art-group
)
9729 (number-to-string (cdr art-group
))))
9730 ;; Now we have the new Xrefs header, so we insert
9731 ;; it and replace the new article.
9732 (nnheader-replace-header "Xref" new-xref
)
9733 (gnus-request-replace-article
9734 (cdr art-group
) to-newsgroup
(current-buffer) t
)
9738 (gnus-message 1 "Couldn't %s article %s: %s"
9739 (cadr (assq action names
)) article
9740 (nnheader-get-report (car to-method
))))
9741 ((eq art-group
'junk
)
9742 (when (eq action
'move
)
9743 (gnus-summary-mark-article article gnus-canceled-mark
)
9744 (gnus-message 4 "Deleted article %s" article
)
9745 ;; run the delete hook
9746 (run-hook-with-args 'gnus-summary-article-delete-hook
9749 (assoc article
(gnus-data-list nil
)))
9750 gnus-newsgroup-name nil
9753 (let* ((pto-group (gnus-group-prefixed-name
9754 (car art-group
) to-method
))
9755 (info (gnus-get-info pto-group
))
9756 (to-group (gnus-info-group info
))
9758 ;; Update the group that has been moved to.
9760 (memq action
'(move copy
)))
9761 (unless (member to-group to-groups
)
9762 (push to-group to-groups
))
9764 (unless (memq article gnus-newsgroup-unreads
)
9765 (push 'read to-marks
)
9767 info
(gnus-add-to-range (gnus-info-read info
)
9768 (list (cdr art-group
)))))
9770 ;; See whether the article is to be put in the cache.
9771 (let* ((expirable (gnus-group-auto-expirable-p to-group
))
9772 (marks (if expirable
9773 gnus-article-mark-lists
9774 (delete '(expirable . expire
)
9775 (copy-sequence gnus-article-mark-lists
))))
9776 (to-article (cdr art-group
)))
9778 ;; Enter the article into the cache in the new group,
9779 ;; if that is required.
9780 (when gnus-use-cache
9781 (gnus-cache-possibly-enter-article
9783 (memq article gnus-newsgroup-marked
)
9784 (memq article gnus-newsgroup-dormant
)
9785 (memq article gnus-newsgroup-unreads
)))
9787 (when gnus-preserve-marks
9788 ;; Copy any marks over to the new group.
9789 (when (and (equal to-group gnus-newsgroup-name
)
9790 (not (memq article gnus-newsgroup-unreads
)))
9791 ;; Mark this article as read in this group.
9792 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
9793 (setcdr (gnus-active to-group
) to-article
)
9794 (setcdr gnus-newsgroup-active to-article
))
9797 (when (eq (gnus-article-mark-to-type (cdar marks
)) 'list
)
9798 (when (memq article
(symbol-value
9799 (intern (format "gnus-newsgroup-%s"
9801 (push (cdar marks
) to-marks
)
9802 ;; If the other group is the same as this group,
9803 ;; then we have to add the mark to the list.
9804 (when (equal to-group gnus-newsgroup-name
)
9805 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
9808 (intern (format "gnus-newsgroup-%s"
9810 ;; Copy the marks to other group.
9811 (gnus-add-marked-articles
9812 to-group
(cdar marks
) (list to-article
) info
)))
9813 (setq marks
(cdr marks
)))
9815 (when (and expirable
9816 gnus-mark-copied-or-moved-articles-as-expirable
9817 (not (memq 'expire to-marks
)))
9818 ;; Mark this article as expirable.
9819 (push 'expire to-marks
)
9820 (when (equal to-group gnus-newsgroup-name
)
9821 (push to-article gnus-newsgroup-expirable
))
9822 ;; Copy the expirable mark to other group.
9823 (gnus-add-marked-articles
9824 to-group
'expire
(list to-article
) info
))
9826 (gnus-request-set-mark
9827 to-group
(list (list (list to-article
) 'add to-marks
))))
9830 (concat "(gnus-group-set-info '"
9831 (gnus-prin1-to-string (gnus-get-info to-group
))
9834 ;; Update the Xref header in this article to point to
9835 ;; the new crossposted article we have just created.
9836 (when (eq action
'crosspost
)
9837 (with-current-buffer copy-buf
9838 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9839 (nnheader-replace-header "Xref" new-xref
)
9840 (gnus-request-replace-article
9841 article gnus-newsgroup-name
(current-buffer) t
)))
9843 ;; run the move/copy/crosspost/respool hook
9844 (run-hook-with-args 'gnus-summary-article-move-hook
9847 (assoc article
(gnus-data-list nil
)))
9852 ;;;!!!Why is this necessary?
9853 (set-buffer gnus-summary-buffer
)
9855 (when (eq action
'move
)
9857 (gnus-summary-goto-subject article
)
9858 (gnus-summary-mark-article article gnus-canceled-mark
)))))
9859 (push article articles-to-update-marks
))
9862 (apply 'gnus-summary-remove-process-mark articles-to-update-marks
))
9863 ;; Re-activate all groups that have been moved to.
9864 (with-current-buffer gnus-group-buffer
9865 (let ((gnus-group-marked to-groups
))
9866 (gnus-group-get-new-news-this-group nil t
)))
9868 (gnus-kill-buffer copy-buf
)
9869 (gnus-summary-position-point)
9870 (gnus-set-mode-line 'summary
)))
9872 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
9873 "Copy the current article to some other group.
9874 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9875 When called interactively, if TO-NEWSGROUP is nil, use the value of
9876 the variable `gnus-move-split-methods' for finding a default target
9878 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9879 re-spool using this method."
9881 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
9883 (defun gnus-summary-crosspost-article (&optional n
)
9884 "Crosspost the current article to some other group."
9886 (gnus-summary-move-article n nil nil
'crosspost
))
9888 (defcustom gnus-summary-respool-default-method nil
9889 "Default method type for respooling an article.
9890 If nil, use to the current newsgroup method."
9892 :group
'gnus-summary-mail
)
9894 (defun gnus-summary-respool-article (&optional n method
)
9895 "Respool the current article.
9896 The article will be squeezed through the mail spooling process again,
9897 which means that it will be put in some mail newsgroup or other
9898 depending on `nnmail-split-methods'.
9899 If N is a positive number, respool the N next articles.
9900 If N is a negative number, respool the N previous articles.
9901 If N is nil and any articles have been marked with the process mark,
9902 respool those articles instead.
9904 Respooling can be done both from mail groups and \"real\" newsgroups.
9905 In the former case, the articles in question will be moved from the
9906 current group into whatever groups they are destined to. In the
9907 latter case, they will be copied into the relevant groups."
9909 (list current-prefix-arg
9910 (let* ((methods (gnus-methods-using 'respool
))
9912 (symbol-name (or gnus-summary-respool-default-method
9913 (car (gnus-find-method-for-group
9914 gnus-newsgroup-name
)))))
9916 (gnus-completing-read-with-default
9917 methname
"Backend to use when respooling"
9918 methods nil t nil
'gnus-mail-method-history
))
9921 ((zerop (length (setq ms
(gnus-servers-using-backend
9923 (list (intern method
) ""))
9927 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
9928 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
9931 (error "No method given for respooling"))
9932 (if (assoc (symbol-name
9933 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
9934 (gnus-methods-using 'respool
))
9935 (gnus-summary-move-article n nil method
)
9936 (gnus-summary-copy-article n nil method
)))
9938 (defun gnus-summary-import-article (file &optional edit
)
9939 "Import an arbitrary file into a mail newsgroup."
9940 (interactive "fImport file: \nP")
9941 (let ((group gnus-newsgroup-name
)
9942 (now (current-time))
9943 atts lines group-art
)
9944 (unless (gnus-check-backend-function 'request-accept-article group
)
9945 (error "%s does not support article importing" group
))
9946 (or (file-readable-p file
)
9947 (not (file-regular-p file
))
9948 (error "Can't read %s" file
))
9949 (with-current-buffer (gnus-get-buffer-create " *import file*")
9951 (nnheader-insert-file-contents file
)
9952 (goto-char (point-min))
9953 (if (nnheader-article-p)
9955 (goto-char (point-min))
9956 (search-forward "\n\n" nil t
)
9957 (narrow-to-region (point-min) (1- (point)))
9958 (goto-char (point-min))
9959 (unless (re-search-forward "^date:" nil t
)
9960 (goto-char (point-max))
9961 (insert "Date: " (message-make-date (nth 5 atts
)) "\n")))
9962 ;; This doesn't look like an article, so we fudge some headers.
9963 (setq atts
(file-attributes file
)
9964 lines
(count-lines (point-min) (point-max)))
9965 (insert "From: " (read-string "From: ") "\n"
9966 "Subject: " (read-string "Subject: ") "\n"
9967 "Date: " (message-make-date (nth 5 atts
)) "\n"
9968 "Message-ID: " (message-make-message-id) "\n"
9969 "Lines: " (int-to-string lines
) "\n"
9970 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9971 (setq group-art
(gnus-request-accept-article group nil t
))
9972 (kill-buffer (current-buffer)))
9973 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9975 (gnus-summary-goto-article (cdr group-art
) nil t
)
9977 (gnus-summary-edit-article))))
9979 (defun gnus-summary-create-article ()
9980 "Create an article in a mail newsgroup."
9982 (let ((group gnus-newsgroup-name
)
9983 (now (current-time))
9985 (unless (gnus-check-backend-function 'request-accept-article group
)
9986 (error "%s does not support article importing" group
))
9987 (with-current-buffer (gnus-get-buffer-create " *import file*")
9989 (goto-char (point-min))
9990 ;; This doesn't look like an article, so we fudge some headers.
9991 (insert "From: " (read-string "From: ") "\n"
9992 "Subject: " (read-string "Subject: ") "\n"
9993 "Date: " (message-make-date now
) "\n"
9994 "Message-ID: " (message-make-message-id) "\n")
9995 (setq group-art
(gnus-request-accept-article group nil t
))
9996 (kill-buffer (current-buffer)))
9997 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9999 (gnus-summary-goto-article (cdr group-art
) nil t
)
10000 (gnus-summary-edit-article)))
10002 (defun gnus-summary-article-posted-p ()
10003 "Say whether the current (mail) article is available from news as well.
10004 This will be the case if the article has both been mailed and posted."
10006 (let ((id (mail-header-references (gnus-summary-article-header)))
10007 (gnus-override-method (car (gnus-refer-article-methods))))
10008 (if (gnus-request-head id
"")
10009 (gnus-message 2 "The current message was found on %s"
10010 gnus-override-method
)
10011 (gnus-message 2 "The current message couldn't be found on %s"
10012 gnus-override-method
)
10015 (defun gnus-summary-expire-articles (&optional now
)
10016 "Expire all articles that are marked as expirable in the current group."
10018 (when (and (not gnus-group-is-exiting-without-update-p
)
10019 (gnus-check-backend-function
10020 'request-expire-articles gnus-newsgroup-name
))
10021 ;; This backend supports expiry.
10022 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
10023 (expirable (if total
10025 ;; We need to update the info for
10026 ;; this group for `gnus-list-of-read-articles'
10027 ;; to give us the right answer.
10028 (gnus-run-hooks 'gnus-exit-group-hook
)
10029 (gnus-summary-update-info)
10030 (gnus-list-of-read-articles gnus-newsgroup-name
))
10031 (setq gnus-newsgroup-expirable
10032 (sort gnus-newsgroup-expirable
'<))))
10033 (expiry-wait (if now
'immediate
10034 (gnus-group-find-parameter
10035 gnus-newsgroup-name
'expiry-wait
)))
10036 (nnmail-expiry-target
10037 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
10038 nnmail-expiry-target
))
10041 ;; There are expirable articles in this group, so we run them
10042 ;; through the expiry process.
10043 (gnus-message 6 "Expiring articles...")
10044 (unless (gnus-check-group gnus-newsgroup-name
)
10045 (error "Can't open server for %s" gnus-newsgroup-name
))
10046 ;; The list of articles that weren't expired is returned.
10049 (let ((nnmail-expiry-wait-function nil
)
10050 (nnmail-expiry-wait expiry-wait
))
10051 (setq es
(gnus-request-expire-articles
10052 expirable gnus-newsgroup-name
)))
10053 (setq es
(gnus-request-expire-articles
10054 expirable gnus-newsgroup-name
)))
10056 (setq gnus-newsgroup-expirable es
))
10057 ;; We go through the old list of expirable, and mark all
10058 ;; really expired articles as nonexistent.
10059 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
10060 (let ((gnus-use-cache nil
))
10061 (dolist (article expirable
)
10062 (when (and (not (memq article es
))
10063 (gnus-data-find article
))
10064 (gnus-summary-mark-article article gnus-canceled-mark
)
10065 (run-hook-with-args 'gnus-summary-article-expire-hook
10068 (assoc article
(gnus-data-list nil
)))
10069 gnus-newsgroup-name
10072 (gnus-message 6 "Expiring articles...done")))))
10074 (defun gnus-summary-expire-articles-now ()
10075 "Expunge all expirable articles in the current group.
10076 This means that *all* articles that are marked as expirable will be
10077 deleted forever, right now."
10079 (or gnus-expert-user
10081 "Are you really, really sure you want to delete all expirable messages? ")
10083 (gnus-summary-expire-articles t
))
10085 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10086 (defun gnus-summary-delete-article (&optional n
)
10087 "Delete the N next (mail) articles.
10088 This command actually deletes articles. This is not a marking
10089 command. The article will disappear forever from your life, never to
10092 If N is negative, delete backwards.
10093 If N is nil and articles have been marked with the process mark,
10094 delete these instead.
10096 If `gnus-novice-user' is non-nil you will be asked for
10097 confirmation before the articles are deleted."
10099 (unless (gnus-check-backend-function 'request-expire-articles
10100 gnus-newsgroup-name
)
10101 (error "The current newsgroup does not support article deletion"))
10102 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
10103 (error "Couldn't open server"))
10104 ;; Compute the list of articles to delete.
10105 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
10106 (nnmail-expiry-target 'delete
)
10108 (if (and gnus-novice-user
10109 (not (gnus-yes-or-no-p
10110 (format "Do you really want to delete %s forever? "
10111 (if (> (length articles
) 1)
10112 (format "these %s articles" (length articles
))
10113 "this article")))))
10115 ;; Delete the articles.
10116 (setq not-deleted
(gnus-request-expire-articles
10117 articles gnus-newsgroup-name
'force
))
10120 (gnus-summary-remove-process-mark (car articles
))
10121 ;; The backend might not have been able to delete the article
10123 (unless (memq (car articles
) not-deleted
)
10124 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
10125 (let* ((article (car articles
))
10126 (ghead (gnus-data-header
10127 (assoc article
(gnus-data-list nil
)))))
10128 (run-hook-with-args 'gnus-summary-article-delete-hook
10129 'delete ghead gnus-newsgroup-name nil
10131 (setq articles
(cdr articles
))))
10133 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
10134 (gnus-summary-position-point)
10135 (gnus-set-mode-line 'summary
)
10138 (defun gnus-summary-edit-article (&optional arg
)
10139 "Edit the current article.
10140 This will have permanent effect only in mail groups.
10141 If ARG is nil, edit the decoded articles.
10142 If ARG is 1, edit the raw articles.
10143 If ARG is 2, edit the raw articles even in read-only groups.
10144 If ARG is 3, edit the articles with the current handles.
10145 Otherwise, allow editing of articles even in read-only
10148 (let (force raw current-handles
)
10157 (setq current-handles
10158 (and (gnus-buffer-live-p gnus-article-buffer
)
10159 (with-current-buffer gnus-article-buffer
10161 gnus-article-mime-handles
10162 (setq gnus-article-mime-handles nil
))))))
10165 (when (and raw
(not force
)
10166 (member gnus-newsgroup-name
'("nndraft:delayed"
10169 (error "Can't edit the raw article in group %s"
10170 gnus-newsgroup-name
))
10171 (with-current-buffer gnus-summary-buffer
10172 (let ((mail-parse-charset gnus-newsgroup-charset
)
10173 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
10174 (gnus-set-global-variables)
10175 (when (and (not force
)
10176 (gnus-group-read-only-p))
10177 (error "The current newsgroup does not support article editing"))
10178 (gnus-summary-show-article t
)
10179 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
10180 (with-current-buffer gnus-article-buffer
10181 (mm-enable-multibyte)))
10182 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
10184 (gnus-article-edit-article
10187 (let ((mbl mml-buffer-list
))
10188 (setq mml-buffer-list nil
)
10189 (let ((rfc2047-quote-decoded-words-containing-tspecials t
))
10190 (mime-to-mml ,'current-handles
))
10191 (let ((mbl1 mml-buffer-list
))
10192 (setq mml-buffer-list mbl
)
10193 (set (make-local-variable 'mml-buffer-list
) mbl1
))
10194 (gnus-make-local-hook 'kill-buffer-hook
)
10195 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
10196 `(lambda (no-highlight)
10197 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
10198 (message-options message-options
)
10199 (message-options-set-recipient)
10200 (mail-parse-ignored-charsets
10201 ',gnus-newsgroup-ignored-charsets
)
10202 (rfc2047-header-encoding-alist
10203 ',(let ((charset (gnus-group-name-charset
10204 (gnus-find-method-for-group
10205 gnus-newsgroup-name
)
10206 gnus-newsgroup-name
)))
10207 (append (list (cons "Newsgroups" charset
)
10208 (cons "Followup-To" charset
)
10209 (cons "Xref" charset
))
10210 rfc2047-header-encoding-alist
))))
10211 ,(if (not raw
) '(progn
10213 (mml-destroy-buffers)
10214 (remove-hook 'kill-buffer-hook
10215 'mml-destroy-buffers t
)
10216 (kill-local-variable 'mml-buffer-list
)))
10217 (gnus-summary-edit-article-done
10218 ,(or (mail-header-references gnus-current-headers
) "")
10219 ,(gnus-group-read-only-p)
10220 ,gnus-summary-buffer no-highlight
))))))))
10222 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
10224 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10226 "Make edits to the current article permanent."
10229 ;; The buffer restriction contains the entire article if it exists.
10230 (when (article-goto-body)
10231 (let ((lines (count-lines (point) (point-max)))
10232 (length (- (point-max) (point)))
10233 (case-fold-search t
)
10234 (body (copy-marker (point))))
10235 (goto-char (point-min))
10236 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t
)
10237 (delete-region (match-beginning 1) (match-end 1))
10238 (insert (number-to-string length
)))
10239 (goto-char (point-min))
10240 (when (re-search-forward
10241 "^x-content-length:[ \t]\\([0-9]+\\)" body t
)
10242 (delete-region (match-beginning 1) (match-end 1))
10243 (insert (number-to-string length
)))
10244 (goto-char (point-min))
10245 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t
)
10246 (delete-region (match-beginning 1) (match-end 1))
10247 (insert (number-to-string lines
))))))
10248 ;; Replace the article.
10249 (let ((buf (current-buffer)))
10251 (insert-buffer-substring buf
)
10253 (if (and (not read-only
)
10254 (not (gnus-request-replace-article
10255 (cdr gnus-article-current
) (car gnus-article-current
)
10256 (current-buffer) t
)))
10257 (error "Couldn't replace article")
10258 ;; Update the summary buffer.
10259 (if (and references
10260 (equal (message-tokenize-header references
" ")
10261 (message-tokenize-header
10262 (or (message-fetch-field "references") "") " ")))
10263 ;; We only have to update this line.
10266 (message-narrow-to-head)
10267 (let ((head (buffer-substring-no-properties
10268 (point-min) (point-max)))
10271 (insert (format "211 %d Article retrieved.\n"
10272 (cdr gnus-article-current
)))
10275 (let ((nntp-server-buffer (current-buffer)))
10276 (setq header
(car (gnus-get-newsgroup-headers
10278 (with-current-buffer gnus-summary-buffer
10279 (gnus-data-set-header
10280 (gnus-data-find (cdr gnus-article-current
))
10282 (gnus-summary-update-article-line
10283 (cdr gnus-article-current
) header
)
10284 (if (gnus-summary-goto-subject
10285 (cdr gnus-article-current
) nil t
)
10286 (gnus-summary-update-secondary-mark
10287 (cdr gnus-article-current
))))))))
10289 (set-buffer (or buffer gnus-summary-buffer
))
10290 (gnus-summary-update-article (cdr gnus-article-current
))
10291 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
10292 (gnus-summary-update-secondary-mark
10293 (cdr gnus-article-current
))))
10294 ;; Prettify the article buffer again.
10295 (unless no-highlight
10296 (with-current-buffer gnus-article-buffer
10297 ;;;!!! Fix this -- article should be rehighlighted.
10298 ;;;(gnus-run-hooks 'gnus-article-display-hook)
10299 (set-buffer gnus-original-article-buffer
)
10300 (gnus-request-article
10301 (cdr gnus-article-current
)
10302 (car gnus-article-current
) (current-buffer))))
10303 ;; Prettify the summary buffer line.
10304 (when (gnus-visual-p 'summary-highlight
'highlight
)
10305 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
10307 (defun gnus-summary-edit-wash (key)
10308 "Perform editing command KEY in the article buffer."
10312 (message "%s" (concat (this-command-keys) "- "))
10315 (gnus-summary-edit-article)
10316 (execute-kbd-macro (concat (this-command-keys) key
))
10317 (gnus-article-edit-done))
10321 (defun gnus-summary-respool-query (&optional silent trace
)
10322 "Query where the respool algorithm would put this article."
10324 (let (gnus-mark-article-hook)
10325 (gnus-summary-select-article)
10326 (with-current-buffer gnus-original-article-buffer
10327 (let ((groups (nnmail-article-group 'identity trace
)))
10330 (message "This message would go to %s"
10331 (mapconcat 'car groups
", "))
10332 (message "This message would go to no groups"))
10335 (defun gnus-summary-respool-trace ()
10336 "Trace where the respool algorithm would put this article.
10337 Display a buffer showing all fancy splitting patterns which matched."
10339 (gnus-summary-respool-query nil t
))
10341 ;; Summary marking commands.
10343 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
10344 "Mark articles which has the same subject as read, and then select the next.
10345 If UNMARK is positive, remove any kind of mark.
10346 If UNMARK is negative, tick articles."
10349 (setq unmark
(prefix-numeric-value unmark
)))
10351 (gnus-summary-mark-same-subject
10352 (gnus-summary-article-subject) unmark
)))
10353 ;; Select next unread article. If auto-select-same mode, should
10354 ;; select the first unread article.
10355 (gnus-summary-next-article t
(and gnus-auto-select-same
10356 (gnus-summary-article-subject)))
10357 (gnus-message 7 "%d article%s marked as %s"
10358 count
(if (= count
1) " is" "s are")
10359 (if unmark
"unread" "read"))))
10361 (defun gnus-summary-kill-same-subject (&optional unmark
)
10362 "Mark articles which has the same subject as read.
10363 If UNMARK is positive, remove any kind of mark.
10364 If UNMARK is negative, tick articles."
10367 (setq unmark
(prefix-numeric-value unmark
)))
10369 (gnus-summary-mark-same-subject
10370 (gnus-summary-article-subject) unmark
)))
10371 ;; If marked as read, go to next unread subject.
10372 (when (null unmark
)
10373 ;; Go to next unread subject.
10374 (gnus-summary-next-subject 1 t
))
10375 (gnus-message 7 "%d articles are marked as %s"
10376 count
(if unmark
"unread" "read"))))
10378 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
10379 "Mark articles with same SUBJECT as read, and return marked number.
10380 If optional argument UNMARK is positive, remove any kinds of marks.
10381 If optional argument UNMARK is negative, mark articles as unread instead."
10385 ((null unmark
) ; Mark as read.
10388 (gnus-summary-mark-article-as-read gnus-killed-mark
)
10389 (gnus-summary-show-thread) t
)
10390 (gnus-summary-find-subject subject
))
10391 (setq count
(1+ count
))))
10392 ((> unmark
0) ; Tick.
10395 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
10396 (gnus-summary-show-thread) t
)
10397 (gnus-summary-find-subject subject
))
10398 (setq count
(1+ count
))))
10399 (t ; Mark as unread.
10402 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
10403 (gnus-summary-show-thread) t
)
10404 (gnus-summary-find-subject subject
))
10405 (setq count
(1+ count
)))))
10406 (gnus-set-mode-line 'summary
)
10407 ;; Return the number of marked articles.
10410 (defun gnus-summary-mark-as-processable (n &optional unmark
)
10411 "Set the process mark on the next N articles.
10412 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10413 the process mark instead. The difference between N and the actual
10414 number of articles marked is returned."
10416 (if (and (null n
) (gnus-region-active-p))
10417 (gnus-uu-mark-region (region-beginning) (region-end) unmark
)
10418 (setq n
(prefix-numeric-value n
))
10419 (let ((backward (< n
0))
10424 (gnus-summary-remove-process-mark
10425 (gnus-summary-article-number))
10426 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10427 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
10430 (gnus-message 7 "No more articles"))
10431 (gnus-summary-recenter)
10432 (gnus-summary-position-point)
10435 (defun gnus-summary-unmark-as-processable (n)
10436 "Remove the process mark from the next N articles.
10437 If N is negative, unmark backward instead. The difference between N and
10438 the actual number of articles unmarked is returned."
10440 (gnus-summary-mark-as-processable n t
))
10442 (defun gnus-summary-unmark-all-processable ()
10443 "Remove the process mark from all articles."
10446 (while gnus-newsgroup-processable
10447 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
10448 (gnus-summary-position-point))
10450 (defun gnus-summary-add-mark (article type
)
10451 "Mark ARTICLE with a mark of TYPE."
10452 (let ((vtype (car (assq type gnus-article-mark-lists
)))
10455 (error "No such mark type: %s" type
)
10456 (setq var
(intern (format "gnus-newsgroup-%s" type
)))
10457 (set var
(cons article
(symbol-value var
)))
10458 (if (memq type
'(processable cached replied forwarded recent saved
))
10459 (gnus-summary-update-secondary-mark article
)
10460 ;;; !!! This is bogus. We should find out what primary
10461 ;;; !!! mark we want to set.
10462 (gnus-summary-update-mark gnus-del-mark
'unread
)))))
10464 (defun gnus-summary-mark-as-expirable (n)
10465 "Mark N articles forward as expirable.
10466 If N is negative, mark backward instead. The difference between N and
10467 the actual number of articles marked is returned."
10469 (gnus-summary-mark-forward n gnus-expirable-mark
))
10471 (defun gnus-summary-mark-as-spam (n)
10472 "Mark N articles forward as spam.
10473 If N is negative, mark backward instead. The difference between N and
10474 the actual number of articles marked is returned."
10476 (gnus-summary-mark-forward n gnus-spam-mark
))
10478 (defun gnus-summary-mark-article-as-replied (article)
10479 "Mark ARTICLE as replied to and update the summary line.
10480 ARTICLE can also be a list of articles."
10481 (interactive (list (gnus-summary-article-number)))
10482 (let ((articles (if (listp article
) article
(list article
))))
10483 (dolist (article articles
)
10484 (unless (numberp article
)
10485 (error "%s is not a number" article
))
10486 (push article gnus-newsgroup-replied
)
10487 (let ((inhibit-read-only t
))
10488 (when (gnus-summary-goto-subject article nil t
)
10489 (gnus-summary-update-secondary-mark article
))))))
10491 (defun gnus-summary-mark-article-as-forwarded (article)
10492 "Mark ARTICLE as forwarded and update the summary line.
10493 ARTICLE can also be a list of articles."
10494 (let ((articles (if (listp article
) article
(list article
))))
10495 (dolist (article articles
)
10496 (push article gnus-newsgroup-forwarded
)
10497 (let ((inhibit-read-only t
))
10498 (when (gnus-summary-goto-subject article nil t
)
10499 (gnus-summary-update-secondary-mark article
))))))
10501 (defun gnus-summary-set-bookmark (article)
10502 "Set a bookmark in current article."
10503 (interactive (list (gnus-summary-article-number)))
10504 (when (or (not (get-buffer gnus-article-buffer
))
10505 (not gnus-current-article
)
10506 (not gnus-article-current
)
10507 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
10508 (error "No current article selected"))
10509 ;; Remove old bookmark, if one exists.
10510 (gnus-pull article gnus-newsgroup-bookmarks
)
10511 ;; Set the new bookmark, which is on the form
10512 ;; (article-number . line-number-in-body).
10515 (with-current-buffer gnus-article-buffer
10519 (article-goto-body)
10522 gnus-newsgroup-bookmarks
)
10523 (gnus-message 6 "A bookmark has been added to the current article."))
10525 (defun gnus-summary-remove-bookmark (article)
10526 "Remove the bookmark from the current article."
10527 (interactive (list (gnus-summary-article-number)))
10528 ;; Remove old bookmark, if one exists.
10529 (if (not (assq article gnus-newsgroup-bookmarks
))
10530 (gnus-message 6 "No bookmark in current article.")
10531 (gnus-pull article gnus-newsgroup-bookmarks
)
10532 (gnus-message 6 "Removed bookmark.")))
10534 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10535 (defun gnus-summary-mark-as-dormant (n)
10536 "Mark N articles forward as dormant.
10537 If N is negative, mark backward instead. The difference between N and
10538 the actual number of articles marked is returned."
10540 (gnus-summary-mark-forward n gnus-dormant-mark
))
10542 (defun gnus-summary-set-process-mark (article)
10543 "Set the process mark on ARTICLE and update the summary line."
10544 (setq gnus-newsgroup-processable
10546 (delq article gnus-newsgroup-processable
)))
10547 (when (gnus-summary-goto-subject article
)
10548 (gnus-summary-show-thread)
10549 (gnus-summary-goto-subject article
)
10550 (gnus-summary-update-secondary-mark article
)))
10552 (defun gnus-summary-remove-process-mark (&rest articles
)
10553 "Remove the process mark from ARTICLES and update the summary line."
10554 (dolist (article articles
)
10555 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
10556 (when (gnus-summary-goto-subject article
)
10557 (gnus-summary-show-thread)
10558 (gnus-summary-goto-subject article
)
10559 (gnus-summary-update-secondary-mark article
)))
10562 (defun gnus-summary-set-saved-mark (article)
10563 "Set the process mark on ARTICLE and update the summary line."
10564 (push article gnus-newsgroup-saved
)
10565 (when (gnus-summary-goto-subject article
)
10566 (gnus-summary-update-secondary-mark article
)))
10568 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
10569 "Mark N articles as read forwards.
10570 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10571 The difference between N and the actual number of articles marked is
10573 If NO-EXPIRE, auto-expiry will be inhibited."
10575 (gnus-summary-show-thread)
10576 (let ((backward (< n
0))
10577 (gnus-summary-goto-unread
10578 (and gnus-summary-goto-unread
10579 (not (eq gnus-summary-goto-unread
'never
))
10580 (not (memq mark
(list gnus-unread-mark gnus-spam-mark
10581 gnus-ticked-mark gnus-dormant-mark
)))))
10583 (mark (or mark gnus-del-mark
)))
10584 (while (and (> n
0)
10585 (gnus-summary-mark-article nil mark no-expire
)
10586 (zerop (gnus-summary-next-subject
10588 (and gnus-summary-goto-unread
10589 (not (eq gnus-summary-goto-unread
'never
)))
10593 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
10594 (gnus-summary-recenter)
10595 (gnus-summary-position-point)
10596 (gnus-set-mode-line 'summary
)
10599 (defun gnus-summary-mark-article-as-read (mark)
10600 "Mark the current article quickly as read with MARK."
10601 (let ((article (gnus-summary-article-number)))
10602 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10603 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10604 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10605 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10606 (push (cons article mark
) gnus-newsgroup-reads
)
10607 ;; Possibly remove from cache, if that is used.
10608 (when gnus-use-cache
10609 (gnus-cache-enter-remove-article article
))
10610 ;; Allow the backend to change the mark.
10611 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10612 ;; Check for auto-expiry.
10613 (when (and gnus-newsgroup-auto-expire
10614 (memq mark gnus-auto-expirable-marks
))
10615 (setq mark gnus-expirable-mark
)
10616 ;; Let the backend know about the mark change.
10617 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10618 (push article gnus-newsgroup-expirable
))
10619 ;; Set the mark in the buffer.
10620 (gnus-summary-update-mark mark
'unread
)
10623 (defun gnus-summary-mark-article-as-unread (mark)
10624 "Mark the current article quickly as unread with MARK."
10625 (let* ((article (gnus-summary-article-number))
10626 (old-mark (gnus-summary-article-mark article
)))
10627 ;; Allow the backend to change the mark.
10628 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10629 (if (eq mark old-mark
)
10633 (gnus-error 1 "Can't mark negative article numbers")
10635 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10636 (setq gnus-newsgroup-spam-marked
10637 (delq article gnus-newsgroup-spam-marked
))
10638 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10639 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
10640 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
10641 (cond ((= mark gnus-ticked-mark
)
10642 (setq gnus-newsgroup-marked
10643 (gnus-add-to-sorted-list gnus-newsgroup-marked
10645 ((= mark gnus-spam-mark
)
10646 (setq gnus-newsgroup-spam-marked
10647 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10649 ((= mark gnus-dormant-mark
)
10650 (setq gnus-newsgroup-dormant
10651 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10654 (setq gnus-newsgroup-unreads
10655 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10657 (gnus-pull article gnus-newsgroup-reads
)
10659 ;; See whether the article is to be put in the cache.
10660 (and gnus-use-cache
10661 (vectorp (gnus-summary-article-header article
))
10663 (gnus-cache-possibly-enter-article
10664 gnus-newsgroup-name article
10665 (= mark gnus-ticked-mark
)
10666 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10669 (gnus-summary-update-mark mark
'unread
)
10672 (defun gnus-summary-mark-article (&optional article mark no-expire
)
10673 "Mark ARTICLE with MARK. MARK can be any character.
10674 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10675 `??' (dormant) and `?E' (expirable).
10676 If MARK is nil, then the default character `?r' is used.
10677 If ARTICLE is nil, then the article on the current line will be
10679 If NO-EXPIRE, auto-expiry will be inhibited."
10680 ;; The mark might be a string.
10681 (when (stringp mark
)
10682 (setq mark
(aref mark
0)))
10683 ;; If no mark is given, then we check auto-expiring.
10685 (setq mark gnus-del-mark
))
10686 (when (and (not no-expire
)
10687 gnus-newsgroup-auto-expire
10688 (memq mark gnus-auto-expirable-marks
))
10689 (setq mark gnus-expirable-mark
))
10690 (let ((article (or article
(gnus-summary-article-number)))
10691 (old-mark (gnus-summary-article-mark article
)))
10692 ;; Allow the backend to change the mark.
10693 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10694 (if (eq mark old-mark
)
10697 (error "No article on current line"))
10698 (if (not (if (or (= mark gnus-unread-mark
)
10699 (= mark gnus-ticked-mark
)
10700 (= mark gnus-spam-mark
)
10701 (= mark gnus-dormant-mark
))
10702 (gnus-mark-article-as-unread article mark
)
10703 (gnus-mark-article-as-read article mark
)))
10705 ;; See whether the article is to be put in the cache.
10706 (and gnus-use-cache
10707 (not (= mark gnus-canceled-mark
))
10708 (vectorp (gnus-summary-article-header article
))
10710 (gnus-cache-possibly-enter-article
10711 gnus-newsgroup-name article
10712 (= mark gnus-ticked-mark
)
10713 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10715 (when (gnus-summary-goto-subject article nil t
)
10716 (let ((inhibit-read-only t
))
10717 (gnus-summary-show-thread)
10719 (gnus-summary-update-mark mark
'unread
)
10722 (defun gnus-summary-update-secondary-mark (article)
10723 "Update the secondary (read, process, cache) mark."
10724 (gnus-summary-update-mark
10725 (cond ((memq article gnus-newsgroup-processable
)
10727 ((memq article gnus-newsgroup-cached
)
10729 ((memq article gnus-newsgroup-replied
)
10731 ((memq article gnus-newsgroup-forwarded
)
10732 gnus-forwarded-mark
)
10733 ((memq article gnus-newsgroup-saved
)
10735 ((memq article gnus-newsgroup-recent
)
10737 ((memq article gnus-newsgroup-unseen
)
10741 (when (gnus-visual-p 'summary-highlight
'highlight
)
10742 (gnus-run-hooks 'gnus-summary-update-hook
))
10745 (defun gnus-summary-update-download-mark (article)
10746 "Update the download mark."
10747 (gnus-summary-update-mark
10748 (cond ((memq article gnus-newsgroup-undownloaded
)
10749 gnus-undownloaded-mark
)
10750 (gnus-newsgroup-agentized
10751 gnus-downloaded-mark
)
10755 (gnus-summary-update-line t
)
10758 (defun gnus-summary-update-mark (mark type
)
10759 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
10760 (inhibit-read-only t
))
10761 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit
)
10763 (when (looking-at "\r")
10765 (when (<= (+ forward
(point)) (point-max))
10766 ;; Go to the right position on the line.
10767 (goto-char (+ forward
(point)))
10768 ;; Replace the old mark with the new mark.
10769 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
10770 ;; Optionally update the marks by some user rule.
10771 (when (eq type
'unread
)
10772 (gnus-data-set-mark
10773 (gnus-data-find (gnus-summary-article-number)) mark
)
10774 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
10776 (defun gnus-mark-article-as-read (article &optional mark
)
10777 "Enter ARTICLE in the pertinent lists and remove it from others."
10778 ;; Make the article expirable.
10779 (let ((mark (or mark gnus-del-mark
)))
10780 (setq gnus-newsgroup-expirable
10781 (if (= mark gnus-expirable-mark
)
10782 (gnus-add-to-sorted-list gnus-newsgroup-expirable article
)
10783 (delq article gnus-newsgroup-expirable
)))
10784 ;; Remove from unread and marked lists.
10785 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10786 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10787 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10788 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10789 (push (cons article mark
) gnus-newsgroup-reads
)
10790 ;; Possibly remove from cache, if that is used.
10791 (when gnus-use-cache
10792 (gnus-cache-enter-remove-article article
))
10795 (defun gnus-mark-article-as-unread (article &optional mark
)
10796 "Enter ARTICLE in the pertinent lists and remove it from others."
10797 (let ((mark (or mark gnus-ticked-mark
)))
10800 (gnus-error 1 "Can't mark negative article numbers")
10802 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
10803 gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
)
10804 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
10805 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
10806 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10808 ;; Unsuppress duplicates?
10809 (when gnus-suppress-duplicates
10810 (gnus-dup-unsuppress-article article
))
10812 (cond ((= mark gnus-ticked-mark
)
10813 (setq gnus-newsgroup-marked
10814 (gnus-add-to-sorted-list gnus-newsgroup-marked article
)))
10815 ((= mark gnus-spam-mark
)
10816 (setq gnus-newsgroup-spam-marked
10817 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10819 ((= mark gnus-dormant-mark
)
10820 (setq gnus-newsgroup-dormant
10821 (gnus-add-to-sorted-list gnus-newsgroup-dormant article
)))
10823 (setq gnus-newsgroup-unreads
10824 (gnus-add-to-sorted-list gnus-newsgroup-unreads article
))))
10825 (gnus-pull article gnus-newsgroup-reads
)
10828 (defalias 'gnus-summary-mark-as-unread-forward
10829 'gnus-summary-tick-article-forward
)
10830 (make-obsolete 'gnus-summary-mark-as-unread-forward
10831 'gnus-summary-tick-article-forward
"Emacs 20.4")
10832 (defun gnus-summary-tick-article-forward (n)
10833 "Tick N articles forwards.
10834 If N is negative, tick backwards instead.
10835 The difference between N and the number of articles ticked is returned."
10837 (gnus-summary-mark-forward n gnus-ticked-mark
))
10839 (defalias 'gnus-summary-mark-as-unread-backward
10840 'gnus-summary-tick-article-backward
)
10841 (make-obsolete 'gnus-summary-mark-as-unread-backward
10842 'gnus-summary-tick-article-backward
"Emacs 20.4")
10843 (defun gnus-summary-tick-article-backward (n)
10844 "Tick N articles backwards.
10845 The difference between N and the number of articles ticked is returned."
10847 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
10849 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10850 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
"Emacs 20.4")
10851 (defun gnus-summary-tick-article (&optional article clear-mark
)
10852 "Mark current article as unread.
10853 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10854 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10856 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
10857 gnus-ticked-mark
)))
10859 (defun gnus-summary-mark-as-read-forward (n)
10860 "Mark N articles as read forwards.
10861 If N is negative, mark backwards instead.
10862 The difference between N and the actual number of articles marked is
10865 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
10867 (defun gnus-summary-mark-as-read-backward (n)
10868 "Mark the N articles as read backwards.
10869 The difference between N and the actual number of articles marked is
10872 (gnus-summary-mark-forward
10873 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
10875 (defun gnus-summary-mark-as-read (&optional article mark
)
10876 "Mark current article as read.
10877 ARTICLE specifies the article to be marked as read.
10878 MARK specifies a string to be inserted at the beginning of the line."
10879 (gnus-summary-mark-article article mark
))
10881 (defun gnus-summary-clear-mark-forward (n)
10882 "Clear marks from N articles forward.
10883 If N is negative, clear backward instead.
10884 The difference between N and the number of marks cleared is returned."
10886 (gnus-summary-mark-forward n gnus-unread-mark
))
10888 (defun gnus-summary-clear-mark-backward (n)
10889 "Clear marks from N articles backward.
10890 The difference between N and the number of marks cleared is returned."
10892 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
10894 (defun gnus-summary-mark-unread-as-read ()
10895 "Intended to be used by `gnus-mark-article-hook'."
10896 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10897 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
10899 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark
)
10900 "Intended to be used by `gnus-mark-article-hook'."
10901 (let ((mark (gnus-summary-article-mark)))
10902 (when (or (gnus-unread-mark-p mark
)
10903 (gnus-read-mark-p mark
))
10904 (gnus-summary-mark-article gnus-current-article
10905 (or new-mark gnus-read-mark
)))))
10907 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark
)
10908 "Intended to be used by `gnus-mark-article-hook'."
10909 (let ((mark (gnus-summary-article-mark)))
10910 (when (or (gnus-unread-mark-p mark
)
10911 (gnus-read-mark-p mark
))
10912 (gnus-summary-mark-article (gnus-summary-article-number)
10913 (or new-mark gnus-read-mark
)))))
10915 (defun gnus-summary-mark-unread-as-ticked ()
10916 "Intended to be used by `gnus-mark-article-hook'."
10917 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10918 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark
)))
10920 (defun gnus-summary-mark-region-as-read (point mark all
)
10921 "Mark all unread articles between point and mark as read.
10922 If given a prefix, mark all articles between point and mark as read,
10923 even ticked and dormant ones."
10924 (interactive "r\nP")
10928 (beginning-of-line)
10933 (memq (setq article
(gnus-summary-article-number))
10934 gnus-newsgroup-unreads
))
10935 (gnus-summary-mark-article article gnus-del-mark
))
10937 (gnus-summary-find-next))))))
10939 (defun gnus-summary-mark-below (score mark
)
10940 "Mark articles with score less than SCORE with MARK."
10941 (interactive "P\ncMark: ")
10942 (setq score
(if score
10943 (prefix-numeric-value score
)
10944 (or gnus-summary-default-score
0)))
10945 (with-current-buffer gnus-summary-buffer
10946 (goto-char (point-min))
10949 (and (< (gnus-summary-article-score) score
)
10950 (gnus-summary-mark-article nil mark
))
10951 (gnus-summary-find-next)))))
10953 (defun gnus-summary-kill-below (&optional score
)
10954 "Mark articles with score below SCORE as read."
10956 (gnus-summary-mark-below score gnus-killed-mark
))
10958 (defun gnus-summary-clear-above (&optional score
)
10959 "Clear all marks from articles with score above SCORE."
10961 (gnus-summary-mark-above score gnus-unread-mark
))
10963 (defun gnus-summary-tick-above (&optional score
)
10964 "Tick all articles with score above SCORE."
10966 (gnus-summary-mark-above score gnus-ticked-mark
))
10968 (defun gnus-summary-mark-above (score mark
)
10969 "Mark articles with score over SCORE with MARK."
10970 (interactive "P\ncMark: ")
10971 (setq score
(if score
10972 (prefix-numeric-value score
)
10973 (or gnus-summary-default-score
0)))
10974 (with-current-buffer gnus-summary-buffer
10975 (goto-char (point-min))
10977 (when (> (gnus-summary-article-score) score
)
10978 (gnus-summary-mark-article nil mark
))
10980 (gnus-summary-find-next)))))
10982 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10983 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
10984 (defun gnus-summary-limit-include-expunged (&optional no-error
)
10985 "Display all the hidden articles that were expunged for low scores."
10987 (let ((inhibit-read-only t
))
10988 (let ((scored gnus-newsgroup-scored
)
10991 (unless (gnus-summary-article-header (caar scored
))
10992 (and (setq h
(gnus-number-to-header (caar scored
)))
10993 (< (cdar scored
) gnus-summary-expunge-below
)
10995 (setq scored
(cdr scored
)))
10997 (when (not no-error
)
10998 (error "No expunged articles hidden"))
10999 (goto-char (point-min))
11000 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
11001 (setq gnus-newsgroup-limit
(copy-sequence gnus-newsgroup-limit
))
11002 (dolist (x headers
)
11003 (push (mail-header-number x
) gnus-newsgroup-limit
))
11004 (gnus-summary-prepare-unthreaded (nreverse headers
))
11005 (goto-char (point-min))
11006 (gnus-summary-position-point)
11009 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse
)
11010 "Mark all unread articles in this newsgroup as read.
11011 If prefix argument ALL is non-nil, ticked and dormant articles will
11012 also be marked as read.
11013 If QUIETLY is non-nil, no questions will be asked.
11015 If TO-HERE is non-nil, it should be a point in the buffer. All
11016 articles before (after, if REVERSE is set) this point will be marked
11019 Note that this function will only catch up the unread article
11020 in the current summary buffer limitation.
11022 The number of articles marked as read is returned."
11027 (not gnus-interactive-catchup
) ;Without confirmation?
11031 "Mark absolutely all articles as read? "
11032 "Mark all unread articles as read? ")))
11034 (not gnus-newsgroup-adaptive
)
11035 (not gnus-newsgroup-auto-expire
)
11036 (not gnus-suppress-duplicates
)
11037 (or (not gnus-use-cache
)
11038 (eq gnus-use-cache
'passive
)))
11041 (setq gnus-newsgroup-marked nil
11042 gnus-newsgroup-spam-marked nil
11043 gnus-newsgroup-dormant nil
))
11044 (setq gnus-newsgroup-unreads
11045 (gnus-sorted-nunion
11046 (gnus-sorted-intersection gnus-newsgroup-unreads
11047 gnus-newsgroup-downloadable
)
11048 (gnus-sorted-difference gnus-newsgroup-unfetched
11049 gnus-newsgroup-cached
))))
11050 ;; We actually mark all articles as canceled, which we
11051 ;; have to do when using auto-expiry or adaptive scoring.
11052 (gnus-summary-show-all-threads)
11053 (if (and to-here reverse
)
11055 (goto-char to-here
)
11056 (gnus-summary-mark-current-read-and-unread-as-read
11058 (while (gnus-summary-find-next (not all
))
11059 (gnus-summary-mark-article-as-read gnus-catchup-mark
)))
11060 (when (gnus-summary-first-subject (not all
))
11062 (if to-here
(< (point) to-here
) t
)
11063 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
11064 (gnus-summary-find-next (not all
))))))
11065 (gnus-set-mode-line 'summary
))
11067 (gnus-summary-position-point)))
11069 (defun gnus-summary-catchup-to-here (&optional all
)
11070 "Mark all unticked articles before the current one as read.
11071 If ALL is non-nil, also mark ticked and dormant articles as read."
11074 (gnus-save-hidden-threads
11075 (let ((beg (point)))
11076 ;; We check that there are unread articles.
11077 (when (or all
(gnus-summary-find-prev))
11078 (gnus-summary-catchup all t beg
)))))
11079 (gnus-summary-position-point))
11081 (defun gnus-summary-catchup-from-here (&optional all
)
11082 "Mark all unticked articles after (and including) the current one as read.
11083 If ALL is non-nil, also mark ticked and dormant articles as read."
11086 (gnus-save-hidden-threads
11087 (let ((beg (point)))
11088 ;; We check that there are unread articles.
11089 (when (or all
(gnus-summary-find-next))
11090 (gnus-summary-catchup all t beg nil t
)))))
11091 (gnus-summary-position-point))
11093 (defun gnus-summary-catchup-all (&optional quietly
)
11094 "Mark all articles in this newsgroup as read.
11095 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11096 instead, which marks only unread articles as read."
11098 (gnus-summary-catchup t quietly
))
11100 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
11101 "Mark all unread articles in this group as read, then exit.
11102 If prefix argument ALL is non-nil, all articles are marked as read.
11103 If QUIETLY is non-nil, no questions will be asked."
11105 (when (gnus-summary-catchup all quietly nil
'fast
)
11106 ;; Select next newsgroup or exit.
11107 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
11108 (eq gnus-auto-select-next
'quietly
))
11109 (gnus-summary-next-group nil
)
11110 (gnus-summary-exit))))
11112 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
11113 "Mark all articles in this newsgroup as read, and then exit.
11114 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11115 instead, which marks only unread articles as read."
11117 (gnus-summary-catchup-and-exit t quietly
))
11119 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
11120 "Mark all articles in this group as read and select the next group.
11121 If given a prefix, mark all articles, unread as well as ticked, as
11125 (gnus-summary-catchup all
))
11126 (gnus-summary-next-group))
11128 (defun gnus-summary-catchup-and-goto-prev-group (&optional all
)
11129 "Mark all articles in this group as read and select the previous group.
11130 If given a prefix, mark all articles, unread as well as ticked, as
11134 (gnus-summary-catchup all
))
11135 (gnus-summary-next-group nil nil t
))
11141 (defmacro gnus-with-article
(article &rest forms
)
11142 "Select ARTICLE and perform FORMS in the original article buffer.
11143 Then replace the article with the result."
11145 ;; We don't want the article to be marked as read.
11146 (let (gnus-mark-article-hook)
11147 (gnus-summary-select-article t t nil
,article
))
11148 (set-buffer gnus-original-article-buffer
)
11150 (if (not (gnus-check-backend-function
11151 'request-replace-article
(car gnus-article-current
)))
11152 (gnus-message 5 "Read-only group; not replacing")
11153 (unless (gnus-request-replace-article
11154 ,article
(car gnus-article-current
)
11155 (current-buffer) t
)
11156 (error "Couldn't replace article")))
11157 ;; The cache and backlog have to be flushed somewhat.
11158 (when gnus-keep-backlog
11159 (gnus-backlog-remove-article
11160 (car gnus-article-current
) (cdr gnus-article-current
)))
11161 (when gnus-use-cache
11162 (gnus-cache-update-article
11163 (car gnus-article-current
) (cdr gnus-article-current
)))))
11165 (put 'gnus-with-article
'lisp-indent-function
1)
11166 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
11168 ;; Thread-based commands.
11170 (defun gnus-summary-articles-in-thread (&optional article
)
11171 "Return a list of all articles in the current thread.
11172 If ARTICLE is non-nil, return all articles in the thread that starts
11173 with that article."
11174 (let* ((article (or article
(gnus-summary-article-number)))
11175 (data (gnus-data-find-list article
))
11176 (top-level (gnus-data-level (car data
)))
11178 (cond ((null gnus-thread-operation-ignore-subject
)
11179 (gnus-simplify-subject-re
11180 (mail-header-subject (gnus-data-header (car data
)))))
11181 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
11182 (gnus-simplify-subject-fuzzy
11183 (mail-header-subject (gnus-data-header (car data
)))))
11185 (end-point (save-excursion
11186 (if (gnus-summary-go-to-next-thread)
11187 (point) (point-max))))
11190 (< (gnus-data-pos (car data
)) end-point
))
11191 (when (or (not top-subject
)
11192 (string= top-subject
11193 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
11194 (gnus-simplify-subject-fuzzy
11195 (mail-header-subject
11196 (gnus-data-header (car data
))))
11197 (gnus-simplify-subject-re
11198 (mail-header-subject
11199 (gnus-data-header (car data
)))))))
11200 (push (gnus-data-number (car data
)) articles
))
11201 (unless (and (setq data
(cdr data
))
11202 (> (gnus-data-level (car data
)) top-level
))
11204 ;; Return the list of articles.
11205 (nreverse articles
)))
11207 (defun gnus-summary-rethread-current ()
11208 "Rethread the thread the current article is part of."
11210 (let* ((gnus-show-threads t
)
11211 (article (gnus-summary-article-number))
11212 (id (mail-header-id (gnus-summary-article-header)))
11213 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
11215 (error "No article on the current line"))
11216 (gnus-rebuild-thread id
)
11217 (gnus-summary-goto-subject article
)))
11219 (defun gnus-summary-reparent-thread ()
11220 "Make the current article child of the marked (or previous) article.
11222 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11223 is non-nil or the Subject: of both articles are the same."
11225 (unless (not (gnus-group-read-only-p))
11226 (error "The current newsgroup does not support article editing"))
11227 (unless (<= (length gnus-newsgroup-processable
) 1)
11228 (error "No more than one article may be marked"))
11229 (let ((child (gnus-summary-article-number))
11230 ;; First grab the marked article, otherwise one line up.
11231 (parent (if (not (null gnus-newsgroup-processable
))
11232 (car gnus-newsgroup-processable
)
11234 (if (eq (forward-line -
1) 0)
11235 (gnus-summary-article-number)
11236 (error "Beginning of summary buffer"))))))
11237 (gnus-summary-reparent-children parent
(list child
))))
11239 (defun gnus-summary-reparent-children (parent children
)
11240 "Make PARENT the parent of CHILDREN.
11241 When called interactively, PARENT is the current article and CHILDREN
11242 are the process-marked articles."
11244 (list (gnus-summary-article-number)
11245 (gnus-summary-work-articles nil
)))
11246 (dolist (child children
)
11247 (save-window-excursion
11248 (let ((gnus-article-buffer " *reparent*"))
11249 (unless (not (eq parent child
))
11250 (error "An article may not be self-referential"))
11251 (let ((message-id (mail-header-id
11252 (gnus-summary-article-header parent
))))
11253 (unless (and message-id
(not (equal message-id
"")))
11254 (error "No message-id in desired parent"))
11255 (gnus-with-article child
11257 (goto-char (point-min))
11258 (message-narrow-to-head)
11259 (if (re-search-forward "^References: " nil t
)
11261 (re-search-forward "^[^ \t]" nil t
)
11264 (insert " " message-id
))
11265 (insert "References: " message-id
"\n"))))
11266 (set-buffer gnus-summary-buffer
)
11267 (gnus-summary-unmark-all-processable)
11268 (gnus-summary-update-article child
)
11269 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
11270 (gnus-summary-update-secondary-mark (cdr gnus-article-current
)))
11271 (gnus-summary-rethread-current)
11272 (gnus-message 3 "Article %d is now the child of article %d"
11275 (defun gnus-summary-toggle-threads (&optional arg
)
11276 "Toggle showing conversation threads.
11277 If ARG is positive number, turn showing conversation threads on."
11279 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
11280 (setq gnus-show-threads
11281 (if (null arg
) (not gnus-show-threads
)
11282 (> (prefix-numeric-value arg
) 0)))
11283 (gnus-summary-prepare)
11284 (gnus-summary-goto-subject current
)
11285 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
11286 (gnus-summary-position-point)))
11289 (if (fboundp 'remove-overlays
)
11290 (defalias 'gnus-remove-overlays
'remove-overlays
)
11291 (defun gnus-remove-overlays (beg end name val
)
11292 "Clear BEG and END of overlays whose property NAME has value VAL.
11293 For compatibility with Emacs 21 and XEmacs."
11294 (dolist (ov (gnus-overlays-in beg end
))
11295 (when (eq (gnus-overlay-get ov name
) val
)
11296 (gnus-delete-overlay ov
))))))
11298 (defun gnus-summary-show-all-threads ()
11299 "Show all threads."
11301 (gnus-remove-overlays (point-min) (point-max) 'invisible
'gnus-sum
)
11302 (gnus-summary-position-point))
11304 (defun gnus-summary-show-thread ()
11305 "Show thread subtrees.
11306 Returns nil if no thread was there to be shown."
11308 (let* ((orig (point))
11309 (end (point-at-eol))
11310 ;; Leave point at bol
11311 (beg (progn (beginning-of-line) (if (bobp) (point) (1- (point)))))
11312 (eoi (when (eq (get-char-property end
'invisible
) 'gnus-sum
)
11313 (if (fboundp 'next-single-char-property-change
)
11314 (or (next-single-char-property-change end
'invisible
)
11319 (eq (get-char-property (point) 'invisible
)
11323 (gnus-remove-overlays beg eoi
'invisible
'gnus-sum
)
11325 (gnus-summary-position-point)
11328 (defun gnus-summary-maybe-hide-threads ()
11329 "If requested, hide the threads that should be hidden."
11330 (when (and gnus-show-threads
11331 gnus-thread-hide-subtree
)
11332 (gnus-summary-hide-all-threads
11333 (if (or (consp gnus-thread-hide-subtree
)
11334 (functionp gnus-thread-hide-subtree
))
11335 (gnus-make-predicate gnus-thread-hide-subtree
)
11338 ;;; Hiding predicates.
11340 (defun gnus-article-unread-p (header)
11341 (memq (mail-header-number header
) gnus-newsgroup-unreads
))
11343 (defun gnus-article-unseen-p (header)
11344 (memq (mail-header-number header
) gnus-newsgroup-unseen
))
11346 (defun gnus-map-articles (predicate articles
)
11347 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11348 (apply 'gnus-or
(mapcar predicate
11349 (mapcar (lambda (number)
11350 (gnus-summary-article-header number
))
11353 (defun gnus-summary-hide-all-threads (&optional predicate
)
11354 "Hide all thread subtrees.
11355 If PREDICATE is supplied, threads that satisfy this predicate
11356 will not be hidden."
11359 (goto-char (point-min))
11362 (when (or (not predicate
)
11364 predicate
(gnus-summary-article-children)))
11365 (gnus-summary-hide-thread))
11366 (setq end
(not (zerop (gnus-summary-next-thread 1 t
)))))))
11367 (gnus-summary-position-point))
11369 (defun gnus-summary-hide-thread ()
11370 "Hide thread subtrees.
11371 If PREDICATE is supplied, threads that satisfy this predicate
11372 will not be hidden.
11373 Returns nil if no threads were there to be hidden."
11375 (let ((start (point))
11376 (starteol (line-end-position))
11377 (article (gnus-summary-article-number)))
11379 ;; Go forward until either the buffer ends or the subthread ends.
11380 (when (and (not (eobp))
11381 (or (zerop (gnus-summary-next-thread 1 t
))
11382 (goto-char (point-max))))
11383 (if (and (> (point) start
)
11384 ;; FIXME: this should actually search for a non-invisible \n.
11385 (search-backward "\n" start t
))
11387 (when (> (point) starteol
)
11388 (gnus-remove-overlays starteol
(point) 'invisible
'gnus-sum
)
11389 (let ((ol (gnus-make-overlay starteol
(point) nil t nil
)))
11390 (gnus-overlay-put ol
'invisible
'gnus-sum
)
11391 (gnus-overlay-put ol
'evaporate t
)))
11392 (gnus-summary-goto-subject article
))
11396 (defun gnus-summary-go-to-next-thread (&optional previous
)
11397 "Go to the same level (or less) next thread.
11398 If PREVIOUS is non-nil, go to previous thread instead.
11399 Return the article number moved to, or nil if moving was impossible."
11400 (let ((level (gnus-summary-thread-level))
11401 (way (if previous -
1 1))
11404 (while (and (not (eobp))
11405 (< level
(gnus-summary-thread-level)))
11406 (forward-line way
))
11413 (gnus-summary-article-number)
11414 (goto-char beg
)))))
11416 (defun gnus-summary-next-thread (n &optional silent
)
11417 "Go to the same level next N'th thread.
11418 If N is negative, search backward instead.
11419 Returns the difference between N and the number of skips actually
11422 If SILENT, don't output messages."
11424 (let ((backward (< n
0))
11426 (while (and (> n
0)
11427 (gnus-summary-go-to-next-thread backward
))
11430 (gnus-summary-position-point))
11431 (when (and (not silent
) (/= 0 n
))
11432 (gnus-message 7 "No more threads"))
11435 (defun gnus-summary-prev-thread (n)
11436 "Go to the same level previous N'th thread.
11437 Returns the difference between N and the number of skips actually
11440 (gnus-summary-next-thread (- n
)))
11442 (defun gnus-summary-go-down-thread ()
11443 "Go down one level in the current thread."
11444 (let ((children (gnus-summary-article-children)))
11446 (gnus-summary-goto-subject (car children
)))))
11448 (defun gnus-summary-go-up-thread ()
11449 "Go up one level in the current thread."
11450 (let ((parent (gnus-summary-article-parent)))
11452 (gnus-summary-goto-subject parent
))))
11454 (defun gnus-summary-down-thread (n)
11455 "Go down thread N steps.
11456 If N is negative, go up instead.
11457 Returns the difference between N and how many steps down that were
11462 (while (and (> n
0)
11463 (if up
(gnus-summary-go-up-thread)
11464 (gnus-summary-go-down-thread)))
11466 (gnus-summary-position-point)
11468 (gnus-message 7 "Can't go further"))
11471 (defun gnus-summary-up-thread (n)
11472 "Go up thread N steps.
11473 If N is negative, go down instead.
11474 Returns the difference between N and how many steps down that were
11477 (gnus-summary-down-thread (- n
)))
11479 (defun gnus-summary-top-thread ()
11480 "Go to the top of the thread."
11482 (while (gnus-summary-go-up-thread))
11483 (gnus-summary-article-number))
11485 (defun gnus-summary-expire-thread ()
11486 "Mark articles under current thread as expired."
11488 (gnus-summary-kill-thread 0))
11490 (defun gnus-summary-kill-thread (&optional unmark
)
11491 "Mark articles under current thread as read.
11492 If the prefix argument is positive, remove any kinds of marks.
11493 If the prefix argument is zero, mark thread as expired.
11494 If the prefix argument is negative, tick articles instead."
11497 (setq unmark
(prefix-numeric-value unmark
)))
11498 (let ((articles (gnus-summary-articles-in-thread))
11499 (hide (or (null unmark
) (= unmark
0))))
11501 ;; Expand the thread.
11502 (gnus-summary-show-thread)
11503 ;; Mark all the articles.
11505 (gnus-summary-goto-subject (car articles
))
11506 (cond ((null unmark
)
11507 (gnus-summary-mark-article-as-read gnus-killed-mark
))
11509 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
11511 (gnus-summary-mark-article nil gnus-expirable-mark
))
11513 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
11514 (setq articles
(cdr articles
))))
11515 ;; Hide killed subtrees when hide is true.
11517 gnus-thread-hide-killed
11518 (gnus-summary-hide-thread))
11519 ;; If hide is t, go to next unread subject.
11521 ;; Go to next unread subject.
11522 (gnus-summary-next-subject 1 t
)))
11523 (gnus-set-mode-line 'summary
))
11525 ;; Summary sorting commands
11527 (defun gnus-summary-sort-by-number (&optional reverse
)
11528 "Sort the summary buffer by article number.
11529 Argument REVERSE means reverse order."
11531 (gnus-summary-sort 'number reverse
))
11533 (defun gnus-summary-sort-by-most-recent-number (&optional reverse
)
11534 "Sort the summary buffer by most recent article number.
11535 Argument REVERSE means reverse order."
11537 (gnus-summary-sort 'most-recent-number reverse
))
11539 (defun gnus-summary-sort-by-random (&optional reverse
)
11540 "Randomize the order in the summary buffer.
11541 Argument REVERSE means to randomize in reverse order."
11543 (gnus-summary-sort 'random reverse
))
11545 (defun gnus-summary-sort-by-author (&optional reverse
)
11546 "Sort the summary buffer by author name alphabetically.
11547 If `case-fold-search' is non-nil, case of letters is ignored.
11548 Argument REVERSE means reverse order."
11550 (gnus-summary-sort 'author reverse
))
11552 (defun gnus-summary-sort-by-recipient (&optional reverse
)
11553 "Sort the summary buffer by recipient name alphabetically.
11554 If `case-fold-search' is non-nil, case of letters is ignored.
11555 Argument REVERSE means reverse order."
11557 (gnus-summary-sort 'recipient reverse
))
11559 (defun gnus-summary-sort-by-subject (&optional reverse
)
11560 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11561 If `case-fold-search' is non-nil, case of letters is ignored.
11562 Argument REVERSE means reverse order."
11564 (gnus-summary-sort 'subject reverse
))
11566 (defun gnus-summary-sort-by-date (&optional reverse
)
11567 "Sort the summary buffer by date.
11568 Argument REVERSE means reverse order."
11570 (gnus-summary-sort 'date reverse
))
11572 (defun gnus-summary-sort-by-most-recent-date (&optional reverse
)
11573 "Sort the summary buffer by most recent date.
11574 Argument REVERSE means reverse order."
11576 (gnus-summary-sort 'most-recent-date reverse
))
11578 (defun gnus-summary-sort-by-score (&optional reverse
)
11579 "Sort the summary buffer by score.
11580 Argument REVERSE means reverse order."
11582 (gnus-summary-sort 'score reverse
))
11584 (defun gnus-summary-sort-by-lines (&optional reverse
)
11585 "Sort the summary buffer by the number of lines.
11586 Argument REVERSE means reverse order."
11588 (gnus-summary-sort 'lines reverse
))
11590 (defun gnus-summary-sort-by-chars (&optional reverse
)
11591 "Sort the summary buffer by article length.
11592 Argument REVERSE means reverse order."
11594 (gnus-summary-sort 'chars reverse
))
11596 (defun gnus-summary-sort-by-original (&optional reverse
)
11597 "Sort the summary buffer using the default sorting method.
11598 Argument REVERSE means reverse order."
11600 (let* ((inhibit-read-only t
)
11601 (gnus-summary-prepare-hook nil
))
11602 ;; We do the sorting by regenerating the threads.
11603 (gnus-summary-prepare)
11604 ;; Hide subthreads if needed.
11605 (gnus-summary-maybe-hide-threads)))
11607 (defun gnus-summary-sort (predicate reverse
)
11608 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11609 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
11610 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
11611 (gnus-thread-sort-functions
11616 (gnus-sort-gathered-threads-function
11617 gnus-thread-sort-functions
)
11618 (gnus-article-sort-functions
11622 (,article t2 t1
))))
11623 (inhibit-read-only t
)
11624 (gnus-summary-prepare-hook nil
))
11625 ;; We do the sorting by regenerating the threads.
11626 (gnus-summary-prepare)
11627 ;; Hide subthreads if needed.
11628 (gnus-summary-maybe-hide-threads)))
11630 ;; Summary saving commands.
11632 (defun gnus-summary-save-article (&optional n not-saved
)
11633 "Save the current article using the default saver function.
11634 If N is a positive number, save the N next articles.
11635 If N is a negative number, save the N previous articles.
11636 If N is nil and any articles have been marked with the process mark,
11637 save those articles instead.
11638 The variable `gnus-default-article-saver' specifies the saver function.
11640 If the optional second argument NOT-SAVED is non-nil, articles saved
11641 will not be marked as saved."
11643 (require 'gnus-art
)
11644 (let* ((articles (gnus-summary-work-articles n
))
11645 (save-buffer (save-excursion
11646 (nnheader-set-temp-buffer " *Gnus Save*")))
11647 (num (length articles
))
11648 ;; Whether to save decoded articles or raw articles.
11649 (decode (when gnus-article-save-coding-system
11650 (get gnus-default-article-saver
:decode
)))
11651 ;; When saving many articles in a single file, use the other
11652 ;; function to save articles other than the first one.
11653 (saver2 (get gnus-default-article-saver
:function
))
11654 (gnus-prompt-before-saving (if saver2
11656 gnus-prompt-before-saving
))
11657 (gnus-default-article-saver gnus-default-article-saver
)
11659 (dolist (article articles
)
11660 (setq header
(gnus-summary-article-header article
))
11661 (if (not (vectorp header
))
11662 ;; This is a pseudo-article.
11663 (if (assq 'name header
)
11664 (gnus-copy-file (cdr (assq 'name header
)))
11665 (gnus-message 1 "Article %d is unsaveable" article
))
11666 ;; This is a real article.
11667 (save-window-excursion
11668 (gnus-summary-select-article decode decode nil article
)
11669 (gnus-summary-goto-subject article
))
11670 (with-current-buffer save-buffer
11672 (insert-buffer-substring (if decode
11673 gnus-article-buffer
11674 gnus-original-article-buffer
)))
11675 (setq file
(gnus-article-save save-buffer file num
))
11676 (gnus-summary-remove-process-mark article
)
11678 (gnus-summary-set-saved-mark article
)))
11680 (setq gnus-default-article-saver saver2
11682 (gnus-kill-buffer save-buffer
)
11683 (gnus-summary-position-point)
11684 (gnus-set-mode-line 'summary
)
11687 (defun gnus-summary-pipe-output (&optional n sym
)
11688 "Pipe the current article to a subprocess.
11689 If N is a positive number, pipe the N next articles.
11690 If N is a negative number, pipe the N previous articles.
11691 If N is nil and any articles have been marked with the process mark,
11692 pipe those articles instead.
11693 The default command to which articles are piped is specified by the
11694 variable `gnus-summary-pipe-output-default-command'; if it is nil, you
11695 will be prompted for the command.
11697 The properties `:decode' and `:headers' that are put to the function
11698 symbol `gnus-summary-save-in-pipe' control whether this function
11699 decodes articles and what headers to keep (see the doc string for the
11700 `gnus-default-article-saver' variable). If SYM (the symbolic prefix)
11701 is neither omitted nor the symbol `r', force including all headers
11702 regardless of the `:headers' property. If it is the symbol `r',
11703 articles that are not decoded and include all headers will be piped
11704 no matter what the properties `:decode' and `:headers' are."
11705 (interactive (gnus-interactive "P\ny"))
11706 (require 'gnus-art
)
11707 (let* ((articles (gnus-summary-work-articles n
))
11708 (result-buffer "*Shell Command Output*")
11709 (all-headers (not (memq sym
'(nil r
))))
11710 (gnus-save-all-headers (or all-headers gnus-save-all-headers
))
11712 (headers (get 'gnus-summary-save-in-pipe
:headers
))
11714 (unless (numberp (car articles
))
11715 (error "No article to pipe"))
11716 (setq command
(gnus-read-shell-command
11717 (concat "Shell command on "
11719 (format "these %d articles" (length articles
))
11722 gnus-summary-pipe-output-default-command
))
11723 (when (string-equal command
"")
11724 (error "A command is required"))
11726 (put 'gnus-summary-save-in-pipe
:headers nil
))
11729 (gnus-summary-goto-subject (pop articles
))
11730 (save-window-excursion (gnus-summary-save-in-pipe command raw
))
11731 (when (and (get-buffer result-buffer
)
11732 (not (zerop (buffer-size (get-buffer result-buffer
)))))
11733 (setq result
(concat result
(with-current-buffer result-buffer
11734 (buffer-string))))))
11735 (put 'gnus-summary-save-in-pipe
:headers headers
))
11736 (unless (zerop (length result
))
11737 (if (with-current-buffer (get-buffer-create result-buffer
)
11741 (and (= (count-lines (point-min) (point)) 1)
11744 (<= (current-column)
11745 (window-width (minibuffer-window)))))
11746 (goto-char (point-min))))
11747 (message "%s" (substring result
0 -
1))
11749 (gnus-configure-windows 'pipe
)))))
11751 (defun gnus-summary-save-article-mail (&optional arg
)
11752 "Append the current article to a Unix mail box file.
11753 If N is a positive number, save the N next articles.
11754 If N is a negative number, save the N previous articles.
11755 If N is nil and any articles have been marked with the process mark,
11756 save those articles instead."
11758 (require 'gnus-art
)
11759 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
11760 (gnus-summary-save-article arg
)))
11762 (defun gnus-summary-save-article-rmail (&optional arg
)
11763 "Append the current article to an rmail file.
11764 If N is a positive number, save the N next articles.
11765 If N is a negative number, save the N previous articles.
11766 If N is nil and any articles have been marked with the process mark,
11767 save those articles instead."
11769 (require 'gnus-art
)
11770 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
11771 (gnus-summary-save-article arg
)))
11773 (defun gnus-summary-save-article-file (&optional arg
)
11774 "Append the current article to a file.
11775 If N is a positive number, save the N next articles.
11776 If N is a negative number, save the N previous articles.
11777 If N is nil and any articles have been marked with the process mark,
11778 save those articles instead."
11780 (require 'gnus-art
)
11781 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
11782 (gnus-summary-save-article arg
)))
11784 (defun gnus-summary-write-article-file (&optional arg
)
11785 "Write the current article to a file, deleting the previous file.
11786 If N is a positive number, save the N next articles.
11787 If N is a negative number, save the N previous articles.
11788 If N is nil and any articles have been marked with the process mark,
11789 save those articles instead."
11791 (require 'gnus-art
)
11792 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
11793 (gnus-summary-save-article arg
)))
11795 (defun gnus-summary-save-article-body-file (&optional arg
)
11796 "Append the current article body to a file.
11797 If N is a positive number, save the N next articles.
11798 If N is a negative number, save the N previous articles.
11799 If N is nil and any articles have been marked with the process mark,
11800 save those articles instead."
11802 (require 'gnus-art
)
11803 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
11804 (gnus-summary-save-article arg
)))
11806 (defun gnus-summary-write-article-body-file (&optional arg
)
11807 "Write the current article body to a file, deleting the previous file.
11808 If N is a positive number, save the N next articles.
11809 If N is a negative number, save the N previous articles.
11810 If N is nil and any articles have been marked with the process mark,
11811 save those articles instead."
11813 (require 'gnus-art
)
11814 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file
))
11815 (gnus-summary-save-article arg
)))
11817 (defun gnus-summary-muttprint (&optional arg
)
11818 "Print the current article using Muttprint.
11819 If N is a positive number, save the N next articles.
11820 If N is a negative number, save the N previous articles.
11821 If N is nil and any articles have been marked with the process mark,
11822 save those articles instead."
11824 (require 'gnus-art
)
11825 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint
))
11826 (gnus-summary-save-article arg t
)))
11828 (defun gnus-summary-pipe-message (program)
11829 "Pipe the current article through PROGRAM."
11830 (interactive "sProgram: ")
11831 (gnus-summary-select-article)
11832 (let ((mail-header-separator ""))
11833 (gnus-eval-in-buffer-window gnus-article-buffer
11836 (let ((start (window-start))
11837 (inhibit-read-only t
))
11838 (message-pipe-buffer-body program
)
11839 (set-window-start (get-buffer-window (current-buffer)) start
))))))
11841 (defun gnus-get-split-value (methods)
11842 "Return a value based on the split METHODS."
11843 (let (split-name method result match
)
11845 (with-current-buffer gnus-original-article-buffer
11847 (nnheader-narrow-to-headers)
11848 (while (and methods
(not split-name
))
11849 (goto-char (point-min))
11850 (setq method
(pop methods
))
11851 (setq match
(car method
))
11854 ;; Regular expression.
11856 (re-search-forward match nil t
)))
11861 (setq result
(funcall match gnus-newsgroup-name
))))
11866 (setq result
(eval match
)))))
11867 (setq split-name
(cdr method
))
11868 (cond ((stringp result
)
11869 (push (expand-file-name
11870 result gnus-article-save-directory
)
11873 (setq split-name
(append result split-name
)))))))))
11874 (nreverse split-name
)))
11876 (defun gnus-valid-move-group-p (group)
11877 (and (boundp group
)
11878 (symbol-name group
)
11879 (symbol-value group
)
11880 (gnus-get-function (gnus-find-method-for-group
11881 (symbol-name group
)) 'request-accept-article t
)))
11883 (defun gnus-read-move-group-name (prompt default articles prefix
)
11884 "Read a group name."
11885 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
11886 (minibuffer-confirm-incomplete nil
) ; XEmacs
11890 (if (> (length articles
) 1)
11891 (format "these %d articles" (length articles
))
11894 (let (active group
)
11895 (when (or (null split-name
) (= 1 (length split-name
)))
11896 (setq active
(gnus-make-hashtable (length gnus-active-hashtb
)))
11897 (mapatoms (lambda (symbol)
11898 (setq group
(symbol-name symbol
))
11899 (when (string-match "[^\000-\177]" group
)
11900 (setq group
(gnus-group-decoded-name group
)))
11901 (set (intern group active
) group
))
11902 gnus-active-hashtb
))
11905 (gnus-completing-read-with-default
11906 default prom active
'gnus-valid-move-group-p nil prefix
11907 'gnus-group-history
))
11908 ((= 1 (length split-name
))
11909 (gnus-completing-read-with-default
11910 (car split-name
) prom active
'gnus-valid-move-group-p nil nil
11911 'gnus-group-history
))
11913 (gnus-completing-read-with-default
11914 nil prom
(mapcar 'list
(nreverse split-name
)) nil nil nil
11915 'gnus-group-history
)))))
11916 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
)))
11919 (if (or (string= to-newsgroup
"")
11920 (string= to-newsgroup prefix
))
11921 (setq to-newsgroup default
))
11922 (unless to-newsgroup
11923 (error "No group name entered"))
11924 (setq encoded
(mm-encode-coding-string
11926 (gnus-group-name-charset to-method to-newsgroup
)))
11927 (or (gnus-active encoded
)
11928 (gnus-activate-group encoded nil nil to-method
)
11929 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11931 (or (and (gnus-request-create-group encoded to-method
)
11932 (gnus-activate-group encoded nil nil to-method
)
11933 (gnus-subscribe-group encoded
))
11934 (error "Couldn't create group %s" to-newsgroup
)))
11935 (error "No such group: %s" to-newsgroup
))
11938 (defvar gnus-summary-save-parts-counter
)
11939 (declare-function mm-uu-dissect
"mm-uu" (&optional noheader mime-type
))
11941 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
11942 "Save parts matching TYPE to DIR.
11943 If REVERSE, save parts that do not match TYPE."
11945 (list (read-string "Save parts of type: "
11946 (or (car gnus-summary-save-parts-type-history
)
11947 gnus-summary-save-parts-default-mime
)
11948 'gnus-summary-save-parts-type-history
)
11949 (setq gnus-summary-save-parts-last-directory
11950 (read-file-name "Save to directory: "
11951 gnus-summary-save-parts-last-directory
11953 current-prefix-arg
))
11954 (gnus-summary-iterate n
11955 (let ((gnus-display-mime-function nil
)
11956 gnus-article-prepare-hook
11957 gnus-article-decode-hook
11958 gnus-display-mime-function
11960 (gnus-inhibit-treatment t
))
11961 (gnus-summary-select-article))
11962 (with-current-buffer gnus-article-buffer
11963 (let ((handles (or gnus-article-mime-handles
11964 (mm-dissect-buffer nil gnus-article-loose-mime
)
11965 (and gnus-article-emulate-mime
11967 (gnus-summary-save-parts-counter 1))
11969 (gnus-summary-save-parts-1 type dir handles reverse
)
11970 (unless gnus-article-mime-handles
;; Don't destroy this case.
11971 (mm-destroy-parts handles
)))))))
11973 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
11974 (if (stringp (car handle
))
11975 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
11978 (not (string-match type
(mm-handle-media-type handle
)))
11979 (string-match type
(mm-handle-media-type handle
)))
11980 (let ((file (expand-file-name
11982 mm-file-name-rewrite-functions
11983 (file-name-nondirectory
11985 (mail-content-type-get
11986 (mm-handle-disposition handle
) 'filename
)
11987 (mail-content-type-get
11988 (mm-handle-type handle
) 'name
)
11989 (format "%s.%d.%d" gnus-newsgroup-name
11990 (cdr gnus-article-current
)
11991 gnus-summary-save-parts-counter
))))
11993 (incf gnus-summary-save-parts-counter
)
11994 (unless (file-exists-p file
)
11995 (mm-save-part-to-file handle file
))))))
11997 ;; Summary extract commands
11999 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
12000 (let ((inhibit-read-only t
)
12001 (article (gnus-summary-article-number))
12003 (unless (gnus-summary-goto-subject article
)
12004 (error "No such article: %d" article
))
12005 (gnus-summary-position-point)
12006 ;; If all commands are to be bunched up on one line, we collect
12008 (unless gnus-view-pseudos-separately
12009 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
12012 (setq action
(cdr (assq 'action
(car ps
))))
12013 (setq files
(list (cdr (assq 'name
(car ps
)))))
12014 (while (and ps
(cdr ps
)
12015 (string= (or action
"1")
12016 (or (cdr (assq 'action
(cadr ps
))) "2")))
12017 (push (cdr (assq 'name
(cadr ps
))) files
)
12018 (setcdr ps
(cddr ps
)))
12020 (when (not (string-match "%s" action
))
12023 (when (assq 'execute
(car ps
))
12024 (setcdr (assq 'execute
(car ps
))
12025 (funcall (if (string-match "%s" action
)
12032 (shell-quote-argument f
)))
12034 (setq ps
(cdr ps
)))))
12035 (if (and gnus-view-pseudos
(not not-view
))
12037 (when (assq 'execute
(car pslist
))
12038 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
12039 (eq gnus-view-pseudos
'not-confirm
)))
12040 (setq pslist
(cdr pslist
)))
12043 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
12044 (gnus-summary-article-number)))
12045 (gnus-summary-goto-subject after-article
)
12048 (insert " " (file-name-nondirectory
12049 (cdr (assq 'name
(car pslist
))))
12050 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
12052 (forward-line -
1) ; back to `b'
12053 (gnus-add-text-properties
12054 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
12055 gnus-mouse-face-prop gnus-mouse-face
))
12057 after-article gnus-reffed-article-number
12058 gnus-unread-mark b
(car pslist
) 0 (- e b
))
12059 (setq gnus-newsgroup-unreads
12060 (gnus-add-to-sorted-list gnus-newsgroup-unreads
12061 gnus-reffed-article-number
))
12062 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
12063 (setq pslist
(cdr pslist
)))))))
12065 (defun gnus-pseudos< (p1 p2
)
12066 (let ((c1 (cdr (assq 'action p1
)))
12067 (c2 (cdr (assq 'action p2
))))
12068 (and c1 c2
(string< c1 c2
))))
12070 (defun gnus-request-pseudo-article (props)
12071 (cond ((assq 'execute props
)
12072 (gnus-execute-command (cdr (assq 'execute props
)))))
12073 (let ((gnus-current-article (gnus-summary-article-number)))
12074 (gnus-run-hooks 'gnus-mark-article-hook
)))
12076 (defun gnus-execute-command (command &optional automatic
)
12078 (gnus-article-setup-buffer)
12079 (set-buffer gnus-article-buffer
)
12080 (setq buffer-read-only nil
)
12081 (let ((command (if automatic command
12082 (read-string "Command: " (cons command
0)))))
12084 (insert "$ " command
"\n\n")
12085 (if gnus-view-pseudo-asynchronously
12086 (start-process "gnus-execute" (current-buffer) shell-file-name
12087 shell-command-switch command
)
12088 (call-process shell-file-name nil t nil
12089 shell-command-switch command
)))))
12091 ;; Summary kill commands.
12093 (defun gnus-summary-edit-global-kill (article)
12094 "Edit the \"global\" kill file."
12095 (interactive (list (gnus-summary-article-number)))
12096 (gnus-group-edit-global-kill article
))
12098 (defun gnus-summary-edit-local-kill ()
12099 "Edit a local kill file applied to the current newsgroup."
12101 (setq gnus-current-headers
(gnus-summary-article-header))
12102 (gnus-group-edit-local-kill
12103 (gnus-summary-article-number) gnus-newsgroup-name
))
12105 ;;; Header reading.
12107 (defun gnus-read-header (id &optional header
)
12108 "Read the headers of article ID and enter them into the Gnus system."
12109 (let ((group gnus-newsgroup-name
)
12110 (gnus-override-method
12112 gnus-override-method
12113 (and (gnus-news-group-p gnus-newsgroup-name
)
12114 (car (gnus-refer-article-methods)))))
12116 ;; First we check to see whether the header in question is already
12119 ;; This is a Message-ID.
12120 (setq header
(or header
(gnus-id-to-header id
)))
12121 ;; This is an article number.
12122 (setq header
(or header
(gnus-summary-article-header id
))))
12124 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
12125 ;; We have found the header.
12127 ;; We have to really fetch the header to this article.
12128 (with-current-buffer nntp-server-buffer
12129 (when (setq where
(gnus-request-head id group
))
12130 (nnheader-fold-continuation-lines)
12131 (goto-char (point-max))
12133 (goto-char (point-min))
12137 ((cdr where
) (cdr where
))
12138 (header (mail-header-number header
))
12139 (t gnus-reffed-article-number
))
12141 (insert " Article retrieved.\n"))
12142 (if (or (not where
)
12143 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
12144 () ; Malformed head.
12145 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
12146 (when (and (stringp id
)
12148 (not (string= (gnus-group-real-name group
)
12150 (not (gnus-server-equal gnus-override-method
12151 (gnus-group-method group
)))))
12152 ;; If we fetched by Message-ID and the article came from
12153 ;; a different group (or server), we fudge some bogus
12154 ;; article numbers for this article.
12155 (mail-header-set-number header gnus-reffed-article-number
))
12156 (with-current-buffer gnus-summary-buffer
12157 (decf gnus-reffed-article-number
)
12158 (gnus-remove-header (mail-header-number header
))
12159 (push header gnus-newsgroup-headers
)
12160 (setq gnus-current-headers header
)
12161 (push (mail-header-number header
) gnus-newsgroup-limit
)))
12164 (defun gnus-remove-header (number)
12165 "Remove header NUMBER from `gnus-newsgroup-headers'."
12166 (if (and gnus-newsgroup-headers
12167 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
12168 (pop gnus-newsgroup-headers
)
12169 (let ((headers gnus-newsgroup-headers
))
12170 (while (and (cdr headers
)
12171 (not (= number
(mail-header-number (cadr headers
)))))
12173 (when (cdr headers
)
12174 (setcdr headers
(cddr headers
))))))
12177 ;;; summary highlights
12180 (defun gnus-highlight-selected-summary ()
12181 "Highlight selected article in summary buffer."
12182 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12183 (when gnus-summary-selected-face
12185 (let* ((beg (point-at-bol))
12186 (end (point-at-eol))
12187 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12188 (from (if (get-text-property beg gnus-mouse-face-prop
)
12190 (or (next-single-property-change
12191 beg gnus-mouse-face-prop nil end
)
12196 (or (next-single-property-change
12197 from gnus-mouse-face-prop nil end
)
12199 ;; If no mouse-face prop on line we will have to = from = end,
12200 ;; so we highlight the entire line instead.
12201 (when (= (+ to
2) from
)
12204 (if gnus-newsgroup-selected-overlay
12205 ;; Move old overlay.
12207 gnus-newsgroup-selected-overlay from to
(current-buffer))
12208 ;; Create new overlay.
12210 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
12211 'face gnus-summary-selected-face
))))))
12213 (defvar gnus-summary-highlight-line-cached nil
)
12214 (defvar gnus-summary-highlight-line-trigger nil
)
12216 (defun gnus-summary-highlight-line-0 ()
12217 (if (and (eq gnus-summary-highlight-line-trigger
12218 gnus-summary-highlight
)
12219 gnus-summary-highlight-line-cached
)
12220 gnus-summary-highlight-line-cached
12221 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12222 gnus-summary-highlight-line-cached
12223 (let* ((cond (list 'cond
))
12225 (list gnus-summary-highlight
))
12227 (setcdr c
(cons (list (caar list
) (list 'quote
(cdar list
)))
12231 (gnus-byte-compile (list 'lambda nil cond
))))))
12233 (defun gnus-summary-highlight-line ()
12234 "Highlight current line according to `gnus-summary-highlight'."
12235 (let* ((beg (point-at-bol))
12236 (article (or (gnus-summary-article-number) gnus-current-article
))
12237 (score (or (cdr (assq article
12238 gnus-newsgroup-scored
))
12239 gnus-summary-default-score
0))
12240 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
12241 (inhibit-read-only t
)
12242 (default gnus-summary-default-score
)
12243 (default-high gnus-summary-default-high-score
)
12244 (default-low gnus-summary-default-low-score
)
12245 (uncached (and gnus-summary-use-undownloaded-faces
12246 (memq article gnus-newsgroup-undownloaded
)
12247 (not (memq article gnus-newsgroup-cached
)))))
12248 (let ((face (funcall (gnus-summary-highlight-line-0))))
12249 (unless (eq face
(get-text-property beg
'face
))
12250 (gnus-put-text-property-excluding-characters-with-faces
12251 beg
(point-at-eol) 'face
12252 (setq face
(if (boundp face
) (symbol-value face
) face
)))
12253 (when gnus-summary-highlight-line-function
12254 (funcall gnus-summary-highlight-line-function article face
))))))
12256 (defun gnus-update-read-articles (group unread
&optional compute
)
12257 "Update the list of read articles in GROUP.
12258 UNREAD is a sorted list."
12259 (let ((active (or gnus-newsgroup-active
(gnus-active group
)))
12260 (info (gnus-get-info group
))
12263 (if (or (not info
) (not active
))
12264 ;; There is no info on this group if it was, in fact,
12265 ;; killed. Gnus stores no information on killed groups, so
12266 ;; there's nothing to be done.
12267 ;; One could store the information somewhere temporarily,
12268 ;; perhaps... Hmmm...
12270 ;; Remove any negative articles numbers.
12271 (while (and unread
(< (car unread
) 0))
12272 (setq unread
(cdr unread
)))
12273 ;; Remove any expired article numbers
12274 (while (and unread
(< (car unread
) (car active
)))
12275 (setq unread
(cdr unread
)))
12276 ;; Compute the ranges of read articles by looking at the list of
12277 ;; unread articles.
12279 (when (/= (car unread
) prev
)
12280 (push (if (= prev
(1- (car unread
))) prev
12281 (cons prev
(1- (car unread
))))
12283 (setq prev
(1+ (car unread
)))
12284 (setq unread
(cdr unread
)))
12285 (when (<= prev
(cdr active
))
12286 (push (cons prev
(cdr active
)) read
))
12287 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
12292 ;; Propagate the read marks to the backend.
12293 (when (and gnus-propagate-marks
12294 (gnus-check-backend-function 'request-set-mark group
))
12295 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
12296 (add (gnus-remove-from-range read
(gnus-info-read info
))))
12298 (unless (gnus-check-group group
)
12299 (error "Can't open server for %s" group
))
12300 (gnus-request-set-mark
12301 group
(delq nil
(list (if add
(list add
'add
'(read)))
12302 (if del
(list del
'del
'(read))))))
12304 `(gnus-request-set-mark
12307 (if del
(list del
'add
'(read)))
12308 (if add
(list add
'del
'(read))))))))))
12309 (set-buffer gnus-group-buffer
)
12310 (gnus-undo-register
12312 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
12313 (gnus-info-set-read ',info
',(gnus-info-read info
))
12314 (gnus-get-unread-articles-in-group ',info
12315 (gnus-active ,group
))
12316 (gnus-group-update-group ,group t
)
12318 ;; Enter this list into the group info.
12319 (gnus-info-set-read info read
)
12320 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12321 (gnus-get-unread-articles-in-group info
(gnus-active group
))
12324 (defun gnus-offer-save-summaries ()
12325 "Offer to save all active summary buffers."
12327 ;; Go through all buffers and find all summaries.
12328 (dolist (buffer (buffer-list))
12329 (when (and (setq buffer
(buffer-name buffer
))
12330 (string-match "Summary" buffer
)
12331 (with-current-buffer buffer
12332 ;; We check that this is, indeed, a summary buffer.
12333 (and (eq major-mode
'gnus-summary-mode
)
12334 ;; Also make sure this isn't bogus.
12335 gnus-newsgroup-prepared
12336 ;; Also make sure that this isn't a
12337 ;; dead summary buffer.
12338 (not gnus-dead-summary-mode
))))
12339 (push buffer buffers
)))
12340 ;; Go through all these summary buffers and offer to save them.
12344 "Update summary buffer %s? "
12346 (switch-to-buffer buf
)
12347 (gnus-summary-exit))
12350 (defun gnus-summary-setup-default-charset ()
12351 "Setup newsgroup default charset."
12352 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
12353 (setq gnus-newsgroup-charset nil
)
12354 (let* ((ignored-charsets
12355 (or gnus-newsgroup-ephemeral-ignored-charsets
12357 (and gnus-newsgroup-name
12358 (gnus-parameter-ignored-charsets gnus-newsgroup-name
))
12359 gnus-newsgroup-ignored-charsets
))))
12360 (setq gnus-newsgroup-charset
12361 (or gnus-newsgroup-ephemeral-charset
12362 (and gnus-newsgroup-name
12363 (gnus-parameter-charset gnus-newsgroup-name
))
12364 gnus-default-charset
))
12365 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
12366 ignored-charsets
))))
12372 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
12373 "Display the current article buffer fully MIME-buttonized.
12374 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12375 treated as multipart/mixed."
12377 (require 'gnus-art
)
12378 (let ((gnus-unbuttonized-mime-types nil
)
12379 (gnus-mime-display-multipart-as-mixed show-all-parts
))
12380 (gnus-summary-show-article)))
12382 (defun gnus-summary-repair-multipart (article)
12383 "Add a Content-Type header to a multipart article without one."
12384 (interactive (list (gnus-summary-article-number)))
12385 (gnus-with-article article
12386 (message-narrow-to-head)
12387 (message-remove-header "Mime-Version")
12388 (goto-char (point-max))
12389 (insert "Mime-Version: 1.0\n")
12391 (when (search-forward "\n--" nil t
)
12392 (let ((separator (buffer-substring (point) (point-at-eol))))
12393 (message-narrow-to-head)
12394 (message-remove-header "Content-Type")
12395 (goto-char (point-max))
12396 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12399 (let (gnus-mark-article-hook)
12400 (gnus-summary-select-article t t nil article
)))
12402 (defun gnus-summary-toggle-display-buttonized ()
12403 "Toggle the buttonizing of the article buffer."
12405 (require 'gnus-art
)
12406 (if (setq gnus-inhibit-mime-unbuttonizing
12407 (not gnus-inhibit-mime-unbuttonizing
))
12408 (let ((gnus-unbuttonized-mime-types nil
))
12409 (gnus-summary-show-article))
12410 (gnus-summary-show-article)))
12413 ;;; Generic summary marking commands
12416 (defvar gnus-summary-marking-alist
12417 '((read gnus-del-mark
"d")
12418 (unread gnus-unread-mark
"u")
12419 (ticked gnus-ticked-mark
"!")
12420 (dormant gnus-dormant-mark
"?")
12421 (expirable gnus-expirable-mark
"e"))
12422 "An alist of names/marks/keystrokes.")
12424 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
12425 (defvar gnus-summary-mark-map
)
12427 (defun gnus-summary-make-all-marking-commands ()
12428 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
12429 (dolist (elem gnus-summary-marking-alist
)
12430 (apply 'gnus-summary-make-marking-command elem
)))
12432 (defun gnus-summary-make-marking-command (name mark keystroke
)
12433 (let ((map (make-sparse-keymap)))
12434 (define-key gnus-summary-generic-mark-map keystroke map
)
12435 (dolist (lway `((next "next" next nil
"n")
12436 (next-unread "next unread" next t
"N")
12437 (prev "previous" prev nil
"p")
12438 (prev-unread "previous unread" prev t
"P")
12439 (nomove "" nil nil
,keystroke
)))
12440 (let ((func (gnus-summary-make-marking-command-1
12441 mark
(car lway
) lway name
)))
12442 (setq func
(eval func
))
12443 (define-key map
(nth 4 lway
) func
)))))
12445 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
12447 (format "gnus-summary-put-mark-as-%s%s"
12448 name
(if (eq way
'nomove
)
12450 (concat "-" (symbol-name way
)))))
12453 "Mark the current article as %s%s.
12454 If N, the prefix, then repeat N times.
12455 If N is negative, move in reverse order.
12456 The difference between N and the actual number of articles marked is
12460 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
12462 (defun gnus-summary-generic-mark (n mark move unread
)
12463 "Mark N articles with MARK."
12464 (unless (eq major-mode
'gnus-summary-mode
)
12465 (error "This command can only be used in the summary buffer"))
12466 (gnus-summary-show-thread)
12469 ((eq move
'next
) 1)
12470 ((eq move
'prev
) -
1)
12472 (if (zerop nummove
)
12476 nummove
(* -
1 nummove
))))
12477 (while (and (> n
0)
12478 (gnus-summary-mark-article nil mark
)
12479 (zerop (gnus-summary-next-subject nummove unread t
)))
12482 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
12483 (gnus-summary-recenter)
12484 (gnus-summary-position-point)
12485 (gnus-set-mode-line 'summary
)
12488 (defun gnus-summary-insert-articles (articles)
12489 (when (setq articles
12490 (gnus-sorted-difference articles
12491 (mapcar (lambda (h)
12492 (mail-header-number h
))
12493 gnus-newsgroup-headers
)))
12494 (setq gnus-newsgroup-headers
12496 gnus-newsgroup-headers
12497 (gnus-fetch-headers articles
)
12498 'gnus-article-sort-by-number
))
12499 ;; Suppress duplicates?
12500 (when gnus-suppress-duplicates
12501 (gnus-dup-suppress-articles))
12503 (if (and gnus-fetch-old-headers
12504 (eq gnus-headers-retrieved-by
'nov
))
12505 ;; We might want to build some more threads first.
12506 (if (eq gnus-fetch-old-headers
'invisible
)
12507 (gnus-build-all-threads)
12508 (gnus-build-old-threads))
12509 ;; Mark the inserted articles that are unread as unread.
12510 (setq gnus-newsgroup-unreads
12511 (gnus-sorted-nunion
12512 gnus-newsgroup-unreads
12513 (gnus-sorted-nintersection
12514 (gnus-list-of-unread-articles gnus-newsgroup-name
)
12516 ;; Mark the inserted articles as selected so that the information
12517 ;; of the marks having been changed by a user may be updated when
12518 ;; exiting this group. See `gnus-summary-update-info'.
12519 (dolist (art articles
)
12520 (setq gnus-newsgroup-unselected
(delq art gnus-newsgroup-unselected
))))
12521 ;; Let the Gnus agent mark articles as read.
12523 (gnus-agent-get-undownloaded-list))
12524 ;; Remove list identifiers from subject
12525 (when gnus-list-identifiers
12526 (gnus-summary-remove-list-identifiers))
12527 ;; First and last article in this newsgroup.
12528 (when gnus-newsgroup-headers
12529 (setq gnus-newsgroup-begin
12530 (mail-header-number (car gnus-newsgroup-headers
))
12532 (mail-header-number
12533 (gnus-last-element gnus-newsgroup-headers
))))
12534 (when gnus-use-scoring
12535 (gnus-possibly-score-headers))))
12537 (defun gnus-summary-insert-old-articles (&optional all
)
12538 "Insert all old articles in this group.
12539 If ALL is non-nil, already read articles become readable.
12540 If ALL is a number, fetch this number of articles."
12543 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
12546 ;; Some nntp servers lie about their active range. When
12547 ;; this happens, the active range can be in the millions.
12548 ;; Use a compressed range to avoid creating a huge list.
12549 (gnus-range-difference (list gnus-newsgroup-active
) old
))
12550 (setq len
(gnus-range-length older
))
12555 (let ((older-range (nreverse older
)))
12559 (let* ((r (pop older-range
))
12560 (min (if (numberp r
) r
(car r
)))
12561 (max (if (numberp r
) r
(cdr r
))))
12562 (while (and (<= min max
)
12567 (setq older
(gnus-uncompress-range older
))))
12569 (setq older
(gnus-uncompress-range older
)))
12571 (when (and (numberp gnus-large-newsgroup
)
12572 (> len gnus-large-newsgroup
))
12573 (let* ((cursor-in-echo-area nil
)
12574 (initial (gnus-parameter-large-newsgroup-initial
12575 gnus-newsgroup-name
))
12579 "How many articles from %s (%s %d): "
12580 (gnus-group-decoded-name gnus-newsgroup-name
)
12581 (if initial
"max" "default")
12584 (cons (number-to-string initial
)
12586 (unless (string-match "^[ \t]*$" input
)
12587 (setq all
(string-to-number input
))
12589 (let ((older-range (nreverse older
)))
12593 (let* ((r (pop older-range
))
12594 (min (if (numberp r
) r
(car r
)))
12595 (max (if (numberp r
) r
(cdr r
))))
12596 (while (and (<= min max
)
12600 max
(1- max
))))))))))
12601 (setq older
(gnus-uncompress-range older
))))
12603 (message "No old news.")
12604 (gnus-summary-insert-articles older
)
12605 (gnus-summary-limit (gnus-sorted-nunion old older
))))
12606 (gnus-summary-position-point)))
12608 (defun gnus-summary-insert-new-articles ()
12609 "Insert all new articles in this group."
12612 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
12613 (old-active gnus-newsgroup-active
)
12614 (nnmail-fetched-sources (list t
))
12616 (setq gnus-newsgroup-active
12617 (gnus-activate-group gnus-newsgroup-name
'scan
))
12618 (setq i
(cdr gnus-newsgroup-active
))
12619 (while (> i
(cdr old-active
))
12623 (message "No gnus is bad news")
12624 (gnus-summary-insert-articles new
)
12625 (setq gnus-newsgroup-unreads
12626 (gnus-sorted-nunion gnus-newsgroup-unreads new
))
12627 (gnus-summary-limit (gnus-sorted-nunion old new
))))
12628 (gnus-summary-position-point)))
12630 ;;; Bookmark support for Gnus.
12631 (declare-function bookmark-make-record-default
12632 "bookmark" (&optional no-file no-context posn
))
12633 (declare-function bookmark-prop-get
"bookmark" (bookmark prop
))
12634 (declare-function bookmark-default-handler
"bookmark" (bmk))
12635 (declare-function bookmark-get-bookmark-record
"bookmark" (bmk))
12636 (defvar bookmark-yank-point
)
12637 (defvar bookmark-current-buffer
)
12639 (defun gnus-summary-bookmark-make-record ()
12640 "Make a bookmark entry for a Gnus summary buffer."
12642 (unless (and (derived-mode-p 'gnus-summary-mode
) gnus-article-current
)
12643 (save-restriction ; FIXME is it necessary to widen?
12644 (widen) (setq pos
(point))) ; Set position in gnus-article buffer.
12645 (setq buf
"art") ; We are recording bookmark from article buffer.
12646 (setq bookmark-yank-point
(point))
12647 (setq bookmark-current-buffer
(current-buffer))
12648 (gnus-article-show-summary)) ; Go back in summary buffer.
12649 ;; We are now recording bookmark from summary buffer.
12650 (unless buf
(setq buf
"sum"))
12651 (let* ((subject (elt (gnus-summary-article-header) 1))
12652 (grp (car gnus-article-current
))
12653 (art (cdr gnus-article-current
))
12654 (head (gnus-summary-article-header art
))
12655 (id (mail-header-id head
)))
12657 ,@(condition-case nil
12658 (bookmark-make-record-default 'no-file
'no-context pos
)
12659 (wrong-number-of-arguments
12660 (bookmark-make-record-default 'point-only
)))
12661 (location .
,(format "Gnus-%s %s:%d:%s" buf grp art id
))
12662 (group .
,grp
) (article .
,art
)
12663 (message-id .
,id
) (handler . gnus-summary-bookmark-jump
)))))
12666 (defun gnus-summary-bookmark-jump (bookmark)
12667 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
12668 BOOKMARK is a bookmark name or a bookmark record."
12669 (let ((group (bookmark-prop-get bookmark
'group
))
12670 (article (bookmark-prop-get bookmark
'article
))
12671 (id (bookmark-prop-get bookmark
'message-id
))
12672 (buf (car (split-string (bookmark-prop-get bookmark
'location
)))))
12673 (gnus-fetch-group group
(list article
))
12674 (gnus-summary-insert-cached-articles)
12675 (gnus-summary-goto-article id nil
'force
)
12676 ;; FIXME we have to wait article buffer is ready (only large buffer)
12677 ;; Is there a better solution to know that?
12678 ;; If we don't wait `bookmark-default-handler' will have no chance
12679 ;; to set position. However there is no error, just wrong pos.
12681 (when (string= buf
"Gnus-art")
12683 (bookmark-default-handler
12685 (buffer .
,(current-buffer))
12686 .
,(bookmark-get-bookmark-record bookmark
)))))
12688 (gnus-summary-make-all-marking-commands)
12690 (gnus-ems-redefine)
12692 (provide 'gnus-sum
)
12694 (run-hooks 'gnus-sum-load-hook
)
12696 ;; Local Variables:
12697 ;; coding: iso-8859-1
12700 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12701 ;;; gnus-sum.el ends here