1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 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 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (defvar tool-bar-mode
))
45 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
46 (autoload 'gnus-cache-write-active
"gnus-cache")
47 (autoload 'gnus-mailing-list-insinuate
"gnus-ml" nil t
)
48 (autoload 'turn-on-gnus-mailing-list-mode
"gnus-ml" nil t
)
49 (autoload 'gnus-pick-line-number
"gnus-salt" nil t
)
50 (autoload 'mm-uu-dissect
"mm-uu")
51 (autoload 'gnus-article-outlook-deuglify-article
"deuglify"
52 "Deuglify broken Outlook (Express) articles and redisplay."
54 (autoload 'gnus-article-outlook-unwrap-lines
"deuglify" nil t
)
55 (autoload 'gnus-article-outlook-repair-attribution
"deuglify" nil t
)
56 (autoload 'gnus-article-outlook-rearrange-citation
"deuglify" nil t
)
58 (defcustom gnus-kill-summary-on-exit t
59 "*If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62 :group
'gnus-summary-exit
65 (defcustom gnus-fetch-old-headers nil
66 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
67 If an unread article in the group refers to an older, already read (or
68 just marked as read) article, the old article will not normally be
69 displayed in the Summary buffer. If this variable is t, Gnus
70 will attempt to grab the headers to the old articles, and thereby
71 build complete threads. If it has the value `some', only enough
72 headers to connect otherwise loose threads will be displayed. This
73 variable can also be a number. In that case, no more than that number
74 of old headers will be fetched. If it has the value `invisible', all
75 old headers will be fetched, but none will be displayed.
77 The server has to support NOV for any of this to work."
79 :type
'(choice (const :tag
"off" nil
)
84 (sexp :menu-tag
"other" t
)))
86 (defcustom gnus-refer-thread-limit
200
87 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
88 If t, fetch all the available old headers."
91 (sexp :menu-tag
"other" t
)))
93 (defcustom gnus-summary-make-false-root
'adopt
94 "*nil means that Gnus won't gather loose threads.
95 If the root of a thread has expired or been read in a previous
96 session, the information necessary to build a complete thread has been
97 lost. Instead of having many small sub-threads from this original thread
98 scattered all over the summary buffer, Gnus can gather them.
100 If non-nil, Gnus will try to gather all loose sub-threads from an
101 original thread into one large thread.
103 If this variable is non-nil, it should be one of `none', `adopt',
106 If this variable is `none', Gnus will not make a false root, but just
107 present the sub-threads after another.
108 If this variable is `dummy', Gnus will create a dummy root that will
109 have all the sub-threads as children.
110 If this variable is `adopt', Gnus will make one of the \"children\"
111 the parent and mark all the step-children as such.
112 If this variable is `empty', the \"children\" are printed with empty
113 subject fields. (Or rather, they will be printed with a string
114 given by the `gnus-summary-same-subject' variable.)"
116 :type
'(choice (const :tag
"off" nil
)
122 (defcustom gnus-summary-make-false-root-always nil
123 "Always make a false dummy root."
128 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
129 "*A regexp to match subjects to be excluded from loose thread gathering.
130 As loose thread gathering is done on subjects only, that means that
131 there can be many false gatherings performed. By rooting out certain
132 common subjects, gathering might become saner."
136 (defcustom gnus-summary-gather-subject-limit nil
137 "*Maximum length of subject comparisons when gathering loose threads.
138 Use nil to compare full subjects. Setting this variable to a low
139 number will help gather threads that have been corrupted by
140 newsreaders chopping off subject lines, but it might also mean that
141 unrelated articles that have subject that happen to begin with the
142 same few characters will be incorrectly gathered.
144 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
147 :type
'(choice (const :tag
"off" nil
)
149 (sexp :menu-tag
"on" t
)))
151 (defcustom gnus-simplify-subject-functions nil
152 "List of functions taking a string argument that simplify subjects.
153 The functions are applied recursively.
155 Useful functions to put in this list include:
156 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
157 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
159 :type
'(repeat function
))
161 (defcustom gnus-simplify-ignored-prefixes nil
162 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
164 :type
'(choice (const :tag
"off" nil
)
167 (defcustom gnus-build-sparse-threads nil
168 "*If non-nil, fill in the gaps in threads.
169 If `some', only fill in the gaps that are needed to tie loose threads
170 together. If `more', fill in all leaf nodes that Gnus can find. If
171 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
173 :type
'(choice (const :tag
"off" nil
)
176 (sexp :menu-tag
"all" t
)))
178 (defcustom gnus-summary-thread-gathering-function
179 'gnus-gather-threads-by-subject
180 "*Function used for gathering loose threads.
181 There are two pre-defined functions: `gnus-gather-threads-by-subject',
182 which only takes Subjects into consideration; and
183 `gnus-gather-threads-by-references', which compared the References
184 headers of the articles to find matches."
186 :type
'(radio (function-item gnus-gather-threads-by-subject
)
187 (function-item gnus-gather-threads-by-references
)
188 (function :tag
"other")))
190 (defcustom gnus-summary-same-subject
""
191 "*String indicating that the current article has the same subject as the previous.
192 This variable will only be used if the value of
193 `gnus-summary-make-false-root' is `empty'."
194 :group
'gnus-summary-format
197 (defcustom gnus-summary-goto-unread t
198 "*If t, many commands will go to the next unread article.
199 This applies to marking commands as well as other commands that
200 \"naturally\" select the next article, like, for instance, `SPC' at
201 the end of an article.
203 If nil, the marking commands do NOT go to the next unread article
204 \(they go to the next article instead). If `never', commands that
205 usually go to the next unread article, will go to the next article,
206 whether it is read or not."
207 :group
'gnus-summary-marks
208 :link
'(custom-manual "(gnus)Setting Marks")
209 :type
'(choice (const :tag
"off" nil
)
211 (sexp :menu-tag
"on" t
)))
213 (defcustom gnus-summary-default-score
0
214 "*Default article score level.
215 All scores generated by the score files will be added to this score.
216 If this variable is nil, scoring will be disabled."
217 :group
'gnus-score-default
218 :type
'(choice (const :tag
"disable")
221 (defcustom gnus-summary-default-high-score
0
222 "*Default threshold for a high scored article.
223 An article will be highlighted as high scored if its score is greater
226 :group
'gnus-score-default
229 (defcustom gnus-summary-default-low-score
0
230 "*Default threshold for a low scored article.
231 An article will be highlighted as low scored if its score is smaller
234 :group
'gnus-score-default
237 (defcustom gnus-summary-zcore-fuzz
0
238 "*Fuzziness factor for the zcore in the summary buffer.
239 Articles with scores closer than this to `gnus-summary-default-score'
241 :group
'gnus-summary-format
244 (defcustom gnus-simplify-subject-fuzzy-regexp nil
245 "*Strings to be removed when doing fuzzy matches.
246 This can either be a regular expression or list of regular expressions
247 that will be removed from subject strings if fuzzy subject
248 simplification is selected."
250 :type
'(repeat regexp
))
252 (defcustom gnus-show-threads t
253 "*If non-nil, display threads in summary mode."
257 (defcustom gnus-thread-hide-subtree nil
258 "*If non-nil, hide all threads initially.
259 This can be a predicate specifier which says which threads to hide.
260 If threads are hidden, you have to run the command
261 `gnus-summary-show-thread' by hand or select an article."
263 :type
'(radio (sexp :format
"Non-nil\n"
264 :match
(lambda (widget value
)
265 (not (or (consp value
) (functionp value
))))
268 (sexp :tag
"Predicate specifier")))
270 (defcustom gnus-thread-hide-killed t
271 "*If non-nil, hide killed threads automatically."
275 (defcustom gnus-thread-ignore-subject t
276 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
277 If nil, articles that have different subjects from their parents will
278 start separate threads."
282 (defcustom gnus-thread-operation-ignore-subject t
283 "*If non-nil, subjects will be ignored when doing thread commands.
284 This affects commands like `gnus-summary-kill-thread' and
285 `gnus-summary-lower-thread'.
287 If this variable is nil, articles in the same thread with different
288 subjects will not be included in the operation in question. If this
289 variable is `fuzzy', only articles that have subjects that are fuzzily
290 equal will be included."
292 :type
'(choice (const :tag
"off" nil
)
296 (defcustom gnus-thread-indent-level
4
297 "*Number that says how much each sub-thread should be indented."
301 (defcustom gnus-auto-extend-newsgroup t
302 "*If non-nil, extend newsgroup forward and backward when requested."
303 :group
'gnus-summary-choose
306 (defcustom gnus-auto-select-first t
307 "*If non-nil, select the article under point.
308 Which article this is is controlled by the `gnus-auto-select-subject'
311 If you want to prevent automatic selection of articles in some
312 newsgroups, set the variable to nil in `gnus-select-group-hook'."
313 :group
'gnus-group-select
314 :type
'(choice (const :tag
"none" nil
)
315 (sexp :menu-tag
"first" t
)))
317 (defcustom gnus-auto-select-subject
'unread
318 "*Says what subject to place under point when entering a group.
320 This variable can either be the symbols `first' (place point on the
321 first subject), `unread' (place point on the subject line of the first
322 unread article), `best' (place point on the subject line of the
323 higest-scored article), `unseen' (place point on the subject line of
324 the first unseen article), `unseen-or-unread' (place point on the subject
325 line of the first unseen article or, if all article have been seen, on the
326 subject line of the first unread article), or a function to be called to
327 place point on some subject line."
329 :group
'gnus-group-select
330 :type
'(choice (const best
)
334 (const unseen-or-unread
)))
336 (defcustom gnus-auto-select-next t
337 "*If non-nil, offer to go to the next group from the end of the previous.
338 If the value is t and the next newsgroup is empty, Gnus will exit
339 summary mode and go back to group mode. If the value is neither nil
340 nor t, Gnus will select the following unread newsgroup. In
341 particular, if the value is the symbol `quietly', the next unread
342 newsgroup will be selected without any confirmation, and if it is
343 `almost-quietly', the next group will be selected without any
344 confirmation if you are located on the last article in the group.
345 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
346 will go to the next group without confirmation."
347 :group
'gnus-summary-maneuvering
348 :type
'(choice (const :tag
"off" nil
)
350 (const almost-quietly
)
351 (const slightly-quietly
)
352 (sexp :menu-tag
"on" t
)))
354 (defcustom gnus-auto-select-same nil
355 "*If non-nil, select the next article with the same subject.
356 If there are no more articles with the same subject, go to
357 the first unread article."
358 :group
'gnus-summary-maneuvering
361 (defcustom gnus-auto-goto-ignores
'unfetched
362 "*Says how to handle unfetched articles when maneuvering.
364 This variable can either be the symbols nil (maneuver to any
365 article), `undownloaded' (maneuvering while unplugged ignores articles
366 that have not been fetched), `always-undownloaded' (maneuvering always
367 ignores articles that have not been fetched), `unfetched' (maneuvering
368 ignores articles whose headers have not been fetched).
370 NOTE: The list of unfetched articles will always be nil when plugged
371 and, when unplugged, a subset of the undownloaded article list."
373 :group
'gnus-summary-maneuvering
374 :type
'(choice (const :tag
"None" nil
)
375 (const :tag
"Undownloaded when unplugged" undownloaded
)
376 (const :tag
"Undownloaded" always-undownloaded
)
377 (const :tag
"Unfetched" unfetched
)))
379 (defcustom gnus-summary-check-current nil
380 "*If non-nil, consider the current article when moving.
381 The \"unread\" movement commands will stay on the same line if the
382 current article is unread."
383 :group
'gnus-summary-maneuvering
386 (defcustom gnus-auto-center-summary t
387 "*If non-nil, always center the current summary buffer.
388 In particular, if `vertical' do only vertical recentering. If non-nil
389 and non-`vertical', do both horizontal and vertical recentering."
390 :group
'gnus-summary-maneuvering
391 :type
'(choice (const :tag
"none" nil
)
393 (integer :tag
"height")
394 (sexp :menu-tag
"both" t
)))
396 (defvar gnus-auto-center-group t
397 "*If non-nil, always center the group buffer.")
399 (defcustom gnus-show-all-headers nil
400 "*If non-nil, don't hide any headers."
401 :group
'gnus-article-hiding
402 :group
'gnus-article-headers
405 (defcustom gnus-summary-ignore-duplicates nil
406 "*If non-nil, ignore articles with identical Message-ID headers."
410 (defcustom gnus-single-article-buffer t
411 "*If non-nil, display all articles in the same buffer.
412 If nil, each group will get its own article buffer."
413 :group
'gnus-article-various
416 (defcustom gnus-break-pages t
417 "*If non-nil, do page breaking on articles.
418 The page delimiter is specified by the `gnus-page-delimiter'
420 :group
'gnus-article-various
423 (defcustom gnus-move-split-methods nil
424 "*Variable used to suggest where articles are to be moved to.
425 It uses the same syntax as the `gnus-split-methods' variable.
426 However, whereas `gnus-split-methods' specifies file names as targets,
427 this variable specifies group names."
428 :group
'gnus-summary-mail
429 :type
'(repeat (choice (list :value
(fun) function
)
430 (cons :value
("" "") regexp
(repeat string
))
433 ;; FIXME: Although the custom type is `character' for the following variables,
434 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
436 (defcustom gnus-unread-mark ?
;Whitespace
437 "*Mark used for unread articles."
438 :group
'gnus-summary-marks
441 (defcustom gnus-ticked-mark ?
!
442 "*Mark used for ticked articles."
443 :group
'gnus-summary-marks
446 (defcustom gnus-dormant-mark ??
447 "*Mark used for dormant articles."
448 :group
'gnus-summary-marks
451 (defcustom gnus-del-mark ?r
452 "*Mark used for del'd articles."
453 :group
'gnus-summary-marks
456 (defcustom gnus-read-mark ?R
457 "*Mark used for read articles."
458 :group
'gnus-summary-marks
461 (defcustom gnus-expirable-mark ?E
462 "*Mark used for expirable articles."
463 :group
'gnus-summary-marks
466 (defcustom gnus-killed-mark ?K
467 "*Mark used for killed articles."
468 :group
'gnus-summary-marks
471 (defcustom gnus-spam-mark ?$
472 "*Mark used for spam articles."
474 :group
'gnus-summary-marks
477 (defcustom gnus-souped-mark ?F
478 "*Mark used for souped articles."
479 :group
'gnus-summary-marks
482 (defcustom gnus-kill-file-mark ?X
483 "*Mark used for articles killed by kill files."
484 :group
'gnus-summary-marks
487 (defcustom gnus-low-score-mark ?Y
488 "*Mark used for articles with a low score."
489 :group
'gnus-summary-marks
492 (defcustom gnus-catchup-mark ?C
493 "*Mark used for articles that are caught up."
494 :group
'gnus-summary-marks
497 (defcustom gnus-replied-mark ?A
498 "*Mark used for articles that have been replied to."
499 :group
'gnus-summary-marks
502 (defcustom gnus-forwarded-mark ?F
503 "*Mark used for articles that have been forwarded."
505 :group
'gnus-summary-marks
508 (defcustom gnus-recent-mark ?N
509 "*Mark used for articles that are recent."
511 :group
'gnus-summary-marks
514 (defcustom gnus-cached-mark ?
*
515 "*Mark used for articles that are in the cache."
516 :group
'gnus-summary-marks
519 (defcustom gnus-saved-mark ?S
520 "*Mark used for articles that have been saved."
521 :group
'gnus-summary-marks
524 (defcustom gnus-unseen-mark ?.
525 "*Mark used for articles that haven't been seen."
527 :group
'gnus-summary-marks
530 (defcustom gnus-no-mark ?
;Whitespace
531 "*Mark used for articles that have no other secondary mark."
533 :group
'gnus-summary-marks
536 (defcustom gnus-ancient-mark ?O
537 "*Mark used for ancient articles."
538 :group
'gnus-summary-marks
541 (defcustom gnus-sparse-mark ?Q
542 "*Mark used for sparsely reffed articles."
543 :group
'gnus-summary-marks
546 (defcustom gnus-canceled-mark ?G
547 "*Mark used for canceled articles."
548 :group
'gnus-summary-marks
551 (defcustom gnus-duplicate-mark ?M
552 "*Mark used for duplicate articles."
553 :group
'gnus-summary-marks
556 (defcustom gnus-undownloaded-mark ?-
557 "*Mark used for articles that weren't downloaded."
559 :group
'gnus-summary-marks
562 (defcustom gnus-downloaded-mark ?
+
563 "*Mark used for articles that were downloaded."
564 :group
'gnus-summary-marks
567 (defcustom gnus-downloadable-mark ?%
568 "*Mark used for articles that are to be downloaded."
569 :group
'gnus-summary-marks
572 (defcustom gnus-unsendable-mark ?
=
573 "*Mark used for articles that won't be sent."
574 :group
'gnus-summary-marks
577 (defcustom gnus-score-over-mark ?
+
578 "*Score mark used for articles with high scores."
579 :group
'gnus-summary-marks
582 (defcustom gnus-score-below-mark ?-
583 "*Score mark used for articles with low scores."
584 :group
'gnus-summary-marks
587 (defcustom gnus-empty-thread-mark ?
;Whitespace
588 "*There is no thread under the article."
589 :group
'gnus-summary-marks
592 (defcustom gnus-not-empty-thread-mark ?
=
593 "*There is a thread under the article."
594 :group
'gnus-summary-marks
597 (defcustom gnus-view-pseudo-asynchronously nil
598 "*If non-nil, Gnus will view pseudo-articles asynchronously."
599 :group
'gnus-extract-view
602 (defcustom gnus-auto-expirable-marks
603 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
604 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
605 gnus-souped-mark gnus-duplicate-mark
)
606 "*The list of marks converted into expiration if a group is auto-expirable."
609 :type
'(repeat character
))
611 (defcustom gnus-inhibit-user-auto-expire t
612 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
617 (defcustom gnus-view-pseudos nil
618 "*If `automatic', pseudo-articles will be viewed automatically.
619 If `not-confirm', pseudos will be viewed automatically, and the user
620 will not be asked to confirm the command."
621 :group
'gnus-extract-view
622 :type
'(choice (const :tag
"off" nil
)
624 (const not-confirm
)))
626 (defcustom gnus-view-pseudos-separately t
627 "*If non-nil, one pseudo-article will be created for each file to be viewed.
628 If nil, all files that use the same viewing command will be given as a
629 list of parameters to that command."
630 :group
'gnus-extract-view
633 (defcustom gnus-insert-pseudo-articles t
634 "*If non-nil, insert pseudo-articles when decoding articles."
635 :group
'gnus-extract-view
638 (defcustom gnus-summary-dummy-line-format
640 "*The format specification for the dummy roots in the summary buffer.
641 It works along the same lines as a normal formatting string,
642 with some simple extensions.
646 General format specifiers can also be used.
647 See `(gnus)Formatting Variables'."
648 :link
'(custom-manual "(gnus)Formatting Variables")
649 :group
'gnus-threading
652 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
653 "*The format specification for the summary mode line.
654 It works along the same lines as a normal formatting string,
655 with some simple extensions:
658 %p Unprefixed group name
659 %A Current article number
660 %z Current article score
662 %U Number of unread articles in the group
663 %e Number of unselected articles in the group
664 %Z A string with unread/unselected article counts
665 %g Shortish group name
666 %S Subject of the current article
668 %s Current score file name
669 %d Number of dormant articles
670 %r Number of articles that have been marked as read in this session
671 %E Number of articles expunged by the score files"
672 :group
'gnus-summary-format
675 (defcustom gnus-list-identifiers nil
676 "Regexp that matches list identifiers to be removed from subject.
677 This can also be a list of regexps."
679 :group
'gnus-summary-format
680 :group
'gnus-article-hiding
681 :type
'(choice (const :tag
"none" nil
)
683 (repeat :value
(".*") regexp
)))
685 (defcustom gnus-summary-mark-below
0
686 "*Mark all articles with a score below this variable as read.
687 This variable is local to each summary buffer and usually set by the
689 :group
'gnus-score-default
692 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
693 "*List of functions used for sorting articles in the summary buffer.
695 Each function takes two articles and returns non-nil if the first
696 article should be sorted before the other. If you use more than one
697 function, the primary sort function should be the last. You should
698 probably always include `gnus-article-sort-by-number' in the list of
699 sorting functions -- preferably first. Also note that sorting by date
700 is often much slower than sorting by number, and the sorting order is
701 very similar. (Sorting by date means sorting by the time the message
702 was sent, sorting by number means sorting by arrival time.)
704 Ready-made functions include `gnus-article-sort-by-number',
705 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
706 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
707 and `gnus-article-sort-by-score'.
709 When threading is turned on, the variable `gnus-thread-sort-functions'
710 controls how articles are sorted."
711 :group
'gnus-summary-sort
712 :type
'(repeat (choice (function-item gnus-article-sort-by-number
)
713 (function-item gnus-article-sort-by-author
)
714 (function-item gnus-article-sort-by-subject
)
715 (function-item gnus-article-sort-by-date
)
716 (function-item gnus-article-sort-by-score
)
717 (function-item gnus-article-sort-by-random
)
718 (function :tag
"other"))))
720 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
721 "*List of functions used for sorting threads in the summary buffer.
722 By default, threads are sorted by article number.
724 Each function takes two threads and returns non-nil if the first
725 thread should be sorted before the other. If you use more than one
726 function, the primary sort function should be the last. You should
727 probably always include `gnus-thread-sort-by-number' in the list of
728 sorting functions -- preferably first. Also note that sorting by date
729 is often much slower than sorting by number, and the sorting order is
730 very similar. (Sorting by date means sorting by the time the message
731 was sent, sorting by number means sorting by arrival time.)
733 Ready-made functions include `gnus-thread-sort-by-number',
734 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
735 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
736 `gnus-thread-sort-by-most-recent-number',
737 `gnus-thread-sort-by-most-recent-date',
738 `gnus-thread-sort-by-random', and
739 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
741 When threading is turned off, the variable
742 `gnus-article-sort-functions' controls how articles are sorted."
743 :group
'gnus-summary-sort
744 :type
'(repeat (choice (function-item gnus-thread-sort-by-number
)
745 (function-item gnus-thread-sort-by-author
)
746 (function-item gnus-thread-sort-by-subject
)
747 (function-item gnus-thread-sort-by-date
)
748 (function-item gnus-thread-sort-by-score
)
749 (function-item gnus-thread-sort-by-total-score
)
750 (function-item gnus-thread-sort-by-random
)
751 (function :tag
"other"))))
753 (defcustom gnus-thread-score-function
'+
754 "*Function used for calculating the total score of a thread.
756 The function is called with the scores of the article and each
757 subthread and should then return the score of the thread.
759 Some functions you can use are `+', `max', or `min'."
760 :group
'gnus-summary-sort
763 (defcustom gnus-summary-expunge-below nil
764 "All articles that have a score less than this variable will be expunged.
765 This variable is local to the summary buffers."
766 :group
'gnus-score-default
767 :type
'(choice (const :tag
"off" nil
)
770 (defcustom gnus-thread-expunge-below nil
771 "All threads that have a total score less than this variable will be expunged.
772 See `gnus-thread-score-function' for en explanation of what a
775 This variable is local to the summary buffers."
776 :group
'gnus-threading
777 :group
'gnus-score-default
778 :type
'(choice (const :tag
"off" nil
)
781 (defcustom gnus-summary-mode-hook nil
782 "*A hook for Gnus summary mode.
783 This hook is run before any variables are set in the summary buffer."
784 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
785 :group
'gnus-summary-various
788 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
789 (when (featurep 'xemacs
)
790 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-summary-menu-add
)
791 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-setup-summary-toolbar
)
792 (add-hook 'gnus-summary-mode-hook
793 'gnus-xmas-switch-horizontal-scrollbar-off
))
795 (defcustom gnus-summary-menu-hook nil
796 "*Hook run after the creation of the summary mode menu."
797 :group
'gnus-summary-visual
800 (defcustom gnus-summary-exit-hook nil
801 "*A hook called on exit from the summary buffer.
802 It will be called with point in the group buffer."
803 :group
'gnus-summary-exit
806 (defcustom gnus-summary-prepare-hook nil
807 "*A hook called after the summary buffer has been generated.
808 If you want to modify the summary buffer, you can use this hook."
809 :group
'gnus-summary-various
812 (defcustom gnus-summary-prepared-hook nil
813 "*A hook called as the last thing after the summary buffer has been generated."
814 :group
'gnus-summary-various
817 (defcustom gnus-summary-generate-hook nil
818 "*A hook run just before generating the summary buffer.
819 This hook is commonly used to customize threading variables and the
821 :group
'gnus-summary-various
824 (defcustom gnus-select-group-hook nil
825 "*A hook called when a newsgroup is selected.
827 If you'd like to simplify subjects like the
828 `gnus-summary-next-same-subject' command does, you can use the
831 (add-hook gnus-select-group-hook
833 (mapcar (lambda (header)
834 (mail-header-set-subject
836 (gnus-simplify-subject
837 (mail-header-subject header) 're-only)))
838 gnus-newsgroup-headers)))"
839 :group
'gnus-group-select
842 (defcustom gnus-select-article-hook nil
843 "*A hook called when an article is selected."
844 :group
'gnus-summary-choose
845 :options
'(gnus-agent-fetch-selected-article)
848 (defcustom gnus-visual-mark-article-hook
849 (list 'gnus-highlight-selected-summary
)
850 "*Hook run after selecting an article in the summary buffer.
851 It is meant to be used for highlighting the article in some way. It
852 is not run if `gnus-visual' is nil."
853 :group
'gnus-summary-visual
856 (defcustom gnus-parse-headers-hook nil
857 "*A hook called before parsing the headers."
861 (defcustom gnus-exit-group-hook nil
862 "*A hook called when exiting summary mode.
863 This hook is not called from the non-updating exit commands like `Q'."
867 (defcustom gnus-summary-update-hook
868 (list 'gnus-summary-highlight-line
)
869 "*A hook called when a summary line is changed.
870 The hook will not be called if `gnus-visual' is nil.
872 The default function `gnus-summary-highlight-line' will
873 highlight the line according to the `gnus-summary-highlight'
875 :group
'gnus-summary-visual
878 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
879 "*A hook called when an article is selected for the first time.
880 The hook is intended to mark an article as read (or unread)
881 automatically when it is selected."
882 :group
'gnus-summary-choose
885 (defcustom gnus-group-no-more-groups-hook nil
886 "*A hook run when returning to group mode having no more (unread) groups."
887 :group
'gnus-group-select
890 (defcustom gnus-ps-print-hook nil
891 "*A hook run before ps-printing something from Gnus."
895 (defcustom gnus-summary-article-move-hook nil
896 "*A hook called after an article is moved, copied, respooled, or crossposted."
901 (defcustom gnus-summary-article-delete-hook nil
902 "*A hook called after an article is deleted."
907 (defcustom gnus-summary-article-expire-hook nil
908 "*A hook called after an article is expired."
913 (defcustom gnus-summary-display-arrow
914 (and (fboundp 'display-graphic-p
)
916 "*If non-nil, display an arrow highlighting the current article."
921 (defcustom gnus-summary-selected-face
'gnus-summary-selected
922 "Face used for highlighting the current article in the summary buffer."
923 :group
'gnus-summary-visual
926 (defvar gnus-tmp-downloaded nil
)
928 (defcustom gnus-summary-highlight
929 '(((eq mark gnus-canceled-mark
)
930 . gnus-summary-cancelled
)
931 ((and uncached
(> score default-high
))
932 . gnus-summary-high-undownloaded
)
933 ((and uncached
(< score default-low
))
934 . gnus-summary-low-undownloaded
)
936 . gnus-summary-normal-undownloaded
)
937 ((and (> score default-high
)
938 (or (eq mark gnus-dormant-mark
)
939 (eq mark gnus-ticked-mark
)))
940 . gnus-summary-high-ticked
)
941 ((and (< score default-low
)
942 (or (eq mark gnus-dormant-mark
)
943 (eq mark gnus-ticked-mark
)))
944 . gnus-summary-low-ticked
)
945 ((or (eq mark gnus-dormant-mark
)
946 (eq mark gnus-ticked-mark
))
947 . gnus-summary-normal-ticked
)
948 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
949 . gnus-summary-high-ancient
)
950 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
951 . gnus-summary-low-ancient
)
952 ((eq mark gnus-ancient-mark
)
953 . gnus-summary-normal-ancient
)
954 ((and (> score default-high
) (eq mark gnus-unread-mark
))
955 . gnus-summary-high-unread
)
956 ((and (< score default-low
) (eq mark gnus-unread-mark
))
957 . gnus-summary-low-unread
)
958 ((eq mark gnus-unread-mark
)
959 . gnus-summary-normal-unread
)
960 ((> score default-high
)
961 . gnus-summary-high-read
)
962 ((< score default-low
)
963 . gnus-summary-low-read
)
965 . gnus-summary-normal-read
))
966 "*Controls the highlighting of summary buffer lines.
968 A list of (FORM . FACE) pairs. When deciding how a a particular
969 summary line should be displayed, each form is evaluated. The content
970 of the face field after the first true form is used. You can change
971 how those summary lines are displayed, by editing the face field.
973 You can use the following variables in the FORM field.
975 score: The article's score
976 default: The default article score.
977 default-high: The default score for high scored articles.
978 default-low: The default score for low scored articles.
979 below: The score below which articles are automatically marked as read.
980 mark: The article's mark.
981 uncached: Non-nil if the article is uncached."
982 :group
'gnus-summary-visual
983 :type
'(repeat (cons (sexp :tag
"Form" nil
)
986 (defcustom gnus-alter-header-function nil
987 "Function called to allow alteration of article header structures.
988 The function is called with one parameter, the article header vector,
989 which it may alter in any way."
990 :type
'(choice (const :tag
"None" nil
)
992 :group
'gnus-summary
)
994 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
995 "Function used to decode a string with encoded words.")
997 (defvar gnus-decode-encoded-address-function
998 'mail-decode-encoded-address-string
999 "Function used to decode addresses with encoded words.")
1001 (defcustom gnus-extra-headers
'(To Newsgroups
)
1002 "*Extra headers to parse."
1004 :group
'gnus-summary
1005 :type
'(repeat symbol
))
1007 (defcustom gnus-ignored-from-addresses
1008 (and user-mail-address
1009 (not (string= user-mail-address
""))
1010 (regexp-quote user-mail-address
))
1011 "*Regexp of From headers that may be suppressed in favor of To headers."
1013 :group
'gnus-summary
1016 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1017 "List of charsets that should be ignored.
1018 When these charsets are used in the \"charset\" parameter, the
1019 default charset will be used instead."
1021 :type
'(repeat symbol
)
1022 :group
'gnus-charset
)
1024 (gnus-define-group-parameter
1028 "Return the ignored charsets of GROUP."
1029 :variable gnus-group-ignored-charsets-alist
1031 '(("alt\\.chinese\\.text" iso-8859-1
))
1033 "Alist of regexps (to match group names) and charsets that should be ignored.
1034 When these charsets are used in the \"charset\" parameter, the
1035 default charset will be used instead."
1036 :variable-group gnus-charset
1037 :variable-type
'(repeat (cons (regexp :tag
"Group")
1039 :parameter-type
'(choice :tag
"Ignored charsets"
1042 :parameter-document
"\
1043 List of charsets that should be ignored.
1045 When these charsets are used in the \"charset\" parameter, the
1046 default charset will be used instead.")
1048 (defcustom gnus-group-highlight-words-alist nil
1049 "Alist of group regexps and highlight regexps.
1050 This variable uses the same syntax as `gnus-emphasis-alist'."
1052 :type
'(repeat (cons (regexp :tag
"Group")
1053 (repeat (list (regexp :tag
"Highlight regexp")
1054 (number :tag
"Group for entire word" 0)
1055 (number :tag
"Group for displayed part" 0)
1057 gnus-emphasis-highlight-words
)))))
1058 :group
'gnus-summary-visual
)
1060 (defcustom gnus-summary-show-article-charset-alist
1062 "Alist of number and charset.
1063 The article will be shown with the charset corresponding to the
1065 For example: ((1 . cn-gb-2312) (2 . big5))."
1067 :type
'(repeat (cons (number :tag
"Argument" 1)
1068 (symbol :tag
"Charset")))
1069 :group
'gnus-charset
)
1071 (defcustom gnus-preserve-marks t
1072 "Whether marks are preserved when moving, copying and respooling messages."
1075 :group
'gnus-summary-marks
)
1077 (defcustom gnus-alter-articles-to-read-function nil
1078 "Function to be called to alter the list of articles to be selected."
1079 :type
'(choice (const nil
) function
)
1080 :group
'gnus-summary
)
1082 (defcustom gnus-orphan-score nil
1083 "*All orphans get this score added. Set in the score file."
1084 :group
'gnus-score-default
1085 :type
'(choice (const nil
)
1088 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1089 "*A regexp to match MIME parts when saving multiple parts of a
1090 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1091 This regexp will be used by default when prompting the user for which
1092 type of files to save."
1093 :group
'gnus-summary
1096 (defcustom gnus-read-all-available-headers nil
1097 "Whether Gnus should parse all headers made available to it.
1098 This is mostly relevant for slow back ends where the user may
1099 wish to widen the summary buffer to include all headers
1100 that were fetched. Say, for nnultimate groups."
1102 :group
'gnus-summary
1103 :type
'(choice boolean regexp
))
1105 (defcustom gnus-summary-muttprint-program
"muttprint"
1106 "Command (and optional arguments) used to run Muttprint."
1108 :group
'gnus-summary
1111 (defcustom gnus-article-loose-mime nil
1112 "If non-nil, don't require MIME-Version header.
1113 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1114 supply the MIME-Version header or deliberately strip it from the mail.
1115 Set it to non-nil, Gnus will treat some articles as MIME even if
1116 the MIME-Version header is missed."
1119 :group
'gnus-article-mime
)
1121 (defcustom gnus-article-emulate-mime t
1122 "If non-nil, use MIME emulation for uuencode and the like.
1123 This means that Gnus will search message bodies for text that look
1124 like uuencoded bits, yEncoded bits, and so on, and present that using
1125 the normal Gnus MIME machinery."
1128 :group
'gnus-article-mime
)
1130 ;;; Internal variables
1132 (defvar gnus-summary-display-cache nil
)
1133 (defvar gnus-article-mime-handles nil
)
1134 (defvar gnus-article-decoded-p nil
)
1135 (defvar gnus-article-charset nil
)
1136 (defvar gnus-article-ignored-charsets nil
)
1137 (defvar gnus-scores-exclude-files nil
)
1138 (defvar gnus-page-broken nil
)
1140 (defvar gnus-original-article nil
)
1141 (defvar gnus-article-internal-prepare-hook nil
)
1142 (defvar gnus-newsgroup-process-stack nil
)
1144 (defvar gnus-thread-indent-array nil
)
1145 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1146 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1147 "Function called to sort the articles within a thread after it has been gathered together.")
1149 (defvar gnus-summary-save-parts-type-history nil
)
1150 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1152 ;; Avoid highlighting in kill files.
1153 (defvar gnus-summary-inhibit-highlight nil
)
1154 (defvar gnus-newsgroup-selected-overlay nil
)
1155 (defvar gnus-inhibit-limiting nil
)
1156 (defvar gnus-newsgroup-adaptive-score-file nil
)
1157 (defvar gnus-current-score-file nil
)
1158 (defvar gnus-current-move-group nil
)
1159 (defvar gnus-current-copy-group nil
)
1160 (defvar gnus-current-crosspost-group nil
)
1161 (defvar gnus-newsgroup-display nil
)
1163 (defvar gnus-newsgroup-dependencies nil
)
1164 (defvar gnus-newsgroup-adaptive nil
)
1165 (defvar gnus-summary-display-article-function nil
)
1166 (defvar gnus-summary-highlight-line-function nil
1167 "Function called after highlighting a summary line.")
1169 (defvar gnus-summary-line-format-alist
1170 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1171 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1172 (?s gnus-tmp-subject-or-nil ?s
)
1173 (?n gnus-tmp-name ?s
)
1174 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1176 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1178 (?F gnus-tmp-from ?s
)
1179 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1180 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1181 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1182 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1183 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1184 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1185 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1186 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1187 (?L gnus-tmp-lines ?s
)
1188 (?O gnus-tmp-downloaded ?c
)
1189 (?I gnus-tmp-indentation ?s
)
1190 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1191 (?R gnus-tmp-replied ?c
)
1192 (?\
[ gnus-tmp-opening-bracket ?c
)
1193 (?\
] gnus-tmp-closing-bracket ?c
)
1194 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1195 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1196 (?i gnus-tmp-score ?d
)
1197 (?z gnus-tmp-score-char ?c
)
1198 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
1199 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1200 (?U gnus-tmp-unread ?c
)
1201 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1203 (?t
(gnus-summary-number-of-articles-in-thread
1204 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1206 (?e
(gnus-summary-number-of-articles-in-thread
1207 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1209 (?u gnus-tmp-user-defined ?s
)
1210 (?P
(gnus-pick-line-number) ?d
)
1211 (?B gnus-tmp-thread-tree-header-string ?s
)
1212 (user-date (gnus-user-date
1213 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1214 "An alist of format specifications that can appear in summary lines.
1215 These are paired with what variables they correspond with, along with
1216 the type of the variable (string, integer, character, etc).")
1218 (defvar gnus-summary-dummy-line-format-alist
1219 `((?S gnus-tmp-subject ?s
)
1220 (?N gnus-tmp-number ?d
)
1221 (?u gnus-tmp-user-defined ?s
)))
1223 (defvar gnus-summary-mode-line-format-alist
1224 `((?G gnus-tmp-group-name ?s
)
1225 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1226 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1227 (?A gnus-tmp-article-number ?d
)
1228 (?Z gnus-tmp-unread-and-unselected ?s
)
1229 (?V gnus-version ?s
)
1230 (?U gnus-tmp-unread-and-unticked ?d
)
1231 (?S gnus-tmp-subject ?s
)
1232 (?e gnus-tmp-unselected ?d
)
1233 (?u gnus-tmp-user-defined ?s
)
1234 (?d
(length gnus-newsgroup-dormant
) ?d
)
1235 (?t
(length gnus-newsgroup-marked
) ?d
)
1236 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1237 (?r
(length gnus-newsgroup-reads
) ?d
)
1238 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1239 (?E gnus-newsgroup-expunged-tally ?d
)
1240 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1242 (defvar gnus-last-search-regexp nil
1243 "Default regexp for article search command.")
1245 (defvar gnus-last-shell-command nil
1246 "Default shell command on article.")
1248 (defvar gnus-newsgroup-agentized nil
1249 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1250 (defvar gnus-newsgroup-begin nil
)
1251 (defvar gnus-newsgroup-end nil
)
1252 (defvar gnus-newsgroup-last-rmail nil
)
1253 (defvar gnus-newsgroup-last-mail nil
)
1254 (defvar gnus-newsgroup-last-folder nil
)
1255 (defvar gnus-newsgroup-last-file nil
)
1256 (defvar gnus-newsgroup-last-directory nil
)
1257 (defvar gnus-newsgroup-auto-expire nil
)
1258 (defvar gnus-newsgroup-active nil
)
1260 (defvar gnus-newsgroup-data nil
)
1261 (defvar gnus-newsgroup-data-reverse nil
)
1262 (defvar gnus-newsgroup-limit nil
)
1263 (defvar gnus-newsgroup-limits nil
)
1264 (defvar gnus-summary-use-undownloaded-faces nil
)
1266 (defvar gnus-newsgroup-unreads nil
1267 "Sorted list of unread articles in the current newsgroup.")
1269 (defvar gnus-newsgroup-unselected nil
1270 "Sorted list of unselected unread articles in the current newsgroup.")
1272 (defvar gnus-newsgroup-reads nil
1273 "Alist of read articles and article marks in the current newsgroup.")
1275 (defvar gnus-newsgroup-expunged-tally nil
)
1277 (defvar gnus-newsgroup-marked nil
1278 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1280 (defvar gnus-newsgroup-spam-marked nil
1281 "List of ranges of articles that have been marked as spam.")
1283 (defvar gnus-newsgroup-killed nil
1284 "List of ranges of articles that have been through the scoring process.")
1286 (defvar gnus-newsgroup-cached nil
1287 "Sorted list of articles that come from the article cache.")
1289 (defvar gnus-newsgroup-saved nil
1290 "List of articles that have been saved.")
1292 (defvar gnus-newsgroup-kill-headers nil
)
1294 (defvar gnus-newsgroup-replied nil
1295 "List of articles that have been replied to in the current newsgroup.")
1297 (defvar gnus-newsgroup-forwarded nil
1298 "List of articles that have been forwarded in the current newsgroup.")
1300 (defvar gnus-newsgroup-recent nil
1301 "List of articles that have are recent in the current newsgroup.")
1303 (defvar gnus-newsgroup-expirable nil
1304 "Sorted list of articles in the current newsgroup that can be expired.")
1306 (defvar gnus-newsgroup-processable nil
1307 "List of articles in the current newsgroup that can be processed.")
1309 (defvar gnus-newsgroup-downloadable nil
1310 "Sorted list of articles in the current newsgroup that can be processed.")
1312 (defvar gnus-newsgroup-unfetched nil
1313 "Sorted list of articles in the current newsgroup whose headers have
1314 not been fetched into the agent.
1316 This list will always be a subset of gnus-newsgroup-undownloaded.")
1318 (defvar gnus-newsgroup-undownloaded nil
1319 "List of articles in the current newsgroup that haven't been downloaded.")
1321 (defvar gnus-newsgroup-unsendable nil
1322 "List of articles in the current newsgroup that won't be sent.")
1324 (defvar gnus-newsgroup-bookmarks nil
1325 "List of articles in the current newsgroup that have bookmarks.")
1327 (defvar gnus-newsgroup-dormant nil
1328 "Sorted list of dormant articles in the current newsgroup.")
1330 (defvar gnus-newsgroup-unseen nil
1331 "List of unseen articles in the current newsgroup.")
1333 (defvar gnus-newsgroup-seen nil
1334 "Range of seen articles in the current newsgroup.")
1336 (defvar gnus-newsgroup-articles nil
1337 "List of articles in the current newsgroup.")
1339 (defvar gnus-newsgroup-scored nil
1340 "List of scored articles in the current newsgroup.")
1342 (defvar gnus-newsgroup-headers nil
1343 "List of article headers in the current newsgroup.")
1345 (defvar gnus-newsgroup-threads nil
)
1347 (defvar gnus-newsgroup-prepared nil
1348 "Whether the current group has been prepared properly.")
1350 (defvar gnus-newsgroup-ancient nil
1351 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1353 (defvar gnus-newsgroup-sparse nil
)
1355 (defvar gnus-current-article nil
)
1356 (defvar gnus-article-current nil
)
1357 (defvar gnus-current-headers nil
)
1358 (defvar gnus-have-all-headers nil
)
1359 (defvar gnus-last-article nil
)
1360 (defvar gnus-newsgroup-history nil
)
1361 (defvar gnus-newsgroup-charset nil
)
1362 (defvar gnus-newsgroup-ephemeral-charset nil
)
1363 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1365 (defvar gnus-article-before-search nil
)
1367 (defvar gnus-summary-local-variables
1368 '(gnus-newsgroup-name
1369 gnus-newsgroup-begin gnus-newsgroup-end
1370 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1371 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1372 gnus-newsgroup-last-directory
1373 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1374 gnus-newsgroup-unselected gnus-newsgroup-marked
1375 gnus-newsgroup-spam-marked
1376 gnus-newsgroup-reads gnus-newsgroup-saved
1377 gnus-newsgroup-replied gnus-newsgroup-forwarded
1378 gnus-newsgroup-recent
1379 gnus-newsgroup-expirable
1380 gnus-newsgroup-processable gnus-newsgroup-killed
1381 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1382 gnus-newsgroup-unfetched
1383 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1384 gnus-newsgroup-seen gnus-newsgroup-articles
1385 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1386 gnus-newsgroup-headers gnus-newsgroup-threads
1387 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1388 gnus-current-article gnus-current-headers gnus-have-all-headers
1389 gnus-last-article gnus-article-internal-prepare-hook
1390 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1391 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1392 gnus-thread-expunge-below
1393 gnus-score-alist gnus-current-score-file
1394 (gnus-summary-expunge-below . global
)
1395 (gnus-summary-mark-below . global
)
1396 (gnus-orphan-score . global
)
1397 gnus-newsgroup-active gnus-scores-exclude-files
1398 gnus-newsgroup-history gnus-newsgroup-ancient
1399 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1400 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1401 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1402 (gnus-newsgroup-expunged-tally .
0)
1403 gnus-cache-removable-articles gnus-newsgroup-cached
1404 gnus-newsgroup-data gnus-newsgroup-data-reverse
1405 gnus-newsgroup-limit gnus-newsgroup-limits
1406 gnus-newsgroup-charset gnus-newsgroup-display
1407 gnus-summary-use-undownloaded-faces
)
1408 "Variables that are buffer-local to the summary buffers.")
1410 (defvar gnus-newsgroup-variables nil
1411 "A list of variables that have separate values in different newsgroups.
1412 A list of newsgroup (summary buffer) local variables, or cons of
1413 variables and their default expressions to be evalled (when the default
1414 values are not nil), that should be made global while the summary buffer
1417 Note: The default expressions will be evaluated (using function `eval')
1418 before assignment to the local variable rather than just assigned to it.
1419 If the default expression is the symbol `global', that symbol will not
1420 be evaluated but the global value of the local variable will be used
1423 These variables can be used to set variables in the group parameters
1424 while still allowing them to affect operations done in other buffers.
1427 \(setq gnus-newsgroup-variables
1428 '(message-use-followup-to
1429 (gnus-visible-headers .
1430 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1433 ;; Byte-compiler warning.
1435 ;; Bind features so that require will believe that gnus-sum has
1436 ;; already been loaded (avoids infinite recursion)
1437 (let ((features (cons 'gnus-sum features
)))
1438 ;; Several of the declarations in gnus-sum are needed to load the
1439 ;; following files. Right now, these definitions have been
1440 ;; compiled but not defined (evaluated). We could either do a
1441 ;; eval-and-compile about all of the declarations or evaluate the
1443 (if (boundp 'gnus-newsgroup-variables
)
1445 (load "gnus-sum.el" t t t
))
1447 (require 'gnus-agent
)
1448 (require 'gnus-art
)))
1452 (defvar gnus-decode-encoded-word-methods
1453 '(mail-decode-encoded-word-string)
1454 "List of methods used to decode encoded words.
1456 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1457 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1458 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1459 whose names match REGEXP.
1462 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1463 mail-decode-encoded-word-string
1464 (\"chinese\" . rfc1843-decode-string))")
1466 (defvar gnus-decode-encoded-word-methods-cache nil
)
1468 (defun gnus-multi-decode-encoded-word-string (string)
1469 "Apply the functions from `gnus-encoded-word-methods' that match."
1470 (unless (and gnus-decode-encoded-word-methods-cache
1471 (eq gnus-newsgroup-name
1472 (car gnus-decode-encoded-word-methods-cache
)))
1473 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1476 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1477 (if (and gnus-newsgroup-name
1478 (string-match (car x
) gnus-newsgroup-name
))
1479 (nconc gnus-decode-encoded-word-methods-cache
1481 gnus-decode-encoded-word-methods
))
1482 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1485 (setq string
(funcall (pop xlist
) string
))))
1488 ;; Subject simplification.
1490 (defun gnus-simplify-whitespace (str)
1491 "Remove excessive whitespace from STR."
1493 (while (string-match "[ \t][ \t]+" str
)
1494 (setq str
(concat (substring str
0 (match-beginning 0))
1496 (substring str
(match-end 0)))))
1498 (when (string-match "^[ \t]+" str
)
1499 (setq str
(substring str
(match-end 0))))
1501 (when (string-match "[ \t]+$" str
)
1502 (setq str
(substring str
0 (match-beginning 0))))
1505 (defun gnus-simplify-all-whitespace (str)
1506 "Remove all whitespace from STR."
1507 (while (string-match "[ \t\n]+" str
)
1508 (setq str
(replace-match "" nil nil str
)))
1511 (defsubst gnus-simplify-subject-re
(subject)
1512 "Remove \"Re:\" from subject lines."
1513 (if (string-match message-subject-re-regexp subject
)
1514 (substring subject
(match-end 0))
1517 (defun gnus-simplify-subject (subject &optional re-only
)
1518 "Remove `Re:' and words in parentheses.
1519 If RE-ONLY is non-nil, strip leading `Re:'s only."
1520 (let ((case-fold-search t
)) ;Ignore case.
1521 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1522 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1523 (setq subject
(substring subject
(match-end 0))))
1524 ;; Remove uninteresting prefixes.
1525 (when (and (not re-only
)
1526 gnus-simplify-ignored-prefixes
1527 (string-match gnus-simplify-ignored-prefixes subject
))
1528 (setq subject
(substring subject
(match-end 0))))
1529 ;; Remove words in parentheses from end.
1531 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1532 (setq subject
(substring subject
0 (match-beginning 0)))))
1533 ;; Return subject string.
1536 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1538 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1539 (goto-char (point-min))
1540 (while (re-search-forward regexp nil t
)
1541 (replace-match (or newtext
""))))
1543 (defun gnus-simplify-buffer-fuzzy ()
1544 "Simplify string in the buffer fuzzily.
1545 The string in the accessible portion of the current buffer is simplified.
1546 It is assumed to be a single-line subject.
1547 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1548 matter is removed. Additional things can be deleted by setting
1549 `gnus-simplify-subject-fuzzy-regexp'."
1550 (let ((case-fold-search t
)
1552 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1554 (while (not (eq modified-tick
(buffer-modified-tick)))
1555 (setq modified-tick
(buffer-modified-tick))
1557 ((listp gnus-simplify-subject-fuzzy-regexp
)
1558 (mapcar 'gnus-simplify-buffer-fuzzy-step
1559 gnus-simplify-subject-fuzzy-regexp
))
1560 (gnus-simplify-subject-fuzzy-regexp
1561 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1562 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1563 (gnus-simplify-buffer-fuzzy-step
1564 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1565 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1567 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1568 (gnus-simplify-buffer-fuzzy-step " +" " ")
1569 (gnus-simplify-buffer-fuzzy-step " $")
1570 (gnus-simplify-buffer-fuzzy-step "^ +")))
1572 (defun gnus-simplify-subject-fuzzy (subject)
1573 "Simplify a subject string fuzzily.
1574 See `gnus-simplify-buffer-fuzzy' for details."
1576 (gnus-set-work-buffer)
1577 (let ((case-fold-search t
))
1578 ;; Remove uninteresting prefixes.
1579 (when (and gnus-simplify-ignored-prefixes
1580 (string-match gnus-simplify-ignored-prefixes subject
))
1581 (setq subject
(substring subject
(match-end 0))))
1583 (inline (gnus-simplify-buffer-fuzzy))
1586 (defsubst gnus-simplify-subject-fully
(subject)
1587 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1589 (gnus-simplify-subject-functions
1590 (gnus-map-function gnus-simplify-subject-functions subject
))
1591 ((null gnus-summary-gather-subject-limit
)
1592 (gnus-simplify-subject-re subject
))
1593 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1594 (gnus-simplify-subject-fuzzy subject
))
1595 ((numberp gnus-summary-gather-subject-limit
)
1596 (gnus-limit-string (gnus-simplify-subject-re subject
)
1597 gnus-summary-gather-subject-limit
))
1601 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1602 "Check whether two subjects are equal.
1603 If optional argument SIMPLE-FIRST is t, first argument is already
1606 ((null simple-first
)
1607 (equal (gnus-simplify-subject-fully s1
)
1608 (gnus-simplify-subject-fully s2
)))
1611 (gnus-simplify-subject-fully s2
)))))
1613 (defun gnus-summary-bubble-group ()
1614 "Increase the score of the current group.
1615 This is a handy function to add to `gnus-summary-exit-hook' to
1616 increase the score of each group you read."
1617 (gnus-group-add-score gnus-newsgroup-name
))
1621 ;;; Gnus summary mode
1624 (put 'gnus-summary-mode
'mode-class
'special
)
1626 (defvar gnus-article-commands-menu
)
1628 ;; Non-orthogonal keys
1630 (gnus-define-keys gnus-summary-mode-map
1631 " " gnus-summary-next-page
1632 "\177" gnus-summary-prev-page
1633 [delete] gnus-summary-prev-page
1634 [backspace] gnus-summary-prev-page
1635 "\r" gnus-summary-scroll-up
1636 "\M-\r" gnus-summary-scroll-down
1637 "n" gnus-summary-next-unread-article
1638 "p" gnus-summary-prev-unread-article
1639 "N" gnus-summary-next-article
1640 "P" gnus-summary-prev-article
1641 "\M-\C-n" gnus-summary-next-same-subject
1642 "\M-\C-p" gnus-summary-prev-same-subject
1643 "\M-n" gnus-summary-next-unread-subject
1644 "\M-p" gnus-summary-prev-unread-subject
1645 "." gnus-summary-first-unread-article
1646 "," gnus-summary-best-unread-article
1647 "\M-s" gnus-summary-search-article-forward
1648 "\M-r" gnus-summary-search-article-backward
1649 "<" gnus-summary-beginning-of-article
1650 ">" gnus-summary-end-of-article
1651 "j" gnus-summary-goto-article
1652 "^" gnus-summary-refer-parent-article
1653 "\M-^" gnus-summary-refer-article
1654 "u" gnus-summary-tick-article-forward
1655 "!" gnus-summary-tick-article-forward
1656 "U" gnus-summary-tick-article-backward
1657 "d" gnus-summary-mark-as-read-forward
1658 "D" gnus-summary-mark-as-read-backward
1659 "E" gnus-summary-mark-as-expirable
1660 "\M-u" gnus-summary-clear-mark-forward
1661 "\M-U" gnus-summary-clear-mark-backward
1662 "k" gnus-summary-kill-same-subject-and-select
1663 "\C-k" gnus-summary-kill-same-subject
1664 "\M-\C-k" gnus-summary-kill-thread
1665 "\M-\C-l" gnus-summary-lower-thread
1666 "e" gnus-summary-edit-article
1667 "#" gnus-summary-mark-as-processable
1668 "\M-#" gnus-summary-unmark-as-processable
1669 "\M-\C-t" gnus-summary-toggle-threads
1670 "\M-\C-s" gnus-summary-show-thread
1671 "\M-\C-h" gnus-summary-hide-thread
1672 "\M-\C-f" gnus-summary-next-thread
1673 "\M-\C-b" gnus-summary-prev-thread
1674 [(meta down)] gnus-summary-next-thread
1675 [(meta up)] gnus-summary-prev-thread
1676 "\M-\C-u" gnus-summary-up-thread
1677 "\M-\C-d" gnus-summary-down-thread
1678 "&" gnus-summary-execute-command
1679 "c" gnus-summary-catchup-and-exit
1680 "\C-w" gnus-summary-mark-region-as-read
1681 "\C-t" gnus-summary-toggle-truncation
1682 "?" gnus-summary-mark-as-dormant
1683 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1684 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1685 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1686 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1687 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1688 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1689 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1690 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1691 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1692 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1693 "=" gnus-summary-expand-window
1694 "\C-x\C-s" gnus-summary-reselect-current-group
1695 "\M-g" gnus-summary-rescan-group
1696 "w" gnus-summary-stop-page-breaking
1697 "\C-c\C-r" gnus-summary-caesar-message
1698 "f" gnus-summary-followup
1699 "F" gnus-summary-followup-with-original
1700 "C" gnus-summary-cancel-article
1701 "r" gnus-summary-reply
1702 "R" gnus-summary-reply-with-original
1703 "\C-c\C-f" gnus-summary-mail-forward
1704 "o" gnus-summary-save-article
1705 "\C-o" gnus-summary-save-article-mail
1706 "|" gnus-summary-pipe-output
1707 "\M-k" gnus-summary-edit-local-kill
1708 "\M-K" gnus-summary-edit-global-kill
1710 "\C-c\C-d" gnus-summary-describe-group
1711 "q" gnus-summary-exit
1712 "Q" gnus-summary-exit-no-update
1713 "\C-c\C-i" gnus-info-find-node
1714 gnus-mouse-2 gnus-mouse-pick-article
1715 [follow-link] mouse-face
1716 "m" gnus-summary-mail-other-window
1717 "a" gnus-summary-post-news
1718 "i" gnus-summary-news-other-window
1719 "x" gnus-summary-limit-to-unread
1720 "s" gnus-summary-isearch-article
1721 "t" gnus-summary-toggle-header
1722 "g" gnus-summary-show-article
1723 "l" gnus-summary-goto-last-article
1724 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1725 "\C-d" gnus-summary-enter-digest-group
1726 "\M-\C-d" gnus-summary-read-document
1727 "\M-\C-e" gnus-summary-edit-parameters
1728 "\M-\C-a" gnus-summary-customize-parameters
1730 "*" gnus-cache-enter-article
1731 "\M-*" gnus-cache-remove-article
1732 "\M-&" gnus-summary-universal-argument
1733 "\C-l" gnus-recenter
1734 "I" gnus-summary-increase-score
1735 "L" gnus-summary-lower-score
1736 "\M-i" gnus-symbolic-argument
1737 "h" gnus-summary-select-article-buffer
1739 "b" gnus-article-view-part
1740 "\M-t" gnus-summary-toggle-display-buttonized
1742 "V" gnus-summary-score-map
1743 "X" gnus-uu-extract-map
1744 "S" gnus-summary-send-map)
1746 ;; Sort of orthogonal keymap
1747 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1748 "t" gnus-summary-tick-article-forward
1749 "!" gnus-summary-tick-article-forward
1750 "d" gnus-summary-mark-as-read-forward
1751 "r" gnus-summary-mark-as-read-forward
1752 "c" gnus-summary-clear-mark-forward
1753 " " gnus-summary-clear-mark-forward
1754 "e" gnus-summary-mark-as-expirable
1755 "x" gnus-summary-mark-as-expirable
1756 "?" gnus-summary-mark-as-dormant
1757 "b" gnus-summary-set-bookmark
1758 "B" gnus-summary-remove-bookmark
1759 "#" gnus-summary-mark-as-processable
1760 "\M-#" gnus-summary-unmark-as-processable
1761 "S" gnus-summary-limit-include-expunged
1762 "C" gnus-summary-catchup
1763 "H" gnus-summary-catchup-to-here
1764 "h" gnus-summary-catchup-from-here
1765 "\C-c" gnus-summary-catchup-all
1766 "k" gnus-summary-kill-same-subject-and-select
1767 "K" gnus-summary-kill-same-subject
1768 "P" gnus-uu-mark-map)
1770 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1771 "c" gnus-summary-clear-above
1772 "u" gnus-summary-tick-above
1773 "m" gnus-summary-mark-above
1774 "k" gnus-summary-kill-below)
1776 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1777 "/" gnus-summary-limit-to-subject
1778 "n" gnus-summary-limit-to-articles
1779 "w" gnus-summary-pop-limit
1780 "s" gnus-summary-limit-to-subject
1781 "a" gnus-summary-limit-to-author
1782 "u" gnus-summary-limit-to-unread
1783 "m" gnus-summary-limit-to-marks
1784 "M" gnus-summary-limit-exclude-marks
1785 "v" gnus-summary-limit-to-score
1786 "*" gnus-summary-limit-include-cached
1787 "D" gnus-summary-limit-include-dormant
1788 "T" gnus-summary-limit-include-thread
1789 "d" gnus-summary-limit-exclude-dormant
1790 "t" gnus-summary-limit-to-age
1791 "." gnus-summary-limit-to-unseen
1792 "x" gnus-summary-limit-to-extra
1793 "p" gnus-summary-limit-to-display-predicate
1794 "E" gnus-summary-limit-include-expunged
1795 "c" gnus-summary-limit-exclude-childless-dormant
1796 "C" gnus-summary-limit-mark-excluded-as-read
1797 "o" gnus-summary-insert-old-articles
1798 "N" gnus-summary-insert-new-articles)
1800 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1801 "n" gnus-summary-next-unread-article
1802 "p" gnus-summary-prev-unread-article
1803 "N" gnus-summary-next-article
1804 "P" gnus-summary-prev-article
1805 "\C-n" gnus-summary-next-same-subject
1806 "\C-p" gnus-summary-prev-same-subject
1807 "\M-n" gnus-summary-next-unread-subject
1808 "\M-p" gnus-summary-prev-unread-subject
1809 "f" gnus-summary-first-unread-article
1810 "b" gnus-summary-best-unread-article
1811 "j" gnus-summary-goto-article
1812 "g" gnus-summary-goto-subject
1813 "l" gnus-summary-goto-last-article
1814 "o" gnus-summary-pop-article)
1816 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1817 "k" gnus-summary-kill-thread
1818 "l" gnus-summary-lower-thread
1819 "i" gnus-summary-raise-thread
1820 "T" gnus-summary-toggle-threads
1821 "t" gnus-summary-rethread-current
1822 "^" gnus-summary-reparent-thread
1823 "s" gnus-summary-show-thread
1824 "S" gnus-summary-show-all-threads
1825 "h" gnus-summary-hide-thread
1826 "H" gnus-summary-hide-all-threads
1827 "n" gnus-summary-next-thread
1828 "p" gnus-summary-prev-thread
1829 "u" gnus-summary-up-thread
1830 "o" gnus-summary-top-thread
1831 "d" gnus-summary-down-thread
1832 "#" gnus-uu-mark-thread
1833 "\M-#" gnus-uu-unmark-thread)
1835 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1836 "g" gnus-summary-prepare
1837 "c" gnus-summary-insert-cached-articles
1838 "d" gnus-summary-insert-dormant-articles)
1840 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1841 "c" gnus-summary-catchup-and-exit
1842 "C" gnus-summary-catchup-all-and-exit
1843 "E" gnus-summary-exit-no-update
1844 "Q" gnus-summary-exit
1845 "Z" gnus-summary-exit
1846 "n" gnus-summary-catchup-and-goto-next-group
1847 "R" gnus-summary-reselect-current-group
1848 "G" gnus-summary-rescan-group
1849 "N" gnus-summary-next-group
1850 "s" gnus-summary-save-newsrc
1851 "P" gnus-summary-prev-group)
1853 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1854 " " gnus-summary-next-page
1855 "n" gnus-summary-next-page
1856 "\177" gnus-summary-prev-page
1857 [delete] gnus-summary-prev-page
1858 "p" gnus-summary-prev-page
1859 "\r" gnus-summary-scroll-up
1860 "\M-\r" gnus-summary-scroll-down
1861 "<" gnus-summary-beginning-of-article
1862 ">" gnus-summary-end-of-article
1863 "b" gnus-summary-beginning-of-article
1864 "e" gnus-summary-end-of-article
1865 "^" gnus-summary-refer-parent-article
1866 "r" gnus-summary-refer-parent-article
1867 "D" gnus-summary-enter-digest-group
1868 "R" gnus-summary-refer-references
1869 "T" gnus-summary-refer-thread
1870 "g" gnus-summary-show-article
1871 "s" gnus-summary-isearch-article
1872 "P" gnus-summary-print-article
1873 "M" gnus-mailing-list-insinuate
1874 "t" gnus-article-babel
)
1876 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1877 "b" gnus-article-add-buttons
1878 "B" gnus-article-add-buttons-to-head
1879 "o" gnus-article-treat-overstrike
1880 "e" gnus-article-emphasize
1881 "w" gnus-article-fill-cited-article
1882 "Q" gnus-article-fill-long-lines
1883 "C" gnus-article-capitalize-sentences
1884 "c" gnus-article-remove-cr
1885 "q" gnus-article-de-quoted-unreadable
1886 "6" gnus-article-de-base64-unreadable
1887 "Z" gnus-article-decode-HZ
1888 "h" gnus-article-wash-html
1889 "u" gnus-article-unsplit-urls
1890 "s" gnus-summary-force-verify-and-decrypt
1891 "f" gnus-article-display-x-face
1892 "l" gnus-summary-stop-page-breaking
1893 "r" gnus-summary-caesar-message
1894 "m" gnus-summary-morse-message
1895 "t" gnus-summary-toggle-header
1896 "g" gnus-treat-smiley
1897 "v" gnus-summary-verbose-headers
1898 "a" gnus-article-strip-headers-in-body
;; mnemonic: wash archive
1899 "p" gnus-article-verify-x-pgp-sig
1900 "d" gnus-article-treat-dumbquotes
)
1902 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map
)
1903 ;; mnemonic: deuglif*Y*
1904 "u" gnus-article-outlook-unwrap-lines
1905 "a" gnus-article-outlook-repair-attribution
1906 "c" gnus-article-outlook-rearrange-citation
1907 "f" gnus-article-outlook-deuglify-article
) ;; mnemonic: full deuglify
1909 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1910 "a" gnus-article-hide
1911 "h" gnus-article-hide-headers
1912 "b" gnus-article-hide-boring-headers
1913 "s" gnus-article-hide-signature
1914 "c" gnus-article-hide-citation
1915 "C" gnus-article-hide-citation-in-followups
1916 "l" gnus-article-hide-list-identifiers
1917 "B" gnus-article-strip-banner
1918 "P" gnus-article-hide-pem
1919 "\C-c" gnus-article-hide-citation-maybe
)
1921 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1922 "a" gnus-article-highlight
1923 "h" gnus-article-highlight-headers
1924 "c" gnus-article-highlight-citation
1925 "s" gnus-article-highlight-signature
)
1927 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map
)
1928 "f" gnus-article-treat-fold-headers
1929 "u" gnus-article-treat-unfold-headers
1930 "n" gnus-article-treat-fold-newsgroups
)
1932 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map
)
1933 "x" gnus-article-display-x-face
1934 "d" gnus-article-display-face
1935 "s" gnus-treat-smiley
1936 "D" gnus-article-remove-images
1937 "f" gnus-treat-from-picon
1938 "m" gnus-treat-mail-picon
1939 "n" gnus-treat-newsgroups-picon
)
1941 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1942 "w" gnus-article-decode-mime-words
1943 "c" gnus-article-decode-charset
1944 "v" gnus-mime-view-all-parts
1945 "b" gnus-article-view-part
)
1947 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1948 "z" gnus-article-date-ut
1949 "u" gnus-article-date-ut
1950 "l" gnus-article-date-local
1951 "p" gnus-article-date-english
1952 "e" gnus-article-date-lapsed
1953 "o" gnus-article-date-original
1954 "i" gnus-article-date-iso8601
1955 "s" gnus-article-date-user
)
1957 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1958 "t" gnus-article-remove-trailing-blank-lines
1959 "l" gnus-article-strip-leading-blank-lines
1960 "m" gnus-article-strip-multiple-blank-lines
1961 "a" gnus-article-strip-blank-lines
1962 "A" gnus-article-strip-all-blank-lines
1963 "s" gnus-article-strip-leading-space
1964 "e" gnus-article-strip-trailing-space
1965 "w" gnus-article-remove-leading-whitespace
)
1967 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1969 "f" gnus-summary-fetch-faq
1970 "d" gnus-summary-describe-group
1971 "h" gnus-summary-describe-briefly
1972 "i" gnus-info-find-node
1973 "c" gnus-group-fetch-charter
1974 "C" gnus-group-fetch-control
)
1976 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1977 "e" gnus-summary-expire-articles
1978 "\M-\C-e" gnus-summary-expire-articles-now
1979 "\177" gnus-summary-delete-article
1980 [delete] gnus-summary-delete-article
1981 [backspace] gnus-summary-delete-article
1982 "m" gnus-summary-move-article
1983 "r" gnus-summary-respool-article
1984 "w" gnus-summary-edit-article
1985 "c" gnus-summary-copy-article
1986 "B" gnus-summary-crosspost-article
1987 "q" gnus-summary-respool-query
1988 "t" gnus-summary-respool-trace
1989 "i" gnus-summary-import-article
1990 "I" gnus-summary-create-article
1991 "p" gnus-summary-article-posted-p)
1993 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1994 "o" gnus-summary-save-article
1995 "m" gnus-summary-save-article-mail
1996 "F" gnus-summary-write-article-file
1997 "r" gnus-summary-save-article-rmail
1998 "f" gnus-summary-save-article-file
1999 "b" gnus-summary-save-article-body-file
2000 "B" gnus-summary-write-article-body-file
2001 "h" gnus-summary-save-article-folder
2002 "v" gnus-summary-save-article-vm
2003 "p" gnus-summary-pipe-output
2004 "P" gnus-summary-muttprint
2005 "s" gnus-soup-add-article)
2007 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2008 "b" gnus-summary-display-buttonized
2009 "m" gnus-summary-repair-multipart
2010 "v" gnus-article-view-part
2011 "o" gnus-article-save-part
2012 "c" gnus-article-copy-part
2013 "C" gnus-article-view-part-as-charset
2014 "e" gnus-article-view-part-externally
2015 "E" gnus-article-encrypt-body
2016 "i" gnus-article-inline-part
2017 "|" gnus-article-pipe-part)
2019 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2020 "p" gnus-summary-mark-as-processable
2021 "u" gnus-summary-unmark-as-processable
2022 "U" gnus-summary-unmark-all-processable
2023 "v" gnus-uu-mark-over
2024 "s" gnus-uu-mark-series
2025 "r" gnus-uu-mark-region
2026 "g" gnus-uu-unmark-region
2027 "R" gnus-uu-mark-by-regexp
2028 "G" gnus-uu-unmark-by-regexp
2029 "t" gnus-uu-mark-thread
2030 "T" gnus-uu-unmark-thread
2031 "a" gnus-uu-mark-all
2032 "b" gnus-uu-mark-buffer
2033 "S" gnus-uu-mark-sparse
2034 "k" gnus-summary-kill-process-mark
2035 "y" gnus-summary-yank-process-mark
2036 "w" gnus-summary-save-process-mark
2037 "i" gnus-uu-invert-processable)
2039 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2040 ;;"x" gnus-uu-extract-any
2041 "m" gnus-summary-save-parts
2042 "u" gnus-uu-decode-uu
2043 "U" gnus-uu-decode-uu-and-save
2044 "s" gnus-uu-decode-unshar
2045 "S" gnus-uu-decode-unshar-and-save
2046 "o" gnus-uu-decode-save
2047 "O" gnus-uu-decode-save
2048 "b" gnus-uu-decode-binhex
2049 "B" gnus-uu-decode-binhex
2050 "p" gnus-uu-decode-postscript
2051 "P" gnus-uu-decode-postscript-and-save)
2054 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2055 "u" gnus-uu-decode-uu-view
2056 "U" gnus-uu-decode-uu-and-save-view
2057 "s" gnus-uu-decode-unshar-view
2058 "S" gnus-uu-decode-unshar-and-save-view
2059 "o" gnus-uu-decode-save-view
2060 "O" gnus-uu-decode-save-view
2061 "b" gnus-uu-decode-binhex-view
2062 "B" gnus-uu-decode-binhex-view
2063 "p" gnus-uu-decode-postscript-view
2064 "P" gnus-uu-decode-postscript-and-save-view)
2066 (defvar gnus-article-post-menu nil)
2068 (defconst gnus-summary-menu-maxlen 20)
2070 (defun gnus-summary-menu-split (menu)
2071 ;; If we have lots of elements, divide them into groups of 20
2072 ;; and make a pane (or submenu) for each one.
2073 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2074 (let ((menu menu) sublists next
2077 ;; Pull off the next gnus-summary-menu-maxlen elements
2078 ;; and make them the next element of sublist.
2079 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2081 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2083 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2084 (aref (car (last menu)) 0)) menu)
2088 (nreverse sublists))
2089 ;; Few elements--put them all in one pane.
2092 (defun gnus-summary-make-menu-bar ()
2093 (gnus-turn-off-edit-menu 'summary)
2095 (unless (boundp 'gnus-summary-misc-menu)
2098 gnus-summary-kill-menu gnus-summary-mode-map ""
2103 ["Customize" gnus-score-customize t])
2104 (gnus-make-score-map 'increase)
2105 (gnus-make-score-map 'lower)
2107 ["Kill below" gnus-summary-kill-below t]
2108 ["Mark above" gnus-summary-mark-above t]
2109 ["Tick above" gnus-summary-tick-above t]
2110 ["Clear above" gnus-summary-clear-above t])
2111 ["Current score" gnus-summary-current-score t]
2112 ["Set score" gnus-summary-set-score t]
2113 ["Switch current score file..." gnus-score-change-score-file t]
2114 ["Set mark below..." gnus-score-set-mark-below t]
2115 ["Set expunge below..." gnus-score-set-expunge-below t]
2116 ["Edit current score file" gnus-score-edit-current-scores t]
2117 ["Edit score file" gnus-score-edit-file t]
2118 ["Trace score" gnus-score-find-trace t]
2119 ["Find words" gnus-score-find-favourite-words t]
2120 ["Rescore buffer" gnus-summary-rescore t]
2121 ["Increase score..." gnus-summary-increase-score t]
2122 ["Lower score..." gnus-summary-lower-score t]))))
2124 ;; Define both the Article menu in the summary buffer and the
2125 ;; equivalent Commands menu in the article buffer here for
2129 ["All" gnus-article-hide t]
2130 ["Headers" gnus-article-hide-headers t]
2131 ["Signature" gnus-article-hide-signature t]
2132 ["Citation" gnus-article-hide-citation t]
2133 ["List identifiers" gnus-article-hide-list-identifiers t]
2134 ["Banner" gnus-article-strip-banner t]
2135 ["Boring headers" gnus-article-hide-boring-headers t])
2137 ["All" gnus-article-highlight t]
2138 ["Headers" gnus-article-highlight-headers t]
2139 ["Signature" gnus-article-highlight-signature t]
2140 ["Citation" gnus-article-highlight-citation t])
2142 ["Words" gnus-article-decode-mime-words t]
2143 ["Charset" gnus-article-decode-charset t]
2144 ["QP" gnus-article-de-quoted-unreadable t]
2145 ["Base64" gnus-article-de-base64-unreadable t]
2146 ["View MIME buttons" gnus-summary-display-buttonized t]
2147 ["View all" gnus-mime-view-all-parts t]
2148 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2149 ["Encrypt body" gnus-article-encrypt-body
2150 :active (not (gnus-group-read-only-p))
2151 ,@(if (featurep 'xemacs) nil
2152 '(:help "Encrypt the message body on disk"))]
2153 ["Extract all parts..." gnus-summary-save-parts t]
2155 ["Repair multipart" gnus-summary-repair-multipart t]
2156 ["Pipe part..." gnus-article-pipe-part t]
2157 ["Inline part" gnus-article-inline-part t]
2158 ["Encrypt body" gnus-article-encrypt-body
2159 :active (not (gnus-group-read-only-p))
2160 ,@(if (featurep 'xemacs) nil
2161 '(:help "Encrypt the message body on disk"))]
2162 ["View part externally" gnus-article-view-part-externally t]
2163 ["View part with charset..." gnus-article-view-part-as-charset t]
2164 ["Copy part" gnus-article-copy-part t]
2165 ["Save part..." gnus-article-save-part t]
2166 ["View part" gnus-article-view-part t]))
2168 ["Local" gnus-article-date-local t]
2169 ["ISO8601" gnus-article-date-iso8601 t]
2170 ["UT" gnus-article-date-ut t]
2171 ["Original" gnus-article-date-original t]
2172 ["Lapsed" gnus-article-date-lapsed t]
2173 ["User-defined" gnus-article-date-user t])
2175 ["Remove images" gnus-article-remove-images t]
2176 ["Toggle smiley" gnus-treat-smiley t]
2177 ["Show X-Face" gnus-article-display-x-face t]
2178 ["Show picons in From" gnus-treat-from-picon t]
2179 ["Show picons in mail headers" gnus-treat-mail-picon t]
2180 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2181 ("View as different encoding"
2182 ,@(gnus-summary-menu-split
2185 ;; Since easymenu under Emacs doesn't allow
2186 ;; lambda forms for menu commands, we should
2187 ;; provide intern'ed function symbols.
2188 (let ((command (intern (format "\
2189 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2193 (let ((gnus-summary-show-article-charset-alist
2195 (gnus-summary-show-article 1))))
2196 `[,(symbol-name cs) ,command t]))
2197 (sort (if (fboundp 'coding-system-list)
2198 (coding-system-list)
2199 (mapcar 'car mm-mime-mule-charset-alist))
2203 ["Leading" gnus-article-strip-leading-blank-lines t]
2204 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2205 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2206 ["All of the above" gnus-article-strip-blank-lines t]
2207 ["All" gnus-article-strip-all-blank-lines t]
2208 ["Leading space" gnus-article-strip-leading-space t]
2209 ["Trailing space" gnus-article-strip-trailing-space t]
2210 ["Leading space in headers"
2211 gnus-article-remove-leading-whitespace t])
2212 ["Overstrike" gnus-article-treat-overstrike t]
2213 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2214 ["Emphasis" gnus-article-emphasize t]
2215 ["Word wrap" gnus-article-fill-cited-article t]
2216 ["Fill long lines" gnus-article-fill-long-lines t]
2217 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2218 ["Remove CR" gnus-article-remove-cr t]
2219 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2220 ["Base64" gnus-article-de-base64-unreadable t]
2221 ["Rot 13" gnus-summary-caesar-message
2222 ,@(if (featurep 'xemacs) '(t)
2223 '(:help "\"Caesar rotate\" article by 13"))]
2224 ["Morse decode" gnus-summary-morse-message t]
2225 ["Unix pipe..." gnus-summary-pipe-message t]
2226 ["Add buttons" gnus-article-add-buttons t]
2227 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2228 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2229 ["Verbose header" gnus-summary-verbose-headers t]
2230 ["Toggle header" gnus-summary-toggle-header t]
2231 ["Unfold headers" gnus-article-treat-unfold-headers t]
2232 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2233 ["Html" gnus-article-wash-html t]
2234 ["Unsplit URLs" gnus-article-unsplit-urls t]
2235 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2236 ["Decode HZ" gnus-article-decode-HZ t]
2237 ("(Outlook) Deuglify"
2238 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2239 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2240 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2241 ["Full (Outlook) deuglify"
2242 gnus-article-outlook-deuglify-article t])
2245 ["Save in default format..." gnus-summary-save-article
2246 ,@(if (featurep 'xemacs) '(t)
2247 '(:help "Save article using default method"))]
2248 ["Save in file..." gnus-summary-save-article-file
2249 ,@(if (featurep 'xemacs) '(t)
2250 '(:help "Save article in file"))]
2251 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2252 ["Save in MH folder..." gnus-summary-save-article-folder t]
2253 ["Save in VM folder..." gnus-summary-save-article-vm t]
2254 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2255 ["Save body in file..." gnus-summary-save-article-body-file t]
2256 ["Pipe through a filter..." gnus-summary-pipe-output t]
2257 ["Add to SOUP packet" gnus-soup-add-article t]
2258 ["Print with Muttprint..." gnus-summary-muttprint t]
2259 ["Print" gnus-summary-print-article
2260 ,@(if (featurep 'xemacs) '(t)
2261 '(:help "Generate and print a PostScript image"))])
2262 ("Copy, move,... (Backend)"
2263 ,@(if (featurep 'xemacs) nil
2264 '(:help "Copying, moving, expiring articles..."))
2265 ["Respool article..." gnus-summary-respool-article t]
2266 ["Move article..." gnus-summary-move-article
2267 (gnus-check-backend-function
2268 'request-move-article gnus-newsgroup-name)]
2269 ["Copy article..." gnus-summary-copy-article t]
2270 ["Crosspost article..." gnus-summary-crosspost-article
2271 (gnus-check-backend-function
2272 'request-replace-article gnus-newsgroup-name)]
2273 ["Import file..." gnus-summary-import-article
2274 (gnus-check-backend-function
2275 'request-accept-article gnus-newsgroup-name)]
2276 ["Create article..." gnus-summary-create-article
2277 (gnus-check-backend-function
2278 'request-accept-article gnus-newsgroup-name)]
2279 ["Check if posted" gnus-summary-article-posted-p t]
2280 ["Edit article" gnus-summary-edit-article
2281 (not (gnus-group-read-only-p))]
2282 ["Delete article" gnus-summary-delete-article
2283 (gnus-check-backend-function
2284 'request-expire-articles gnus-newsgroup-name)]
2285 ["Query respool" gnus-summary-respool-query t]
2286 ["Trace respool" gnus-summary-respool-trace t]
2287 ["Delete expirable articles" gnus-summary-expire-articles-now
2288 (gnus-check-backend-function
2289 'request-expire-articles gnus-newsgroup-name)])
2291 ["Uudecode" gnus-uu-decode-uu
2292 ,@(if (featurep 'xemacs) '(t)
2293 '(:help "Decode uuencoded article(s)"))]
2294 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2295 ["Unshar" gnus-uu-decode-unshar t]
2296 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2297 ["Save" gnus-uu-decode-save t]
2298 ["Binhex" gnus-uu-decode-binhex t]
2299 ["Postscript" gnus-uu-decode-postscript t]
2300 ["All MIME parts" gnus-summary-save-parts t])
2302 ["Enter article" gnus-cache-enter-article t]
2303 ["Remove article" gnus-cache-remove-article t])
2304 ["Translate" gnus-article-babel t]
2305 ["Select article buffer" gnus-summary-select-article-buffer t]
2306 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2307 ["Isearch article..." gnus-summary-isearch-article t]
2308 ["Beginning of the article" gnus-summary-beginning-of-article t]
2309 ["End of the article" gnus-summary-end-of-article t]
2310 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2311 ["Fetch referenced articles" gnus-summary-refer-references t]
2312 ["Fetch current thread" gnus-summary-refer-thread t]
2313 ["Fetch article with id..." gnus-summary-refer-article t]
2314 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2315 ["Redisplay" gnus-summary-show-article t]
2316 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2318 gnus-summary-article-menu gnus-summary-mode-map ""
2319 (cons "Article" innards))
2321 (if (not (keymapp gnus-summary-article-menu))
2323 gnus-article-commands-menu gnus-article-mode-map ""
2324 (cons "Commands" innards))
2325 ;; in Emacs, don't share menu.
2326 (setq gnus-article-commands-menu
2327 (copy-keymap gnus-summary-article-menu))
2328 (define-key gnus-article-mode-map [menu-bar commands]
2329 (cons "Commands" gnus-article-commands-menu))))
2332 gnus-summary-thread-menu gnus-summary-mode-map ""
2334 ["Find all messages in thread" gnus-summary-refer-thread t]
2335 ["Toggle threading" gnus-summary-toggle-threads t]
2336 ["Hide threads" gnus-summary-hide-all-threads t]
2337 ["Show threads" gnus-summary-show-all-threads t]
2338 ["Hide thread" gnus-summary-hide-thread t]
2339 ["Show thread" gnus-summary-show-thread t]
2340 ["Go to next thread" gnus-summary-next-thread t]
2341 ["Go to previous thread" gnus-summary-prev-thread t]
2342 ["Go down thread" gnus-summary-down-thread t]
2343 ["Go up thread" gnus-summary-up-thread t]
2344 ["Top of thread" gnus-summary-top-thread t]
2345 ["Mark thread as read" gnus-summary-kill-thread t]
2346 ["Lower thread score" gnus-summary-lower-thread t]
2347 ["Raise thread score" gnus-summary-raise-thread t]
2348 ["Rethread current" gnus-summary-rethread-current t]))
2351 gnus-summary-post-menu gnus-summary-mode-map ""
2353 ["Send a message (mail or news)" gnus-summary-post-news
2354 ,@(if (featurep 'xemacs) '(t)
2355 '(:help "Compose a new message (mail or news)"))]
2356 ["Followup" gnus-summary-followup
2357 ,@(if (featurep 'xemacs) '(t)
2358 '(:help "Post followup to this article"))]
2359 ["Followup and yank" gnus-summary-followup-with-original
2360 ,@(if (featurep 'xemacs) '(t)
2361 '(:help "Post followup to this article, quoting its contents"))]
2362 ["Supersede article" gnus-summary-supersede-article t]
2363 ["Cancel article" gnus-summary-cancel-article
2364 ,@(if (featurep 'xemacs) '(t)
2365 '(:help "Cancel an article you posted"))]
2366 ["Reply" gnus-summary-reply t]
2367 ["Reply and yank" gnus-summary-reply-with-original t]
2368 ["Wide reply" gnus-summary-wide-reply t]
2369 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2370 ,@(if (featurep 'xemacs) '(t)
2371 '(:help "Mail a reply, quoting this article"))]
2372 ["Very wide reply" gnus-summary-very-wide-reply t]
2373 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2374 ,@(if (featurep 'xemacs) '(t)
2375 '(:help "Mail a very wide reply, quoting this article"))]
2376 ["Mail forward" gnus-summary-mail-forward t]
2377 ["Post forward" gnus-summary-post-forward t]
2378 ["Digest and mail" gnus-uu-digest-mail-forward t]
2379 ["Digest and post" gnus-uu-digest-post-forward t]
2380 ["Resend message" gnus-summary-resend-message t]
2381 ["Resend message edit" gnus-summary-resend-message-edit t]
2382 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2383 ["Send a mail" gnus-summary-mail-other-window t]
2384 ["Create a local message" gnus-summary-news-other-window t]
2385 ["Uuencode and post" gnus-uu-post-news
2386 ,@(if (featurep 'xemacs) '(t)
2387 '(:help "Post a uuencoded article"))]
2388 ["Followup via news" gnus-summary-followup-to-mail t]
2389 ["Followup via news and yank"
2390 gnus-summary-followup-to-mail-with-original t]
2392 ;;["Send" gnus-summary-send-draft t]
2393 ;;["Send bounced" gnus-resend-bounced-mail t])
2397 ((not (keymapp gnus-summary-post-menu))
2398 (setq gnus-article-post-menu gnus-summary-post-menu))
2399 ((not gnus-article-post-menu)
2400 ;; Don't share post menu.
2401 (setq gnus-article-post-menu
2402 (copy-keymap gnus-summary-post-menu))))
2403 (define-key gnus-article-mode-map [menu-bar post]
2404 (cons "Post" gnus-article-post-menu))
2407 gnus-summary-misc-menu gnus-summary-mode-map ""
2410 ["Mark as read" gnus-summary-mark-as-read-forward t]
2411 ["Mark same subject and select"
2412 gnus-summary-kill-same-subject-and-select t]
2413 ["Mark same subject" gnus-summary-kill-same-subject t]
2414 ["Catchup" gnus-summary-catchup
2415 ,@(if (featurep 'xemacs) '(t)
2416 '(:help "Mark unread articles in this group as read"))]
2417 ["Catchup all" gnus-summary-catchup-all t]
2418 ["Catchup to here" gnus-summary-catchup-to-here t]
2419 ["Catchup from here" gnus-summary-catchup-from-here t]
2420 ["Catchup region" gnus-summary-mark-region-as-read
2421 (gnus-mark-active-p)]
2422 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2424 ["Tick" gnus-summary-tick-article-forward t]
2425 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2426 ["Remove marks" gnus-summary-clear-mark-forward t]
2427 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2428 ["Set bookmark" gnus-summary-set-bookmark t]
2429 ["Remove bookmark" gnus-summary-remove-bookmark t])
2431 ["Marks..." gnus-summary-limit-to-marks t]
2432 ["Subject..." gnus-summary-limit-to-subject t]
2433 ["Author..." gnus-summary-limit-to-author t]
2434 ["Age..." gnus-summary-limit-to-age t]
2435 ["Extra..." gnus-summary-limit-to-extra t]
2436 ["Score..." gnus-summary-limit-to-score t]
2437 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2438 ["Unread" gnus-summary-limit-to-unread t]
2439 ["Unseen" gnus-summary-limit-to-unseen t]
2440 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2441 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2442 ["Pop limit" gnus-summary-pop-limit t]
2443 ["Show dormant" gnus-summary-limit-include-dormant t]
2444 ["Hide childless dormant"
2445 gnus-summary-limit-exclude-childless-dormant t]
2446 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2447 ["Hide marked" gnus-summary-limit-exclude-marks t]
2448 ["Show expunged" gnus-summary-limit-include-expunged t])
2450 ["Set mark" gnus-summary-mark-as-processable t]
2451 ["Remove mark" gnus-summary-unmark-as-processable t]
2452 ["Remove all marks" gnus-summary-unmark-all-processable t]
2453 ["Mark above" gnus-uu-mark-over t]
2454 ["Mark series" gnus-uu-mark-series t]
2455 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2456 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2457 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2458 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2459 ["Mark all" gnus-uu-mark-all t]
2460 ["Mark buffer" gnus-uu-mark-buffer t]
2461 ["Mark sparse" gnus-uu-mark-sparse t]
2462 ["Mark thread" gnus-uu-mark-thread t]
2463 ["Unmark thread" gnus-uu-unmark-thread t]
2464 ("Process Mark Sets"
2465 ["Kill" gnus-summary-kill-process-mark t]
2466 ["Yank" gnus-summary-yank-process-mark
2467 gnus-newsgroup-process-stack]
2468 ["Save" gnus-summary-save-process-mark t]
2469 ["Run command on marked..." gnus-summary-universal-argument t]))
2471 ["Page forward" gnus-summary-next-page
2472 ,@(if (featurep 'xemacs) '(t)
2473 '(:help "Show next page of article"))]
2474 ["Page backward" gnus-summary-prev-page
2475 ,@(if (featurep 'xemacs) '(t)
2476 '(:help "Show previous page of article"))]
2477 ["Line forward" gnus-summary-scroll-up t])
2479 ["Next unread article" gnus-summary-next-unread-article t]
2480 ["Previous unread article" gnus-summary-prev-unread-article t]
2481 ["Next article" gnus-summary-next-article t]
2482 ["Previous article" gnus-summary-prev-article t]
2483 ["Next unread subject" gnus-summary-next-unread-subject t]
2484 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2485 ["Next article same subject" gnus-summary-next-same-subject t]
2486 ["Previous article same subject" gnus-summary-prev-same-subject t]
2487 ["First unread article" gnus-summary-first-unread-article t]
2488 ["Best unread article" gnus-summary-best-unread-article t]
2489 ["Go to subject number..." gnus-summary-goto-subject t]
2490 ["Go to article number..." gnus-summary-goto-article t]
2491 ["Go to the last article" gnus-summary-goto-last-article t]
2492 ["Pop article off history" gnus-summary-pop-article t])
2494 ["Sort by number" gnus-summary-sort-by-number t]
2495 ["Sort by author" gnus-summary-sort-by-author t]
2496 ["Sort by subject" gnus-summary-sort-by-subject t]
2497 ["Sort by date" gnus-summary-sort-by-date t]
2498 ["Sort by score" gnus-summary-sort-by-score t]
2499 ["Sort by lines" gnus-summary-sort-by-lines t]
2500 ["Sort by characters" gnus-summary-sort-by-chars t]
2501 ["Randomize" gnus-summary-sort-by-random t]
2502 ["Original sort" gnus-summary-sort-by-original t])
2504 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2505 ["Describe group" gnus-summary-describe-group t]
2506 ["Fetch charter" gnus-group-fetch-charter
2507 ,@(if (featurep 'xemacs) nil
2508 '(:help "Display the charter of the current group"))]
2509 ["Fetch control message" gnus-group-fetch-control
2510 ,@(if (featurep 'xemacs) nil
2511 '(:help "Display the archived control message for the current group"))]
2512 ["Read manual" gnus-info-find-node t])
2514 ["Pick and read" gnus-pick-mode t]
2515 ["Binary" gnus-binary-mode t])
2517 ["Regenerate" gnus-summary-prepare t]
2518 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2519 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2520 ["Toggle threading" gnus-summary-toggle-threads t])
2521 ["See old articles" gnus-summary-insert-old-articles t]
2522 ["See new articles" gnus-summary-insert-new-articles t]
2523 ["Filter articles..." gnus-summary-execute-command t]
2524 ["Run command on articles..." gnus-summary-universal-argument t]
2525 ["Search articles forward..." gnus-summary-search-article-forward t]
2526 ["Search articles backward..." gnus-summary-search-article-backward t]
2527 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2528 ["Expand window" gnus-summary-expand-window t]
2529 ["Expire expirable articles" gnus-summary-expire-articles
2530 (gnus-check-backend-function
2531 'request-expire-articles gnus-newsgroup-name)]
2532 ["Edit local kill file" gnus-summary-edit-local-kill t]
2533 ["Edit main kill file" gnus-summary-edit-global-kill t]
2534 ["Edit group parameters" gnus-summary-edit-parameters t]
2535 ["Customize group parameters" gnus-summary-customize-parameters t]
2536 ["Send a bug report" gnus-bug t]
2538 ["Catchup and exit" gnus-summary-catchup-and-exit
2539 ,@(if (featurep 'xemacs) '(t)
2540 '(:help "Mark unread articles in this group as read, then exit"))]
2541 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2542 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2543 ["Exit group" gnus-summary-exit
2544 ,@(if (featurep 'xemacs) '(t)
2545 '(:help "Exit current group, return to group selection mode"))]
2546 ["Exit group without updating" gnus-summary-exit-no-update t]
2547 ["Exit and goto next group" gnus-summary-next-group t]
2548 ["Exit and goto prev group" gnus-summary-prev-group t]
2549 ["Reselect group" gnus-summary-reselect-current-group t]
2550 ["Rescan group" gnus-summary-rescan-group t]
2551 ["Update dribble" gnus-summary-save-newsrc t])))
2553 (gnus-run-hooks 'gnus-summary-menu-hook)))
2555 (defvar gnus-summary-tool-bar-map nil)
2557 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2558 ;; affect _new_ message buffers. We might add a function that walks thru all
2559 ;; summary-mode buffers and force the update.
2560 (defun gnus-summary-tool-bar-update (&optional symbol value)
2561 "Update summary mode toolbar.
2562 Setter function for custom variables."
2563 (setq-default gnus-summary-tool-bar-map nil)
2565 ;; When used as ":set" function:
2566 (set-default symbol value))
2567 (when (gnus-buffer-live-p gnus-summary-buffer)
2568 (with-current-buffer gnus-summary-buffer
2569 (gnus-summary-make-tool-bar))))
2571 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2572 'gnus-summary-tool-bar-gnome
2573 'gnus-summary-tool-bar-retro)
2574 "Specifies the Gnus summary tool bar.
2576 It can be either a list or a symbol refering to a list. See
2577 `gmm-tool-bar-from-list' for the format of the list. The
2578 default key map is `gnus-summary-mode-map'.
2580 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2581 `gnus-summary-tool-bar-retro'."
2582 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2583 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2584 (repeat :tag "User defined list" gmm-tool-bar-item)
2586 :version "22.1" ;; Gnus 5.10.9
2587 :initialize 'custom-initialize-default
2588 :set 'gnus-summary-tool-bar-update
2589 :group 'gnus-summary)
2591 (defcustom gnus-summary-tool-bar-gnome
2592 '((gnus-summary-post-news "mail/compose" nil)
2593 (gnus-summary-insert-new-articles "mail/inbox" nil
2594 :visible (or (not gnus-agent)
2596 (gnus-summary-reply-with-original "mail/reply")
2597 (gnus-summary-reply "mail/reply" nil :visible nil)
2598 (gnus-summary-followup-with-original "mail/reply-all")
2599 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2600 (gnus-summary-mail-forward "mail/forward")
2601 (gnus-summary-save-article "mail/save")
2602 (gnus-summary-search-article-forward "search" nil :visible nil)
2603 (gnus-summary-print-article "print")
2604 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2605 ;; Some new commands that may need more suitable icons:
2606 (gnus-summary-save-newsrc "save" nil :visible nil)
2607 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2608 (gnus-summary-prev-article "left-arrow")
2609 (gnus-summary-next-article "right-arrow")
2610 (gnus-summary-next-page "next-page")
2611 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2613 ;; Maybe some sort-by-... could be added:
2614 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2615 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2616 (gnus-summary-mark-as-expirable
2618 :visible (gnus-check-backend-function 'request-expire-articles
2619 gnus-newsgroup-name))
2620 (gnus-summary-mark-as-spam
2622 :visible (and (fboundp 'spam-group-ham-contents-p)
2623 (spam-group-ham-contents-p gnus-newsgroup-name))
2624 :help "Mark as spam")
2625 (gnus-summary-mark-as-read-forward
2627 :visible (and (fboundp 'spam-group-spam-contents-p)
2628 (spam-group-spam-contents-p gnus-newsgroup-name)))
2630 (gnus-summary-exit "exit")
2631 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2632 (gnus-info-find-node "help"))
2633 "List of functions for the summary tool bar (GNOME style).
2635 See `gmm-tool-bar-from-list' for the format of the list."
2636 :type '(repeat gmm-tool-bar-item)
2637 :version "22.1" ;; Gnus 5.10.9
2638 :initialize 'custom-initialize-default
2639 :set 'gnus-summary-tool-bar-update
2640 :group 'gnus-summary)
2642 (defcustom gnus-summary-tool-bar-retro
2643 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2644 (gnus-summary-next-unread-article "gnus/next-ur")
2645 (gnus-summary-post-news "gnus/post")
2646 (gnus-summary-followup-with-original "gnus/fuwo")
2647 (gnus-summary-followup "gnus/followup")
2648 (gnus-summary-reply-with-original "gnus/reply-wo")
2649 (gnus-summary-reply "gnus/reply")
2650 (gnus-summary-caesar-message "gnus/rot13")
2651 (gnus-uu-decode-uu "gnus/uu-decode")
2652 (gnus-summary-save-article-file "gnus/save-aif")
2653 (gnus-summary-save-article "gnus/save-art")
2654 (gnus-uu-post-news "gnus/uu-post")
2655 (gnus-summary-catchup "gnus/catchup")
2656 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2657 (gnus-summary-exit "gnus/exit-summ")
2658 ;; Some new command that may need more suitable icons:
2659 (gnus-summary-print-article "gnus/print" nil :visible nil)
2660 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2661 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2662 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2663 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2664 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2665 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2667 (gnus-info-find-node "gnus/help" nil :visible nil))
2668 "List of functions for the summary tool bar (retro look).
2670 See `gmm-tool-bar-from-list' for the format of the list."
2671 :type '(repeat gmm-tool-bar-item)
2672 :version "22.1" ;; Gnus 5.10.9
2673 :initialize 'custom-initialize-default
2674 :set 'gnus-summary-tool-bar-update
2675 :group 'gnus-summary)
2677 (defcustom gnus-summary-tool-bar-zap-list t
2678 "List of icon items from the global tool bar.
2679 These items are not displayed in the Gnus summary mode tool bar.
2681 See `gmm-tool-bar-from-list' for the format of the list."
2682 :type 'gmm-tool-bar-zap-list
2683 :version "22.1" ;; Gnus 5.10.9
2684 :initialize 'custom-initialize-default
2685 :set 'gnus-summary-tool-bar-update
2686 :group 'gnus-summary)
2688 (defvar image-load-path)
2690 (defun gnus-summary-make-tool-bar (&optional force)
2691 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2692 When FORCE, rebuild the tool bar."
2693 (when (and (not (featurep 'xemacs))
2694 (boundp 'tool-bar-mode)
2696 (or (not gnus-summary-tool-bar-map) force))
2698 (gmm-image-load-path-for-library "gnus"
2701 (image-load-path (cons (car load-path)
2702 (when (boundp 'image-load-path)
2704 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2705 gnus-summary-tool-bar-zap-list
2706 'gnus-summary-mode-map)))
2708 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2710 (setq gnus-summary-tool-bar-map map))))
2711 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2713 (defun gnus-score-set-default (var value)
2714 "A version of set that updates the GNU Emacs menu-bar."
2716 ;; It is the message that forces the active status to be updated.
2719 (defun gnus-make-score-map (type)
2720 "Make a summary score map of type TYPE."
2723 (let ((headers '(("author" "from" string)
2724 ("subject" "subject" string)
2725 ("article body" "body" string)
2726 ("article head" "head" string)
2727 ("xref" "xref" string)
2728 ("extra header" "extra" string)
2729 ("lines" "lines" number)
2730 ("followups to author" "followup" string)))
2731 (types '((number ("less than" <)
2734 (string ("substring" s)
2738 (perms '(("temporary" (current-time-string))
2746 (if (eq type 'lower)
2751 (setq header (car headers))
2757 (let ((ts (cdr (assoc (nth 2 header) types)))
2773 'gnus-summary-score-entry
2775 (if (or (string= (nth 1 header)
2777 (string= (nth 1 header)
2780 (list 'gnus-summary-header
2782 (list 'quote (nth 1 (car ts)))
2783 (list 'gnus-score-delta-default
2790 (list (nreverse outp))))
2793 (list (nreverse outt))))
2795 (setq headers (cdr headers)))
2796 (list (nreverse outh))))))))
2800 (defun gnus-summary-mode (&optional group)
2801 "Major mode for reading articles.
2803 All normal editing commands are switched off.
2804 \\<gnus-summary-mode-map>
2805 Each line in this buffer represents one article. To read an
2806 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2807 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2810 You can also post articles and send mail from this buffer. To
2811 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2812 of an article, type `\\[gnus-summary-reply]'.
2814 There are approx. one gazillion commands you can execute in this
2815 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2817 The following commands are available:
2819 \\{gnus-summary-mode-map}"
2821 (kill-all-local-variables)
2822 (when (gnus-visual-p 'summary-menu 'menu)
2823 (gnus-summary-make-menu-bar)
2824 (gnus-summary-make-tool-bar))
2825 (gnus-summary-make-local-variables)
2826 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2827 (gnus-summary-make-local-variables))
2828 (gnus-make-thread-indent-array)
2829 (gnus-simplify-mode-line)
2830 (setq major-mode 'gnus-summary-mode)
2831 (setq mode-name "Summary")
2832 (make-local-variable 'minor-mode-alist)
2833 (use-local-map gnus-summary-mode-map)
2834 (buffer-disable-undo)
2835 (setq buffer-read-only t) ;Disable modification
2836 (setq truncate-lines t)
2837 (setq selective-display t)
2838 (setq selective-display-ellipses t) ;Display `...'
2839 (gnus-summary-set-display-table)
2840 (gnus-set-default-directory)
2841 (setq gnus-newsgroup-name group)
2842 (make-local-variable 'gnus-summary-line-format)
2843 (make-local-variable 'gnus-summary-line-format-spec)
2844 (make-local-variable 'gnus-summary-dummy-line-format)
2845 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2846 (make-local-variable 'gnus-summary-mark-positions)
2847 (gnus-make-local-hook 'pre-command-hook)
2848 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2849 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2850 (turn-on-gnus-mailing-list-mode)
2851 (mm-enable-multibyte)
2852 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2853 (gnus-update-summary-mark-positions))
2855 (defun gnus-summary-make-local-variables ()
2856 "Make all the local summary buffer variables."
2858 (dolist (local gnus-summary-local-variables)
2861 (if (eq (cdr local) 'global)
2862 ;; Copy the global value of the variable.
2863 (setq global (symbol-value (car local)))
2864 ;; Use the value from the list.
2865 (setq global (eval (cdr local))))
2866 (set (make-local-variable (car local)) global))
2867 ;; Simple nil-valued local variable.
2868 (set (make-local-variable local) nil)))))
2870 (defun gnus-summary-clear-local-variables ()
2871 (let ((locals gnus-summary-local-variables))
2873 (if (consp (car locals))
2874 (and (vectorp (caar locals))
2875 (set (caar locals) nil))
2876 (and (vectorp (car locals))
2877 (set (car locals) nil)))
2878 (setq locals (cdr locals)))))
2880 ;; Summary data functions.
2882 (defmacro gnus-data-number (data)
2885 (defmacro gnus-data-set-number (data number)
2886 `(setcar ,data ,number))
2888 (defmacro gnus-data-mark (data)
2891 (defmacro gnus-data-set-mark (data mark)
2892 `(setcar (nthcdr 1 ,data) ,mark))
2894 (defmacro gnus-data-pos (data)
2897 (defmacro gnus-data-set-pos (data pos)
2898 `(setcar (nthcdr 2 ,data) ,pos))
2900 (defmacro gnus-data-header (data)
2903 (defmacro gnus-data-set-header (data header)
2904 `(setf (nth 3 ,data) ,header))
2906 (defmacro gnus-data-level (data)
2909 (defmacro gnus-data-unread-p (data)
2910 `(= (nth 1 ,data) gnus-unread-mark))
2912 (defmacro gnus-data-read-p (data)
2913 `(/= (nth 1 ,data) gnus-unread-mark))
2915 (defmacro gnus-data-pseudo-p (data)
2916 `(consp (nth 3 ,data)))
2918 (defmacro gnus-data-find (number)
2919 `(assq ,number gnus-newsgroup-data))
2921 (defmacro gnus-data-find-list (number &optional data)
2922 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2923 (memq (assq ,number bdata)
2926 (defmacro gnus-data-make (number mark pos header level)
2927 `(list ,number ,mark ,pos ,header ,level))
2929 (defun gnus-data-enter (after-article number mark pos header level offset)
2930 (let ((data (gnus-data-find-list after-article)))
2932 (error "No such article: %d" after-article))
2933 (setcdr data (cons (gnus-data-make number mark pos header level)
2935 (setq gnus-newsgroup-data-reverse nil)
2936 (gnus-data-update-list (cddr data) offset)))
2938 (defun gnus-data-enter-list (after-article list &optional offset)
2940 (let ((data (and after-article (gnus-data-find-list after-article)))
2944 (let ((odata gnus-newsgroup-data))
2945 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2947 (gnus-data-update-list odata offset)))
2948 ;; Find the last element in the list to be spliced into the main
2951 (setq list (cdr list)))
2954 (setcdr list gnus-newsgroup-data)
2955 (setq gnus-newsgroup-data ilist)
2957 (gnus-data-update-list (cdr list) offset)))
2958 (setcdr list (cdr data))
2961 (gnus-data-update-list (cdr list) offset))))
2962 (setq gnus-newsgroup-data-reverse nil))))
2964 (defun gnus-data-remove (article &optional offset)
2965 (let ((data gnus-newsgroup-data))
2966 (if (= (gnus-data-number (car data)) article)
2968 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2969 gnus-newsgroup-data-reverse nil)
2971 (gnus-data-update-list gnus-newsgroup-data offset)))
2973 (when (= (gnus-data-number (cadr data)) article)
2974 (setcdr data (cddr data))
2976 (gnus-data-update-list (cdr data) offset))
2978 gnus-newsgroup-data-reverse nil))
2979 (setq data (cdr data))))))
2981 (defmacro gnus-data-list (backward)
2983 (or gnus-newsgroup-data-reverse
2984 (setq gnus-newsgroup-data-reverse
2985 (reverse gnus-newsgroup-data)))
2986 gnus-newsgroup-data))
2988 (defun gnus-data-update-list (data offset)
2989 "Add OFFSET to the POS of all data entries in DATA."
2990 (setq gnus-newsgroup-data-reverse nil)
2992 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2993 (setq data (cdr data))))
2995 (defun gnus-summary-article-pseudo-p (article)
2996 "Say whether this article is a pseudo article or not."
2997 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2999 (defmacro gnus-summary-article-sparse-p (article)
3000 "Say whether this article is a sparse article or not."
3001 `(memq ,article gnus-newsgroup-sparse))
3003 (defmacro gnus-summary-article-ancient-p (article)
3004 "Say whether this article is a sparse article or not."
3005 `(memq ,article gnus-newsgroup-ancient))
3007 (defun gnus-article-parent-p (number)
3008 "Say whether this article is a parent or not."
3009 (let ((data (gnus-data-find-list number)))
3010 (and (cdr data) ; There has to be an article after...
3011 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3012 (gnus-data-level (nth 1 data))))))
3014 (defun gnus-article-children (number)
3015 "Return a list of all children to NUMBER."
3016 (let* ((data (gnus-data-find-list number))
3017 (level (gnus-data-level (car data)))
3019 (setq data (cdr data))
3021 (= (gnus-data-level (car data)) (1+ level)))
3022 (push (gnus-data-number (car data)) children)
3023 (setq data (cdr data)))
3026 (defmacro gnus-summary-skip-intangible ()
3027 "If the current article is intangible, then jump to a different article."
3028 '(let ((to (get-text-property (point) 'gnus-intangible)))
3029 (and to (gnus-summary-goto-subject to))))
3031 (defmacro gnus-summary-article-intangible-p ()
3032 "Say whether this article is intangible or not."
3033 '(get-text-property (point) 'gnus-intangible))
3035 (defun gnus-article-read-p (article)
3036 "Say whether ARTICLE is read or not."
3037 (not (or (memq article gnus-newsgroup-marked)
3038 (memq article gnus-newsgroup-spam-marked)
3039 (memq article gnus-newsgroup-unreads)
3040 (memq article gnus-newsgroup-unselected)
3041 (memq article gnus-newsgroup-dormant))))
3043 ;; Some summary mode macros.
3045 (defmacro gnus-summary-article-number ()
3046 "The article number of the article on the current line.
3047 If there isn't an article number here, then we return the current
3050 (gnus-summary-skip-intangible)
3051 (or (get-text-property (point) 'gnus-number)
3052 (gnus-summary-last-subject))))
3054 (defmacro gnus-summary-article-header (&optional number)
3055 "Return the header of article NUMBER."
3056 `(gnus-data-header (gnus-data-find
3057 ,(or number '(gnus-summary-article-number)))))
3059 (defmacro gnus-summary-thread-level (&optional number)
3060 "Return the level of thread that starts with article NUMBER."
3061 `(if (and (eq gnus-summary-make-false-root 'dummy)
3062 (get-text-property (point) 'gnus-intangible))
3064 (gnus-data-level (gnus-data-find
3065 ,(or number '(gnus-summary-article-number))))))
3067 (defmacro gnus-summary-article-mark (&optional number)
3068 "Return the mark of article NUMBER."
3069 `(gnus-data-mark (gnus-data-find
3070 ,(or number '(gnus-summary-article-number)))))
3072 (defmacro gnus-summary-article-pos (&optional number)
3073 "Return the position of the line of article NUMBER."
3074 `(gnus-data-pos (gnus-data-find
3075 ,(or number '(gnus-summary-article-number)))))
3077 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3078 (defmacro gnus-summary-article-subject (&optional number)
3079 "Return current subject string or nil if nothing."
3082 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3083 '(gnus-data-header (assq (gnus-summary-article-number)
3084 gnus-newsgroup-data)))))
3087 (mail-header-subject headers))))
3089 (defmacro gnus-summary-article-score (&optional number)
3090 "Return current article score."
3091 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3092 gnus-newsgroup-scored))
3093 gnus-summary-default-score 0))
3095 (defun gnus-summary-article-children (&optional number)
3096 "Return a list of article numbers that are children of article NUMBER."
3097 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3098 (level (gnus-data-level (car data)))
3100 (while (and (setq data (cdr data))
3101 (> (setq l (gnus-data-level (car data))) level))
3102 (and (= (1+ level) l)
3103 (push (gnus-data-number (car data))
3105 (nreverse children)))
3107 (defun gnus-summary-article-parent (&optional number)
3108 "Return the article number of the parent of article NUMBER."
3109 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3110 (gnus-data-list t)))
3111 (level (gnus-data-level (car data))))
3113 () ; This is a root.
3114 ;; We search until we find an article with a level less than
3115 ;; this one. That function has to be the parent.
3116 (while (and (setq data (cdr data))
3117 (not (< (gnus-data-level (car data)) level))))
3118 (and data (gnus-data-number (car data))))))
3120 (defun gnus-unread-mark-p (mark)
3121 "Say whether MARK is the unread mark."
3122 (= mark gnus-unread-mark))
3124 (defun gnus-read-mark-p (mark)
3125 "Say whether MARK is one of the marks that mark as read.
3126 This is all marks except unread, ticked, dormant, and expirable."
3127 (not (or (= mark gnus-unread-mark)
3128 (= mark gnus-ticked-mark)
3129 (= mark gnus-spam-mark)
3130 (= mark gnus-dormant-mark)
3131 (= mark gnus-expirable-mark))))
3133 (defmacro gnus-article-mark (number)
3134 "Return the MARK of article NUMBER.
3135 This macro should only be used when computing the mark the \"first\"
3136 time; i.e., when generating the summary lines. After that,
3137 `gnus-summary-article-mark' should be used to examine the
3140 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3141 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3142 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3143 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3144 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3145 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3146 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3147 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3148 gnus-ancient-mark))))
3150 ;; Saving hidden threads.
3152 (defmacro gnus-save-hidden-threads (&rest forms)
3153 "Save hidden threads, eval FORMS, and restore the hidden threads."
3154 (let ((config (make-symbol "config")))
3155 `(let ((,config (gnus-hidden-threads-configuration)))
3159 (gnus-restore-hidden-threads-configuration ,config)))))
3160 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3161 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3163 (defun gnus-data-compute-positions ()
3164 "Compute the positions of all articles."
3165 (setq gnus-newsgroup-data-reverse nil)
3166 (let ((data gnus-newsgroup-data))
3168 (gnus-save-hidden-threads
3169 (gnus-summary-show-all-threads)
3170 (goto-char (point-min))
3172 (while (get-text-property (point) 'gnus-intangible)
3174 (gnus-data-set-pos (car data) (+ (point) 3))
3175 (setq data (cdr data))
3176 (forward-line 1))))))
3178 (defun gnus-hidden-threads-configuration ()
3179 "Return the current hidden threads configuration."
3182 (goto-char (point-min))
3183 (while (search-forward "\r" nil t)
3184 (push (1- (point)) config))
3187 (defun gnus-restore-hidden-threads-configuration (config)
3188 "Restore hidden threads configuration from CONFIG."
3190 (let (point buffer-read-only)
3191 (while (setq point (pop config))
3192 (when (and (< point (point-max))
3194 (eq (char-after) ?\n))
3195 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3197 ;; Various summary mode internalish functions.
3199 (defun gnus-mouse-pick-article (e)
3202 (gnus-summary-next-page nil t))
3204 (defun gnus-summary-set-display-table ()
3205 "Change the display table.
3206 Odd characters have a tendency to mess
3207 up nicely formatted displays - we make all possible glyphs
3208 display only a single character."
3210 ;; We start from the standard display table, if any.
3211 (let ((table (or (copy-sequence standard-display-table)
3212 (make-display-table)))
3214 ;; Nix out all the control chars...
3215 (while (>= (setq i (1- i)) 0)
3216 (aset table i [??]))
3217 ;; ... but not newline and cr, of course. (cr is necessary for the
3218 ;; selective display).
3219 (aset table ?\n nil)
3220 (aset table ?\r nil)
3221 ;; We keep TAB as well.
3222 (aset table ?\t nil)
3223 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3224 ;; Emacs 23 (unicode), that are not set already.
3225 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3228 (while (>= (setq i (1- i)) 127)
3229 ;; Only modify if the entry is nil.
3230 (unless (aref table i)
3231 (aset table i [??]))))
3232 (setq buffer-display-table table)))
3234 (defun gnus-summary-set-article-display-arrow (pos)
3235 "Update the overlay arrow to point to line at position POS."
3236 (when (and gnus-summary-display-arrow
3237 (boundp 'overlay-arrow-position)
3238 (boundp 'overlay-arrow-string))
3242 (unless overlay-arrow-position
3243 (setq overlay-arrow-position (make-marker)))
3244 (setq overlay-arrow-string "=>"
3245 overlay-arrow-position (set-marker overlay-arrow-position
3247 (current-buffer))))))
3249 (defun gnus-summary-setup-buffer (group)
3250 "Initialize summary buffer."
3251 (let ((buffer (gnus-summary-buffer-name group))
3252 (dead-name (concat "*Dead Summary "
3253 (gnus-group-decoded-name group) "*")))
3254 ;; If a dead summary buffer exists, we kill it.
3255 (when (gnus-buffer-live-p dead-name)
3256 (gnus-kill-buffer dead-name))
3257 (if (get-buffer buffer)
3260 (setq gnus-summary-buffer (current-buffer))
3261 (not gnus-newsgroup-prepared))
3262 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3263 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3264 (gnus-summary-mode group)
3266 (gnus-carpal-setup-buffer 'summary))
3267 (unless gnus-single-article-buffer
3268 (make-local-variable 'gnus-article-buffer)
3269 (make-local-variable 'gnus-article-current)
3270 (make-local-variable 'gnus-original-article-buffer))
3271 (setq gnus-newsgroup-name group)
3272 ;; Set any local variables in the group parameters.
3273 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3276 (defun gnus-set-global-variables ()
3277 "Set the global equivalents of the buffer-local variables.
3278 They are set to the latest values they had. These reflect the summary
3279 buffer that was in action when the last article was fetched."
3280 (when (eq major-mode 'gnus-summary-mode)
3281 (setq gnus-summary-buffer (current-buffer))
3282 (let ((name gnus-newsgroup-name)
3283 (marked gnus-newsgroup-marked)
3284 (spam gnus-newsgroup-spam-marked)
3285 (unread gnus-newsgroup-unreads)
3286 (headers gnus-current-headers)
3287 (data gnus-newsgroup-data)
3288 (summary gnus-summary-buffer)
3289 (article-buffer gnus-article-buffer)
3290 (original gnus-original-article-buffer)
3291 (gac gnus-article-current)
3292 (reffed gnus-reffed-article-number)
3293 (score-file gnus-current-score-file)
3294 (default-charset gnus-newsgroup-charset)
3296 (let ((locals gnus-newsgroup-variables))
3298 (if (consp (car locals))
3299 (push (eval (caar locals)) vlist)
3300 (push (eval (car locals)) vlist))
3301 (setq locals (cdr locals)))
3302 (setq vlist (nreverse vlist)))
3304 (set-buffer gnus-group-buffer)
3305 (setq gnus-newsgroup-name name
3306 gnus-newsgroup-marked marked
3307 gnus-newsgroup-spam-marked spam
3308 gnus-newsgroup-unreads unread
3309 gnus-current-headers headers
3310 gnus-newsgroup-data data
3311 gnus-article-current gac
3312 gnus-summary-buffer summary
3313 gnus-article-buffer article-buffer
3314 gnus-original-article-buffer original
3315 gnus-reffed-article-number reffed
3316 gnus-current-score-file score-file
3317 gnus-newsgroup-charset default-charset)
3318 (let ((locals gnus-newsgroup-variables))
3320 (if (consp (car locals))
3321 (set (caar locals) (pop vlist))
3322 (set (car locals) (pop vlist)))
3323 (setq locals (cdr locals))))
3324 ;; The article buffer also has local variables.
3325 (when (gnus-buffer-live-p gnus-article-buffer)
3326 (set-buffer gnus-article-buffer)
3327 (setq gnus-summary-buffer summary))))))
3329 (defun gnus-summary-article-unread-p (article)
3330 "Say whether ARTICLE is unread or not."
3331 (memq article gnus-newsgroup-unreads))
3333 (defun gnus-summary-first-article-p (&optional article)
3334 "Return whether ARTICLE is the first article in the buffer."
3335 (if (not (setq article (or article (gnus-summary-article-number))))
3337 (eq article (caar gnus-newsgroup-data))))
3339 (defun gnus-summary-last-article-p (&optional article)
3340 "Return whether ARTICLE is the last article in the buffer."
3341 (if (not (setq article (or article (gnus-summary-article-number))))
3342 ;; All non-existent numbers are the last article. :-)
3344 (not (cdr (gnus-data-find-list article)))))
3346 (defun gnus-make-thread-indent-array ()
3348 (unless (and gnus-thread-indent-array
3349 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3350 (setq gnus-thread-indent-array (make-vector 201 "")
3351 gnus-thread-indent-array-level gnus-thread-indent-level)
3353 (aset gnus-thread-indent-array n
3354 (make-string (* n gnus-thread-indent-level) ? ))
3357 (defun gnus-update-summary-mark-positions ()
3358 "Compute where the summary marks are to go."
3360 (when (gnus-buffer-exists-p gnus-summary-buffer)
3361 (set-buffer gnus-summary-buffer))
3362 (let ((spec gnus-summary-line-format-spec)
3365 (gnus-set-work-buffer)
3366 (let ((gnus-tmp-unread ?Z)
3367 (gnus-replied-mark ?Z)
3368 (gnus-score-below-mark ?Z)
3369 (gnus-score-over-mark ?Z)
3370 (gnus-undownloaded-mark ?Z)
3371 (gnus-summary-line-format-spec spec)
3372 (gnus-newsgroup-downloadable '(0))
3373 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3374 case-fold-search ignores)
3375 ;; Here, all marks are bound to Z.
3376 (gnus-summary-insert-line header
3377 0 nil t gnus-tmp-unread t nil "" nil 1)
3378 (goto-char (point-min))
3379 ;; Memorize the positions of the same characters as dummy marks.
3380 (while (re-search-forward "[A-D]" nil t)
3381 (push (point) ignores))
3383 ;; We use A-D as dummy marks in order to know column positions
3384 ;; where marks should be inserted.
3385 (setq gnus-tmp-unread ?A
3386 gnus-replied-mark ?B
3387 gnus-score-below-mark ?C
3388 gnus-score-over-mark ?C
3389 gnus-undownloaded-mark ?D)
3390 (gnus-summary-insert-line header
3391 0 nil t gnus-tmp-unread t nil "" nil 1)
3392 ;; Ignore characters which aren't dummy marks.
3394 (delete-region (goto-char (1- p)) p)
3396 (goto-char (point-min))
3397 (setq pos (list (cons 'unread
3398 (and (search-forward "A" nil t)
3399 (- (point) (point-min) 1)))))
3400 (goto-char (point-min))
3401 (push (cons 'replied (and (search-forward "B" nil t)
3402 (- (point) (point-min) 1)))
3404 (goto-char (point-min))
3405 (push (cons 'score (and (search-forward "C" nil t)
3406 (- (point) (point-min) 1)))
3408 (goto-char (point-min))
3409 (push (cons 'download (and (search-forward "D" nil t)
3410 (- (point) (point-min) 1)))
3412 (setq gnus-summary-mark-positions pos))))
3414 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3415 "Insert a dummy root in the summary buffer."
3417 (gnus-add-text-properties
3418 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3419 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3421 (defun gnus-summary-extract-address-component (from)
3422 (or (car (funcall gnus-extract-address-components from))
3425 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3426 (let ((mail-parse-charset gnus-newsgroup-charset)
3427 ; Is it really necessary to do this next part for each summary line?
3428 ; Luckily, doesn't seem to slow things down much.
3429 (mail-parse-ignored-charsets
3430 (save-excursion (set-buffer gnus-summary-buffer)
3431 gnus-newsgroup-ignored-charsets)))
3433 (and gnus-ignored-from-addresses
3434 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3435 (let ((extra-headers (mail-header-extra header))
3439 ((setq to (cdr (assq 'To extra-headers)))
3442 (gnus-summary-extract-address-component
3443 (funcall gnus-decode-encoded-address-function to)))))
3444 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3445 (concat "=> " newsgroups)))))
3446 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3448 (defun gnus-summary-insert-line (gnus-tmp-header
3449 gnus-tmp-level gnus-tmp-current
3450 undownloaded gnus-tmp-unread gnus-tmp-replied
3451 gnus-tmp-expirable gnus-tmp-subject-or-nil
3452 &optional gnus-tmp-dummy gnus-tmp-score
3454 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3455 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3456 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3457 (gnus-tmp-score-char
3458 (if (or (null gnus-summary-default-score)
3459 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3460 gnus-summary-zcore-fuzz))
3462 (if (< gnus-tmp-score gnus-summary-default-score)
3463 gnus-score-below-mark gnus-score-over-mark)))
3464 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3466 (cond (gnus-tmp-process gnus-process-mark)
3467 ((memq gnus-tmp-current gnus-newsgroup-cached)
3469 (gnus-tmp-replied gnus-replied-mark)
3470 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3471 gnus-forwarded-mark)
3472 ((memq gnus-tmp-current gnus-newsgroup-saved)
3474 ((memq gnus-tmp-number gnus-newsgroup-recent)
3476 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3479 (gnus-tmp-downloaded
3481 gnus-undownloaded-mark)
3482 (gnus-newsgroup-agentized
3483 gnus-downloaded-mark)
3486 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3489 ((string-match "<[^>]+> *$" gnus-tmp-from)
3490 (let ((beg (match-beginning 0)))
3491 (or (and (string-match "^\".+\"" gnus-tmp-from)
3492 (substring gnus-tmp-from 1 (1- (match-end 0))))
3493 (substring gnus-tmp-from 0 beg))))
3494 ((string-match "(.+)" gnus-tmp-from)
3495 (substring gnus-tmp-from
3496 (1+ (match-beginning 0)) (1- (match-end 0))))
3498 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3499 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3500 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3501 (buffer-read-only nil))
3502 (when (string= gnus-tmp-name "")
3503 (setq gnus-tmp-name gnus-tmp-from))
3504 (unless (numberp gnus-tmp-lines)
3505 (setq gnus-tmp-lines -1))
3506 (if (= gnus-tmp-lines -1)
3507 (setq gnus-tmp-lines "?")
3508 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3509 (gnus-put-text-property
3511 (progn (eval gnus-summary-line-format-spec) (point))
3512 'gnus-number gnus-tmp-number)
3513 (when (gnus-visual-p 'summary-highlight 'highlight)
3515 (gnus-run-hooks 'gnus-summary-update-hook)
3518 (defun gnus-summary-update-line (&optional dont-update)
3519 "Update summary line after change."
3520 (when (and gnus-summary-default-score
3521 (not gnus-summary-inhibit-highlight))
3522 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3523 (article (gnus-summary-article-number))
3524 (score (gnus-summary-article-score article)))
3526 (if (and gnus-summary-mark-below
3527 (< (gnus-summary-article-score)
3528 gnus-summary-mark-below))
3529 ;; This article has a low score, so we mark it as read.
3530 (when (memq article gnus-newsgroup-unreads)
3531 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3532 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3533 ;; This article was previously marked as read on account
3534 ;; of a low score, but now it has risen, so we mark it as
3536 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3537 (gnus-summary-update-mark
3538 (if (or (null gnus-summary-default-score)
3539 (<= (abs (- score gnus-summary-default-score))
3540 gnus-summary-zcore-fuzz))
3542 (if (< score gnus-summary-default-score)
3543 gnus-score-below-mark gnus-score-over-mark))
3545 ;; Do visual highlighting.
3546 (when (gnus-visual-p 'summary-highlight 'highlight)
3547 (gnus-run-hooks 'gnus-summary-update-hook)))))
3549 (defvar gnus-tmp-new-adopts nil)
3551 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3552 "Return the number of articles in THREAD.
3553 This may be 0 in some cases -- if none of the articles in
3554 the thread are to be displayed."
3556 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3558 ((not (listp thread))
3560 ((and (consp thread) (cdr thread))
3563 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3566 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3569 (when (and level (zerop level) gnus-tmp-new-adopts)
3572 'gnus-summary-number-of-articles-in-thread
3573 gnus-tmp-new-adopts))))
3575 (if (> number 1) gnus-not-empty-thread-mark
3576 gnus-empty-thread-mark)
3579 (defsubst gnus-summary-line-message-size (head)
3580 "Return pretty-printed version of message size.
3581 This function is intended to be used in
3582 `gnus-summary-line-format-alist'."
3583 (let ((c (or (mail-header-chars head) -1)))
3584 (cond ((< c 0) "n/a") ; chars not available
3585 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3586 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3587 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3588 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3591 (defun gnus-summary-set-local-parameters (group)
3592 "Go through the local params of GROUP and set all variable specs in that list."
3593 (let ((params (gnus-group-find-parameter group))
3594 (vars '(quit-config)) ; Ignore quit-config.
3597 (setq elem (car params)
3598 params (cdr params))
3599 (and (consp elem) ; Has to be a cons.
3600 (consp (cdr elem)) ; The cdr has to be a list.
3601 (symbolp (car elem)) ; Has to be a symbol in there.
3602 (not (memq (car elem) vars))
3603 (ignore-errors ; So we set it.
3604 (push (car elem) vars)
3605 (make-local-variable (car elem))
3606 (set (car elem) (eval (nth 1 elem))))))))
3608 (defun gnus-summary-read-group (group &optional show-all no-article
3609 kill-buffer no-display backward
3611 "Start reading news in newsgroup GROUP.
3612 If SHOW-ALL is non-nil, already read articles are also listed.
3613 If NO-ARTICLE is non-nil, no article is selected initially.
3614 If NO-DISPLAY, don't generate a summary buffer."
3618 (let ((gnus-auto-select-next nil))
3619 (or (gnus-summary-read-group-1
3620 group show-all no-article
3621 kill-buffer no-display
3624 select-articles nil)))))
3625 (eq gnus-auto-select-next 'quietly))
3626 (set-buffer gnus-group-buffer)
3627 ;; The entry function called above goes to the next
3628 ;; group automatically, so we go two groups back
3629 ;; if we are searching for the previous group.
3631 (gnus-group-prev-unread-group 2))
3632 (if (not (equal group (gnus-group-group-name)))
3633 (setq group (gnus-group-group-name))
3637 (defun gnus-summary-read-group-1 (group show-all no-article
3638 kill-buffer no-display
3639 &optional select-articles)
3640 ;; Killed foreign groups can't be entered.
3641 ;; (when (and (not (gnus-group-native-p group))
3642 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3643 ;; (error "Dead non-native groups can't be entered"))
3644 (gnus-message 5 "Retrieving newsgroup: %s..."
3645 (gnus-group-decoded-name group))
3646 (let* ((new-group (gnus-summary-setup-buffer group))
3647 (quit-config (gnus-group-quit-config group))
3648 (did-select (and new-group (gnus-select-newsgroup
3649 group show-all select-articles))))
3651 ;; This summary buffer exists already, so we just select it.
3653 (gnus-set-global-variables)
3655 (gnus-kill-or-deaden-summary kill-buffer))
3656 (gnus-configure-windows 'summary 'force)
3657 (gnus-set-mode-line 'summary)
3658 (gnus-summary-position-point)
3661 ;; We couldn't select this group.
3663 (when (and (eq major-mode 'gnus-summary-mode)
3664 (not (equal (current-buffer) kill-buffer)))
3665 (kill-buffer (current-buffer))
3666 (if (not quit-config)
3668 ;; Update the info -- marks might need to be removed,
3670 (gnus-summary-update-info)
3671 (set-buffer gnus-group-buffer)
3672 (gnus-group-jump-to-group group)
3673 (gnus-group-next-unread-group 1))
3674 (gnus-handle-ephemeral-exit quit-config)))
3675 (let ((grpinfo (gnus-get-info group)))
3676 (if (null (gnus-info-read grpinfo))
3677 (gnus-message 3 "Group %s contains no messages"
3678 (gnus-group-decoded-name group))
3679 (gnus-message 3 "Can't select group")))
3681 ;; The user did a `C-g' while prompting for number of articles,
3682 ;; so we exit this group.
3683 ((eq did-select 'quit)
3684 (and (eq major-mode 'gnus-summary-mode)
3685 (not (equal (current-buffer) kill-buffer))
3686 (kill-buffer (current-buffer)))
3688 (gnus-kill-or-deaden-summary kill-buffer))
3689 (if (not quit-config)
3691 (set-buffer gnus-group-buffer)
3692 (gnus-group-jump-to-group group)
3693 (gnus-group-next-unread-group 1)
3694 (gnus-configure-windows 'group 'force))
3695 (gnus-handle-ephemeral-exit quit-config))
3696 ;; Finally signal the quit.
3698 ;; The group was successfully selected.
3700 (gnus-set-global-variables)
3701 ;; Save the active value in effect when the group was entered.
3702 (setq gnus-newsgroup-active
3704 (gnus-active gnus-newsgroup-name)))
3705 ;; You can change the summary buffer in some way with this hook.
3706 (gnus-run-hooks 'gnus-select-group-hook)
3707 (when (memq 'summary (gnus-update-format-specifications
3708 nil 'summary 'summary-mode 'summary-dummy))
3709 ;; The format specification for the summary line was updated,
3710 ;; so we need to update the mark positions as well.
3711 (gnus-update-summary-mark-positions))
3712 ;; Do score processing.
3713 (when gnus-use-scoring
3714 (gnus-possibly-score-headers))
3715 ;; Check whether to fill in the gaps in the threads.
3716 (when gnus-build-sparse-threads
3717 (gnus-build-sparse-threads))
3718 ;; Find the initial limit.
3720 (let ((gnus-newsgroup-dormant nil))
3721 (gnus-summary-initial-limit show-all))
3722 (gnus-summary-initial-limit show-all))
3723 ;; Generate the summary buffer.
3725 (gnus-summary-prepare))
3726 (when gnus-use-trees
3727 (gnus-tree-open group)
3728 (setq gnus-summary-highlight-line-function
3729 'gnus-tree-highlight-article))
3730 ;; If the summary buffer is empty, but there are some low-scored
3731 ;; articles or some excluded dormants, we include these in the
3733 (when (and (zerop (buffer-size))
3735 (cond (gnus-newsgroup-dormant
3736 (gnus-summary-limit-include-dormant))
3737 ((and gnus-newsgroup-scored show-all)
3738 (gnus-summary-limit-include-expunged t))))
3739 ;; Function `gnus-apply-kill-file' must be called in this hook.
3740 (gnus-run-hooks 'gnus-apply-kill-hook)
3741 (if (and (zerop (buffer-size))
3744 ;; This newsgroup is empty.
3745 (gnus-summary-catchup-and-exit nil t)
3746 (gnus-message 6 "No unread news")
3748 (gnus-kill-or-deaden-summary kill-buffer))
3749 ;; Return nil from this function.
3751 ;; Hide conversation thread subtrees. We cannot do this in
3752 ;; gnus-summary-prepare-hook since kill processing may not
3753 ;; work with hidden articles.
3754 (gnus-summary-maybe-hide-threads)
3756 (gnus-kill-or-deaden-summary kill-buffer))
3757 (gnus-summary-auto-select-subject)
3758 ;; Show first unread article if requested.
3759 (if (and (not no-article)
3761 gnus-newsgroup-unreads
3762 gnus-auto-select-first)
3764 (gnus-configure-windows 'summary)
3765 (let ((art (gnus-summary-article-number)))
3766 (unless (and (not gnus-plugged)
3767 (or (memq art gnus-newsgroup-undownloaded)
3768 (memq art gnus-newsgroup-downloadable)))
3769 (gnus-summary-goto-article art))))
3770 ;; Don't select any articles.
3771 (gnus-summary-position-point)
3772 (gnus-configure-windows 'summary 'force)
3773 (gnus-set-mode-line 'summary))
3774 (when (and gnus-auto-center-group
3775 (get-buffer-window gnus-group-buffer t))
3776 ;; Gotta use windows, because recenter does weird stuff if
3777 ;; the current buffer ain't the displayed window.
3778 (let ((owin (selected-window)))
3779 (select-window (get-buffer-window gnus-group-buffer t))
3780 (when (gnus-group-goto-group group)
3782 (select-window owin)))
3783 ;; Mark this buffer as "prepared".
3784 (setq gnus-newsgroup-prepared t)
3785 (gnus-run-hooks 'gnus-summary-prepared-hook)
3786 (unless (gnus-ephemeral-group-p group)
3787 (gnus-group-update-group group))
3790 (defun gnus-summary-auto-select-subject ()
3791 "Select the subject line on initial group entry."
3792 (goto-char (point-min))
3794 ((eq gnus-auto-select-subject 'best)
3795 (gnus-summary-best-unread-subject))
3796 ((eq gnus-auto-select-subject 'unread)
3797 (gnus-summary-first-unread-subject))
3798 ((eq gnus-auto-select-subject 'unseen)
3799 (gnus-summary-first-unseen-subject))
3800 ((eq gnus-auto-select-subject 'unseen-or-unread)
3801 (gnus-summary-first-unseen-or-unread-subject))
3802 ((eq gnus-auto-select-subject 'first)
3805 ((functionp gnus-auto-select-subject)
3806 (funcall gnus-auto-select-subject))))
3808 (defun gnus-summary-prepare ()
3809 "Generate the summary buffer."
3811 (let ((buffer-read-only nil))
3813 (setq gnus-newsgroup-data nil
3814 gnus-newsgroup-data-reverse nil)
3815 (gnus-run-hooks 'gnus-summary-generate-hook)
3816 ;; Generate the buffer, either with threads or without.
3817 (when gnus-newsgroup-headers
3818 (gnus-summary-prepare-threads
3819 (if gnus-show-threads
3820 (gnus-sort-gathered-threads
3821 (funcall gnus-summary-thread-gathering-function
3823 (gnus-cut-threads (gnus-make-threads)))))
3824 ;; Unthreaded display.
3825 (gnus-sort-articles gnus-newsgroup-headers))))
3826 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3827 ;; Call hooks for modifying summary buffer.
3828 (goto-char (point-min))
3829 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3831 (defsubst gnus-general-simplify-subject (subject)
3832 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3835 ;; Truncate the subject.
3836 (gnus-simplify-subject-functions
3837 (gnus-map-function gnus-simplify-subject-functions subject))
3838 ((numberp gnus-summary-gather-subject-limit)
3839 (setq subject (gnus-simplify-subject-re subject))
3840 (if (> (length subject) gnus-summary-gather-subject-limit)
3841 (substring subject 0 gnus-summary-gather-subject-limit)
3843 ;; Fuzzily simplify it.
3844 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3845 (gnus-simplify-subject-fuzzy subject))
3846 ;; Just remove the leading "Re:".
3848 (gnus-simplify-subject-re subject))))
3850 (if (and gnus-summary-gather-exclude-subject
3851 (string-match gnus-summary-gather-exclude-subject subject))
3852 nil ; This article shouldn't be gathered
3855 (defun gnus-summary-simplify-subject-query ()
3856 "Query where the respool algorithm would put this article."
3858 (gnus-summary-select-article)
3859 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3861 (defun gnus-gather-threads-by-subject (threads)
3862 "Gather threads by looking at Subject headers."
3863 (if (not gnus-summary-make-false-root)
3865 (let ((hashtb (gnus-make-hashtable 1024))
3868 subject hthread whole-subject)
3870 (setq subject (gnus-general-simplify-subject
3871 (setq whole-subject (mail-header-subject
3874 (if (setq hthread (gnus-gethash subject hashtb))
3876 ;; We enter a dummy root into the thread, if we
3877 ;; haven't done that already.
3878 (unless (stringp (caar hthread))
3879 (setcar hthread (list whole-subject (car hthread))))
3880 ;; We add this new gathered thread to this gathered
3882 (setcdr (car hthread)
3883 (nconc (cdar hthread) (list (car threads))))
3884 ;; Remove it from the list of threads.
3885 (setcdr prev (cdr threads))
3886 (setq threads prev))
3887 ;; Enter this thread into the hash table.
3888 (gnus-sethash subject
3889 (if gnus-summary-make-false-root-always
3891 ;; If you want a dummy root above all
3893 (setcar threads (list whole-subject
3899 (setq threads (cdr threads)))
3902 (defun gnus-gather-threads-by-references (threads)
3903 "Gather threads by looking at References headers."
3904 (let ((idhashtb (gnus-make-hashtable 1024))
3905 (thhashtb (gnus-make-hashtable 1024))
3908 ids references id gthread gid entered ref)
3910 (when (setq references (mail-header-references (caar threads)))
3911 (setq id (mail-header-id (caar threads))
3912 ids (inline (gnus-split-references references))
3914 (while (setq ref (pop ids))
3915 (setq ids (delete ref ids))
3916 (if (not (setq gid (gnus-gethash ref idhashtb)))
3918 (gnus-sethash ref id idhashtb)
3919 (gnus-sethash id threads thhashtb))
3920 (setq gthread (gnus-gethash gid thhashtb))
3922 ;; We enter a dummy root into the thread, if we
3923 ;; haven't done that already.
3924 (unless (stringp (caar gthread))
3925 (setcar gthread (list (mail-header-subject (caar gthread))
3927 ;; We add this new gathered thread to this gathered
3929 (setcdr (car gthread)
3930 (nconc (cdar gthread) (list (car threads)))))
3931 ;; Add it into the thread hash table.
3932 (gnus-sethash id gthread thhashtb)
3934 ;; Remove it from the list of threads.
3935 (setcdr prev (cdr threads))
3936 (setq threads prev))))
3938 (setq threads (cdr threads)))
3941 (defun gnus-sort-gathered-threads (threads)
3942 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3943 (let ((result threads))
3945 (when (stringp (caar threads))
3946 (setcdr (car threads)
3947 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3948 (setq threads (cdr threads)))
3951 (defun gnus-thread-loop-p (root thread)
3952 "Say whether ROOT is in THREAD."
3953 (let ((stack (list thread))
3956 (while (setq thread (pop stack))
3957 (setq th (cdr thread))
3959 (not (eq (caar th) root)))
3962 ;; We have found a loop.
3964 (setcdr thread (delq (car th) (cdr thread)))
3965 (if (boundp (setq ref-dep (intern "none"
3966 gnus-newsgroup-dependencies)))
3967 (setcdr (symbol-value ref-dep)
3968 (nconc (cdr (symbol-value ref-dep))
3970 (set ref-dep (list nil (car th))))
3973 ;; Push all the subthreads onto the stack.
3974 (push (cdr thread) stack)))
3977 (defun gnus-make-threads ()
3978 "Go through the dependency hashtb and find the roots. Return all threads."
3980 (while (catch 'infloop
3983 ;; Deal with self-referencing References loops.
3984 (when (and (car (symbol-value refs))
3991 (car (symbol-value refs)) thread))
3992 (cdr (symbol-value refs)))))))
3995 (unless (car (symbol-value refs))
3996 ;; These threads do not refer back to any other
3997 ;; articles, so they're roots.
3998 (setq threads (append (cdr (symbol-value refs)) threads))))
3999 gnus-newsgroup-dependencies)))
4002 ;; Build the thread tree.
4003 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4004 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4006 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4007 if it was already present.
4009 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4010 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4011 Message-IDs will be renamed to a unique Message-ID before being
4014 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4015 (let* ((id (mail-header-id header))
4016 (id-dep (and id (intern id dependencies)))
4017 parent-id ref ref-dep ref-header replaced)
4018 ;; Enter this `header' in the `dependencies' table.
4022 ;; The first two cases do the normal part: enter a new `header'
4023 ;; in the `dependencies' table.
4024 ((not (boundp id-dep))
4025 (set id-dep (list header)))
4026 ((null (car (symbol-value id-dep)))
4027 (setcar (symbol-value id-dep) header))
4029 ;; From here the `header' was already present in the
4030 ;; `dependencies' table.
4032 ;; Overrides an existing entry;
4033 ;; just set the header part of the entry.
4034 (setcar (symbol-value id-dep) header)
4037 ;; Renames the existing `header' to a unique Message-ID.
4038 ((not gnus-summary-ignore-duplicates)
4039 ;; An article with this Message-ID has already been seen.
4040 ;; We rename the Message-ID.
4041 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4043 (mail-header-set-id header id))
4045 ;; The last case ignores an existing entry, except it adds any
4046 ;; additional Xrefs (in case the two articles came from different
4048 ;; Also sets `header' to `nil' meaning that the `dependencies'
4049 ;; table was *not* modified.
4051 (mail-header-set-xref
4052 (car (symbol-value id-dep))
4053 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4055 (or (mail-header-xref header) "")))
4058 (when (and header (not replaced))
4059 ;; First check that we are not creating a References loop.
4060 (setq parent-id (gnus-parent-id (mail-header-references header)))
4061 (setq ref parent-id)
4063 (setq ref-dep (intern-soft ref dependencies))
4065 (setq ref-header (car (symbol-value ref-dep))))
4066 (if (string= id ref)
4067 ;; Yuk! This is a reference loop. Make the article be a
4070 (mail-header-set-references (car (symbol-value id-dep)) "none")
4072 (setq parent-id nil))
4073 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4074 (setq ref-dep (intern (or parent-id "none") dependencies))
4075 (if (boundp ref-dep)
4076 (setcdr (symbol-value ref-dep)
4077 (nconc (cdr (symbol-value ref-dep))
4078 (list (symbol-value id-dep))))
4079 (set ref-dep (list nil (symbol-value id-dep)))))
4082 (defun gnus-extract-message-id-from-in-reply-to (string)
4083 (if (string-match "<[^>]+>" string)
4084 (substring string (match-beginning 0) (match-end 0))
4087 (defun gnus-build-sparse-threads ()
4088 (let ((headers gnus-newsgroup-headers)
4089 (mail-parse-charset gnus-newsgroup-charset)
4090 (gnus-summary-ignore-duplicates t)
4091 header references generation relations
4092 subject child end new-child date)
4093 ;; First we create an alist of generations/relations, where
4094 ;; generations is how much we trust the relation, and the relation
4096 (gnus-message 7 "Making sparse threads...")
4098 (nnheader-set-temp-buffer " *gnus sparse threads*")
4099 (while (setq header (pop headers))
4100 (when (and (setq references (mail-header-references header))
4101 (not (string= references "")))
4103 (setq child (mail-header-id header)
4104 subject (mail-header-subject header)
4105 date (mail-header-date header)
4107 (while (search-backward ">" nil t)
4108 (setq end (1+ (point)))
4109 (when (search-backward "<" nil t)
4110 (setq new-child (buffer-substring (point) end))
4111 (push (list (incf generation)
4112 child (setq child new-child)
4116 (push (list (1+ generation) child nil subject) relations))
4118 (kill-buffer (current-buffer)))
4119 ;; Sort over trustworthiness.
4122 (when (gnus-dependencies-add-header
4123 (make-full-mail-header
4124 gnus-reffed-article-number
4125 (nth 3 relation) "" (or (nth 4 relation) "")
4127 (or (nth 2 relation) "") 0 0 "")
4128 gnus-newsgroup-dependencies nil)
4129 (push gnus-reffed-article-number gnus-newsgroup-limit)
4130 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4131 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4132 gnus-newsgroup-reads)
4133 (decf gnus-reffed-article-number)))
4134 (sort relations 'car-less-than-car))
4135 (gnus-message 7 "Making sparse threads...done")))
4137 (defun gnus-build-old-threads ()
4138 ;; Look at all the articles that refer back to old articles, and
4139 ;; fetch the headers for the articles that aren't there. This will
4140 ;; build complete threads - if the roots haven't been expired by the
4142 (let ((mail-parse-charset gnus-newsgroup-charset)
4146 (when (not (car (symbol-value refs)))
4147 (setq heads (cdr (symbol-value refs)))
4149 (if (memq (mail-header-number (caar heads))
4150 gnus-newsgroup-dormant)
4151 (setq heads (cdr heads))
4152 (setq id (symbol-name refs))
4153 (while (and (setq id (gnus-build-get-header id))
4154 (not (car (gnus-id-to-thread id)))))
4155 (setq heads nil)))))
4156 gnus-newsgroup-dependencies)))
4158 (defsubst gnus-remove-odd-characters (string)
4159 "Translate STRING into something that doesn't contain weird characters."
4160 (mm-subst-char-in-string
4162 (mm-subst-char-in-string
4165 ;; This function has to be called with point after the article number
4166 ;; on the beginning of the line.
4167 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4168 (let ((eol (gnus-point-at-eol))
4169 (buffer (current-buffer))
4170 header references in-reply-to)
4172 ;; overview: [num subject from date id refs chars lines misc]
4175 (narrow-to-region (point) eol)
4180 (make-full-mail-header
4182 (condition-case () ; subject
4183 (gnus-remove-odd-characters
4184 (funcall gnus-decode-encoded-word-function
4185 (setq x (nnheader-nov-field))))
4187 (condition-case () ; from
4188 (gnus-remove-odd-characters
4189 (funcall gnus-decode-encoded-address-function
4190 (setq x (nnheader-nov-field))))
4192 (nnheader-nov-field) ; date
4193 (nnheader-nov-read-message-id) ; id
4194 (setq references (nnheader-nov-field)) ; refs
4195 (nnheader-nov-read-integer) ; chars
4196 (nnheader-nov-read-integer) ; lines
4198 (if (looking-at "Xref: ")
4199 (goto-char (match-end 0)))
4200 (nnheader-nov-field)) ; Xref
4201 (nnheader-nov-parse-extra)))) ; extra
4205 (when (and (string= references "")
4206 (setq in-reply-to (mail-header-extra header))
4207 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4208 (mail-header-set-references
4209 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4211 (when gnus-alter-header-function
4212 (funcall gnus-alter-header-function header))
4213 (gnus-dependencies-add-header header dependencies force-new)))
4215 (defun gnus-build-get-header (id)
4216 "Look through the buffer of NOV lines and find the header to ID.
4217 Enter this line into the dependencies hash table, and return
4218 the id of the parent article (if any)."
4219 (let ((deps gnus-newsgroup-dependencies)
4223 (set-buffer nntp-server-buffer)
4224 (let ((case-fold-search nil))
4225 (goto-char (point-min))
4226 (while (and (not found)
4227 (search-forward id nil t))
4229 (setq found (looking-at
4230 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4231 (regexp-quote id))))
4232 (or found (beginning-of-line 2)))
4236 (setq header (gnus-nov-parse-line
4237 (read (current-buffer)) deps))
4238 (gnus-parent-id (mail-header-references header))))))
4240 (let ((number (mail-header-number header)))
4241 (push number gnus-newsgroup-limit)
4242 (push header gnus-newsgroup-headers)
4243 (if (memq number gnus-newsgroup-unselected)
4245 (setq gnus-newsgroup-unreads
4246 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4248 (setq gnus-newsgroup-unselected
4249 (delq number gnus-newsgroup-unselected)))
4250 (push number gnus-newsgroup-ancient)))))))
4252 (defun gnus-build-all-threads ()
4253 "Read all the headers."
4254 (let ((gnus-summary-ignore-duplicates t)
4255 (mail-parse-charset gnus-newsgroup-charset)
4256 (dependencies gnus-newsgroup-dependencies)
4259 (set-buffer nntp-server-buffer)
4260 (let ((case-fold-search nil))
4261 (goto-char (point-min))
4264 (setq article (read (current-buffer))
4265 header (gnus-nov-parse-line article dependencies)))
4268 (set-buffer gnus-summary-buffer)
4269 (push header gnus-newsgroup-headers)
4270 (if (memq (setq article (mail-header-number header))
4271 gnus-newsgroup-unselected)
4273 (setq gnus-newsgroup-unreads
4274 (gnus-add-to-sorted-list
4275 gnus-newsgroup-unreads article))
4276 (setq gnus-newsgroup-unselected
4277 (delq article gnus-newsgroup-unselected)))
4278 (push article gnus-newsgroup-ancient)))
4279 (forward-line 1)))))))
4281 (defun gnus-summary-update-article-line (article header)
4282 "Update the line for ARTICLE using HEADER."
4283 (let* ((id (mail-header-id header))
4284 (thread (gnus-id-to-thread id)))
4286 (error "Article in no thread"))
4287 ;; Update the thread.
4288 (setcar thread header)
4289 (gnus-summary-goto-subject article)
4290 (let* ((datal (gnus-data-find-list article))
4292 (buffer-read-only nil)
4293 (level (gnus-summary-thread-level)))
4295 (let ((inserted (- (point)
4297 (gnus-summary-insert-line
4299 (memq article gnus-newsgroup-undownloaded)
4300 (gnus-article-mark article)
4301 (memq article gnus-newsgroup-replied)
4302 (memq article gnus-newsgroup-expirable)
4303 ;; Only insert the Subject string when it's different
4304 ;; from the previous Subject string.
4309 (mail-header-subject
4312 (gnus-data-find-list
4314 (gnus-data-list t)))))
4315 ;; Error on the side of excessive subjects.
4317 (mail-header-subject header)))
4319 (mail-header-subject header))
4320 nil (cdr (assq article gnus-newsgroup-scored))
4321 (memq article gnus-newsgroup-processable))
4324 (gnus-data-update-list
4326 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4328 (defun gnus-summary-update-article (article &optional iheader)
4329 "Update ARTICLE in the summary buffer."
4330 (set-buffer gnus-summary-buffer)
4331 (let* ((header (gnus-summary-article-header article))
4332 (id (mail-header-id header))
4333 (data (gnus-data-find article))
4334 (thread (gnus-id-to-thread id))
4335 (references (mail-header-references header))
4339 (when (and references
4340 (not (equal "" references)))
4343 (buffer-read-only nil)
4349 (delq thread parent)))
4350 (if (gnus-summary-insert-subject id header)
4351 ;; Set the (possibly) new article number in the data structure.
4352 (gnus-data-set-number data (gnus-id-to-article id))
4356 (defun gnus-rebuild-thread (id &optional line)
4357 "Rebuild the thread containing ID.
4358 If LINE, insert the rebuilt thread starting on line LINE."
4359 (let ((buffer-read-only nil)
4360 old-pos current thread data)
4361 (if (not gnus-show-threads)
4362 (setq thread (list (car (gnus-id-to-thread id))))
4363 ;; Get the thread this article is part of.
4364 (setq thread (gnus-remove-thread id)))
4365 (setq old-pos (gnus-point-at-bol))
4366 (setq current (save-excursion
4367 (and (re-search-backward "[\r\n]" nil t)
4368 (gnus-summary-article-number))))
4369 ;; If this is a gathered thread, we have to go some re-gathering.
4370 (when (stringp (car thread))
4371 (let ((subject (car thread))
4373 (setq thread (cdr thread))
4375 (unless (memq (setq thr (gnus-id-to-thread
4377 (mail-header-id (caar thread)))))
4380 (setq thread (cdr thread)))
4381 ;; We now have all (unique) roots.
4382 (if (= (length roots) 1)
4383 ;; All the loose roots are now one solid root.
4384 (setq thread (car roots))
4385 (setq thread (cons subject (gnus-sort-threads roots))))))
4387 ;; We then insert this thread into the summary buffer.
4389 (goto-char (point-min))
4390 (forward-line (1- line)))
4391 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4392 (if gnus-show-threads
4393 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4394 (gnus-summary-prepare-unthreaded thread))
4395 (setq data (nreverse gnus-newsgroup-data))
4396 (setq threads gnus-newsgroup-threads))
4397 ;; We splice the new data into the data structure.
4398 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4399 ;;!!! then we want to insert at the beginning of the buffer.
4400 ;;!!! That happens to be true with Gnus now, but that may
4401 ;;!!! change in the future. Perhaps.
4402 (gnus-data-enter-list
4403 (if line nil current) data (- (point) old-pos))
4404 (setq gnus-newsgroup-threads
4405 (nconc threads gnus-newsgroup-threads))
4406 (gnus-data-compute-positions))))
4408 (defun gnus-number-to-header (number)
4409 "Return the header for article NUMBER."
4410 (let ((headers gnus-newsgroup-headers))
4412 (not (= number (mail-header-number (car headers)))))
4417 (defun gnus-parent-headers (in-headers &optional generation)
4418 "Return the headers of the GENERATIONeth parent of HEADERS."
4420 (setq generation 1))
4422 (headers in-headers)
4425 (not (zerop generation))
4426 (setq references (mail-header-references headers)))
4427 (setq headers (if (and references
4428 (setq parent (gnus-parent-id references)))
4429 (car (gnus-id-to-thread parent))
4432 (and (not (eq headers in-headers))
4435 (defun gnus-id-to-thread (id)
4436 "Return the (sub-)thread where ID appears."
4437 (gnus-gethash id gnus-newsgroup-dependencies))
4439 (defun gnus-id-to-article (id)
4440 "Return the article number of ID."
4441 (let ((thread (gnus-id-to-thread id)))
4444 (mail-header-number (car thread)))))
4446 (defun gnus-id-to-header (id)
4447 "Return the article headers of ID."
4448 (car (gnus-id-to-thread id)))
4450 (defun gnus-article-displayed-root-p (article)
4451 "Say whether ARTICLE is a root(ish) article."
4452 (let ((level (gnus-summary-thread-level article))
4453 (refs (mail-header-references (gnus-summary-article-header article)))
4459 ((null (gnus-parent-id refs)) t)
4461 (null (setq particle (gnus-id-to-article
4462 (gnus-parent-id refs))))
4463 (null (gnus-summary-thread-level particle)))))))
4465 (defun gnus-root-id (id)
4466 "Return the id of the root of the thread where ID appears."
4468 (while (and id (setq prev (car (gnus-id-to-thread id))))
4470 id (gnus-parent-id (mail-header-references prev))))
4473 (defun gnus-articles-in-thread (thread)
4474 "Return the list of articles in THREAD."
4475 (cons (mail-header-number (car thread))
4476 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4478 (defun gnus-remove-thread (id &optional dont-remove)
4479 "Remove the thread that has ID in it."
4480 (let (headers thread last-id)
4481 ;; First go up in this thread until we find the root.
4482 (setq last-id (gnus-root-id id)
4483 headers (message-flatten-list (gnus-id-to-thread last-id)))
4484 ;; We have now found the real root of this thread. It might have
4485 ;; been gathered into some loose thread, so we have to search
4486 ;; through the threads to find the thread we wanted.
4487 (let ((threads gnus-newsgroup-threads)
4490 (setq sub (car threads))
4491 (if (stringp (car sub))
4492 ;; This is a gathered thread, so we look at the roots
4493 ;; below it to find whether this article is in this
4496 (setq sub (cdr sub))
4498 (when (member (caar sub) headers)
4499 (setq thread (car threads)
4502 (setq sub (cdr sub))))
4503 ;; It's an ordinary thread, so we check it.
4504 (when (eq (car sub) (car headers))
4507 (setq threads (cdr threads)))
4508 ;; If this article is in no thread, then it's a root.
4511 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4512 (setq thread (gnus-id-to-thread last-id)))
4515 thread ; We return this thread.
4517 (if (stringp (car thread))
4519 ;; If we use dummy roots, then we have to remove the
4520 ;; dummy root as well.
4521 (when (eq gnus-summary-make-false-root 'dummy)
4522 ;; We go to the dummy root by going to
4523 ;; the first sub-"thread", and then one line up.
4524 (gnus-summary-goto-article
4525 (mail-header-number (caadr thread)))
4528 (gnus-data-compute-positions))
4529 (setq thread (cdr thread))
4531 (gnus-remove-thread-1 (car thread))
4532 (setq thread (cdr thread))))
4533 (gnus-remove-thread-1 thread))))))))
4535 (defun gnus-remove-thread-1 (thread)
4536 "Remove the thread THREAD recursively."
4537 (let ((number (mail-header-number (pop thread)))
4539 (setq thread (reverse thread))
4541 (gnus-remove-thread-1 (pop thread)))
4542 (when (setq d (gnus-data-find number))
4543 (goto-char (gnus-data-pos d))
4544 (gnus-summary-show-thread)
4547 (- (gnus-point-at-bol)
4549 (1+ (gnus-point-at-eol))
4550 (gnus-delete-line)))))))
4552 (defun gnus-sort-threads-1 (threads func)
4553 (sort (mapcar (lambda (thread)
4556 (gnus-sort-threads-1 (cdr thread) func))))
4559 (defun gnus-sort-threads (threads)
4561 (if (not gnus-thread-sort-functions)
4563 (gnus-message 8 "Sorting threads...")
4564 (let ((max-lisp-eval-depth 5000))
4565 (prog1 (gnus-sort-threads-1
4567 (gnus-make-sort-function gnus-thread-sort-functions))
4568 (gnus-message 8 "Sorting threads...done")))))
4570 (defun gnus-sort-articles (articles)
4572 (when gnus-article-sort-functions
4573 (gnus-message 7 "Sorting articles...")
4575 (setq gnus-newsgroup-headers
4576 (sort articles (gnus-make-sort-function
4577 gnus-article-sort-functions)))
4578 (gnus-message 7 "Sorting articles...done"))))
4580 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4581 (defmacro gnus-thread-header (thread)
4582 "Return header of first article in THREAD.
4583 Note that THREAD must never, ever be anything else than a variable -
4584 using some other form will lead to serious barfage."
4585 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4586 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4587 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4590 (defsubst gnus-article-sort-by-number (h1 h2)
4591 "Sort articles by article number."
4592 (< (mail-header-number h1)
4593 (mail-header-number h2)))
4595 (defun gnus-thread-sort-by-number (h1 h2)
4596 "Sort threads by root article number."
4597 (gnus-article-sort-by-number
4598 (gnus-thread-header h1) (gnus-thread-header h2)))
4600 (defsubst gnus-article-sort-by-random (h1 h2)
4601 "Sort articles by article number."
4604 (defun gnus-thread-sort-by-random (h1 h2)
4605 "Sort threads by root article number."
4606 (gnus-article-sort-by-random
4607 (gnus-thread-header h1) (gnus-thread-header h2)))
4609 (defsubst gnus-article-sort-by-lines (h1 h2)
4610 "Sort articles by article Lines header."
4611 (< (mail-header-lines h1)
4612 (mail-header-lines h2)))
4614 (defun gnus-thread-sort-by-lines (h1 h2)
4615 "Sort threads by root article Lines header."
4616 (gnus-article-sort-by-lines
4617 (gnus-thread-header h1) (gnus-thread-header h2)))
4619 (defsubst gnus-article-sort-by-chars (h1 h2)
4620 "Sort articles by octet length."
4621 (< (mail-header-chars h1)
4622 (mail-header-chars h2)))
4624 (defun gnus-thread-sort-by-chars (h1 h2)
4625 "Sort threads by root article octet length."
4626 (gnus-article-sort-by-chars
4627 (gnus-thread-header h1) (gnus-thread-header h2)))
4629 (defsubst gnus-article-sort-by-author (h1 h2)
4630 "Sort articles by root author."
4632 (let ((extract (funcall
4633 gnus-extract-address-components
4634 (mail-header-from h1))))
4635 (or (car extract) (cadr extract) ""))
4636 (let ((extract (funcall
4637 gnus-extract-address-components
4638 (mail-header-from h2))))
4639 (or (car extract) (cadr extract) ""))))
4641 (defun gnus-thread-sort-by-author (h1 h2)
4642 "Sort threads by root author."
4643 (gnus-article-sort-by-author
4644 (gnus-thread-header h1) (gnus-thread-header h2)))
4646 (defsubst gnus-article-sort-by-subject (h1 h2)
4647 "Sort articles by root subject."
4649 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4650 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4652 (defun gnus-thread-sort-by-subject (h1 h2)
4653 "Sort threads by root subject."
4654 (gnus-article-sort-by-subject
4655 (gnus-thread-header h1) (gnus-thread-header h2)))
4657 (defsubst gnus-article-sort-by-date (h1 h2)
4658 "Sort articles by root article date."
4660 (gnus-date-get-time (mail-header-date h1))
4661 (gnus-date-get-time (mail-header-date h2))))
4663 (defun gnus-thread-sort-by-date (h1 h2)
4664 "Sort threads by root article date."
4665 (gnus-article-sort-by-date
4666 (gnus-thread-header h1) (gnus-thread-header h2)))
4668 (defsubst gnus-article-sort-by-score (h1 h2)
4669 "Sort articles by root article score.
4670 Unscored articles will be counted as having a score of zero."
4671 (> (or (cdr (assq (mail-header-number h1)
4672 gnus-newsgroup-scored))
4673 gnus-summary-default-score 0)
4674 (or (cdr (assq (mail-header-number h2)
4675 gnus-newsgroup-scored))
4676 gnus-summary-default-score 0)))
4678 (defun gnus-thread-sort-by-score (h1 h2)
4679 "Sort threads by root article score."
4680 (gnus-article-sort-by-score
4681 (gnus-thread-header h1) (gnus-thread-header h2)))
4683 (defun gnus-thread-sort-by-total-score (h1 h2)
4684 "Sort threads by the sum of all scores in the thread.
4685 Unscored articles will be counted as having a score of zero."
4686 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4688 (defun gnus-thread-total-score (thread)
4689 ;; This function find the total score of THREAD.
4694 (if (stringp (car thread))
4695 (apply gnus-thread-score-function 0
4696 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4697 (gnus-thread-total-score-1 thread)))
4699 (gnus-thread-total-score-1 (list thread)))))
4701 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4702 "Sort threads such that the thread with the most recently arrived article comes first."
4703 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4705 (defun gnus-thread-highest-number (thread)
4706 "Return the highest article number in THREAD."
4707 (apply 'max (mapcar (lambda (header)
4708 (mail-header-number header))
4709 (message-flatten-list thread))))
4711 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4712 "Sort threads such that the thread with the most recently dated article comes first."
4713 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4715 (defun gnus-thread-latest-date (thread)
4716 "Return the highest article date in THREAD."
4717 (let ((previous-time 0))
4723 (time-to-seconds (mail-header-parse-date
4724 (mail-header-date header)))
4725 (error previous-time))))
4727 (message-flatten-list thread)
4729 (< (mail-header-number h1)
4730 (mail-header-number h2))))))))
4732 (defun gnus-thread-total-score-1 (root)
4733 ;; This function find the total score of the thread below ROOT.
4734 (setq root (car root))
4735 (apply gnus-thread-score-function
4737 (mapcar 'gnus-thread-total-score
4738 (cdr (gnus-id-to-thread (mail-header-id root))))
4739 (when (> (mail-header-number root) 0)
4740 (list (or (cdr (assq (mail-header-number root)
4741 gnus-newsgroup-scored))
4742 gnus-summary-default-score 0))))
4743 (list gnus-summary-default-score)
4746 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4747 (defvar gnus-tmp-prev-subject nil)
4748 (defvar gnus-tmp-false-parent nil)
4749 (defvar gnus-tmp-root-expunged nil)
4750 (defvar gnus-tmp-dummy-line nil)
4752 (eval-when-compile (defvar gnus-tmp-header))
4753 (defun gnus-extra-header (type &optional header)
4754 "Return the extra header of TYPE."
4755 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4758 (defvar gnus-tmp-thread-tree-header-string "")
4760 (defcustom gnus-sum-thread-tree-root "> "
4761 "With %B spec, used for the root of a thread.
4762 If nil, use subject instead."
4764 :type '(radio (const :format "%v " nil) string)
4765 :group 'gnus-thread)
4766 (defcustom gnus-sum-thread-tree-false-root "> "
4767 "With %B spec, used for a false root of a thread.
4768 If nil, use subject instead."
4770 :type '(radio (const :format "%v " nil) string)
4771 :group 'gnus-thread)
4772 (defcustom gnus-sum-thread-tree-single-indent ""
4773 "With %B spec, used for a thread with just one message.
4774 If nil, use subject instead."
4776 :type '(radio (const :format "%v " nil) string)
4777 :group 'gnus-thread)
4778 (defcustom gnus-sum-thread-tree-vertical "| "
4779 "With %B spec, used for drawing a vertical line."
4782 :group 'gnus-thread)
4783 (defcustom gnus-sum-thread-tree-indent " "
4784 "With %B spec, used for indenting."
4787 :group 'gnus-thread)
4788 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4789 "With %B spec, used for a leaf with brothers."
4792 :group 'gnus-thread)
4793 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4794 "With %B spec, used for a leaf without brothers."
4797 :group 'gnus-thread)
4799 (defun gnus-summary-prepare-threads (threads)
4800 "Prepare summary buffer from THREADS and indentation LEVEL.
4801 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4802 or a straight list of headers."
4803 (gnus-message 7 "Generating summary...")
4805 (setq gnus-newsgroup-threads threads)
4808 (let ((gnus-tmp-level 0)
4809 (default-score (or gnus-summary-default-score 0))
4810 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4811 (building-line-count gnus-summary-display-while-building)
4812 (building-count (integerp gnus-summary-display-while-building))
4813 thread number subject stack state gnus-tmp-gathered beg-match
4814 new-roots gnus-tmp-new-adopts thread-end simp-subject
4815 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4816 gnus-tmp-replied gnus-tmp-subject-or-nil
4817 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4818 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4819 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4822 (setq gnus-tmp-prev-subject nil
4823 gnus-tmp-thread-tree-header-string "")
4825 (if (vectorp (car threads))
4826 ;; If this is a straight (sic) list of headers, then a
4827 ;; threaded summary display isn't required, so we just create
4828 ;; an unthreaded one.
4829 (gnus-summary-prepare-unthreaded threads)
4831 ;; Do the threaded display.
4833 (if gnus-summary-display-while-building
4834 (switch-to-buffer (buffer-name)))
4835 (while (or threads stack gnus-tmp-new-adopts new-roots)
4837 (if (and (= gnus-tmp-level 0)
4840 (not gnus-tmp-false-parent)
4841 (or gnus-tmp-new-adopts new-roots))
4842 (if gnus-tmp-new-adopts
4843 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4844 thread (list (car gnus-tmp-new-adopts))
4845 gnus-tmp-header (caar thread)
4846 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4848 (setq thread (list (car new-roots))
4849 gnus-tmp-header (caar thread)
4850 new-roots (cdr new-roots))))
4853 ;; If there are some threads, we do them before the
4854 ;; threads on the stack.
4855 (setq thread threads
4856 gnus-tmp-header (caar thread))
4857 ;; There were no current threads, so we pop something off
4859 (setq state (car stack)
4860 gnus-tmp-level (car state)
4861 tree-stack (cadr state)
4862 thread (caddr state)
4864 gnus-tmp-header (caar thread))))
4866 (setq gnus-tmp-false-parent nil)
4867 (setq gnus-tmp-root-expunged nil)
4868 (setq thread-end nil)
4870 (if (stringp gnus-tmp-header)
4871 ;; The header is a dummy root.
4873 ((eq gnus-summary-make-false-root 'adopt)
4874 ;; We let the first article adopt the rest.
4875 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4877 (setq gnus-tmp-gathered
4879 (lambda (h) (mail-header-number (car h)))
4882 (setq thread (cons (list (caar thread)
4885 (setq gnus-tmp-level -1
4886 gnus-tmp-false-parent t))
4887 ((eq gnus-summary-make-false-root 'empty)
4888 ;; We print adopted articles with empty subject fields.
4889 (setq gnus-tmp-gathered
4891 (lambda (h) (mail-header-number (car h)))
4894 (setq gnus-tmp-level -1))
4895 ((eq gnus-summary-make-false-root 'dummy)
4896 ;; We remember that we probably want to output a dummy
4898 (setq gnus-tmp-dummy-line gnus-tmp-header)
4899 (setq gnus-tmp-prev-subject gnus-tmp-header))
4901 ;; We do not make a root for the gathered
4902 ;; sub-threads at all.
4903 (setq gnus-tmp-level -1)))
4905 (setq number (mail-header-number gnus-tmp-header)
4906 subject (mail-header-subject gnus-tmp-header)
4907 simp-subject (gnus-simplify-subject-fully subject))
4910 ;; If the thread has changed subject, we might want to make
4911 ;; this subthread into a root.
4912 ((and (null gnus-thread-ignore-subject)
4913 (not (zerop gnus-tmp-level))
4914 gnus-tmp-prev-subject
4915 (not (string= gnus-tmp-prev-subject simp-subject)))
4916 (setq new-roots (nconc new-roots (list (car thread)))
4918 gnus-tmp-header nil))
4919 ;; If the article lies outside the current limit,
4920 ;; then we do not display it.
4921 ((not (memq number gnus-newsgroup-limit))
4922 (setq gnus-tmp-gathered
4924 (lambda (h) (mail-header-number (car h)))
4927 (setq gnus-tmp-new-adopts (if (cdar thread)
4928 (append gnus-tmp-new-adopts
4930 gnus-tmp-new-adopts)
4932 gnus-tmp-header nil)
4933 (when (zerop gnus-tmp-level)
4934 (setq gnus-tmp-root-expunged t)))
4935 ;; Perhaps this article is to be marked as read?
4936 ((and gnus-summary-mark-below
4937 (< (or (cdr (assq number gnus-newsgroup-scored))
4939 gnus-summary-mark-below)
4940 ;; Don't touch sparse articles.
4941 (not (gnus-summary-article-sparse-p number))
4942 (not (gnus-summary-article-ancient-p number)))
4943 (setq gnus-newsgroup-unreads
4944 (delq number gnus-newsgroup-unreads))
4945 (if gnus-newsgroup-auto-expire
4946 (setq gnus-newsgroup-expirable
4947 (gnus-add-to-sorted-list
4948 gnus-newsgroup-expirable number))
4949 (push (cons number gnus-low-score-mark)
4950 gnus-newsgroup-reads))))
4952 (when gnus-tmp-header
4953 ;; We may have an old dummy line to output before this
4955 (when (and gnus-tmp-dummy-line
4958 (mail-header-subject gnus-tmp-header)))
4959 (gnus-summary-insert-dummy-line
4960 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4961 (setq gnus-tmp-dummy-line nil))
4963 ;; Compute the mark.
4964 (setq gnus-tmp-unread (gnus-article-mark number))
4966 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4967 gnus-tmp-header gnus-tmp-level)
4968 gnus-newsgroup-data)
4970 ;; Actually insert the line.
4972 gnus-tmp-subject-or-nil
4974 ((and gnus-thread-ignore-subject
4975 gnus-tmp-prev-subject
4976 (not (string= gnus-tmp-prev-subject simp-subject)))
4978 ((zerop gnus-tmp-level)
4979 (if (and (eq gnus-summary-make-false-root 'empty)
4980 (memq number gnus-tmp-gathered)
4981 gnus-tmp-prev-subject
4982 (string= gnus-tmp-prev-subject simp-subject))
4983 gnus-summary-same-subject
4985 (t gnus-summary-same-subject)))
4986 (if (and (eq gnus-summary-make-false-root 'adopt)
4987 (= gnus-tmp-level 1)
4988 (memq number gnus-tmp-gathered))
4989 (setq gnus-tmp-opening-bracket ?\<
4990 gnus-tmp-closing-bracket ?\>)
4991 (setq gnus-tmp-opening-bracket ?\[
4992 gnus-tmp-closing-bracket ?\]))
4994 gnus-tmp-indentation
4995 (aref gnus-thread-indent-array gnus-tmp-level)
4996 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4997 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4998 gnus-summary-default-score 0)
5000 (if (or (null gnus-summary-default-score)
5001 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5002 gnus-summary-zcore-fuzz))
5004 (if (< gnus-tmp-score gnus-summary-default-score)
5005 gnus-score-below-mark gnus-score-over-mark))
5007 (cond ((memq number gnus-newsgroup-processable)
5009 ((memq number gnus-newsgroup-cached)
5011 ((memq number gnus-newsgroup-replied)
5013 ((memq number gnus-newsgroup-forwarded)
5014 gnus-forwarded-mark)
5015 ((memq number gnus-newsgroup-saved)
5017 ((memq number gnus-newsgroup-recent)
5019 ((memq number gnus-newsgroup-unseen)
5023 (cond ((memq number gnus-newsgroup-undownloaded)
5024 gnus-undownloaded-mark)
5025 (gnus-newsgroup-agentized
5026 gnus-downloaded-mark)
5029 gnus-tmp-from (mail-header-from gnus-tmp-header)
5032 ((string-match "<[^>]+> *$" gnus-tmp-from)
5033 (setq beg-match (match-beginning 0))
5034 (or (and (string-match "^\".+\"" gnus-tmp-from)
5035 (substring gnus-tmp-from 1 (1- (match-end 0))))
5036 (substring gnus-tmp-from 0 beg-match)))
5037 ((string-match "(.+)" gnus-tmp-from)
5038 (substring gnus-tmp-from
5039 (1+ (match-beginning 0)) (1- (match-end 0))))
5043 gnus-tmp-thread-tree-header-string
5045 ((not gnus-show-threads) "")
5046 ((zerop gnus-tmp-level)
5047 (cond ((cdar thread)
5048 (or gnus-sum-thread-tree-root subject))
5049 (gnus-tmp-new-adopts
5050 (or gnus-sum-thread-tree-false-root subject))
5052 (or gnus-sum-thread-tree-single-indent subject))))
5054 (concat (apply 'concat
5055 (mapcar (lambda (item)
5057 gnus-sum-thread-tree-vertical
5058 gnus-sum-thread-tree-indent))
5059 (cdr (reverse tree-stack))))
5061 gnus-sum-thread-tree-leaf-with-other
5062 gnus-sum-thread-tree-single-leaf)))))
5063 (when (string= gnus-tmp-name "")
5064 (setq gnus-tmp-name gnus-tmp-from))
5065 (unless (numberp gnus-tmp-lines)
5066 (setq gnus-tmp-lines -1))
5067 (if (= gnus-tmp-lines -1)
5068 (setq gnus-tmp-lines "?")
5069 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5070 (gnus-put-text-property
5072 (progn (eval gnus-summary-line-format-spec) (point))
5073 'gnus-number number)
5076 (gnus-run-hooks 'gnus-summary-update-hook)
5079 (setq gnus-tmp-prev-subject simp-subject)))
5081 (when (nth 1 thread)
5082 (push (list (max 0 gnus-tmp-level)
5083 (copy-sequence tree-stack)
5086 (push (if (nth 1 thread) 1 0) tree-stack)
5087 (incf gnus-tmp-level)
5088 (setq threads (if thread-end nil (cdar thread)))
5089 (if gnus-summary-display-while-building
5092 ;; use a set frequency
5093 (setq building-line-count (1- building-line-count))
5094 (when (= building-line-count 0)
5096 (setq building-line-count
5097 gnus-summary-display-while-building)))
5101 (setq gnus-tmp-level 0)))))
5102 (gnus-message 7 "Generating summary...done"))
5104 (defun gnus-summary-prepare-unthreaded (headers)
5105 "Generate an unthreaded summary buffer based on HEADERS."
5106 (let (header number mark)
5111 ;; We may have to root out some bad articles...
5112 (when (memq (setq number (mail-header-number
5113 (setq header (pop headers))))
5114 gnus-newsgroup-limit)
5115 ;; Mark article as read when it has a low score.
5116 (when (and gnus-summary-mark-below
5117 (< (or (cdr (assq number gnus-newsgroup-scored))
5118 gnus-summary-default-score 0)
5119 gnus-summary-mark-below)
5120 (not (gnus-summary-article-ancient-p number)))
5121 (setq gnus-newsgroup-unreads
5122 (delq number gnus-newsgroup-unreads))
5123 (if gnus-newsgroup-auto-expire
5124 (push number gnus-newsgroup-expirable)
5125 (push (cons number gnus-low-score-mark)
5126 gnus-newsgroup-reads)))
5128 (setq mark (gnus-article-mark number))
5129 (push (gnus-data-make number mark (1+ (point)) header 0)
5130 gnus-newsgroup-data)
5131 (gnus-summary-insert-line
5133 (memq number gnus-newsgroup-undownloaded)
5134 mark (memq number gnus-newsgroup-replied)
5135 (memq number gnus-newsgroup-expirable)
5136 (mail-header-subject header) nil
5137 (cdr (assq number gnus-newsgroup-scored))
5138 (memq number gnus-newsgroup-processable))))))
5140 (defun gnus-summary-remove-list-identifiers ()
5141 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5142 (let ((regexp (if (consp gnus-list-identifiers)
5143 (mapconcat 'identity gnus-list-identifiers " *\\|")
5144 gnus-list-identifiers))
5147 (dolist (header gnus-newsgroup-headers)
5148 (setq subject (mail-header-subject header)
5150 (while (string-match
5151 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
5154 (concat (substring subject 0 (match-beginning 2))
5155 (substring subject (match-end 0)))
5159 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
5161 (concat (substring subject 0 (match-beginning 1))
5162 (substring subject (match-end 1)))))
5164 (mail-header-set-subject header subject))))))
5166 (defun gnus-fetch-headers (articles)
5167 "Fetch headers of ARTICLES."
5168 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5169 (gnus-message 5 "Fetching headers for %s..." name)
5172 (setq gnus-headers-retrieved-by
5173 (gnus-retrieve-headers
5174 articles gnus-newsgroup-name
5175 ;; We might want to fetch old headers, but
5176 ;; not if there is only 1 article.
5178 (not (eq gnus-fetch-old-headers 'some))
5179 (not (numberp gnus-fetch-old-headers)))
5180 (> (length articles) 1))
5181 gnus-fetch-old-headers))))
5182 (gnus-get-newsgroup-headers-xover
5183 articles nil nil gnus-newsgroup-name t)
5184 (gnus-get-newsgroup-headers))
5185 (gnus-message 5 "Fetching headers for %s...done" name))))
5187 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5188 "Select newsgroup GROUP.
5189 If READ-ALL is non-nil, all articles in the group are selected.
5190 If SELECT-ARTICLES, only select those articles from GROUP."
5191 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5192 ;;!!! Dirty hack; should be removed.
5193 (gnus-summary-ignore-duplicates
5194 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5196 gnus-summary-ignore-duplicates))
5197 (info (nth 2 entry))
5198 articles fetched-articles cached)
5200 (unless (gnus-check-server
5201 (set (make-local-variable 'gnus-current-select-method)
5202 (gnus-find-method-for-group group)))
5203 (error "Couldn't open server"))
5205 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5206 (gnus-activate-group group) ; Or we can activate it...
5207 (progn ; Or we bug out.
5208 (when (equal major-mode 'gnus-summary-mode)
5209 (gnus-kill-buffer (current-buffer)))
5210 (error "Couldn't activate group %s: %s"
5211 (gnus-group-decoded-name group) (gnus-status-message group))))
5213 (unless (gnus-request-group group t)
5214 (when (equal major-mode 'gnus-summary-mode)
5215 (gnus-kill-buffer (current-buffer)))
5216 (error "Couldn't request group %s: %s"
5217 (gnus-group-decoded-name group) (gnus-status-message group)))
5220 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5222 (setq gnus-summary-use-undownloaded-faces
5223 (gnus-agent-find-parameter
5225 'agent-enable-undownloaded-faces)))
5227 (setq gnus-newsgroup-name group
5228 gnus-newsgroup-unselected nil
5229 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5231 (let ((display (gnus-group-find-parameter group 'display)))
5232 (setq gnus-newsgroup-display
5234 ((not (zerop (or (car-safe read-all) 0)))
5235 ;; The user entered the group with C-u SPC/RET, let's show
5241 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5243 ;; The following is probably the "correct" solution, but
5244 ;; it makes Gnus fetch all headers and then limit the
5245 ;; articles (which is slow), so instead we hack the
5246 ;; select-articles parameter instead. -- Simon Josefsson
5249 ;; (gnus-byte-compile
5250 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5252 (setq select-articles
5253 (gnus-uncompress-range
5254 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5258 (cdr (gnus-active group)))))
5263 (gnus-summary-setup-default-charset)
5265 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5266 (when (gnus-virtual-group-p group)
5267 (setq cached gnus-newsgroup-cached))
5269 (setq gnus-newsgroup-unreads
5270 (gnus-sorted-ndifference
5271 (gnus-sorted-ndifference gnus-newsgroup-unreads
5272 gnus-newsgroup-marked)
5273 gnus-newsgroup-dormant))
5275 (setq gnus-newsgroup-processable nil)
5277 (gnus-update-read-articles group gnus-newsgroup-unreads)
5279 ;; Adjust and set lists of article marks.
5281 (gnus-adjust-marked-articles info))
5282 (if (setq articles select-articles)
5283 (setq gnus-newsgroup-unselected
5284 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5285 (setq articles (gnus-articles-to-read group read-all)))
5289 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5291 ((eq articles 0) nil)
5293 ;; Init the dependencies hash table.
5294 (setq gnus-newsgroup-dependencies
5295 (gnus-make-hashtable (length articles)))
5296 (gnus-set-global-variables)
5297 ;; Retrieve the headers and read them in.
5299 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5301 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5303 (setq gnus-newsgroup-cached cached))
5305 ;; Suppress duplicates?
5306 (when gnus-suppress-duplicates
5307 (gnus-dup-suppress-articles))
5309 ;; Set the initial limit.
5310 (setq gnus-newsgroup-limit (copy-sequence articles))
5311 ;; Remove canceled articles from the list of unread articles.
5312 (setq fetched-articles
5313 (mapcar (lambda (headers) (mail-header-number headers))
5314 gnus-newsgroup-headers))
5315 (setq gnus-newsgroup-articles fetched-articles)
5316 (setq gnus-newsgroup-unreads
5317 (gnus-sorted-nintersection
5318 gnus-newsgroup-unreads fetched-articles))
5319 (gnus-compute-unseen-list)
5321 ;; Removed marked articles that do not exist.
5322 (gnus-update-missing-marks
5323 (gnus-sorted-difference articles fetched-articles))
5324 ;; We might want to build some more threads first.
5325 (when (and gnus-fetch-old-headers
5326 (eq gnus-headers-retrieved-by 'nov))
5327 (if (eq gnus-fetch-old-headers 'invisible)
5328 (gnus-build-all-threads)
5329 (gnus-build-old-threads)))
5330 ;; Let the Gnus agent mark articles as read.
5332 (gnus-agent-get-undownloaded-list))
5333 ;; Remove list identifiers from subject
5334 (when gnus-list-identifiers
5335 (gnus-summary-remove-list-identifiers))
5336 ;; Check whether auto-expire is to be done in this group.
5337 (setq gnus-newsgroup-auto-expire
5338 (gnus-group-auto-expirable-p group))
5339 ;; Set up the article buffer now, if necessary.
5340 (unless gnus-single-article-buffer
5341 (gnus-article-setup-buffer))
5342 ;; First and last article in this newsgroup.
5343 (when gnus-newsgroup-headers
5344 (setq gnus-newsgroup-begin
5345 (mail-header-number (car gnus-newsgroup-headers))
5348 (gnus-last-element gnus-newsgroup-headers))))
5349 ;; GROUP is successfully selected.
5350 (or gnus-newsgroup-headers t)))))
5352 (defun gnus-compute-unseen-list ()
5353 ;; The `seen' marks are treated specially.
5354 (if (not gnus-newsgroup-seen)
5355 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5356 (setq gnus-newsgroup-unseen
5357 (gnus-inverse-list-range-intersection
5358 gnus-newsgroup-articles gnus-newsgroup-seen))))
5360 (defun gnus-summary-display-make-predicate (display)
5361 (require 'gnus-agent)
5362 (when (= (length display) 1)
5363 (setq display (car display)))
5364 (unless gnus-summary-display-cache
5365 (dolist (elem (append '((unread . unread)
5368 gnus-article-mark-lists))
5369 (push (cons (cdr elem)
5371 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5372 gnus-summary-display-cache)))
5373 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5374 (gnus-category-predicate-cache gnus-summary-display-cache))
5375 (gnus-get-predicate display)))
5377 ;; Uses the dynamically bound `number' variable.
5380 (defun gnus-article-marked-p (type &optional article)
5381 (let ((article (or article number)))
5384 (memq article gnus-newsgroup-marked))
5386 (memq article gnus-newsgroup-spam-marked))
5388 (memq article gnus-newsgroup-unsendable))
5389 ((eq type 'undownload)
5390 (memq article gnus-newsgroup-undownloaded))
5391 ((eq type 'download)
5392 (memq article gnus-newsgroup-downloadable))
5394 (memq article gnus-newsgroup-unreads))
5396 (memq article gnus-newsgroup-reads))
5398 (memq article gnus-newsgroup-dormant) )
5400 (memq article gnus-newsgroup-expirable))
5402 (memq article gnus-newsgroup-replied))
5404 (memq article gnus-newsgroup-killed))
5405 ((eq type 'bookmark)
5406 (assq article gnus-newsgroup-bookmarks))
5408 (assq article gnus-newsgroup-scored))
5410 (memq article gnus-newsgroup-saved))
5412 (memq article gnus-newsgroup-cached))
5414 (memq article gnus-newsgroup-forwarded))
5416 (not (memq article gnus-newsgroup-unseen)))
5418 (memq article gnus-newsgroup-recent))
5421 (defun gnus-articles-to-read (group &optional read-all)
5422 "Find out what articles the user wants to read."
5424 ;; Select all articles if `read-all' is non-nil, or if there
5425 ;; are no unread articles.
5427 (and (zerop (length gnus-newsgroup-marked))
5428 (zerop (length gnus-newsgroup-unreads)))
5429 ;; Fetch all if the predicate is non-nil.
5430 gnus-newsgroup-display)
5431 ;; We want to select the headers for all the articles in
5432 ;; the group, so we select either all the active
5433 ;; articles in the group, or (if that's nil), the
5434 ;; articles in the cache.
5436 (gnus-uncompress-range (gnus-active group))
5437 (gnus-cache-articles-in-group group))
5438 ;; Select only the "normal" subset of articles.
5440 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5441 gnus-newsgroup-unreads)))
5442 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5443 (scored (length scored-list))
5444 (number (length articles))
5445 (marked (+ (length gnus-newsgroup-marked)
5446 (length gnus-newsgroup-dormant)))
5451 ((numberp gnus-newsgroup-display)
5452 gnus-newsgroup-display)
5456 ((and (or (<= scored marked) (= scored number))
5457 (numberp gnus-large-newsgroup)
5458 (> number gnus-large-newsgroup))
5459 (let* ((cursor-in-echo-area nil)
5460 (initial (gnus-parameter-large-newsgroup-initial
5461 gnus-newsgroup-name))
5465 "How many articles from %s (%s %d): "
5467 (gnus-group-decoded-name gnus-newsgroup-name)
5469 (if initial "max" "default")
5472 (cons (number-to-string initial)
5474 (if (string-match "^[ \t]*$" input) number input)))
5475 ((and (> scored marked) (< scored number)
5476 (> (- scored number) 20))
5479 (format "%s %s (%d scored, %d total): "
5480 "How many articles from"
5481 (gnus-group-decoded-name group)
5483 (if (string-match "^[ \t]*$" input)
5487 (message "Quit getting the articles to read")
5489 (setq select (if (stringp select) (string-to-number select) select))
5490 (if (or (null select) (zerop select))
5492 (if (and (not (zerop scored)) (<= (abs select) scored))
5494 (setq articles (sort scored-list '<))
5495 (setq number (length articles)))
5496 (setq articles (copy-sequence articles)))
5498 (when (< (abs select) number)
5500 ;; Select the N oldest articles.
5501 (setcdr (nthcdr (1- (abs select)) articles) nil)
5502 ;; Select the N most recent articles.
5503 (setq articles (nthcdr (- number select) articles))))
5504 (setq gnus-newsgroup-unselected
5505 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5506 (when gnus-alter-articles-to-read-function
5509 (funcall gnus-alter-articles-to-read-function
5510 gnus-newsgroup-name articles)
5514 (defun gnus-killed-articles (killed articles)
5517 (when (inline (gnus-member-of-range (car articles) killed))
5518 (push (car articles) out))
5519 (setq articles (cdr articles)))
5522 (defun gnus-uncompress-marks (marks)
5523 "Uncompress the mark ranges in MARKS."
5524 (let ((uncompressed '(score bookmark))
5527 (if (memq (caar marks) uncompressed)
5528 (push (car marks) out)
5529 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5530 (setq marks (cdr marks)))
5533 (defun gnus-article-mark-to-type (mark)
5534 "Return the type of MARK."
5535 (or (cadr (assq mark gnus-article-special-mark-lists))
5538 (defun gnus-article-unpropagatable-p (mark)
5539 "Return whether MARK should be propagated to back end."
5540 (memq mark gnus-article-unpropagated-mark-lists))
5542 (defun gnus-adjust-marked-articles (info)
5543 "Set all article lists and remove all marks that are no longer valid."
5544 (let* ((marked-lists (gnus-info-marks info))
5545 (active (gnus-active (gnus-info-group info)))
5548 (types gnus-article-mark-lists)
5549 marks var articles article mark mark-type
5552 (dolist (marks marked-lists)
5553 (setq mark (car marks)
5554 mark-type (gnus-article-mark-to-type mark)
5555 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5557 ;; We set the variable according to the type of the marks list,
5558 ;; and then adjust the marks to a subset of the active articles.
5560 ;; Adjust "simple" lists - compressed yet unsorted
5561 ((eq mark-type 'list)
5562 ;; Simultaneously uncompress and clip to active range
5563 ;; See gnus-uncompress-range for a description of possible marks
5565 (if (not (cadr marks))
5567 (setq articles (if (numberp (cddr marks))
5573 (while (setq article (pop articles))
5574 (cond ((consp article)
5575 (setq bgn (max (car article) min)
5576 end (min (cdr article) max))
5578 (setq l (setcdr l (cons bgn nil))
5580 ((and (<= min article)
5582 (setq l (setcdr l (cons article nil))))))
5583 (set var (cdr lh)))))
5585 ((eq mark-type 'tuple)
5586 (set var (setq articles (cdr marks)))
5587 (when (not (listp (cdr (symbol-value var))))
5588 (set var (list (symbol-value var))))
5589 (when (not (listp (cdr articles)))
5590 (setq articles (list articles)))
5592 (when (or (not (consp (setq article (pop articles))))
5593 (< (car article) min)
5594 (> (car article) max))
5595 (set var (delq article (symbol-value var))))))
5596 ;; Adjust ranges (sloppily).
5597 ((eq mark-type 'range)
5600 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5601 ;; It should be (seen (NUM1 . NUM2)).
5602 (when (numberp (cddr marks))
5603 (setcdr marks (list (cdr marks))))
5604 (setq articles (cdr marks))
5605 (while (and articles
5606 (or (and (consp (car articles))
5607 (> min (cdar articles)))
5608 (and (numberp (car articles))
5609 (> min (car articles)))))
5611 (set var articles))))))))
5613 (defun gnus-update-missing-marks (missing)
5614 "Go through the list of MISSING articles and remove them from the mark lists."
5617 ;; Go through all types.
5618 (dolist (elem gnus-article-mark-lists)
5619 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5620 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5621 (when (symbol-value var)
5622 ;; This list has articles. So we delete all missing
5623 ;; articles from it.
5626 (set var (delq (pop m) (symbol-value var))))))))))
5628 (defun gnus-update-marks ()
5629 "Enter the various lists of marked articles into the newsgroup info list."
5630 (let ((types gnus-article-mark-lists)
5631 (info (gnus-get-info gnus-newsgroup-name))
5632 type list newmarked symbol delta-marks)
5634 ;; Add all marks lists to the list of marks lists.
5635 (while (setq type (pop types))
5636 (setq list (symbol-value
5638 (intern (format "gnus-newsgroup-%s" (car type))))))
5641 ;; Get rid of the entries of the articles that have the
5643 (when (and (eq (cdr type) 'score)
5647 (prev (cons nil list))
5650 (if (or (not (consp (car arts)))
5651 (= (cdar arts) gnus-summary-default-score))
5652 (setcdr prev (cdr arts))
5654 (setq arts (cdr arts)))
5655 (setq list (cdr all)))))
5657 (when (eq (cdr type) 'seen)
5658 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5660 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5661 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5663 (when (and (gnus-check-backend-function
5664 'request-set-mark gnus-newsgroup-name)
5665 (not (gnus-article-unpropagatable-p (cdr type))))
5666 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5667 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5668 (add (gnus-remove-from-range
5669 (gnus-copy-sequence list) old)))
5671 (push (list add 'add (list (cdr type))) delta-marks))
5673 (push (list del 'del (list (cdr type))) delta-marks))))
5676 (push (cons (cdr type) list) newmarked)))
5679 (unless (gnus-check-group gnus-newsgroup-name)
5680 (error "Can't open server for %s" gnus-newsgroup-name))
5681 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5683 ;; Enter these new marks into the info of the group.
5685 (setcar (nthcdr 3 info) newmarked)
5686 ;; Add the marks lists to the end of the info.
5688 (setcdr (nthcdr 2 info) (list newmarked))))
5690 ;; Cut off the end of the info if there's nothing else there.
5694 (when (nthcdr (decf i) info)
5695 (setcdr (nthcdr i info) nil)))))))
5697 (defun gnus-set-mode-line (where)
5698 "Set the mode line of the article or summary buffers.
5699 If WHERE is `summary', the summary mode line format will be used."
5700 ;; Is this mode line one we keep updated?
5701 (when (and (memq where gnus-updated-mode-lines)
5703 (intern (format "gnus-%s-mode-line-format-spec" where))))
5706 ;; We evaluate this in the summary buffer since these
5707 ;; variables are buffer-local to that buffer.
5708 (set-buffer gnus-summary-buffer)
5709 ;; We bind all these variables that are used in the `eval' form
5711 (let* ((mformat (symbol-value
5713 (format "gnus-%s-mode-line-format-spec" where))))
5714 (gnus-tmp-group-name (gnus-mode-string-quote
5715 (gnus-group-decoded-name
5716 gnus-newsgroup-name)))
5717 (gnus-tmp-article-number (or gnus-current-article 0))
5718 (gnus-tmp-unread gnus-newsgroup-unreads)
5719 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5720 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5721 (gnus-tmp-unread-and-unselected
5722 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5723 (zerop gnus-tmp-unselected))
5725 ((zerop gnus-tmp-unselected)
5726 (format "{%d more}" gnus-tmp-unread-and-unticked))
5727 (t (format "{%d(+%d) more}"
5728 gnus-tmp-unread-and-unticked
5729 gnus-tmp-unselected))))
5731 (if (and gnus-current-headers
5732 (vectorp gnus-current-headers))
5733 (gnus-mode-string-quote
5734 (mail-header-subject gnus-current-headers))
5736 bufname-length max-len
5737 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5738 (setq mode-string (eval mformat))
5739 (setq bufname-length (if (string-match "%b" mode-string)
5742 (if (eq where 'summary)
5744 (get-buffer gnus-article-buffer))))
5747 (setq max-len (max 4 (if gnus-mode-non-string-length
5749 gnus-mode-non-string-length
5751 (length mode-string))))
5752 ;; We might have to chop a bit of the string off...
5753 (when (> (length mode-string) max-len)
5755 (concat (truncate-string-to-width mode-string (- max-len 3))
5757 ;; Pad the mode string a bit.
5758 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5759 ;; Update the mode line.
5760 (setq mode-line-buffer-identification
5761 (gnus-mode-line-buffer-identification (list mode-string)))
5762 (set-buffer-modified-p t))))
5764 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5765 "Go through the HEADERS list and add all Xrefs to a hash table.
5766 The resulting hash table is returned, or nil if no Xrefs were found."
5767 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5768 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5769 (xref-hashtb (gnus-make-hashtable))
5770 start group entry number xrefs header)
5772 (setq header (pop headers))
5773 (when (and (setq xrefs (mail-header-xref header))
5774 (not (memq (setq number (mail-header-number header))
5777 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5778 (setq start (match-end 0))
5779 (setq group (if prefix
5780 (concat prefix (substring xrefs (match-beginning 1)
5782 (substring xrefs (match-beginning 1) (match-end 1))))
5784 (string-to-number (substring xrefs (match-beginning 2)
5786 (if (setq entry (gnus-gethash group xref-hashtb))
5787 (setcdr entry (cons number (cdr entry)))
5788 (gnus-sethash group (cons number nil) xref-hashtb)))))
5789 (and start xref-hashtb)))
5791 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5792 "Look through all the headers and mark the Xrefs as read."
5793 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5794 name entry info xref-hashtb idlist method nth4)
5796 (set-buffer gnus-group-buffer)
5797 (when (setq xref-hashtb
5798 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5801 (unless (string= from-newsgroup (setq name (symbol-name group)))
5802 (setq idlist (symbol-value group))
5803 ;; Dead groups are not updated.
5805 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5807 (when (stringp (setq nth4 (gnus-info-method info)))
5808 (setq nth4 (gnus-server-to-method nth4))))
5809 ;; Only do the xrefs if the group has the same
5810 ;; select method as the group we have just read.
5811 (or (gnus-methods-equal-p
5812 nth4 (gnus-find-method-for-group from-newsgroup))
5814 (equal nth4 (setq method (gnus-find-method-for-group
5816 (and (equal (car nth4) (car method))
5817 (equal (nth 1 nth4) (nth 1 method))))
5818 gnus-use-cross-reference
5819 (or (not (eq gnus-use-cross-reference t))
5821 ;; Only do cross-references on subscribed
5822 ;; groups, if that is what is wanted.
5823 (<= (gnus-info-level info) gnus-level-subscribed))
5824 (gnus-group-make-articles-read name idlist))))
5827 (defun gnus-compute-read-articles (group articles)
5828 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5829 (info (nth 2 entry))
5830 (active (gnus-active group))
5833 ;; First peel off all invalid article numbers.
5835 (let ((ids articles)
5837 (while (setq id (pop ids))
5838 (when (and first (> id (cdr active)))
5839 ;; We'll end up in this situation in one particular
5840 ;; obscure situation. If you re-scan a group and get
5841 ;; a new article that is cross-posted to a different
5842 ;; group that has not been re-scanned, you might get
5843 ;; crossposted article that has a higher number than
5844 ;; Gnus believes possible. So we re-activate this
5845 ;; group as well. This might mean doing the
5846 ;; crossposting thingy will *increase* the number
5847 ;; of articles in some groups. Tsk, tsk.
5848 (setq active (or (gnus-activate-group group) active)))
5849 (when (or (> id (cdr active))
5850 (< id (car active)))
5851 (setq articles (delq id articles))))))
5852 ;; If the read list is nil, we init it.
5854 (null (gnus-info-read info))
5856 (setq ninfo (cons 1 (1- (car active))))
5857 (setq ninfo (gnus-info-read info)))
5858 ;; Then we add the read articles to the range.
5860 ninfo (setq articles (sort articles '<))))))
5862 (defun gnus-group-make-articles-read (group articles)
5863 "Update the info of GROUP to say that ARTICLES are read."
5865 (entry (gnus-gethash group gnus-newsrc-hashtb))
5866 (info (nth 2 entry))
5867 (active (gnus-active group))
5870 (setq range (gnus-compute-read-articles group articles))
5872 (set-buffer gnus-group-buffer)
5875 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5876 (gnus-info-set-read ',info ',(gnus-info-read info))
5877 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5878 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5879 (gnus-group-update-group ,group t))))
5880 ;; Add the read articles to the range.
5881 (gnus-info-set-read info range)
5882 (gnus-request-set-mark group (list (list range 'add '(read))))
5883 ;; Then we have to re-compute how many unread
5884 ;; articles there are in this group.
5888 (setq num (- (1+ (cdr active)) (car active))))
5889 ((not (listp (cdr range)))
5890 (setq num (- (cdr active) (- (1+ (cdr range))
5894 (if (numberp (car range))
5896 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5897 (setq range (cdr range)))
5898 (setq num (- (cdr active) num))))
5899 ;; Update the number of unread articles.
5901 ;; Update the group buffer.
5902 (unless (gnus-ephemeral-group-p group)
5903 (gnus-group-update-group group t))))))
5905 (defvar gnus-newsgroup-none-id 0)
5907 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5908 (let ((cur nntp-server-buffer)
5911 (save-excursion (set-buffer gnus-summary-buffer)
5912 gnus-newsgroup-dependencies)))
5914 (mail-parse-charset gnus-newsgroup-charset)
5915 (mail-parse-ignored-charsets
5916 (save-excursion (condition-case nil
5917 (set-buffer gnus-summary-buffer)
5919 gnus-newsgroup-ignored-charsets)))
5921 (set-buffer nntp-server-buffer)
5922 ;; Translate all TAB characters into SPACE characters.
5923 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5924 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5925 (ietf-drums-unfold-fws)
5926 (gnus-run-hooks 'gnus-parse-headers-hook)
5927 (let ((case-fold-search t)
5928 in-reply-to header p lines chars)
5929 (goto-char (point-min))
5930 ;; Search to the beginning of the next header. Error messages
5931 ;; do not begin with 2 or 3.
5932 (while (re-search-forward "^[23][0-9]+ " nil t)
5935 ;; This implementation of this function, with nine
5936 ;; search-forwards instead of the one re-search-forward and
5937 ;; a case (which basically was the old function) is actually
5938 ;; about twice as fast, even though it looks messier. You
5939 ;; can't have everything, I guess. Speed and elegance
5940 ;; doesn't always go hand in hand.
5949 (narrow-to-region (point)
5950 (or (and (search-forward "\n.\n" nil t)
5956 (if (search-forward "\nsubject:" nil t)
5957 (funcall gnus-decode-encoded-word-function
5958 (nnheader-header-value))
5963 (if (search-forward "\nfrom:" nil t)
5964 (funcall gnus-decode-encoded-address-function
5965 (nnheader-header-value))
5970 (if (search-forward "\ndate:" nil t)
5971 (nnheader-header-value) ""))
5975 (setq id (if (re-search-forward
5976 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5977 ;; We do it this way to make sure the Message-ID
5978 ;; is (somewhat) syntactically valid.
5979 (buffer-substring (match-beginning 1)
5981 ;; If there was no message-id, we just fake one
5982 ;; to make subsequent routines simpler.
5983 (nnheader-generate-fake-message-id))))
5987 (if (search-forward "\nreferences:" nil t)
5991 (nnheader-header-value)
5996 (search-backward ">" end t)
5999 (search-backward "<" end t)
6001 ;; Get the references from the in-reply-to header if there
6002 ;; were no references and the in-reply-to header looks
6004 (if (and (search-forward "\nin-reply-to:" nil t)
6005 (setq in-reply-to (nnheader-header-value))
6006 (string-match "<[^>]+>" in-reply-to))
6008 (setq ref (substring in-reply-to (match-beginning 0)
6010 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6011 (setq ref2 (substring in-reply-to (match-beginning 0)
6013 (when (> (length ref2) (length ref))
6020 (if (search-forward "\nchars: " nil t)
6021 (if (numberp (setq chars (ignore-errors (read cur))))
6027 (if (search-forward "\nlines: " nil t)
6028 (if (numberp (setq lines (ignore-errors (read cur))))
6034 (and (search-forward "\nxref:" nil t)
6035 (nnheader-header-value)))
6037 (when gnus-extra-headers
6038 (let ((extra gnus-extra-headers)
6042 (when (search-forward
6043 (concat "\n" (symbol-name (car extra)) ":") nil t)
6044 (push (cons (car extra) (nnheader-header-value))
6048 (when (equal id ref)
6051 (when gnus-alter-header-function
6052 (funcall gnus-alter-header-function header)
6053 (setq id (mail-header-id header)
6054 ref (gnus-parent-id (mail-header-references header))))
6057 (gnus-dependencies-add-header
6058 header dependencies force-new))
6059 (push header headers))
6060 (goto-char (point-max))
6062 (nreverse headers)))))
6064 ;; Goes through the xover lines and returns a list of vectors
6065 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6066 force-new dependencies
6067 group also-fetch-heads)
6068 "Parse the news overview data in the server buffer.
6069 Return a list of headers that match SEQUENCE (see
6070 `nntp-retrieve-headers')."
6071 ;; Get the Xref when the users reads the articles since most/some
6072 ;; NNTP servers do not include Xrefs when using XOVER.
6073 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6074 (let ((mail-parse-charset gnus-newsgroup-charset)
6075 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6076 (cur nntp-server-buffer)
6077 (dependencies (or dependencies gnus-newsgroup-dependencies))
6079 ((eq gnus-read-all-available-headers t)
6081 ((and (stringp gnus-read-all-available-headers)
6083 (string-match gnus-read-all-available-headers group))
6086 number headers header)
6088 (set-buffer nntp-server-buffer)
6089 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6090 ;; Allow the user to mangle the headers before parsing them.
6091 (gnus-run-hooks 'gnus-parse-headers-hook)
6092 (goto-char (point-min))
6093 (gnus-parse-without-error
6094 (while (and (or sequence allp)
6096 (setq number (read cur))
6098 (while (and sequence
6099 (< (car sequence) number))
6100 (setq sequence (cdr sequence))))
6103 (eq number (car sequence))))
6105 (setq sequence (cdr sequence))
6106 (setq header (inline
6107 (gnus-nov-parse-line
6108 number dependencies force-new)))))
6109 (push header headers))
6111 ;; A common bug in inn is that if you have posted an article and
6112 ;; then retrieves the active file, it will answer correctly --
6113 ;; the new article is included. However, a NOV entry for the
6114 ;; article may not have been generated yet, so this may fail.
6115 ;; We work around this problem by retrieving the last few
6116 ;; headers using HEAD.
6117 (if (or (not also-fetch-heads)
6119 ;; We (probably) got all the headers.
6121 (let ((gnus-nov-is-evil t))
6124 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6125 (gnus-get-newsgroup-headers))))))))
6127 (defun gnus-article-get-xrefs ()
6128 "Fill in the Xref value in `gnus-current-headers', if necessary.
6129 This is meant to be called in `gnus-article-internal-prepare-hook'."
6130 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
6131 gnus-current-headers)))
6132 (or (not gnus-use-cross-reference)
6134 (and (mail-header-xref headers)
6135 (not (string= (mail-header-xref headers) "")))
6136 (let ((case-fold-search t)
6139 (nnheader-narrow-to-headers)
6140 (goto-char (point-min))
6141 (when (or (and (not (eobp))
6142 (eq (downcase (char-after)) ?x)
6143 (looking-at "Xref:"))
6144 (search-forward "\nXref:" nil t))
6145 (goto-char (1+ (match-end 0)))
6146 (setq xref (buffer-substring (point) (gnus-point-at-eol)))
6147 (mail-header-set-xref headers xref)))))))
6149 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6150 "Find article ID and insert the summary line for that article.
6151 OLD-HEADER can either be a header or a line number to insert
6152 the subject line on."
6153 (let* ((line (and (numberp old-header) old-header))
6154 (old-header (and (vectorp old-header) old-header))
6155 (header (cond ((and old-header use-old-header)
6158 (gnus-number-to-header id))
6159 (gnus-number-to-header id))
6161 (gnus-read-header id))))
6162 (number (and (numberp id) id))
6165 ;; Rebuild the thread that this article is part of and go to the
6166 ;; article we have fetched.
6167 (when (and (not gnus-show-threads)
6170 (setq d (gnus-data-find (mail-header-number old-header))))
6171 (goto-char (gnus-data-pos d))
6174 (- (gnus-point-at-bol)
6176 (1+ (gnus-point-at-eol))
6177 (gnus-delete-line))))))
6178 ;; Remove list identifiers from subject.
6179 (when gnus-list-identifiers
6180 (let ((gnus-newsgroup-headers (list header)))
6181 (gnus-summary-remove-list-identifiers)))
6183 (mail-header-set-number header (mail-header-number old-header)))
6184 (setq gnus-newsgroup-sparse
6185 (delq (setq number (mail-header-number header))
6186 gnus-newsgroup-sparse))
6187 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6188 (push number gnus-newsgroup-limit)
6189 (gnus-rebuild-thread (mail-header-id header) line)
6190 (gnus-summary-goto-subject number nil t))
6191 (when (and (numberp number)
6193 ;; We have to update the boundaries even if we can't fetch the
6194 ;; article if ID is a number -- so that the next `P' or `N'
6195 ;; command will fetch the previous (or next) article even
6196 ;; if the one we tried to fetch this time has been canceled.
6197 (when (> number gnus-newsgroup-end)
6198 (setq gnus-newsgroup-end number))
6199 (when (< number gnus-newsgroup-begin)
6200 (setq gnus-newsgroup-begin number))
6201 (setq gnus-newsgroup-unselected
6202 (delq number gnus-newsgroup-unselected)))
6203 ;; Report back a success?
6204 (and header (mail-header-number header))))
6206 ;;; Process/prefix in the summary buffer
6208 (defun gnus-summary-work-articles (n)
6209 "Return a list of articles to be worked upon.
6210 The prefix argument, the list of process marked articles, and the
6211 current article will be taken into consideration."
6213 (set-buffer gnus-summary-buffer)
6216 ;; A numerical prefix has been given.
6217 (setq n (prefix-numeric-value n))
6218 (let ((backward (< n 0))
6219 (n (abs (prefix-numeric-value n)))
6224 (push (setq article (gnus-summary-article-number))
6227 (gnus-summary-find-prev nil article)
6228 (gnus-summary-find-next nil article)))
6230 (nreverse articles)))
6231 ((and (gnus-region-active-p) (mark))
6232 (message "region active")
6233 ;; Work on the region between point and mark.
6234 (let ((max (max (point) (mark)))
6237 (goto-char (min (point) (mark)))
6240 (push (setq article (gnus-summary-article-number)) articles)
6241 (gnus-summary-find-next nil article)
6243 (nreverse articles))))
6244 (gnus-newsgroup-processable
6245 ;; There are process-marked articles present.
6246 ;; Save current state.
6247 (gnus-summary-save-process-mark)
6249 (reverse gnus-newsgroup-processable))
6251 ;; Just return the current article.
6252 (list (gnus-summary-article-number))))))
6254 (defmacro gnus-summary-iterate (arg &rest forms)
6255 "Iterate over the process/prefixed articles and do FORMS.
6256 ARG is the interactive prefix given to the command. FORMS will be
6257 executed with point over the summary line of the articles."
6258 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6259 `(let ((,articles (gnus-summary-work-articles ,arg)))
6261 (gnus-summary-goto-subject (car ,articles))
6265 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6266 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6268 (defun gnus-summary-save-process-mark ()
6269 "Push the current set of process marked articles on the stack."
6271 (push (copy-sequence gnus-newsgroup-processable)
6272 gnus-newsgroup-process-stack))
6274 (defun gnus-summary-kill-process-mark ()
6275 "Push the current set of process marked articles on the stack and unmark."
6277 (gnus-summary-save-process-mark)
6278 (gnus-summary-unmark-all-processable))
6280 (defun gnus-summary-yank-process-mark ()
6281 "Pop the last process mark state off the stack and restore it."
6283 (unless gnus-newsgroup-process-stack
6284 (error "Empty mark stack"))
6285 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6287 (defun gnus-summary-process-mark-set (set)
6288 "Make SET into the current process marked articles."
6289 (gnus-summary-unmark-all-processable)
6291 (gnus-summary-set-process-mark (pop set))))
6293 ;;; Searching and stuff
6295 (defun gnus-summary-search-group (&optional backward use-level)
6296 "Search for next unread newsgroup.
6297 If optional argument BACKWARD is non-nil, search backward instead."
6299 (set-buffer gnus-group-buffer)
6300 (when (gnus-group-search-forward
6301 backward nil (if use-level (gnus-group-group-level) nil))
6302 (gnus-group-group-name))))
6304 (defun gnus-summary-best-group (&optional exclude-group)
6305 "Find the name of the best unread group.
6306 If EXCLUDE-GROUP, do not go to this group."
6308 (set-buffer gnus-group-buffer)
6310 (gnus-group-best-unread-group exclude-group))))
6312 (defun gnus-summary-find-next (&optional unread article backward)
6314 (gnus-summary-find-prev unread article)
6315 (let* ((dummy (gnus-summary-article-intangible-p))
6316 (article (or article (gnus-summary-article-number)))
6317 (data (gnus-data-find-list article))
6319 (when (and (not dummy)
6320 (or (not gnus-summary-check-current)
6322 (not (gnus-data-unread-p (car data)))))
6323 (setq data (cdr data)))
6328 (unless (memq (gnus-data-number (car data))
6330 ((eq gnus-auto-goto-ignores
6331 'always-undownloaded)
6332 gnus-newsgroup-undownloaded)
6335 ((eq gnus-auto-goto-ignores
6337 gnus-newsgroup-unfetched)
6338 ((eq gnus-auto-goto-ignores
6340 gnus-newsgroup-undownloaded)))
6341 (when (gnus-data-unread-p (car data))
6342 (setq result (car data)
6344 (setq data (cdr data)))
6347 (goto-char (gnus-data-pos result))
6348 (gnus-data-number result)))))
6350 (defun gnus-summary-find-prev (&optional unread article)
6351 (let* ((eobp (eobp))
6352 (article (or article (gnus-summary-article-number)))
6353 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6355 (when (and (not eobp)
6356 (or (not gnus-summary-check-current)
6358 (not (gnus-data-unread-p (car data)))))
6359 (setq data (cdr data)))
6364 (unless (memq (gnus-data-number (car data))
6366 ((eq gnus-auto-goto-ignores
6367 'always-undownloaded)
6368 gnus-newsgroup-undownloaded)
6371 ((eq gnus-auto-goto-ignores
6373 gnus-newsgroup-unfetched)
6374 ((eq gnus-auto-goto-ignores
6376 gnus-newsgroup-undownloaded)))
6377 (when (gnus-data-unread-p (car data))
6378 (setq result (car data)
6380 (setq data (cdr data)))
6383 (goto-char (gnus-data-pos result))
6384 (gnus-data-number result))))
6386 (defun gnus-summary-find-subject (subject &optional unread backward article)
6387 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6388 (article (or article (gnus-summary-article-number)))
6389 (articles (gnus-data-list backward))
6390 (arts (gnus-data-find-list article articles))
6392 (when (or (not gnus-summary-check-current)
6394 (not (gnus-data-unread-p (car arts))))
6395 (setq arts (cdr arts)))
6397 (and (or (not unread)
6398 (gnus-data-unread-p (car arts)))
6399 (vectorp (gnus-data-header (car arts)))
6401 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6402 (setq result (car arts)
6404 (setq arts (cdr arts)))
6406 (goto-char (gnus-data-pos result))
6407 (gnus-data-number result))))
6409 (defun gnus-summary-search-forward (&optional unread subject backward)
6410 "Search forward for an article.
6411 If UNREAD, look for unread articles. If SUBJECT, look for
6412 articles with that subject. If BACKWARD, search backward instead."
6413 (cond (subject (gnus-summary-find-subject subject unread backward))
6414 (backward (gnus-summary-find-prev unread))
6415 (t (gnus-summary-find-next unread))))
6417 (defun gnus-recenter (&optional n)
6418 "Center point in window and redisplay frame.
6419 Also do horizontal recentering."
6421 (when (and gnus-auto-center-summary
6422 (not (eq gnus-auto-center-summary 'vertical)))
6423 (gnus-horizontal-recenter))
6426 (defun gnus-summary-recenter ()
6427 "Center point in the summary window.
6428 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6429 displayed, no centering will be performed."
6430 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6431 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6433 ;; The user has to want it.
6434 (when gnus-auto-center-summary
6435 (let* ((top (cond ((< (window-height) 4) 0)
6436 ((< (window-height) 7) 1)
6437 (t (if (numberp gnus-auto-center-summary)
6438 gnus-auto-center-summary
6440 (height (1- (window-height)))
6441 (bottom (save-excursion (goto-char (point-max))
6442 (forward-line (- height))
6444 (window (get-buffer-window (current-buffer))))
6445 (when (get-buffer-window gnus-article-buffer)
6446 ;; Only do recentering when the article buffer is displayed,
6447 ;; Set the window start to either `bottom', which is the biggest
6448 ;; possible valid number, or the second line from the top,
6449 ;; whichever is the least.
6450 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6451 (if (> bottom top-pos)
6452 ;; Keep the second line from the top visible
6453 (set-window-start window top-pos t)
6454 ;; Try to keep the bottom line visible; if it's partially
6455 ;; obscured, either scroll one more line to make it fully
6456 ;; visible, or revert to using TOP-POS.
6458 (goto-char (point-max))
6460 (let ((last-line-start (point)))
6462 (set-window-start window (point) t)
6463 (when (not (pos-visible-in-window-p last-line-start window))
6465 (set-window-start window (min (point) top-pos) t)))))))
6466 ;; Do horizontal recentering while we're at it.
6467 (when (and (get-buffer-window (current-buffer) t)
6468 (not (eq gnus-auto-center-summary 'vertical)))
6469 (let ((selected (selected-window)))
6470 (select-window (get-buffer-window (current-buffer) t))
6471 (gnus-summary-position-point)
6472 (gnus-horizontal-recenter)
6473 (select-window selected))))))
6475 (defun gnus-summary-jump-to-group (newsgroup)
6476 "Move point to NEWSGROUP in group mode buffer."
6477 ;; Keep update point of group mode buffer if visible.
6478 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6479 (save-window-excursion
6480 ;; Take care of tree window mode.
6481 (when (get-buffer-window gnus-group-buffer)
6482 (pop-to-buffer gnus-group-buffer))
6483 (gnus-group-jump-to-group newsgroup))
6485 ;; Take care of tree window mode.
6486 (if (get-buffer-window gnus-group-buffer)
6487 (pop-to-buffer gnus-group-buffer)
6488 (set-buffer gnus-group-buffer))
6489 (gnus-group-jump-to-group newsgroup))))
6491 ;; This function returns a list of article numbers based on the
6492 ;; difference between the ranges of read articles in this group and
6493 ;; the range of active articles.
6494 (defun gnus-list-of-unread-articles (group)
6495 (let* ((read (gnus-info-read (gnus-get-info group)))
6496 (active (or (gnus-active group) (gnus-activate-group group)))
6499 ;; If none are read, then all are unread.
6501 (setq first (car active))
6502 ;; If the range of read articles is a single range, then the
6503 ;; first unread article is the article after the last read
6504 ;; article. Sounds logical, doesn't it?
6505 (if (and (not (listp (cdr read)))
6506 (or (< (car read) (car active))
6507 (progn (setq read (list read))
6509 (setq first (max (car active) (1+ (cdr read))))
6510 ;; `read' is a list of ranges.
6511 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6514 (setq first (car active)))
6517 (while (< first nlast)
6518 (setq unread (cons first unread)
6520 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6521 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6522 (setq read (cdr read)))))
6523 ;; And add the last unread articles.
6524 (while (<= first last)
6525 (setq unread (cons first unread)
6527 ;; Return the list of unread articles.
6528 (delq 0 (nreverse unread))))
6530 (defun gnus-list-of-read-articles (group)
6531 "Return a list of unread, unticked and non-dormant articles."
6532 (let* ((info (gnus-get-info group))
6533 (marked (gnus-info-marks info))
6534 (active (gnus-active group)))
6536 (gnus-list-range-difference
6537 (gnus-list-range-difference
6538 (gnus-sorted-complement
6539 (gnus-uncompress-range active)
6540 (gnus-list-of-unread-articles group))
6541 (cdr (assq 'dormant marked)))
6542 (cdr (assq 'tick marked))))))
6544 ;; This function returns a sequence of article numbers based on the
6545 ;; difference between the ranges of read articles in this group and
6546 ;; the range of active articles.
6547 (defun gnus-sequence-of-unread-articles (group)
6548 (let* ((read (gnus-info-read (gnus-get-info group)))
6549 (active (or (gnus-active group) (gnus-activate-group group)))
6552 ;; If none are read, then all are unread.
6554 (setq first (car active))
6555 ;; If the range of read articles is a single range, then the
6556 ;; first unread article is the article after the last read
6557 ;; article. Sounds logical, doesn't it?
6558 (if (and (not (listp (cdr read)))
6559 (or (< (car read) (car active))
6560 (progn (setq read (list read))
6562 (setq first (max (car active) (1+ (cdr read))))
6563 ;; `read' is a list of ranges.
6564 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6567 (setq first (car active)))
6570 (push (cons first nlast) unread))
6571 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6572 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6573 (setq read (cdr read)))))
6574 ;; And add the last unread articles.
6575 (cond ((not (and first last))
6578 (push (cons first last) unread))
6580 (push first unread)))
6581 ;; Return the sequence of unread articles.
6582 (delq 0 (nreverse unread))))
6584 ;; Various summary commands
6586 (defun gnus-summary-select-article-buffer ()
6587 "Reconfigure windows to show article buffer."
6589 (if (not (gnus-buffer-live-p gnus-article-buffer))
6590 (error "There is no article buffer for this summary buffer")
6591 (gnus-configure-windows 'article)
6592 (select-window (get-buffer-window gnus-article-buffer))))
6594 (defun gnus-summary-universal-argument (arg)
6595 "Perform any operation on all articles that are process/prefixed."
6597 (let ((articles (gnus-summary-work-articles arg))
6604 (substitute-command-keys
6605 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6607 (gnus-error 1 "Undefined key")
6610 (gnus-summary-goto-subject (setq article (pop articles)))
6611 (let (gnus-newsgroup-processable)
6612 (command-execute func))
6613 (gnus-summary-remove-process-mark article)))))
6614 (gnus-summary-position-point))
6616 (defun gnus-summary-toggle-truncation (&optional arg)
6617 "Toggle truncation of summary lines.
6618 With ARG, turn line truncation on if ARG is positive."
6620 (setq truncate-lines
6621 (if (null arg) (not truncate-lines)
6622 (> (prefix-numeric-value arg) 0)))
6625 (defun gnus-summary-find-for-reselect ()
6626 "Return the number of an article to stay on across a reselect.
6627 The current article is considered, then following articles, then previous
6628 articles. An article is sought which is not cancelled and isn't a temporary
6629 insertion from another group. If there's no such then return a dummy 0."
6631 (dolist (rev '(nil t))
6632 (unless found ; don't demand the reverse list if we don't need it
6633 (let ((data (gnus-data-find-list
6634 (gnus-summary-article-number) (gnus-data-list rev))))
6635 (while (and data (not found))
6636 (if (and (< 0 (gnus-data-number (car data)))
6637 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6638 (setq found (gnus-data-number (car data))))
6639 (setq data (cdr data))))))
6642 (defun gnus-summary-reselect-current-group (&optional all rescan)
6643 "Exit and then reselect the current newsgroup.
6644 The prefix argument ALL means to select all articles."
6646 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6647 (error "Ephemeral groups can't be reselected"))
6648 (let ((current-subject (gnus-summary-find-for-reselect))
6649 (group gnus-newsgroup-name))
6650 (setq gnus-newsgroup-begin nil)
6651 (gnus-summary-exit nil 'leave-hidden)
6652 ;; We have to adjust the point of group mode buffer because
6653 ;; point was moved to the next unread newsgroup by exiting.
6654 (gnus-summary-jump-to-group group)
6657 (gnus-group-get-new-news-this-group 1)))
6658 (gnus-group-read-group all t)
6659 (gnus-summary-goto-subject current-subject nil t)))
6661 (defun gnus-summary-rescan-group (&optional all)
6662 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6664 (gnus-summary-reselect-current-group all t))
6666 (defun gnus-summary-update-info (&optional non-destructive)
6668 (let ((group gnus-newsgroup-name))
6670 (when gnus-newsgroup-kill-headers
6671 (setq gnus-newsgroup-killed
6672 (gnus-compress-sequence
6674 (gnus-list-range-intersection
6675 gnus-newsgroup-unselected gnus-newsgroup-killed)
6676 gnus-newsgroup-unreads)
6678 (unless (listp (cdr gnus-newsgroup-killed))
6679 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6680 (let ((headers gnus-newsgroup-headers))
6681 ;; Set the new ranges of read articles.
6683 (set-buffer gnus-group-buffer)
6684 (gnus-undo-force-boundary))
6685 (gnus-update-read-articles
6686 group (gnus-sorted-union
6687 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6688 ;; Set the current article marks.
6689 (let ((gnus-newsgroup-scored
6690 (if (and (not gnus-save-score)
6691 (not non-destructive))
6693 gnus-newsgroup-scored)))
6695 (gnus-update-marks)))
6696 ;; Do the cross-ref thing.
6697 (when gnus-use-cross-reference
6698 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6699 ;; Do not switch windows but change the buffer to work.
6700 (set-buffer gnus-group-buffer)
6701 (unless (gnus-ephemeral-group-p group)
6702 (gnus-group-update-group group)))))))
6704 (defun gnus-summary-save-newsrc (&optional force)
6705 "Save the current number of read/marked articles in the dribble buffer.
6706 The dribble buffer will then be saved.
6707 If FORCE (the prefix), also save the .newsrc file(s)."
6709 (gnus-summary-update-info t)
6711 (gnus-save-newsrc-file)
6712 (gnus-dribble-save)))
6714 (defun gnus-summary-exit (&optional temporary leave-hidden)
6715 "Exit reading current newsgroup, and then return to group selection mode.
6716 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6718 (gnus-set-global-variables)
6719 (when (gnus-buffer-live-p gnus-article-buffer)
6721 (set-buffer gnus-article-buffer)
6722 (mm-destroy-parts gnus-article-mime-handles)
6723 ;; Set it to nil for safety reason.
6724 (setq gnus-article-mime-handle-alist nil)
6725 (setq gnus-article-mime-handles nil)))
6726 (gnus-kill-save-kill-buffer)
6727 (gnus-async-halt-prefetch)
6728 (let* ((group gnus-newsgroup-name)
6729 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6730 (gnus-group-is-exiting-p t)
6733 (buf (current-buffer)))
6735 ;; Do adaptive scoring, and possibly save score files.
6736 (when gnus-newsgroup-adaptive
6737 (gnus-score-adaptive))
6738 (when gnus-use-scoring
6740 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6741 ;; If we have several article buffers, we kill them at exit.
6742 (unless gnus-single-article-buffer
6743 (gnus-kill-buffer gnus-original-article-buffer)
6744 (setq gnus-article-current nil))
6745 (when gnus-use-cache
6746 (gnus-cache-possibly-remove-articles)
6747 (gnus-cache-save-buffers))
6748 (gnus-async-prefetch-remove-group group)
6749 (when gnus-suppress-duplicates
6750 (gnus-dup-enter-articles))
6751 (when gnus-use-trees
6752 (gnus-tree-close group))
6753 (when gnus-use-cache
6754 (gnus-cache-write-active))
6755 ;; Remove entries for this group.
6756 (nnmail-purge-split-history (gnus-group-real-name group))
6757 ;; Make all changes in this group permanent.
6759 (gnus-run-hooks 'gnus-exit-group-hook)
6760 (gnus-summary-update-info))
6761 (gnus-close-group group)
6762 ;; Make sure where we were, and go to next newsgroup.
6763 (set-buffer gnus-group-buffer)
6765 (gnus-group-jump-to-group group))
6766 (gnus-run-hooks 'gnus-summary-exit-hook)
6767 (unless (or quit-config
6768 ;; If this group has disappeared from the summary
6769 ;; buffer, don't skip forwards.
6770 (not (string= group (gnus-group-group-name))))
6771 (gnus-group-next-unread-group 1))
6772 (setq group-point (point))
6775 ;; If we have several article buffers, we kill them at exit.
6776 (unless gnus-single-article-buffer
6777 (gnus-kill-buffer gnus-article-buffer)
6778 (gnus-kill-buffer gnus-original-article-buffer)
6779 (setq gnus-article-current nil))
6781 (if (not gnus-kill-summary-on-exit)
6783 (gnus-deaden-summary)
6785 ;; We set all buffer-local variables to nil. It is unclear why
6786 ;; this is needed, but if we don't, buffer-local variables are
6787 ;; not garbage-collected, it seems. This would the lead to en
6788 ;; ever-growing Emacs.
6789 (gnus-summary-clear-local-variables)
6790 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6791 (gnus-summary-clear-local-variables))
6792 (when (get-buffer gnus-article-buffer)
6793 (bury-buffer gnus-article-buffer))
6794 ;; We clear the global counterparts of the buffer-local
6795 ;; variables as well, just to be on the safe side.
6796 (set-buffer gnus-group-buffer)
6797 (gnus-summary-clear-local-variables)
6798 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6799 (gnus-summary-clear-local-variables))
6800 ;; Return to group mode buffer.
6801 (when (eq mode 'gnus-summary-mode)
6802 (gnus-kill-buffer buf)))
6803 (setq gnus-current-select-method gnus-select-method)
6804 (set-buffer gnus-group-buffer)
6806 (gnus-handle-ephemeral-exit quit-config)
6807 (goto-char group-point)
6808 ;; If gnus-group-buffer is already displayed, make sure we also move
6809 ;; the cursor in the window that displays it.
6810 (let ((win (get-buffer-window (current-buffer) 0)))
6811 (if win (set-window-point win (point))))
6812 (unless leave-hidden
6813 (gnus-configure-windows 'group 'force)))
6814 ;; Clear the current group name.
6816 (setq gnus-newsgroup-name nil)))))
6818 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6819 (defun gnus-summary-exit-no-update (&optional no-questions)
6820 "Quit reading current newsgroup without updating read article info."
6822 (let* ((group gnus-newsgroup-name)
6823 (gnus-group-is-exiting-p t)
6824 (gnus-group-is-exiting-without-update-p t)
6825 (quit-config (gnus-group-quit-config group)))
6826 (when (or no-questions
6828 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6829 (gnus-async-halt-prefetch)
6830 (run-hooks 'gnus-summary-prepare-exit-hook)
6831 (when (gnus-buffer-live-p gnus-article-buffer)
6833 (set-buffer gnus-article-buffer)
6834 (mm-destroy-parts gnus-article-mime-handles)
6835 ;; Set it to nil for safety reason.
6836 (setq gnus-article-mime-handle-alist nil)
6837 (setq gnus-article-mime-handles nil)))
6838 ;; If we have several article buffers, we kill them at exit.
6839 (unless gnus-single-article-buffer
6840 (gnus-kill-buffer gnus-article-buffer)
6841 (gnus-kill-buffer gnus-original-article-buffer)
6842 (setq gnus-article-current nil))
6843 (if (not gnus-kill-summary-on-exit)
6844 (gnus-deaden-summary)
6845 (gnus-close-group group)
6846 (gnus-summary-clear-local-variables)
6847 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6848 (gnus-summary-clear-local-variables))
6849 (set-buffer gnus-group-buffer)
6850 (gnus-summary-clear-local-variables)
6851 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6852 (gnus-summary-clear-local-variables))
6853 (gnus-kill-buffer gnus-summary-buffer))
6854 (unless gnus-single-article-buffer
6855 (setq gnus-article-current nil))
6856 (when gnus-use-trees
6857 (gnus-tree-close group))
6858 (gnus-async-prefetch-remove-group group)
6859 (when (get-buffer gnus-article-buffer)
6860 (bury-buffer gnus-article-buffer))
6861 ;; Return to the group buffer.
6862 (gnus-configure-windows 'group 'force)
6863 ;; Clear the current group name.
6864 (setq gnus-newsgroup-name nil)
6865 (unless (gnus-ephemeral-group-p group)
6866 (gnus-group-update-group group))
6867 (when (equal (gnus-group-group-name) group)
6868 (gnus-group-next-unread-group 1))
6870 (gnus-handle-ephemeral-exit quit-config)))))
6872 (defun gnus-handle-ephemeral-exit (quit-config)
6873 "Handle movement when leaving an ephemeral group.
6874 The state which existed when entering the ephemeral is reset."
6875 (if (not (buffer-name (car quit-config)))
6876 (gnus-configure-windows 'group 'force)
6877 (set-buffer (car quit-config))
6878 (cond ((eq major-mode 'gnus-summary-mode)
6879 (gnus-set-global-variables))
6880 ((eq major-mode 'gnus-article-mode)
6882 ;; The `gnus-summary-buffer' variable may point
6883 ;; to the old summary buffer when using a single
6885 (unless (gnus-buffer-live-p gnus-summary-buffer)
6886 (set-buffer gnus-group-buffer))
6887 (set-buffer gnus-summary-buffer)
6888 (gnus-set-global-variables))))
6889 (if (or (eq (cdr quit-config) 'article)
6890 (eq (cdr quit-config) 'pick))
6892 ;; The current article may be from the ephemeral group
6893 ;; thus it is best that we reload this article
6895 ;; If we're exiting from a large digest, this can be
6896 ;; extremely slow. So, it's better not to reload it. -- jh.
6897 ;;(gnus-summary-show-article)
6898 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6899 (gnus-configure-windows 'pick 'force)
6900 (gnus-configure-windows (cdr quit-config) 'force)))
6901 (gnus-configure-windows (cdr quit-config) 'force))
6902 (when (eq major-mode 'gnus-summary-mode)
6903 (gnus-summary-next-subject 1 nil t)
6904 (gnus-summary-recenter)
6905 (gnus-summary-position-point))))
6909 (defvar gnus-dead-summary-mode-map nil)
6911 (unless gnus-dead-summary-mode-map
6912 (setq gnus-dead-summary-mode-map (make-keymap))
6913 (suppress-keymap gnus-dead-summary-mode-map)
6914 (substitute-key-definition
6915 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6916 (dolist (key '("\C-d" "\r" "\177" [delete]))
6917 (define-key gnus-dead-summary-mode-map
6918 key
'gnus-summary-wake-up-the-dead
))
6919 (dolist (key '("q" "Q"))
6920 (define-key gnus-dead-summary-mode-map key
'bury-buffer
)))
6922 (defvar gnus-dead-summary-mode nil
6923 "Minor mode for Gnus summary buffers.")
6925 (defun gnus-dead-summary-mode (&optional arg
)
6926 "Minor mode for Gnus summary buffers."
6928 (when (eq major-mode
'gnus-summary-mode
)
6929 (make-local-variable 'gnus-dead-summary-mode
)
6930 (setq gnus-dead-summary-mode
6931 (if (null arg
) (not gnus-dead-summary-mode
)
6932 (> (prefix-numeric-value arg
) 0)))
6933 (when gnus-dead-summary-mode
6934 (gnus-add-minor-mode
6935 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
6937 (defun gnus-deaden-summary ()
6938 "Make the current summary buffer into a dead summary buffer."
6939 ;; Kill any previous dead summary buffer.
6940 (when (and gnus-dead-summary
6941 (buffer-name gnus-dead-summary
))
6943 (set-buffer gnus-dead-summary
)
6944 (when gnus-dead-summary-mode
6945 (kill-buffer (current-buffer)))))
6946 ;; Make this the current dead summary.
6947 (setq gnus-dead-summary
(current-buffer))
6948 (gnus-dead-summary-mode 1)
6949 (let ((name (buffer-name)))
6950 (when (string-match "Summary" name
)
6952 (concat (substring name
0 (match-beginning 0)) "Dead "
6953 (substring name
(match-beginning 0)))
6957 (defun gnus-kill-or-deaden-summary (buffer)
6958 "Kill or deaden the summary BUFFER."
6960 (when (and (buffer-name buffer
)
6961 (not gnus-single-article-buffer
))
6964 (gnus-kill-buffer gnus-article-buffer
)
6965 (gnus-kill-buffer gnus-original-article-buffer
)))
6968 (gnus-kill-summary-on-exit
6969 (when (and gnus-use-trees
6970 (gnus-buffer-exists-p buffer
))
6973 (gnus-tree-close gnus-newsgroup-name
)))
6974 (gnus-kill-buffer buffer
))
6975 ;; Deaden the buffer.
6976 ((gnus-buffer-exists-p buffer
)
6979 (gnus-deaden-summary))))))
6981 (defun gnus-summary-wake-up-the-dead (&rest args
)
6982 "Wake up the dead summary buffer."
6984 (gnus-dead-summary-mode -
1)
6985 (let ((name (buffer-name)))
6986 (when (string-match "Dead " name
)
6988 (concat (substring name
0 (match-beginning 0))
6989 (substring name
(match-end 0)))
6991 (gnus-message 3 "This dead summary is now alive again"))
6993 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6994 (defun gnus-summary-fetch-faq (&optional faq-dir
)
6995 "Fetch the FAQ for the current group.
6996 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7000 (when current-prefix-arg
7002 "FAQ dir: " (and (listp gnus-group-faq-directory
)
7003 (mapcar (lambda (file) (list file
))
7004 gnus-group-faq-directory
))))))
7005 (let (gnus-faq-buffer)
7006 (when (setq gnus-faq-buffer
7007 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
7008 (gnus-configure-windows 'summary-faq
))))
7010 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7011 (defun gnus-summary-describe-group (&optional force
)
7012 "Describe the current newsgroup."
7014 (gnus-group-describe-group force gnus-newsgroup-name
))
7016 (defun gnus-summary-describe-briefly ()
7017 "Describe summary mode commands briefly."
7019 (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")))
7021 ;; Walking around group mode buffer from summary mode.
7023 (defun gnus-summary-next-group (&optional no-article target-group backward
)
7024 "Exit current newsgroup and then select next unread newsgroup.
7025 If prefix argument NO-ARTICLE is non-nil, no article is selected
7026 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7027 previous group instead."
7029 ;; Stop pre-fetching.
7030 (gnus-async-halt-prefetch)
7031 (let ((current-group gnus-newsgroup-name
)
7032 (current-buffer (current-buffer))
7034 ;; First we semi-exit this group to update Xrefs and all variables.
7035 ;; We can't do a real exit, because the window conf must remain
7036 ;; the same in case the user is prompted for info, and we don't
7037 ;; want the window conf to change before that...
7038 (gnus-summary-exit t
)
7039 (while (not entered
)
7040 ;; Then we find what group we are supposed to enter.
7041 (set-buffer gnus-group-buffer
)
7042 (gnus-group-jump-to-group current-group
)
7045 (if (eq gnus-keep-same-level
'best
)
7046 (gnus-summary-best-group gnus-newsgroup-name
)
7047 (gnus-summary-search-group backward gnus-keep-same-level
))))
7048 (if (not target-group
)
7049 ;; There are no further groups, so we return to the group
7052 (gnus-message 5 "Returning to the group buffer")
7054 (when (gnus-buffer-live-p current-buffer
)
7055 (set-buffer current-buffer
)
7056 (gnus-summary-exit))
7057 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
7058 ;; We try to enter the target group.
7059 (gnus-group-jump-to-group target-group
)
7060 (let ((unreads (gnus-group-group-unread)))
7061 (if (and (or (eq t unreads
)
7062 (and unreads
(not (zerop unreads
))))
7063 (gnus-summary-read-group
7064 target-group nil no-article
7065 (and (buffer-name current-buffer
) current-buffer
)
7068 (setq current-group target-group
7069 target-group nil
)))))))
7071 (defun gnus-summary-prev-group (&optional no-article
)
7072 "Exit current newsgroup and then select previous unread newsgroup.
7073 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7075 (gnus-summary-next-group no-article nil t
))
7077 ;; Walking around summary lines.
7079 (defun gnus-summary-first-subject (&optional unread undownloaded unseen
)
7080 "Go to the first subject satisfying any non-nil constraint.
7081 If UNREAD is non-nil, the article should be unread.
7082 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7083 If UNSEEN is non-nil, the article should be unseen.
7084 Returns the article selected or nil if there are no matching articles."
7088 ((null gnus-newsgroup-data
)
7089 (gnus-message 3 "No articles in the group")
7091 ;; Pick the first article.
7092 ((not (or unread undownloaded unseen
))
7093 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
7094 (gnus-data-number (car gnus-newsgroup-data
)))
7095 ;; Find the first unread article.
7097 (let ((data gnus-newsgroup-data
))
7099 (let ((num (gnus-data-number (car data
))))
7100 (or (memq num gnus-newsgroup-unfetched
)
7101 (not (or (and unread
7102 (memq num gnus-newsgroup-unreads
))
7104 (memq num gnus-newsgroup-undownloaded
))
7106 (memq num gnus-newsgroup-unseen
)))))))
7107 (setq data
(cdr data
)))
7111 (goto-char (gnus-data-pos (car data
)))
7112 (gnus-data-number (car data
)))
7113 (gnus-message 3 "No more%s articles"
7114 (let* ((r (when unread
" unread"))
7115 (d (when undownloaded
" undownloaded"))
7116 (s (when unseen
" unseen"))
7117 (l (delq nil
(list r d s
))))
7118 (cond ((= 3 (length l
))
7119 (concat r
"," d
", or" s
))
7121 (concat (car l
) ", or" (cadr l
)))
7128 (gnus-summary-position-point))))))
7130 (defun gnus-summary-next-subject (n &optional unread dont-display
)
7131 "Go to next N'th summary line.
7132 If N is negative, go to the previous N'th subject line.
7133 If UNREAD is non-nil, only unread articles are selected.
7134 The difference between N and the actual number of steps taken is
7137 (let ((backward (< n
0))
7141 (gnus-summary-find-prev unread
)
7142 (gnus-summary-find-next unread
)))
7143 (unless (zerop (setq n
(1- n
)))
7144 (gnus-summary-show-thread)))
7146 (gnus-message 7 "No more%s articles"
7147 (if unread
" unread" "")))
7148 (unless dont-display
7149 (gnus-summary-recenter)
7150 (gnus-summary-position-point))
7153 (defun gnus-summary-next-unread-subject (n)
7154 "Go to next N'th unread summary line."
7156 (gnus-summary-next-subject n t
))
7158 (defun gnus-summary-prev-subject (n &optional unread
)
7159 "Go to previous N'th summary line.
7160 If optional argument UNREAD is non-nil, only unread article is selected."
7162 (gnus-summary-next-subject (- n
) unread
))
7164 (defun gnus-summary-prev-unread-subject (n)
7165 "Go to previous N'th unread summary line."
7167 (gnus-summary-next-subject (- n
) t
))
7169 (defun gnus-summary-goto-subjects (articles)
7170 "Insert the subject header for ARTICLES in the current buffer."
7172 (dolist (article articles
)
7173 (gnus-summary-goto-subject article t
)))
7174 (gnus-summary-limit (append articles gnus-newsgroup-limit
))
7175 (gnus-summary-position-point))
7177 (defun gnus-summary-goto-subject (article &optional force silent
)
7178 "Go the subject line of ARTICLE.
7179 If FORCE, also allow jumping to articles not currently shown."
7180 (interactive "nArticle number: ")
7181 (unless (numberp article
)
7182 (error "Article %s is not a number" article
))
7184 (data (gnus-data-find article
)))
7185 ;; We read in the article if we have to.
7188 (gnus-summary-insert-subject
7190 (if (or (numberp force
) (vectorp force
)) force
)
7192 (setq data
(gnus-data-find article
)))
7197 (gnus-message 3 "Can't find article %d" article
))
7199 (let ((pt (gnus-data-pos data
)))
7201 (gnus-summary-set-article-display-arrow pt
))
7202 (gnus-summary-position-point)
7205 ;; Walking around summary lines with displaying articles.
7207 (defun gnus-summary-expand-window (&optional arg
)
7208 "Make the summary buffer take up the entire Emacs frame.
7209 Given a prefix, will force an `article' buffer configuration."
7212 (gnus-configure-windows 'article
'force
)
7213 (gnus-configure-windows 'summary
'force
)))
7215 (defun gnus-summary-display-article (article &optional all-header
)
7216 "Display ARTICLE in article buffer."
7217 (when (gnus-buffer-live-p gnus-article-buffer
)
7218 (with-current-buffer gnus-article-buffer
7219 (mm-enable-multibyte)))
7220 (gnus-set-global-variables)
7221 (when (gnus-buffer-live-p gnus-article-buffer
)
7222 (with-current-buffer gnus-article-buffer
7223 (setq gnus-article-charset gnus-newsgroup-charset
)
7224 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets
)
7225 (mm-enable-multibyte)))
7229 (if gnus-summary-display-article-function
7230 (funcall gnus-summary-display-article-function article all-header
)
7231 (gnus-article-prepare article all-header
))
7232 (gnus-run-hooks 'gnus-select-article-hook
)
7233 (when (and gnus-current-article
7234 (not (zerop gnus-current-article
)))
7235 (gnus-summary-goto-subject gnus-current-article
))
7236 (gnus-summary-recenter)
7237 (when (and gnus-use-trees gnus-show-threads
)
7238 (gnus-possibly-generate-tree article
)
7239 (gnus-highlight-selected-tree article
))
7240 ;; Successfully display article.
7241 (gnus-article-set-window-start
7242 (cdr (assq article gnus-newsgroup-bookmarks
))))))
7244 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
7245 "Select the current article.
7246 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7247 non-nil, the article will be re-fetched even if it already present in
7248 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7250 ;; Make sure we are in the summary buffer to work around bbdb bug.
7251 (unless (eq major-mode
'gnus-summary-mode
)
7252 (set-buffer gnus-summary-buffer
))
7253 (let ((article (or article
(gnus-summary-article-number)))
7254 (all-headers (not (not all-headers
))) ;Must be t or nil.
7255 gnus-summary-display-article-function
)
7257 (gnus-summary-article-pseudo-p article
)
7258 (error "This is a pseudo-article"))
7260 (set-buffer gnus-summary-buffer
)
7261 (if (or (and gnus-single-article-buffer
7262 (or (null gnus-current-article
)
7263 (null gnus-article-current
)
7264 (null (get-buffer gnus-article-buffer
))
7265 (not (eq article
(cdr gnus-article-current
)))
7266 (not (equal (car gnus-article-current
)
7267 gnus-newsgroup-name
))))
7268 (and (not gnus-single-article-buffer
)
7269 (or (null gnus-current-article
)
7270 (not (eq gnus-current-article article
))))
7272 ;; The requested article is different from the current article.
7274 (gnus-summary-display-article article all-headers
)
7275 (when (gnus-buffer-live-p gnus-article-buffer
)
7276 (with-current-buffer gnus-article-buffer
7277 (if (not gnus-article-decoded-p
) ;; a local variable
7278 (mm-disable-multibyte))))
7279 (gnus-article-set-window-start
7280 (cdr (assq article gnus-newsgroup-bookmarks
)))
7284 (defun gnus-summary-force-verify-and-decrypt ()
7285 "Display buttons for signed/encrypted parts and verify/decrypt them."
7287 (let ((mm-verify-option 'known
)
7288 (mm-decrypt-option 'known
)
7289 (gnus-article-emulate-mime t
)
7290 (gnus-buttonized-mime-types (append (list "multipart/signed"
7291 "multipart/encrypted")
7292 gnus-buttonized-mime-types
)))
7293 (gnus-summary-select-article nil
'force
)))
7295 (defun gnus-summary-set-current-mark (&optional current-mark
)
7296 "Obsolete function."
7299 (defun gnus-summary-next-article (&optional unread subject backward push
)
7300 "Select the next article.
7301 If UNREAD, only unread articles are selected.
7302 If SUBJECT, only articles with SUBJECT are selected.
7303 If BACKWARD, the previous article is selected instead of the next."
7306 ;; Is there such an article?
7307 ((and (gnus-summary-search-forward unread subject backward
)
7308 (or (gnus-summary-display-article (gnus-summary-article-number))
7309 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
7310 (gnus-summary-position-point))
7311 ;; If not, we try the first unread, if that is wanted.
7313 gnus-auto-select-same
7314 (gnus-summary-first-unread-article))
7315 (gnus-summary-position-point)
7316 (gnus-message 6 "Wrapped"))
7317 ;; Try to get next/previous article not displayed in this group.
7318 ((and gnus-auto-extend-newsgroup
7319 (not unread
) (not subject
))
7320 (gnus-summary-goto-article
7321 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
7322 nil
(count-lines (point-min) (point))))
7323 ;; Go to next/previous group.
7325 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
7326 (gnus-summary-jump-to-group gnus-newsgroup-name
))
7327 (let ((cmd last-command-char
)
7330 (set-buffer gnus-group-buffer
)
7333 (if (eq gnus-keep-same-level
'best
)
7334 (gnus-summary-best-group gnus-newsgroup-name
)
7335 (gnus-summary-search-group backward gnus-keep-same-level
))))
7336 ;; For some reason, the group window gets selected. We change
7338 (select-window (get-buffer-window (current-buffer)))
7339 ;; Select next unread newsgroup automagically.
7341 ((or (not gnus-auto-select-next
)
7343 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
7344 ((or (eq gnus-auto-select-next
'quietly
)
7345 (and (eq gnus-auto-select-next
'slightly-quietly
)
7347 (and (eq gnus-auto-select-next
'almost-quietly
)
7348 (gnus-summary-last-article-p)))
7350 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
7352 (gnus-message 7 "No more%s articles (%s)..."
7353 (if unread
" unread" "")
7354 (if group
(concat "selecting " group
)
7356 (gnus-summary-next-group nil group backward
)))
7358 (when (gnus-key-press-event-p last-input-event
)
7359 (gnus-summary-walk-group-buffer
7360 gnus-newsgroup-name cmd unread backward point
))))))))
7362 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
7363 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
7364 (?\C-p
(gnus-group-prev-unread-group 1))))
7365 (cursor-in-echo-area t
)
7366 keve key group ended prompt
)
7368 (set-buffer gnus-group-buffer
)
7371 (if (eq gnus-keep-same-level
'best
)
7372 (gnus-summary-best-group gnus-newsgroup-name
)
7373 (gnus-summary-search-group backward gnus-keep-same-level
))))
7377 "No more%s articles%s " (if unread
" unread" "")
7379 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
7380 (format " (Type %s for %s [%s])"
7381 (single-key-description cmd
)
7382 (gnus-group-decoded-name group
)
7383 (car (gnus-gethash group gnus-newsrc-hashtb
)))
7384 (format " (Type %s to exit %s)"
7385 (single-key-description cmd
)
7386 (gnus-group-decoded-name gnus-newsgroup-name
)))))
7387 ;; Confirm auto selection.
7388 (setq key
(car (setq keve
(gnus-read-event-char prompt
)))
7391 ((assq key keystrokes
)
7392 (let ((obuf (current-buffer)))
7393 (switch-to-buffer gnus-group-buffer
)
7395 (gnus-group-jump-to-group group
))
7396 (eval (cadr (assq key keystrokes
)))
7397 (setq group
(gnus-group-group-name))
7398 (switch-to-buffer obuf
))
7402 (gnus-ephemeral-group-p gnus-newsgroup-name
))
7404 (gnus-summary-next-group nil group backward
)))
7406 (push (cdr keve
) unread-command-events
))))))
7408 (defun gnus-summary-next-unread-article ()
7409 "Select unread article after current one."
7411 (gnus-summary-next-article
7412 (or (not (eq gnus-summary-goto-unread
'never
))
7413 (gnus-summary-last-article-p (gnus-summary-article-number)))
7414 (and gnus-auto-select-same
7415 (gnus-summary-article-subject))))
7417 (defun gnus-summary-prev-article (&optional unread subject
)
7418 "Select the article after the current one.
7419 If UNREAD is non-nil, only unread articles are selected."
7421 (gnus-summary-next-article unread subject t
))
7423 (defun gnus-summary-prev-unread-article ()
7424 "Select unread article before current one."
7426 (gnus-summary-prev-article
7427 (or (not (eq gnus-summary-goto-unread
'never
))
7428 (gnus-summary-first-article-p (gnus-summary-article-number)))
7429 (and gnus-auto-select-same
7430 (gnus-summary-article-subject))))
7432 (defun gnus-summary-next-page (&optional lines circular stop
)
7433 "Show next page of the selected article.
7434 If at the end of the current article, select the next article.
7435 LINES says how many lines should be scrolled up.
7437 If CIRCULAR is non-nil, go to the start of the article instead of
7438 selecting the next article when reaching the end of the current
7441 If STOP is non-nil, just stop when reaching the end of the message.
7443 Also see the variable `gnus-article-skip-boring'."
7445 (setq gnus-summary-buffer
(current-buffer))
7446 (gnus-set-global-variables)
7447 (let ((article (gnus-summary-article-number))
7448 (article-window (get-buffer-window gnus-article-buffer t
))
7450 ;; If the buffer is empty, we have no article.
7452 (error "No article to select"))
7453 (gnus-configure-windows 'article
)
7454 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
7455 (if (and (eq gnus-summary-goto-unread
'never
)
7456 (not (gnus-summary-last-article-p article
)))
7457 (gnus-summary-next-article)
7458 (gnus-summary-next-unread-article))
7459 (if (or (null gnus-current-article
)
7460 (null gnus-article-current
)
7461 (/= article
(cdr gnus-article-current
))
7462 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7463 ;; Selected subject is different from current article's.
7464 (gnus-summary-display-article article
)
7465 (when article-window
7466 (gnus-eval-in-buffer-window gnus-article-buffer
7467 (setq endp
(or (gnus-article-next-page lines
)
7468 (gnus-article-only-boring-p))))
7471 (gnus-message 3 "End of message"))
7473 (gnus-summary-beginning-of-article))
7475 (gnus-message 3 "End of message"))
7477 (if (and (eq gnus-summary-goto-unread
'never
)
7478 (not (gnus-summary-last-article-p article
)))
7479 (gnus-summary-next-article)
7480 (gnus-summary-next-unread-article))))))))
7481 (gnus-summary-recenter)
7482 (gnus-summary-position-point)))
7484 (defun gnus-summary-prev-page (&optional lines move
)
7485 "Show previous page of selected article.
7486 Argument LINES specifies lines to be scrolled down.
7487 If MOVE, move to the previous unread article if point is at
7488 the beginning of the buffer."
7490 (let ((article (gnus-summary-article-number))
7491 (article-window (get-buffer-window gnus-article-buffer t
))
7493 (gnus-configure-windows 'article
)
7494 (if (or (null gnus-current-article
)
7495 (null gnus-article-current
)
7496 (/= article
(cdr gnus-article-current
))
7497 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7498 ;; Selected subject is different from current article's.
7499 (gnus-summary-display-article article
)
7500 (gnus-summary-recenter)
7501 (when article-window
7502 (gnus-eval-in-buffer-window gnus-article-buffer
7503 (setq endp
(gnus-article-prev-page lines
)))
7504 (when (and move endp
)
7506 (gnus-message 3 "Beginning of message"))
7508 (if (and (eq gnus-summary-goto-unread
'never
)
7509 (not (gnus-summary-first-article-p article
)))
7510 (gnus-summary-prev-article)
7511 (gnus-summary-prev-unread-article))))))))
7512 (gnus-summary-position-point))
7514 (defun gnus-summary-prev-page-or-article (&optional lines
)
7515 "Show previous page of selected article.
7516 Argument LINES specifies lines to be scrolled down.
7517 If at the beginning of the article, go to the next article."
7519 (gnus-summary-prev-page lines t
))
7521 (defun gnus-summary-scroll-up (lines)
7522 "Scroll up (or down) one line current article.
7523 Argument LINES specifies lines to be scrolled up (or down if negative)."
7525 (gnus-configure-windows 'article
)
7526 (gnus-summary-show-thread)
7527 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
7528 (gnus-eval-in-buffer-window gnus-article-buffer
7530 (when (gnus-article-next-page lines
)
7531 (gnus-message 3 "End of message")))
7533 (gnus-article-prev-page (- lines
))))))
7534 (gnus-summary-recenter)
7535 (gnus-summary-position-point))
7537 (defun gnus-summary-scroll-down (lines)
7538 "Scroll down (or up) one line current article.
7539 Argument LINES specifies lines to be scrolled down (or up if negative)."
7541 (gnus-summary-scroll-up (- lines
)))
7543 (defun gnus-summary-next-same-subject ()
7544 "Select next article which has the same subject as current one."
7546 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
7548 (defun gnus-summary-prev-same-subject ()
7549 "Select previous article which has the same subject as current one."
7551 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
7553 (defun gnus-summary-next-unread-same-subject ()
7554 "Select next unread article which has the same subject as current one."
7556 (gnus-summary-next-article t
(gnus-summary-article-subject)))
7558 (defun gnus-summary-prev-unread-same-subject ()
7559 "Select previous unread article which has the same subject as current one."
7561 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
7563 (defun gnus-summary-first-unread-article ()
7564 "Select the first unread article.
7565 Return nil if there are no unread articles."
7568 (when (gnus-summary-first-subject t
)
7569 (gnus-summary-show-thread)
7570 (gnus-summary-first-subject t
)
7571 (gnus-summary-display-article (gnus-summary-article-number)))
7572 (gnus-summary-position-point)))
7574 (defun gnus-summary-first-unread-subject ()
7575 "Place the point on the subject line of the first unread article.
7576 Return nil if there are no unread articles."
7579 (when (gnus-summary-first-subject t
)
7580 (gnus-summary-show-thread)
7581 (gnus-summary-first-subject t
))
7582 (gnus-summary-position-point)))
7584 (defun gnus-summary-first-unseen-subject ()
7585 "Place the point on the subject line of the first unseen article.
7586 Return nil if there are no unseen articles."
7589 (when (gnus-summary-first-subject nil nil t
)
7590 (gnus-summary-show-thread)
7591 (gnus-summary-first-subject nil nil t
))
7592 (gnus-summary-position-point)))
7594 (defun gnus-summary-first-unseen-or-unread-subject ()
7595 "Place the point on the subject line of the first unseen article or,
7596 if all article have been seen, on the subject line of the first unread
7600 (unless (when (gnus-summary-first-subject nil nil t
)
7601 (gnus-summary-show-thread)
7602 (gnus-summary-first-subject nil nil t
))
7603 (when (gnus-summary-first-subject t
)
7604 (gnus-summary-show-thread)
7605 (gnus-summary-first-subject t
)))
7606 (gnus-summary-position-point)))
7608 (defun gnus-summary-first-article ()
7609 "Select the first article.
7610 Return nil if there are no articles."
7613 (when (gnus-summary-first-subject)
7614 (gnus-summary-show-thread)
7615 (gnus-summary-first-subject)
7616 (gnus-summary-display-article (gnus-summary-article-number)))
7617 (gnus-summary-position-point)))
7619 (defun gnus-summary-best-unread-article (&optional arg
)
7620 "Select the unread article with the highest score.
7621 If given a prefix argument, select the next unread article that has a
7622 score higher than the default score."
7624 (let ((article (if arg
7625 (gnus-summary-better-unread-subject)
7626 (gnus-summary-best-unread-subject))))
7628 (gnus-summary-goto-article article
)
7629 (error "No unread articles"))))
7631 (defun gnus-summary-best-unread-subject ()
7632 "Select the unread subject with the highest score."
7634 (let ((best -
1000000)
7635 (data gnus-newsgroup-data
)
7638 (and (gnus-data-unread-p (car data
))
7640 (gnus-summary-article-score (gnus-data-number (car data
))))
7643 article
(gnus-data-number (car data
))))
7644 (setq data
(cdr data
)))
7646 (gnus-summary-goto-subject article
))
7647 (gnus-summary-position-point)
7650 (defun gnus-summary-better-unread-subject ()
7651 "Select the first unread subject that has a score over the default score."
7653 (let ((data gnus-newsgroup-data
)
7655 (while (and (setq article
(gnus-data-number (car data
)))
7656 (or (gnus-data-read-p (car data
))
7657 (not (> (gnus-summary-article-score article
)
7658 gnus-summary-default-score
))))
7659 (setq data
(cdr data
)))
7661 (gnus-summary-goto-subject article
))
7662 (gnus-summary-position-point)
7665 (defun gnus-summary-last-subject ()
7666 "Go to the last displayed subject line in the group."
7667 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
7669 (gnus-summary-goto-subject article
))))
7671 (defun gnus-summary-goto-article (article &optional all-headers force
)
7672 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7673 If ALL-HEADERS is non-nil, no header lines are hidden.
7674 If FORCE, go to the article even if it isn't displayed. If FORCE
7675 is a number, it is the line the article is to be displayed on."
7679 "Article number or Message-ID: "
7680 (mapcar (lambda (number) (list (int-to-string number
)))
7681 gnus-newsgroup-limit
))
7685 (if (and (stringp article
)
7686 (string-match "@\\|%40" article
))
7687 (gnus-summary-refer-article article
)
7688 (when (stringp article
)
7689 (setq article
(string-to-number article
)))
7690 (if (gnus-summary-goto-subject article force
)
7691 (gnus-summary-display-article article all-headers
)
7692 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
7693 (gnus-summary-position-point)))
7695 (defun gnus-summary-goto-last-article ()
7696 "Go to the previously read article."
7699 (when gnus-last-article
7700 (gnus-summary-goto-article gnus-last-article nil t
))
7701 (gnus-summary-position-point)))
7703 (defun gnus-summary-pop-article (number)
7704 "Pop one article off the history and go to the previous.
7705 NUMBER articles will be popped off."
7708 (setq gnus-newsgroup-history
7709 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
7711 (gnus-summary-goto-article (car to
) nil t
)
7712 (error "Article history empty")))
7713 (gnus-summary-position-point))
7715 ;; Summary commands and functions for limiting the summary buffer.
7717 (defun gnus-summary-limit-to-articles (n)
7718 "Limit the summary buffer to the next N articles.
7719 If not given a prefix, use the process marked articles instead."
7722 (let ((articles (gnus-summary-work-articles n
)))
7723 (setq gnus-newsgroup-processable nil
)
7724 (gnus-summary-limit articles
))
7725 (gnus-summary-position-point)))
7727 (defun gnus-summary-pop-limit (&optional total
)
7728 "Restore the previous limit.
7729 If given a prefix, remove all limits."
7732 (setq gnus-newsgroup-limits
7733 (list (mapcar (lambda (h) (mail-header-number h
))
7734 gnus-newsgroup-headers
))))
7735 (unless gnus-newsgroup-limits
7736 (error "No limit to pop"))
7738 (gnus-summary-limit nil
'pop
)
7739 (gnus-summary-position-point)))
7741 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
7742 "Limit the summary buffer to articles that have subjects that match a regexp.
7743 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7745 (list (read-string (if current-prefix-arg
7746 "Exclude subject (regexp): "
7747 "Limit to subject (regexp): "))
7748 nil current-prefix-arg
))
7750 (setq header
"subject"))
7751 (when (not (equal "" subject
))
7753 (let ((articles (gnus-summary-find-matching
7754 (or header
"subject") subject
'all nil nil
7757 (error "Found no matches for \"%s\"" subject
))
7758 (gnus-summary-limit articles
))
7759 (gnus-summary-position-point))))
7761 (defun gnus-summary-limit-to-author (from &optional not-matching
)
7762 "Limit the summary buffer to articles that have authors that match a regexp.
7763 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7765 (list (read-string (if current-prefix-arg
7766 "Exclude author (regexp): "
7767 "Limit to author (regexp): "))
7768 current-prefix-arg
))
7769 (gnus-summary-limit-to-subject from
"from" not-matching
))
7771 (defun gnus-summary-limit-to-age (age &optional younger-p
)
7772 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7773 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7774 articles that are younger than AGE days."
7776 (let ((younger current-prefix-arg
)
7779 (while (not days-got
)
7780 (setq days
(if younger
7781 (read-string "Limit to articles younger than (in days, older when negative): ")
7783 "Limit to articles older than (in days, younger when negative): ")))
7784 (when (> (length days
) 0)
7785 (setq days
(read days
)))
7791 (setq younger
(not younger
))
7792 (setq days
(* days -
1)))))
7793 (message "Please enter a number.")
7795 (list days younger
)))
7797 (let ((data gnus-newsgroup-data
)
7798 (cutoff (days-to-time age
))
7799 articles d date is-younger
)
7800 (while (setq d
(pop data
))
7801 (when (and (vectorp (gnus-data-header d
))
7802 (setq date
(mail-header-date (gnus-data-header d
))))
7803 (setq is-younger
(time-less-p
7804 (time-since (condition-case ()
7811 (push (gnus-data-number d
) articles
))))
7812 (gnus-summary-limit (nreverse articles
)))
7813 (gnus-summary-position-point)))
7815 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
7816 "Limit the summary buffer to articles that match an 'extra' header."
7820 (gnus-completing-read-with-default
7821 (symbol-name (car gnus-extra-headers
))
7822 (if current-prefix-arg
7823 "Exclude extra header"
7824 "Limit extra header")
7826 (cons (symbol-name x
) x
))
7831 (read-string (format "%s header %s (regexp): "
7832 (if current-prefix-arg
"Exclude" "Limit to")
7834 current-prefix-arg
)))
7835 (when (not (equal "" regexp
))
7837 (let ((articles (gnus-summary-find-matching
7838 (cons 'extra header
) regexp
'all nil nil
7841 (error "Found no matches for \"%s\"" regexp
))
7842 (gnus-summary-limit articles
))
7843 (gnus-summary-position-point))))
7845 (defun gnus-summary-limit-to-display-predicate ()
7846 "Limit the summary buffer to the predicated in the `display' group parameter."
7848 (unless gnus-newsgroup-display
7849 (error "There is no `display' group parameter"))
7851 (dolist (number gnus-newsgroup-articles
)
7852 (when (funcall gnus-newsgroup-display
)
7853 (push number articles
)))
7854 (gnus-summary-limit articles
))
7855 (gnus-summary-position-point))
7857 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7859 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7861 (defun gnus-summary-limit-to-unread (&optional all
)
7862 "Limit the summary buffer to articles that are not marked as read.
7863 If ALL is non-nil, limit strictly to unread articles."
7866 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
7867 (gnus-summary-limit-to-marks
7868 ;; Concat all the marks that say that an article is read and have
7870 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7871 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7872 gnus-low-score-mark gnus-expirable-mark
7873 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7874 gnus-duplicate-mark gnus-souped-mark
)
7877 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
7878 (make-obsolete 'gnus-summary-delete-marked-with
7879 'gnus-summary-limit-exclude-marks
)
7881 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
7882 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7883 If REVERSE, limit the summary buffer to articles that are marked
7884 with MARKS. MARKS can either be a string of marks or a list of marks.
7885 Returns how many articles were removed."
7886 (interactive "sMarks: ")
7887 (gnus-summary-limit-to-marks marks t
))
7889 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
7890 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7891 If REVERSE (the prefix), limit the summary buffer to articles that are
7892 not marked with MARKS. MARKS can either be a string of marks or a
7894 Returns how many articles were removed."
7895 (interactive "sMarks: \nP")
7897 (let ((data gnus-newsgroup-data
)
7898 (marks (if (listp marks
) marks
7899 (append marks nil
))) ; Transform to list.
7902 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
7903 (memq (gnus-data-mark (car data
)) marks
))
7904 (push (gnus-data-number (car data
)) articles
))
7905 (setq data
(cdr data
)))
7906 (gnus-summary-limit articles
))
7907 (gnus-summary-position-point)))
7909 (defun gnus-summary-limit-to-score (score)
7910 "Limit to articles with score at or above SCORE."
7911 (interactive "NLimit to articles with score of at least: ")
7912 (let ((data gnus-newsgroup-data
)
7915 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
7917 (push (gnus-data-number (car data
)) articles
))
7918 (setq data
(cdr data
)))
7920 (gnus-summary-limit articles
)
7921 (gnus-summary-position-point))))
7923 (defun gnus-summary-limit-to-unseen ()
7924 "Limit to unseen articles."
7927 (gnus-summary-limit gnus-newsgroup-unseen
)
7928 (gnus-summary-position-point)))
7930 (defun gnus-summary-limit-include-thread (id)
7931 "Display all the hidden articles that is in the thread with ID in it.
7932 When called interactively, ID is the Message-ID of the current
7934 (interactive (list (mail-header-id (gnus-summary-article-header))))
7935 (let ((articles (gnus-articles-in-thread
7936 (gnus-id-to-thread (gnus-root-id id
)))))
7938 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
7939 (gnus-summary-limit-include-matching-articles
7941 (regexp-quote (gnus-simplify-subject-re
7942 (mail-header-subject (gnus-id-to-header id
)))))
7943 (gnus-summary-position-point))))
7945 (defun gnus-summary-limit-include-matching-articles (header regexp
)
7946 "Display all the hidden articles that have HEADERs that match REGEXP."
7947 (interactive (list (read-string "Match on header: ")
7948 (read-string "Regexp: ")))
7949 (let ((articles (gnus-find-matching-articles header regexp
)))
7951 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
7952 (gnus-summary-position-point))))
7954 (defun gnus-summary-insert-dormant-articles ()
7955 "Insert all the dormant articles for this group into the current buffer."
7957 (let ((gnus-verbose (max 6 gnus-verbose
)))
7958 (if (not gnus-newsgroup-dormant
)
7959 (gnus-message 3 "No cached articles for this group")
7960 (gnus-summary-goto-subjects gnus-newsgroup-dormant
))))
7962 (defun gnus-summary-limit-include-dormant ()
7963 "Display all the hidden articles that are marked as dormant.
7964 Note that this command only works on a subset of the articles currently
7965 fetched for this group."
7967 (unless gnus-newsgroup-dormant
7968 (error "There are no dormant articles in this group"))
7970 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
7971 (gnus-summary-position-point)))
7973 (defun gnus-summary-limit-exclude-dormant ()
7974 "Hide all dormant articles."
7977 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
7978 (gnus-summary-position-point)))
7980 (defun gnus-summary-limit-exclude-childless-dormant ()
7981 "Hide all dormant articles that have no children."
7983 (let ((data (gnus-data-list t
))
7984 articles d children
)
7985 ;; Find all articles that are either not dormant or have
7987 (while (setq d
(pop data
))
7988 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
7990 (gnus-article-children (gnus-data-number d
)))
7993 (when (memq (car children
) articles
)
7998 (push (gnus-data-number d
) articles
)))
8001 (gnus-summary-limit articles
)
8002 (gnus-summary-position-point))))
8004 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
8005 "Mark all unread excluded articles as read.
8006 If ALL, mark even excluded ticked and dormants as read."
8008 (setq gnus-newsgroup-limit
(sort gnus-newsgroup-limit
'<))
8009 (let ((articles (gnus-sorted-ndifference
8011 (mapcar (lambda (h) (mail-header-number h
))
8012 gnus-newsgroup-headers
)
8014 gnus-newsgroup-limit
))
8016 (setq gnus-newsgroup-unreads
8017 (gnus-sorted-intersection gnus-newsgroup-unreads
8018 gnus-newsgroup-limit
))
8020 (setq gnus-newsgroup-dormant nil
8021 gnus-newsgroup-marked nil
8022 gnus-newsgroup-reads
8024 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
8025 gnus-newsgroup-reads
))
8026 (while (setq article
(pop articles
))
8027 (unless (or (memq article gnus-newsgroup-dormant
)
8028 (memq article gnus-newsgroup-marked
))
8029 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
8031 (defun gnus-summary-limit (articles &optional pop
)
8033 ;; We pop the previous limit off the stack and use that.
8034 (setq articles
(car gnus-newsgroup-limits
)
8035 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
8036 ;; We use the new limit, so we push the old limit on the stack.
8037 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
8039 (setq gnus-newsgroup-limit articles
)
8040 (let ((total (length gnus-newsgroup-data
))
8041 (data (gnus-data-find-list (gnus-summary-article-number)))
8042 (gnus-summary-mark-below nil
) ; Inhibit this.
8044 ;; This will do all the work of generating the new summary buffer
8045 ;; according to the new limit.
8046 (gnus-summary-prepare)
8047 ;; Hide any threads, possibly.
8048 (gnus-summary-maybe-hide-threads)
8049 ;; Try to return to the article you were at, or one in the
8052 ;; We try to find some article after the current one.
8054 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
8057 (setq data
(cdr data
))))
8059 ;; If there is no data, that means that we were after the last
8060 ;; article. The same goes when we can't find any articles
8061 ;; after the current one.
8062 (goto-char (point-max))
8063 (gnus-summary-find-prev))
8064 (gnus-set-mode-line 'summary
)
8065 ;; We return how many articles were removed from the summary
8066 ;; buffer as a result of the new limit.
8067 (- total
(length gnus-newsgroup-data
))))
8069 (defsubst gnus-invisible-cut-children
(threads)
8072 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
8077 (defsubst gnus-cut-thread
(thread)
8078 "Go forwards in the thread until we find an article that we want to display."
8079 (when (or (eq gnus-fetch-old-headers
'some
)
8080 (eq gnus-fetch-old-headers
'invisible
)
8081 (numberp gnus-fetch-old-headers
)
8082 (eq gnus-build-sparse-threads
'some
)
8083 (eq gnus-build-sparse-threads
'more
))
8084 ;; Deal with old-fetched headers and sparse threads.
8088 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
8089 (gnus-summary-article-ancient-p
8090 (mail-header-number (car thread
))))
8091 (if (or (<= (length (cdr thread
)) 1)
8092 (eq gnus-fetch-old-headers
'invisible
))
8093 (setq gnus-newsgroup-limit
8094 (delq (mail-header-number (car thread
))
8095 gnus-newsgroup-limit
)
8096 thread
(cadr thread
))
8097 (when (gnus-invisible-cut-children (cdr thread
))
8098 (let ((th (cdr thread
)))
8100 (if (memq (mail-header-number (caar th
))
8101 gnus-newsgroup-limit
)
8102 (setq thread
(car th
)
8104 (setq th
(cdr th
))))))))))
8107 (defun gnus-cut-threads (threads)
8108 "Cut off all uninteresting articles from the beginning of THREADS."
8109 (when (or (eq gnus-fetch-old-headers
'some
)
8110 (eq gnus-fetch-old-headers
'invisible
)
8111 (numberp gnus-fetch-old-headers
)
8112 (eq gnus-build-sparse-threads
'some
)
8113 (eq gnus-build-sparse-threads
'more
))
8116 (setcar th
(gnus-cut-thread (car th
)))
8117 (setq th
(cdr th
)))))
8118 ;; Remove nixed out threads.
8121 (defun gnus-summary-initial-limit (&optional show-if-empty
)
8122 "Figure out what the initial limit is supposed to be on group entry.
8123 This entails weeding out unwanted dormants, low-scored articles,
8124 fetch-old-headers verbiage, and so on."
8125 ;; Most groups have nothing to remove.
8126 (if (or gnus-inhibit-limiting
8127 (and (null gnus-newsgroup-dormant
)
8128 (eq gnus-newsgroup-display
'gnus-not-ignore
)
8129 (not (eq gnus-fetch-old-headers
'some
))
8130 (not (numberp gnus-fetch-old-headers
))
8131 (not (eq gnus-fetch-old-headers
'invisible
))
8132 (null gnus-summary-expunge-below
)
8133 (not (eq gnus-build-sparse-threads
'some
))
8134 (not (eq gnus-build-sparse-threads
'more
))
8135 (null gnus-thread-expunge-below
)
8136 (not gnus-use-nocem
)))
8138 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
8139 (setq gnus-newsgroup-limit nil
)
8142 (unless (car (symbol-value node
))
8143 ;; These threads have no parents -- they are roots.
8144 (let ((nodes (cdr (symbol-value node
)))
8147 (if (and gnus-thread-expunge-below
8148 (< (gnus-thread-total-score (car nodes
))
8149 gnus-thread-expunge-below
))
8150 (gnus-expunge-thread (pop nodes
))
8151 (setq thread
(pop nodes
))
8152 (gnus-summary-limit-children thread
))))))
8153 gnus-newsgroup-dependencies
)
8154 ;; If this limitation resulted in an empty group, we might
8155 ;; pop the previous limit and use it instead.
8156 (when (and (not gnus-newsgroup-limit
)
8158 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
8159 gnus-newsgroup-limit
))
8161 (defun gnus-summary-limit-children (thread)
8162 "Return 1 if this subthread is visible and 0 if it is not."
8163 ;; First we get the number of visible children to this thread. This
8164 ;; is done by recursing down the thread using this function, so this
8165 ;; will really go down to a leaf article first, before slowly
8166 ;; working its way up towards the root.
8168 (let* ((max-lisp-eval-depth 5000)
8171 (apply '+ (mapcar 'gnus-summary-limit-children
8174 (number (mail-header-number (car thread
)))
8177 (not (memq number gnus-newsgroup-marked
))
8179 ;; If this article is dormant and has absolutely no visible
8180 ;; children, then this article isn't visible.
8181 (and (memq number gnus-newsgroup-dormant
)
8183 ;; If this is "fetch-old-headered" and there is no
8184 ;; visible children, then we don't want this article.
8185 (and (or (eq gnus-fetch-old-headers
'some
)
8186 (numberp gnus-fetch-old-headers
))
8187 (gnus-summary-article-ancient-p number
)
8189 ;; If this is "fetch-old-headered" and `invisible', then
8190 ;; we don't want this article.
8191 (and (eq gnus-fetch-old-headers
'invisible
)
8192 (gnus-summary-article-ancient-p number
))
8193 ;; If this is a sparsely inserted article with no children,
8194 ;; we don't want it.
8195 (and (eq gnus-build-sparse-threads
'some
)
8196 (gnus-summary-article-sparse-p number
)
8198 ;; If we use expunging, and this article is really
8199 ;; low-scored, then we don't want this article.
8200 (when (and gnus-summary-expunge-below
8202 (or (cdr (assq number gnus-newsgroup-scored
))
8203 gnus-summary-default-score
))
8204 gnus-summary-expunge-below
))
8205 ;; We increase the expunge-tally here, but that has
8206 ;; nothing to do with the limits, really.
8207 (incf gnus-newsgroup-expunged-tally
)
8208 ;; We also mark as read here, if that's wanted.
8209 (when (and gnus-summary-mark-below
8210 (< score gnus-summary-mark-below
))
8211 (setq gnus-newsgroup-unreads
8212 (delq number gnus-newsgroup-unreads
))
8213 (if gnus-newsgroup-auto-expire
8214 (push number gnus-newsgroup-expirable
)
8215 (push (cons number gnus-low-score-mark
)
8216 gnus-newsgroup-reads
)))
8218 ;; Do the `display' group parameter.
8219 (and gnus-newsgroup-display
8220 (not (funcall gnus-newsgroup-display
)))
8221 ;; Check NoCeM things.
8222 (if (and gnus-use-nocem
8223 (gnus-nocem-unwanted-article-p
8224 (mail-header-id (car thread
))))
8226 (setq gnus-newsgroup-unreads
8227 (delq number gnus-newsgroup-unreads
))
8229 ;; Nope, invisible article.
8231 ;; Ok, this article is to be visible, so we add it to the limit
8233 (push number gnus-newsgroup-limit
)
8236 (defun gnus-expunge-thread (thread)
8237 "Mark all articles in THREAD as read."
8238 (let* ((number (mail-header-number (car thread
))))
8239 (incf gnus-newsgroup-expunged-tally
)
8240 ;; We also mark as read here, if that's wanted.
8241 (setq gnus-newsgroup-unreads
8242 (delq number gnus-newsgroup-unreads
))
8243 (if gnus-newsgroup-auto-expire
8244 (push number gnus-newsgroup-expirable
)
8245 (push (cons number gnus-low-score-mark
)
8246 gnus-newsgroup-reads
)))
8247 ;; Go recursively through all subthreads.
8248 (mapcar 'gnus-expunge-thread
(cdr thread
)))
8250 ;; Summary article oriented commands
8252 (defun gnus-summary-refer-parent-article (n)
8253 "Refer parent article N times.
8254 If N is negative, go to ancestor -N instead.
8255 The difference between N and the number of articles fetched is returned."
8259 (when (not (natnump n
))
8264 (setq header
(gnus-summary-article-header))
8265 (if (and (eq (mail-header-number header
)
8266 (cdr gnus-article-current
))
8267 (equal gnus-newsgroup-name
8268 (car gnus-article-current
)))
8269 ;; If we try to find the parent of the currently
8270 ;; displayed article, then we take a look at the actual
8271 ;; References header, since this is slightly more
8272 ;; reliable than the References field we got from the
8275 (set-buffer gnus-original-article-buffer
)
8276 (nnheader-narrow-to-headers)
8277 (unless (setq ref
(message-fetch-field "references"))
8278 (when (setq ref
(message-fetch-field "in-reply-to"))
8279 (setq ref
(gnus-extract-message-id-from-in-reply-to ref
))))
8282 ;; It's not the current article, so we take a bet on
8283 ;; the value we got from the server.
8284 (mail-header-references header
)))
8286 (not (equal ref
"")))
8287 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
8288 (gnus-message 1 "Couldn't find parent"))
8289 (gnus-message 1 "No references in article %d"
8290 (gnus-summary-article-number))
8293 (gnus-summary-position-point)
8296 (defun gnus-summary-refer-references ()
8297 "Fetch all articles mentioned in the References header.
8298 Return the number of articles fetched."
8300 (let ((ref (mail-header-references (gnus-summary-article-header)))
8301 (current (gnus-summary-article-number))
8305 (error "No References in the current article")
8306 ;; For each Message-ID in the References header...
8307 (while (string-match "<[^>]*>" ref
)
8309 ;; ... fetch that article.
8310 (gnus-summary-refer-article
8311 (prog1 (match-string 0 ref
)
8312 (setq ref
(substring ref
(match-end 0))))))
8313 (gnus-summary-goto-subject current
)
8314 (gnus-summary-position-point)
8317 (defun gnus-summary-refer-thread (&optional limit
)
8318 "Fetch all articles in the current thread.
8319 If LIMIT (the numerical prefix), fetch that many old headers instead
8320 of what's specified by the `gnus-refer-thread-limit' variable."
8322 (let ((id (mail-header-id (gnus-summary-article-header)))
8323 (limit (if limit
(prefix-numeric-value limit
)
8324 gnus-refer-thread-limit
)))
8325 (unless (eq gnus-fetch-old-headers
'invisible
)
8326 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
8327 ;; Retrieve the headers and read them in.
8328 (if (eq (if (numberp limit
)
8329 (gnus-retrieve-headers
8331 (+ (mail-header-number
8332 (gnus-summary-article-header))
8334 gnus-newsgroup-end
))
8335 gnus-newsgroup-name
(* limit
2))
8336 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8338 (gnus-retrieve-headers (list gnus-newsgroup-end
)
8339 gnus-newsgroup-name limit
))
8341 (gnus-build-all-threads)
8342 (error "Can't fetch thread from back ends that don't support NOV"))
8343 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
8344 (gnus-summary-limit-include-thread id
)))
8346 (defun gnus-summary-refer-article (message-id)
8347 "Fetch an article specified by MESSAGE-ID."
8348 (interactive "sMessage-ID: ")
8349 (when (and (stringp message-id
)
8350 (not (zerop (length message-id
))))
8351 (setq message-id
(gnus-replace-in-string message-id
" " ""))
8352 ;; Construct the correct Message-ID if necessary.
8353 ;; Suggested by tale@pawl.rpi.edu.
8354 (unless (string-match "^<" message-id
)
8355 (setq message-id
(concat "<" message-id
)))
8356 (unless (string-match ">$" message-id
)
8357 (setq message-id
(concat message-id
">")))
8358 ;; People often post MIDs from URLs, so unhex it:
8359 (unless (string-match "@" message-id
)
8360 (setq message-id
(gnus-url-unhex-string message-id
)))
8361 (let* ((header (gnus-id-to-header message-id
))
8363 (gnus-summary-article-sparse-p
8364 (mail-header-number header
))
8365 (memq (mail-header-number header
)
8366 gnus-newsgroup-limit
)))
8369 ;; If the article is present in the buffer we just go to it.
8371 (or (not (gnus-summary-article-sparse-p
8372 (mail-header-number header
)))
8375 (gnus-summary-goto-article
8376 (mail-header-number header
) nil t
)
8378 (gnus-summary-update-article (mail-header-number header
)))))
8380 ;; We fetch the article.
8382 (dolist (gnus-override-method (gnus-refer-article-methods))
8383 (when (and (gnus-check-server gnus-override-method
)
8384 ;; Fetch the header,
8385 (setq number
(gnus-summary-insert-subject message-id
)))
8386 ;; and display the article.
8387 (gnus-summary-select-article nil nil nil number
)
8389 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
8391 (defun gnus-refer-article-methods ()
8392 "Return a list of referable methods."
8394 ;; No method, so we default to current and native.
8395 ((null gnus-refer-article-method
)
8396 (list gnus-current-select-method gnus-select-method
))
8398 ((eq 'current gnus-refer-article-method
)
8399 (list gnus-current-select-method
))
8400 ;; List of select methods.
8401 ((not (and (symbolp (car gnus-refer-article-method
))
8402 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
8404 (dolist (method gnus-refer-article-method
)
8405 (push (if (eq 'current method
)
8406 gnus-current-select-method
8410 ;; One single select method.
8412 (list gnus-refer-article-method
))))
8414 (defun gnus-summary-edit-parameters ()
8415 "Edit the group parameters of the current group."
8417 (gnus-group-edit-group gnus-newsgroup-name
'params
))
8419 (defun gnus-summary-customize-parameters ()
8420 "Customize the group parameters of the current group."
8422 (gnus-group-customize gnus-newsgroup-name
))
8424 (defun gnus-summary-enter-digest-group (&optional force
)
8425 "Enter an nndoc group based on the current article.
8426 If FORCE, force a digest interpretation. If not, try
8427 to guess what the document format is."
8429 (let ((conf gnus-current-window-configuration
))
8430 (save-window-excursion
8432 (let (gnus-article-prepare-hook
8433 gnus-display-mime-function
8435 (gnus-summary-select-article))))
8436 (setq gnus-current-window-configuration conf
)
8437 (let* ((name (format "%s-%d"
8438 (gnus-group-prefixed-name
8439 gnus-newsgroup-name
(list 'nndoc
""))
8441 (set-buffer gnus-summary-buffer
)
8442 gnus-current-article
)))
8443 (ogroup gnus-newsgroup-name
)
8444 (params (append (gnus-info-params (gnus-get-info ogroup
))
8445 (list (cons 'to-group ogroup
))
8446 (list (cons 'parent-group ogroup
))
8447 (list (cons 'save-article-group ogroup
))))
8448 (case-fold-search t
)
8449 (buf (current-buffer))
8452 (set-buffer gnus-original-article-buffer
)
8453 ;; Have the digest group inherit the main mail address of
8454 ;; the parent article.
8455 (when (setq to-address
(or (gnus-fetch-field "reply-to")
8456 (gnus-fetch-field "from")))
8459 (list (cons 'to-address
8460 (funcall gnus-decode-encoded-address-function
8462 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
8463 (insert-buffer-substring gnus-original-article-buffer
)
8464 ;; Remove lines that may lead nndoc to misinterpret the
8467 (goto-char (point-min))
8468 (or (search-forward "\n\n" nil t
) (point)))
8469 (goto-char (point-min))
8470 (delete-matching-lines "^Path:\\|^From ")
8473 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
8474 (gnus-newsgroup-ephemeral-ignored-charsets
8475 gnus-newsgroup-ignored-charsets
))
8476 (gnus-group-read-ephemeral-group
8477 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
8479 ,(if force
'mbox
'guess
)))
8481 `((adapt-file .
,(gnus-score-file-name gnus-newsgroup-name
8483 ;; Make all postings to this group go to the parent group.
8484 (nconc (gnus-info-params (gnus-get-info name
))
8486 ;; Couldn't select this doc group.
8487 (switch-to-buffer buf
)
8488 (gnus-set-global-variables)
8489 (gnus-configure-windows 'summary
)
8490 (gnus-message 3 "Article couldn't be entered?"))
8491 (kill-buffer dig
)))))
8493 (defun gnus-summary-read-document (n)
8494 "Open a new group based on the current article(s).
8495 This will allow you to read digests and other similar
8496 documents as newsgroups.
8497 Obeys the standard process/prefix convention."
8499 (let* ((articles (gnus-summary-work-articles n
))
8500 (ogroup gnus-newsgroup-name
)
8501 (params (append (gnus-info-params (gnus-get-info ogroup
))
8502 (list (cons 'to-group ogroup
))))
8503 article group egroup groups vgroup
)
8504 (while (setq article
(pop articles
))
8505 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
8506 (gnus-summary-remove-process-mark article
)
8507 (when (gnus-summary-display-article article
)
8510 (insert-buffer-substring gnus-original-article-buffer
)
8511 ;; Remove some headers that may lead nndoc to make
8513 (message-narrow-to-head)
8514 (goto-char (point-min))
8515 (delete-matching-lines "^\\(Path\\):\\|^From ")
8518 (gnus-group-read-ephemeral-group
8519 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
8520 (nndoc-article-type guess
))
8523 ;; Make all postings to this group go to the parent group.
8524 (nconc (gnus-info-params (gnus-get-info egroup
))
8526 (push egroup groups
))
8527 ;; Couldn't select this doc group.
8528 (gnus-error 3 "Article couldn't be entered"))))))
8529 ;; Now we have selected all the documents.
8532 (error "None of the articles could be interpreted as documents"))
8533 ((gnus-group-read-ephemeral-group
8534 (setq vgroup
(format
8535 "nnvirtual:%s-%s" gnus-newsgroup-name
8536 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8537 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
8539 (cons (current-buffer) 'summary
)))
8541 (error "Couldn't select virtual nndoc group")))))
8543 (defun gnus-summary-isearch-article (&optional regexp-p
)
8544 "Do incremental search forward on the current article.
8545 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8547 (gnus-summary-select-article)
8548 (gnus-configure-windows 'article
)
8549 (gnus-eval-in-buffer-window gnus-article-buffer
8552 (isearch-forward regexp-p
))))
8554 (defun gnus-summary-search-article-forward (regexp &optional backward
)
8555 "Search for an article containing REGEXP forward.
8556 If BACKWARD, search backward instead."
8559 (format "Search article %s (regexp%s): "
8560 (if current-prefix-arg
"backward" "forward")
8561 (if gnus-last-search-regexp
8562 (concat ", default " gnus-last-search-regexp
)
8564 current-prefix-arg
))
8565 (if (string-equal regexp
"")
8566 (setq regexp
(or gnus-last-search-regexp
""))
8567 (setq gnus-last-search-regexp regexp
)
8568 (setq gnus-article-before-search gnus-current-article
))
8569 ;; Intentionally set gnus-last-article.
8570 (setq gnus-last-article gnus-article-before-search
)
8571 (let ((gnus-last-article gnus-last-article
))
8572 (if (gnus-summary-search-article regexp backward
)
8573 (gnus-summary-show-thread)
8574 (signal 'search-failed
(list regexp
)))))
8576 (defun gnus-summary-search-article-backward (regexp)
8577 "Search for an article containing REGEXP backward."
8580 (format "Search article backward (regexp%s): "
8581 (if gnus-last-search-regexp
8582 (concat ", default " gnus-last-search-regexp
)
8584 (gnus-summary-search-article-forward regexp
'backward
))
8586 (defun gnus-summary-search-article (regexp &optional backward
)
8587 "Search for an article containing REGEXP.
8588 Optional argument BACKWARD means do search for backward.
8589 `gnus-select-article-hook' is not called during the search."
8590 ;; We have to require this here to make sure that the following
8591 ;; dynamic binding isn't shadowed by autoloading.
8592 (require 'gnus-async
)
8594 (let ((gnus-select-article-hook nil
) ;Disable hook.
8595 (gnus-article-prepare-hook nil
)
8596 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
8597 (gnus-use-article-prefetch nil
)
8598 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
8599 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
8601 (gnus-keep-backlog nil
)
8602 (gnus-break-pages nil
)
8603 (gnus-summary-display-arrow nil
)
8604 (gnus-updated-mode-lines nil
)
8605 (gnus-auto-center-summary nil
)
8606 (sum (current-buffer))
8607 (gnus-display-mime-function nil
)
8610 (gnus-save-hidden-threads
8611 (gnus-summary-select-article)
8612 (set-buffer gnus-article-buffer
)
8613 (goto-char (window-point (get-buffer-window (current-buffer))))
8617 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
8619 (re-search-backward regexp nil t
)
8620 (re-search-forward regexp nil t
))
8621 ;; We found the regexp.
8626 (get-buffer-window (current-buffer))
8630 (get-buffer-window (current-buffer))
8633 (setq point
(point)))
8634 ;; We didn't find it, so we go to the next article.
8637 (while (eq found
'not
)
8638 (if (not (if backward
(gnus-summary-find-prev)
8639 (gnus-summary-find-next)))
8640 ;; No more articles.
8642 ;; Select the next article and adjust point.
8643 (unless (gnus-summary-article-sparse-p
8644 (gnus-summary-article-number))
8646 (gnus-summary-select-article)
8647 (set-buffer gnus-article-buffer
)
8649 (goto-char (if backward
(point-max) (point-min))))))))
8650 (gnus-message 7 ""))
8651 ;; Return whether we found the regexp.
8652 (when (eq found
'found
)
8654 (gnus-summary-show-thread)
8655 (gnus-summary-goto-subject gnus-current-article
)
8656 (gnus-summary-position-point)
8659 (defun gnus-find-matching-articles (header regexp
)
8660 "Return a list of all articles that match REGEXP on HEADER.
8661 This search includes all articles in the current group that Gnus has
8662 fetched headers for, whether they are displayed or not."
8663 (let ((articles nil
)
8664 (func `(lambda (h) (,(intern (concat "mail-header-" header
)) h
)))
8665 (case-fold-search t
))
8666 (dolist (header gnus-newsgroup-headers
)
8667 (when (string-match regexp
(funcall func header
))
8668 (push (mail-header-number header
) articles
)))
8669 (nreverse articles
)))
8671 (defun gnus-summary-find-matching (header regexp
&optional backward unread
8672 not-case-fold not-matching
)
8673 "Return a list of all articles that match REGEXP on HEADER.
8674 The search stars on the current article and goes forwards unless
8675 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8676 If UNREAD is non-nil, only unread articles will
8677 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8678 in the comparisons. If NOT-MATCHING, return a list of all articles that
8679 not match REGEXP on HEADER."
8680 (let ((case-fold-search (not not-case-fold
))
8683 (if (eq (car header
) 'extra
)
8686 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
8688 (error "%s is an invalid header" header
))
8689 (unless (fboundp (intern (concat "mail-header-" header
)))
8690 (error "%s is not a valid header" header
))
8691 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
8692 (dolist (d (if (eq backward
'all
)
8694 (gnus-data-find-list
8695 (gnus-summary-article-number)
8696 (gnus-data-list backward
))))
8697 (when (and (or (not unread
) ; We want all articles...
8698 (gnus-data-unread-p d
)) ; Or just unreads.
8699 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
8703 (funcall func
(gnus-data-header d
))))
8704 (string-match regexp
8705 (funcall func
(gnus-data-header d
)))))
8706 (push (gnus-data-number d
) articles
))) ; Success!
8707 (nreverse articles
)))
8709 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
8710 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8711 If HEADER is an empty string (or nil), the match is done on the entire
8712 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8714 (list (let ((completion-ignore-case t
))
8717 (mapcar (lambda (header) (list (format "%s" header
)))
8719 '("Number" "Subject" "From" "Lines" "Date"
8720 "Message-ID" "Xref" "References" "Body")
8721 gnus-extra-headers
))
8722 nil
'require-match
))
8723 (read-string "Regexp: ")
8724 (read-key-sequence "Command: ")
8725 current-prefix-arg
))
8726 (when (equal header
"Body")
8728 ;; Hidden thread subtrees must be searched as well.
8729 (gnus-summary-show-all-threads)
8730 ;; We don't want to change current point nor window configuration.
8732 (save-window-excursion
8734 gnus-treat-strip-trailing-blank-lines
8735 gnus-treat-strip-leading-blank-lines
8736 gnus-treat-strip-multiple-blank-lines
8737 gnus-treat-hide-boring-headers
8738 gnus-treat-fold-newsgroups
8739 gnus-article-prepare-hook
)
8740 (gnus-message 6 "Executing %s..." (key-description command
))
8741 ;; We'd like to execute COMMAND interactively so as to give arguments.
8742 (gnus-execute header regexp
8743 `(call-interactively ',(key-binding command
))
8745 (gnus-message 6 "Executing %s...done" (key-description command
))))))
8747 (defun gnus-summary-beginning-of-article ()
8748 "Scroll the article back to the beginning."
8750 (gnus-summary-select-article)
8751 (gnus-configure-windows 'article
)
8752 (gnus-eval-in-buffer-window gnus-article-buffer
8754 (goto-char (point-min))
8755 (when gnus-break-pages
8756 (gnus-narrow-to-page))))
8758 (defun gnus-summary-end-of-article ()
8759 "Scroll to the end of the article."
8761 (gnus-summary-select-article)
8762 (gnus-configure-windows 'article
)
8763 (gnus-eval-in-buffer-window gnus-article-buffer
8765 (goto-char (point-max))
8767 (when gnus-break-pages
8768 (when (re-search-backward page-delimiter nil t
)
8769 (narrow-to-region (match-end 0) (point-max)))
8770 (gnus-narrow-to-page))))
8772 (defun gnus-summary-print-truncate-and-quote (string &optional len
)
8773 "Truncate to LEN and quote all \"(\"'s in STRING."
8774 (gnus-replace-in-string (if (and len
(> (length string
) len
))
8775 (substring string
0 len
)
8779 (defun gnus-summary-print-article (&optional filename n
)
8780 "Generate and print a PostScript image of the process-marked (mail) articles.
8782 If used interactively, print the current article if none are
8783 process-marked. With prefix arg, prompt the user for the name of the
8786 When used from Lisp, accept two optional args FILENAME and N. N means
8787 to print the next N articles. If N is negative, print the N previous
8788 articles. If N is nil and articles have been marked with the process
8789 mark, print these instead.
8791 If the optional first argument FILENAME is nil, send the image to the
8792 printer. If FILENAME is a string, save the PostScript image in a file with
8793 that name. If FILENAME is a number, prompt the user for the name of the file
8795 (interactive (list (ps-print-preprint current-prefix-arg
)))
8796 (dolist (article (gnus-summary-work-articles n
))
8797 (gnus-summary-select-article nil nil
'pseudo article
)
8798 (gnus-eval-in-buffer-window gnus-article-buffer
8799 (gnus-print-buffer))
8800 (gnus-summary-remove-process-mark article
))
8801 (ps-despool filename
))
8803 (defun gnus-print-buffer ()
8804 (let ((buffer (generate-new-buffer " *print*")))
8807 (copy-to-buffer buffer
(point-min) (point-max))
8809 (gnus-remove-text-with-property 'gnus-decoration
)
8810 (when (gnus-visual-p 'article-highlight
'highlight
)
8811 ;; Copy-to-buffer doesn't copy overlay. So redo
8813 (let ((gnus-article-buffer buffer
))
8814 (gnus-article-highlight-citation t
)
8815 (gnus-article-highlight-signature)
8816 (gnus-article-emphasize)
8817 (gnus-article-delete-invisible-text)))
8818 (let ((ps-left-header
8821 (gnus-summary-print-truncate-and-quote
8822 (mail-header-subject gnus-current-headers
)
8825 (gnus-summary-print-truncate-and-quote
8826 (mail-header-from gnus-current-headers
)
8830 "/pagenumberstring load"
8832 (mail-header-date gnus-current-headers
) ")"))))
8833 (gnus-run-hooks 'gnus-ps-print-hook
)
8836 (ps-spool-buffer-with-faces)
8837 (ps-spool-buffer)))))
8838 (kill-buffer buffer
))))
8840 (defun gnus-summary-show-article (&optional arg
)
8841 "Force redisplaying of the current article.
8842 If ARG (the prefix) is a number, show the article with the charset
8843 defined in `gnus-summary-show-article-charset-alist', or the charset
8845 If ARG (the prefix) is non-nil and not a number, show the raw article
8846 without any article massaging functions being run. Normally, the key
8847 strokes are `C-u g'."
8851 (gnus-summary-show-article t
)
8852 (let ((gnus-newsgroup-charset
8853 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
8854 (mm-read-coding-system
8855 "View as charset: " ;; actually it is coding system.
8857 (set-buffer gnus-article-buffer
)
8858 (mm-detect-coding-region (point) (point-max))))))
8859 (gnus-newsgroup-ignored-charsets 'gnus-all
))
8860 (gnus-summary-select-article nil
'force
)
8861 (let ((deps gnus-newsgroup-dependencies
)
8864 (set-buffer gnus-original-article-buffer
)
8866 (message-narrow-to-head)
8867 (setq head
(buffer-string))
8868 (goto-char (point-min))
8869 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t
)
8870 (goto-char (point-max))
8872 (setq lines
(1- (count-lines (point) (point-max))))))
8874 (insert (format "211 %d Article retrieved.\n"
8875 (cdr gnus-article-current
)))
8877 (if lines
(insert (format "Lines: %d\n" lines
)))
8879 (let ((nntp-server-buffer (current-buffer)))
8880 (setq header
(car (gnus-get-newsgroup-headers deps t
))))))
8881 (gnus-data-set-header
8882 (gnus-data-find (cdr gnus-article-current
))
8884 (gnus-summary-update-article-line
8885 (cdr gnus-article-current
) header
)
8886 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
8887 (gnus-summary-update-secondary-mark (cdr gnus-article-current
))))))
8889 ;; Select the article the normal way.
8890 (gnus-summary-select-article nil
'force
))
8892 ;; We have to require this here to make sure that the following
8893 ;; dynamic binding isn't shadowed by autoloading.
8894 (require 'gnus-async
)
8896 ;; Bind the article treatment functions to nil.
8897 (let ((gnus-have-all-headers t
)
8898 gnus-article-prepare-hook
8899 gnus-article-decode-hook
8900 gnus-display-mime-function
8902 ;; Destroy any MIME parts.
8903 (when (gnus-buffer-live-p gnus-article-buffer
)
8905 (set-buffer gnus-article-buffer
)
8906 (mm-destroy-parts gnus-article-mime-handles
)
8907 ;; Set it to nil for safety reason.
8908 (setq gnus-article-mime-handle-alist nil
)
8909 (setq gnus-article-mime-handles nil
)))
8910 (gnus-summary-select-article nil
'force
))))
8911 (gnus-summary-goto-subject gnus-current-article
)
8912 (gnus-summary-position-point))
8914 (defun gnus-summary-show-raw-article ()
8915 "Show the raw article without any article massaging functions being run."
8917 (gnus-summary-show-article t
))
8919 (defun gnus-summary-verbose-headers (&optional arg
)
8920 "Toggle permanent full header display.
8921 If ARG is a positive number, turn header display on.
8922 If ARG is a negative number, turn header display off."
8924 (setq gnus-show-all-headers
8925 (cond ((or (not (numberp arg
))
8927 (not gnus-show-all-headers
))
8930 (gnus-summary-show-article))
8932 (defun gnus-summary-toggle-header (&optional arg
)
8933 "Show the headers if they are hidden, or hide them if they are shown.
8934 If ARG is a positive number, show the entire header.
8935 If ARG is a negative number, hide the unwanted header lines."
8937 (let ((window (and (gnus-buffer-live-p gnus-article-buffer
)
8938 (get-buffer-window gnus-article-buffer t
))))
8939 (with-current-buffer gnus-article-buffer
8941 (article-narrow-to-head)
8942 (let* ((buffer-read-only nil
)
8943 (inhibit-point-motion-hooks t
)
8944 (hidden (if (numberp arg
)
8946 (or (not (looking-at "[^ \t\n]+:"))
8947 (gnus-article-hidden-text-p 'headers
))))
8949 (delete-region (point-min) (point-max))
8950 (with-current-buffer gnus-original-article-buffer
8951 (goto-char (setq s
(point-min)))
8952 (setq e
(if (search-forward "\n\n" nil t
)
8955 (insert-buffer-substring gnus-original-article-buffer s e
)
8956 (run-hooks 'gnus-article-decode-hook
)
8958 (let ((gnus-treat-hide-headers nil
)
8959 (gnus-treat-hide-boring-headers nil
))
8960 (gnus-delete-wash-type 'headers
)
8961 (gnus-treat-article 'head
))
8962 (gnus-treat-article 'head
))
8965 (set-window-start window
(goto-char (point-min))))
8966 (if gnus-break-pages
8967 (gnus-narrow-to-page)
8968 (when (gnus-visual-p 'page-marker
)
8969 (let ((buffer-read-only nil
))
8970 (gnus-remove-text-with-property 'gnus-prev
)
8971 (gnus-remove-text-with-property 'gnus-next
))))
8972 (gnus-set-mode-line 'article
)))))
8974 (defun gnus-summary-show-all-headers ()
8975 "Make all header lines visible."
8977 (gnus-summary-toggle-header 1))
8979 (defun gnus-summary-caesar-message (&optional arg
)
8980 "Caesar rotate the current article by 13.
8981 The numerical prefix specifies how many places to rotate each letter
8984 (gnus-summary-select-article)
8985 (let ((mail-header-separator ""))
8986 (gnus-eval-in-buffer-window gnus-article-buffer
8989 (let ((start (window-start))
8991 (message-caesar-buffer-body arg
)
8992 (set-window-start (get-buffer-window (current-buffer)) start
)))))
8993 ;; Create buttons and stuff...
8994 (gnus-treat-article nil
))
8996 (autoload 'unmorse-region
"morse"
8997 "Convert morse coded text in region to ordinary ASCII text."
9000 (defun gnus-summary-morse-message (&optional arg
)
9001 "Morse decode the current article."
9003 (gnus-summary-select-article)
9004 (let ((mail-header-separator ""))
9005 (gnus-eval-in-buffer-window gnus-article-buffer
9009 (let ((pos (window-start))
9011 (goto-char (point-min))
9012 (when (message-goto-body)
9013 (gnus-narrow-to-body))
9014 (goto-char (point-min))
9015 (while (re-search-forward "·" (point-max) t
)
9016 (replace-match "."))
9017 (unmorse-region (point-min) (point-max))
9019 (set-window-start (get-buffer-window (current-buffer)) pos
)))))))
9021 (defun gnus-summary-stop-page-breaking ()
9022 "Stop page breaking in the current article."
9024 (gnus-summary-select-article)
9025 (gnus-eval-in-buffer-window gnus-article-buffer
9027 (when (gnus-visual-p 'page-marker
)
9028 (let ((buffer-read-only nil
))
9029 (gnus-remove-text-with-property 'gnus-prev
)
9030 (gnus-remove-text-with-property 'gnus-next
))
9031 (setq gnus-page-broken nil
))))
9033 (defun gnus-summary-move-article (&optional n to-newsgroup
9034 select-method action
)
9035 "Move the current article to a different newsgroup.
9036 If N is a positive number, move the N next articles.
9037 If N is a negative number, move the N previous articles.
9038 If N is nil and any articles have been marked with the process mark,
9039 move those articles instead.
9040 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9041 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9042 re-spool using this method.
9044 When called interactively with TO-NEWSGROUP being nil, the value of
9045 the variable `gnus-move-split-methods' is used for finding a default
9046 for the target newsgroup.
9048 For this function to work, both the current newsgroup and the
9049 newsgroup that you want to move to have to support the `request-move'
9050 and `request-accept' functions.
9052 ACTION can be either `move' (the default), `crosspost' or `copy'."
9055 (setq action
'move
))
9056 ;; Check whether the source group supports the required functions.
9057 (cond ((and (eq action
'move
)
9058 (not (gnus-check-backend-function
9059 'request-move-article gnus-newsgroup-name
)))
9060 (error "The current group does not support article moving"))
9061 ((and (eq action
'crosspost
)
9062 (not (gnus-check-backend-function
9063 'request-replace-article gnus-newsgroup-name
)))
9064 (error "The current group does not support article editing")))
9065 (let ((articles (gnus-summary-work-articles n
))
9066 (prefix (if (gnus-check-backend-function
9067 'request-move-article gnus-newsgroup-name
)
9068 (gnus-group-real-prefix gnus-newsgroup-name
)
9070 (names '((move "Move" "Moving")
9071 (copy "Copy" "Copying")
9072 (crosspost "Crosspost" "Crossposting")))
9073 (copy-buf (save-excursion
9074 (nnheader-set-temp-buffer " *copy article*")))
9075 art-group to-method new-xref article to-groups
)
9076 (unless (assq action names
)
9077 (error "Unknown action %s" action
))
9078 ;; Read the newsgroup name.
9079 (when (and (not to-newsgroup
)
9080 (not select-method
))
9081 (if (and gnus-move-split-methods
9083 (and (memq gnus-current-article articles
)
9084 (gnus-buffer-live-p gnus-original-article-buffer
))))
9085 ;; When `gnus-move-split-methods' is non-nil, we have to
9086 ;; select an article to give `gnus-read-move-group-name' an
9087 ;; opportunity to suggest an appropriate default. However,
9088 ;; we needn't render or mark the article.
9089 (let ((gnus-display-mime-function nil
)
9090 (gnus-article-prepare-hook nil
)
9091 (gnus-mark-article-hook nil
))
9092 (gnus-summary-select-article nil nil nil
(car articles
))))
9094 (gnus-read-move-group-name
9095 (cadr (assq action names
))
9096 (symbol-value (intern (format "gnus-current-%s-group" action
)))
9098 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
9099 (setq to-method
(or select-method
9100 (gnus-server-to-method
9101 (gnus-group-method to-newsgroup
))))
9102 ;; Check the method we are to move this article to...
9103 (unless (gnus-check-backend-function
9104 'request-accept-article
(car to-method
))
9105 (error "%s does not support article copying" (car to-method
)))
9106 (unless (gnus-check-server to-method
)
9107 (error "Can't open server %s" (car to-method
)))
9108 (gnus-message 6 "%s to %s: %s..."
9109 (caddr (assq action names
))
9110 (or (car select-method
) to-newsgroup
) articles
)
9112 (setq article
(pop articles
))
9116 ;; Move the article.
9118 ;; Remove this article from future suppression.
9119 (gnus-dup-unsuppress-article article
)
9120 (gnus-request-move-article
9121 article
; Article to move
9122 gnus-newsgroup-name
; From newsgroup
9123 (nth 1 (gnus-find-method-for-group
9124 gnus-newsgroup-name
)) ; Server
9125 (list 'gnus-request-accept-article
9126 to-newsgroup
(list 'quote select-method
)
9127 (not articles
) t
) ; Accept form
9128 (not articles
))) ; Only save nov last time
9129 ;; Copy the article.
9132 (set-buffer copy-buf
)
9133 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9134 (gnus-request-accept-article
9135 to-newsgroup select-method
(not articles
) t
))))
9136 ;; Crosspost the article.
9137 ((eq action
'crosspost
)
9138 (let ((xref (message-tokenize-header
9139 (mail-header-xref (gnus-summary-article-header article
))
9141 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
9142 ":" (number-to-string article
)))
9144 (setq xref
(list (system-name))))
9147 (mapconcat 'identity
9148 (delete "Xref:" (delete new-xref xref
))
9152 (set-buffer copy-buf
)
9153 ;; First put the article in the destination group.
9154 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9155 (when (consp (setq art-group
9156 (gnus-request-accept-article
9157 to-newsgroup select-method
(not articles
) t
)))
9158 (setq new-xref
(concat new-xref
" " (car art-group
)
9160 (number-to-string (cdr art-group
))))
9161 ;; Now we have the new Xrefs header, so we insert
9162 ;; it and replace the new article.
9163 (nnheader-replace-header "Xref" new-xref
)
9164 (gnus-request-replace-article
9165 (cdr art-group
) to-newsgroup
(current-buffer) t
)
9169 (gnus-message 1 "Couldn't %s article %s: %s"
9170 (cadr (assq action names
)) article
9171 (nnheader-get-report (car to-method
))))
9172 ((eq art-group
'junk
)
9173 (when (eq action
'move
)
9174 (gnus-summary-mark-article article gnus-canceled-mark
)
9175 (gnus-message 4 "Deleted article %s" article
)
9176 ;; run the delete hook
9177 (run-hook-with-args 'gnus-summary-article-delete-hook
9180 (assoc article
(gnus-data-list nil
)))
9181 gnus-newsgroup-name nil
9184 (let* ((pto-group (gnus-group-prefixed-name
9185 (car art-group
) to-method
))
9187 (gnus-gethash pto-group gnus-newsrc-hashtb
))
9188 (info (nth 2 entry
))
9189 (to-group (gnus-info-group info
))
9191 ;; Update the group that has been moved to.
9193 (memq action
'(move copy
)))
9194 (unless (member to-group to-groups
)
9195 (push to-group to-groups
))
9197 (unless (memq article gnus-newsgroup-unreads
)
9198 (push 'read to-marks
)
9200 info
(gnus-add-to-range (gnus-info-read info
)
9201 (list (cdr art-group
)))))
9203 ;; See whether the article is to be put in the cache.
9204 (let ((marks (if (gnus-group-auto-expirable-p to-group
)
9205 gnus-article-mark-lists
9206 (delete '(expirable . expire
)
9207 (copy-sequence gnus-article-mark-lists
))))
9208 (to-article (cdr art-group
)))
9210 ;; Enter the article into the cache in the new group,
9211 ;; if that is required.
9212 (when gnus-use-cache
9213 (gnus-cache-possibly-enter-article
9215 (memq article gnus-newsgroup-marked
)
9216 (memq article gnus-newsgroup-dormant
)
9217 (memq article gnus-newsgroup-unreads
)))
9219 (when gnus-preserve-marks
9220 ;; Copy any marks over to the new group.
9221 (when (and (equal to-group gnus-newsgroup-name
)
9222 (not (memq article gnus-newsgroup-unreads
)))
9223 ;; Mark this article as read in this group.
9224 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
9225 (setcdr (gnus-active to-group
) to-article
)
9226 (setcdr gnus-newsgroup-active to-article
))
9229 (when (eq (gnus-article-mark-to-type (cdar marks
)) 'list
)
9230 (when (memq article
(symbol-value
9231 (intern (format "gnus-newsgroup-%s"
9233 (push (cdar marks
) to-marks
)
9234 ;; If the other group is the same as this group,
9235 ;; then we have to add the mark to the list.
9236 (when (equal to-group gnus-newsgroup-name
)
9237 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
9240 (intern (format "gnus-newsgroup-%s"
9242 ;; Copy the marks to other group.
9243 (gnus-add-marked-articles
9244 to-group
(cdar marks
) (list to-article
) info
)))
9245 (setq marks
(cdr marks
)))
9247 (gnus-request-set-mark
9248 to-group
(list (list (list to-article
) 'add to-marks
))))
9251 (concat "(gnus-group-set-info '"
9252 (gnus-prin1-to-string (gnus-get-info to-group
))
9255 ;; Update the Xref header in this article to point to
9256 ;; the new crossposted article we have just created.
9257 (when (eq action
'crosspost
)
9259 (set-buffer copy-buf
)
9260 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9261 (nnheader-replace-header "Xref" new-xref
)
9262 (gnus-request-replace-article
9263 article gnus-newsgroup-name
(current-buffer) t
)))
9265 ;; run the move/copy/crosspost/respool hook
9266 (run-hook-with-args 'gnus-summary-article-move-hook
9269 (assoc article
(gnus-data-list nil
)))
9274 ;;;!!!Why is this necessary?
9275 (set-buffer gnus-summary-buffer
)
9277 (gnus-summary-goto-subject article
)
9278 (when (eq action
'move
)
9279 (gnus-summary-mark-article article gnus-canceled-mark
))))
9280 (gnus-summary-remove-process-mark article
))
9281 ;; Re-activate all groups that have been moved to.
9283 (set-buffer gnus-group-buffer
)
9284 (let ((gnus-group-marked to-groups
))
9285 (gnus-group-get-new-news-this-group nil t
)))
9287 (gnus-kill-buffer copy-buf
)
9288 (gnus-summary-position-point)
9289 (gnus-set-mode-line 'summary
)))
9291 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
9292 "Copy the current article to some other group.
9293 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9294 When called interactively, if TO-NEWSGROUP is nil, use the value of
9295 the variable `gnus-move-split-methods' for finding a default target
9297 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9298 re-spool using this method."
9300 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
9302 (defun gnus-summary-crosspost-article (&optional n
)
9303 "Crosspost the current article to some other group."
9305 (gnus-summary-move-article n nil nil
'crosspost
))
9307 (defcustom gnus-summary-respool-default-method nil
9308 "Default method type for respooling an article.
9309 If nil, use to the current newsgroup method."
9311 :group
'gnus-summary-mail
)
9313 (defcustom gnus-summary-display-while-building nil
9314 "If non-nil, show and update the summary buffer as it's being built.
9315 If the value is t, update the buffer after every line is inserted. If
9316 the value is an integer (N), update the display every N lines."
9319 :type
'(choice (const :tag
"off" nil
)
9321 (const :tag
"frequently" t
)))
9323 (defun gnus-summary-respool-article (&optional n method
)
9324 "Respool the current article.
9325 The article will be squeezed through the mail spooling process again,
9326 which means that it will be put in some mail newsgroup or other
9327 depending on `nnmail-split-methods'.
9328 If N is a positive number, respool the N next articles.
9329 If N is a negative number, respool the N previous articles.
9330 If N is nil and any articles have been marked with the process mark,
9331 respool those articles instead.
9333 Respooling can be done both from mail groups and \"real\" newsgroups.
9334 In the former case, the articles in question will be moved from the
9335 current group into whatever groups they are destined to. In the
9336 latter case, they will be copied into the relevant groups."
9338 (list current-prefix-arg
9339 (let* ((methods (gnus-methods-using 'respool
))
9341 (symbol-name (or gnus-summary-respool-default-method
9342 (car (gnus-find-method-for-group
9343 gnus-newsgroup-name
)))))
9345 (gnus-completing-read-with-default
9346 methname
"Backend to use when respooling"
9347 methods nil t nil
'gnus-mail-method-history
))
9350 ((zerop (length (setq ms
(gnus-servers-using-backend
9352 (list (intern method
) ""))
9356 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
9357 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
9360 (error "No method given for respooling"))
9361 (if (assoc (symbol-name
9362 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
9363 (gnus-methods-using 'respool
))
9364 (gnus-summary-move-article n nil method
)
9365 (gnus-summary-copy-article n nil method
)))
9367 (defun gnus-summary-import-article (file &optional edit
)
9368 "Import an arbitrary file into a mail newsgroup."
9369 (interactive "fImport file: \nP")
9370 (let ((group gnus-newsgroup-name
)
9371 (now (current-time))
9372 atts lines group-art
)
9373 (unless (gnus-check-backend-function 'request-accept-article group
)
9374 (error "%s does not support article importing" group
))
9375 (or (file-readable-p file
)
9376 (not (file-regular-p file
))
9377 (error "Can't read %s" file
))
9379 (set-buffer (gnus-get-buffer-create " *import file*"))
9381 (nnheader-insert-file-contents file
)
9382 (goto-char (point-min))
9383 (if (nnheader-article-p)
9385 (goto-char (point-min))
9386 (search-forward "\n\n" nil t
)
9387 (narrow-to-region (point-min) (1- (point)))
9388 (goto-char (point-min))
9389 (unless (re-search-forward "^date:" nil t
)
9390 (goto-char (point-max))
9391 (insert "Date: " (message-make-date (nth 5 atts
)) "\n")))
9392 ;; This doesn't look like an article, so we fudge some headers.
9393 (setq atts
(file-attributes file
)
9394 lines
(count-lines (point-min) (point-max)))
9395 (insert "From: " (read-string "From: ") "\n"
9396 "Subject: " (read-string "Subject: ") "\n"
9397 "Date: " (message-make-date (nth 5 atts
)) "\n"
9398 "Message-ID: " (message-make-message-id) "\n"
9399 "Lines: " (int-to-string lines
) "\n"
9400 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9401 (setq group-art
(gnus-request-accept-article group nil t
))
9402 (kill-buffer (current-buffer)))
9403 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9405 (gnus-summary-goto-article (cdr group-art
) nil t
)
9407 (gnus-summary-edit-article))))
9409 (defun gnus-summary-create-article ()
9410 "Create an article in a mail newsgroup."
9412 (let ((group gnus-newsgroup-name
)
9413 (now (current-time))
9415 (unless (gnus-check-backend-function 'request-accept-article group
)
9416 (error "%s does not support article importing" group
))
9418 (set-buffer (gnus-get-buffer-create " *import file*"))
9420 (goto-char (point-min))
9421 ;; This doesn't look like an article, so we fudge some headers.
9422 (insert "From: " (read-string "From: ") "\n"
9423 "Subject: " (read-string "Subject: ") "\n"
9424 "Date: " (message-make-date now
) "\n"
9425 "Message-ID: " (message-make-message-id) "\n")
9426 (setq group-art
(gnus-request-accept-article group nil t
))
9427 (kill-buffer (current-buffer)))
9428 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9430 (gnus-summary-goto-article (cdr group-art
) nil t
)
9431 (gnus-summary-edit-article)))
9433 (defun gnus-summary-article-posted-p ()
9434 "Say whether the current (mail) article is available from news as well.
9435 This will be the case if the article has both been mailed and posted."
9437 (let ((id (mail-header-references (gnus-summary-article-header)))
9438 (gnus-override-method (car (gnus-refer-article-methods))))
9439 (if (gnus-request-head id
"")
9440 (gnus-message 2 "The current message was found on %s"
9441 gnus-override-method
)
9442 (gnus-message 2 "The current message couldn't be found on %s"
9443 gnus-override-method
)
9446 (defun gnus-summary-expire-articles (&optional now
)
9447 "Expire all articles that are marked as expirable in the current group."
9449 (when (and (not gnus-group-is-exiting-without-update-p
)
9450 (gnus-check-backend-function
9451 'request-expire-articles gnus-newsgroup-name
))
9452 ;; This backend supports expiry.
9453 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
9454 (expirable (if total
9456 ;; We need to update the info for
9457 ;; this group for `gnus-list-of-read-articles'
9458 ;; to give us the right answer.
9459 (gnus-run-hooks 'gnus-exit-group-hook
)
9460 (gnus-summary-update-info)
9461 (gnus-list-of-read-articles gnus-newsgroup-name
))
9462 (setq gnus-newsgroup-expirable
9463 (sort gnus-newsgroup-expirable
'<))))
9464 (expiry-wait (if now
'immediate
9465 (gnus-group-find-parameter
9466 gnus-newsgroup-name
'expiry-wait
)))
9467 (nnmail-expiry-target
9468 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
9469 nnmail-expiry-target
))
9472 ;; There are expirable articles in this group, so we run them
9473 ;; through the expiry process.
9474 (gnus-message 6 "Expiring articles...")
9475 (unless (gnus-check-group gnus-newsgroup-name
)
9476 (error "Can't open server for %s" gnus-newsgroup-name
))
9477 ;; The list of articles that weren't expired is returned.
9480 (let ((nnmail-expiry-wait-function nil
)
9481 (nnmail-expiry-wait expiry-wait
))
9482 (setq es
(gnus-request-expire-articles
9483 expirable gnus-newsgroup-name
)))
9484 (setq es
(gnus-request-expire-articles
9485 expirable gnus-newsgroup-name
)))
9487 (setq gnus-newsgroup-expirable es
))
9488 ;; We go through the old list of expirable, and mark all
9489 ;; really expired articles as nonexistent.
9490 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
9491 (let ((gnus-use-cache nil
))
9492 (dolist (article expirable
)
9493 (when (and (not (memq article es
))
9494 (gnus-data-find article
))
9495 (gnus-summary-mark-article article gnus-canceled-mark
)
9496 (run-hook-with-args 'gnus-summary-article-expire-hook
9499 (assoc article
(gnus-data-list nil
)))
9503 (gnus-message 6 "Expiring articles...done")))))
9505 (defun gnus-summary-expire-articles-now ()
9506 "Expunge all expirable articles in the current group.
9507 This means that *all* articles that are marked as expirable will be
9508 deleted forever, right now."
9510 (or gnus-expert-user
9512 "Are you really, really sure you want to delete all expirable messages? ")
9514 (gnus-summary-expire-articles t
))
9516 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9517 (defun gnus-summary-delete-article (&optional n
)
9518 "Delete the N next (mail) articles.
9519 This command actually deletes articles. This is not a marking
9520 command. The article will disappear forever from your life, never to
9523 If N is negative, delete backwards.
9524 If N is nil and articles have been marked with the process mark,
9525 delete these instead.
9527 If `gnus-novice-user' is non-nil you will be asked for
9528 confirmation before the articles are deleted."
9530 (unless (gnus-check-backend-function 'request-expire-articles
9531 gnus-newsgroup-name
)
9532 (error "The current newsgroup does not support article deletion"))
9533 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
9534 (error "Couldn't open server"))
9535 ;; Compute the list of articles to delete.
9536 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
9537 (nnmail-expiry-target 'delete
)
9539 (if (and gnus-novice-user
9540 (not (gnus-yes-or-no-p
9541 (format "Do you really want to delete %s forever? "
9542 (if (> (length articles
) 1)
9543 (format "these %s articles" (length articles
))
9546 ;; Delete the articles.
9547 (setq not-deleted
(gnus-request-expire-articles
9548 articles gnus-newsgroup-name
'force
))
9550 (gnus-summary-remove-process-mark (car articles
))
9551 ;; The backend might not have been able to delete the article
9553 (unless (memq (car articles
) not-deleted
)
9554 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
9555 (let* ((article (car articles
))
9556 (id (mail-header-id (gnus-data-header
9557 (assoc article
(gnus-data-list nil
))))))
9558 (run-hook-with-args 'gnus-summary-article-delete-hook
9559 'delete id gnus-newsgroup-name nil
9561 (setq articles
(cdr articles
)))
9563 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
9564 (gnus-summary-position-point)
9565 (gnus-set-mode-line 'summary
)
9568 (defun gnus-summary-edit-article (&optional arg
)
9569 "Edit the current article.
9570 This will have permanent effect only in mail groups.
9571 If ARG is nil, edit the decoded articles.
9572 If ARG is 1, edit the raw articles.
9573 If ARG is 2, edit the raw articles even in read-only groups.
9574 If ARG is 3, edit the articles with the current handles.
9575 Otherwise, allow editing of articles even in read-only
9578 (let (force raw current-handles
)
9587 (setq current-handles
9588 (and (gnus-buffer-live-p gnus-article-buffer
)
9589 (with-current-buffer gnus-article-buffer
9591 gnus-article-mime-handles
9592 (setq gnus-article-mime-handles nil
))))))
9595 (when (and raw
(not force
)
9596 (member gnus-newsgroup-name
'("nndraft:delayed"
9599 (error "Can't edit the raw article in group %s"
9600 gnus-newsgroup-name
))
9602 (set-buffer gnus-summary-buffer
)
9603 (let ((mail-parse-charset gnus-newsgroup-charset
)
9604 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
9605 (gnus-set-global-variables)
9606 (when (and (not force
)
9607 (gnus-group-read-only-p))
9608 (error "The current newsgroup does not support article editing"))
9609 (gnus-summary-show-article t
)
9610 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
9611 (with-current-buffer gnus-article-buffer
9612 (mm-enable-multibyte)))
9613 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
9615 (gnus-article-edit-article
9618 (let ((mbl mml-buffer-list
))
9619 (setq mml-buffer-list nil
)
9620 (let ((rfc2047-quote-decoded-words-containing-tspecials t
))
9621 (mime-to-mml ,'current-handles
))
9622 (let ((mbl1 mml-buffer-list
))
9623 (setq mml-buffer-list mbl
)
9624 (set (make-local-variable 'mml-buffer-list
) mbl1
))
9625 (gnus-make-local-hook 'kill-buffer-hook
)
9626 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
9627 `(lambda (no-highlight)
9628 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
9629 (message-options message-options
)
9630 (message-options-set-recipient)
9631 (mail-parse-ignored-charsets
9632 ',gnus-newsgroup-ignored-charsets
))
9633 ,(if (not raw
) '(progn
9635 (mml-destroy-buffers)
9636 (remove-hook 'kill-buffer-hook
9637 'mml-destroy-buffers t
)
9638 (kill-local-variable 'mml-buffer-list
)))
9639 (gnus-summary-edit-article-done
9640 ,(or (mail-header-references gnus-current-headers
) "")
9641 ,(gnus-group-read-only-p)
9642 ,gnus-summary-buffer no-highlight
))))))))
9644 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
9646 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9648 "Make edits to the current article permanent."
9651 ;; The buffer restriction contains the entire article if it exists.
9652 (when (article-goto-body)
9653 (let ((lines (count-lines (point) (point-max)))
9654 (length (- (point-max) (point)))
9655 (case-fold-search t
)
9656 (body (copy-marker (point))))
9657 (goto-char (point-min))
9658 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t
)
9659 (delete-region (match-beginning 1) (match-end 1))
9660 (insert (number-to-string length
)))
9661 (goto-char (point-min))
9662 (when (re-search-forward
9663 "^x-content-length:[ \t]\\([0-9]+\\)" body t
)
9664 (delete-region (match-beginning 1) (match-end 1))
9665 (insert (number-to-string length
)))
9666 (goto-char (point-min))
9667 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t
)
9668 (delete-region (match-beginning 1) (match-end 1))
9669 (insert (number-to-string lines
))))))
9670 ;; Replace the article.
9671 (let ((buf (current-buffer)))
9673 (insert-buffer-substring buf
)
9675 (if (and (not read-only
)
9676 (not (gnus-request-replace-article
9677 (cdr gnus-article-current
) (car gnus-article-current
)
9678 (current-buffer) t
)))
9679 (error "Couldn't replace article")
9680 ;; Update the summary buffer.
9682 (equal (message-tokenize-header references
" ")
9683 (message-tokenize-header
9684 (or (message-fetch-field "references") "") " ")))
9685 ;; We only have to update this line.
9688 (message-narrow-to-head)
9689 (let ((head (buffer-substring-no-properties
9690 (point-min) (point-max)))
9693 (insert (format "211 %d Article retrieved.\n"
9694 (cdr gnus-article-current
)))
9697 (let ((nntp-server-buffer (current-buffer)))
9698 (setq header
(car (gnus-get-newsgroup-headers
9701 (set-buffer gnus-summary-buffer
)
9702 (gnus-data-set-header
9703 (gnus-data-find (cdr gnus-article-current
))
9705 (gnus-summary-update-article-line
9706 (cdr gnus-article-current
) header
)
9707 (if (gnus-summary-goto-subject
9708 (cdr gnus-article-current
) nil t
)
9709 (gnus-summary-update-secondary-mark
9710 (cdr gnus-article-current
))))))))
9712 (set-buffer (or buffer gnus-summary-buffer
))
9713 (gnus-summary-update-article (cdr gnus-article-current
))
9714 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
9715 (gnus-summary-update-secondary-mark
9716 (cdr gnus-article-current
))))
9717 ;; Prettify the article buffer again.
9718 (unless no-highlight
9720 (set-buffer gnus-article-buffer
)
9721 ;;;!!! Fix this -- article should be rehighlighted.
9722 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9723 (set-buffer gnus-original-article-buffer
)
9724 (gnus-request-article
9725 (cdr gnus-article-current
)
9726 (car gnus-article-current
) (current-buffer))))
9727 ;; Prettify the summary buffer line.
9728 (when (gnus-visual-p 'summary-highlight
'highlight
)
9729 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
9731 (defun gnus-summary-edit-wash (key)
9732 "Perform editing command KEY in the article buffer."
9736 (message "%s" (concat (this-command-keys) "- "))
9739 (gnus-summary-edit-article)
9740 (execute-kbd-macro (concat (this-command-keys) key
))
9741 (gnus-article-edit-done))
9745 (defun gnus-summary-respool-query (&optional silent trace
)
9746 "Query where the respool algorithm would put this article."
9748 (let (gnus-mark-article-hook)
9749 (gnus-summary-select-article)
9751 (set-buffer gnus-original-article-buffer
)
9752 (let ((groups (nnmail-article-group 'identity trace
)))
9755 (message "This message would go to %s"
9756 (mapconcat 'car groups
", "))
9757 (message "This message would go to no groups"))
9760 (defun gnus-summary-respool-trace ()
9761 "Trace where the respool algorithm would put this article.
9762 Display a buffer showing all fancy splitting patterns which matched."
9764 (gnus-summary-respool-query nil t
))
9766 ;; Summary marking commands.
9768 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
9769 "Mark articles which has the same subject as read, and then select the next.
9770 If UNMARK is positive, remove any kind of mark.
9771 If UNMARK is negative, tick articles."
9774 (setq unmark
(prefix-numeric-value unmark
)))
9776 (gnus-summary-mark-same-subject
9777 (gnus-summary-article-subject) unmark
)))
9778 ;; Select next unread article. If auto-select-same mode, should
9779 ;; select the first unread article.
9780 (gnus-summary-next-article t
(and gnus-auto-select-same
9781 (gnus-summary-article-subject)))
9782 (gnus-message 7 "%d article%s marked as %s"
9783 count
(if (= count
1) " is" "s are")
9784 (if unmark
"unread" "read"))))
9786 (defun gnus-summary-kill-same-subject (&optional unmark
)
9787 "Mark articles which has the same subject as read.
9788 If UNMARK is positive, remove any kind of mark.
9789 If UNMARK is negative, tick articles."
9792 (setq unmark
(prefix-numeric-value unmark
)))
9794 (gnus-summary-mark-same-subject
9795 (gnus-summary-article-subject) unmark
)))
9796 ;; If marked as read, go to next unread subject.
9798 ;; Go to next unread subject.
9799 (gnus-summary-next-subject 1 t
))
9800 (gnus-message 7 "%d articles are marked as %s"
9801 count
(if unmark
"unread" "read"))))
9803 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
9804 "Mark articles with same SUBJECT as read, and return marked number.
9805 If optional argument UNMARK is positive, remove any kinds of marks.
9806 If optional argument UNMARK is negative, mark articles as unread instead."
9810 ((null unmark
) ; Mark as read.
9813 (gnus-summary-mark-article-as-read gnus-killed-mark
)
9814 (gnus-summary-show-thread) t
)
9815 (gnus-summary-find-subject subject
))
9816 (setq count
(1+ count
))))
9817 ((> unmark
0) ; Tick.
9820 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
9821 (gnus-summary-show-thread) t
)
9822 (gnus-summary-find-subject subject
))
9823 (setq count
(1+ count
))))
9824 (t ; Mark as unread.
9827 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
9828 (gnus-summary-show-thread) t
)
9829 (gnus-summary-find-subject subject
))
9830 (setq count
(1+ count
)))))
9831 (gnus-set-mode-line 'summary
)
9832 ;; Return the number of marked articles.
9835 (defun gnus-summary-mark-as-processable (n &optional unmark
)
9836 "Set the process mark on the next N articles.
9837 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9838 the process mark instead. The difference between N and the actual
9839 number of articles marked is returned."
9841 (if (and (null n
) (gnus-region-active-p))
9842 (gnus-uu-mark-region (region-beginning) (region-end) unmark
)
9843 (setq n
(prefix-numeric-value n
))
9844 (let ((backward (< n
0))
9849 (gnus-summary-remove-process-mark
9850 (gnus-summary-article-number))
9851 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9852 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
9855 (gnus-message 7 "No more articles"))
9856 (gnus-summary-recenter)
9857 (gnus-summary-position-point)
9860 (defun gnus-summary-unmark-as-processable (n)
9861 "Remove the process mark from the next N articles.
9862 If N is negative, unmark backward instead. The difference between N and
9863 the actual number of articles unmarked is returned."
9865 (gnus-summary-mark-as-processable n t
))
9867 (defun gnus-summary-unmark-all-processable ()
9868 "Remove the process mark from all articles."
9871 (while gnus-newsgroup-processable
9872 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
9873 (gnus-summary-position-point))
9875 (defun gnus-summary-add-mark (article type
)
9876 "Mark ARTICLE with a mark of TYPE."
9877 (let ((vtype (car (assq type gnus-article-mark-lists
)))
9880 (error "No such mark type: %s" type
)
9881 (setq var
(intern (format "gnus-newsgroup-%s" type
)))
9882 (set var
(cons article
(symbol-value var
)))
9883 (if (memq type
'(processable cached replied forwarded recent saved
))
9884 (gnus-summary-update-secondary-mark article
)
9885 ;;; !!! This is bogus. We should find out what primary
9886 ;;; !!! mark we want to set.
9887 (gnus-summary-update-mark gnus-del-mark
'unread
)))))
9889 (defun gnus-summary-mark-as-expirable (n)
9890 "Mark N articles forward as expirable.
9891 If N is negative, mark backward instead. The difference between N and
9892 the actual number of articles marked is returned."
9894 (gnus-summary-mark-forward n gnus-expirable-mark
))
9896 (defun gnus-summary-mark-as-spam (n)
9897 "Mark N articles forward as spam.
9898 If N is negative, mark backward instead. The difference between N and
9899 the actual number of articles marked is returned."
9901 (gnus-summary-mark-forward n gnus-spam-mark
))
9903 (defun gnus-summary-mark-article-as-replied (article)
9904 "Mark ARTICLE as replied to and update the summary line.
9905 ARTICLE can also be a list of articles."
9906 (interactive (list (gnus-summary-article-number)))
9907 (let ((articles (if (listp article
) article
(list article
))))
9908 (dolist (article articles
)
9909 (unless (numberp article
)
9910 (error "%s is not a number" article
))
9911 (push article gnus-newsgroup-replied
)
9912 (let ((buffer-read-only nil
))
9913 (when (gnus-summary-goto-subject article nil t
)
9914 (gnus-summary-update-secondary-mark article
))))))
9916 (defun gnus-summary-mark-article-as-forwarded (article)
9917 "Mark ARTICLE as forwarded and update the summary line.
9918 ARTICLE can also be a list of articles."
9919 (let ((articles (if (listp article
) article
(list article
))))
9920 (dolist (article articles
)
9921 (push article gnus-newsgroup-forwarded
)
9922 (let ((buffer-read-only nil
))
9923 (when (gnus-summary-goto-subject article nil t
)
9924 (gnus-summary-update-secondary-mark article
))))))
9926 (defun gnus-summary-set-bookmark (article)
9927 "Set a bookmark in current article."
9928 (interactive (list (gnus-summary-article-number)))
9929 (when (or (not (get-buffer gnus-article-buffer
))
9930 (not gnus-current-article
)
9931 (not gnus-article-current
)
9932 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
9933 (error "No current article selected"))
9934 ;; Remove old bookmark, if one exists.
9935 (gnus-pull article gnus-newsgroup-bookmarks
)
9936 ;; Set the new bookmark, which is on the form
9937 ;; (article-number . line-number-in-body).
9941 (set-buffer gnus-article-buffer
)
9948 gnus-newsgroup-bookmarks
)
9949 (gnus-message 6 "A bookmark has been added to the current article."))
9951 (defun gnus-summary-remove-bookmark (article)
9952 "Remove the bookmark from the current article."
9953 (interactive (list (gnus-summary-article-number)))
9954 ;; Remove old bookmark, if one exists.
9955 (if (not (assq article gnus-newsgroup-bookmarks
))
9956 (gnus-message 6 "No bookmark in current article.")
9957 (gnus-pull article gnus-newsgroup-bookmarks
)
9958 (gnus-message 6 "Removed bookmark.")))
9960 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9961 (defun gnus-summary-mark-as-dormant (n)
9962 "Mark N articles forward as dormant.
9963 If N is negative, mark backward instead. The difference between N and
9964 the actual number of articles marked is returned."
9966 (gnus-summary-mark-forward n gnus-dormant-mark
))
9968 (defun gnus-summary-set-process-mark (article)
9969 "Set the process mark on ARTICLE and update the summary line."
9970 (setq gnus-newsgroup-processable
9972 (delq article gnus-newsgroup-processable
)))
9973 (when (gnus-summary-goto-subject article
)
9974 (gnus-summary-show-thread)
9975 (gnus-summary-goto-subject article
)
9976 (gnus-summary-update-secondary-mark article
)))
9978 (defun gnus-summary-remove-process-mark (article)
9979 "Remove the process mark from ARTICLE and update the summary line."
9980 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
9981 (when (gnus-summary-goto-subject article
)
9982 (gnus-summary-show-thread)
9983 (gnus-summary-goto-subject article
)
9984 (gnus-summary-update-secondary-mark article
)))
9986 (defun gnus-summary-set-saved-mark (article)
9987 "Set the process mark on ARTICLE and update the summary line."
9988 (push article gnus-newsgroup-saved
)
9989 (when (gnus-summary-goto-subject article
)
9990 (gnus-summary-update-secondary-mark article
)))
9992 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
9993 "Mark N articles as read forwards.
9994 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9995 The difference between N and the actual number of articles marked is
9997 If NO-EXPIRE, auto-expiry will be inhibited."
9999 (gnus-summary-show-thread)
10000 (let ((backward (< n
0))
10001 (gnus-summary-goto-unread
10002 (and gnus-summary-goto-unread
10003 (not (eq gnus-summary-goto-unread
'never
))
10004 (not (memq mark
(list gnus-unread-mark gnus-spam-mark
10005 gnus-ticked-mark gnus-dormant-mark
)))))
10007 (mark (or mark gnus-del-mark
)))
10008 (while (and (> n
0)
10009 (gnus-summary-mark-article nil mark no-expire
)
10010 (zerop (gnus-summary-next-subject
10012 (and gnus-summary-goto-unread
10013 (not (eq gnus-summary-goto-unread
'never
)))
10017 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
10018 (gnus-summary-recenter)
10019 (gnus-summary-position-point)
10020 (gnus-set-mode-line 'summary
)
10023 (defun gnus-summary-mark-article-as-read (mark)
10024 "Mark the current article quickly as read with MARK."
10025 (let ((article (gnus-summary-article-number)))
10026 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10027 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10028 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10029 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10030 (push (cons article mark
) gnus-newsgroup-reads
)
10031 ;; Possibly remove from cache, if that is used.
10032 (when gnus-use-cache
10033 (gnus-cache-enter-remove-article article
))
10034 ;; Allow the backend to change the mark.
10035 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10036 ;; Check for auto-expiry.
10037 (when (and gnus-newsgroup-auto-expire
10038 (memq mark gnus-auto-expirable-marks
))
10039 (setq mark gnus-expirable-mark
)
10040 ;; Let the backend know about the mark change.
10041 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10042 (push article gnus-newsgroup-expirable
))
10043 ;; Set the mark in the buffer.
10044 (gnus-summary-update-mark mark
'unread
)
10047 (defun gnus-summary-mark-article-as-unread (mark)
10048 "Mark the current article quickly as unread with MARK."
10049 (let* ((article (gnus-summary-article-number))
10050 (old-mark (gnus-summary-article-mark article
)))
10051 ;; Allow the backend to change the mark.
10052 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10053 (if (eq mark old-mark
)
10057 (gnus-error 1 "Can't mark negative article numbers")
10059 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10060 (setq gnus-newsgroup-spam-marked
10061 (delq article gnus-newsgroup-spam-marked
))
10062 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10063 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
10064 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
10065 (cond ((= mark gnus-ticked-mark
)
10066 (setq gnus-newsgroup-marked
10067 (gnus-add-to-sorted-list gnus-newsgroup-marked
10069 ((= mark gnus-spam-mark
)
10070 (setq gnus-newsgroup-spam-marked
10071 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10073 ((= mark gnus-dormant-mark
)
10074 (setq gnus-newsgroup-dormant
10075 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10078 (setq gnus-newsgroup-unreads
10079 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10081 (gnus-pull article gnus-newsgroup-reads
)
10083 ;; See whether the article is to be put in the cache.
10084 (and gnus-use-cache
10085 (vectorp (gnus-summary-article-header article
))
10087 (gnus-cache-possibly-enter-article
10088 gnus-newsgroup-name article
10089 (= mark gnus-ticked-mark
)
10090 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10093 (gnus-summary-update-mark mark
'unread
)
10096 (defun gnus-summary-mark-article (&optional article mark no-expire
)
10097 "Mark ARTICLE with MARK. MARK can be any character.
10098 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10099 `??' (dormant) and `?E' (expirable).
10100 If MARK is nil, then the default character `?r' is used.
10101 If ARTICLE is nil, then the article on the current line will be
10103 If NO-EXPIRE, auto-expiry will be inhibited."
10104 ;; The mark might be a string.
10105 (when (stringp mark
)
10106 (setq mark
(aref mark
0)))
10107 ;; If no mark is given, then we check auto-expiring.
10109 (setq mark gnus-del-mark
))
10110 (when (and (not no-expire
)
10111 gnus-newsgroup-auto-expire
10112 (memq mark gnus-auto-expirable-marks
))
10113 (setq mark gnus-expirable-mark
))
10114 (let ((article (or article
(gnus-summary-article-number)))
10115 (old-mark (gnus-summary-article-mark article
)))
10116 ;; Allow the backend to change the mark.
10117 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10118 (if (eq mark old-mark
)
10121 (error "No article on current line"))
10122 (if (not (if (or (= mark gnus-unread-mark
)
10123 (= mark gnus-ticked-mark
)
10124 (= mark gnus-spam-mark
)
10125 (= mark gnus-dormant-mark
))
10126 (gnus-mark-article-as-unread article mark
)
10127 (gnus-mark-article-as-read article mark
)))
10129 ;; See whether the article is to be put in the cache.
10130 (and gnus-use-cache
10131 (not (= mark gnus-canceled-mark
))
10132 (vectorp (gnus-summary-article-header article
))
10134 (gnus-cache-possibly-enter-article
10135 gnus-newsgroup-name article
10136 (= mark gnus-ticked-mark
)
10137 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10139 (when (gnus-summary-goto-subject article nil t
)
10140 (let ((buffer-read-only nil
))
10141 (gnus-summary-show-thread)
10143 (gnus-summary-update-mark mark
'unread
)
10146 (defun gnus-summary-update-secondary-mark (article)
10147 "Update the secondary (read, process, cache) mark."
10148 (gnus-summary-update-mark
10149 (cond ((memq article gnus-newsgroup-processable
)
10151 ((memq article gnus-newsgroup-cached
)
10153 ((memq article gnus-newsgroup-replied
)
10155 ((memq article gnus-newsgroup-forwarded
)
10156 gnus-forwarded-mark
)
10157 ((memq article gnus-newsgroup-saved
)
10159 ((memq article gnus-newsgroup-recent
)
10161 ((memq article gnus-newsgroup-unseen
)
10165 (when (gnus-visual-p 'summary-highlight
'highlight
)
10166 (gnus-run-hooks 'gnus-summary-update-hook
))
10169 (defun gnus-summary-update-download-mark (article)
10170 "Update the download mark."
10171 (gnus-summary-update-mark
10172 (cond ((memq article gnus-newsgroup-undownloaded
)
10173 gnus-undownloaded-mark
)
10174 (gnus-newsgroup-agentized
10175 gnus-downloaded-mark
)
10179 (gnus-summary-update-line t
)
10182 (defun gnus-summary-update-mark (mark type
)
10183 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
10184 (buffer-read-only nil
))
10185 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
10187 (when (looking-at "\r")
10189 (when (<= (+ forward
(point)) (point-max))
10190 ;; Go to the right position on the line.
10191 (goto-char (+ forward
(point)))
10192 ;; Replace the old mark with the new mark.
10193 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
10194 ;; Optionally update the marks by some user rule.
10195 (when (eq type
'unread
)
10196 (gnus-data-set-mark
10197 (gnus-data-find (gnus-summary-article-number)) mark
)
10198 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
10200 (defun gnus-mark-article-as-read (article &optional mark
)
10201 "Enter ARTICLE in the pertinent lists and remove it from others."
10202 ;; Make the article expirable.
10203 (let ((mark (or mark gnus-del-mark
)))
10204 (setq gnus-newsgroup-expirable
10205 (if (= mark gnus-expirable-mark
)
10206 (gnus-add-to-sorted-list gnus-newsgroup-expirable article
)
10207 (delq article gnus-newsgroup-expirable
)))
10208 ;; Remove from unread and marked lists.
10209 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10210 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10211 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10212 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10213 (push (cons article mark
) gnus-newsgroup-reads
)
10214 ;; Possibly remove from cache, if that is used.
10215 (when gnus-use-cache
10216 (gnus-cache-enter-remove-article article
))
10219 (defun gnus-mark-article-as-unread (article &optional mark
)
10220 "Enter ARTICLE in the pertinent lists and remove it from others."
10221 (let ((mark (or mark gnus-ticked-mark
)))
10224 (gnus-error 1 "Can't mark negative article numbers")
10226 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
10227 gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
)
10228 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
10229 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
10230 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10232 ;; Unsuppress duplicates?
10233 (when gnus-suppress-duplicates
10234 (gnus-dup-unsuppress-article article
))
10236 (cond ((= mark gnus-ticked-mark
)
10237 (setq gnus-newsgroup-marked
10238 (gnus-add-to-sorted-list gnus-newsgroup-marked article
)))
10239 ((= mark gnus-spam-mark
)
10240 (setq gnus-newsgroup-spam-marked
10241 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10243 ((= mark gnus-dormant-mark
)
10244 (setq gnus-newsgroup-dormant
10245 (gnus-add-to-sorted-list gnus-newsgroup-dormant article
)))
10247 (setq gnus-newsgroup-unreads
10248 (gnus-add-to-sorted-list gnus-newsgroup-unreads article
))))
10249 (gnus-pull article gnus-newsgroup-reads
)
10252 (defalias 'gnus-summary-mark-as-unread-forward
10253 'gnus-summary-tick-article-forward
)
10254 (make-obsolete 'gnus-summary-mark-as-unread-forward
10255 'gnus-summary-tick-article-forward
)
10256 (defun gnus-summary-tick-article-forward (n)
10257 "Tick N articles forwards.
10258 If N is negative, tick backwards instead.
10259 The difference between N and the number of articles ticked is returned."
10261 (gnus-summary-mark-forward n gnus-ticked-mark
))
10263 (defalias 'gnus-summary-mark-as-unread-backward
10264 'gnus-summary-tick-article-backward
)
10265 (make-obsolete 'gnus-summary-mark-as-unread-backward
10266 'gnus-summary-tick-article-backward
)
10267 (defun gnus-summary-tick-article-backward (n)
10268 "Tick N articles backwards.
10269 The difference between N and the number of articles ticked is returned."
10271 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
10273 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10274 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10275 (defun gnus-summary-tick-article (&optional article clear-mark
)
10276 "Mark current article as unread.
10277 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10278 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10280 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
10281 gnus-ticked-mark
)))
10283 (defun gnus-summary-mark-as-read-forward (n)
10284 "Mark N articles as read forwards.
10285 If N is negative, mark backwards instead.
10286 The difference between N and the actual number of articles marked is
10289 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
10291 (defun gnus-summary-mark-as-read-backward (n)
10292 "Mark the N articles as read backwards.
10293 The difference between N and the actual number of articles marked is
10296 (gnus-summary-mark-forward
10297 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
10299 (defun gnus-summary-mark-as-read (&optional article mark
)
10300 "Mark current article as read.
10301 ARTICLE specifies the article to be marked as read.
10302 MARK specifies a string to be inserted at the beginning of the line."
10303 (gnus-summary-mark-article article mark
))
10305 (defun gnus-summary-clear-mark-forward (n)
10306 "Clear marks from N articles forward.
10307 If N is negative, clear backward instead.
10308 The difference between N and the number of marks cleared is returned."
10310 (gnus-summary-mark-forward n gnus-unread-mark
))
10312 (defun gnus-summary-clear-mark-backward (n)
10313 "Clear marks from N articles backward.
10314 The difference between N and the number of marks cleared is returned."
10316 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
10318 (defun gnus-summary-mark-unread-as-read ()
10319 "Intended to be used by `gnus-summary-mark-article-hook'."
10320 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10321 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
10323 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark
)
10324 "Intended to be used by `gnus-summary-mark-article-hook'."
10325 (let ((mark (gnus-summary-article-mark)))
10326 (when (or (gnus-unread-mark-p mark
)
10327 (gnus-read-mark-p mark
))
10328 (gnus-summary-mark-article gnus-current-article
10329 (or new-mark gnus-read-mark
)))))
10331 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark
)
10332 "Intended to be used by `gnus-summary-mark-article-hook'."
10333 (let ((mark (gnus-summary-article-mark)))
10334 (when (or (gnus-unread-mark-p mark
)
10335 (gnus-read-mark-p mark
))
10336 (gnus-summary-mark-article (gnus-summary-article-number)
10337 (or new-mark gnus-read-mark
)))))
10339 (defun gnus-summary-mark-unread-as-ticked ()
10340 "Intended to be used by `gnus-summary-mark-article-hook'."
10341 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10342 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark
)))
10344 (defun gnus-summary-mark-region-as-read (point mark all
)
10345 "Mark all unread articles between point and mark as read.
10346 If given a prefix, mark all articles between point and mark as read,
10347 even ticked and dormant ones."
10348 (interactive "r\nP")
10352 (beginning-of-line)
10357 (memq (setq article
(gnus-summary-article-number))
10358 gnus-newsgroup-unreads
))
10359 (gnus-summary-mark-article article gnus-del-mark
))
10361 (gnus-summary-find-next))))))
10363 (defun gnus-summary-mark-below (score mark
)
10364 "Mark articles with score less than SCORE with MARK."
10365 (interactive "P\ncMark: ")
10366 (setq score
(if score
10367 (prefix-numeric-value score
)
10368 (or gnus-summary-default-score
0)))
10370 (set-buffer gnus-summary-buffer
)
10371 (goto-char (point-min))
10374 (and (< (gnus-summary-article-score) score
)
10375 (gnus-summary-mark-article nil mark
))
10376 (gnus-summary-find-next)))))
10378 (defun gnus-summary-kill-below (&optional score
)
10379 "Mark articles with score below SCORE as read."
10381 (gnus-summary-mark-below score gnus-killed-mark
))
10383 (defun gnus-summary-clear-above (&optional score
)
10384 "Clear all marks from articles with score above SCORE."
10386 (gnus-summary-mark-above score gnus-unread-mark
))
10388 (defun gnus-summary-tick-above (&optional score
)
10389 "Tick all articles with score above SCORE."
10391 (gnus-summary-mark-above score gnus-ticked-mark
))
10393 (defun gnus-summary-mark-above (score mark
)
10394 "Mark articles with score over SCORE with MARK."
10395 (interactive "P\ncMark: ")
10396 (setq score
(if score
10397 (prefix-numeric-value score
)
10398 (or gnus-summary-default-score
0)))
10400 (set-buffer gnus-summary-buffer
)
10401 (goto-char (point-min))
10403 (when (> (gnus-summary-article-score) score
)
10404 (gnus-summary-mark-article nil mark
))
10406 (gnus-summary-find-next)))))
10408 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10409 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
10410 (defun gnus-summary-limit-include-expunged (&optional no-error
)
10411 "Display all the hidden articles that were expunged for low scores."
10413 (let ((buffer-read-only nil
))
10414 (let ((scored gnus-newsgroup-scored
)
10417 (unless (gnus-summary-article-header (caar scored
))
10418 (and (setq h
(gnus-number-to-header (caar scored
)))
10419 (< (cdar scored
) gnus-summary-expunge-below
)
10421 (setq scored
(cdr scored
)))
10423 (when (not no-error
)
10424 (error "No expunged articles hidden"))
10425 (goto-char (point-min))
10426 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
10427 (setq gnus-newsgroup-limit
(copy-sequence gnus-newsgroup-limit
))
10428 (mapcar (lambda (x) (push (mail-header-number x
)
10429 gnus-newsgroup-limit
))
10431 (gnus-summary-prepare-unthreaded (nreverse headers
))
10432 (goto-char (point-min))
10433 (gnus-summary-position-point)
10436 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse
)
10437 "Mark all unread articles in this newsgroup as read.
10438 If prefix argument ALL is non-nil, ticked and dormant articles will
10439 also be marked as read.
10440 If QUIETLY is non-nil, no questions will be asked.
10442 If TO-HERE is non-nil, it should be a point in the buffer. All
10443 articles before (after, if REVERSE is set) this point will be marked
10446 Note that this function will only catch up the unread article
10447 in the current summary buffer limitation.
10449 The number of articles marked as read is returned."
10454 (not gnus-interactive-catchup
) ;Without confirmation?
10458 "Mark absolutely all articles as read? "
10459 "Mark all unread articles as read? ")))
10461 (not gnus-newsgroup-adaptive
)
10462 (not gnus-newsgroup-auto-expire
)
10463 (not gnus-suppress-duplicates
)
10464 (or (not gnus-use-cache
)
10465 (eq gnus-use-cache
'passive
)))
10468 (setq gnus-newsgroup-marked nil
10469 gnus-newsgroup-spam-marked nil
10470 gnus-newsgroup-dormant nil
))
10471 (setq gnus-newsgroup-unreads
10472 (gnus-sorted-nunion
10473 (gnus-sorted-intersection gnus-newsgroup-unreads
10474 gnus-newsgroup-downloadable
)
10475 gnus-newsgroup-unfetched
)))
10476 ;; We actually mark all articles as canceled, which we
10477 ;; have to do when using auto-expiry or adaptive scoring.
10478 (gnus-summary-show-all-threads)
10479 (if (and to-here reverse
)
10481 (goto-char to-here
)
10482 (gnus-summary-mark-current-read-and-unread-as-read
10484 (while (gnus-summary-find-next (not all
))
10485 (gnus-summary-mark-article-as-read gnus-catchup-mark
)))
10486 (when (gnus-summary-first-subject (not all
))
10488 (if to-here
(< (point) to-here
) t
)
10489 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
10490 (gnus-summary-find-next (not all
))))))
10491 (gnus-set-mode-line 'summary
))
10493 (gnus-summary-position-point)))
10495 (defun gnus-summary-catchup-to-here (&optional all
)
10496 "Mark all unticked articles before the current one as read.
10497 If ALL is non-nil, also mark ticked and dormant articles as read."
10500 (gnus-save-hidden-threads
10501 (let ((beg (point)))
10502 ;; We check that there are unread articles.
10503 (when (or all
(gnus-summary-find-prev))
10504 (gnus-summary-catchup all t beg
)))))
10505 (gnus-summary-position-point))
10507 (defun gnus-summary-catchup-from-here (&optional all
)
10508 "Mark all unticked articles after (and including) the current one as read.
10509 If ALL is non-nil, also mark ticked and dormant articles as read."
10512 (gnus-save-hidden-threads
10513 (let ((beg (point)))
10514 ;; We check that there are unread articles.
10515 (when (or all
(gnus-summary-find-next))
10516 (gnus-summary-catchup all t beg nil t
)))))
10517 (gnus-summary-position-point))
10519 (defun gnus-summary-catchup-all (&optional quietly
)
10520 "Mark all articles in this newsgroup as read.
10521 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10522 instead, which marks only unread articles as read."
10524 (gnus-summary-catchup t quietly
))
10526 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
10527 "Mark all unread articles in this group as read, then exit.
10528 If prefix argument ALL is non-nil, all articles are marked as read.
10529 If QUIETLY is non-nil, no questions will be asked."
10531 (when (gnus-summary-catchup all quietly nil
'fast
)
10532 ;; Select next newsgroup or exit.
10533 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
10534 (eq gnus-auto-select-next
'quietly
))
10535 (gnus-summary-next-group nil
)
10536 (gnus-summary-exit))))
10538 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
10539 "Mark all articles in this newsgroup as read, and then exit.
10540 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10541 instead, which marks only unread articles as read."
10543 (gnus-summary-catchup-and-exit t quietly
))
10545 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
10546 "Mark all articles in this group as read and select the next group.
10547 If given a prefix, mark all articles, unread as well as ticked, as
10551 (gnus-summary-catchup all
))
10552 (gnus-summary-next-group))
10558 (defmacro gnus-with-article
(article &rest forms
)
10559 "Select ARTICLE and perform FORMS in the original article buffer.
10560 Then replace the article with the result."
10562 ;; We don't want the article to be marked as read.
10563 (let (gnus-mark-article-hook)
10564 (gnus-summary-select-article t t nil
,article
))
10565 (set-buffer gnus-original-article-buffer
)
10567 (if (not (gnus-check-backend-function
10568 'request-replace-article
(car gnus-article-current
)))
10569 (gnus-message 5 "Read-only group; not replacing")
10570 (unless (gnus-request-replace-article
10571 ,article
(car gnus-article-current
)
10572 (current-buffer) t
)
10573 (error "Couldn't replace article")))
10574 ;; The cache and backlog have to be flushed somewhat.
10575 (when gnus-keep-backlog
10576 (gnus-backlog-remove-article
10577 (car gnus-article-current
) (cdr gnus-article-current
)))
10578 (when gnus-use-cache
10579 (gnus-cache-update-article
10580 (car gnus-article-current
) (cdr gnus-article-current
)))))
10582 (put 'gnus-with-article
'lisp-indent-function
1)
10583 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
10585 ;; Thread-based commands.
10587 (defun gnus-summary-articles-in-thread (&optional article
)
10588 "Return a list of all articles in the current thread.
10589 If ARTICLE is non-nil, return all articles in the thread that starts
10590 with that article."
10591 (let* ((article (or article
(gnus-summary-article-number)))
10592 (data (gnus-data-find-list article
))
10593 (top-level (gnus-data-level (car data
)))
10595 (cond ((null gnus-thread-operation-ignore-subject
)
10596 (gnus-simplify-subject-re
10597 (mail-header-subject (gnus-data-header (car data
)))))
10598 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
10599 (gnus-simplify-subject-fuzzy
10600 (mail-header-subject (gnus-data-header (car data
)))))
10602 (end-point (save-excursion
10603 (if (gnus-summary-go-to-next-thread)
10604 (point) (point-max))))
10607 (< (gnus-data-pos (car data
)) end-point
))
10608 (when (or (not top-subject
)
10609 (string= top-subject
10610 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
10611 (gnus-simplify-subject-fuzzy
10612 (mail-header-subject
10613 (gnus-data-header (car data
))))
10614 (gnus-simplify-subject-re
10615 (mail-header-subject
10616 (gnus-data-header (car data
)))))))
10617 (push (gnus-data-number (car data
)) articles
))
10618 (unless (and (setq data
(cdr data
))
10619 (> (gnus-data-level (car data
)) top-level
))
10621 ;; Return the list of articles.
10622 (nreverse articles
)))
10624 (defun gnus-summary-rethread-current ()
10625 "Rethread the thread the current article is part of."
10627 (let* ((gnus-show-threads t
)
10628 (article (gnus-summary-article-number))
10629 (id (mail-header-id (gnus-summary-article-header)))
10630 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
10632 (error "No article on the current line"))
10633 (gnus-rebuild-thread id
)
10634 (gnus-summary-goto-subject article
)))
10636 (defun gnus-summary-reparent-thread ()
10637 "Make the current article child of the marked (or previous) article.
10639 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10640 is non-nil or the Subject: of both articles are the same."
10642 (unless (not (gnus-group-read-only-p))
10643 (error "The current newsgroup does not support article editing"))
10644 (unless (<= (length gnus-newsgroup-processable
) 1)
10645 (error "No more than one article may be marked"))
10646 (save-window-excursion
10647 (let ((gnus-article-buffer " *reparent*")
10648 (current-article (gnus-summary-article-number))
10649 ;; First grab the marked article, otherwise one line up.
10650 (parent-article (if (not (null gnus-newsgroup-processable
))
10651 (car gnus-newsgroup-processable
)
10653 (if (eq (forward-line -
1) 0)
10654 (gnus-summary-article-number)
10655 (error "Beginning of summary buffer"))))))
10656 (unless (not (eq current-article parent-article
))
10657 (error "An article may not be self-referential"))
10658 (let ((message-id (mail-header-id
10659 (gnus-summary-article-header parent-article
))))
10660 (unless (and message-id
(not (equal message-id
"")))
10661 (error "No message-id in desired parent"))
10662 (gnus-with-article current-article
10664 (goto-char (point-min))
10665 (message-narrow-to-head)
10666 (if (re-search-forward "^References: " nil t
)
10668 (re-search-forward "^[^ \t]" nil t
)
10671 (insert " " message-id
))
10672 (insert "References: " message-id
"\n"))))
10673 (set-buffer gnus-summary-buffer
)
10674 (gnus-summary-unmark-all-processable)
10675 (gnus-summary-update-article current-article
)
10676 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
10677 (gnus-summary-update-secondary-mark (cdr gnus-article-current
)))
10678 (gnus-summary-rethread-current)
10679 (gnus-message 3 "Article %d is now the child of article %d"
10680 current-article parent-article
)))))
10682 (defun gnus-summary-toggle-threads (&optional arg
)
10683 "Toggle showing conversation threads.
10684 If ARG is positive number, turn showing conversation threads on."
10686 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
10687 (setq gnus-show-threads
10688 (if (null arg
) (not gnus-show-threads
)
10689 (> (prefix-numeric-value arg
) 0)))
10690 (gnus-summary-prepare)
10691 (gnus-summary-goto-subject current
)
10692 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
10693 (gnus-summary-position-point)))
10695 (defun gnus-summary-show-all-threads ()
10696 "Show all threads."
10699 (let ((buffer-read-only nil
))
10700 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
10701 (gnus-summary-position-point))
10703 (defun gnus-summary-show-thread ()
10704 "Show thread subtrees.
10705 Returns nil if no thread was there to be shown."
10707 (let ((buffer-read-only nil
)
10709 (end (gnus-point-at-eol))
10710 ;; Leave point at bol
10711 (beg (progn (beginning-of-line) (point))))
10713 ;; Any hidden lines here?
10714 (search-forward "\r" end t
)
10715 (subst-char-in-region beg end ?\^M ?
\n t
)
10717 (gnus-summary-position-point))))
10719 (defun gnus-summary-maybe-hide-threads ()
10720 "If requested, hide the threads that should be hidden."
10721 (when (and gnus-show-threads
10722 gnus-thread-hide-subtree
)
10723 (gnus-summary-hide-all-threads
10724 (if (or (consp gnus-thread-hide-subtree
)
10725 (functionp gnus-thread-hide-subtree
))
10726 (gnus-make-predicate gnus-thread-hide-subtree
)
10729 ;;; Hiding predicates.
10731 (defun gnus-article-unread-p (header)
10732 (memq (mail-header-number header
) gnus-newsgroup-unreads
))
10734 (defun gnus-article-unseen-p (header)
10735 (memq (mail-header-number header
) gnus-newsgroup-unseen
))
10737 (defun gnus-map-articles (predicate articles
)
10738 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10739 (apply 'gnus-or
(mapcar predicate
10740 (mapcar (lambda (number)
10741 (gnus-summary-article-header number
))
10744 (defun gnus-summary-hide-all-threads (&optional predicate
)
10745 "Hide all thread subtrees.
10746 If PREDICATE is supplied, threads that satisfy this predicate
10747 will not be hidden."
10750 (goto-char (point-min))
10753 (when (or (not predicate
)
10755 predicate
(gnus-summary-article-children)))
10756 (gnus-summary-hide-thread))
10757 (setq end
(not (zerop (gnus-summary-next-thread 1 t
)))))))
10758 (gnus-summary-position-point))
10760 (defun gnus-summary-hide-thread ()
10761 "Hide thread subtrees.
10762 If PREDICATE is supplied, threads that satisfy this predicate
10763 will not be hidden.
10764 Returns nil if no threads were there to be hidden."
10766 (let ((buffer-read-only nil
)
10768 (article (gnus-summary-article-number)))
10770 ;; Go forward until either the buffer ends or the subthread
10772 (when (and (not (eobp))
10773 (or (zerop (gnus-summary-next-thread 1 t
))
10774 (goto-char (point-max))))
10776 (if (and (> (point) start
)
10777 (search-backward "\n" start t
))
10779 (subst-char-in-region start
(point) ?
\n ?\^M
)
10780 (gnus-summary-goto-subject article
))
10784 (defun gnus-summary-go-to-next-thread (&optional previous
)
10785 "Go to the same level (or less) next thread.
10786 If PREVIOUS is non-nil, go to previous thread instead.
10787 Return the article number moved to, or nil if moving was impossible."
10788 (let ((level (gnus-summary-thread-level))
10789 (way (if previous -
1 1))
10792 (while (and (not (eobp))
10793 (< level
(gnus-summary-thread-level)))
10794 (forward-line way
))
10801 (gnus-summary-article-number)
10802 (goto-char beg
)))))
10804 (defun gnus-summary-next-thread (n &optional silent
)
10805 "Go to the same level next N'th thread.
10806 If N is negative, search backward instead.
10807 Returns the difference between N and the number of skips actually
10810 If SILENT, don't output messages."
10812 (let ((backward (< n
0))
10814 (while (and (> n
0)
10815 (gnus-summary-go-to-next-thread backward
))
10818 (gnus-summary-position-point))
10819 (when (and (not silent
) (/= 0 n
))
10820 (gnus-message 7 "No more threads"))
10823 (defun gnus-summary-prev-thread (n)
10824 "Go to the same level previous N'th thread.
10825 Returns the difference between N and the number of skips actually
10828 (gnus-summary-next-thread (- n
)))
10830 (defun gnus-summary-go-down-thread ()
10831 "Go down one level in the current thread."
10832 (let ((children (gnus-summary-article-children)))
10834 (gnus-summary-goto-subject (car children
)))))
10836 (defun gnus-summary-go-up-thread ()
10837 "Go up one level in the current thread."
10838 (let ((parent (gnus-summary-article-parent)))
10840 (gnus-summary-goto-subject parent
))))
10842 (defun gnus-summary-down-thread (n)
10843 "Go down thread N steps.
10844 If N is negative, go up instead.
10845 Returns the difference between N and how many steps down that were
10850 (while (and (> n
0)
10851 (if up
(gnus-summary-go-up-thread)
10852 (gnus-summary-go-down-thread)))
10854 (gnus-summary-position-point)
10856 (gnus-message 7 "Can't go further"))
10859 (defun gnus-summary-up-thread (n)
10860 "Go up thread N steps.
10861 If N is negative, go down instead.
10862 Returns the difference between N and how many steps down that were
10865 (gnus-summary-down-thread (- n
)))
10867 (defun gnus-summary-top-thread ()
10868 "Go to the top of the thread."
10870 (while (gnus-summary-go-up-thread))
10871 (gnus-summary-article-number))
10873 (defun gnus-summary-kill-thread (&optional unmark
)
10874 "Mark articles under current thread as read.
10875 If the prefix argument is positive, remove any kinds of marks.
10876 If the prefix argument is negative, tick articles instead."
10879 (setq unmark
(prefix-numeric-value unmark
)))
10880 (let ((articles (gnus-summary-articles-in-thread)))
10882 ;; Expand the thread.
10883 (gnus-summary-show-thread)
10884 ;; Mark all the articles.
10886 (gnus-summary-goto-subject (car articles
))
10887 (cond ((null unmark
)
10888 (gnus-summary-mark-article-as-read gnus-killed-mark
))
10890 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
10892 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
10893 (setq articles
(cdr articles
))))
10894 ;; Hide killed subtrees.
10896 gnus-thread-hide-killed
10897 (gnus-summary-hide-thread))
10898 ;; If marked as read, go to next unread subject.
10899 (when (null unmark
)
10900 ;; Go to next unread subject.
10901 (gnus-summary-next-subject 1 t
)))
10902 (gnus-set-mode-line 'summary
))
10904 ;; Summary sorting commands
10906 (defun gnus-summary-sort-by-number (&optional reverse
)
10907 "Sort the summary buffer by article number.
10908 Argument REVERSE means reverse order."
10910 (gnus-summary-sort 'number reverse
))
10912 (defun gnus-summary-sort-by-random (&optional reverse
)
10913 "Randomize the order in the summary buffer.
10914 Argument REVERSE means to randomize in reverse order."
10916 (gnus-summary-sort 'random reverse
))
10918 (defun gnus-summary-sort-by-author (&optional reverse
)
10919 "Sort the summary buffer by author name alphabetically.
10920 If `case-fold-search' is non-nil, case of letters is ignored.
10921 Argument REVERSE means reverse order."
10923 (gnus-summary-sort 'author reverse
))
10925 (defun gnus-summary-sort-by-subject (&optional reverse
)
10926 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10927 If `case-fold-search' is non-nil, case of letters is ignored.
10928 Argument REVERSE means reverse order."
10930 (gnus-summary-sort 'subject reverse
))
10932 (defun gnus-summary-sort-by-date (&optional reverse
)
10933 "Sort the summary buffer by date.
10934 Argument REVERSE means reverse order."
10936 (gnus-summary-sort 'date reverse
))
10938 (defun gnus-summary-sort-by-score (&optional reverse
)
10939 "Sort the summary buffer by score.
10940 Argument REVERSE means reverse order."
10942 (gnus-summary-sort 'score reverse
))
10944 (defun gnus-summary-sort-by-lines (&optional reverse
)
10945 "Sort the summary buffer by the number of lines.
10946 Argument REVERSE means reverse order."
10948 (gnus-summary-sort 'lines reverse
))
10950 (defun gnus-summary-sort-by-chars (&optional reverse
)
10951 "Sort the summary buffer by article length.
10952 Argument REVERSE means reverse order."
10954 (gnus-summary-sort 'chars reverse
))
10956 (defun gnus-summary-sort-by-original (&optional reverse
)
10957 "Sort the summary buffer using the default sorting method.
10958 Argument REVERSE means reverse order."
10960 (let* ((buffer-read-only)
10961 (gnus-summary-prepare-hook nil
))
10962 ;; We do the sorting by regenerating the threads.
10963 (gnus-summary-prepare)
10964 ;; Hide subthreads if needed.
10965 (gnus-summary-maybe-hide-threads)))
10967 (defun gnus-summary-sort (predicate reverse
)
10968 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10969 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
10970 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
10971 (gnus-thread-sort-functions
10976 (gnus-sort-gathered-threads-function
10977 gnus-thread-sort-functions
)
10978 (gnus-article-sort-functions
10982 (,article t2 t1
))))
10984 (gnus-summary-prepare-hook nil
))
10985 ;; We do the sorting by regenerating the threads.
10986 (gnus-summary-prepare)
10987 ;; Hide subthreads if needed.
10988 (gnus-summary-maybe-hide-threads)))
10990 ;; Summary saving commands.
10992 (defun gnus-summary-save-article (&optional n not-saved
)
10993 "Save the current article using the default saver function.
10994 If N is a positive number, save the N next articles.
10995 If N is a negative number, save the N previous articles.
10996 If N is nil and any articles have been marked with the process mark,
10997 save those articles instead.
10998 The variable `gnus-default-article-saver' specifies the saver function.
11000 If the optional second argument NOT-SAVED is non-nil, articles saved
11001 will not be marked as saved."
11003 (require 'gnus-art
)
11004 (let* ((articles (gnus-summary-work-articles n
))
11005 (save-buffer (save-excursion
11006 (nnheader-set-temp-buffer " *Gnus Save*")))
11007 (num (length articles
))
11008 ;; Whether to save decoded articles or raw articles.
11009 (decode (when gnus-article-save-coding-system
11010 (get gnus-default-article-saver
:decode
)))
11011 ;; When saving many articles in a single file, use the other
11012 ;; function to save articles other than the first one.
11013 (saver2 (get gnus-default-article-saver
:function
))
11014 (gnus-prompt-before-saving (if saver2
11016 gnus-prompt-before-saving
))
11017 (gnus-default-article-saver gnus-default-article-saver
)
11019 (dolist (article articles
)
11020 (setq header
(gnus-summary-article-header article
))
11021 (if (not (vectorp header
))
11022 ;; This is a pseudo-article.
11023 (if (assq 'name header
)
11024 (gnus-copy-file (cdr (assq 'name header
)))
11025 (gnus-message 1 "Article %d is unsaveable" article
))
11026 ;; This is a real article.
11027 (save-window-excursion
11028 (let ((gnus-display-mime-function (when decode
11029 gnus-display-mime-function
))
11030 (gnus-article-prepare-hook (when decode
11031 gnus-article-prepare-hook
)))
11032 (gnus-summary-select-article t nil nil article
)
11033 (gnus-summary-goto-subject article
)))
11035 (set-buffer save-buffer
)
11037 (insert-buffer-substring (if decode
11038 gnus-article-buffer
11039 gnus-original-article-buffer
)))
11040 (setq file
(gnus-article-save save-buffer file num
))
11041 (gnus-summary-remove-process-mark article
)
11043 (gnus-summary-set-saved-mark article
)))
11045 (setq gnus-default-article-saver saver2
11047 (gnus-kill-buffer save-buffer
)
11048 (gnus-summary-position-point)
11049 (gnus-set-mode-line 'summary
)
11052 (defun gnus-summary-pipe-output (&optional arg headers
)
11053 "Pipe the current article to a subprocess.
11054 If N is a positive number, pipe the N next articles.
11055 If N is a negative number, pipe the N previous articles.
11056 If N is nil and any articles have been marked with the process mark,
11057 pipe those articles instead.
11058 If HEADERS (the symbolic prefix), include the headers, too."
11059 (interactive (gnus-interactive "P\ny"))
11060 (require 'gnus-art
)
11061 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
)
11062 (gnus-save-all-headers (or headers gnus-save-all-headers
)))
11063 (gnus-summary-save-article arg t
))
11064 (let ((buffer (get-buffer "*Shell Command Output*")))
11066 (not (zerop (buffer-size buffer
))))
11067 (gnus-configure-windows 'pipe
))))
11069 (defun gnus-summary-save-article-mail (&optional arg
)
11070 "Append the current article to a Unix mail box file.
11071 If N is a positive number, save the N next articles.
11072 If N is a negative number, save the N previous articles.
11073 If N is nil and any articles have been marked with the process mark,
11074 save those articles instead."
11076 (require 'gnus-art
)
11077 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
11078 (gnus-summary-save-article arg
)))
11080 (defun gnus-summary-save-article-rmail (&optional arg
)
11081 "Append the current article to an rmail file.
11082 If N is a positive number, save the N next articles.
11083 If N is a negative number, save the N previous articles.
11084 If N is nil and any articles have been marked with the process mark,
11085 save those articles instead."
11087 (require 'gnus-art
)
11088 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
11089 (gnus-summary-save-article arg
)))
11091 (defun gnus-summary-save-article-file (&optional arg
)
11092 "Append the current article to a file.
11093 If N is a positive number, save the N next articles.
11094 If N is a negative number, save the N previous articles.
11095 If N is nil and any articles have been marked with the process mark,
11096 save those articles instead."
11098 (require 'gnus-art
)
11099 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
11100 (gnus-summary-save-article arg
)))
11102 (defun gnus-summary-write-article-file (&optional arg
)
11103 "Write the current article to a file, deleting the previous file.
11104 If N is a positive number, save the N next articles.
11105 If N is a negative number, save the N previous articles.
11106 If N is nil and any articles have been marked with the process mark,
11107 save those articles instead."
11109 (require 'gnus-art
)
11110 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
11111 (gnus-summary-save-article arg
)))
11113 (defun gnus-summary-save-article-body-file (&optional arg
)
11114 "Append the current article body to a file.
11115 If N is a positive number, save the N next articles.
11116 If N is a negative number, save the N previous articles.
11117 If N is nil and any articles have been marked with the process mark,
11118 save those articles instead."
11120 (require 'gnus-art
)
11121 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
11122 (gnus-summary-save-article arg
)))
11124 (defun gnus-summary-write-article-body-file (&optional arg
)
11125 "Write the current article body to a file, deleting the previous file.
11126 If N is a positive number, save the N next articles.
11127 If N is a negative number, save the N previous articles.
11128 If N is nil and any articles have been marked with the process mark,
11129 save those articles instead."
11131 (require 'gnus-art
)
11132 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file
))
11133 (gnus-summary-save-article arg
)))
11135 (defun gnus-summary-muttprint (&optional arg
)
11136 "Print the current article using Muttprint.
11137 If N is a positive number, save the N next articles.
11138 If N is a negative number, save the N previous articles.
11139 If N is nil and any articles have been marked with the process mark,
11140 save those articles instead."
11142 (require 'gnus-art
)
11143 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint
))
11144 (gnus-summary-save-article arg t
)))
11146 (defun gnus-summary-pipe-message (program)
11147 "Pipe the current article through PROGRAM."
11148 (interactive "sProgram: ")
11149 (gnus-summary-select-article)
11150 (let ((mail-header-separator ""))
11151 (gnus-eval-in-buffer-window gnus-article-buffer
11154 (let ((start (window-start))
11156 (message-pipe-buffer-body program
)
11157 (set-window-start (get-buffer-window (current-buffer)) start
))))))
11159 (defun gnus-get-split-value (methods)
11160 "Return a value based on the split METHODS."
11161 (let (split-name method result match
)
11164 (set-buffer gnus-original-article-buffer
)
11166 (nnheader-narrow-to-headers)
11167 (while (and methods
(not split-name
))
11168 (goto-char (point-min))
11169 (setq method
(pop methods
))
11170 (setq match
(car method
))
11173 ;; Regular expression.
11175 (re-search-forward match nil t
)))
11180 (setq result
(funcall match gnus-newsgroup-name
))))
11185 (setq result
(eval match
)))))
11186 (setq split-name
(cdr method
))
11187 (cond ((stringp result
)
11188 (push (expand-file-name
11189 result gnus-article-save-directory
)
11192 (setq split-name
(append result split-name
)))))))))
11193 (nreverse split-name
)))
11195 (defun gnus-valid-move-group-p (group)
11196 (and (boundp group
)
11197 (symbol-name group
)
11198 (symbol-value group
)
11199 (gnus-get-function (gnus-find-method-for-group
11200 (symbol-name group
)) 'request-accept-article t
)))
11202 (defun gnus-read-move-group-name (prompt default articles prefix
)
11203 "Read a group name."
11204 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
11205 (minibuffer-confirm-incomplete nil
) ; XEmacs
11209 (if (> (length articles
) 1)
11210 (format "these %d articles" (length articles
))
11215 (gnus-completing-read-with-default
11218 'gnus-valid-move-group-p
11220 'gnus-group-history
))
11221 ((= 1 (length split-name
))
11222 (gnus-completing-read-with-default
11223 (car split-name
) prom
11225 'gnus-valid-move-group-p
11227 'gnus-group-history
))
11229 (gnus-completing-read-with-default
11231 (mapcar (lambda (el) (list el
))
11232 (nreverse split-name
))
11234 'gnus-group-history
))))
11235 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
11237 (if (or (string= to-newsgroup
"")
11238 (string= to-newsgroup prefix
))
11239 (setq to-newsgroup default
))
11240 (unless to-newsgroup
11241 (error "No group name entered"))
11242 (or (gnus-active to-newsgroup
)
11243 (gnus-activate-group to-newsgroup nil nil to-method
)
11244 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11246 (or (and (gnus-request-create-group to-newsgroup to-method
)
11247 (gnus-activate-group
11248 to-newsgroup nil nil to-method
)
11249 (gnus-subscribe-group to-newsgroup
))
11250 (error "Couldn't create group %s" to-newsgroup
)))
11251 (error "No such group: %s" to-newsgroup
)))
11254 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
11255 "Save parts matching TYPE to DIR.
11256 If REVERSE, save parts that do not match TYPE."
11258 (list (read-string "Save parts of type: "
11259 (or (car gnus-summary-save-parts-type-history
)
11260 gnus-summary-save-parts-default-mime
)
11261 'gnus-summary-save-parts-type-history
)
11262 (setq gnus-summary-save-parts-last-directory
11263 (read-file-name "Save to directory: "
11264 gnus-summary-save-parts-last-directory
11266 current-prefix-arg
))
11267 (gnus-summary-iterate n
11268 (let ((gnus-display-mime-function nil
)
11269 (gnus-inhibit-treatment t
))
11270 (gnus-summary-select-article))
11272 (set-buffer gnus-article-buffer
)
11273 (let ((handles (or gnus-article-mime-handles
11274 (mm-dissect-buffer nil gnus-article-loose-mime
)
11275 (and gnus-article-emulate-mime
11276 (mm-uu-dissect)))))
11278 (gnus-summary-save-parts-1 type dir handles reverse
)
11279 (unless gnus-article-mime-handles
;; Don't destroy this case.
11280 (mm-destroy-parts handles
)))))))
11282 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
11283 (if (stringp (car handle
))
11284 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
11287 (not (string-match type
(mm-handle-media-type handle
)))
11288 (string-match type
(mm-handle-media-type handle
)))
11289 (let ((file (expand-file-name
11291 mm-file-name-rewrite-functions
11292 (file-name-nondirectory
11294 (mail-content-type-get
11295 (mm-handle-disposition handle
) 'filename
)
11296 (mail-content-type-get
11297 (mm-handle-type handle
) 'name
)
11298 (concat gnus-newsgroup-name
11299 "." (number-to-string
11300 (cdr gnus-article-current
))))))
11302 (unless (file-exists-p file
)
11303 (mm-save-part-to-file handle file
))))))
11305 ;; Summary extract commands
11307 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
11308 (let ((buffer-read-only nil
)
11309 (article (gnus-summary-article-number))
11311 (unless (gnus-summary-goto-subject article
)
11312 (error "No such article: %d" article
))
11313 (gnus-summary-position-point)
11314 ;; If all commands are to be bunched up on one line, we collect
11316 (unless gnus-view-pseudos-separately
11317 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
11320 (setq action
(cdr (assq 'action
(car ps
))))
11321 (setq files
(list (cdr (assq 'name
(car ps
)))))
11322 (while (and ps
(cdr ps
)
11323 (string= (or action
"1")
11324 (or (cdr (assq 'action
(cadr ps
))) "2")))
11325 (push (cdr (assq 'name
(cadr ps
))) files
)
11326 (setcdr ps
(cddr ps
)))
11328 (when (not (string-match "%s" action
))
11331 (when (assq 'execute
(car ps
))
11332 (setcdr (assq 'execute
(car ps
))
11333 (funcall (if (string-match "%s" action
)
11342 (setq ps
(cdr ps
)))))
11343 (if (and gnus-view-pseudos
(not not-view
))
11345 (when (assq 'execute
(car pslist
))
11346 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
11347 (eq gnus-view-pseudos
'not-confirm
)))
11348 (setq pslist
(cdr pslist
)))
11351 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
11352 (gnus-summary-article-number)))
11353 (gnus-summary-goto-subject after-article
)
11356 (insert " " (file-name-nondirectory
11357 (cdr (assq 'name
(car pslist
))))
11358 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
11360 (forward-line -
1) ; back to `b'
11361 (gnus-add-text-properties
11362 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
11363 gnus-mouse-face-prop gnus-mouse-face
))
11365 after-article gnus-reffed-article-number
11366 gnus-unread-mark b
(car pslist
) 0 (- e b
))
11367 (setq gnus-newsgroup-unreads
11368 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11369 gnus-reffed-article-number
))
11370 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
11371 (setq pslist
(cdr pslist
)))))))
11373 (defun gnus-pseudos< (p1 p2
)
11374 (let ((c1 (cdr (assq 'action p1
)))
11375 (c2 (cdr (assq 'action p2
))))
11376 (and c1 c2
(string< c1 c2
))))
11378 (defun gnus-request-pseudo-article (props)
11379 (cond ((assq 'execute props
)
11380 (gnus-execute-command (cdr (assq 'execute props
)))))
11381 (let ((gnus-current-article (gnus-summary-article-number)))
11382 (gnus-run-hooks 'gnus-mark-article-hook
)))
11384 (defun gnus-execute-command (command &optional automatic
)
11386 (gnus-article-setup-buffer)
11387 (set-buffer gnus-article-buffer
)
11388 (setq buffer-read-only nil
)
11389 (let ((command (if automatic command
11390 (read-string "Command: " (cons command
0)))))
11392 (insert "$ " command
"\n\n")
11393 (if gnus-view-pseudo-asynchronously
11394 (start-process "gnus-execute" (current-buffer) shell-file-name
11395 shell-command-switch command
)
11396 (call-process shell-file-name nil t nil
11397 shell-command-switch command
)))))
11399 ;; Summary kill commands.
11401 (defun gnus-summary-edit-global-kill (article)
11402 "Edit the \"global\" kill file."
11403 (interactive (list (gnus-summary-article-number)))
11404 (gnus-group-edit-global-kill article
))
11406 (defun gnus-summary-edit-local-kill ()
11407 "Edit a local kill file applied to the current newsgroup."
11409 (setq gnus-current-headers
(gnus-summary-article-header))
11410 (gnus-group-edit-local-kill
11411 (gnus-summary-article-number) gnus-newsgroup-name
))
11413 ;;; Header reading.
11415 (defun gnus-read-header (id &optional header
)
11416 "Read the headers of article ID and enter them into the Gnus system."
11417 (let ((group gnus-newsgroup-name
)
11418 (gnus-override-method
11420 gnus-override-method
11421 (and (gnus-news-group-p gnus-newsgroup-name
)
11422 (car (gnus-refer-article-methods)))))
11424 ;; First we check to see whether the header in question is already
11427 ;; This is a Message-ID.
11428 (setq header
(or header
(gnus-id-to-header id
)))
11429 ;; This is an article number.
11430 (setq header
(or header
(gnus-summary-article-header id
))))
11432 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
11433 ;; We have found the header.
11435 ;; We have to really fetch the header to this article.
11437 (set-buffer nntp-server-buffer
)
11438 (when (setq where
(gnus-request-head id group
))
11439 (nnheader-fold-continuation-lines)
11440 (goto-char (point-max))
11442 (goto-char (point-min))
11446 ((cdr where
) (cdr where
))
11447 (header (mail-header-number header
))
11448 (t gnus-reffed-article-number
))
11450 (insert " Article retrieved.\n"))
11451 (if (or (not where
)
11452 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
11453 () ; Malformed head.
11454 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
11455 (when (and (stringp id
)
11456 (not (string= (gnus-group-real-name group
)
11458 ;; If we fetched by Message-ID and the article came
11459 ;; from a different group, we fudge some bogus article
11460 ;; numbers for this article.
11461 (mail-header-set-number header gnus-reffed-article-number
))
11463 (set-buffer gnus-summary-buffer
)
11464 (decf gnus-reffed-article-number
)
11465 (gnus-remove-header (mail-header-number header
))
11466 (push header gnus-newsgroup-headers
)
11467 (setq gnus-current-headers header
)
11468 (push (mail-header-number header
) gnus-newsgroup-limit
)))
11471 (defun gnus-remove-header (number)
11472 "Remove header NUMBER from `gnus-newsgroup-headers'."
11473 (if (and gnus-newsgroup-headers
11474 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
11475 (pop gnus-newsgroup-headers
)
11476 (let ((headers gnus-newsgroup-headers
))
11477 (while (and (cdr headers
)
11478 (not (= number
(mail-header-number (cadr headers
)))))
11480 (when (cdr headers
)
11481 (setcdr headers
(cddr headers
))))))
11484 ;;; summary highlights
11487 (defun gnus-highlight-selected-summary ()
11488 "Highlight selected article in summary buffer."
11489 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11490 (when gnus-summary-selected-face
11492 (let* ((beg (gnus-point-at-bol))
11493 (end (gnus-point-at-eol))
11494 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11495 (from (if (get-text-property beg gnus-mouse-face-prop
)
11497 (or (next-single-property-change
11498 beg gnus-mouse-face-prop nil end
)
11503 (or (next-single-property-change
11504 from gnus-mouse-face-prop nil end
)
11506 ;; If no mouse-face prop on line we will have to = from = end,
11507 ;; so we highlight the entire line instead.
11508 (when (= (+ to
2) from
)
11511 (if gnus-newsgroup-selected-overlay
11512 ;; Move old overlay.
11514 gnus-newsgroup-selected-overlay from to
(current-buffer))
11515 ;; Create new overlay.
11517 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
11518 'face gnus-summary-selected-face
))))))
11520 (defvar gnus-summary-highlight-line-cached nil
)
11521 (defvar gnus-summary-highlight-line-trigger nil
)
11523 (defun gnus-summary-highlight-line-0 ()
11524 (if (and (eq gnus-summary-highlight-line-trigger
11525 gnus-summary-highlight
)
11526 gnus-summary-highlight-line-cached
)
11527 gnus-summary-highlight-line-cached
11528 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11529 gnus-summary-highlight-line-cached
11530 (let* ((cond (list 'cond
))
11532 (list gnus-summary-highlight
))
11534 (setcdr c
(cons (list (caar list
) (list 'quote
(cdar list
)))
11538 (gnus-byte-compile (list 'lambda nil cond
))))))
11540 (defun gnus-summary-highlight-line ()
11541 "Highlight current line according to `gnus-summary-highlight'."
11542 (let* ((beg (gnus-point-at-bol))
11543 (article (or (gnus-summary-article-number) gnus-current-article
))
11544 (score (or (cdr (assq article
11545 gnus-newsgroup-scored
))
11546 gnus-summary-default-score
0))
11547 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
11548 (inhibit-read-only t
)
11549 (default gnus-summary-default-score
)
11550 (default-high gnus-summary-default-high-score
)
11551 (default-low gnus-summary-default-low-score
)
11552 (uncached (and gnus-summary-use-undownloaded-faces
11553 (memq article gnus-newsgroup-undownloaded
)
11554 (not (memq article gnus-newsgroup-cached
)))))
11555 (let ((face (funcall (gnus-summary-highlight-line-0))))
11556 (unless (eq face
(get-text-property beg
'face
))
11557 (gnus-put-text-property-excluding-characters-with-faces
11558 beg
(gnus-point-at-eol) 'face
11559 (setq face
(if (boundp face
) (symbol-value face
) face
)))
11560 (when gnus-summary-highlight-line-function
11561 (funcall gnus-summary-highlight-line-function article face
))))))
11563 (defun gnus-update-read-articles (group unread
&optional compute
)
11564 "Update the list of read articles in GROUP.
11565 UNREAD is a sorted list."
11566 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
11567 (entry (gnus-gethash group gnus-newsrc-hashtb
))
11568 (info (nth 2 entry
))
11571 (if (or (not info
) (not active
))
11572 ;; There is no info on this group if it was, in fact,
11573 ;; killed. Gnus stores no information on killed groups, so
11574 ;; there's nothing to be done.
11575 ;; One could store the information somewhere temporarily,
11576 ;; perhaps... Hmmm...
11578 ;; Remove any negative articles numbers.
11579 (while (and unread
(< (car unread
) 0))
11580 (setq unread
(cdr unread
)))
11581 ;; Remove any expired article numbers
11582 (while (and unread
(< (car unread
) (car active
)))
11583 (setq unread
(cdr unread
)))
11584 ;; Compute the ranges of read articles by looking at the list of
11585 ;; unread articles.
11587 (when (/= (car unread
) prev
)
11588 (push (if (= prev
(1- (car unread
))) prev
11589 (cons prev
(1- (car unread
))))
11591 (setq prev
(1+ (car unread
)))
11592 (setq unread
(cdr unread
)))
11593 (when (<= prev
(cdr active
))
11594 (push (cons prev
(cdr active
)) read
))
11595 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
11600 ;; Propagate the read marks to the backend.
11601 (when (gnus-check-backend-function 'request-set-mark group
)
11602 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
11603 (add (gnus-remove-from-range read
(gnus-info-read info
))))
11605 (unless (gnus-check-group group
)
11606 (error "Can't open server for %s" group
))
11607 (gnus-request-set-mark
11608 group
(delq nil
(list (if add
(list add
'add
'(read)))
11609 (if del
(list del
'del
'(read))))))
11611 `(gnus-request-set-mark
11614 (if del
(list del
'add
'(read)))
11615 (if add
(list add
'del
'(read))))))))))
11616 (set-buffer gnus-group-buffer
)
11617 (gnus-undo-register
11619 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
11620 (gnus-info-set-read ',info
',(gnus-info-read info
))
11621 (gnus-get-unread-articles-in-group ',info
11622 (gnus-active ,group
))
11623 (gnus-group-update-group ,group t
)
11625 ;; Enter this list into the group info.
11626 (gnus-info-set-read info read
)
11627 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11628 (gnus-get-unread-articles-in-group info
(gnus-active group
))
11631 (defun gnus-offer-save-summaries ()
11632 "Offer to save all active summary buffers."
11634 ;; Go through all buffers and find all summaries.
11635 (dolist (buffer (buffer-list))
11636 (when (and (setq buffer
(buffer-name buffer
))
11637 (string-match "Summary" buffer
)
11639 (set-buffer buffer
)
11640 ;; We check that this is, indeed, a summary buffer.
11641 (and (eq major-mode
'gnus-summary-mode
)
11642 ;; Also make sure this isn't bogus.
11643 gnus-newsgroup-prepared
11644 ;; Also make sure that this isn't a
11645 ;; dead summary buffer.
11646 (not gnus-dead-summary-mode
))))
11647 (push buffer buffers
)))
11648 ;; Go through all these summary buffers and offer to save them.
11652 "Update summary buffer %s? "
11654 (switch-to-buffer buf
)
11655 (gnus-summary-exit))
11658 (defun gnus-summary-setup-default-charset ()
11659 "Setup newsgroup default charset."
11660 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
11661 (setq gnus-newsgroup-charset nil
)
11662 (let* ((ignored-charsets
11663 (or gnus-newsgroup-ephemeral-ignored-charsets
11665 (and gnus-newsgroup-name
11666 (gnus-parameter-ignored-charsets gnus-newsgroup-name
))
11667 gnus-newsgroup-ignored-charsets
))))
11668 (setq gnus-newsgroup-charset
11669 (or gnus-newsgroup-ephemeral-charset
11670 (and gnus-newsgroup-name
11671 (gnus-parameter-charset gnus-newsgroup-name
))
11672 gnus-default-charset
))
11673 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
11674 ignored-charsets
))))
11680 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
11681 "Display the current article buffer fully MIME-buttonized.
11682 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11683 treated as multipart/mixed."
11685 (require 'gnus-art
)
11686 (let ((gnus-unbuttonized-mime-types nil
)
11687 (gnus-mime-display-multipart-as-mixed show-all-parts
))
11688 (gnus-summary-show-article)))
11690 (defun gnus-summary-repair-multipart (article)
11691 "Add a Content-Type header to a multipart article without one."
11692 (interactive (list (gnus-summary-article-number)))
11693 (gnus-with-article article
11694 (message-narrow-to-head)
11695 (message-remove-header "Mime-Version")
11696 (goto-char (point-max))
11697 (insert "Mime-Version: 1.0\n")
11699 (when (search-forward "\n--" nil t
)
11700 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11701 (message-narrow-to-head)
11702 (message-remove-header "Content-Type")
11703 (goto-char (point-max))
11704 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11707 (let (gnus-mark-article-hook)
11708 (gnus-summary-select-article t t nil article
)))
11710 (defun gnus-summary-toggle-display-buttonized ()
11711 "Toggle the buttonizing of the article buffer."
11713 (require 'gnus-art
)
11714 (if (setq gnus-inhibit-mime-unbuttonizing
11715 (not gnus-inhibit-mime-unbuttonizing
))
11716 (let ((gnus-unbuttonized-mime-types nil
))
11717 (gnus-summary-show-article))
11718 (gnus-summary-show-article)))
11721 ;;; Generic summary marking commands
11724 (defvar gnus-summary-marking-alist
11725 '((read gnus-del-mark
"d")
11726 (unread gnus-unread-mark
"u")
11727 (ticked gnus-ticked-mark
"!")
11728 (dormant gnus-dormant-mark
"?")
11729 (expirable gnus-expirable-mark
"e"))
11730 "An alist of names/marks/keystrokes.")
11732 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
11733 (defvar gnus-summary-mark-map
)
11735 (defun gnus-summary-make-all-marking-commands ()
11736 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
11737 (dolist (elem gnus-summary-marking-alist
)
11738 (apply 'gnus-summary-make-marking-command elem
)))
11740 (defun gnus-summary-make-marking-command (name mark keystroke
)
11741 (let ((map (make-sparse-keymap)))
11742 (define-key gnus-summary-generic-mark-map keystroke map
)
11743 (dolist (lway `((next "next" next nil
"n")
11744 (next-unread "next unread" next t
"N")
11745 (prev "previous" prev nil
"p")
11746 (prev-unread "previous unread" prev t
"P")
11747 (nomove "" nil nil
,keystroke
)))
11748 (let ((func (gnus-summary-make-marking-command-1
11749 mark
(car lway
) lway name
)))
11750 (setq func
(eval func
))
11751 (define-key map
(nth 4 lway
) func
)))))
11753 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
11755 (format "gnus-summary-put-mark-as-%s%s"
11756 name
(if (eq way
'nomove
)
11758 (concat "-" (symbol-name way
)))))
11761 "Mark the current article as %s%s.
11762 If N, the prefix, then repeat N times.
11763 If N is negative, move in reverse order.
11764 The difference between N and the actual number of articles marked is
11768 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
11770 (defun gnus-summary-generic-mark (n mark move unread
)
11771 "Mark N articles with MARK."
11772 (unless (eq major-mode
'gnus-summary-mode
)
11773 (error "This command can only be used in the summary buffer"))
11774 (gnus-summary-show-thread)
11777 ((eq move
'next
) 1)
11778 ((eq move
'prev
) -
1)
11780 (if (zerop nummove
)
11784 nummove
(* -
1 nummove
))))
11785 (while (and (> n
0)
11786 (gnus-summary-mark-article nil mark
)
11787 (zerop (gnus-summary-next-subject nummove unread t
)))
11790 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
11791 (gnus-summary-recenter)
11792 (gnus-summary-position-point)
11793 (gnus-set-mode-line 'summary
)
11796 (defun gnus-summary-insert-articles (articles)
11797 (when (setq articles
11798 (gnus-sorted-difference articles
11799 (mapcar (lambda (h)
11800 (mail-header-number h
))
11801 gnus-newsgroup-headers
)))
11802 (setq gnus-newsgroup-headers
11804 gnus-newsgroup-headers
11805 (gnus-fetch-headers articles
)
11806 'gnus-article-sort-by-number
))
11807 ;; Suppress duplicates?
11808 (when gnus-suppress-duplicates
11809 (gnus-dup-suppress-articles))
11811 ;; We might want to build some more threads first.
11812 (when (and gnus-fetch-old-headers
11813 (eq gnus-headers-retrieved-by
'nov
))
11814 (if (eq gnus-fetch-old-headers
'invisible
)
11815 (gnus-build-all-threads)
11816 (gnus-build-old-threads)))
11817 ;; Let the Gnus agent mark articles as read.
11819 (gnus-agent-get-undownloaded-list))
11820 ;; Remove list identifiers from subject
11821 (when gnus-list-identifiers
11822 (gnus-summary-remove-list-identifiers))
11823 ;; First and last article in this newsgroup.
11824 (when gnus-newsgroup-headers
11825 (setq gnus-newsgroup-begin
11826 (mail-header-number (car gnus-newsgroup-headers
))
11828 (mail-header-number
11829 (gnus-last-element gnus-newsgroup-headers
))))
11830 (when gnus-use-scoring
11831 (gnus-possibly-score-headers))))
11833 (defun gnus-summary-insert-old-articles (&optional all
)
11834 "Insert all old articles in this group.
11835 If ALL is non-nil, already read articles become readable.
11836 If ALL is a number, fetch this number of articles."
11839 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11842 ;; Some nntp servers lie about their active range. When
11843 ;; this happens, the active range can be in the millions.
11844 ;; Use a compressed range to avoid creating a huge list.
11845 (gnus-range-difference (list gnus-newsgroup-active
) old
))
11846 (setq len
(gnus-range-length older
))
11851 (let ((older-range (nreverse older
)))
11855 (let* ((r (pop older-range
))
11856 (min (if (numberp r
) r
(car r
)))
11857 (max (if (numberp r
) r
(cdr r
))))
11858 (while (and (<= min max
)
11863 (setq older
(gnus-uncompress-range older
))))
11865 (setq older
(gnus-uncompress-range older
)))
11867 (when (and (numberp gnus-large-newsgroup
)
11868 (> len gnus-large-newsgroup
))
11869 (let* ((cursor-in-echo-area nil
)
11870 (initial (gnus-parameter-large-newsgroup-initial
11871 gnus-newsgroup-name
))
11875 "How many articles from %s (%s %d): "
11877 (gnus-group-decoded-name gnus-newsgroup-name
) 35)
11878 (if initial
"max" "default")
11881 (cons (number-to-string initial
)
11883 (unless (string-match "^[ \t]*$" input
)
11884 (setq all
(string-to-number input
))
11886 (let ((older-range (nreverse older
)))
11890 (let* ((r (pop older-range
))
11891 (min (if (numberp r
) r
(car r
)))
11892 (max (if (numberp r
) r
(cdr r
))))
11893 (while (and (<= min max
)
11897 max
(1- max
))))))))))
11898 (setq older
(gnus-uncompress-range older
))))
11900 (message "No old news.")
11901 (gnus-summary-insert-articles older
)
11902 (gnus-summary-limit (gnus-sorted-nunion old older
))))
11903 (gnus-summary-position-point)))
11905 (defun gnus-summary-insert-new-articles ()
11906 "Insert all new articles in this group."
11909 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11910 (old-active gnus-newsgroup-active
)
11911 (nnmail-fetched-sources (list t
))
11913 (setq gnus-newsgroup-active
11914 (gnus-activate-group gnus-newsgroup-name
'scan
))
11915 (setq i
(cdr gnus-newsgroup-active
))
11916 (while (> i
(cdr old-active
))
11920 (message "No gnus is bad news.")
11921 (gnus-summary-insert-articles new
)
11922 (setq gnus-newsgroup-unreads
11923 (gnus-sorted-nunion gnus-newsgroup-unreads new
))
11924 (gnus-summary-limit (gnus-sorted-nunion old new
))))
11925 (gnus-summary-position-point)))
11927 (gnus-summary-make-all-marking-commands)
11929 (gnus-ems-redefine)
11931 (provide 'gnus-sum
)
11933 (run-hooks 'gnus-sum-load-hook
)
11935 ;; Local Variables:
11936 ;; coding: iso-8859-1
11939 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11940 ;;; gnus-sum.el ends here