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 "Variable that says which function should be used to decode a string with encoded words.")
997 (defcustom gnus-extra-headers
'(To Newsgroups
)
998 "*Extra headers to parse."
1000 :group
'gnus-summary
1001 :type
'(repeat symbol
))
1003 (defcustom gnus-ignored-from-addresses
1004 (and user-mail-address
1005 (not (string= user-mail-address
""))
1006 (regexp-quote user-mail-address
))
1007 "*Regexp of From headers that may be suppressed in favor of To headers."
1009 :group
'gnus-summary
1012 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1013 "List of charsets that should be ignored.
1014 When these charsets are used in the \"charset\" parameter, the
1015 default charset will be used instead."
1017 :type
'(repeat symbol
)
1018 :group
'gnus-charset
)
1020 (gnus-define-group-parameter
1024 "Return the ignored charsets of GROUP."
1025 :variable gnus-group-ignored-charsets-alist
1027 '(("alt\\.chinese\\.text" iso-8859-1
))
1029 "Alist of regexps (to match group names) and charsets that should be ignored.
1030 When these charsets are used in the \"charset\" parameter, the
1031 default charset will be used instead."
1032 :variable-group gnus-charset
1033 :variable-type
'(repeat (cons (regexp :tag
"Group")
1035 :parameter-type
'(choice :tag
"Ignored charsets"
1038 :parameter-document
"\
1039 List of charsets that should be ignored.
1041 When these charsets are used in the \"charset\" parameter, the
1042 default charset will be used instead.")
1044 (defcustom gnus-group-highlight-words-alist nil
1045 "Alist of group regexps and highlight regexps.
1046 This variable uses the same syntax as `gnus-emphasis-alist'."
1048 :type
'(repeat (cons (regexp :tag
"Group")
1049 (repeat (list (regexp :tag
"Highlight regexp")
1050 (number :tag
"Group for entire word" 0)
1051 (number :tag
"Group for displayed part" 0)
1053 gnus-emphasis-highlight-words
)))))
1054 :group
'gnus-summary-visual
)
1056 (defcustom gnus-summary-show-article-charset-alist
1058 "Alist of number and charset.
1059 The article will be shown with the charset corresponding to the
1061 For example: ((1 . cn-gb-2312) (2 . big5))."
1063 :type
'(repeat (cons (number :tag
"Argument" 1)
1064 (symbol :tag
"Charset")))
1065 :group
'gnus-charset
)
1067 (defcustom gnus-preserve-marks t
1068 "Whether marks are preserved when moving, copying and respooling messages."
1071 :group
'gnus-summary-marks
)
1073 (defcustom gnus-alter-articles-to-read-function nil
1074 "Function to be called to alter the list of articles to be selected."
1075 :type
'(choice (const nil
) function
)
1076 :group
'gnus-summary
)
1078 (defcustom gnus-orphan-score nil
1079 "*All orphans get this score added. Set in the score file."
1080 :group
'gnus-score-default
1081 :type
'(choice (const nil
)
1084 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1085 "*A regexp to match MIME parts when saving multiple parts of a
1086 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1087 This regexp will be used by default when prompting the user for which
1088 type of files to save."
1089 :group
'gnus-summary
1092 (defcustom gnus-read-all-available-headers nil
1093 "Whether Gnus should parse all headers made available to it.
1094 This is mostly relevant for slow back ends where the user may
1095 wish to widen the summary buffer to include all headers
1096 that were fetched. Say, for nnultimate groups."
1098 :group
'gnus-summary
1099 :type
'(choice boolean regexp
))
1101 (defcustom gnus-summary-muttprint-program
"muttprint"
1102 "Command (and optional arguments) used to run Muttprint."
1104 :group
'gnus-summary
1107 (defcustom gnus-article-loose-mime nil
1108 "If non-nil, don't require MIME-Version header.
1109 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1110 supply the MIME-Version header or deliberately strip it from the mail.
1111 Set it to non-nil, Gnus will treat some articles as MIME even if
1112 the MIME-Version header is missed."
1115 :group
'gnus-article-mime
)
1117 (defcustom gnus-article-emulate-mime t
1118 "If non-nil, use MIME emulation for uuencode and the like.
1119 This means that Gnus will search message bodies for text that look
1120 like uuencoded bits, yEncoded bits, and so on, and present that using
1121 the normal Gnus MIME machinery."
1124 :group
'gnus-article-mime
)
1126 ;;; Internal variables
1128 (defvar gnus-summary-display-cache nil
)
1129 (defvar gnus-article-mime-handles nil
)
1130 (defvar gnus-article-decoded-p nil
)
1131 (defvar gnus-article-charset nil
)
1132 (defvar gnus-article-ignored-charsets nil
)
1133 (defvar gnus-scores-exclude-files nil
)
1134 (defvar gnus-page-broken nil
)
1136 (defvar gnus-original-article nil
)
1137 (defvar gnus-article-internal-prepare-hook nil
)
1138 (defvar gnus-newsgroup-process-stack nil
)
1140 (defvar gnus-thread-indent-array nil
)
1141 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1142 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1143 "Function called to sort the articles within a thread after it has been gathered together.")
1145 (defvar gnus-summary-save-parts-type-history nil
)
1146 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1148 ;; Avoid highlighting in kill files.
1149 (defvar gnus-summary-inhibit-highlight nil
)
1150 (defvar gnus-newsgroup-selected-overlay nil
)
1151 (defvar gnus-inhibit-limiting nil
)
1152 (defvar gnus-newsgroup-adaptive-score-file nil
)
1153 (defvar gnus-current-score-file nil
)
1154 (defvar gnus-current-move-group nil
)
1155 (defvar gnus-current-copy-group nil
)
1156 (defvar gnus-current-crosspost-group nil
)
1157 (defvar gnus-newsgroup-display nil
)
1159 (defvar gnus-newsgroup-dependencies nil
)
1160 (defvar gnus-newsgroup-adaptive nil
)
1161 (defvar gnus-summary-display-article-function nil
)
1162 (defvar gnus-summary-highlight-line-function nil
1163 "Function called after highlighting a summary line.")
1165 (defvar gnus-summary-line-format-alist
1166 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1167 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1168 (?s gnus-tmp-subject-or-nil ?s
)
1169 (?n gnus-tmp-name ?s
)
1170 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1172 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1174 (?F gnus-tmp-from ?s
)
1175 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1176 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1177 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1178 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1179 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1180 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1181 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1182 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1183 (?L gnus-tmp-lines ?s
)
1184 (?O gnus-tmp-downloaded ?c
)
1185 (?I gnus-tmp-indentation ?s
)
1186 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1187 (?R gnus-tmp-replied ?c
)
1188 (?\
[ gnus-tmp-opening-bracket ?c
)
1189 (?\
] gnus-tmp-closing-bracket ?c
)
1190 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1191 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1192 (?i gnus-tmp-score ?d
)
1193 (?z gnus-tmp-score-char ?c
)
1194 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
1195 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1196 (?U gnus-tmp-unread ?c
)
1197 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1199 (?t
(gnus-summary-number-of-articles-in-thread
1200 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1202 (?e
(gnus-summary-number-of-articles-in-thread
1203 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1205 (?u gnus-tmp-user-defined ?s
)
1206 (?P
(gnus-pick-line-number) ?d
)
1207 (?B gnus-tmp-thread-tree-header-string ?s
)
1208 (user-date (gnus-user-date
1209 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1210 "An alist of format specifications that can appear in summary lines.
1211 These are paired with what variables they correspond with, along with
1212 the type of the variable (string, integer, character, etc).")
1214 (defvar gnus-summary-dummy-line-format-alist
1215 `((?S gnus-tmp-subject ?s
)
1216 (?N gnus-tmp-number ?d
)
1217 (?u gnus-tmp-user-defined ?s
)))
1219 (defvar gnus-summary-mode-line-format-alist
1220 `((?G gnus-tmp-group-name ?s
)
1221 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1222 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1223 (?A gnus-tmp-article-number ?d
)
1224 (?Z gnus-tmp-unread-and-unselected ?s
)
1225 (?V gnus-version ?s
)
1226 (?U gnus-tmp-unread-and-unticked ?d
)
1227 (?S gnus-tmp-subject ?s
)
1228 (?e gnus-tmp-unselected ?d
)
1229 (?u gnus-tmp-user-defined ?s
)
1230 (?d
(length gnus-newsgroup-dormant
) ?d
)
1231 (?t
(length gnus-newsgroup-marked
) ?d
)
1232 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1233 (?r
(length gnus-newsgroup-reads
) ?d
)
1234 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1235 (?E gnus-newsgroup-expunged-tally ?d
)
1236 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1238 (defvar gnus-last-search-regexp nil
1239 "Default regexp for article search command.")
1241 (defvar gnus-last-shell-command nil
1242 "Default shell command on article.")
1244 (defvar gnus-newsgroup-agentized nil
1245 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1246 (defvar gnus-newsgroup-begin nil
)
1247 (defvar gnus-newsgroup-end nil
)
1248 (defvar gnus-newsgroup-last-rmail nil
)
1249 (defvar gnus-newsgroup-last-mail nil
)
1250 (defvar gnus-newsgroup-last-folder nil
)
1251 (defvar gnus-newsgroup-last-file nil
)
1252 (defvar gnus-newsgroup-last-directory nil
)
1253 (defvar gnus-newsgroup-auto-expire nil
)
1254 (defvar gnus-newsgroup-active nil
)
1256 (defvar gnus-newsgroup-data nil
)
1257 (defvar gnus-newsgroup-data-reverse nil
)
1258 (defvar gnus-newsgroup-limit nil
)
1259 (defvar gnus-newsgroup-limits nil
)
1260 (defvar gnus-summary-use-undownloaded-faces nil
)
1262 (defvar gnus-newsgroup-unreads nil
1263 "Sorted list of unread articles in the current newsgroup.")
1265 (defvar gnus-newsgroup-unselected nil
1266 "Sorted list of unselected unread articles in the current newsgroup.")
1268 (defvar gnus-newsgroup-reads nil
1269 "Alist of read articles and article marks in the current newsgroup.")
1271 (defvar gnus-newsgroup-expunged-tally nil
)
1273 (defvar gnus-newsgroup-marked nil
1274 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1276 (defvar gnus-newsgroup-spam-marked nil
1277 "List of ranges of articles that have been marked as spam.")
1279 (defvar gnus-newsgroup-killed nil
1280 "List of ranges of articles that have been through the scoring process.")
1282 (defvar gnus-newsgroup-cached nil
1283 "Sorted list of articles that come from the article cache.")
1285 (defvar gnus-newsgroup-saved nil
1286 "List of articles that have been saved.")
1288 (defvar gnus-newsgroup-kill-headers nil
)
1290 (defvar gnus-newsgroup-replied nil
1291 "List of articles that have been replied to in the current newsgroup.")
1293 (defvar gnus-newsgroup-forwarded nil
1294 "List of articles that have been forwarded in the current newsgroup.")
1296 (defvar gnus-newsgroup-recent nil
1297 "List of articles that have are recent in the current newsgroup.")
1299 (defvar gnus-newsgroup-expirable nil
1300 "Sorted list of articles in the current newsgroup that can be expired.")
1302 (defvar gnus-newsgroup-processable nil
1303 "List of articles in the current newsgroup that can be processed.")
1305 (defvar gnus-newsgroup-downloadable nil
1306 "Sorted list of articles in the current newsgroup that can be processed.")
1308 (defvar gnus-newsgroup-unfetched nil
1309 "Sorted list of articles in the current newsgroup whose headers have
1310 not been fetched into the agent.
1312 This list will always be a subset of gnus-newsgroup-undownloaded.")
1314 (defvar gnus-newsgroup-undownloaded nil
1315 "List of articles in the current newsgroup that haven't been downloaded.")
1317 (defvar gnus-newsgroup-unsendable nil
1318 "List of articles in the current newsgroup that won't be sent.")
1320 (defvar gnus-newsgroup-bookmarks nil
1321 "List of articles in the current newsgroup that have bookmarks.")
1323 (defvar gnus-newsgroup-dormant nil
1324 "Sorted list of dormant articles in the current newsgroup.")
1326 (defvar gnus-newsgroup-unseen nil
1327 "List of unseen articles in the current newsgroup.")
1329 (defvar gnus-newsgroup-seen nil
1330 "Range of seen articles in the current newsgroup.")
1332 (defvar gnus-newsgroup-articles nil
1333 "List of articles in the current newsgroup.")
1335 (defvar gnus-newsgroup-scored nil
1336 "List of scored articles in the current newsgroup.")
1338 (defvar gnus-newsgroup-headers nil
1339 "List of article headers in the current newsgroup.")
1341 (defvar gnus-newsgroup-threads nil
)
1343 (defvar gnus-newsgroup-prepared nil
1344 "Whether the current group has been prepared properly.")
1346 (defvar gnus-newsgroup-ancient nil
1347 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1349 (defvar gnus-newsgroup-sparse nil
)
1351 (defvar gnus-current-article nil
)
1352 (defvar gnus-article-current nil
)
1353 (defvar gnus-current-headers nil
)
1354 (defvar gnus-have-all-headers nil
)
1355 (defvar gnus-last-article nil
)
1356 (defvar gnus-newsgroup-history nil
)
1357 (defvar gnus-newsgroup-charset nil
)
1358 (defvar gnus-newsgroup-ephemeral-charset nil
)
1359 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1361 (defvar gnus-article-before-search nil
)
1363 (defvar gnus-summary-local-variables
1364 '(gnus-newsgroup-name
1365 gnus-newsgroup-begin gnus-newsgroup-end
1366 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1367 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1368 gnus-newsgroup-last-directory
1369 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1370 gnus-newsgroup-unselected gnus-newsgroup-marked
1371 gnus-newsgroup-spam-marked
1372 gnus-newsgroup-reads gnus-newsgroup-saved
1373 gnus-newsgroup-replied gnus-newsgroup-forwarded
1374 gnus-newsgroup-recent
1375 gnus-newsgroup-expirable
1376 gnus-newsgroup-processable gnus-newsgroup-killed
1377 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1378 gnus-newsgroup-unfetched
1379 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1380 gnus-newsgroup-seen gnus-newsgroup-articles
1381 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1382 gnus-newsgroup-headers gnus-newsgroup-threads
1383 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1384 gnus-current-article gnus-current-headers gnus-have-all-headers
1385 gnus-last-article gnus-article-internal-prepare-hook
1386 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1387 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1388 gnus-thread-expunge-below
1389 gnus-score-alist gnus-current-score-file
1390 (gnus-summary-expunge-below . global
)
1391 (gnus-summary-mark-below . global
)
1392 (gnus-orphan-score . global
)
1393 gnus-newsgroup-active gnus-scores-exclude-files
1394 gnus-newsgroup-history gnus-newsgroup-ancient
1395 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1396 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1397 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1398 (gnus-newsgroup-expunged-tally .
0)
1399 gnus-cache-removable-articles gnus-newsgroup-cached
1400 gnus-newsgroup-data gnus-newsgroup-data-reverse
1401 gnus-newsgroup-limit gnus-newsgroup-limits
1402 gnus-newsgroup-charset gnus-newsgroup-display
1403 gnus-summary-use-undownloaded-faces
)
1404 "Variables that are buffer-local to the summary buffers.")
1406 (defvar gnus-newsgroup-variables nil
1407 "A list of variables that have separate values in different newsgroups.
1408 A list of newsgroup (summary buffer) local variables, or cons of
1409 variables and their default expressions to be evalled (when the default
1410 values are not nil), that should be made global while the summary buffer
1413 Note: The default expressions will be evaluated (using function `eval')
1414 before assignment to the local variable rather than just assigned to it.
1415 If the default expression is the symbol `global', that symbol will not
1416 be evaluated but the global value of the local variable will be used
1419 These variables can be used to set variables in the group parameters
1420 while still allowing them to affect operations done in other buffers.
1423 \(setq gnus-newsgroup-variables
1424 '(message-use-followup-to
1425 (gnus-visible-headers .
1426 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1429 ;; Byte-compiler warning.
1431 ;; Bind features so that require will believe that gnus-sum has
1432 ;; already been loaded (avoids infinite recursion)
1433 (let ((features (cons 'gnus-sum features
)))
1434 ;; Several of the declarations in gnus-sum are needed to load the
1435 ;; following files. Right now, these definitions have been
1436 ;; compiled but not defined (evaluated). We could either do a
1437 ;; eval-and-compile about all of the declarations or evaluate the
1439 (if (boundp 'gnus-newsgroup-variables
)
1441 (load "gnus-sum.el" t t t
))
1443 (require 'gnus-agent
)
1444 (require 'gnus-art
)))
1448 (defvar gnus-decode-encoded-word-methods
1449 '(mail-decode-encoded-word-string)
1450 "List of methods used to decode encoded words.
1452 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1453 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1454 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1455 whose names match REGEXP.
1458 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1459 mail-decode-encoded-word-string
1460 (\"chinese\" . rfc1843-decode-string))")
1462 (defvar gnus-decode-encoded-word-methods-cache nil
)
1464 (defun gnus-multi-decode-encoded-word-string (string)
1465 "Apply the functions from `gnus-encoded-word-methods' that match."
1466 (unless (and gnus-decode-encoded-word-methods-cache
1467 (eq gnus-newsgroup-name
1468 (car gnus-decode-encoded-word-methods-cache
)))
1469 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1472 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1473 (if (and gnus-newsgroup-name
1474 (string-match (car x
) gnus-newsgroup-name
))
1475 (nconc gnus-decode-encoded-word-methods-cache
1477 gnus-decode-encoded-word-methods
))
1478 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1481 (setq string
(funcall (pop xlist
) string
))))
1484 ;; Subject simplification.
1486 (defun gnus-simplify-whitespace (str)
1487 "Remove excessive whitespace from STR."
1489 (while (string-match "[ \t][ \t]+" str
)
1490 (setq str
(concat (substring str
0 (match-beginning 0))
1492 (substring str
(match-end 0)))))
1494 (when (string-match "^[ \t]+" str
)
1495 (setq str
(substring str
(match-end 0))))
1497 (when (string-match "[ \t]+$" str
)
1498 (setq str
(substring str
0 (match-beginning 0))))
1501 (defun gnus-simplify-all-whitespace (str)
1502 "Remove all whitespace from STR."
1503 (while (string-match "[ \t\n]+" str
)
1504 (setq str
(replace-match "" nil nil str
)))
1507 (defsubst gnus-simplify-subject-re
(subject)
1508 "Remove \"Re:\" from subject lines."
1509 (if (string-match message-subject-re-regexp subject
)
1510 (substring subject
(match-end 0))
1513 (defun gnus-simplify-subject (subject &optional re-only
)
1514 "Remove `Re:' and words in parentheses.
1515 If RE-ONLY is non-nil, strip leading `Re:'s only."
1516 (let ((case-fold-search t
)) ;Ignore case.
1517 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1518 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1519 (setq subject
(substring subject
(match-end 0))))
1520 ;; Remove uninteresting prefixes.
1521 (when (and (not re-only
)
1522 gnus-simplify-ignored-prefixes
1523 (string-match gnus-simplify-ignored-prefixes subject
))
1524 (setq subject
(substring subject
(match-end 0))))
1525 ;; Remove words in parentheses from end.
1527 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1528 (setq subject
(substring subject
0 (match-beginning 0)))))
1529 ;; Return subject string.
1532 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1534 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1535 (goto-char (point-min))
1536 (while (re-search-forward regexp nil t
)
1537 (replace-match (or newtext
""))))
1539 (defun gnus-simplify-buffer-fuzzy ()
1540 "Simplify string in the buffer fuzzily.
1541 The string in the accessible portion of the current buffer is simplified.
1542 It is assumed to be a single-line subject.
1543 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1544 matter is removed. Additional things can be deleted by setting
1545 `gnus-simplify-subject-fuzzy-regexp'."
1546 (let ((case-fold-search t
)
1548 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1550 (while (not (eq modified-tick
(buffer-modified-tick)))
1551 (setq modified-tick
(buffer-modified-tick))
1553 ((listp gnus-simplify-subject-fuzzy-regexp
)
1554 (mapcar 'gnus-simplify-buffer-fuzzy-step
1555 gnus-simplify-subject-fuzzy-regexp
))
1556 (gnus-simplify-subject-fuzzy-regexp
1557 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1558 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1559 (gnus-simplify-buffer-fuzzy-step
1560 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1561 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1563 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1564 (gnus-simplify-buffer-fuzzy-step " +" " ")
1565 (gnus-simplify-buffer-fuzzy-step " $")
1566 (gnus-simplify-buffer-fuzzy-step "^ +")))
1568 (defun gnus-simplify-subject-fuzzy (subject)
1569 "Simplify a subject string fuzzily.
1570 See `gnus-simplify-buffer-fuzzy' for details."
1572 (gnus-set-work-buffer)
1573 (let ((case-fold-search t
))
1574 ;; Remove uninteresting prefixes.
1575 (when (and gnus-simplify-ignored-prefixes
1576 (string-match gnus-simplify-ignored-prefixes subject
))
1577 (setq subject
(substring subject
(match-end 0))))
1579 (inline (gnus-simplify-buffer-fuzzy))
1582 (defsubst gnus-simplify-subject-fully
(subject)
1583 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1585 (gnus-simplify-subject-functions
1586 (gnus-map-function gnus-simplify-subject-functions subject
))
1587 ((null gnus-summary-gather-subject-limit
)
1588 (gnus-simplify-subject-re subject
))
1589 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1590 (gnus-simplify-subject-fuzzy subject
))
1591 ((numberp gnus-summary-gather-subject-limit
)
1592 (gnus-limit-string (gnus-simplify-subject-re subject
)
1593 gnus-summary-gather-subject-limit
))
1597 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1598 "Check whether two subjects are equal.
1599 If optional argument SIMPLE-FIRST is t, first argument is already
1602 ((null simple-first
)
1603 (equal (gnus-simplify-subject-fully s1
)
1604 (gnus-simplify-subject-fully s2
)))
1607 (gnus-simplify-subject-fully s2
)))))
1609 (defun gnus-summary-bubble-group ()
1610 "Increase the score of the current group.
1611 This is a handy function to add to `gnus-summary-exit-hook' to
1612 increase the score of each group you read."
1613 (gnus-group-add-score gnus-newsgroup-name
))
1617 ;;; Gnus summary mode
1620 (put 'gnus-summary-mode
'mode-class
'special
)
1622 (defvar gnus-article-commands-menu
)
1624 ;; Non-orthogonal keys
1626 (gnus-define-keys gnus-summary-mode-map
1627 " " gnus-summary-next-page
1628 "\177" gnus-summary-prev-page
1629 [delete] gnus-summary-prev-page
1630 [backspace] gnus-summary-prev-page
1631 "\r" gnus-summary-scroll-up
1632 "\M-\r" gnus-summary-scroll-down
1633 "n" gnus-summary-next-unread-article
1634 "p" gnus-summary-prev-unread-article
1635 "N" gnus-summary-next-article
1636 "P" gnus-summary-prev-article
1637 "\M-\C-n" gnus-summary-next-same-subject
1638 "\M-\C-p" gnus-summary-prev-same-subject
1639 "\M-n" gnus-summary-next-unread-subject
1640 "\M-p" gnus-summary-prev-unread-subject
1641 "." gnus-summary-first-unread-article
1642 "," gnus-summary-best-unread-article
1643 "\M-s" gnus-summary-search-article-forward
1644 "\M-r" gnus-summary-search-article-backward
1645 "<" gnus-summary-beginning-of-article
1646 ">" gnus-summary-end-of-article
1647 "j" gnus-summary-goto-article
1648 "^" gnus-summary-refer-parent-article
1649 "\M-^" gnus-summary-refer-article
1650 "u" gnus-summary-tick-article-forward
1651 "!" gnus-summary-tick-article-forward
1652 "U" gnus-summary-tick-article-backward
1653 "d" gnus-summary-mark-as-read-forward
1654 "D" gnus-summary-mark-as-read-backward
1655 "E" gnus-summary-mark-as-expirable
1656 "\M-u" gnus-summary-clear-mark-forward
1657 "\M-U" gnus-summary-clear-mark-backward
1658 "k" gnus-summary-kill-same-subject-and-select
1659 "\C-k" gnus-summary-kill-same-subject
1660 "\M-\C-k" gnus-summary-kill-thread
1661 "\M-\C-l" gnus-summary-lower-thread
1662 "e" gnus-summary-edit-article
1663 "#" gnus-summary-mark-as-processable
1664 "\M-#" gnus-summary-unmark-as-processable
1665 "\M-\C-t" gnus-summary-toggle-threads
1666 "\M-\C-s" gnus-summary-show-thread
1667 "\M-\C-h" gnus-summary-hide-thread
1668 "\M-\C-f" gnus-summary-next-thread
1669 "\M-\C-b" gnus-summary-prev-thread
1670 [(meta down)] gnus-summary-next-thread
1671 [(meta up)] gnus-summary-prev-thread
1672 "\M-\C-u" gnus-summary-up-thread
1673 "\M-\C-d" gnus-summary-down-thread
1674 "&" gnus-summary-execute-command
1675 "c" gnus-summary-catchup-and-exit
1676 "\C-w" gnus-summary-mark-region-as-read
1677 "\C-t" gnus-summary-toggle-truncation
1678 "?" gnus-summary-mark-as-dormant
1679 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1680 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1681 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1682 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1683 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1684 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1685 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1686 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1687 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1688 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1689 "=" gnus-summary-expand-window
1690 "\C-x\C-s" gnus-summary-reselect-current-group
1691 "\M-g" gnus-summary-rescan-group
1692 "w" gnus-summary-stop-page-breaking
1693 "\C-c\C-r" gnus-summary-caesar-message
1694 "f" gnus-summary-followup
1695 "F" gnus-summary-followup-with-original
1696 "C" gnus-summary-cancel-article
1697 "r" gnus-summary-reply
1698 "R" gnus-summary-reply-with-original
1699 "\C-c\C-f" gnus-summary-mail-forward
1700 "o" gnus-summary-save-article
1701 "\C-o" gnus-summary-save-article-mail
1702 "|" gnus-summary-pipe-output
1703 "\M-k" gnus-summary-edit-local-kill
1704 "\M-K" gnus-summary-edit-global-kill
1706 "\C-c\C-d" gnus-summary-describe-group
1707 "q" gnus-summary-exit
1708 "Q" gnus-summary-exit-no-update
1709 "\C-c\C-i" gnus-info-find-node
1710 gnus-mouse-2 gnus-mouse-pick-article
1711 [follow-link] mouse-face
1712 "m" gnus-summary-mail-other-window
1713 "a" gnus-summary-post-news
1714 "i" gnus-summary-news-other-window
1715 "x" gnus-summary-limit-to-unread
1716 "s" gnus-summary-isearch-article
1717 "t" gnus-summary-toggle-header
1718 "g" gnus-summary-show-article
1719 "l" gnus-summary-goto-last-article
1720 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1721 "\C-d" gnus-summary-enter-digest-group
1722 "\M-\C-d" gnus-summary-read-document
1723 "\M-\C-e" gnus-summary-edit-parameters
1724 "\M-\C-a" gnus-summary-customize-parameters
1726 "*" gnus-cache-enter-article
1727 "\M-*" gnus-cache-remove-article
1728 "\M-&" gnus-summary-universal-argument
1729 "\C-l" gnus-recenter
1730 "I" gnus-summary-increase-score
1731 "L" gnus-summary-lower-score
1732 "\M-i" gnus-symbolic-argument
1733 "h" gnus-summary-select-article-buffer
1735 "b" gnus-article-view-part
1736 "\M-t" gnus-summary-toggle-display-buttonized
1738 "V" gnus-summary-score-map
1739 "X" gnus-uu-extract-map
1740 "S" gnus-summary-send-map)
1742 ;; Sort of orthogonal keymap
1743 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1744 "t" gnus-summary-tick-article-forward
1745 "!" gnus-summary-tick-article-forward
1746 "d" gnus-summary-mark-as-read-forward
1747 "r" gnus-summary-mark-as-read-forward
1748 "c" gnus-summary-clear-mark-forward
1749 " " gnus-summary-clear-mark-forward
1750 "e" gnus-summary-mark-as-expirable
1751 "x" gnus-summary-mark-as-expirable
1752 "?" gnus-summary-mark-as-dormant
1753 "b" gnus-summary-set-bookmark
1754 "B" gnus-summary-remove-bookmark
1755 "#" gnus-summary-mark-as-processable
1756 "\M-#" gnus-summary-unmark-as-processable
1757 "S" gnus-summary-limit-include-expunged
1758 "C" gnus-summary-catchup
1759 "H" gnus-summary-catchup-to-here
1760 "h" gnus-summary-catchup-from-here
1761 "\C-c" gnus-summary-catchup-all
1762 "k" gnus-summary-kill-same-subject-and-select
1763 "K" gnus-summary-kill-same-subject
1764 "P" gnus-uu-mark-map)
1766 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1767 "c" gnus-summary-clear-above
1768 "u" gnus-summary-tick-above
1769 "m" gnus-summary-mark-above
1770 "k" gnus-summary-kill-below)
1772 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1773 "/" gnus-summary-limit-to-subject
1774 "n" gnus-summary-limit-to-articles
1775 "w" gnus-summary-pop-limit
1776 "s" gnus-summary-limit-to-subject
1777 "a" gnus-summary-limit-to-author
1778 "u" gnus-summary-limit-to-unread
1779 "m" gnus-summary-limit-to-marks
1780 "M" gnus-summary-limit-exclude-marks
1781 "v" gnus-summary-limit-to-score
1782 "*" gnus-summary-limit-include-cached
1783 "D" gnus-summary-limit-include-dormant
1784 "T" gnus-summary-limit-include-thread
1785 "d" gnus-summary-limit-exclude-dormant
1786 "t" gnus-summary-limit-to-age
1787 "." gnus-summary-limit-to-unseen
1788 "x" gnus-summary-limit-to-extra
1789 "p" gnus-summary-limit-to-display-predicate
1790 "E" gnus-summary-limit-include-expunged
1791 "c" gnus-summary-limit-exclude-childless-dormant
1792 "C" gnus-summary-limit-mark-excluded-as-read
1793 "o" gnus-summary-insert-old-articles
1794 "N" gnus-summary-insert-new-articles)
1796 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1797 "n" gnus-summary-next-unread-article
1798 "p" gnus-summary-prev-unread-article
1799 "N" gnus-summary-next-article
1800 "P" gnus-summary-prev-article
1801 "\C-n" gnus-summary-next-same-subject
1802 "\C-p" gnus-summary-prev-same-subject
1803 "\M-n" gnus-summary-next-unread-subject
1804 "\M-p" gnus-summary-prev-unread-subject
1805 "f" gnus-summary-first-unread-article
1806 "b" gnus-summary-best-unread-article
1807 "j" gnus-summary-goto-article
1808 "g" gnus-summary-goto-subject
1809 "l" gnus-summary-goto-last-article
1810 "o" gnus-summary-pop-article)
1812 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1813 "k" gnus-summary-kill-thread
1814 "l" gnus-summary-lower-thread
1815 "i" gnus-summary-raise-thread
1816 "T" gnus-summary-toggle-threads
1817 "t" gnus-summary-rethread-current
1818 "^" gnus-summary-reparent-thread
1819 "s" gnus-summary-show-thread
1820 "S" gnus-summary-show-all-threads
1821 "h" gnus-summary-hide-thread
1822 "H" gnus-summary-hide-all-threads
1823 "n" gnus-summary-next-thread
1824 "p" gnus-summary-prev-thread
1825 "u" gnus-summary-up-thread
1826 "o" gnus-summary-top-thread
1827 "d" gnus-summary-down-thread
1828 "#" gnus-uu-mark-thread
1829 "\M-#" gnus-uu-unmark-thread)
1831 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1832 "g" gnus-summary-prepare
1833 "c" gnus-summary-insert-cached-articles
1834 "d" gnus-summary-insert-dormant-articles)
1836 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1837 "c" gnus-summary-catchup-and-exit
1838 "C" gnus-summary-catchup-all-and-exit
1839 "E" gnus-summary-exit-no-update
1840 "Q" gnus-summary-exit
1841 "Z" gnus-summary-exit
1842 "n" gnus-summary-catchup-and-goto-next-group
1843 "R" gnus-summary-reselect-current-group
1844 "G" gnus-summary-rescan-group
1845 "N" gnus-summary-next-group
1846 "s" gnus-summary-save-newsrc
1847 "P" gnus-summary-prev-group)
1849 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1850 " " gnus-summary-next-page
1851 "n" gnus-summary-next-page
1852 "\177" gnus-summary-prev-page
1853 [delete] gnus-summary-prev-page
1854 "p" gnus-summary-prev-page
1855 "\r" gnus-summary-scroll-up
1856 "\M-\r" gnus-summary-scroll-down
1857 "<" gnus-summary-beginning-of-article
1858 ">" gnus-summary-end-of-article
1859 "b" gnus-summary-beginning-of-article
1860 "e" gnus-summary-end-of-article
1861 "^" gnus-summary-refer-parent-article
1862 "r" gnus-summary-refer-parent-article
1863 "D" gnus-summary-enter-digest-group
1864 "R" gnus-summary-refer-references
1865 "T" gnus-summary-refer-thread
1866 "g" gnus-summary-show-article
1867 "s" gnus-summary-isearch-article
1868 "P" gnus-summary-print-article
1869 "M" gnus-mailing-list-insinuate
1870 "t" gnus-article-babel
)
1872 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1873 "b" gnus-article-add-buttons
1874 "B" gnus-article-add-buttons-to-head
1875 "o" gnus-article-treat-overstrike
1876 "e" gnus-article-emphasize
1877 "w" gnus-article-fill-cited-article
1878 "Q" gnus-article-fill-long-lines
1879 "C" gnus-article-capitalize-sentences
1880 "c" gnus-article-remove-cr
1881 "q" gnus-article-de-quoted-unreadable
1882 "6" gnus-article-de-base64-unreadable
1883 "Z" gnus-article-decode-HZ
1884 "h" gnus-article-wash-html
1885 "u" gnus-article-unsplit-urls
1886 "s" gnus-summary-force-verify-and-decrypt
1887 "f" gnus-article-display-x-face
1888 "l" gnus-summary-stop-page-breaking
1889 "r" gnus-summary-caesar-message
1890 "m" gnus-summary-morse-message
1891 "t" gnus-summary-toggle-header
1892 "g" gnus-treat-smiley
1893 "v" gnus-summary-verbose-headers
1894 "a" gnus-article-strip-headers-in-body
;; mnemonic: wash archive
1895 "p" gnus-article-verify-x-pgp-sig
1896 "d" gnus-article-treat-dumbquotes
)
1898 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map
)
1899 ;; mnemonic: deuglif*Y*
1900 "u" gnus-article-outlook-unwrap-lines
1901 "a" gnus-article-outlook-repair-attribution
1902 "c" gnus-article-outlook-rearrange-citation
1903 "f" gnus-article-outlook-deuglify-article
) ;; mnemonic: full deuglify
1905 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1906 "a" gnus-article-hide
1907 "h" gnus-article-hide-headers
1908 "b" gnus-article-hide-boring-headers
1909 "s" gnus-article-hide-signature
1910 "c" gnus-article-hide-citation
1911 "C" gnus-article-hide-citation-in-followups
1912 "l" gnus-article-hide-list-identifiers
1913 "B" gnus-article-strip-banner
1914 "P" gnus-article-hide-pem
1915 "\C-c" gnus-article-hide-citation-maybe
)
1917 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1918 "a" gnus-article-highlight
1919 "h" gnus-article-highlight-headers
1920 "c" gnus-article-highlight-citation
1921 "s" gnus-article-highlight-signature
)
1923 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map
)
1924 "f" gnus-article-treat-fold-headers
1925 "u" gnus-article-treat-unfold-headers
1926 "n" gnus-article-treat-fold-newsgroups
)
1928 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map
)
1929 "x" gnus-article-display-x-face
1930 "d" gnus-article-display-face
1931 "s" gnus-treat-smiley
1932 "D" gnus-article-remove-images
1933 "f" gnus-treat-from-picon
1934 "m" gnus-treat-mail-picon
1935 "n" gnus-treat-newsgroups-picon
)
1937 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1938 "w" gnus-article-decode-mime-words
1939 "c" gnus-article-decode-charset
1940 "v" gnus-mime-view-all-parts
1941 "b" gnus-article-view-part
)
1943 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1944 "z" gnus-article-date-ut
1945 "u" gnus-article-date-ut
1946 "l" gnus-article-date-local
1947 "p" gnus-article-date-english
1948 "e" gnus-article-date-lapsed
1949 "o" gnus-article-date-original
1950 "i" gnus-article-date-iso8601
1951 "s" gnus-article-date-user
)
1953 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1954 "t" gnus-article-remove-trailing-blank-lines
1955 "l" gnus-article-strip-leading-blank-lines
1956 "m" gnus-article-strip-multiple-blank-lines
1957 "a" gnus-article-strip-blank-lines
1958 "A" gnus-article-strip-all-blank-lines
1959 "s" gnus-article-strip-leading-space
1960 "e" gnus-article-strip-trailing-space
1961 "w" gnus-article-remove-leading-whitespace
)
1963 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1965 "f" gnus-summary-fetch-faq
1966 "d" gnus-summary-describe-group
1967 "h" gnus-summary-describe-briefly
1968 "i" gnus-info-find-node
1969 "c" gnus-group-fetch-charter
1970 "C" gnus-group-fetch-control
)
1972 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1973 "e" gnus-summary-expire-articles
1974 "\M-\C-e" gnus-summary-expire-articles-now
1975 "\177" gnus-summary-delete-article
1976 [delete] gnus-summary-delete-article
1977 [backspace] gnus-summary-delete-article
1978 "m" gnus-summary-move-article
1979 "r" gnus-summary-respool-article
1980 "w" gnus-summary-edit-article
1981 "c" gnus-summary-copy-article
1982 "B" gnus-summary-crosspost-article
1983 "q" gnus-summary-respool-query
1984 "t" gnus-summary-respool-trace
1985 "i" gnus-summary-import-article
1986 "I" gnus-summary-create-article
1987 "p" gnus-summary-article-posted-p)
1989 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1990 "o" gnus-summary-save-article
1991 "m" gnus-summary-save-article-mail
1992 "F" gnus-summary-write-article-file
1993 "r" gnus-summary-save-article-rmail
1994 "f" gnus-summary-save-article-file
1995 "b" gnus-summary-save-article-body-file
1996 "B" gnus-summary-write-article-body-file
1997 "h" gnus-summary-save-article-folder
1998 "v" gnus-summary-save-article-vm
1999 "p" gnus-summary-pipe-output
2000 "P" gnus-summary-muttprint
2001 "s" gnus-soup-add-article)
2003 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2004 "b" gnus-summary-display-buttonized
2005 "m" gnus-summary-repair-multipart
2006 "v" gnus-article-view-part
2007 "o" gnus-article-save-part
2008 "c" gnus-article-copy-part
2009 "C" gnus-article-view-part-as-charset
2010 "e" gnus-article-view-part-externally
2011 "E" gnus-article-encrypt-body
2012 "i" gnus-article-inline-part
2013 "|" gnus-article-pipe-part)
2015 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2016 "p" gnus-summary-mark-as-processable
2017 "u" gnus-summary-unmark-as-processable
2018 "U" gnus-summary-unmark-all-processable
2019 "v" gnus-uu-mark-over
2020 "s" gnus-uu-mark-series
2021 "r" gnus-uu-mark-region
2022 "g" gnus-uu-unmark-region
2023 "R" gnus-uu-mark-by-regexp
2024 "G" gnus-uu-unmark-by-regexp
2025 "t" gnus-uu-mark-thread
2026 "T" gnus-uu-unmark-thread
2027 "a" gnus-uu-mark-all
2028 "b" gnus-uu-mark-buffer
2029 "S" gnus-uu-mark-sparse
2030 "k" gnus-summary-kill-process-mark
2031 "y" gnus-summary-yank-process-mark
2032 "w" gnus-summary-save-process-mark
2033 "i" gnus-uu-invert-processable)
2035 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2036 ;;"x" gnus-uu-extract-any
2037 "m" gnus-summary-save-parts
2038 "u" gnus-uu-decode-uu
2039 "U" gnus-uu-decode-uu-and-save
2040 "s" gnus-uu-decode-unshar
2041 "S" gnus-uu-decode-unshar-and-save
2042 "o" gnus-uu-decode-save
2043 "O" gnus-uu-decode-save
2044 "b" gnus-uu-decode-binhex
2045 "B" gnus-uu-decode-binhex
2046 "p" gnus-uu-decode-postscript
2047 "P" gnus-uu-decode-postscript-and-save)
2050 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2051 "u" gnus-uu-decode-uu-view
2052 "U" gnus-uu-decode-uu-and-save-view
2053 "s" gnus-uu-decode-unshar-view
2054 "S" gnus-uu-decode-unshar-and-save-view
2055 "o" gnus-uu-decode-save-view
2056 "O" gnus-uu-decode-save-view
2057 "b" gnus-uu-decode-binhex-view
2058 "B" gnus-uu-decode-binhex-view
2059 "p" gnus-uu-decode-postscript-view
2060 "P" gnus-uu-decode-postscript-and-save-view)
2062 (defvar gnus-article-post-menu nil)
2064 (defconst gnus-summary-menu-maxlen 20)
2066 (defun gnus-summary-menu-split (menu)
2067 ;; If we have lots of elements, divide them into groups of 20
2068 ;; and make a pane (or submenu) for each one.
2069 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2070 (let ((menu menu) sublists next
2073 ;; Pull off the next gnus-summary-menu-maxlen elements
2074 ;; and make them the next element of sublist.
2075 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2077 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2079 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2080 (aref (car (last menu)) 0)) menu)
2084 (nreverse sublists))
2085 ;; Few elements--put them all in one pane.
2088 (defun gnus-summary-make-menu-bar ()
2089 (gnus-turn-off-edit-menu 'summary)
2091 (unless (boundp 'gnus-summary-misc-menu)
2094 gnus-summary-kill-menu gnus-summary-mode-map ""
2099 ["Customize" gnus-score-customize t])
2100 (gnus-make-score-map 'increase)
2101 (gnus-make-score-map 'lower)
2103 ["Kill below" gnus-summary-kill-below t]
2104 ["Mark above" gnus-summary-mark-above t]
2105 ["Tick above" gnus-summary-tick-above t]
2106 ["Clear above" gnus-summary-clear-above t])
2107 ["Current score" gnus-summary-current-score t]
2108 ["Set score" gnus-summary-set-score t]
2109 ["Switch current score file..." gnus-score-change-score-file t]
2110 ["Set mark below..." gnus-score-set-mark-below t]
2111 ["Set expunge below..." gnus-score-set-expunge-below t]
2112 ["Edit current score file" gnus-score-edit-current-scores t]
2113 ["Edit score file" gnus-score-edit-file t]
2114 ["Trace score" gnus-score-find-trace t]
2115 ["Find words" gnus-score-find-favourite-words t]
2116 ["Rescore buffer" gnus-summary-rescore t]
2117 ["Increase score..." gnus-summary-increase-score t]
2118 ["Lower score..." gnus-summary-lower-score t]))))
2120 ;; Define both the Article menu in the summary buffer and the
2121 ;; equivalent Commands menu in the article buffer here for
2125 ["All" gnus-article-hide t]
2126 ["Headers" gnus-article-hide-headers t]
2127 ["Signature" gnus-article-hide-signature t]
2128 ["Citation" gnus-article-hide-citation t]
2129 ["List identifiers" gnus-article-hide-list-identifiers t]
2130 ["Banner" gnus-article-strip-banner t]
2131 ["Boring headers" gnus-article-hide-boring-headers t])
2133 ["All" gnus-article-highlight t]
2134 ["Headers" gnus-article-highlight-headers t]
2135 ["Signature" gnus-article-highlight-signature t]
2136 ["Citation" gnus-article-highlight-citation t])
2138 ["Words" gnus-article-decode-mime-words t]
2139 ["Charset" gnus-article-decode-charset t]
2140 ["QP" gnus-article-de-quoted-unreadable t]
2141 ["Base64" gnus-article-de-base64-unreadable t]
2142 ["View MIME buttons" gnus-summary-display-buttonized t]
2143 ["View all" gnus-mime-view-all-parts t]
2144 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2145 ["Encrypt body" gnus-article-encrypt-body
2146 :active (not (gnus-group-read-only-p))
2147 ,@(if (featurep 'xemacs) nil
2148 '(:help "Encrypt the message body on disk"))]
2149 ["Extract all parts..." gnus-summary-save-parts t]
2151 ["Repair multipart" gnus-summary-repair-multipart t]
2152 ["Pipe part..." gnus-article-pipe-part t]
2153 ["Inline part" gnus-article-inline-part t]
2154 ["Encrypt body" gnus-article-encrypt-body
2155 :active (not (gnus-group-read-only-p))
2156 ,@(if (featurep 'xemacs) nil
2157 '(:help "Encrypt the message body on disk"))]
2158 ["View part externally" gnus-article-view-part-externally t]
2159 ["View part with charset..." gnus-article-view-part-as-charset t]
2160 ["Copy part" gnus-article-copy-part t]
2161 ["Save part..." gnus-article-save-part t]
2162 ["View part" gnus-article-view-part t]))
2164 ["Local" gnus-article-date-local t]
2165 ["ISO8601" gnus-article-date-iso8601 t]
2166 ["UT" gnus-article-date-ut t]
2167 ["Original" gnus-article-date-original t]
2168 ["Lapsed" gnus-article-date-lapsed t]
2169 ["User-defined" gnus-article-date-user t])
2171 ["Remove images" gnus-article-remove-images t]
2172 ["Toggle smiley" gnus-treat-smiley t]
2173 ["Show X-Face" gnus-article-display-x-face t]
2174 ["Show picons in From" gnus-treat-from-picon t]
2175 ["Show picons in mail headers" gnus-treat-mail-picon t]
2176 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2177 ("View as different encoding"
2178 ,@(gnus-summary-menu-split
2181 ;; Since easymenu under Emacs doesn't allow
2182 ;; lambda forms for menu commands, we should
2183 ;; provide intern'ed function symbols.
2184 (let ((command (intern (format "\
2185 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2189 (let ((gnus-summary-show-article-charset-alist
2191 (gnus-summary-show-article 1))))
2192 `[,(symbol-name cs) ,command t]))
2193 (sort (if (fboundp 'coding-system-list)
2194 (coding-system-list)
2195 (mapcar 'car mm-mime-mule-charset-alist))
2199 ["Leading" gnus-article-strip-leading-blank-lines t]
2200 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2201 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2202 ["All of the above" gnus-article-strip-blank-lines t]
2203 ["All" gnus-article-strip-all-blank-lines t]
2204 ["Leading space" gnus-article-strip-leading-space t]
2205 ["Trailing space" gnus-article-strip-trailing-space t]
2206 ["Leading space in headers"
2207 gnus-article-remove-leading-whitespace t])
2208 ["Overstrike" gnus-article-treat-overstrike t]
2209 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2210 ["Emphasis" gnus-article-emphasize t]
2211 ["Word wrap" gnus-article-fill-cited-article t]
2212 ["Fill long lines" gnus-article-fill-long-lines t]
2213 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2214 ["Remove CR" gnus-article-remove-cr t]
2215 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2216 ["Base64" gnus-article-de-base64-unreadable t]
2217 ["Rot 13" gnus-summary-caesar-message
2218 ,@(if (featurep 'xemacs) '(t)
2219 '(:help "\"Caesar rotate\" article by 13"))]
2220 ["Morse decode" gnus-summary-morse-message t]
2221 ["Unix pipe..." gnus-summary-pipe-message t]
2222 ["Add buttons" gnus-article-add-buttons t]
2223 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2224 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2225 ["Verbose header" gnus-summary-verbose-headers t]
2226 ["Toggle header" gnus-summary-toggle-header t]
2227 ["Unfold headers" gnus-article-treat-unfold-headers t]
2228 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2229 ["Html" gnus-article-wash-html t]
2230 ["Unsplit URLs" gnus-article-unsplit-urls t]
2231 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2232 ["Decode HZ" gnus-article-decode-HZ t]
2233 ("(Outlook) Deuglify"
2234 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2235 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2236 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2237 ["Full (Outlook) deuglify"
2238 gnus-article-outlook-deuglify-article t])
2241 ["Save in default format..." gnus-summary-save-article
2242 ,@(if (featurep 'xemacs) '(t)
2243 '(:help "Save article using default method"))]
2244 ["Save in file..." gnus-summary-save-article-file
2245 ,@(if (featurep 'xemacs) '(t)
2246 '(:help "Save article in file"))]
2247 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2248 ["Save in MH folder..." gnus-summary-save-article-folder t]
2249 ["Save in VM folder..." gnus-summary-save-article-vm t]
2250 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2251 ["Save body in file..." gnus-summary-save-article-body-file t]
2252 ["Pipe through a filter..." gnus-summary-pipe-output t]
2253 ["Add to SOUP packet" gnus-soup-add-article t]
2254 ["Print with Muttprint..." gnus-summary-muttprint t]
2255 ["Print" gnus-summary-print-article
2256 ,@(if (featurep 'xemacs) '(t)
2257 '(:help "Generate and print a PostScript image"))])
2258 ("Copy, move,... (Backend)"
2259 ,@(if (featurep 'xemacs) nil
2260 '(:help "Copying, moving, expiring articles..."))
2261 ["Respool article..." gnus-summary-respool-article t]
2262 ["Move article..." gnus-summary-move-article
2263 (gnus-check-backend-function
2264 'request-move-article gnus-newsgroup-name)]
2265 ["Copy article..." gnus-summary-copy-article t]
2266 ["Crosspost article..." gnus-summary-crosspost-article
2267 (gnus-check-backend-function
2268 'request-replace-article gnus-newsgroup-name)]
2269 ["Import file..." gnus-summary-import-article
2270 (gnus-check-backend-function
2271 'request-accept-article gnus-newsgroup-name)]
2272 ["Create article..." gnus-summary-create-article
2273 (gnus-check-backend-function
2274 'request-accept-article gnus-newsgroup-name)]
2275 ["Check if posted" gnus-summary-article-posted-p t]
2276 ["Edit article" gnus-summary-edit-article
2277 (not (gnus-group-read-only-p))]
2278 ["Delete article" gnus-summary-delete-article
2279 (gnus-check-backend-function
2280 'request-expire-articles gnus-newsgroup-name)]
2281 ["Query respool" gnus-summary-respool-query t]
2282 ["Trace respool" gnus-summary-respool-trace t]
2283 ["Delete expirable articles" gnus-summary-expire-articles-now
2284 (gnus-check-backend-function
2285 'request-expire-articles gnus-newsgroup-name)])
2287 ["Uudecode" gnus-uu-decode-uu
2288 ,@(if (featurep 'xemacs) '(t)
2289 '(:help "Decode uuencoded article(s)"))]
2290 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2291 ["Unshar" gnus-uu-decode-unshar t]
2292 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2293 ["Save" gnus-uu-decode-save t]
2294 ["Binhex" gnus-uu-decode-binhex t]
2295 ["Postscript" gnus-uu-decode-postscript t]
2296 ["All MIME parts" gnus-summary-save-parts t])
2298 ["Enter article" gnus-cache-enter-article t]
2299 ["Remove article" gnus-cache-remove-article t])
2300 ["Translate" gnus-article-babel t]
2301 ["Select article buffer" gnus-summary-select-article-buffer t]
2302 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2303 ["Isearch article..." gnus-summary-isearch-article t]
2304 ["Beginning of the article" gnus-summary-beginning-of-article t]
2305 ["End of the article" gnus-summary-end-of-article t]
2306 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2307 ["Fetch referenced articles" gnus-summary-refer-references t]
2308 ["Fetch current thread" gnus-summary-refer-thread t]
2309 ["Fetch article with id..." gnus-summary-refer-article t]
2310 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2311 ["Redisplay" gnus-summary-show-article t]
2312 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2314 gnus-summary-article-menu gnus-summary-mode-map ""
2315 (cons "Article" innards))
2317 (if (not (keymapp gnus-summary-article-menu))
2319 gnus-article-commands-menu gnus-article-mode-map ""
2320 (cons "Commands" innards))
2321 ;; in Emacs, don't share menu.
2322 (setq gnus-article-commands-menu
2323 (copy-keymap gnus-summary-article-menu))
2324 (define-key gnus-article-mode-map [menu-bar commands]
2325 (cons "Commands" gnus-article-commands-menu))))
2328 gnus-summary-thread-menu gnus-summary-mode-map ""
2330 ["Find all messages in thread" gnus-summary-refer-thread t]
2331 ["Toggle threading" gnus-summary-toggle-threads t]
2332 ["Hide threads" gnus-summary-hide-all-threads t]
2333 ["Show threads" gnus-summary-show-all-threads t]
2334 ["Hide thread" gnus-summary-hide-thread t]
2335 ["Show thread" gnus-summary-show-thread t]
2336 ["Go to next thread" gnus-summary-next-thread t]
2337 ["Go to previous thread" gnus-summary-prev-thread t]
2338 ["Go down thread" gnus-summary-down-thread t]
2339 ["Go up thread" gnus-summary-up-thread t]
2340 ["Top of thread" gnus-summary-top-thread t]
2341 ["Mark thread as read" gnus-summary-kill-thread t]
2342 ["Lower thread score" gnus-summary-lower-thread t]
2343 ["Raise thread score" gnus-summary-raise-thread t]
2344 ["Rethread current" gnus-summary-rethread-current t]))
2347 gnus-summary-post-menu gnus-summary-mode-map ""
2349 ["Send a message (mail or news)" gnus-summary-post-news
2350 ,@(if (featurep 'xemacs) '(t)
2351 '(:help "Compose a new message (mail or news)"))]
2352 ["Followup" gnus-summary-followup
2353 ,@(if (featurep 'xemacs) '(t)
2354 '(:help "Post followup to this article"))]
2355 ["Followup and yank" gnus-summary-followup-with-original
2356 ,@(if (featurep 'xemacs) '(t)
2357 '(:help "Post followup to this article, quoting its contents"))]
2358 ["Supersede article" gnus-summary-supersede-article t]
2359 ["Cancel article" gnus-summary-cancel-article
2360 ,@(if (featurep 'xemacs) '(t)
2361 '(:help "Cancel an article you posted"))]
2362 ["Reply" gnus-summary-reply t]
2363 ["Reply and yank" gnus-summary-reply-with-original t]
2364 ["Wide reply" gnus-summary-wide-reply t]
2365 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2366 ,@(if (featurep 'xemacs) '(t)
2367 '(:help "Mail a reply, quoting this article"))]
2368 ["Very wide reply" gnus-summary-very-wide-reply t]
2369 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2370 ,@(if (featurep 'xemacs) '(t)
2371 '(:help "Mail a very wide reply, quoting this article"))]
2372 ["Mail forward" gnus-summary-mail-forward t]
2373 ["Post forward" gnus-summary-post-forward t]
2374 ["Digest and mail" gnus-uu-digest-mail-forward t]
2375 ["Digest and post" gnus-uu-digest-post-forward t]
2376 ["Resend message" gnus-summary-resend-message t]
2377 ["Resend message edit" gnus-summary-resend-message-edit t]
2378 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2379 ["Send a mail" gnus-summary-mail-other-window t]
2380 ["Create a local message" gnus-summary-news-other-window t]
2381 ["Uuencode and post" gnus-uu-post-news
2382 ,@(if (featurep 'xemacs) '(t)
2383 '(:help "Post a uuencoded article"))]
2384 ["Followup via news" gnus-summary-followup-to-mail t]
2385 ["Followup via news and yank"
2386 gnus-summary-followup-to-mail-with-original t]
2388 ;;["Send" gnus-summary-send-draft t]
2389 ;;["Send bounced" gnus-resend-bounced-mail t])
2393 ((not (keymapp gnus-summary-post-menu))
2394 (setq gnus-article-post-menu gnus-summary-post-menu))
2395 ((not gnus-article-post-menu)
2396 ;; Don't share post menu.
2397 (setq gnus-article-post-menu
2398 (copy-keymap gnus-summary-post-menu))))
2399 (define-key gnus-article-mode-map [menu-bar post]
2400 (cons "Post" gnus-article-post-menu))
2403 gnus-summary-misc-menu gnus-summary-mode-map ""
2406 ["Mark as read" gnus-summary-mark-as-read-forward t]
2407 ["Mark same subject and select"
2408 gnus-summary-kill-same-subject-and-select t]
2409 ["Mark same subject" gnus-summary-kill-same-subject t]
2410 ["Catchup" gnus-summary-catchup
2411 ,@(if (featurep 'xemacs) '(t)
2412 '(:help "Mark unread articles in this group as read"))]
2413 ["Catchup all" gnus-summary-catchup-all t]
2414 ["Catchup to here" gnus-summary-catchup-to-here t]
2415 ["Catchup from here" gnus-summary-catchup-from-here t]
2416 ["Catchup region" gnus-summary-mark-region-as-read
2417 (gnus-mark-active-p)]
2418 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2420 ["Tick" gnus-summary-tick-article-forward t]
2421 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2422 ["Remove marks" gnus-summary-clear-mark-forward t]
2423 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2424 ["Set bookmark" gnus-summary-set-bookmark t]
2425 ["Remove bookmark" gnus-summary-remove-bookmark t])
2427 ["Marks..." gnus-summary-limit-to-marks t]
2428 ["Subject..." gnus-summary-limit-to-subject t]
2429 ["Author..." gnus-summary-limit-to-author t]
2430 ["Age..." gnus-summary-limit-to-age t]
2431 ["Extra..." gnus-summary-limit-to-extra t]
2432 ["Score..." gnus-summary-limit-to-score t]
2433 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2434 ["Unread" gnus-summary-limit-to-unread t]
2435 ["Unseen" gnus-summary-limit-to-unseen t]
2436 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2437 ["Next articles" gnus-summary-limit-to-articles t]
2438 ["Pop limit" gnus-summary-pop-limit t]
2439 ["Show dormant" gnus-summary-limit-include-dormant t]
2440 ["Hide childless dormant"
2441 gnus-summary-limit-exclude-childless-dormant t]
2442 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2443 ["Hide marked" gnus-summary-limit-exclude-marks t]
2444 ["Show expunged" gnus-summary-limit-include-expunged t])
2446 ["Set mark" gnus-summary-mark-as-processable t]
2447 ["Remove mark" gnus-summary-unmark-as-processable t]
2448 ["Remove all marks" gnus-summary-unmark-all-processable t]
2449 ["Mark above" gnus-uu-mark-over t]
2450 ["Mark series" gnus-uu-mark-series t]
2451 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2452 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2453 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2454 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2455 ["Mark all" gnus-uu-mark-all t]
2456 ["Mark buffer" gnus-uu-mark-buffer t]
2457 ["Mark sparse" gnus-uu-mark-sparse t]
2458 ["Mark thread" gnus-uu-mark-thread t]
2459 ["Unmark thread" gnus-uu-unmark-thread t]
2460 ("Process Mark Sets"
2461 ["Kill" gnus-summary-kill-process-mark t]
2462 ["Yank" gnus-summary-yank-process-mark
2463 gnus-newsgroup-process-stack]
2464 ["Save" gnus-summary-save-process-mark t]
2465 ["Run command on marked..." gnus-summary-universal-argument t]))
2467 ["Page forward" gnus-summary-next-page
2468 ,@(if (featurep 'xemacs) '(t)
2469 '(:help "Show next page of article"))]
2470 ["Page backward" gnus-summary-prev-page
2471 ,@(if (featurep 'xemacs) '(t)
2472 '(:help "Show previous page of article"))]
2473 ["Line forward" gnus-summary-scroll-up t])
2475 ["Next unread article" gnus-summary-next-unread-article t]
2476 ["Previous unread article" gnus-summary-prev-unread-article t]
2477 ["Next article" gnus-summary-next-article t]
2478 ["Previous article" gnus-summary-prev-article t]
2479 ["Next unread subject" gnus-summary-next-unread-subject t]
2480 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2481 ["Next article same subject" gnus-summary-next-same-subject t]
2482 ["Previous article same subject" gnus-summary-prev-same-subject t]
2483 ["First unread article" gnus-summary-first-unread-article t]
2484 ["Best unread article" gnus-summary-best-unread-article t]
2485 ["Go to subject number..." gnus-summary-goto-subject t]
2486 ["Go to article number..." gnus-summary-goto-article t]
2487 ["Go to the last article" gnus-summary-goto-last-article t]
2488 ["Pop article off history" gnus-summary-pop-article t])
2490 ["Sort by number" gnus-summary-sort-by-number t]
2491 ["Sort by author" gnus-summary-sort-by-author t]
2492 ["Sort by subject" gnus-summary-sort-by-subject t]
2493 ["Sort by date" gnus-summary-sort-by-date t]
2494 ["Sort by score" gnus-summary-sort-by-score t]
2495 ["Sort by lines" gnus-summary-sort-by-lines t]
2496 ["Sort by characters" gnus-summary-sort-by-chars t]
2497 ["Randomize" gnus-summary-sort-by-random t]
2498 ["Original sort" gnus-summary-sort-by-original t])
2500 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2501 ["Describe group" gnus-summary-describe-group t]
2502 ["Fetch charter" gnus-group-fetch-charter
2503 ,@(if (featurep 'xemacs) nil
2504 '(:help "Display the charter of the current group"))]
2505 ["Fetch control message" gnus-group-fetch-control
2506 ,@(if (featurep 'xemacs) nil
2507 '(:help "Display the archived control message for the current group"))]
2508 ["Read manual" gnus-info-find-node t])
2510 ["Pick and read" gnus-pick-mode t]
2511 ["Binary" gnus-binary-mode t])
2513 ["Regenerate" gnus-summary-prepare t]
2514 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2515 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2516 ["Toggle threading" gnus-summary-toggle-threads t])
2517 ["See old articles" gnus-summary-insert-old-articles t]
2518 ["See new articles" gnus-summary-insert-new-articles t]
2519 ["Filter articles..." gnus-summary-execute-command t]
2520 ["Run command on articles..." gnus-summary-universal-argument t]
2521 ["Search articles forward..." gnus-summary-search-article-forward t]
2522 ["Search articles backward..." gnus-summary-search-article-backward t]
2523 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2524 ["Expand window" gnus-summary-expand-window t]
2525 ["Expire expirable articles" gnus-summary-expire-articles
2526 (gnus-check-backend-function
2527 'request-expire-articles gnus-newsgroup-name)]
2528 ["Edit local kill file" gnus-summary-edit-local-kill t]
2529 ["Edit main kill file" gnus-summary-edit-global-kill t]
2530 ["Edit group parameters" gnus-summary-edit-parameters t]
2531 ["Customize group parameters" gnus-summary-customize-parameters t]
2532 ["Send a bug report" gnus-bug t]
2534 ["Catchup and exit" gnus-summary-catchup-and-exit
2535 ,@(if (featurep 'xemacs) '(t)
2536 '(:help "Mark unread articles in this group as read, then exit"))]
2537 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2538 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2539 ["Exit group" gnus-summary-exit
2540 ,@(if (featurep 'xemacs) '(t)
2541 '(:help "Exit current group, return to group selection mode"))]
2542 ["Exit group without updating" gnus-summary-exit-no-update t]
2543 ["Exit and goto next group" gnus-summary-next-group t]
2544 ["Exit and goto prev group" gnus-summary-prev-group t]
2545 ["Reselect group" gnus-summary-reselect-current-group t]
2546 ["Rescan group" gnus-summary-rescan-group t]
2547 ["Update dribble" gnus-summary-save-newsrc t])))
2549 (gnus-run-hooks 'gnus-summary-menu-hook)))
2551 (defvar gnus-summary-tool-bar-map nil)
2553 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2554 ;; affect _new_ message buffers. We might add a function that walks thru all
2555 ;; summary-mode buffers and force the update.
2556 (defun gnus-summary-tool-bar-update (&optional symbol value)
2557 "Update summary mode toolbar.
2558 Setter function for custom variables."
2559 (setq-default gnus-summary-tool-bar-map nil)
2561 ;; When used as ":set" function:
2562 (set-default symbol value))
2563 (when (gnus-buffer-live-p gnus-summary-buffer)
2564 (with-current-buffer gnus-summary-buffer
2565 (gnus-summary-make-tool-bar))))
2567 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2568 'gnus-summary-tool-bar-gnome
2569 'gnus-summary-tool-bar-retro)
2570 "Specifies the Gnus summary tool bar.
2572 It can be either a list or a symbol refering to a list. See
2573 `gmm-tool-bar-from-list' for the format of the list. The
2574 default key map is `gnus-summary-mode-map'.
2576 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2577 `gnus-summary-tool-bar-retro'."
2578 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2579 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2580 (repeat :tag "User defined list" gmm-tool-bar-item)
2582 :version "22.1" ;; Gnus 5.10.9
2583 :initialize 'custom-initialize-default
2584 :set 'gnus-summary-tool-bar-update
2585 :group 'gnus-summary)
2587 (defcustom gnus-summary-tool-bar-gnome
2588 '((gnus-summary-post-news "mail/compose" nil)
2589 (gnus-summary-insert-new-articles "mail/inbox" nil
2590 :visible (or (not gnus-agent)
2592 (gnus-summary-reply-with-original "mail/reply")
2593 (gnus-summary-reply "mail/reply" nil :visible nil)
2594 (gnus-summary-followup-with-original "mail/reply-all")
2595 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2596 (gnus-summary-mail-forward "mail/forward")
2597 (gnus-summary-save-article "mail/save")
2598 (gnus-summary-search-article-forward "search" nil :visible nil)
2599 (gnus-summary-print-article "print")
2600 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2601 ;; Some new commands that may need more suitable icons:
2602 (gnus-summary-save-newsrc "save" nil :visible nil)
2603 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2604 (gnus-summary-prev-article "left-arrow")
2605 (gnus-summary-next-article "right-arrow")
2606 (gnus-summary-next-page "next-page")
2607 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2609 ;; Maybe some sort-by-... could be added:
2610 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2611 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2612 (gnus-summary-mark-as-expirable
2614 :visible (gnus-check-backend-function 'request-expire-articles
2615 gnus-newsgroup-name))
2616 (gnus-summary-mark-as-spam
2618 :visible (and (fboundp 'spam-group-ham-contents-p)
2619 (spam-group-ham-contents-p gnus-newsgroup-name))
2620 :help "Mark as spam")
2621 (gnus-summary-mark-as-read-forward
2623 :visible (and (fboundp 'spam-group-spam-contents-p)
2624 (spam-group-spam-contents-p gnus-newsgroup-name)))
2626 (gnus-summary-exit "exit")
2627 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2628 (gnus-info-find-node "help"))
2629 "List of functions for the summary tool bar (GNOME style).
2631 See `gmm-tool-bar-from-list' for the format of the list."
2632 :type '(repeat gmm-tool-bar-item)
2633 :version "22.1" ;; Gnus 5.10.9
2634 :initialize 'custom-initialize-default
2635 :set 'gnus-summary-tool-bar-update
2636 :group 'gnus-summary)
2638 (defcustom gnus-summary-tool-bar-retro
2639 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2640 (gnus-summary-next-unread-article "gnus/next-ur")
2641 (gnus-summary-post-news "gnus/post")
2642 (gnus-summary-followup-with-original "gnus/fuwo")
2643 (gnus-summary-followup "gnus/followup")
2644 (gnus-summary-reply-with-original "gnus/reply-wo")
2645 (gnus-summary-reply "gnus/reply")
2646 (gnus-summary-caesar-message "gnus/rot13")
2647 (gnus-uu-decode-uu "gnus/uu-decode")
2648 (gnus-summary-save-article-file "gnus/save-aif")
2649 (gnus-summary-save-article "gnus/save-art")
2650 (gnus-uu-post-news "gnus/uu-post")
2651 (gnus-summary-catchup "gnus/catchup")
2652 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2653 (gnus-summary-exit "gnus/exit-summ")
2654 ;; Some new command that may need more suitable icons:
2655 (gnus-summary-print-article "gnus/print" nil :visible nil)
2656 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2657 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2658 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2659 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2660 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2661 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2663 (gnus-info-find-node "gnus/help" nil :visible nil))
2664 "List of functions for the summary tool bar (retro look).
2666 See `gmm-tool-bar-from-list' for the format of the list."
2667 :type '(repeat gmm-tool-bar-item)
2668 :version "22.1" ;; Gnus 5.10.9
2669 :initialize 'custom-initialize-default
2670 :set 'gnus-summary-tool-bar-update
2671 :group 'gnus-summary)
2673 (defcustom gnus-summary-tool-bar-zap-list t
2674 "List of icon items from the global tool bar.
2675 These items are not displayed in the Gnus summary mode tool bar.
2677 See `gmm-tool-bar-from-list' for the format of the list."
2678 :type 'gmm-tool-bar-zap-list
2679 :version "22.1" ;; Gnus 5.10.9
2680 :initialize 'custom-initialize-default
2681 :set 'gnus-summary-tool-bar-update
2682 :group 'gnus-summary)
2684 (defvar image-load-path)
2686 (defun gnus-summary-make-tool-bar (&optional force)
2687 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2688 When FORCE, rebuild the tool bar."
2689 (when (and (not (featurep 'xemacs))
2690 (boundp 'tool-bar-mode)
2692 (or (not gnus-summary-tool-bar-map) force))
2694 (gmm-image-load-path-for-library "gnus"
2697 (image-load-path (cons (car load-path)
2698 (when (boundp 'image-load-path)
2700 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2701 gnus-summary-tool-bar-zap-list
2702 'gnus-summary-mode-map)))
2704 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2706 (setq gnus-summary-tool-bar-map map))))
2707 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2709 (defun gnus-score-set-default (var value)
2710 "A version of set that updates the GNU Emacs menu-bar."
2712 ;; It is the message that forces the active status to be updated.
2715 (defun gnus-make-score-map (type)
2716 "Make a summary score map of type TYPE."
2719 (let ((headers '(("author" "from" string)
2720 ("subject" "subject" string)
2721 ("article body" "body" string)
2722 ("article head" "head" string)
2723 ("xref" "xref" string)
2724 ("extra header" "extra" string)
2725 ("lines" "lines" number)
2726 ("followups to author" "followup" string)))
2727 (types '((number ("less than" <)
2730 (string ("substring" s)
2734 (perms '(("temporary" (current-time-string))
2742 (if (eq type 'lower)
2747 (setq header (car headers))
2753 (let ((ts (cdr (assoc (nth 2 header) types)))
2769 'gnus-summary-score-entry
2771 (if (or (string= (nth 1 header)
2773 (string= (nth 1 header)
2776 (list 'gnus-summary-header
2778 (list 'quote (nth 1 (car ts)))
2779 (list 'gnus-score-delta-default
2786 (list (nreverse outp))))
2789 (list (nreverse outt))))
2791 (setq headers (cdr headers)))
2792 (list (nreverse outh))))))))
2796 (defun gnus-summary-mode (&optional group)
2797 "Major mode for reading articles.
2799 All normal editing commands are switched off.
2800 \\<gnus-summary-mode-map>
2801 Each line in this buffer represents one article. To read an
2802 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2803 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2806 You can also post articles and send mail from this buffer. To
2807 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2808 of an article, type `\\[gnus-summary-reply]'.
2810 There are approx. one gazillion commands you can execute in this
2811 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2813 The following commands are available:
2815 \\{gnus-summary-mode-map}"
2817 (kill-all-local-variables)
2818 (when (gnus-visual-p 'summary-menu 'menu)
2819 (gnus-summary-make-menu-bar)
2820 (gnus-summary-make-tool-bar))
2821 (gnus-summary-make-local-variables)
2822 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2823 (gnus-summary-make-local-variables))
2824 (gnus-make-thread-indent-array)
2825 (gnus-simplify-mode-line)
2826 (setq major-mode 'gnus-summary-mode)
2827 (setq mode-name "Summary")
2828 (make-local-variable 'minor-mode-alist)
2829 (use-local-map gnus-summary-mode-map)
2830 (buffer-disable-undo)
2831 (setq buffer-read-only t) ;Disable modification
2832 (setq truncate-lines t)
2833 (setq selective-display t)
2834 (setq selective-display-ellipses t) ;Display `...'
2835 (gnus-summary-set-display-table)
2836 (gnus-set-default-directory)
2837 (setq gnus-newsgroup-name group)
2838 (make-local-variable 'gnus-summary-line-format)
2839 (make-local-variable 'gnus-summary-line-format-spec)
2840 (make-local-variable 'gnus-summary-dummy-line-format)
2841 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2842 (make-local-variable 'gnus-summary-mark-positions)
2843 (gnus-make-local-hook 'pre-command-hook)
2844 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2845 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2846 (turn-on-gnus-mailing-list-mode)
2847 (mm-enable-multibyte)
2848 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2849 (gnus-update-summary-mark-positions))
2851 (defun gnus-summary-make-local-variables ()
2852 "Make all the local summary buffer variables."
2854 (dolist (local gnus-summary-local-variables)
2857 (if (eq (cdr local) 'global)
2858 ;; Copy the global value of the variable.
2859 (setq global (symbol-value (car local)))
2860 ;; Use the value from the list.
2861 (setq global (eval (cdr local))))
2862 (set (make-local-variable (car local)) global))
2863 ;; Simple nil-valued local variable.
2864 (set (make-local-variable local) nil)))))
2866 (defun gnus-summary-clear-local-variables ()
2867 (let ((locals gnus-summary-local-variables))
2869 (if (consp (car locals))
2870 (and (vectorp (caar locals))
2871 (set (caar locals) nil))
2872 (and (vectorp (car locals))
2873 (set (car locals) nil)))
2874 (setq locals (cdr locals)))))
2876 ;; Summary data functions.
2878 (defmacro gnus-data-number (data)
2881 (defmacro gnus-data-set-number (data number)
2882 `(setcar ,data ,number))
2884 (defmacro gnus-data-mark (data)
2887 (defmacro gnus-data-set-mark (data mark)
2888 `(setcar (nthcdr 1 ,data) ,mark))
2890 (defmacro gnus-data-pos (data)
2893 (defmacro gnus-data-set-pos (data pos)
2894 `(setcar (nthcdr 2 ,data) ,pos))
2896 (defmacro gnus-data-header (data)
2899 (defmacro gnus-data-set-header (data header)
2900 `(setf (nth 3 ,data) ,header))
2902 (defmacro gnus-data-level (data)
2905 (defmacro gnus-data-unread-p (data)
2906 `(= (nth 1 ,data) gnus-unread-mark))
2908 (defmacro gnus-data-read-p (data)
2909 `(/= (nth 1 ,data) gnus-unread-mark))
2911 (defmacro gnus-data-pseudo-p (data)
2912 `(consp (nth 3 ,data)))
2914 (defmacro gnus-data-find (number)
2915 `(assq ,number gnus-newsgroup-data))
2917 (defmacro gnus-data-find-list (number &optional data)
2918 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2919 (memq (assq ,number bdata)
2922 (defmacro gnus-data-make (number mark pos header level)
2923 `(list ,number ,mark ,pos ,header ,level))
2925 (defun gnus-data-enter (after-article number mark pos header level offset)
2926 (let ((data (gnus-data-find-list after-article)))
2928 (error "No such article: %d" after-article))
2929 (setcdr data (cons (gnus-data-make number mark pos header level)
2931 (setq gnus-newsgroup-data-reverse nil)
2932 (gnus-data-update-list (cddr data) offset)))
2934 (defun gnus-data-enter-list (after-article list &optional offset)
2936 (let ((data (and after-article (gnus-data-find-list after-article)))
2940 (let ((odata gnus-newsgroup-data))
2941 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2943 (gnus-data-update-list odata offset)))
2944 ;; Find the last element in the list to be spliced into the main
2947 (setq list (cdr list)))
2950 (setcdr list gnus-newsgroup-data)
2951 (setq gnus-newsgroup-data ilist)
2953 (gnus-data-update-list (cdr list) offset)))
2954 (setcdr list (cdr data))
2957 (gnus-data-update-list (cdr list) offset))))
2958 (setq gnus-newsgroup-data-reverse nil))))
2960 (defun gnus-data-remove (article &optional offset)
2961 (let ((data gnus-newsgroup-data))
2962 (if (= (gnus-data-number (car data)) article)
2964 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2965 gnus-newsgroup-data-reverse nil)
2967 (gnus-data-update-list gnus-newsgroup-data offset)))
2969 (when (= (gnus-data-number (cadr data)) article)
2970 (setcdr data (cddr data))
2972 (gnus-data-update-list (cdr data) offset))
2974 gnus-newsgroup-data-reverse nil))
2975 (setq data (cdr data))))))
2977 (defmacro gnus-data-list (backward)
2979 (or gnus-newsgroup-data-reverse
2980 (setq gnus-newsgroup-data-reverse
2981 (reverse gnus-newsgroup-data)))
2982 gnus-newsgroup-data))
2984 (defun gnus-data-update-list (data offset)
2985 "Add OFFSET to the POS of all data entries in DATA."
2986 (setq gnus-newsgroup-data-reverse nil)
2988 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2989 (setq data (cdr data))))
2991 (defun gnus-summary-article-pseudo-p (article)
2992 "Say whether this article is a pseudo article or not."
2993 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2995 (defmacro gnus-summary-article-sparse-p (article)
2996 "Say whether this article is a sparse article or not."
2997 `(memq ,article gnus-newsgroup-sparse))
2999 (defmacro gnus-summary-article-ancient-p (article)
3000 "Say whether this article is a sparse article or not."
3001 `(memq ,article gnus-newsgroup-ancient))
3003 (defun gnus-article-parent-p (number)
3004 "Say whether this article is a parent or not."
3005 (let ((data (gnus-data-find-list number)))
3006 (and (cdr data) ; There has to be an article after...
3007 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3008 (gnus-data-level (nth 1 data))))))
3010 (defun gnus-article-children (number)
3011 "Return a list of all children to NUMBER."
3012 (let* ((data (gnus-data-find-list number))
3013 (level (gnus-data-level (car data)))
3015 (setq data (cdr data))
3017 (= (gnus-data-level (car data)) (1+ level)))
3018 (push (gnus-data-number (car data)) children)
3019 (setq data (cdr data)))
3022 (defmacro gnus-summary-skip-intangible ()
3023 "If the current article is intangible, then jump to a different article."
3024 '(let ((to (get-text-property (point) 'gnus-intangible)))
3025 (and to (gnus-summary-goto-subject to))))
3027 (defmacro gnus-summary-article-intangible-p ()
3028 "Say whether this article is intangible or not."
3029 '(get-text-property (point) 'gnus-intangible))
3031 (defun gnus-article-read-p (article)
3032 "Say whether ARTICLE is read or not."
3033 (not (or (memq article gnus-newsgroup-marked)
3034 (memq article gnus-newsgroup-spam-marked)
3035 (memq article gnus-newsgroup-unreads)
3036 (memq article gnus-newsgroup-unselected)
3037 (memq article gnus-newsgroup-dormant))))
3039 ;; Some summary mode macros.
3041 (defmacro gnus-summary-article-number ()
3042 "The article number of the article on the current line.
3043 If there isn't an article number here, then we return the current
3046 (gnus-summary-skip-intangible)
3047 (or (get-text-property (point) 'gnus-number)
3048 (gnus-summary-last-subject))))
3050 (defmacro gnus-summary-article-header (&optional number)
3051 "Return the header of article NUMBER."
3052 `(gnus-data-header (gnus-data-find
3053 ,(or number '(gnus-summary-article-number)))))
3055 (defmacro gnus-summary-thread-level (&optional number)
3056 "Return the level of thread that starts with article NUMBER."
3057 `(if (and (eq gnus-summary-make-false-root 'dummy)
3058 (get-text-property (point) 'gnus-intangible))
3060 (gnus-data-level (gnus-data-find
3061 ,(or number '(gnus-summary-article-number))))))
3063 (defmacro gnus-summary-article-mark (&optional number)
3064 "Return the mark of article NUMBER."
3065 `(gnus-data-mark (gnus-data-find
3066 ,(or number '(gnus-summary-article-number)))))
3068 (defmacro gnus-summary-article-pos (&optional number)
3069 "Return the position of the line of article NUMBER."
3070 `(gnus-data-pos (gnus-data-find
3071 ,(or number '(gnus-summary-article-number)))))
3073 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3074 (defmacro gnus-summary-article-subject (&optional number)
3075 "Return current subject string or nil if nothing."
3078 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3079 '(gnus-data-header (assq (gnus-summary-article-number)
3080 gnus-newsgroup-data)))))
3083 (mail-header-subject headers))))
3085 (defmacro gnus-summary-article-score (&optional number)
3086 "Return current article score."
3087 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3088 gnus-newsgroup-scored))
3089 gnus-summary-default-score 0))
3091 (defun gnus-summary-article-children (&optional number)
3092 "Return a list of article numbers that are children of article NUMBER."
3093 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3094 (level (gnus-data-level (car data)))
3096 (while (and (setq data (cdr data))
3097 (> (setq l (gnus-data-level (car data))) level))
3098 (and (= (1+ level) l)
3099 (push (gnus-data-number (car data))
3101 (nreverse children)))
3103 (defun gnus-summary-article-parent (&optional number)
3104 "Return the article number of the parent of article NUMBER."
3105 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3106 (gnus-data-list t)))
3107 (level (gnus-data-level (car data))))
3109 () ; This is a root.
3110 ;; We search until we find an article with a level less than
3111 ;; this one. That function has to be the parent.
3112 (while (and (setq data (cdr data))
3113 (not (< (gnus-data-level (car data)) level))))
3114 (and data (gnus-data-number (car data))))))
3116 (defun gnus-unread-mark-p (mark)
3117 "Say whether MARK is the unread mark."
3118 (= mark gnus-unread-mark))
3120 (defun gnus-read-mark-p (mark)
3121 "Say whether MARK is one of the marks that mark as read.
3122 This is all marks except unread, ticked, dormant, and expirable."
3123 (not (or (= mark gnus-unread-mark)
3124 (= mark gnus-ticked-mark)
3125 (= mark gnus-spam-mark)
3126 (= mark gnus-dormant-mark)
3127 (= mark gnus-expirable-mark))))
3129 (defmacro gnus-article-mark (number)
3130 "Return the MARK of article NUMBER.
3131 This macro should only be used when computing the mark the \"first\"
3132 time; i.e., when generating the summary lines. After that,
3133 `gnus-summary-article-mark' should be used to examine the
3136 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3137 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3138 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3139 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3140 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3141 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3142 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3143 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3144 gnus-ancient-mark))))
3146 ;; Saving hidden threads.
3148 (defmacro gnus-save-hidden-threads (&rest forms)
3149 "Save hidden threads, eval FORMS, and restore the hidden threads."
3150 (let ((config (make-symbol "config")))
3151 `(let ((,config (gnus-hidden-threads-configuration)))
3155 (gnus-restore-hidden-threads-configuration ,config)))))
3156 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3157 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3159 (defun gnus-data-compute-positions ()
3160 "Compute the positions of all articles."
3161 (setq gnus-newsgroup-data-reverse nil)
3162 (let ((data gnus-newsgroup-data))
3164 (gnus-save-hidden-threads
3165 (gnus-summary-show-all-threads)
3166 (goto-char (point-min))
3168 (while (get-text-property (point) 'gnus-intangible)
3170 (gnus-data-set-pos (car data) (+ (point) 3))
3171 (setq data (cdr data))
3172 (forward-line 1))))))
3174 (defun gnus-hidden-threads-configuration ()
3175 "Return the current hidden threads configuration."
3178 (goto-char (point-min))
3179 (while (search-forward "\r" nil t)
3180 (push (1- (point)) config))
3183 (defun gnus-restore-hidden-threads-configuration (config)
3184 "Restore hidden threads configuration from CONFIG."
3186 (let (point buffer-read-only)
3187 (while (setq point (pop config))
3188 (when (and (< point (point-max))
3190 (eq (char-after) ?\n))
3191 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3193 ;; Various summary mode internalish functions.
3195 (defun gnus-mouse-pick-article (e)
3198 (gnus-summary-next-page nil t))
3200 (defun gnus-summary-set-display-table ()
3201 "Change the display table.
3202 Odd characters have a tendency to mess
3203 up nicely formatted displays - we make all possible glyphs
3204 display only a single character."
3206 ;; We start from the standard display table, if any.
3207 (let ((table (or (copy-sequence standard-display-table)
3208 (make-display-table)))
3210 ;; Nix out all the control chars...
3211 (while (>= (setq i (1- i)) 0)
3212 (aset table i [??]))
3213 ;; ... but not newline and cr, of course. (cr is necessary for the
3214 ;; selective display).
3215 (aset table ?\n nil)
3216 (aset table ?\r nil)
3217 ;; We keep TAB as well.
3218 (aset table ?\t nil)
3219 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3220 ;; Emacs 23 (unicode), that are not set already.
3221 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3224 (while (>= (setq i (1- i)) 127)
3225 ;; Only modify if the entry is nil.
3226 (unless (aref table i)
3227 (aset table i [??]))))
3228 (setq buffer-display-table table)))
3230 (defun gnus-summary-set-article-display-arrow (pos)
3231 "Update the overlay arrow to point to line at position POS."
3232 (when (and gnus-summary-display-arrow
3233 (boundp 'overlay-arrow-position)
3234 (boundp 'overlay-arrow-string))
3238 (unless overlay-arrow-position
3239 (setq overlay-arrow-position (make-marker)))
3240 (setq overlay-arrow-string "=>"
3241 overlay-arrow-position (set-marker overlay-arrow-position
3243 (current-buffer))))))
3245 (defun gnus-summary-setup-buffer (group)
3246 "Initialize summary buffer."
3247 (let ((buffer (gnus-summary-buffer-name group))
3248 (dead-name (concat "*Dead Summary "
3249 (gnus-group-decoded-name group) "*")))
3250 ;; If a dead summary buffer exists, we kill it.
3251 (when (gnus-buffer-live-p dead-name)
3252 (gnus-kill-buffer dead-name))
3253 (if (get-buffer buffer)
3256 (setq gnus-summary-buffer (current-buffer))
3257 (not gnus-newsgroup-prepared))
3258 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3259 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3260 (gnus-summary-mode group)
3262 (gnus-carpal-setup-buffer 'summary))
3263 (unless gnus-single-article-buffer
3264 (make-local-variable 'gnus-article-buffer)
3265 (make-local-variable 'gnus-article-current)
3266 (make-local-variable 'gnus-original-article-buffer))
3267 (setq gnus-newsgroup-name group)
3268 ;; Set any local variables in the group parameters.
3269 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3272 (defun gnus-set-global-variables ()
3273 "Set the global equivalents of the buffer-local variables.
3274 They are set to the latest values they had. These reflect the summary
3275 buffer that was in action when the last article was fetched."
3276 (when (eq major-mode 'gnus-summary-mode)
3277 (setq gnus-summary-buffer (current-buffer))
3278 (let ((name gnus-newsgroup-name)
3279 (marked gnus-newsgroup-marked)
3280 (spam gnus-newsgroup-spam-marked)
3281 (unread gnus-newsgroup-unreads)
3282 (headers gnus-current-headers)
3283 (data gnus-newsgroup-data)
3284 (summary gnus-summary-buffer)
3285 (article-buffer gnus-article-buffer)
3286 (original gnus-original-article-buffer)
3287 (gac gnus-article-current)
3288 (reffed gnus-reffed-article-number)
3289 (score-file gnus-current-score-file)
3290 (default-charset gnus-newsgroup-charset)
3292 (let ((locals gnus-newsgroup-variables))
3294 (if (consp (car locals))
3295 (push (eval (caar locals)) vlist)
3296 (push (eval (car locals)) vlist))
3297 (setq locals (cdr locals)))
3298 (setq vlist (nreverse vlist)))
3300 (set-buffer gnus-group-buffer)
3301 (setq gnus-newsgroup-name name
3302 gnus-newsgroup-marked marked
3303 gnus-newsgroup-spam-marked spam
3304 gnus-newsgroup-unreads unread
3305 gnus-current-headers headers
3306 gnus-newsgroup-data data
3307 gnus-article-current gac
3308 gnus-summary-buffer summary
3309 gnus-article-buffer article-buffer
3310 gnus-original-article-buffer original
3311 gnus-reffed-article-number reffed
3312 gnus-current-score-file score-file
3313 gnus-newsgroup-charset default-charset)
3314 (let ((locals gnus-newsgroup-variables))
3316 (if (consp (car locals))
3317 (set (caar locals) (pop vlist))
3318 (set (car locals) (pop vlist)))
3319 (setq locals (cdr locals))))
3320 ;; The article buffer also has local variables.
3321 (when (gnus-buffer-live-p gnus-article-buffer)
3322 (set-buffer gnus-article-buffer)
3323 (setq gnus-summary-buffer summary))))))
3325 (defun gnus-summary-article-unread-p (article)
3326 "Say whether ARTICLE is unread or not."
3327 (memq article gnus-newsgroup-unreads))
3329 (defun gnus-summary-first-article-p (&optional article)
3330 "Return whether ARTICLE is the first article in the buffer."
3331 (if (not (setq article (or article (gnus-summary-article-number))))
3333 (eq article (caar gnus-newsgroup-data))))
3335 (defun gnus-summary-last-article-p (&optional article)
3336 "Return whether ARTICLE is the last article in the buffer."
3337 (if (not (setq article (or article (gnus-summary-article-number))))
3338 ;; All non-existent numbers are the last article. :-)
3340 (not (cdr (gnus-data-find-list article)))))
3342 (defun gnus-make-thread-indent-array ()
3344 (unless (and gnus-thread-indent-array
3345 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3346 (setq gnus-thread-indent-array (make-vector 201 "")
3347 gnus-thread-indent-array-level gnus-thread-indent-level)
3349 (aset gnus-thread-indent-array n
3350 (make-string (* n gnus-thread-indent-level) ? ))
3353 (defun gnus-update-summary-mark-positions ()
3354 "Compute where the summary marks are to go."
3356 (when (gnus-buffer-exists-p gnus-summary-buffer)
3357 (set-buffer gnus-summary-buffer))
3358 (let ((spec gnus-summary-line-format-spec)
3361 (gnus-set-work-buffer)
3362 (let ((gnus-tmp-unread ?Z)
3363 (gnus-replied-mark ?Z)
3364 (gnus-score-below-mark ?Z)
3365 (gnus-score-over-mark ?Z)
3366 (gnus-undownloaded-mark ?Z)
3367 (gnus-summary-line-format-spec spec)
3368 (gnus-newsgroup-downloadable '(0))
3369 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3370 case-fold-search ignores)
3371 ;; Here, all marks are bound to Z.
3372 (gnus-summary-insert-line header
3373 0 nil t gnus-tmp-unread t nil "" nil 1)
3374 (goto-char (point-min))
3375 ;; Memorize the positions of the same characters as dummy marks.
3376 (while (re-search-forward "[A-D]" nil t)
3377 (push (point) ignores))
3379 ;; We use A-D as dummy marks in order to know column positions
3380 ;; where marks should be inserted.
3381 (setq gnus-tmp-unread ?A
3382 gnus-replied-mark ?B
3383 gnus-score-below-mark ?C
3384 gnus-score-over-mark ?C
3385 gnus-undownloaded-mark ?D)
3386 (gnus-summary-insert-line header
3387 0 nil t gnus-tmp-unread t nil "" nil 1)
3388 ;; Ignore characters which aren't dummy marks.
3390 (delete-region (goto-char (1- p)) p)
3392 (goto-char (point-min))
3393 (setq pos (list (cons 'unread
3394 (and (search-forward "A" nil t)
3395 (- (point) (point-min) 1)))))
3396 (goto-char (point-min))
3397 (push (cons 'replied (and (search-forward "B" nil t)
3398 (- (point) (point-min) 1)))
3400 (goto-char (point-min))
3401 (push (cons 'score (and (search-forward "C" nil t)
3402 (- (point) (point-min) 1)))
3404 (goto-char (point-min))
3405 (push (cons 'download (and (search-forward "D" nil t)
3406 (- (point) (point-min) 1)))
3408 (setq gnus-summary-mark-positions pos))))
3410 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3411 "Insert a dummy root in the summary buffer."
3413 (gnus-add-text-properties
3414 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3415 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3417 (defun gnus-summary-extract-address-component (from)
3418 (or (car (funcall gnus-extract-address-components from))
3421 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3422 (let ((mail-parse-charset gnus-newsgroup-charset)
3423 ; Is it really necessary to do this next part for each summary line?
3424 ; Luckily, doesn't seem to slow things down much.
3425 (mail-parse-ignored-charsets
3426 (save-excursion (set-buffer gnus-summary-buffer)
3427 gnus-newsgroup-ignored-charsets)))
3429 (and gnus-ignored-from-addresses
3430 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3431 (let ((extra-headers (mail-header-extra header))
3435 ((setq to (cdr (assq 'To extra-headers)))
3438 (gnus-summary-extract-address-component
3439 (funcall gnus-decode-encoded-word-function to)))))
3440 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3441 (concat "=> " newsgroups)))))
3442 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3444 (defun gnus-summary-insert-line (gnus-tmp-header
3445 gnus-tmp-level gnus-tmp-current
3446 undownloaded gnus-tmp-unread gnus-tmp-replied
3447 gnus-tmp-expirable gnus-tmp-subject-or-nil
3448 &optional gnus-tmp-dummy gnus-tmp-score
3450 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3451 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3452 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3453 (gnus-tmp-score-char
3454 (if (or (null gnus-summary-default-score)
3455 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3456 gnus-summary-zcore-fuzz))
3458 (if (< gnus-tmp-score gnus-summary-default-score)
3459 gnus-score-below-mark gnus-score-over-mark)))
3460 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3462 (cond (gnus-tmp-process gnus-process-mark)
3463 ((memq gnus-tmp-current gnus-newsgroup-cached)
3465 (gnus-tmp-replied gnus-replied-mark)
3466 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3467 gnus-forwarded-mark)
3468 ((memq gnus-tmp-current gnus-newsgroup-saved)
3470 ((memq gnus-tmp-number gnus-newsgroup-recent)
3472 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3475 (gnus-tmp-downloaded
3477 gnus-undownloaded-mark)
3478 (gnus-newsgroup-agentized
3479 gnus-downloaded-mark)
3482 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3485 ((string-match "<[^>]+> *$" gnus-tmp-from)
3486 (let ((beg (match-beginning 0)))
3487 (or (and (string-match "^\".+\"" gnus-tmp-from)
3488 (substring gnus-tmp-from 1 (1- (match-end 0))))
3489 (substring gnus-tmp-from 0 beg))))
3490 ((string-match "(.+)" gnus-tmp-from)
3491 (substring gnus-tmp-from
3492 (1+ (match-beginning 0)) (1- (match-end 0))))
3494 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3495 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3496 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3497 (buffer-read-only nil))
3498 (when (string= gnus-tmp-name "")
3499 (setq gnus-tmp-name gnus-tmp-from))
3500 (unless (numberp gnus-tmp-lines)
3501 (setq gnus-tmp-lines -1))
3502 (if (= gnus-tmp-lines -1)
3503 (setq gnus-tmp-lines "?")
3504 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3505 (gnus-put-text-property
3507 (progn (eval gnus-summary-line-format-spec) (point))
3508 'gnus-number gnus-tmp-number)
3509 (when (gnus-visual-p 'summary-highlight 'highlight)
3511 (gnus-run-hooks 'gnus-summary-update-hook)
3514 (defun gnus-summary-update-line (&optional dont-update)
3515 "Update summary line after change."
3516 (when (and gnus-summary-default-score
3517 (not gnus-summary-inhibit-highlight))
3518 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3519 (article (gnus-summary-article-number))
3520 (score (gnus-summary-article-score article)))
3522 (if (and gnus-summary-mark-below
3523 (< (gnus-summary-article-score)
3524 gnus-summary-mark-below))
3525 ;; This article has a low score, so we mark it as read.
3526 (when (memq article gnus-newsgroup-unreads)
3527 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3528 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3529 ;; This article was previously marked as read on account
3530 ;; of a low score, but now it has risen, so we mark it as
3532 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3533 (gnus-summary-update-mark
3534 (if (or (null gnus-summary-default-score)
3535 (<= (abs (- score gnus-summary-default-score))
3536 gnus-summary-zcore-fuzz))
3538 (if (< score gnus-summary-default-score)
3539 gnus-score-below-mark gnus-score-over-mark))
3541 ;; Do visual highlighting.
3542 (when (gnus-visual-p 'summary-highlight 'highlight)
3543 (gnus-run-hooks 'gnus-summary-update-hook)))))
3545 (defvar gnus-tmp-new-adopts nil)
3547 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3548 "Return the number of articles in THREAD.
3549 This may be 0 in some cases -- if none of the articles in
3550 the thread are to be displayed."
3552 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3554 ((not (listp thread))
3556 ((and (consp thread) (cdr thread))
3559 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3562 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3565 (when (and level (zerop level) gnus-tmp-new-adopts)
3568 'gnus-summary-number-of-articles-in-thread
3569 gnus-tmp-new-adopts))))
3571 (if (> number 1) gnus-not-empty-thread-mark
3572 gnus-empty-thread-mark)
3575 (defsubst gnus-summary-line-message-size (head)
3576 "Return pretty-printed version of message size.
3577 This function is intended to be used in
3578 `gnus-summary-line-format-alist'."
3579 (let ((c (or (mail-header-chars head) -1)))
3580 (cond ((< c 0) "n/a") ; chars not available
3581 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3582 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3583 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3584 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3587 (defun gnus-summary-set-local-parameters (group)
3588 "Go through the local params of GROUP and set all variable specs in that list."
3589 (let ((params (gnus-group-find-parameter group))
3590 (vars '(quit-config)) ; Ignore quit-config.
3593 (setq elem (car params)
3594 params (cdr params))
3595 (and (consp elem) ; Has to be a cons.
3596 (consp (cdr elem)) ; The cdr has to be a list.
3597 (symbolp (car elem)) ; Has to be a symbol in there.
3598 (not (memq (car elem) vars))
3599 (ignore-errors ; So we set it.
3600 (push (car elem) vars)
3601 (make-local-variable (car elem))
3602 (set (car elem) (eval (nth 1 elem))))))))
3604 (defun gnus-summary-read-group (group &optional show-all no-article
3605 kill-buffer no-display backward
3607 "Start reading news in newsgroup GROUP.
3608 If SHOW-ALL is non-nil, already read articles are also listed.
3609 If NO-ARTICLE is non-nil, no article is selected initially.
3610 If NO-DISPLAY, don't generate a summary buffer."
3614 (let ((gnus-auto-select-next nil))
3615 (or (gnus-summary-read-group-1
3616 group show-all no-article
3617 kill-buffer no-display
3620 select-articles nil)))))
3621 (eq gnus-auto-select-next 'quietly))
3622 (set-buffer gnus-group-buffer)
3623 ;; The entry function called above goes to the next
3624 ;; group automatically, so we go two groups back
3625 ;; if we are searching for the previous group.
3627 (gnus-group-prev-unread-group 2))
3628 (if (not (equal group (gnus-group-group-name)))
3629 (setq group (gnus-group-group-name))
3633 (defun gnus-summary-read-group-1 (group show-all no-article
3634 kill-buffer no-display
3635 &optional select-articles)
3636 ;; Killed foreign groups can't be entered.
3637 ;; (when (and (not (gnus-group-native-p group))
3638 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3639 ;; (error "Dead non-native groups can't be entered"))
3640 (gnus-message 5 "Retrieving newsgroup: %s..."
3641 (gnus-group-decoded-name group))
3642 (let* ((new-group (gnus-summary-setup-buffer group))
3643 (quit-config (gnus-group-quit-config group))
3644 (did-select (and new-group (gnus-select-newsgroup
3645 group show-all select-articles))))
3647 ;; This summary buffer exists already, so we just select it.
3649 (gnus-set-global-variables)
3651 (gnus-kill-or-deaden-summary kill-buffer))
3652 (gnus-configure-windows 'summary 'force)
3653 (gnus-set-mode-line 'summary)
3654 (gnus-summary-position-point)
3657 ;; We couldn't select this group.
3659 (when (and (eq major-mode 'gnus-summary-mode)
3660 (not (equal (current-buffer) kill-buffer)))
3661 (kill-buffer (current-buffer))
3662 (if (not quit-config)
3664 ;; Update the info -- marks might need to be removed,
3666 (gnus-summary-update-info)
3667 (set-buffer gnus-group-buffer)
3668 (gnus-group-jump-to-group group)
3669 (gnus-group-next-unread-group 1))
3670 (gnus-handle-ephemeral-exit quit-config)))
3671 (let ((grpinfo (gnus-get-info group)))
3672 (if (null (gnus-info-read grpinfo))
3673 (gnus-message 3 "Group %s contains no messages"
3674 (gnus-group-decoded-name group))
3675 (gnus-message 3 "Can't select group")))
3677 ;; The user did a `C-g' while prompting for number of articles,
3678 ;; so we exit this group.
3679 ((eq did-select 'quit)
3680 (and (eq major-mode 'gnus-summary-mode)
3681 (not (equal (current-buffer) kill-buffer))
3682 (kill-buffer (current-buffer)))
3684 (gnus-kill-or-deaden-summary kill-buffer))
3685 (if (not quit-config)
3687 (set-buffer gnus-group-buffer)
3688 (gnus-group-jump-to-group group)
3689 (gnus-group-next-unread-group 1)
3690 (gnus-configure-windows 'group 'force))
3691 (gnus-handle-ephemeral-exit quit-config))
3692 ;; Finally signal the quit.
3694 ;; The group was successfully selected.
3696 (gnus-set-global-variables)
3697 ;; Save the active value in effect when the group was entered.
3698 (setq gnus-newsgroup-active
3700 (gnus-active gnus-newsgroup-name)))
3701 ;; You can change the summary buffer in some way with this hook.
3702 (gnus-run-hooks 'gnus-select-group-hook)
3703 (when (memq 'summary (gnus-update-format-specifications
3704 nil 'summary 'summary-mode 'summary-dummy))
3705 ;; The format specification for the summary line was updated,
3706 ;; so we need to update the mark positions as well.
3707 (gnus-update-summary-mark-positions))
3708 ;; Do score processing.
3709 (when gnus-use-scoring
3710 (gnus-possibly-score-headers))
3711 ;; Check whether to fill in the gaps in the threads.
3712 (when gnus-build-sparse-threads
3713 (gnus-build-sparse-threads))
3714 ;; Find the initial limit.
3716 (let ((gnus-newsgroup-dormant nil))
3717 (gnus-summary-initial-limit show-all))
3718 (gnus-summary-initial-limit show-all))
3719 ;; Generate the summary buffer.
3721 (gnus-summary-prepare))
3722 (when gnus-use-trees
3723 (gnus-tree-open group)
3724 (setq gnus-summary-highlight-line-function
3725 'gnus-tree-highlight-article))
3726 ;; If the summary buffer is empty, but there are some low-scored
3727 ;; articles or some excluded dormants, we include these in the
3729 (when (and (zerop (buffer-size))
3731 (cond (gnus-newsgroup-dormant
3732 (gnus-summary-limit-include-dormant))
3733 ((and gnus-newsgroup-scored show-all)
3734 (gnus-summary-limit-include-expunged t))))
3735 ;; Function `gnus-apply-kill-file' must be called in this hook.
3736 (gnus-run-hooks 'gnus-apply-kill-hook)
3737 (if (and (zerop (buffer-size))
3740 ;; This newsgroup is empty.
3741 (gnus-summary-catchup-and-exit nil t)
3742 (gnus-message 6 "No unread news")
3744 (gnus-kill-or-deaden-summary kill-buffer))
3745 ;; Return nil from this function.
3747 ;; Hide conversation thread subtrees. We cannot do this in
3748 ;; gnus-summary-prepare-hook since kill processing may not
3749 ;; work with hidden articles.
3750 (gnus-summary-maybe-hide-threads)
3752 (gnus-kill-or-deaden-summary kill-buffer))
3753 (gnus-summary-auto-select-subject)
3754 ;; Show first unread article if requested.
3755 (if (and (not no-article)
3757 gnus-newsgroup-unreads
3758 gnus-auto-select-first)
3760 (gnus-configure-windows 'summary)
3761 (let ((art (gnus-summary-article-number)))
3762 (unless (and (not gnus-plugged)
3763 (or (memq art gnus-newsgroup-undownloaded)
3764 (memq art gnus-newsgroup-downloadable)))
3765 (gnus-summary-goto-article art))))
3766 ;; Don't select any articles.
3767 (gnus-summary-position-point)
3768 (gnus-configure-windows 'summary 'force)
3769 (gnus-set-mode-line 'summary))
3770 (when (and gnus-auto-center-group
3771 (get-buffer-window gnus-group-buffer t))
3772 ;; Gotta use windows, because recenter does weird stuff if
3773 ;; the current buffer ain't the displayed window.
3774 (let ((owin (selected-window)))
3775 (select-window (get-buffer-window gnus-group-buffer t))
3776 (when (gnus-group-goto-group group)
3778 (select-window owin)))
3779 ;; Mark this buffer as "prepared".
3780 (setq gnus-newsgroup-prepared t)
3781 (gnus-run-hooks 'gnus-summary-prepared-hook)
3782 (unless (gnus-ephemeral-group-p group)
3783 (gnus-group-update-group group))
3786 (defun gnus-summary-auto-select-subject ()
3787 "Select the subject line on initial group entry."
3788 (goto-char (point-min))
3790 ((eq gnus-auto-select-subject 'best)
3791 (gnus-summary-best-unread-subject))
3792 ((eq gnus-auto-select-subject 'unread)
3793 (gnus-summary-first-unread-subject))
3794 ((eq gnus-auto-select-subject 'unseen)
3795 (gnus-summary-first-unseen-subject))
3796 ((eq gnus-auto-select-subject 'unseen-or-unread)
3797 (gnus-summary-first-unseen-or-unread-subject))
3798 ((eq gnus-auto-select-subject 'first)
3801 ((functionp gnus-auto-select-subject)
3802 (funcall gnus-auto-select-subject))))
3804 (defun gnus-summary-prepare ()
3805 "Generate the summary buffer."
3807 (let ((buffer-read-only nil))
3809 (setq gnus-newsgroup-data nil
3810 gnus-newsgroup-data-reverse nil)
3811 (gnus-run-hooks 'gnus-summary-generate-hook)
3812 ;; Generate the buffer, either with threads or without.
3813 (when gnus-newsgroup-headers
3814 (gnus-summary-prepare-threads
3815 (if gnus-show-threads
3816 (gnus-sort-gathered-threads
3817 (funcall gnus-summary-thread-gathering-function
3819 (gnus-cut-threads (gnus-make-threads)))))
3820 ;; Unthreaded display.
3821 (gnus-sort-articles gnus-newsgroup-headers))))
3822 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3823 ;; Call hooks for modifying summary buffer.
3824 (goto-char (point-min))
3825 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3827 (defsubst gnus-general-simplify-subject (subject)
3828 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3831 ;; Truncate the subject.
3832 (gnus-simplify-subject-functions
3833 (gnus-map-function gnus-simplify-subject-functions subject))
3834 ((numberp gnus-summary-gather-subject-limit)
3835 (setq subject (gnus-simplify-subject-re subject))
3836 (if (> (length subject) gnus-summary-gather-subject-limit)
3837 (substring subject 0 gnus-summary-gather-subject-limit)
3839 ;; Fuzzily simplify it.
3840 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3841 (gnus-simplify-subject-fuzzy subject))
3842 ;; Just remove the leading "Re:".
3844 (gnus-simplify-subject-re subject))))
3846 (if (and gnus-summary-gather-exclude-subject
3847 (string-match gnus-summary-gather-exclude-subject subject))
3848 nil ; This article shouldn't be gathered
3851 (defun gnus-summary-simplify-subject-query ()
3852 "Query where the respool algorithm would put this article."
3854 (gnus-summary-select-article)
3855 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3857 (defun gnus-gather-threads-by-subject (threads)
3858 "Gather threads by looking at Subject headers."
3859 (if (not gnus-summary-make-false-root)
3861 (let ((hashtb (gnus-make-hashtable 1024))
3864 subject hthread whole-subject)
3866 (setq subject (gnus-general-simplify-subject
3867 (setq whole-subject (mail-header-subject
3870 (if (setq hthread (gnus-gethash subject hashtb))
3872 ;; We enter a dummy root into the thread, if we
3873 ;; haven't done that already.
3874 (unless (stringp (caar hthread))
3875 (setcar hthread (list whole-subject (car hthread))))
3876 ;; We add this new gathered thread to this gathered
3878 (setcdr (car hthread)
3879 (nconc (cdar hthread) (list (car threads))))
3880 ;; Remove it from the list of threads.
3881 (setcdr prev (cdr threads))
3882 (setq threads prev))
3883 ;; Enter this thread into the hash table.
3884 (gnus-sethash subject
3885 (if gnus-summary-make-false-root-always
3887 ;; If you want a dummy root above all
3889 (setcar threads (list whole-subject
3895 (setq threads (cdr threads)))
3898 (defun gnus-gather-threads-by-references (threads)
3899 "Gather threads by looking at References headers."
3900 (let ((idhashtb (gnus-make-hashtable 1024))
3901 (thhashtb (gnus-make-hashtable 1024))
3904 ids references id gthread gid entered ref)
3906 (when (setq references (mail-header-references (caar threads)))
3907 (setq id (mail-header-id (caar threads))
3908 ids (inline (gnus-split-references references))
3910 (while (setq ref (pop ids))
3911 (setq ids (delete ref ids))
3912 (if (not (setq gid (gnus-gethash ref idhashtb)))
3914 (gnus-sethash ref id idhashtb)
3915 (gnus-sethash id threads thhashtb))
3916 (setq gthread (gnus-gethash gid thhashtb))
3918 ;; We enter a dummy root into the thread, if we
3919 ;; haven't done that already.
3920 (unless (stringp (caar gthread))
3921 (setcar gthread (list (mail-header-subject (caar gthread))
3923 ;; We add this new gathered thread to this gathered
3925 (setcdr (car gthread)
3926 (nconc (cdar gthread) (list (car threads)))))
3927 ;; Add it into the thread hash table.
3928 (gnus-sethash id gthread thhashtb)
3930 ;; Remove it from the list of threads.
3931 (setcdr prev (cdr threads))
3932 (setq threads prev))))
3934 (setq threads (cdr threads)))
3937 (defun gnus-sort-gathered-threads (threads)
3938 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3939 (let ((result threads))
3941 (when (stringp (caar threads))
3942 (setcdr (car threads)
3943 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3944 (setq threads (cdr threads)))
3947 (defun gnus-thread-loop-p (root thread)
3948 "Say whether ROOT is in THREAD."
3949 (let ((stack (list thread))
3952 (while (setq thread (pop stack))
3953 (setq th (cdr thread))
3955 (not (eq (caar th) root)))
3958 ;; We have found a loop.
3960 (setcdr thread (delq (car th) (cdr thread)))
3961 (if (boundp (setq ref-dep (intern "none"
3962 gnus-newsgroup-dependencies)))
3963 (setcdr (symbol-value ref-dep)
3964 (nconc (cdr (symbol-value ref-dep))
3966 (set ref-dep (list nil (car th))))
3969 ;; Push all the subthreads onto the stack.
3970 (push (cdr thread) stack)))
3973 (defun gnus-make-threads ()
3974 "Go through the dependency hashtb and find the roots. Return all threads."
3976 (while (catch 'infloop
3979 ;; Deal with self-referencing References loops.
3980 (when (and (car (symbol-value refs))
3987 (car (symbol-value refs)) thread))
3988 (cdr (symbol-value refs)))))))
3991 (unless (car (symbol-value refs))
3992 ;; These threads do not refer back to any other
3993 ;; articles, so they're roots.
3994 (setq threads (append (cdr (symbol-value refs)) threads))))
3995 gnus-newsgroup-dependencies)))
3998 ;; Build the thread tree.
3999 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4000 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4002 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4003 if it was already present.
4005 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4006 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4007 Message-IDs will be renamed to a unique Message-ID before being
4010 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4011 (let* ((id (mail-header-id header))
4012 (id-dep (and id (intern id dependencies)))
4013 parent-id ref ref-dep ref-header replaced)
4014 ;; Enter this `header' in the `dependencies' table.
4018 ;; The first two cases do the normal part: enter a new `header'
4019 ;; in the `dependencies' table.
4020 ((not (boundp id-dep))
4021 (set id-dep (list header)))
4022 ((null (car (symbol-value id-dep)))
4023 (setcar (symbol-value id-dep) header))
4025 ;; From here the `header' was already present in the
4026 ;; `dependencies' table.
4028 ;; Overrides an existing entry;
4029 ;; just set the header part of the entry.
4030 (setcar (symbol-value id-dep) header)
4033 ;; Renames the existing `header' to a unique Message-ID.
4034 ((not gnus-summary-ignore-duplicates)
4035 ;; An article with this Message-ID has already been seen.
4036 ;; We rename the Message-ID.
4037 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4039 (mail-header-set-id header id))
4041 ;; The last case ignores an existing entry, except it adds any
4042 ;; additional Xrefs (in case the two articles came from different
4044 ;; Also sets `header' to `nil' meaning that the `dependencies'
4045 ;; table was *not* modified.
4047 (mail-header-set-xref
4048 (car (symbol-value id-dep))
4049 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4051 (or (mail-header-xref header) "")))
4054 (when (and header (not replaced))
4055 ;; First check that we are not creating a References loop.
4056 (setq parent-id (gnus-parent-id (mail-header-references header)))
4057 (setq ref parent-id)
4059 (setq ref-dep (intern-soft ref dependencies))
4061 (setq ref-header (car (symbol-value ref-dep))))
4062 (if (string= id ref)
4063 ;; Yuk! This is a reference loop. Make the article be a
4066 (mail-header-set-references (car (symbol-value id-dep)) "none")
4068 (setq parent-id nil))
4069 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4070 (setq ref-dep (intern (or parent-id "none") dependencies))
4071 (if (boundp ref-dep)
4072 (setcdr (symbol-value ref-dep)
4073 (nconc (cdr (symbol-value ref-dep))
4074 (list (symbol-value id-dep))))
4075 (set ref-dep (list nil (symbol-value id-dep)))))
4078 (defun gnus-extract-message-id-from-in-reply-to (string)
4079 (if (string-match "<[^>]+>" string)
4080 (substring string (match-beginning 0) (match-end 0))
4083 (defun gnus-build-sparse-threads ()
4084 (let ((headers gnus-newsgroup-headers)
4085 (mail-parse-charset gnus-newsgroup-charset)
4086 (gnus-summary-ignore-duplicates t)
4087 header references generation relations
4088 subject child end new-child date)
4089 ;; First we create an alist of generations/relations, where
4090 ;; generations is how much we trust the relation, and the relation
4092 (gnus-message 7 "Making sparse threads...")
4094 (nnheader-set-temp-buffer " *gnus sparse threads*")
4095 (while (setq header (pop headers))
4096 (when (and (setq references (mail-header-references header))
4097 (not (string= references "")))
4099 (setq child (mail-header-id header)
4100 subject (mail-header-subject header)
4101 date (mail-header-date header)
4103 (while (search-backward ">" nil t)
4104 (setq end (1+ (point)))
4105 (when (search-backward "<" nil t)
4106 (setq new-child (buffer-substring (point) end))
4107 (push (list (incf generation)
4108 child (setq child new-child)
4112 (push (list (1+ generation) child nil subject) relations))
4114 (kill-buffer (current-buffer)))
4115 ;; Sort over trustworthiness.
4118 (when (gnus-dependencies-add-header
4119 (make-full-mail-header
4120 gnus-reffed-article-number
4121 (nth 3 relation) "" (or (nth 4 relation) "")
4123 (or (nth 2 relation) "") 0 0 "")
4124 gnus-newsgroup-dependencies nil)
4125 (push gnus-reffed-article-number gnus-newsgroup-limit)
4126 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4127 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4128 gnus-newsgroup-reads)
4129 (decf gnus-reffed-article-number)))
4130 (sort relations 'car-less-than-car))
4131 (gnus-message 7 "Making sparse threads...done")))
4133 (defun gnus-build-old-threads ()
4134 ;; Look at all the articles that refer back to old articles, and
4135 ;; fetch the headers for the articles that aren't there. This will
4136 ;; build complete threads - if the roots haven't been expired by the
4138 (let ((mail-parse-charset gnus-newsgroup-charset)
4142 (when (not (car (symbol-value refs)))
4143 (setq heads (cdr (symbol-value refs)))
4145 (if (memq (mail-header-number (caar heads))
4146 gnus-newsgroup-dormant)
4147 (setq heads (cdr heads))
4148 (setq id (symbol-name refs))
4149 (while (and (setq id (gnus-build-get-header id))
4150 (not (car (gnus-id-to-thread id)))))
4151 (setq heads nil)))))
4152 gnus-newsgroup-dependencies)))
4154 (defsubst gnus-remove-odd-characters (string)
4155 "Translate STRING into something that doesn't contain weird characters."
4156 (mm-subst-char-in-string
4158 (mm-subst-char-in-string
4161 ;; This function has to be called with point after the article number
4162 ;; on the beginning of the line.
4163 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4164 (let ((eol (gnus-point-at-eol))
4165 (buffer (current-buffer))
4166 header references in-reply-to)
4168 ;; overview: [num subject from date id refs chars lines misc]
4171 (narrow-to-region (point) eol)
4176 (make-full-mail-header
4178 (condition-case () ; subject
4179 (gnus-remove-odd-characters
4180 (funcall gnus-decode-encoded-word-function
4181 (setq x (nnheader-nov-field))))
4183 (condition-case () ; from
4184 (gnus-remove-odd-characters
4185 (funcall gnus-decode-encoded-word-function
4186 (setq x (nnheader-nov-field))))
4188 (nnheader-nov-field) ; date
4189 (nnheader-nov-read-message-id) ; id
4190 (setq references (nnheader-nov-field)) ; refs
4191 (nnheader-nov-read-integer) ; chars
4192 (nnheader-nov-read-integer) ; lines
4194 (if (looking-at "Xref: ")
4195 (goto-char (match-end 0)))
4196 (nnheader-nov-field)) ; Xref
4197 (nnheader-nov-parse-extra)))) ; extra
4201 (when (and (string= references "")
4202 (setq in-reply-to (mail-header-extra header))
4203 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4204 (mail-header-set-references
4205 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4207 (when gnus-alter-header-function
4208 (funcall gnus-alter-header-function header))
4209 (gnus-dependencies-add-header header dependencies force-new)))
4211 (defun gnus-build-get-header (id)
4212 "Look through the buffer of NOV lines and find the header to ID.
4213 Enter this line into the dependencies hash table, and return
4214 the id of the parent article (if any)."
4215 (let ((deps gnus-newsgroup-dependencies)
4219 (set-buffer nntp-server-buffer)
4220 (let ((case-fold-search nil))
4221 (goto-char (point-min))
4222 (while (and (not found)
4223 (search-forward id nil t))
4225 (setq found (looking-at
4226 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4227 (regexp-quote id))))
4228 (or found (beginning-of-line 2)))
4232 (setq header (gnus-nov-parse-line
4233 (read (current-buffer)) deps))
4234 (gnus-parent-id (mail-header-references header))))))
4236 (let ((number (mail-header-number header)))
4237 (push number gnus-newsgroup-limit)
4238 (push header gnus-newsgroup-headers)
4239 (if (memq number gnus-newsgroup-unselected)
4241 (setq gnus-newsgroup-unreads
4242 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4244 (setq gnus-newsgroup-unselected
4245 (delq number gnus-newsgroup-unselected)))
4246 (push number gnus-newsgroup-ancient)))))))
4248 (defun gnus-build-all-threads ()
4249 "Read all the headers."
4250 (let ((gnus-summary-ignore-duplicates t)
4251 (mail-parse-charset gnus-newsgroup-charset)
4252 (dependencies gnus-newsgroup-dependencies)
4255 (set-buffer nntp-server-buffer)
4256 (let ((case-fold-search nil))
4257 (goto-char (point-min))
4260 (setq article (read (current-buffer))
4261 header (gnus-nov-parse-line article dependencies)))
4264 (set-buffer gnus-summary-buffer)
4265 (push header gnus-newsgroup-headers)
4266 (if (memq (setq article (mail-header-number header))
4267 gnus-newsgroup-unselected)
4269 (setq gnus-newsgroup-unreads
4270 (gnus-add-to-sorted-list
4271 gnus-newsgroup-unreads article))
4272 (setq gnus-newsgroup-unselected
4273 (delq article gnus-newsgroup-unselected)))
4274 (push article gnus-newsgroup-ancient)))
4275 (forward-line 1)))))))
4277 (defun gnus-summary-update-article-line (article header)
4278 "Update the line for ARTICLE using HEADER."
4279 (let* ((id (mail-header-id header))
4280 (thread (gnus-id-to-thread id)))
4282 (error "Article in no thread"))
4283 ;; Update the thread.
4284 (setcar thread header)
4285 (gnus-summary-goto-subject article)
4286 (let* ((datal (gnus-data-find-list article))
4288 (buffer-read-only nil)
4289 (level (gnus-summary-thread-level)))
4291 (let ((inserted (- (point)
4293 (gnus-summary-insert-line
4295 (memq article gnus-newsgroup-undownloaded)
4296 (gnus-article-mark article)
4297 (memq article gnus-newsgroup-replied)
4298 (memq article gnus-newsgroup-expirable)
4299 ;; Only insert the Subject string when it's different
4300 ;; from the previous Subject string.
4305 (mail-header-subject
4308 (gnus-data-find-list
4310 (gnus-data-list t)))))
4311 ;; Error on the side of excessive subjects.
4313 (mail-header-subject header)))
4315 (mail-header-subject header))
4316 nil (cdr (assq article gnus-newsgroup-scored))
4317 (memq article gnus-newsgroup-processable))
4320 (gnus-data-update-list
4322 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4324 (defun gnus-summary-update-article (article &optional iheader)
4325 "Update ARTICLE in the summary buffer."
4326 (set-buffer gnus-summary-buffer)
4327 (let* ((header (gnus-summary-article-header article))
4328 (id (mail-header-id header))
4329 (data (gnus-data-find article))
4330 (thread (gnus-id-to-thread id))
4331 (references (mail-header-references header))
4335 (when (and references
4336 (not (equal "" references)))
4339 (buffer-read-only nil)
4345 (delq thread parent)))
4346 (if (gnus-summary-insert-subject id header)
4347 ;; Set the (possibly) new article number in the data structure.
4348 (gnus-data-set-number data (gnus-id-to-article id))
4352 (defun gnus-rebuild-thread (id &optional line)
4353 "Rebuild the thread containing ID.
4354 If LINE, insert the rebuilt thread starting on line LINE."
4355 (let ((buffer-read-only nil)
4356 old-pos current thread data)
4357 (if (not gnus-show-threads)
4358 (setq thread (list (car (gnus-id-to-thread id))))
4359 ;; Get the thread this article is part of.
4360 (setq thread (gnus-remove-thread id)))
4361 (setq old-pos (gnus-point-at-bol))
4362 (setq current (save-excursion
4363 (and (re-search-backward "[\r\n]" nil t)
4364 (gnus-summary-article-number))))
4365 ;; If this is a gathered thread, we have to go some re-gathering.
4366 (when (stringp (car thread))
4367 (let ((subject (car thread))
4369 (setq thread (cdr thread))
4371 (unless (memq (setq thr (gnus-id-to-thread
4373 (mail-header-id (caar thread)))))
4376 (setq thread (cdr thread)))
4377 ;; We now have all (unique) roots.
4378 (if (= (length roots) 1)
4379 ;; All the loose roots are now one solid root.
4380 (setq thread (car roots))
4381 (setq thread (cons subject (gnus-sort-threads roots))))))
4383 ;; We then insert this thread into the summary buffer.
4385 (goto-char (point-min))
4386 (forward-line (1- line)))
4387 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4388 (if gnus-show-threads
4389 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4390 (gnus-summary-prepare-unthreaded thread))
4391 (setq data (nreverse gnus-newsgroup-data))
4392 (setq threads gnus-newsgroup-threads))
4393 ;; We splice the new data into the data structure.
4394 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4395 ;;!!! then we want to insert at the beginning of the buffer.
4396 ;;!!! That happens to be true with Gnus now, but that may
4397 ;;!!! change in the future. Perhaps.
4398 (gnus-data-enter-list
4399 (if line nil current) data (- (point) old-pos))
4400 (setq gnus-newsgroup-threads
4401 (nconc threads gnus-newsgroup-threads))
4402 (gnus-data-compute-positions))))
4404 (defun gnus-number-to-header (number)
4405 "Return the header for article NUMBER."
4406 (let ((headers gnus-newsgroup-headers))
4408 (not (= number (mail-header-number (car headers)))))
4413 (defun gnus-parent-headers (in-headers &optional generation)
4414 "Return the headers of the GENERATIONeth parent of HEADERS."
4416 (setq generation 1))
4418 (headers in-headers)
4421 (not (zerop generation))
4422 (setq references (mail-header-references headers)))
4423 (setq headers (if (and references
4424 (setq parent (gnus-parent-id references)))
4425 (car (gnus-id-to-thread parent))
4428 (and (not (eq headers in-headers))
4431 (defun gnus-id-to-thread (id)
4432 "Return the (sub-)thread where ID appears."
4433 (gnus-gethash id gnus-newsgroup-dependencies))
4435 (defun gnus-id-to-article (id)
4436 "Return the article number of ID."
4437 (let ((thread (gnus-id-to-thread id)))
4440 (mail-header-number (car thread)))))
4442 (defun gnus-id-to-header (id)
4443 "Return the article headers of ID."
4444 (car (gnus-id-to-thread id)))
4446 (defun gnus-article-displayed-root-p (article)
4447 "Say whether ARTICLE is a root(ish) article."
4448 (let ((level (gnus-summary-thread-level article))
4449 (refs (mail-header-references (gnus-summary-article-header article)))
4455 ((null (gnus-parent-id refs)) t)
4457 (null (setq particle (gnus-id-to-article
4458 (gnus-parent-id refs))))
4459 (null (gnus-summary-thread-level particle)))))))
4461 (defun gnus-root-id (id)
4462 "Return the id of the root of the thread where ID appears."
4464 (while (and id (setq prev (car (gnus-id-to-thread id))))
4466 id (gnus-parent-id (mail-header-references prev))))
4469 (defun gnus-articles-in-thread (thread)
4470 "Return the list of articles in THREAD."
4471 (cons (mail-header-number (car thread))
4472 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4474 (defun gnus-remove-thread (id &optional dont-remove)
4475 "Remove the thread that has ID in it."
4476 (let (headers thread last-id)
4477 ;; First go up in this thread until we find the root.
4478 (setq last-id (gnus-root-id id)
4479 headers (message-flatten-list (gnus-id-to-thread last-id)))
4480 ;; We have now found the real root of this thread. It might have
4481 ;; been gathered into some loose thread, so we have to search
4482 ;; through the threads to find the thread we wanted.
4483 (let ((threads gnus-newsgroup-threads)
4486 (setq sub (car threads))
4487 (if (stringp (car sub))
4488 ;; This is a gathered thread, so we look at the roots
4489 ;; below it to find whether this article is in this
4492 (setq sub (cdr sub))
4494 (when (member (caar sub) headers)
4495 (setq thread (car threads)
4498 (setq sub (cdr sub))))
4499 ;; It's an ordinary thread, so we check it.
4500 (when (eq (car sub) (car headers))
4503 (setq threads (cdr threads)))
4504 ;; If this article is in no thread, then it's a root.
4507 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4508 (setq thread (gnus-id-to-thread last-id)))
4511 thread ; We return this thread.
4513 (if (stringp (car thread))
4515 ;; If we use dummy roots, then we have to remove the
4516 ;; dummy root as well.
4517 (when (eq gnus-summary-make-false-root 'dummy)
4518 ;; We go to the dummy root by going to
4519 ;; the first sub-"thread", and then one line up.
4520 (gnus-summary-goto-article
4521 (mail-header-number (caadr thread)))
4524 (gnus-data-compute-positions))
4525 (setq thread (cdr thread))
4527 (gnus-remove-thread-1 (car thread))
4528 (setq thread (cdr thread))))
4529 (gnus-remove-thread-1 thread))))))))
4531 (defun gnus-remove-thread-1 (thread)
4532 "Remove the thread THREAD recursively."
4533 (let ((number (mail-header-number (pop thread)))
4535 (setq thread (reverse thread))
4537 (gnus-remove-thread-1 (pop thread)))
4538 (when (setq d (gnus-data-find number))
4539 (goto-char (gnus-data-pos d))
4540 (gnus-summary-show-thread)
4543 (- (gnus-point-at-bol)
4545 (1+ (gnus-point-at-eol))
4546 (gnus-delete-line)))))))
4548 (defun gnus-sort-threads-1 (threads func)
4549 (sort (mapcar (lambda (thread)
4552 (gnus-sort-threads-1 (cdr thread) func))))
4555 (defun gnus-sort-threads (threads)
4557 (if (not gnus-thread-sort-functions)
4559 (gnus-message 8 "Sorting threads...")
4560 (let ((max-lisp-eval-depth 5000))
4561 (prog1 (gnus-sort-threads-1
4563 (gnus-make-sort-function gnus-thread-sort-functions))
4564 (gnus-message 8 "Sorting threads...done")))))
4566 (defun gnus-sort-articles (articles)
4568 (when gnus-article-sort-functions
4569 (gnus-message 7 "Sorting articles...")
4571 (setq gnus-newsgroup-headers
4572 (sort articles (gnus-make-sort-function
4573 gnus-article-sort-functions)))
4574 (gnus-message 7 "Sorting articles...done"))))
4576 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4577 (defmacro gnus-thread-header (thread)
4578 "Return header of first article in THREAD.
4579 Note that THREAD must never, ever be anything else than a variable -
4580 using some other form will lead to serious barfage."
4581 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4582 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4583 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4586 (defsubst gnus-article-sort-by-number (h1 h2)
4587 "Sort articles by article number."
4588 (< (mail-header-number h1)
4589 (mail-header-number h2)))
4591 (defun gnus-thread-sort-by-number (h1 h2)
4592 "Sort threads by root article number."
4593 (gnus-article-sort-by-number
4594 (gnus-thread-header h1) (gnus-thread-header h2)))
4596 (defsubst gnus-article-sort-by-random (h1 h2)
4597 "Sort articles by article number."
4600 (defun gnus-thread-sort-by-random (h1 h2)
4601 "Sort threads by root article number."
4602 (gnus-article-sort-by-random
4603 (gnus-thread-header h1) (gnus-thread-header h2)))
4605 (defsubst gnus-article-sort-by-lines (h1 h2)
4606 "Sort articles by article Lines header."
4607 (< (mail-header-lines h1)
4608 (mail-header-lines h2)))
4610 (defun gnus-thread-sort-by-lines (h1 h2)
4611 "Sort threads by root article Lines header."
4612 (gnus-article-sort-by-lines
4613 (gnus-thread-header h1) (gnus-thread-header h2)))
4615 (defsubst gnus-article-sort-by-chars (h1 h2)
4616 "Sort articles by octet length."
4617 (< (mail-header-chars h1)
4618 (mail-header-chars h2)))
4620 (defun gnus-thread-sort-by-chars (h1 h2)
4621 "Sort threads by root article octet length."
4622 (gnus-article-sort-by-chars
4623 (gnus-thread-header h1) (gnus-thread-header h2)))
4625 (defsubst gnus-article-sort-by-author (h1 h2)
4626 "Sort articles by root author."
4628 (let ((extract (funcall
4629 gnus-extract-address-components
4630 (mail-header-from h1))))
4631 (or (car extract) (cadr extract) ""))
4632 (let ((extract (funcall
4633 gnus-extract-address-components
4634 (mail-header-from h2))))
4635 (or (car extract) (cadr extract) ""))))
4637 (defun gnus-thread-sort-by-author (h1 h2)
4638 "Sort threads by root author."
4639 (gnus-article-sort-by-author
4640 (gnus-thread-header h1) (gnus-thread-header h2)))
4642 (defsubst gnus-article-sort-by-subject (h1 h2)
4643 "Sort articles by root subject."
4645 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4646 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4648 (defun gnus-thread-sort-by-subject (h1 h2)
4649 "Sort threads by root subject."
4650 (gnus-article-sort-by-subject
4651 (gnus-thread-header h1) (gnus-thread-header h2)))
4653 (defsubst gnus-article-sort-by-date (h1 h2)
4654 "Sort articles by root article date."
4656 (gnus-date-get-time (mail-header-date h1))
4657 (gnus-date-get-time (mail-header-date h2))))
4659 (defun gnus-thread-sort-by-date (h1 h2)
4660 "Sort threads by root article date."
4661 (gnus-article-sort-by-date
4662 (gnus-thread-header h1) (gnus-thread-header h2)))
4664 (defsubst gnus-article-sort-by-score (h1 h2)
4665 "Sort articles by root article score.
4666 Unscored articles will be counted as having a score of zero."
4667 (> (or (cdr (assq (mail-header-number h1)
4668 gnus-newsgroup-scored))
4669 gnus-summary-default-score 0)
4670 (or (cdr (assq (mail-header-number h2)
4671 gnus-newsgroup-scored))
4672 gnus-summary-default-score 0)))
4674 (defun gnus-thread-sort-by-score (h1 h2)
4675 "Sort threads by root article score."
4676 (gnus-article-sort-by-score
4677 (gnus-thread-header h1) (gnus-thread-header h2)))
4679 (defun gnus-thread-sort-by-total-score (h1 h2)
4680 "Sort threads by the sum of all scores in the thread.
4681 Unscored articles will be counted as having a score of zero."
4682 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4684 (defun gnus-thread-total-score (thread)
4685 ;; This function find the total score of THREAD.
4690 (if (stringp (car thread))
4691 (apply gnus-thread-score-function 0
4692 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4693 (gnus-thread-total-score-1 thread)))
4695 (gnus-thread-total-score-1 (list thread)))))
4697 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4698 "Sort threads such that the thread with the most recently arrived article comes first."
4699 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4701 (defun gnus-thread-highest-number (thread)
4702 "Return the highest article number in THREAD."
4703 (apply 'max (mapcar (lambda (header)
4704 (mail-header-number header))
4705 (message-flatten-list thread))))
4707 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4708 "Sort threads such that the thread with the most recently dated article comes first."
4709 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4711 (defun gnus-thread-latest-date (thread)
4712 "Return the highest article date in THREAD."
4713 (let ((previous-time 0))
4719 (time-to-seconds (mail-header-parse-date
4720 (mail-header-date header)))
4721 (error previous-time))))
4723 (message-flatten-list thread)
4725 (< (mail-header-number h1)
4726 (mail-header-number h2))))))))
4728 (defun gnus-thread-total-score-1 (root)
4729 ;; This function find the total score of the thread below ROOT.
4730 (setq root (car root))
4731 (apply gnus-thread-score-function
4733 (mapcar 'gnus-thread-total-score
4734 (cdr (gnus-id-to-thread (mail-header-id root))))
4735 (when (> (mail-header-number root) 0)
4736 (list (or (cdr (assq (mail-header-number root)
4737 gnus-newsgroup-scored))
4738 gnus-summary-default-score 0))))
4739 (list gnus-summary-default-score)
4742 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4743 (defvar gnus-tmp-prev-subject nil)
4744 (defvar gnus-tmp-false-parent nil)
4745 (defvar gnus-tmp-root-expunged nil)
4746 (defvar gnus-tmp-dummy-line nil)
4748 (eval-when-compile (defvar gnus-tmp-header))
4749 (defun gnus-extra-header (type &optional header)
4750 "Return the extra header of TYPE."
4751 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4754 (defvar gnus-tmp-thread-tree-header-string "")
4756 (defcustom gnus-sum-thread-tree-root "> "
4757 "With %B spec, used for the root of a thread.
4758 If nil, use subject instead."
4760 :type '(radio (const :format "%v " nil) string)
4761 :group 'gnus-thread)
4762 (defcustom gnus-sum-thread-tree-false-root "> "
4763 "With %B spec, used for a false root of a thread.
4764 If nil, use subject instead."
4766 :type '(radio (const :format "%v " nil) string)
4767 :group 'gnus-thread)
4768 (defcustom gnus-sum-thread-tree-single-indent ""
4769 "With %B spec, used for a thread with just one message.
4770 If nil, use subject instead."
4772 :type '(radio (const :format "%v " nil) string)
4773 :group 'gnus-thread)
4774 (defcustom gnus-sum-thread-tree-vertical "| "
4775 "With %B spec, used for drawing a vertical line."
4778 :group 'gnus-thread)
4779 (defcustom gnus-sum-thread-tree-indent " "
4780 "With %B spec, used for indenting."
4783 :group 'gnus-thread)
4784 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4785 "With %B spec, used for a leaf with brothers."
4788 :group 'gnus-thread)
4789 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4790 "With %B spec, used for a leaf without brothers."
4793 :group 'gnus-thread)
4795 (defun gnus-summary-prepare-threads (threads)
4796 "Prepare summary buffer from THREADS and indentation LEVEL.
4797 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4798 or a straight list of headers."
4799 (gnus-message 7 "Generating summary...")
4801 (setq gnus-newsgroup-threads threads)
4804 (let ((gnus-tmp-level 0)
4805 (default-score (or gnus-summary-default-score 0))
4806 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4807 (building-line-count gnus-summary-display-while-building)
4808 (building-count (integerp gnus-summary-display-while-building))
4809 thread number subject stack state gnus-tmp-gathered beg-match
4810 new-roots gnus-tmp-new-adopts thread-end simp-subject
4811 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4812 gnus-tmp-replied gnus-tmp-subject-or-nil
4813 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4814 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4815 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4818 (setq gnus-tmp-prev-subject nil
4819 gnus-tmp-thread-tree-header-string "")
4821 (if (vectorp (car threads))
4822 ;; If this is a straight (sic) list of headers, then a
4823 ;; threaded summary display isn't required, so we just create
4824 ;; an unthreaded one.
4825 (gnus-summary-prepare-unthreaded threads)
4827 ;; Do the threaded display.
4829 (if gnus-summary-display-while-building
4830 (switch-to-buffer (buffer-name)))
4831 (while (or threads stack gnus-tmp-new-adopts new-roots)
4833 (if (and (= gnus-tmp-level 0)
4836 (not gnus-tmp-false-parent)
4837 (or gnus-tmp-new-adopts new-roots))
4838 (if gnus-tmp-new-adopts
4839 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4840 thread (list (car gnus-tmp-new-adopts))
4841 gnus-tmp-header (caar thread)
4842 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4844 (setq thread (list (car new-roots))
4845 gnus-tmp-header (caar thread)
4846 new-roots (cdr new-roots))))
4849 ;; If there are some threads, we do them before the
4850 ;; threads on the stack.
4851 (setq thread threads
4852 gnus-tmp-header (caar thread))
4853 ;; There were no current threads, so we pop something off
4855 (setq state (car stack)
4856 gnus-tmp-level (car state)
4857 tree-stack (cadr state)
4858 thread (caddr state)
4860 gnus-tmp-header (caar thread))))
4862 (setq gnus-tmp-false-parent nil)
4863 (setq gnus-tmp-root-expunged nil)
4864 (setq thread-end nil)
4866 (if (stringp gnus-tmp-header)
4867 ;; The header is a dummy root.
4869 ((eq gnus-summary-make-false-root 'adopt)
4870 ;; We let the first article adopt the rest.
4871 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4873 (setq gnus-tmp-gathered
4875 (lambda (h) (mail-header-number (car h)))
4878 (setq thread (cons (list (caar thread)
4881 (setq gnus-tmp-level -1
4882 gnus-tmp-false-parent t))
4883 ((eq gnus-summary-make-false-root 'empty)
4884 ;; We print adopted articles with empty subject fields.
4885 (setq gnus-tmp-gathered
4887 (lambda (h) (mail-header-number (car h)))
4890 (setq gnus-tmp-level -1))
4891 ((eq gnus-summary-make-false-root 'dummy)
4892 ;; We remember that we probably want to output a dummy
4894 (setq gnus-tmp-dummy-line gnus-tmp-header)
4895 (setq gnus-tmp-prev-subject gnus-tmp-header))
4897 ;; We do not make a root for the gathered
4898 ;; sub-threads at all.
4899 (setq gnus-tmp-level -1)))
4901 (setq number (mail-header-number gnus-tmp-header)
4902 subject (mail-header-subject gnus-tmp-header)
4903 simp-subject (gnus-simplify-subject-fully subject))
4906 ;; If the thread has changed subject, we might want to make
4907 ;; this subthread into a root.
4908 ((and (null gnus-thread-ignore-subject)
4909 (not (zerop gnus-tmp-level))
4910 gnus-tmp-prev-subject
4911 (not (string= gnus-tmp-prev-subject simp-subject)))
4912 (setq new-roots (nconc new-roots (list (car thread)))
4914 gnus-tmp-header nil))
4915 ;; If the article lies outside the current limit,
4916 ;; then we do not display it.
4917 ((not (memq number gnus-newsgroup-limit))
4918 (setq gnus-tmp-gathered
4920 (lambda (h) (mail-header-number (car h)))
4923 (setq gnus-tmp-new-adopts (if (cdar thread)
4924 (append gnus-tmp-new-adopts
4926 gnus-tmp-new-adopts)
4928 gnus-tmp-header nil)
4929 (when (zerop gnus-tmp-level)
4930 (setq gnus-tmp-root-expunged t)))
4931 ;; Perhaps this article is to be marked as read?
4932 ((and gnus-summary-mark-below
4933 (< (or (cdr (assq number gnus-newsgroup-scored))
4935 gnus-summary-mark-below)
4936 ;; Don't touch sparse articles.
4937 (not (gnus-summary-article-sparse-p number))
4938 (not (gnus-summary-article-ancient-p number)))
4939 (setq gnus-newsgroup-unreads
4940 (delq number gnus-newsgroup-unreads))
4941 (if gnus-newsgroup-auto-expire
4942 (setq gnus-newsgroup-expirable
4943 (gnus-add-to-sorted-list
4944 gnus-newsgroup-expirable number))
4945 (push (cons number gnus-low-score-mark)
4946 gnus-newsgroup-reads))))
4948 (when gnus-tmp-header
4949 ;; We may have an old dummy line to output before this
4951 (when (and gnus-tmp-dummy-line
4954 (mail-header-subject gnus-tmp-header)))
4955 (gnus-summary-insert-dummy-line
4956 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4957 (setq gnus-tmp-dummy-line nil))
4959 ;; Compute the mark.
4960 (setq gnus-tmp-unread (gnus-article-mark number))
4962 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4963 gnus-tmp-header gnus-tmp-level)
4964 gnus-newsgroup-data)
4966 ;; Actually insert the line.
4968 gnus-tmp-subject-or-nil
4970 ((and gnus-thread-ignore-subject
4971 gnus-tmp-prev-subject
4972 (not (string= gnus-tmp-prev-subject simp-subject)))
4974 ((zerop gnus-tmp-level)
4975 (if (and (eq gnus-summary-make-false-root 'empty)
4976 (memq number gnus-tmp-gathered)
4977 gnus-tmp-prev-subject
4978 (string= gnus-tmp-prev-subject simp-subject))
4979 gnus-summary-same-subject
4981 (t gnus-summary-same-subject)))
4982 (if (and (eq gnus-summary-make-false-root 'adopt)
4983 (= gnus-tmp-level 1)
4984 (memq number gnus-tmp-gathered))
4985 (setq gnus-tmp-opening-bracket ?\<
4986 gnus-tmp-closing-bracket ?\>)
4987 (setq gnus-tmp-opening-bracket ?\[
4988 gnus-tmp-closing-bracket ?\]))
4990 gnus-tmp-indentation
4991 (aref gnus-thread-indent-array gnus-tmp-level)
4992 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4993 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4994 gnus-summary-default-score 0)
4996 (if (or (null gnus-summary-default-score)
4997 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4998 gnus-summary-zcore-fuzz))
5000 (if (< gnus-tmp-score gnus-summary-default-score)
5001 gnus-score-below-mark gnus-score-over-mark))
5003 (cond ((memq number gnus-newsgroup-processable)
5005 ((memq number gnus-newsgroup-cached)
5007 ((memq number gnus-newsgroup-replied)
5009 ((memq number gnus-newsgroup-forwarded)
5010 gnus-forwarded-mark)
5011 ((memq number gnus-newsgroup-saved)
5013 ((memq number gnus-newsgroup-recent)
5015 ((memq number gnus-newsgroup-unseen)
5019 (cond ((memq number gnus-newsgroup-undownloaded)
5020 gnus-undownloaded-mark)
5021 (gnus-newsgroup-agentized
5022 gnus-downloaded-mark)
5025 gnus-tmp-from (mail-header-from gnus-tmp-header)
5028 ((string-match "<[^>]+> *$" gnus-tmp-from)
5029 (setq beg-match (match-beginning 0))
5030 (or (and (string-match "^\".+\"" gnus-tmp-from)
5031 (substring gnus-tmp-from 1 (1- (match-end 0))))
5032 (substring gnus-tmp-from 0 beg-match)))
5033 ((string-match "(.+)" gnus-tmp-from)
5034 (substring gnus-tmp-from
5035 (1+ (match-beginning 0)) (1- (match-end 0))))
5039 gnus-tmp-thread-tree-header-string
5041 ((not gnus-show-threads) "")
5042 ((zerop gnus-tmp-level)
5043 (cond ((cdar thread)
5044 (or gnus-sum-thread-tree-root subject))
5045 (gnus-tmp-new-adopts
5046 (or gnus-sum-thread-tree-false-root subject))
5048 (or gnus-sum-thread-tree-single-indent subject))))
5050 (concat (apply 'concat
5051 (mapcar (lambda (item)
5053 gnus-sum-thread-tree-vertical
5054 gnus-sum-thread-tree-indent))
5055 (cdr (reverse tree-stack))))
5057 gnus-sum-thread-tree-leaf-with-other
5058 gnus-sum-thread-tree-single-leaf)))))
5059 (when (string= gnus-tmp-name "")
5060 (setq gnus-tmp-name gnus-tmp-from))
5061 (unless (numberp gnus-tmp-lines)
5062 (setq gnus-tmp-lines -1))
5063 (if (= gnus-tmp-lines -1)
5064 (setq gnus-tmp-lines "?")
5065 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5066 (gnus-put-text-property
5068 (progn (eval gnus-summary-line-format-spec) (point))
5069 'gnus-number number)
5072 (gnus-run-hooks 'gnus-summary-update-hook)
5075 (setq gnus-tmp-prev-subject simp-subject)))
5077 (when (nth 1 thread)
5078 (push (list (max 0 gnus-tmp-level)
5079 (copy-sequence tree-stack)
5082 (push (if (nth 1 thread) 1 0) tree-stack)
5083 (incf gnus-tmp-level)
5084 (setq threads (if thread-end nil (cdar thread)))
5085 (if gnus-summary-display-while-building
5088 ;; use a set frequency
5089 (setq building-line-count (1- building-line-count))
5090 (when (= building-line-count 0)
5092 (setq building-line-count
5093 gnus-summary-display-while-building)))
5097 (setq gnus-tmp-level 0)))))
5098 (gnus-message 7 "Generating summary...done"))
5100 (defun gnus-summary-prepare-unthreaded (headers)
5101 "Generate an unthreaded summary buffer based on HEADERS."
5102 (let (header number mark)
5107 ;; We may have to root out some bad articles...
5108 (when (memq (setq number (mail-header-number
5109 (setq header (pop headers))))
5110 gnus-newsgroup-limit)
5111 ;; Mark article as read when it has a low score.
5112 (when (and gnus-summary-mark-below
5113 (< (or (cdr (assq number gnus-newsgroup-scored))
5114 gnus-summary-default-score 0)
5115 gnus-summary-mark-below)
5116 (not (gnus-summary-article-ancient-p number)))
5117 (setq gnus-newsgroup-unreads
5118 (delq number gnus-newsgroup-unreads))
5119 (if gnus-newsgroup-auto-expire
5120 (push number gnus-newsgroup-expirable)
5121 (push (cons number gnus-low-score-mark)
5122 gnus-newsgroup-reads)))
5124 (setq mark (gnus-article-mark number))
5125 (push (gnus-data-make number mark (1+ (point)) header 0)
5126 gnus-newsgroup-data)
5127 (gnus-summary-insert-line
5129 (memq number gnus-newsgroup-undownloaded)
5130 mark (memq number gnus-newsgroup-replied)
5131 (memq number gnus-newsgroup-expirable)
5132 (mail-header-subject header) nil
5133 (cdr (assq number gnus-newsgroup-scored))
5134 (memq number gnus-newsgroup-processable))))))
5136 (defun gnus-summary-remove-list-identifiers ()
5137 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5138 (let ((regexp (if (consp gnus-list-identifiers)
5139 (mapconcat 'identity gnus-list-identifiers " *\\|")
5140 gnus-list-identifiers))
5143 (dolist (header gnus-newsgroup-headers)
5144 (setq subject (mail-header-subject header)
5146 (while (string-match
5147 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
5150 (concat (substring subject 0 (match-beginning 2))
5151 (substring subject (match-end 0)))
5155 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
5157 (concat (substring subject 0 (match-beginning 1))
5158 (substring subject (match-end 1)))))
5160 (mail-header-set-subject header subject))))))
5162 (defun gnus-fetch-headers (articles)
5163 "Fetch headers of ARTICLES."
5164 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5165 (gnus-message 5 "Fetching headers for %s..." name)
5168 (setq gnus-headers-retrieved-by
5169 (gnus-retrieve-headers
5170 articles gnus-newsgroup-name
5171 ;; We might want to fetch old headers, but
5172 ;; not if there is only 1 article.
5174 (not (eq gnus-fetch-old-headers 'some))
5175 (not (numberp gnus-fetch-old-headers)))
5176 (> (length articles) 1))
5177 gnus-fetch-old-headers))))
5178 (gnus-get-newsgroup-headers-xover
5179 articles nil nil gnus-newsgroup-name t)
5180 (gnus-get-newsgroup-headers))
5181 (gnus-message 5 "Fetching headers for %s...done" name))))
5183 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5184 "Select newsgroup GROUP.
5185 If READ-ALL is non-nil, all articles in the group are selected.
5186 If SELECT-ARTICLES, only select those articles from GROUP."
5187 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5188 ;;!!! Dirty hack; should be removed.
5189 (gnus-summary-ignore-duplicates
5190 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5192 gnus-summary-ignore-duplicates))
5193 (info (nth 2 entry))
5194 articles fetched-articles cached)
5196 (unless (gnus-check-server
5197 (set (make-local-variable 'gnus-current-select-method)
5198 (gnus-find-method-for-group group)))
5199 (error "Couldn't open server"))
5201 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5202 (gnus-activate-group group) ; Or we can activate it...
5203 (progn ; Or we bug out.
5204 (when (equal major-mode 'gnus-summary-mode)
5205 (gnus-kill-buffer (current-buffer)))
5206 (error "Couldn't activate group %s: %s"
5207 group (gnus-status-message group))))
5209 (unless (gnus-request-group group t)
5210 (when (equal major-mode 'gnus-summary-mode)
5211 (gnus-kill-buffer (current-buffer)))
5212 (error "Couldn't request group %s: %s"
5213 group (gnus-status-message group)))
5216 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5218 (setq gnus-summary-use-undownloaded-faces
5219 (gnus-agent-find-parameter
5221 'agent-enable-undownloaded-faces)))
5223 (setq gnus-newsgroup-name group
5224 gnus-newsgroup-unselected nil
5225 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5227 (let ((display (gnus-group-find-parameter group 'display)))
5228 (setq gnus-newsgroup-display
5230 ((not (zerop (or (car-safe read-all) 0)))
5231 ;; The user entered the group with C-u SPC/RET, let's show
5237 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5239 ;; The following is probably the "correct" solution, but
5240 ;; it makes Gnus fetch all headers and then limit the
5241 ;; articles (which is slow), so instead we hack the
5242 ;; select-articles parameter instead. -- Simon Josefsson
5245 ;; (gnus-byte-compile
5246 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5248 (setq select-articles
5249 (gnus-uncompress-range
5250 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5254 (cdr (gnus-active group)))))
5259 (gnus-summary-setup-default-charset)
5261 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5262 (when (gnus-virtual-group-p group)
5263 (setq cached gnus-newsgroup-cached))
5265 (setq gnus-newsgroup-unreads
5266 (gnus-sorted-ndifference
5267 (gnus-sorted-ndifference gnus-newsgroup-unreads
5268 gnus-newsgroup-marked)
5269 gnus-newsgroup-dormant))
5271 (setq gnus-newsgroup-processable nil)
5273 (gnus-update-read-articles group gnus-newsgroup-unreads)
5275 ;; Adjust and set lists of article marks.
5277 (gnus-adjust-marked-articles info))
5278 (if (setq articles select-articles)
5279 (setq gnus-newsgroup-unselected
5280 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5281 (setq articles (gnus-articles-to-read group read-all)))
5285 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5287 ((eq articles 0) nil)
5289 ;; Init the dependencies hash table.
5290 (setq gnus-newsgroup-dependencies
5291 (gnus-make-hashtable (length articles)))
5292 (gnus-set-global-variables)
5293 ;; Retrieve the headers and read them in.
5295 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5297 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5299 (setq gnus-newsgroup-cached cached))
5301 ;; Suppress duplicates?
5302 (when gnus-suppress-duplicates
5303 (gnus-dup-suppress-articles))
5305 ;; Set the initial limit.
5306 (setq gnus-newsgroup-limit (copy-sequence articles))
5307 ;; Remove canceled articles from the list of unread articles.
5308 (setq fetched-articles
5309 (mapcar (lambda (headers) (mail-header-number headers))
5310 gnus-newsgroup-headers))
5311 (setq gnus-newsgroup-articles fetched-articles)
5312 (setq gnus-newsgroup-unreads
5313 (gnus-sorted-nintersection
5314 gnus-newsgroup-unreads fetched-articles))
5315 (gnus-compute-unseen-list)
5317 ;; Removed marked articles that do not exist.
5318 (gnus-update-missing-marks
5319 (gnus-sorted-difference articles fetched-articles))
5320 ;; We might want to build some more threads first.
5321 (when (and gnus-fetch-old-headers
5322 (eq gnus-headers-retrieved-by 'nov))
5323 (if (eq gnus-fetch-old-headers 'invisible)
5324 (gnus-build-all-threads)
5325 (gnus-build-old-threads)))
5326 ;; Let the Gnus agent mark articles as read.
5328 (gnus-agent-get-undownloaded-list))
5329 ;; Remove list identifiers from subject
5330 (when gnus-list-identifiers
5331 (gnus-summary-remove-list-identifiers))
5332 ;; Check whether auto-expire is to be done in this group.
5333 (setq gnus-newsgroup-auto-expire
5334 (gnus-group-auto-expirable-p group))
5335 ;; Set up the article buffer now, if necessary.
5336 (unless gnus-single-article-buffer
5337 (gnus-article-setup-buffer))
5338 ;; First and last article in this newsgroup.
5339 (when gnus-newsgroup-headers
5340 (setq gnus-newsgroup-begin
5341 (mail-header-number (car gnus-newsgroup-headers))
5344 (gnus-last-element gnus-newsgroup-headers))))
5345 ;; GROUP is successfully selected.
5346 (or gnus-newsgroup-headers t)))))
5348 (defun gnus-compute-unseen-list ()
5349 ;; The `seen' marks are treated specially.
5350 (if (not gnus-newsgroup-seen)
5351 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5352 (setq gnus-newsgroup-unseen
5353 (gnus-inverse-list-range-intersection
5354 gnus-newsgroup-articles gnus-newsgroup-seen))))
5356 (defun gnus-summary-display-make-predicate (display)
5357 (require 'gnus-agent)
5358 (when (= (length display) 1)
5359 (setq display (car display)))
5360 (unless gnus-summary-display-cache
5361 (dolist (elem (append '((unread . unread)
5364 gnus-article-mark-lists))
5365 (push (cons (cdr elem)
5367 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5368 gnus-summary-display-cache)))
5369 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5370 (gnus-category-predicate-cache gnus-summary-display-cache))
5371 (gnus-get-predicate display)))
5373 ;; Uses the dynamically bound `number' variable.
5376 (defun gnus-article-marked-p (type &optional article)
5377 (let ((article (or article number)))
5380 (memq article gnus-newsgroup-marked))
5382 (memq article gnus-newsgroup-spam-marked))
5384 (memq article gnus-newsgroup-unsendable))
5385 ((eq type 'undownload)
5386 (memq article gnus-newsgroup-undownloaded))
5387 ((eq type 'download)
5388 (memq article gnus-newsgroup-downloadable))
5390 (memq article gnus-newsgroup-unreads))
5392 (memq article gnus-newsgroup-reads))
5394 (memq article gnus-newsgroup-dormant) )
5396 (memq article gnus-newsgroup-expirable))
5398 (memq article gnus-newsgroup-replied))
5400 (memq article gnus-newsgroup-killed))
5401 ((eq type 'bookmark)
5402 (assq article gnus-newsgroup-bookmarks))
5404 (assq article gnus-newsgroup-scored))
5406 (memq article gnus-newsgroup-saved))
5408 (memq article gnus-newsgroup-cached))
5410 (memq article gnus-newsgroup-forwarded))
5412 (not (memq article gnus-newsgroup-unseen)))
5414 (memq article gnus-newsgroup-recent))
5417 (defun gnus-articles-to-read (group &optional read-all)
5418 "Find out what articles the user wants to read."
5420 ;; Select all articles if `read-all' is non-nil, or if there
5421 ;; are no unread articles.
5423 (and (zerop (length gnus-newsgroup-marked))
5424 (zerop (length gnus-newsgroup-unreads)))
5425 ;; Fetch all if the predicate is non-nil.
5426 gnus-newsgroup-display)
5427 ;; We want to select the headers for all the articles in
5428 ;; the group, so we select either all the active
5429 ;; articles in the group, or (if that's nil), the
5430 ;; articles in the cache.
5432 (gnus-uncompress-range (gnus-active group))
5433 (gnus-cache-articles-in-group group))
5434 ;; Select only the "normal" subset of articles.
5436 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5437 gnus-newsgroup-unreads)))
5438 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5439 (scored (length scored-list))
5440 (number (length articles))
5441 (marked (+ (length gnus-newsgroup-marked)
5442 (length gnus-newsgroup-dormant)))
5447 ((numberp gnus-newsgroup-display)
5448 gnus-newsgroup-display)
5452 ((and (or (<= scored marked) (= scored number))
5453 (numberp gnus-large-newsgroup)
5454 (> number gnus-large-newsgroup))
5455 (let* ((cursor-in-echo-area nil)
5456 (initial (gnus-parameter-large-newsgroup-initial
5457 gnus-newsgroup-name))
5461 "How many articles from %s (%s %d): "
5463 (gnus-group-decoded-name gnus-newsgroup-name)
5465 (if initial "max" "default")
5468 (cons (number-to-string initial)
5470 (if (string-match "^[ \t]*$" input) number input)))
5471 ((and (> scored marked) (< scored number)
5472 (> (- scored number) 20))
5475 (format "%s %s (%d scored, %d total): "
5476 "How many articles from"
5477 (gnus-group-decoded-name group)
5479 (if (string-match "^[ \t]*$" input)
5483 (message "Quit getting the articles to read")
5485 (setq select (if (stringp select) (string-to-number select) select))
5486 (if (or (null select) (zerop select))
5488 (if (and (not (zerop scored)) (<= (abs select) scored))
5490 (setq articles (sort scored-list '<))
5491 (setq number (length articles)))
5492 (setq articles (copy-sequence articles)))
5494 (when (< (abs select) number)
5496 ;; Select the N oldest articles.
5497 (setcdr (nthcdr (1- (abs select)) articles) nil)
5498 ;; Select the N most recent articles.
5499 (setq articles (nthcdr (- number select) articles))))
5500 (setq gnus-newsgroup-unselected
5501 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5502 (when gnus-alter-articles-to-read-function
5505 (funcall gnus-alter-articles-to-read-function
5506 gnus-newsgroup-name articles)
5510 (defun gnus-killed-articles (killed articles)
5513 (when (inline (gnus-member-of-range (car articles) killed))
5514 (push (car articles) out))
5515 (setq articles (cdr articles)))
5518 (defun gnus-uncompress-marks (marks)
5519 "Uncompress the mark ranges in MARKS."
5520 (let ((uncompressed '(score bookmark))
5523 (if (memq (caar marks) uncompressed)
5524 (push (car marks) out)
5525 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5526 (setq marks (cdr marks)))
5529 (defun gnus-article-mark-to-type (mark)
5530 "Return the type of MARK."
5531 (or (cadr (assq mark gnus-article-special-mark-lists))
5534 (defun gnus-article-unpropagatable-p (mark)
5535 "Return whether MARK should be propagated to back end."
5536 (memq mark gnus-article-unpropagated-mark-lists))
5538 (defun gnus-adjust-marked-articles (info)
5539 "Set all article lists and remove all marks that are no longer valid."
5540 (let* ((marked-lists (gnus-info-marks info))
5541 (active (gnus-active (gnus-info-group info)))
5544 (types gnus-article-mark-lists)
5545 marks var articles article mark mark-type
5548 (dolist (marks marked-lists)
5549 (setq mark (car marks)
5550 mark-type (gnus-article-mark-to-type mark)
5551 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5553 ;; We set the variable according to the type of the marks list,
5554 ;; and then adjust the marks to a subset of the active articles.
5556 ;; Adjust "simple" lists - compressed yet unsorted
5557 ((eq mark-type 'list)
5558 ;; Simultaneously uncompress and clip to active range
5559 ;; See gnus-uncompress-range for a description of possible marks
5561 (if (not (cadr marks))
5563 (setq articles (if (numberp (cddr marks))
5569 (while (setq article (pop articles))
5570 (cond ((consp article)
5571 (setq bgn (max (car article) min)
5572 end (min (cdr article) max))
5574 (setq l (setcdr l (cons bgn nil))
5576 ((and (<= min article)
5578 (setq l (setcdr l (cons article nil))))))
5579 (set var (cdr lh)))))
5581 ((eq mark-type 'tuple)
5582 (set var (setq articles (cdr marks)))
5583 (when (not (listp (cdr (symbol-value var))))
5584 (set var (list (symbol-value var))))
5585 (when (not (listp (cdr articles)))
5586 (setq articles (list articles)))
5588 (when (or (not (consp (setq article (pop articles))))
5589 (< (car article) min)
5590 (> (car article) max))
5591 (set var (delq article (symbol-value var))))))
5592 ;; Adjust ranges (sloppily).
5593 ((eq mark-type 'range)
5596 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5597 ;; It should be (seen (NUM1 . NUM2)).
5598 (when (numberp (cddr marks))
5599 (setcdr marks (list (cdr marks))))
5600 (setq articles (cdr marks))
5601 (while (and articles
5602 (or (and (consp (car articles))
5603 (> min (cdar articles)))
5604 (and (numberp (car articles))
5605 (> min (car articles)))))
5607 (set var articles))))))))
5609 (defun gnus-update-missing-marks (missing)
5610 "Go through the list of MISSING articles and remove them from the mark lists."
5613 ;; Go through all types.
5614 (dolist (elem gnus-article-mark-lists)
5615 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5616 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5617 (when (symbol-value var)
5618 ;; This list has articles. So we delete all missing
5619 ;; articles from it.
5622 (set var (delq (pop m) (symbol-value var))))))))))
5624 (defun gnus-update-marks ()
5625 "Enter the various lists of marked articles into the newsgroup info list."
5626 (let ((types gnus-article-mark-lists)
5627 (info (gnus-get-info gnus-newsgroup-name))
5628 type list newmarked symbol delta-marks)
5630 ;; Add all marks lists to the list of marks lists.
5631 (while (setq type (pop types))
5632 (setq list (symbol-value
5634 (intern (format "gnus-newsgroup-%s" (car type))))))
5637 ;; Get rid of the entries of the articles that have the
5639 (when (and (eq (cdr type) 'score)
5643 (prev (cons nil list))
5646 (if (or (not (consp (car arts)))
5647 (= (cdar arts) gnus-summary-default-score))
5648 (setcdr prev (cdr arts))
5650 (setq arts (cdr arts)))
5651 (setq list (cdr all)))))
5653 (when (eq (cdr type) 'seen)
5654 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5656 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5657 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5659 (when (and (gnus-check-backend-function
5660 'request-set-mark gnus-newsgroup-name)
5661 (not (gnus-article-unpropagatable-p (cdr type))))
5662 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5663 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5664 (add (gnus-remove-from-range
5665 (gnus-copy-sequence list) old)))
5667 (push (list add 'add (list (cdr type))) delta-marks))
5669 (push (list del 'del (list (cdr type))) delta-marks))))
5672 (push (cons (cdr type) list) newmarked)))
5675 (unless (gnus-check-group gnus-newsgroup-name)
5676 (error "Can't open server for %s" gnus-newsgroup-name))
5677 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5679 ;; Enter these new marks into the info of the group.
5681 (setcar (nthcdr 3 info) newmarked)
5682 ;; Add the marks lists to the end of the info.
5684 (setcdr (nthcdr 2 info) (list newmarked))))
5686 ;; Cut off the end of the info if there's nothing else there.
5690 (when (nthcdr (decf i) info)
5691 (setcdr (nthcdr i info) nil)))))))
5693 (defun gnus-set-mode-line (where)
5694 "Set the mode line of the article or summary buffers.
5695 If WHERE is `summary', the summary mode line format will be used."
5696 ;; Is this mode line one we keep updated?
5697 (when (and (memq where gnus-updated-mode-lines)
5699 (intern (format "gnus-%s-mode-line-format-spec" where))))
5702 ;; We evaluate this in the summary buffer since these
5703 ;; variables are buffer-local to that buffer.
5704 (set-buffer gnus-summary-buffer)
5705 ;; We bind all these variables that are used in the `eval' form
5707 (let* ((mformat (symbol-value
5709 (format "gnus-%s-mode-line-format-spec" where))))
5710 (gnus-tmp-group-name (gnus-group-decoded-name
5711 gnus-newsgroup-name))
5712 (gnus-tmp-article-number (or gnus-current-article 0))
5713 (gnus-tmp-unread gnus-newsgroup-unreads)
5714 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5715 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5716 (gnus-tmp-unread-and-unselected
5717 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5718 (zerop gnus-tmp-unselected))
5720 ((zerop gnus-tmp-unselected)
5721 (format "{%d more}" gnus-tmp-unread-and-unticked))
5722 (t (format "{%d(+%d) more}"
5723 gnus-tmp-unread-and-unticked
5724 gnus-tmp-unselected))))
5726 (if (and gnus-current-headers
5727 (vectorp gnus-current-headers))
5728 (gnus-mode-string-quote
5729 (mail-header-subject gnus-current-headers))
5731 bufname-length max-len
5732 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5733 (setq mode-string (eval mformat))
5734 (setq bufname-length (if (string-match "%b" mode-string)
5737 (if (eq where 'summary)
5739 (get-buffer gnus-article-buffer))))
5742 (setq max-len (max 4 (if gnus-mode-non-string-length
5744 gnus-mode-non-string-length
5746 (length mode-string))))
5747 ;; We might have to chop a bit of the string off...
5748 (when (> (length mode-string) max-len)
5750 (concat (truncate-string-to-width mode-string (- max-len 3))
5752 ;; Pad the mode string a bit.
5753 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5754 ;; Update the mode line.
5755 (setq mode-line-buffer-identification
5756 (gnus-mode-line-buffer-identification (list mode-string)))
5757 (set-buffer-modified-p t))))
5759 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5760 "Go through the HEADERS list and add all Xrefs to a hash table.
5761 The resulting hash table is returned, or nil if no Xrefs were found."
5762 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5763 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5764 (xref-hashtb (gnus-make-hashtable))
5765 start group entry number xrefs header)
5767 (setq header (pop headers))
5768 (when (and (setq xrefs (mail-header-xref header))
5769 (not (memq (setq number (mail-header-number header))
5772 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5773 (setq start (match-end 0))
5774 (setq group (if prefix
5775 (concat prefix (substring xrefs (match-beginning 1)
5777 (substring xrefs (match-beginning 1) (match-end 1))))
5779 (string-to-number (substring xrefs (match-beginning 2)
5781 (if (setq entry (gnus-gethash group xref-hashtb))
5782 (setcdr entry (cons number (cdr entry)))
5783 (gnus-sethash group (cons number nil) xref-hashtb)))))
5784 (and start xref-hashtb)))
5786 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5787 "Look through all the headers and mark the Xrefs as read."
5788 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5789 name entry info xref-hashtb idlist method nth4)
5791 (set-buffer gnus-group-buffer)
5792 (when (setq xref-hashtb
5793 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5796 (unless (string= from-newsgroup (setq name (symbol-name group)))
5797 (setq idlist (symbol-value group))
5798 ;; Dead groups are not updated.
5800 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5802 (when (stringp (setq nth4 (gnus-info-method info)))
5803 (setq nth4 (gnus-server-to-method nth4))))
5804 ;; Only do the xrefs if the group has the same
5805 ;; select method as the group we have just read.
5806 (or (gnus-methods-equal-p
5807 nth4 (gnus-find-method-for-group from-newsgroup))
5809 (equal nth4 (setq method (gnus-find-method-for-group
5811 (and (equal (car nth4) (car method))
5812 (equal (nth 1 nth4) (nth 1 method))))
5813 gnus-use-cross-reference
5814 (or (not (eq gnus-use-cross-reference t))
5816 ;; Only do cross-references on subscribed
5817 ;; groups, if that is what is wanted.
5818 (<= (gnus-info-level info) gnus-level-subscribed))
5819 (gnus-group-make-articles-read name idlist))))
5822 (defun gnus-compute-read-articles (group articles)
5823 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5824 (info (nth 2 entry))
5825 (active (gnus-active group))
5828 ;; First peel off all invalid article numbers.
5830 (let ((ids articles)
5832 (while (setq id (pop ids))
5833 (when (and first (> id (cdr active)))
5834 ;; We'll end up in this situation in one particular
5835 ;; obscure situation. If you re-scan a group and get
5836 ;; a new article that is cross-posted to a different
5837 ;; group that has not been re-scanned, you might get
5838 ;; crossposted article that has a higher number than
5839 ;; Gnus believes possible. So we re-activate this
5840 ;; group as well. This might mean doing the
5841 ;; crossposting thingy will *increase* the number
5842 ;; of articles in some groups. Tsk, tsk.
5843 (setq active (or (gnus-activate-group group) active)))
5844 (when (or (> id (cdr active))
5845 (< id (car active)))
5846 (setq articles (delq id articles))))))
5847 ;; If the read list is nil, we init it.
5849 (null (gnus-info-read info))
5851 (setq ninfo (cons 1 (1- (car active))))
5852 (setq ninfo (gnus-info-read info)))
5853 ;; Then we add the read articles to the range.
5855 ninfo (setq articles (sort articles '<))))))
5857 (defun gnus-group-make-articles-read (group articles)
5858 "Update the info of GROUP to say that ARTICLES are read."
5860 (entry (gnus-gethash group gnus-newsrc-hashtb))
5861 (info (nth 2 entry))
5862 (active (gnus-active group))
5865 (setq range (gnus-compute-read-articles group articles))
5867 (set-buffer gnus-group-buffer)
5870 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5871 (gnus-info-set-read ',info ',(gnus-info-read info))
5872 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5873 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5874 (gnus-group-update-group ,group t))))
5875 ;; Add the read articles to the range.
5876 (gnus-info-set-read info range)
5877 (gnus-request-set-mark group (list (list range 'add '(read))))
5878 ;; Then we have to re-compute how many unread
5879 ;; articles there are in this group.
5883 (setq num (- (1+ (cdr active)) (car active))))
5884 ((not (listp (cdr range)))
5885 (setq num (- (cdr active) (- (1+ (cdr range))
5889 (if (numberp (car range))
5891 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5892 (setq range (cdr range)))
5893 (setq num (- (cdr active) num))))
5894 ;; Update the number of unread articles.
5896 ;; Update the group buffer.
5897 (unless (gnus-ephemeral-group-p group)
5898 (gnus-group-update-group group t))))))
5900 (defvar gnus-newsgroup-none-id 0)
5902 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5903 (let ((cur nntp-server-buffer)
5906 (save-excursion (set-buffer gnus-summary-buffer)
5907 gnus-newsgroup-dependencies)))
5909 (mail-parse-charset gnus-newsgroup-charset)
5910 (mail-parse-ignored-charsets
5911 (save-excursion (condition-case nil
5912 (set-buffer gnus-summary-buffer)
5914 gnus-newsgroup-ignored-charsets)))
5916 (set-buffer nntp-server-buffer)
5917 ;; Translate all TAB characters into SPACE characters.
5918 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5919 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5920 (ietf-drums-unfold-fws)
5921 (gnus-run-hooks 'gnus-parse-headers-hook)
5922 (let ((case-fold-search t)
5923 in-reply-to header p lines chars)
5924 (goto-char (point-min))
5925 ;; Search to the beginning of the next header. Error messages
5926 ;; do not begin with 2 or 3.
5927 (while (re-search-forward "^[23][0-9]+ " nil t)
5930 ;; This implementation of this function, with nine
5931 ;; search-forwards instead of the one re-search-forward and
5932 ;; a case (which basically was the old function) is actually
5933 ;; about twice as fast, even though it looks messier. You
5934 ;; can't have everything, I guess. Speed and elegance
5935 ;; doesn't always go hand in hand.
5944 (narrow-to-region (point)
5945 (or (and (search-forward "\n.\n" nil t)
5951 (if (search-forward "\nsubject:" nil t)
5952 (funcall gnus-decode-encoded-word-function
5953 (nnheader-header-value))
5958 (if (search-forward "\nfrom:" nil t)
5959 (funcall gnus-decode-encoded-word-function
5960 (nnheader-header-value))
5965 (if (search-forward "\ndate:" nil t)
5966 (nnheader-header-value) ""))
5970 (setq id (if (re-search-forward
5971 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5972 ;; We do it this way to make sure the Message-ID
5973 ;; is (somewhat) syntactically valid.
5974 (buffer-substring (match-beginning 1)
5976 ;; If there was no message-id, we just fake one
5977 ;; to make subsequent routines simpler.
5978 (nnheader-generate-fake-message-id))))
5982 (if (search-forward "\nreferences:" nil t)
5986 (nnheader-header-value)
5991 (search-backward ">" end t)
5994 (search-backward "<" end t)
5996 ;; Get the references from the in-reply-to header if there
5997 ;; were no references and the in-reply-to header looks
5999 (if (and (search-forward "\nin-reply-to:" nil t)
6000 (setq in-reply-to (nnheader-header-value))
6001 (string-match "<[^>]+>" in-reply-to))
6003 (setq ref (substring in-reply-to (match-beginning 0)
6005 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6006 (setq ref2 (substring in-reply-to (match-beginning 0)
6008 (when (> (length ref2) (length ref))
6015 (if (search-forward "\nchars: " nil t)
6016 (if (numberp (setq chars (ignore-errors (read cur))))
6022 (if (search-forward "\nlines: " nil t)
6023 (if (numberp (setq lines (ignore-errors (read cur))))
6029 (and (search-forward "\nxref:" nil t)
6030 (nnheader-header-value)))
6032 (when gnus-extra-headers
6033 (let ((extra gnus-extra-headers)
6037 (when (search-forward
6038 (concat "\n" (symbol-name (car extra)) ":") nil t)
6039 (push (cons (car extra) (nnheader-header-value))
6043 (when (equal id ref)
6046 (when gnus-alter-header-function
6047 (funcall gnus-alter-header-function header)
6048 (setq id (mail-header-id header)
6049 ref (gnus-parent-id (mail-header-references header))))
6052 (gnus-dependencies-add-header
6053 header dependencies force-new))
6054 (push header headers))
6055 (goto-char (point-max))
6057 (nreverse headers)))))
6059 ;; Goes through the xover lines and returns a list of vectors
6060 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6061 force-new dependencies
6062 group also-fetch-heads)
6063 "Parse the news overview data in the server buffer.
6064 Return a list of headers that match SEQUENCE (see
6065 `nntp-retrieve-headers')."
6066 ;; Get the Xref when the users reads the articles since most/some
6067 ;; NNTP servers do not include Xrefs when using XOVER.
6068 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6069 (let ((mail-parse-charset gnus-newsgroup-charset)
6070 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6071 (cur nntp-server-buffer)
6072 (dependencies (or dependencies gnus-newsgroup-dependencies))
6074 ((eq gnus-read-all-available-headers t)
6076 ((and (stringp gnus-read-all-available-headers)
6078 (string-match gnus-read-all-available-headers group))
6081 number headers header)
6083 (set-buffer nntp-server-buffer)
6084 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6085 ;; Allow the user to mangle the headers before parsing them.
6086 (gnus-run-hooks 'gnus-parse-headers-hook)
6087 (goto-char (point-min))
6088 (gnus-parse-without-error
6089 (while (and (or sequence allp)
6091 (setq number (read cur))
6093 (while (and sequence
6094 (< (car sequence) number))
6095 (setq sequence (cdr sequence))))
6098 (eq number (car sequence))))
6100 (setq sequence (cdr sequence))
6101 (setq header (inline
6102 (gnus-nov-parse-line
6103 number dependencies force-new)))))
6104 (push header headers))
6106 ;; A common bug in inn is that if you have posted an article and
6107 ;; then retrieves the active file, it will answer correctly --
6108 ;; the new article is included. However, a NOV entry for the
6109 ;; article may not have been generated yet, so this may fail.
6110 ;; We work around this problem by retrieving the last few
6111 ;; headers using HEAD.
6112 (if (or (not also-fetch-heads)
6114 ;; We (probably) got all the headers.
6116 (let ((gnus-nov-is-evil t))
6119 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6120 (gnus-get-newsgroup-headers))))))))
6122 (defun gnus-article-get-xrefs ()
6123 "Fill in the Xref value in `gnus-current-headers', if necessary.
6124 This is meant to be called in `gnus-article-internal-prepare-hook'."
6125 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
6126 gnus-current-headers)))
6127 (or (not gnus-use-cross-reference)
6129 (and (mail-header-xref headers)
6130 (not (string= (mail-header-xref headers) "")))
6131 (let ((case-fold-search t)
6134 (nnheader-narrow-to-headers)
6135 (goto-char (point-min))
6136 (when (or (and (not (eobp))
6137 (eq (downcase (char-after)) ?x)
6138 (looking-at "Xref:"))
6139 (search-forward "\nXref:" nil t))
6140 (goto-char (1+ (match-end 0)))
6141 (setq xref (buffer-substring (point) (gnus-point-at-eol)))
6142 (mail-header-set-xref headers xref)))))))
6144 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6145 "Find article ID and insert the summary line for that article.
6146 OLD-HEADER can either be a header or a line number to insert
6147 the subject line on."
6148 (let* ((line (and (numberp old-header) old-header))
6149 (old-header (and (vectorp old-header) old-header))
6150 (header (cond ((and old-header use-old-header)
6153 (gnus-number-to-header id))
6154 (gnus-number-to-header id))
6156 (gnus-read-header id))))
6157 (number (and (numberp id) id))
6160 ;; Rebuild the thread that this article is part of and go to the
6161 ;; article we have fetched.
6162 (when (and (not gnus-show-threads)
6165 (setq d (gnus-data-find (mail-header-number old-header))))
6166 (goto-char (gnus-data-pos d))
6169 (- (gnus-point-at-bol)
6171 (1+ (gnus-point-at-eol))
6172 (gnus-delete-line))))))
6173 ;; Remove list identifiers from subject.
6174 (when gnus-list-identifiers
6175 (let ((gnus-newsgroup-headers (list header)))
6176 (gnus-summary-remove-list-identifiers)))
6178 (mail-header-set-number header (mail-header-number old-header)))
6179 (setq gnus-newsgroup-sparse
6180 (delq (setq number (mail-header-number header))
6181 gnus-newsgroup-sparse))
6182 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6183 (push number gnus-newsgroup-limit)
6184 (gnus-rebuild-thread (mail-header-id header) line)
6185 (gnus-summary-goto-subject number nil t))
6186 (when (and (numberp number)
6188 ;; We have to update the boundaries even if we can't fetch the
6189 ;; article if ID is a number -- so that the next `P' or `N'
6190 ;; command will fetch the previous (or next) article even
6191 ;; if the one we tried to fetch this time has been canceled.
6192 (when (> number gnus-newsgroup-end)
6193 (setq gnus-newsgroup-end number))
6194 (when (< number gnus-newsgroup-begin)
6195 (setq gnus-newsgroup-begin number))
6196 (setq gnus-newsgroup-unselected
6197 (delq number gnus-newsgroup-unselected)))
6198 ;; Report back a success?
6199 (and header (mail-header-number header))))
6201 ;;; Process/prefix in the summary buffer
6203 (defun gnus-summary-work-articles (n)
6204 "Return a list of articles to be worked upon.
6205 The prefix argument, the list of process marked articles, and the
6206 current article will be taken into consideration."
6208 (set-buffer gnus-summary-buffer)
6211 ;; A numerical prefix has been given.
6212 (setq n (prefix-numeric-value n))
6213 (let ((backward (< n 0))
6214 (n (abs (prefix-numeric-value n)))
6219 (push (setq article (gnus-summary-article-number))
6222 (gnus-summary-find-prev nil article)
6223 (gnus-summary-find-next nil article)))
6225 (nreverse articles)))
6226 ((and (gnus-region-active-p) (mark))
6227 (message "region active")
6228 ;; Work on the region between point and mark.
6229 (let ((max (max (point) (mark)))
6232 (goto-char (min (point) (mark)))
6235 (push (setq article (gnus-summary-article-number)) articles)
6236 (gnus-summary-find-next nil article)
6238 (nreverse articles))))
6239 (gnus-newsgroup-processable
6240 ;; There are process-marked articles present.
6241 ;; Save current state.
6242 (gnus-summary-save-process-mark)
6244 (reverse gnus-newsgroup-processable))
6246 ;; Just return the current article.
6247 (list (gnus-summary-article-number))))))
6249 (defmacro gnus-summary-iterate (arg &rest forms)
6250 "Iterate over the process/prefixed articles and do FORMS.
6251 ARG is the interactive prefix given to the command. FORMS will be
6252 executed with point over the summary line of the articles."
6253 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6254 `(let ((,articles (gnus-summary-work-articles ,arg)))
6256 (gnus-summary-goto-subject (car ,articles))
6260 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6261 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6263 (defun gnus-summary-save-process-mark ()
6264 "Push the current set of process marked articles on the stack."
6266 (push (copy-sequence gnus-newsgroup-processable)
6267 gnus-newsgroup-process-stack))
6269 (defun gnus-summary-kill-process-mark ()
6270 "Push the current set of process marked articles on the stack and unmark."
6272 (gnus-summary-save-process-mark)
6273 (gnus-summary-unmark-all-processable))
6275 (defun gnus-summary-yank-process-mark ()
6276 "Pop the last process mark state off the stack and restore it."
6278 (unless gnus-newsgroup-process-stack
6279 (error "Empty mark stack"))
6280 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6282 (defun gnus-summary-process-mark-set (set)
6283 "Make SET into the current process marked articles."
6284 (gnus-summary-unmark-all-processable)
6286 (gnus-summary-set-process-mark (pop set))))
6288 ;;; Searching and stuff
6290 (defun gnus-summary-search-group (&optional backward use-level)
6291 "Search for next unread newsgroup.
6292 If optional argument BACKWARD is non-nil, search backward instead."
6294 (set-buffer gnus-group-buffer)
6295 (when (gnus-group-search-forward
6296 backward nil (if use-level (gnus-group-group-level) nil))
6297 (gnus-group-group-name))))
6299 (defun gnus-summary-best-group (&optional exclude-group)
6300 "Find the name of the best unread group.
6301 If EXCLUDE-GROUP, do not go to this group."
6303 (set-buffer gnus-group-buffer)
6305 (gnus-group-best-unread-group exclude-group))))
6307 (defun gnus-summary-find-next (&optional unread article backward)
6309 (gnus-summary-find-prev unread article)
6310 (let* ((dummy (gnus-summary-article-intangible-p))
6311 (article (or article (gnus-summary-article-number)))
6312 (data (gnus-data-find-list article))
6314 (when (and (not dummy)
6315 (or (not gnus-summary-check-current)
6317 (not (gnus-data-unread-p (car data)))))
6318 (setq data (cdr data)))
6323 (unless (memq (gnus-data-number (car data))
6325 ((eq gnus-auto-goto-ignores
6326 'always-undownloaded)
6327 gnus-newsgroup-undownloaded)
6330 ((eq gnus-auto-goto-ignores
6332 gnus-newsgroup-unfetched)
6333 ((eq gnus-auto-goto-ignores
6335 gnus-newsgroup-undownloaded)))
6336 (when (gnus-data-unread-p (car data))
6337 (setq result (car data)
6339 (setq data (cdr data)))
6342 (goto-char (gnus-data-pos result))
6343 (gnus-data-number result)))))
6345 (defun gnus-summary-find-prev (&optional unread article)
6346 (let* ((eobp (eobp))
6347 (article (or article (gnus-summary-article-number)))
6348 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6350 (when (and (not eobp)
6351 (or (not gnus-summary-check-current)
6353 (not (gnus-data-unread-p (car data)))))
6354 (setq data (cdr data)))
6359 (unless (memq (gnus-data-number (car data))
6361 ((eq gnus-auto-goto-ignores
6362 'always-undownloaded)
6363 gnus-newsgroup-undownloaded)
6366 ((eq gnus-auto-goto-ignores
6368 gnus-newsgroup-unfetched)
6369 ((eq gnus-auto-goto-ignores
6371 gnus-newsgroup-undownloaded)))
6372 (when (gnus-data-unread-p (car data))
6373 (setq result (car data)
6375 (setq data (cdr data)))
6378 (goto-char (gnus-data-pos result))
6379 (gnus-data-number result))))
6381 (defun gnus-summary-find-subject (subject &optional unread backward article)
6382 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6383 (article (or article (gnus-summary-article-number)))
6384 (articles (gnus-data-list backward))
6385 (arts (gnus-data-find-list article articles))
6387 (when (or (not gnus-summary-check-current)
6389 (not (gnus-data-unread-p (car arts))))
6390 (setq arts (cdr arts)))
6392 (and (or (not unread)
6393 (gnus-data-unread-p (car arts)))
6394 (vectorp (gnus-data-header (car arts)))
6396 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6397 (setq result (car arts)
6399 (setq arts (cdr arts)))
6401 (goto-char (gnus-data-pos result))
6402 (gnus-data-number result))))
6404 (defun gnus-summary-search-forward (&optional unread subject backward)
6405 "Search forward for an article.
6406 If UNREAD, look for unread articles. If SUBJECT, look for
6407 articles with that subject. If BACKWARD, search backward instead."
6408 (cond (subject (gnus-summary-find-subject subject unread backward))
6409 (backward (gnus-summary-find-prev unread))
6410 (t (gnus-summary-find-next unread))))
6412 (defun gnus-recenter (&optional n)
6413 "Center point in window and redisplay frame.
6414 Also do horizontal recentering."
6416 (when (and gnus-auto-center-summary
6417 (not (eq gnus-auto-center-summary 'vertical)))
6418 (gnus-horizontal-recenter))
6421 (defun gnus-summary-recenter ()
6422 "Center point in the summary window.
6423 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6424 displayed, no centering will be performed."
6425 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6426 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6428 ;; The user has to want it.
6429 (when gnus-auto-center-summary
6430 (let* ((top (cond ((< (window-height) 4) 0)
6431 ((< (window-height) 7) 1)
6432 (t (if (numberp gnus-auto-center-summary)
6433 gnus-auto-center-summary
6435 (height (1- (window-height)))
6436 (bottom (save-excursion (goto-char (point-max))
6437 (forward-line (- height))
6439 (window (get-buffer-window (current-buffer))))
6440 (when (get-buffer-window gnus-article-buffer)
6441 ;; Only do recentering when the article buffer is displayed,
6442 ;; Set the window start to either `bottom', which is the biggest
6443 ;; possible valid number, or the second line from the top,
6444 ;; whichever is the least.
6445 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6446 (if (> bottom top-pos)
6447 ;; Keep the second line from the top visible
6448 (set-window-start window top-pos t)
6449 ;; Try to keep the bottom line visible; if it's partially
6450 ;; obscured, either scroll one more line to make it fully
6451 ;; visible, or revert to using TOP-POS.
6453 (goto-char (point-max))
6455 (let ((last-line-start (point)))
6457 (set-window-start window (point) t)
6458 (when (not (pos-visible-in-window-p last-line-start window))
6460 (set-window-start window (min (point) top-pos) t)))))))
6461 ;; Do horizontal recentering while we're at it.
6462 (when (and (get-buffer-window (current-buffer) t)
6463 (not (eq gnus-auto-center-summary 'vertical)))
6464 (let ((selected (selected-window)))
6465 (select-window (get-buffer-window (current-buffer) t))
6466 (gnus-summary-position-point)
6467 (gnus-horizontal-recenter)
6468 (select-window selected))))))
6470 (defun gnus-summary-jump-to-group (newsgroup)
6471 "Move point to NEWSGROUP in group mode buffer."
6472 ;; Keep update point of group mode buffer if visible.
6473 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6474 (save-window-excursion
6475 ;; Take care of tree window mode.
6476 (when (get-buffer-window gnus-group-buffer)
6477 (pop-to-buffer gnus-group-buffer))
6478 (gnus-group-jump-to-group newsgroup))
6480 ;; Take care of tree window mode.
6481 (if (get-buffer-window gnus-group-buffer)
6482 (pop-to-buffer gnus-group-buffer)
6483 (set-buffer gnus-group-buffer))
6484 (gnus-group-jump-to-group newsgroup))))
6486 ;; This function returns a list of article numbers based on the
6487 ;; difference between the ranges of read articles in this group and
6488 ;; the range of active articles.
6489 (defun gnus-list-of-unread-articles (group)
6490 (let* ((read (gnus-info-read (gnus-get-info group)))
6491 (active (or (gnus-active group) (gnus-activate-group group)))
6494 ;; If none are read, then all are unread.
6496 (setq first (car active))
6497 ;; If the range of read articles is a single range, then the
6498 ;; first unread article is the article after the last read
6499 ;; article. Sounds logical, doesn't it?
6500 (if (and (not (listp (cdr read)))
6501 (or (< (car read) (car active))
6502 (progn (setq read (list read))
6504 (setq first (max (car active) (1+ (cdr read))))
6505 ;; `read' is a list of ranges.
6506 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6509 (setq first (car active)))
6512 (while (< first nlast)
6513 (setq unread (cons first unread)
6515 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6516 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6517 (setq read (cdr read)))))
6518 ;; And add the last unread articles.
6519 (while (<= first last)
6520 (setq unread (cons first unread)
6522 ;; Return the list of unread articles.
6523 (delq 0 (nreverse unread))))
6525 (defun gnus-list-of-read-articles (group)
6526 "Return a list of unread, unticked and non-dormant articles."
6527 (let* ((info (gnus-get-info group))
6528 (marked (gnus-info-marks info))
6529 (active (gnus-active group)))
6531 (gnus-list-range-difference
6532 (gnus-list-range-difference
6533 (gnus-sorted-complement
6534 (gnus-uncompress-range active)
6535 (gnus-list-of-unread-articles group))
6536 (cdr (assq 'dormant marked)))
6537 (cdr (assq 'tick marked))))))
6539 ;; This function returns a sequence of article numbers based on the
6540 ;; difference between the ranges of read articles in this group and
6541 ;; the range of active articles.
6542 (defun gnus-sequence-of-unread-articles (group)
6543 (let* ((read (gnus-info-read (gnus-get-info group)))
6544 (active (or (gnus-active group) (gnus-activate-group group)))
6547 ;; If none are read, then all are unread.
6549 (setq first (car active))
6550 ;; If the range of read articles is a single range, then the
6551 ;; first unread article is the article after the last read
6552 ;; article. Sounds logical, doesn't it?
6553 (if (and (not (listp (cdr read)))
6554 (or (< (car read) (car active))
6555 (progn (setq read (list read))
6557 (setq first (max (car active) (1+ (cdr read))))
6558 ;; `read' is a list of ranges.
6559 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6562 (setq first (car active)))
6565 (push (cons first nlast) unread))
6566 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6567 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6568 (setq read (cdr read)))))
6569 ;; And add the last unread articles.
6570 (cond ((not (and first last))
6573 (push (cons first last) unread))
6575 (push first unread)))
6576 ;; Return the sequence of unread articles.
6577 (delq 0 (nreverse unread))))
6579 ;; Various summary commands
6581 (defun gnus-summary-select-article-buffer ()
6582 "Reconfigure windows to show article buffer."
6584 (if (not (gnus-buffer-live-p gnus-article-buffer))
6585 (error "There is no article buffer for this summary buffer")
6586 (gnus-configure-windows 'article)
6587 (select-window (get-buffer-window gnus-article-buffer))))
6589 (defun gnus-summary-universal-argument (arg)
6590 "Perform any operation on all articles that are process/prefixed."
6592 (let ((articles (gnus-summary-work-articles arg))
6599 (substitute-command-keys
6600 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6602 (gnus-error 1 "Undefined key")
6605 (gnus-summary-goto-subject (setq article (pop articles)))
6606 (let (gnus-newsgroup-processable)
6607 (command-execute func))
6608 (gnus-summary-remove-process-mark article)))))
6609 (gnus-summary-position-point))
6611 (defun gnus-summary-toggle-truncation (&optional arg)
6612 "Toggle truncation of summary lines.
6613 With ARG, turn line truncation on if ARG is positive."
6615 (setq truncate-lines
6616 (if (null arg) (not truncate-lines)
6617 (> (prefix-numeric-value arg) 0)))
6620 (defun gnus-summary-find-for-reselect ()
6621 "Return the number of an article to stay on across a reselect.
6622 The current article is considered, then following articles, then previous
6623 articles. An article is sought which is not cancelled and isn't a temporary
6624 insertion from another group. If there's no such then return a dummy 0."
6626 (dolist (rev '(nil t))
6627 (unless found ; don't demand the reverse list if we don't need it
6628 (let ((data (gnus-data-find-list
6629 (gnus-summary-article-number) (gnus-data-list rev))))
6630 (while (and data (not found))
6631 (if (and (< 0 (gnus-data-number (car data)))
6632 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6633 (setq found (gnus-data-number (car data))))
6634 (setq data (cdr data))))))
6637 (defun gnus-summary-reselect-current-group (&optional all rescan)
6638 "Exit and then reselect the current newsgroup.
6639 The prefix argument ALL means to select all articles."
6641 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6642 (error "Ephemeral groups can't be reselected"))
6643 (let ((current-subject (gnus-summary-find-for-reselect))
6644 (group gnus-newsgroup-name))
6645 (setq gnus-newsgroup-begin nil)
6646 (gnus-summary-exit nil 'leave-hidden)
6647 ;; We have to adjust the point of group mode buffer because
6648 ;; point was moved to the next unread newsgroup by exiting.
6649 (gnus-summary-jump-to-group group)
6652 (gnus-group-get-new-news-this-group 1)))
6653 (gnus-group-read-group all t)
6654 (gnus-summary-goto-subject current-subject nil t)))
6656 (defun gnus-summary-rescan-group (&optional all)
6657 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6659 (gnus-summary-reselect-current-group all t))
6661 (defun gnus-summary-update-info (&optional non-destructive)
6663 (let ((group gnus-newsgroup-name))
6665 (when gnus-newsgroup-kill-headers
6666 (setq gnus-newsgroup-killed
6667 (gnus-compress-sequence
6669 (gnus-list-range-intersection
6670 gnus-newsgroup-unselected gnus-newsgroup-killed)
6671 gnus-newsgroup-unreads)
6673 (unless (listp (cdr gnus-newsgroup-killed))
6674 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6675 (let ((headers gnus-newsgroup-headers))
6676 ;; Set the new ranges of read articles.
6678 (set-buffer gnus-group-buffer)
6679 (gnus-undo-force-boundary))
6680 (gnus-update-read-articles
6681 group (gnus-sorted-union
6682 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6683 ;; Set the current article marks.
6684 (let ((gnus-newsgroup-scored
6685 (if (and (not gnus-save-score)
6686 (not non-destructive))
6688 gnus-newsgroup-scored)))
6690 (gnus-update-marks)))
6691 ;; Do the cross-ref thing.
6692 (when gnus-use-cross-reference
6693 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6694 ;; Do not switch windows but change the buffer to work.
6695 (set-buffer gnus-group-buffer)
6696 (unless (gnus-ephemeral-group-p group)
6697 (gnus-group-update-group group)))))))
6699 (defun gnus-summary-save-newsrc (&optional force)
6700 "Save the current number of read/marked articles in the dribble buffer.
6701 The dribble buffer will then be saved.
6702 If FORCE (the prefix), also save the .newsrc file(s)."
6704 (gnus-summary-update-info t)
6706 (gnus-save-newsrc-file)
6707 (gnus-dribble-save)))
6709 (defun gnus-summary-exit (&optional temporary leave-hidden)
6710 "Exit reading current newsgroup, and then return to group selection mode.
6711 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6713 (gnus-set-global-variables)
6714 (when (gnus-buffer-live-p gnus-article-buffer)
6716 (set-buffer gnus-article-buffer)
6717 (mm-destroy-parts gnus-article-mime-handles)
6718 ;; Set it to nil for safety reason.
6719 (setq gnus-article-mime-handle-alist nil)
6720 (setq gnus-article-mime-handles nil)))
6721 (gnus-kill-save-kill-buffer)
6722 (gnus-async-halt-prefetch)
6723 (let* ((group gnus-newsgroup-name)
6724 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6725 (gnus-group-is-exiting-p t)
6728 (buf (current-buffer)))
6730 ;; Do adaptive scoring, and possibly save score files.
6731 (when gnus-newsgroup-adaptive
6732 (gnus-score-adaptive))
6733 (when gnus-use-scoring
6735 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6736 ;; If we have several article buffers, we kill them at exit.
6737 (unless gnus-single-article-buffer
6738 (gnus-kill-buffer gnus-original-article-buffer)
6739 (setq gnus-article-current nil))
6740 (when gnus-use-cache
6741 (gnus-cache-possibly-remove-articles)
6742 (gnus-cache-save-buffers))
6743 (gnus-async-prefetch-remove-group group)
6744 (when gnus-suppress-duplicates
6745 (gnus-dup-enter-articles))
6746 (when gnus-use-trees
6747 (gnus-tree-close group))
6748 (when gnus-use-cache
6749 (gnus-cache-write-active))
6750 ;; Remove entries for this group.
6751 (nnmail-purge-split-history (gnus-group-real-name group))
6752 ;; Make all changes in this group permanent.
6754 (gnus-run-hooks 'gnus-exit-group-hook)
6755 (gnus-summary-update-info))
6756 (gnus-close-group group)
6757 ;; Make sure where we were, and go to next newsgroup.
6758 (set-buffer gnus-group-buffer)
6760 (gnus-group-jump-to-group group))
6761 (gnus-run-hooks 'gnus-summary-exit-hook)
6762 (unless (or quit-config
6763 ;; If this group has disappeared from the summary
6764 ;; buffer, don't skip forwards.
6765 (not (string= group (gnus-group-group-name))))
6766 (gnus-group-next-unread-group 1))
6767 (setq group-point (point))
6770 ;; If we have several article buffers, we kill them at exit.
6771 (unless gnus-single-article-buffer
6772 (gnus-kill-buffer gnus-article-buffer)
6773 (gnus-kill-buffer gnus-original-article-buffer)
6774 (setq gnus-article-current nil))
6776 (if (not gnus-kill-summary-on-exit)
6778 (gnus-deaden-summary)
6780 ;; We set all buffer-local variables to nil. It is unclear why
6781 ;; this is needed, but if we don't, buffer-local variables are
6782 ;; not garbage-collected, it seems. This would the lead to en
6783 ;; ever-growing Emacs.
6784 (gnus-summary-clear-local-variables)
6785 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6786 (gnus-summary-clear-local-variables))
6787 (when (get-buffer gnus-article-buffer)
6788 (bury-buffer gnus-article-buffer))
6789 ;; We clear the global counterparts of the buffer-local
6790 ;; variables as well, just to be on the safe side.
6791 (set-buffer gnus-group-buffer)
6792 (gnus-summary-clear-local-variables)
6793 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6794 (gnus-summary-clear-local-variables))
6795 ;; Return to group mode buffer.
6796 (when (eq mode 'gnus-summary-mode)
6797 (gnus-kill-buffer buf)))
6798 (setq gnus-current-select-method gnus-select-method)
6799 (set-buffer gnus-group-buffer)
6801 (gnus-handle-ephemeral-exit quit-config)
6802 (goto-char group-point)
6803 ;; If gnus-group-buffer is already displayed, make sure we also move
6804 ;; the cursor in the window that displays it.
6805 (let ((win (get-buffer-window (current-buffer) 0)))
6806 (if win (set-window-point win (point))))
6807 (unless leave-hidden
6808 (gnus-configure-windows 'group 'force)))
6809 ;; Clear the current group name.
6811 (setq gnus-newsgroup-name nil)))))
6813 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6814 (defun gnus-summary-exit-no-update (&optional no-questions)
6815 "Quit reading current newsgroup without updating read article info."
6817 (let* ((group gnus-newsgroup-name)
6818 (gnus-group-is-exiting-p t)
6819 (gnus-group-is-exiting-without-update-p t)
6820 (quit-config (gnus-group-quit-config group)))
6821 (when (or no-questions
6823 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6824 (gnus-async-halt-prefetch)
6825 (run-hooks 'gnus-summary-prepare-exit-hook)
6826 (when (gnus-buffer-live-p gnus-article-buffer)
6828 (set-buffer gnus-article-buffer)
6829 (mm-destroy-parts gnus-article-mime-handles)
6830 ;; Set it to nil for safety reason.
6831 (setq gnus-article-mime-handle-alist nil)
6832 (setq gnus-article-mime-handles nil)))
6833 ;; If we have several article buffers, we kill them at exit.
6834 (unless gnus-single-article-buffer
6835 (gnus-kill-buffer gnus-article-buffer)
6836 (gnus-kill-buffer gnus-original-article-buffer)
6837 (setq gnus-article-current nil))
6838 (if (not gnus-kill-summary-on-exit)
6839 (gnus-deaden-summary)
6840 (gnus-close-group group)
6841 (gnus-summary-clear-local-variables)
6842 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6843 (gnus-summary-clear-local-variables))
6844 (set-buffer gnus-group-buffer)
6845 (gnus-summary-clear-local-variables)
6846 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6847 (gnus-summary-clear-local-variables))
6848 (gnus-kill-buffer gnus-summary-buffer))
6849 (unless gnus-single-article-buffer
6850 (setq gnus-article-current nil))
6851 (when gnus-use-trees
6852 (gnus-tree-close group))
6853 (gnus-async-prefetch-remove-group group)
6854 (when (get-buffer gnus-article-buffer)
6855 (bury-buffer gnus-article-buffer))
6856 ;; Return to the group buffer.
6857 (gnus-configure-windows 'group 'force)
6858 ;; Clear the current group name.
6859 (setq gnus-newsgroup-name nil)
6860 (unless (gnus-ephemeral-group-p group)
6861 (gnus-group-update-group group))
6862 (when (equal (gnus-group-group-name) group)
6863 (gnus-group-next-unread-group 1))
6865 (gnus-handle-ephemeral-exit quit-config)))))
6867 (defun gnus-handle-ephemeral-exit (quit-config)
6868 "Handle movement when leaving an ephemeral group.
6869 The state which existed when entering the ephemeral is reset."
6870 (if (not (buffer-name (car quit-config)))
6871 (gnus-configure-windows 'group 'force)
6872 (set-buffer (car quit-config))
6873 (cond ((eq major-mode 'gnus-summary-mode)
6874 (gnus-set-global-variables))
6875 ((eq major-mode 'gnus-article-mode)
6877 ;; The `gnus-summary-buffer' variable may point
6878 ;; to the old summary buffer when using a single
6880 (unless (gnus-buffer-live-p gnus-summary-buffer)
6881 (set-buffer gnus-group-buffer))
6882 (set-buffer gnus-summary-buffer)
6883 (gnus-set-global-variables))))
6884 (if (or (eq (cdr quit-config) 'article)
6885 (eq (cdr quit-config) 'pick))
6887 ;; The current article may be from the ephemeral group
6888 ;; thus it is best that we reload this article
6890 ;; If we're exiting from a large digest, this can be
6891 ;; extremely slow. So, it's better not to reload it. -- jh.
6892 ;;(gnus-summary-show-article)
6893 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6894 (gnus-configure-windows 'pick 'force)
6895 (gnus-configure-windows (cdr quit-config) 'force)))
6896 (gnus-configure-windows (cdr quit-config) 'force))
6897 (when (eq major-mode 'gnus-summary-mode)
6898 (gnus-summary-next-subject 1 nil t)
6899 (gnus-summary-recenter)
6900 (gnus-summary-position-point))))
6904 (defvar gnus-dead-summary-mode-map nil)
6906 (unless gnus-dead-summary-mode-map
6907 (setq gnus-dead-summary-mode-map (make-keymap))
6908 (suppress-keymap gnus-dead-summary-mode-map)
6909 (substitute-key-definition
6910 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6911 (dolist (key '("\C-d" "\r" "\177" [delete]))
6912 (define-key gnus-dead-summary-mode-map
6913 key
'gnus-summary-wake-up-the-dead
))
6914 (dolist (key '("q" "Q"))
6915 (define-key gnus-dead-summary-mode-map key
'bury-buffer
)))
6917 (defvar gnus-dead-summary-mode nil
6918 "Minor mode for Gnus summary buffers.")
6920 (defun gnus-dead-summary-mode (&optional arg
)
6921 "Minor mode for Gnus summary buffers."
6923 (when (eq major-mode
'gnus-summary-mode
)
6924 (make-local-variable 'gnus-dead-summary-mode
)
6925 (setq gnus-dead-summary-mode
6926 (if (null arg
) (not gnus-dead-summary-mode
)
6927 (> (prefix-numeric-value arg
) 0)))
6928 (when gnus-dead-summary-mode
6929 (gnus-add-minor-mode
6930 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
6932 (defun gnus-deaden-summary ()
6933 "Make the current summary buffer into a dead summary buffer."
6934 ;; Kill any previous dead summary buffer.
6935 (when (and gnus-dead-summary
6936 (buffer-name gnus-dead-summary
))
6938 (set-buffer gnus-dead-summary
)
6939 (when gnus-dead-summary-mode
6940 (kill-buffer (current-buffer)))))
6941 ;; Make this the current dead summary.
6942 (setq gnus-dead-summary
(current-buffer))
6943 (gnus-dead-summary-mode 1)
6944 (let ((name (buffer-name)))
6945 (when (string-match "Summary" name
)
6947 (concat (substring name
0 (match-beginning 0)) "Dead "
6948 (substring name
(match-beginning 0)))
6952 (defun gnus-kill-or-deaden-summary (buffer)
6953 "Kill or deaden the summary BUFFER."
6955 (when (and (buffer-name buffer
)
6956 (not gnus-single-article-buffer
))
6959 (gnus-kill-buffer gnus-article-buffer
)
6960 (gnus-kill-buffer gnus-original-article-buffer
)))
6963 (gnus-kill-summary-on-exit
6964 (when (and gnus-use-trees
6965 (gnus-buffer-exists-p buffer
))
6968 (gnus-tree-close gnus-newsgroup-name
)))
6969 (gnus-kill-buffer buffer
))
6970 ;; Deaden the buffer.
6971 ((gnus-buffer-exists-p buffer
)
6974 (gnus-deaden-summary))))))
6976 (defun gnus-summary-wake-up-the-dead (&rest args
)
6977 "Wake up the dead summary buffer."
6979 (gnus-dead-summary-mode -
1)
6980 (let ((name (buffer-name)))
6981 (when (string-match "Dead " name
)
6983 (concat (substring name
0 (match-beginning 0))
6984 (substring name
(match-end 0)))
6986 (gnus-message 3 "This dead summary is now alive again"))
6988 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6989 (defun gnus-summary-fetch-faq (&optional faq-dir
)
6990 "Fetch the FAQ for the current group.
6991 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6995 (when current-prefix-arg
6997 "FAQ dir: " (and (listp gnus-group-faq-directory
)
6998 (mapcar (lambda (file) (list file
))
6999 gnus-group-faq-directory
))))))
7000 (let (gnus-faq-buffer)
7001 (when (setq gnus-faq-buffer
7002 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
7003 (gnus-configure-windows 'summary-faq
))))
7005 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7006 (defun gnus-summary-describe-group (&optional force
)
7007 "Describe the current newsgroup."
7009 (gnus-group-describe-group force gnus-newsgroup-name
))
7011 (defun gnus-summary-describe-briefly ()
7012 "Describe summary mode commands briefly."
7014 (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")))
7016 ;; Walking around group mode buffer from summary mode.
7018 (defun gnus-summary-next-group (&optional no-article target-group backward
)
7019 "Exit current newsgroup and then select next unread newsgroup.
7020 If prefix argument NO-ARTICLE is non-nil, no article is selected
7021 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7022 previous group instead."
7024 ;; Stop pre-fetching.
7025 (gnus-async-halt-prefetch)
7026 (let ((current-group gnus-newsgroup-name
)
7027 (current-buffer (current-buffer))
7029 ;; First we semi-exit this group to update Xrefs and all variables.
7030 ;; We can't do a real exit, because the window conf must remain
7031 ;; the same in case the user is prompted for info, and we don't
7032 ;; want the window conf to change before that...
7033 (gnus-summary-exit t
)
7034 (while (not entered
)
7035 ;; Then we find what group we are supposed to enter.
7036 (set-buffer gnus-group-buffer
)
7037 (gnus-group-jump-to-group current-group
)
7040 (if (eq gnus-keep-same-level
'best
)
7041 (gnus-summary-best-group gnus-newsgroup-name
)
7042 (gnus-summary-search-group backward gnus-keep-same-level
))))
7043 (if (not target-group
)
7044 ;; There are no further groups, so we return to the group
7047 (gnus-message 5 "Returning to the group buffer")
7049 (when (gnus-buffer-live-p current-buffer
)
7050 (set-buffer current-buffer
)
7051 (gnus-summary-exit))
7052 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
7053 ;; We try to enter the target group.
7054 (gnus-group-jump-to-group target-group
)
7055 (let ((unreads (gnus-group-group-unread)))
7056 (if (and (or (eq t unreads
)
7057 (and unreads
(not (zerop unreads
))))
7058 (gnus-summary-read-group
7059 target-group nil no-article
7060 (and (buffer-name current-buffer
) current-buffer
)
7063 (setq current-group target-group
7064 target-group nil
)))))))
7066 (defun gnus-summary-prev-group (&optional no-article
)
7067 "Exit current newsgroup and then select previous unread newsgroup.
7068 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7070 (gnus-summary-next-group no-article nil t
))
7072 ;; Walking around summary lines.
7074 (defun gnus-summary-first-subject (&optional unread undownloaded unseen
)
7075 "Go to the first subject satisfying any non-nil constraint.
7076 If UNREAD is non-nil, the article should be unread.
7077 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7078 If UNSEEN is non-nil, the article should be unseen.
7079 Returns the article selected or nil if there are no matching articles."
7083 ((null gnus-newsgroup-data
)
7084 (gnus-message 3 "No articles in the group")
7086 ;; Pick the first article.
7087 ((not (or unread undownloaded unseen
))
7088 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
7089 (gnus-data-number (car gnus-newsgroup-data
)))
7090 ;; Find the first unread article.
7092 (let ((data gnus-newsgroup-data
))
7094 (let ((num (gnus-data-number (car data
))))
7095 (or (memq num gnus-newsgroup-unfetched
)
7096 (not (or (and unread
7097 (memq num gnus-newsgroup-unreads
))
7099 (memq num gnus-newsgroup-undownloaded
))
7101 (memq num gnus-newsgroup-unseen
)))))))
7102 (setq data
(cdr data
)))
7106 (goto-char (gnus-data-pos (car data
)))
7107 (gnus-data-number (car data
)))
7108 (gnus-message 3 "No more%s articles"
7109 (let* ((r (when unread
" unread"))
7110 (d (when undownloaded
" undownloaded"))
7111 (s (when unseen
" unseen"))
7112 (l (delq nil
(list r d s
))))
7113 (cond ((= 3 (length l
))
7114 (concat r
"," d
", or" s
))
7116 (concat (car l
) ", or" (cadr l
)))
7123 (gnus-summary-position-point))))))
7125 (defun gnus-summary-next-subject (n &optional unread dont-display
)
7126 "Go to next N'th summary line.
7127 If N is negative, go to the previous N'th subject line.
7128 If UNREAD is non-nil, only unread articles are selected.
7129 The difference between N and the actual number of steps taken is
7132 (let ((backward (< n
0))
7136 (gnus-summary-find-prev unread
)
7137 (gnus-summary-find-next unread
)))
7138 (unless (zerop (setq n
(1- n
)))
7139 (gnus-summary-show-thread)))
7141 (gnus-message 7 "No more%s articles"
7142 (if unread
" unread" "")))
7143 (unless dont-display
7144 (gnus-summary-recenter)
7145 (gnus-summary-position-point))
7148 (defun gnus-summary-next-unread-subject (n)
7149 "Go to next N'th unread summary line."
7151 (gnus-summary-next-subject n t
))
7153 (defun gnus-summary-prev-subject (n &optional unread
)
7154 "Go to previous N'th summary line.
7155 If optional argument UNREAD is non-nil, only unread article is selected."
7157 (gnus-summary-next-subject (- n
) unread
))
7159 (defun gnus-summary-prev-unread-subject (n)
7160 "Go to previous N'th unread summary line."
7162 (gnus-summary-next-subject (- n
) t
))
7164 (defun gnus-summary-goto-subjects (articles)
7165 "Insert the subject header for ARTICLES in the current buffer."
7167 (dolist (article articles
)
7168 (gnus-summary-goto-subject article t
)))
7169 (gnus-summary-limit (append articles gnus-newsgroup-limit
))
7170 (gnus-summary-position-point))
7172 (defun gnus-summary-goto-subject (article &optional force silent
)
7173 "Go the subject line of ARTICLE.
7174 If FORCE, also allow jumping to articles not currently shown."
7175 (interactive "nArticle number: ")
7176 (unless (numberp article
)
7177 (error "Article %s is not a number" article
))
7179 (data (gnus-data-find article
)))
7180 ;; We read in the article if we have to.
7183 (gnus-summary-insert-subject
7185 (if (or (numberp force
) (vectorp force
)) force
)
7187 (setq data
(gnus-data-find article
)))
7192 (gnus-message 3 "Can't find article %d" article
))
7194 (let ((pt (gnus-data-pos data
)))
7196 (gnus-summary-set-article-display-arrow pt
))
7197 (gnus-summary-position-point)
7200 ;; Walking around summary lines with displaying articles.
7202 (defun gnus-summary-expand-window (&optional arg
)
7203 "Make the summary buffer take up the entire Emacs frame.
7204 Given a prefix, will force an `article' buffer configuration."
7207 (gnus-configure-windows 'article
'force
)
7208 (gnus-configure-windows 'summary
'force
)))
7210 (defun gnus-summary-display-article (article &optional all-header
)
7211 "Display ARTICLE in article buffer."
7212 (when (gnus-buffer-live-p gnus-article-buffer
)
7213 (with-current-buffer gnus-article-buffer
7214 (mm-enable-multibyte)))
7215 (gnus-set-global-variables)
7216 (when (gnus-buffer-live-p gnus-article-buffer
)
7217 (with-current-buffer gnus-article-buffer
7218 (setq gnus-article-charset gnus-newsgroup-charset
)
7219 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets
)
7220 (mm-enable-multibyte)))
7224 (if gnus-summary-display-article-function
7225 (funcall gnus-summary-display-article-function article all-header
)
7226 (gnus-article-prepare article all-header
))
7227 (gnus-run-hooks 'gnus-select-article-hook
)
7228 (when (and gnus-current-article
7229 (not (zerop gnus-current-article
)))
7230 (gnus-summary-goto-subject gnus-current-article
))
7231 (gnus-summary-recenter)
7232 (when (and gnus-use-trees gnus-show-threads
)
7233 (gnus-possibly-generate-tree article
)
7234 (gnus-highlight-selected-tree article
))
7235 ;; Successfully display article.
7236 (gnus-article-set-window-start
7237 (cdr (assq article gnus-newsgroup-bookmarks
))))))
7239 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
7240 "Select the current article.
7241 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7242 non-nil, the article will be re-fetched even if it already present in
7243 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7245 ;; Make sure we are in the summary buffer to work around bbdb bug.
7246 (unless (eq major-mode
'gnus-summary-mode
)
7247 (set-buffer gnus-summary-buffer
))
7248 (let ((article (or article
(gnus-summary-article-number)))
7249 (all-headers (not (not all-headers
))) ;Must be t or nil.
7250 gnus-summary-display-article-function
)
7252 (gnus-summary-article-pseudo-p article
)
7253 (error "This is a pseudo-article"))
7255 (set-buffer gnus-summary-buffer
)
7256 (if (or (and gnus-single-article-buffer
7257 (or (null gnus-current-article
)
7258 (null gnus-article-current
)
7259 (null (get-buffer gnus-article-buffer
))
7260 (not (eq article
(cdr gnus-article-current
)))
7261 (not (equal (car gnus-article-current
)
7262 gnus-newsgroup-name
))))
7263 (and (not gnus-single-article-buffer
)
7264 (or (null gnus-current-article
)
7265 (not (eq gnus-current-article article
))))
7267 ;; The requested article is different from the current article.
7269 (gnus-summary-display-article article all-headers
)
7270 (when (gnus-buffer-live-p gnus-article-buffer
)
7271 (with-current-buffer gnus-article-buffer
7272 (if (not gnus-article-decoded-p
) ;; a local variable
7273 (mm-disable-multibyte))))
7274 (gnus-article-set-window-start
7275 (cdr (assq article gnus-newsgroup-bookmarks
)))
7279 (defun gnus-summary-force-verify-and-decrypt ()
7280 "Display buttons for signed/encrypted parts and verify/decrypt them."
7282 (let ((mm-verify-option 'known
)
7283 (mm-decrypt-option 'known
)
7284 (gnus-article-emulate-mime t
)
7285 (gnus-buttonized-mime-types (append (list "multipart/signed"
7286 "multipart/encrypted")
7287 gnus-buttonized-mime-types
)))
7288 (gnus-summary-select-article nil
'force
)))
7290 (defun gnus-summary-set-current-mark (&optional current-mark
)
7291 "Obsolete function."
7294 (defun gnus-summary-next-article (&optional unread subject backward push
)
7295 "Select the next article.
7296 If UNREAD, only unread articles are selected.
7297 If SUBJECT, only articles with SUBJECT are selected.
7298 If BACKWARD, the previous article is selected instead of the next."
7301 ;; Is there such an article?
7302 ((and (gnus-summary-search-forward unread subject backward
)
7303 (or (gnus-summary-display-article (gnus-summary-article-number))
7304 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
7305 (gnus-summary-position-point))
7306 ;; If not, we try the first unread, if that is wanted.
7308 gnus-auto-select-same
7309 (gnus-summary-first-unread-article))
7310 (gnus-summary-position-point)
7311 (gnus-message 6 "Wrapped"))
7312 ;; Try to get next/previous article not displayed in this group.
7313 ((and gnus-auto-extend-newsgroup
7314 (not unread
) (not subject
))
7315 (gnus-summary-goto-article
7316 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
7317 nil
(count-lines (point-min) (point))))
7318 ;; Go to next/previous group.
7320 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
7321 (gnus-summary-jump-to-group gnus-newsgroup-name
))
7322 (let ((cmd last-command-char
)
7325 (set-buffer gnus-group-buffer
)
7328 (if (eq gnus-keep-same-level
'best
)
7329 (gnus-summary-best-group gnus-newsgroup-name
)
7330 (gnus-summary-search-group backward gnus-keep-same-level
))))
7331 ;; For some reason, the group window gets selected. We change
7333 (select-window (get-buffer-window (current-buffer)))
7334 ;; Select next unread newsgroup automagically.
7336 ((or (not gnus-auto-select-next
)
7338 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
7339 ((or (eq gnus-auto-select-next
'quietly
)
7340 (and (eq gnus-auto-select-next
'slightly-quietly
)
7342 (and (eq gnus-auto-select-next
'almost-quietly
)
7343 (gnus-summary-last-article-p)))
7345 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
7347 (gnus-message 7 "No more%s articles (%s)..."
7348 (if unread
" unread" "")
7349 (if group
(concat "selecting " group
)
7351 (gnus-summary-next-group nil group backward
)))
7353 (when (gnus-key-press-event-p last-input-event
)
7354 (gnus-summary-walk-group-buffer
7355 gnus-newsgroup-name cmd unread backward point
))))))))
7357 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
7358 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
7359 (?\C-p
(gnus-group-prev-unread-group 1))))
7360 (cursor-in-echo-area t
)
7361 keve key group ended prompt
)
7363 (set-buffer gnus-group-buffer
)
7366 (if (eq gnus-keep-same-level
'best
)
7367 (gnus-summary-best-group gnus-newsgroup-name
)
7368 (gnus-summary-search-group backward gnus-keep-same-level
))))
7372 "No more%s articles%s " (if unread
" unread" "")
7374 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
7375 (format " (Type %s for %s [%s])"
7376 (single-key-description cmd
)
7377 (gnus-group-decoded-name group
)
7378 (car (gnus-gethash group gnus-newsrc-hashtb
)))
7379 (format " (Type %s to exit %s)"
7380 (single-key-description cmd
)
7381 (gnus-group-decoded-name gnus-newsgroup-name
)))))
7382 ;; Confirm auto selection.
7383 (setq key
(car (setq keve
(gnus-read-event-char prompt
)))
7386 ((assq key keystrokes
)
7387 (let ((obuf (current-buffer)))
7388 (switch-to-buffer gnus-group-buffer
)
7390 (gnus-group-jump-to-group group
))
7391 (eval (cadr (assq key keystrokes
)))
7392 (setq group
(gnus-group-group-name))
7393 (switch-to-buffer obuf
))
7397 (gnus-ephemeral-group-p gnus-newsgroup-name
))
7399 (gnus-summary-next-group nil group backward
)))
7401 (push (cdr keve
) unread-command-events
))))))
7403 (defun gnus-summary-next-unread-article ()
7404 "Select unread article after current one."
7406 (gnus-summary-next-article
7407 (or (not (eq gnus-summary-goto-unread
'never
))
7408 (gnus-summary-last-article-p (gnus-summary-article-number)))
7409 (and gnus-auto-select-same
7410 (gnus-summary-article-subject))))
7412 (defun gnus-summary-prev-article (&optional unread subject
)
7413 "Select the article after the current one.
7414 If UNREAD is non-nil, only unread articles are selected."
7416 (gnus-summary-next-article unread subject t
))
7418 (defun gnus-summary-prev-unread-article ()
7419 "Select unread article before current one."
7421 (gnus-summary-prev-article
7422 (or (not (eq gnus-summary-goto-unread
'never
))
7423 (gnus-summary-first-article-p (gnus-summary-article-number)))
7424 (and gnus-auto-select-same
7425 (gnus-summary-article-subject))))
7427 (defun gnus-summary-next-page (&optional lines circular stop
)
7428 "Show next page of the selected article.
7429 If at the end of the current article, select the next article.
7430 LINES says how many lines should be scrolled up.
7432 If CIRCULAR is non-nil, go to the start of the article instead of
7433 selecting the next article when reaching the end of the current
7436 If STOP is non-nil, just stop when reaching the end of the message.
7438 Also see the variable `gnus-article-skip-boring'."
7440 (setq gnus-summary-buffer
(current-buffer))
7441 (gnus-set-global-variables)
7442 (let ((article (gnus-summary-article-number))
7443 (article-window (get-buffer-window gnus-article-buffer t
))
7445 ;; If the buffer is empty, we have no article.
7447 (error "No article to select"))
7448 (gnus-configure-windows 'article
)
7449 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
7450 (if (and (eq gnus-summary-goto-unread
'never
)
7451 (not (gnus-summary-last-article-p article
)))
7452 (gnus-summary-next-article)
7453 (gnus-summary-next-unread-article))
7454 (if (or (null gnus-current-article
)
7455 (null gnus-article-current
)
7456 (/= article
(cdr gnus-article-current
))
7457 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7458 ;; Selected subject is different from current article's.
7459 (gnus-summary-display-article article
)
7460 (when article-window
7461 (gnus-eval-in-buffer-window gnus-article-buffer
7462 (setq endp
(or (gnus-article-next-page lines
)
7463 (gnus-article-only-boring-p))))
7466 (gnus-message 3 "End of message"))
7468 (gnus-summary-beginning-of-article))
7470 (gnus-message 3 "End of message"))
7472 (if (and (eq gnus-summary-goto-unread
'never
)
7473 (not (gnus-summary-last-article-p article
)))
7474 (gnus-summary-next-article)
7475 (gnus-summary-next-unread-article))))))))
7476 (gnus-summary-recenter)
7477 (gnus-summary-position-point)))
7479 (defun gnus-summary-prev-page (&optional lines move
)
7480 "Show previous page of selected article.
7481 Argument LINES specifies lines to be scrolled down.
7482 If MOVE, move to the previous unread article if point is at
7483 the beginning of the buffer."
7485 (let ((article (gnus-summary-article-number))
7486 (article-window (get-buffer-window gnus-article-buffer t
))
7488 (gnus-configure-windows 'article
)
7489 (if (or (null gnus-current-article
)
7490 (null gnus-article-current
)
7491 (/= article
(cdr gnus-article-current
))
7492 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7493 ;; Selected subject is different from current article's.
7494 (gnus-summary-display-article article
)
7495 (gnus-summary-recenter)
7496 (when article-window
7497 (gnus-eval-in-buffer-window gnus-article-buffer
7498 (setq endp
(gnus-article-prev-page lines
)))
7499 (when (and move endp
)
7501 (gnus-message 3 "Beginning of message"))
7503 (if (and (eq gnus-summary-goto-unread
'never
)
7504 (not (gnus-summary-first-article-p article
)))
7505 (gnus-summary-prev-article)
7506 (gnus-summary-prev-unread-article))))))))
7507 (gnus-summary-position-point))
7509 (defun gnus-summary-prev-page-or-article (&optional lines
)
7510 "Show previous page of selected article.
7511 Argument LINES specifies lines to be scrolled down.
7512 If at the beginning of the article, go to the next article."
7514 (gnus-summary-prev-page lines t
))
7516 (defun gnus-summary-scroll-up (lines)
7517 "Scroll up (or down) one line current article.
7518 Argument LINES specifies lines to be scrolled up (or down if negative)."
7520 (gnus-configure-windows 'article
)
7521 (gnus-summary-show-thread)
7522 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
7523 (gnus-eval-in-buffer-window gnus-article-buffer
7525 (when (gnus-article-next-page lines
)
7526 (gnus-message 3 "End of message")))
7528 (gnus-article-prev-page (- lines
))))))
7529 (gnus-summary-recenter)
7530 (gnus-summary-position-point))
7532 (defun gnus-summary-scroll-down (lines)
7533 "Scroll down (or up) one line current article.
7534 Argument LINES specifies lines to be scrolled down (or up if negative)."
7536 (gnus-summary-scroll-up (- lines
)))
7538 (defun gnus-summary-next-same-subject ()
7539 "Select next article which has the same subject as current one."
7541 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
7543 (defun gnus-summary-prev-same-subject ()
7544 "Select previous article which has the same subject as current one."
7546 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
7548 (defun gnus-summary-next-unread-same-subject ()
7549 "Select next unread article which has the same subject as current one."
7551 (gnus-summary-next-article t
(gnus-summary-article-subject)))
7553 (defun gnus-summary-prev-unread-same-subject ()
7554 "Select previous unread article which has the same subject as current one."
7556 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
7558 (defun gnus-summary-first-unread-article ()
7559 "Select the first unread article.
7560 Return nil if there are no unread articles."
7563 (when (gnus-summary-first-subject t
)
7564 (gnus-summary-show-thread)
7565 (gnus-summary-first-subject t
)
7566 (gnus-summary-display-article (gnus-summary-article-number)))
7567 (gnus-summary-position-point)))
7569 (defun gnus-summary-first-unread-subject ()
7570 "Place the point on the subject line of the first unread article.
7571 Return nil if there are no unread articles."
7574 (when (gnus-summary-first-subject t
)
7575 (gnus-summary-show-thread)
7576 (gnus-summary-first-subject t
))
7577 (gnus-summary-position-point)))
7579 (defun gnus-summary-first-unseen-subject ()
7580 "Place the point on the subject line of the first unseen article.
7581 Return nil if there are no unseen articles."
7584 (when (gnus-summary-first-subject nil nil t
)
7585 (gnus-summary-show-thread)
7586 (gnus-summary-first-subject nil nil t
))
7587 (gnus-summary-position-point)))
7589 (defun gnus-summary-first-unseen-or-unread-subject ()
7590 "Place the point on the subject line of the first unseen article or,
7591 if all article have been seen, on the subject line of the first unread
7595 (unless (when (gnus-summary-first-subject nil nil t
)
7596 (gnus-summary-show-thread)
7597 (gnus-summary-first-subject nil nil t
))
7598 (when (gnus-summary-first-subject t
)
7599 (gnus-summary-show-thread)
7600 (gnus-summary-first-subject t
)))
7601 (gnus-summary-position-point)))
7603 (defun gnus-summary-first-article ()
7604 "Select the first article.
7605 Return nil if there are no articles."
7608 (when (gnus-summary-first-subject)
7609 (gnus-summary-show-thread)
7610 (gnus-summary-first-subject)
7611 (gnus-summary-display-article (gnus-summary-article-number)))
7612 (gnus-summary-position-point)))
7614 (defun gnus-summary-best-unread-article (&optional arg
)
7615 "Select the unread article with the highest score.
7616 If given a prefix argument, select the next unread article that has a
7617 score higher than the default score."
7619 (let ((article (if arg
7620 (gnus-summary-better-unread-subject)
7621 (gnus-summary-best-unread-subject))))
7623 (gnus-summary-goto-article article
)
7624 (error "No unread articles"))))
7626 (defun gnus-summary-best-unread-subject ()
7627 "Select the unread subject with the highest score."
7629 (let ((best -
1000000)
7630 (data gnus-newsgroup-data
)
7633 (and (gnus-data-unread-p (car data
))
7635 (gnus-summary-article-score (gnus-data-number (car data
))))
7638 article
(gnus-data-number (car data
))))
7639 (setq data
(cdr data
)))
7641 (gnus-summary-goto-subject article
))
7642 (gnus-summary-position-point)
7645 (defun gnus-summary-better-unread-subject ()
7646 "Select the first unread subject that has a score over the default score."
7648 (let ((data gnus-newsgroup-data
)
7650 (while (and (setq article
(gnus-data-number (car data
)))
7651 (or (gnus-data-read-p (car data
))
7652 (not (> (gnus-summary-article-score article
)
7653 gnus-summary-default-score
))))
7654 (setq data
(cdr data
)))
7656 (gnus-summary-goto-subject article
))
7657 (gnus-summary-position-point)
7660 (defun gnus-summary-last-subject ()
7661 "Go to the last displayed subject line in the group."
7662 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
7664 (gnus-summary-goto-subject article
))))
7666 (defun gnus-summary-goto-article (article &optional all-headers force
)
7667 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7668 If ALL-HEADERS is non-nil, no header lines are hidden.
7669 If FORCE, go to the article even if it isn't displayed. If FORCE
7670 is a number, it is the line the article is to be displayed on."
7674 "Article number or Message-ID: "
7675 (mapcar (lambda (number) (list (int-to-string number
)))
7676 gnus-newsgroup-limit
))
7680 (if (and (stringp article
)
7681 (string-match "@\\|%40" article
))
7682 (gnus-summary-refer-article article
)
7683 (when (stringp article
)
7684 (setq article
(string-to-number article
)))
7685 (if (gnus-summary-goto-subject article force
)
7686 (gnus-summary-display-article article all-headers
)
7687 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
7688 (gnus-summary-position-point)))
7690 (defun gnus-summary-goto-last-article ()
7691 "Go to the previously read article."
7694 (when gnus-last-article
7695 (gnus-summary-goto-article gnus-last-article nil t
))
7696 (gnus-summary-position-point)))
7698 (defun gnus-summary-pop-article (number)
7699 "Pop one article off the history and go to the previous.
7700 NUMBER articles will be popped off."
7703 (setq gnus-newsgroup-history
7704 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
7706 (gnus-summary-goto-article (car to
) nil t
)
7707 (error "Article history empty")))
7708 (gnus-summary-position-point))
7710 ;; Summary commands and functions for limiting the summary buffer.
7712 (defun gnus-summary-limit-to-articles (n)
7713 "Limit the summary buffer to the next N articles.
7714 If not given a prefix, use the process marked articles instead."
7717 (let ((articles (gnus-summary-work-articles n
)))
7718 (setq gnus-newsgroup-processable nil
)
7719 (gnus-summary-limit articles
))
7720 (gnus-summary-position-point)))
7722 (defun gnus-summary-pop-limit (&optional total
)
7723 "Restore the previous limit.
7724 If given a prefix, remove all limits."
7727 (setq gnus-newsgroup-limits
7728 (list (mapcar (lambda (h) (mail-header-number h
))
7729 gnus-newsgroup-headers
))))
7730 (unless gnus-newsgroup-limits
7731 (error "No limit to pop"))
7733 (gnus-summary-limit nil
'pop
)
7734 (gnus-summary-position-point)))
7736 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
7737 "Limit the summary buffer to articles that have subjects that match a regexp.
7738 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7740 (list (read-string (if current-prefix-arg
7741 "Exclude subject (regexp): "
7742 "Limit to subject (regexp): "))
7743 nil current-prefix-arg
))
7745 (setq header
"subject"))
7746 (when (not (equal "" subject
))
7748 (let ((articles (gnus-summary-find-matching
7749 (or header
"subject") subject
'all nil nil
7752 (error "Found no matches for \"%s\"" subject
))
7753 (gnus-summary-limit articles
))
7754 (gnus-summary-position-point))))
7756 (defun gnus-summary-limit-to-author (from &optional not-matching
)
7757 "Limit the summary buffer to articles that have authors that match a regexp.
7758 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7760 (list (read-string (if current-prefix-arg
7761 "Exclude author (regexp): "
7762 "Limit to author (regexp): "))
7763 current-prefix-arg
))
7764 (gnus-summary-limit-to-subject from
"from" not-matching
))
7766 (defun gnus-summary-limit-to-age (age &optional younger-p
)
7767 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7768 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7769 articles that are younger than AGE days."
7771 (let ((younger current-prefix-arg
)
7774 (while (not days-got
)
7775 (setq days
(if younger
7776 (read-string "Limit to articles younger than (in days, older when negative): ")
7778 "Limit to articles older than (in days, younger when negative): ")))
7779 (when (> (length days
) 0)
7780 (setq days
(read days
)))
7786 (setq younger
(not younger
))
7787 (setq days
(* days -
1)))))
7788 (message "Please enter a number.")
7790 (list days younger
)))
7792 (let ((data gnus-newsgroup-data
)
7793 (cutoff (days-to-time age
))
7794 articles d date is-younger
)
7795 (while (setq d
(pop data
))
7796 (when (and (vectorp (gnus-data-header d
))
7797 (setq date
(mail-header-date (gnus-data-header d
))))
7798 (setq is-younger
(time-less-p
7799 (time-since (condition-case ()
7806 (push (gnus-data-number d
) articles
))))
7807 (gnus-summary-limit (nreverse articles
)))
7808 (gnus-summary-position-point)))
7810 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
7811 "Limit the summary buffer to articles that match an 'extra' header."
7815 (gnus-completing-read-with-default
7816 (symbol-name (car gnus-extra-headers
))
7817 (if current-prefix-arg
7818 "Exclude extra header"
7819 "Limit extra header")
7821 (cons (symbol-name x
) x
))
7826 (read-string (format "%s header %s (regexp): "
7827 (if current-prefix-arg
"Exclude" "Limit to")
7829 current-prefix-arg
)))
7830 (when (not (equal "" regexp
))
7832 (let ((articles (gnus-summary-find-matching
7833 (cons 'extra header
) regexp
'all nil nil
7836 (error "Found no matches for \"%s\"" regexp
))
7837 (gnus-summary-limit articles
))
7838 (gnus-summary-position-point))))
7840 (defun gnus-summary-limit-to-display-predicate ()
7841 "Limit the summary buffer to the predicated in the `display' group parameter."
7843 (unless gnus-newsgroup-display
7844 (error "There is no `display' group parameter"))
7846 (dolist (number gnus-newsgroup-articles
)
7847 (when (funcall gnus-newsgroup-display
)
7848 (push number articles
)))
7849 (gnus-summary-limit articles
))
7850 (gnus-summary-position-point))
7852 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7854 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7856 (defun gnus-summary-limit-to-unread (&optional all
)
7857 "Limit the summary buffer to articles that are not marked as read.
7858 If ALL is non-nil, limit strictly to unread articles."
7861 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
7862 (gnus-summary-limit-to-marks
7863 ;; Concat all the marks that say that an article is read and have
7865 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7866 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7867 gnus-low-score-mark gnus-expirable-mark
7868 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7869 gnus-duplicate-mark gnus-souped-mark
)
7872 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
7873 (make-obsolete 'gnus-summary-delete-marked-with
7874 'gnus-summary-limit-exclude-marks
)
7876 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
7877 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7878 If REVERSE, limit the summary buffer to articles that are marked
7879 with MARKS. MARKS can either be a string of marks or a list of marks.
7880 Returns how many articles were removed."
7881 (interactive "sMarks: ")
7882 (gnus-summary-limit-to-marks marks t
))
7884 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
7885 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7886 If REVERSE (the prefix), limit the summary buffer to articles that are
7887 not marked with MARKS. MARKS can either be a string of marks or a
7889 Returns how many articles were removed."
7890 (interactive "sMarks: \nP")
7892 (let ((data gnus-newsgroup-data
)
7893 (marks (if (listp marks
) marks
7894 (append marks nil
))) ; Transform to list.
7897 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
7898 (memq (gnus-data-mark (car data
)) marks
))
7899 (push (gnus-data-number (car data
)) articles
))
7900 (setq data
(cdr data
)))
7901 (gnus-summary-limit articles
))
7902 (gnus-summary-position-point)))
7904 (defun gnus-summary-limit-to-score (score)
7905 "Limit to articles with score at or above SCORE."
7906 (interactive "NLimit to articles with score of at least: ")
7907 (let ((data gnus-newsgroup-data
)
7910 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
7912 (push (gnus-data-number (car data
)) articles
))
7913 (setq data
(cdr data
)))
7915 (gnus-summary-limit articles
)
7916 (gnus-summary-position-point))))
7918 (defun gnus-summary-limit-to-unseen ()
7919 "Limit to unseen articles."
7922 (gnus-summary-limit gnus-newsgroup-unseen
)
7923 (gnus-summary-position-point)))
7925 (defun gnus-summary-limit-include-thread (id)
7926 "Display all the hidden articles that is in the thread with ID in it.
7927 When called interactively, ID is the Message-ID of the current
7929 (interactive (list (mail-header-id (gnus-summary-article-header))))
7930 (let ((articles (gnus-articles-in-thread
7931 (gnus-id-to-thread (gnus-root-id id
)))))
7933 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
7934 (gnus-summary-limit-include-matching-articles
7936 (regexp-quote (gnus-simplify-subject-re
7937 (mail-header-subject (gnus-id-to-header id
)))))
7938 (gnus-summary-position-point))))
7940 (defun gnus-summary-limit-include-matching-articles (header regexp
)
7941 "Display all the hidden articles that have HEADERs that match REGEXP."
7942 (interactive (list (read-string "Match on header: ")
7943 (read-string "Regexp: ")))
7944 (let ((articles (gnus-find-matching-articles header regexp
)))
7946 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
7947 (gnus-summary-position-point))))
7949 (defun gnus-summary-insert-dormant-articles ()
7950 "Insert all the dormant articles for this group into the current buffer."
7952 (let ((gnus-verbose (max 6 gnus-verbose
)))
7953 (if (not gnus-newsgroup-dormant
)
7954 (gnus-message 3 "No cached articles for this group")
7955 (gnus-summary-goto-subjects gnus-newsgroup-dormant
))))
7957 (defun gnus-summary-limit-include-dormant ()
7958 "Display all the hidden articles that are marked as dormant.
7959 Note that this command only works on a subset of the articles currently
7960 fetched for this group."
7962 (unless gnus-newsgroup-dormant
7963 (error "There are no dormant articles in this group"))
7965 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
7966 (gnus-summary-position-point)))
7968 (defun gnus-summary-limit-exclude-dormant ()
7969 "Hide all dormant articles."
7972 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
7973 (gnus-summary-position-point)))
7975 (defun gnus-summary-limit-exclude-childless-dormant ()
7976 "Hide all dormant articles that have no children."
7978 (let ((data (gnus-data-list t
))
7979 articles d children
)
7980 ;; Find all articles that are either not dormant or have
7982 (while (setq d
(pop data
))
7983 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
7985 (gnus-article-children (gnus-data-number d
)))
7988 (when (memq (car children
) articles
)
7993 (push (gnus-data-number d
) articles
)))
7996 (gnus-summary-limit articles
)
7997 (gnus-summary-position-point))))
7999 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
8000 "Mark all unread excluded articles as read.
8001 If ALL, mark even excluded ticked and dormants as read."
8003 (setq gnus-newsgroup-limit
(sort gnus-newsgroup-limit
'<))
8004 (let ((articles (gnus-sorted-ndifference
8006 (mapcar (lambda (h) (mail-header-number h
))
8007 gnus-newsgroup-headers
)
8009 gnus-newsgroup-limit
))
8011 (setq gnus-newsgroup-unreads
8012 (gnus-sorted-intersection gnus-newsgroup-unreads
8013 gnus-newsgroup-limit
))
8015 (setq gnus-newsgroup-dormant nil
8016 gnus-newsgroup-marked nil
8017 gnus-newsgroup-reads
8019 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
8020 gnus-newsgroup-reads
))
8021 (while (setq article
(pop articles
))
8022 (unless (or (memq article gnus-newsgroup-dormant
)
8023 (memq article gnus-newsgroup-marked
))
8024 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
8026 (defun gnus-summary-limit (articles &optional pop
)
8028 ;; We pop the previous limit off the stack and use that.
8029 (setq articles
(car gnus-newsgroup-limits
)
8030 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
8031 ;; We use the new limit, so we push the old limit on the stack.
8032 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
8034 (setq gnus-newsgroup-limit articles
)
8035 (let ((total (length gnus-newsgroup-data
))
8036 (data (gnus-data-find-list (gnus-summary-article-number)))
8037 (gnus-summary-mark-below nil
) ; Inhibit this.
8039 ;; This will do all the work of generating the new summary buffer
8040 ;; according to the new limit.
8041 (gnus-summary-prepare)
8042 ;; Hide any threads, possibly.
8043 (gnus-summary-maybe-hide-threads)
8044 ;; Try to return to the article you were at, or one in the
8047 ;; We try to find some article after the current one.
8049 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
8052 (setq data
(cdr data
))))
8054 ;; If there is no data, that means that we were after the last
8055 ;; article. The same goes when we can't find any articles
8056 ;; after the current one.
8057 (goto-char (point-max))
8058 (gnus-summary-find-prev))
8059 (gnus-set-mode-line 'summary
)
8060 ;; We return how many articles were removed from the summary
8061 ;; buffer as a result of the new limit.
8062 (- total
(length gnus-newsgroup-data
))))
8064 (defsubst gnus-invisible-cut-children
(threads)
8067 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
8072 (defsubst gnus-cut-thread
(thread)
8073 "Go forwards in the thread until we find an article that we want to display."
8074 (when (or (eq gnus-fetch-old-headers
'some
)
8075 (eq gnus-fetch-old-headers
'invisible
)
8076 (numberp gnus-fetch-old-headers
)
8077 (eq gnus-build-sparse-threads
'some
)
8078 (eq gnus-build-sparse-threads
'more
))
8079 ;; Deal with old-fetched headers and sparse threads.
8083 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
8084 (gnus-summary-article-ancient-p
8085 (mail-header-number (car thread
))))
8086 (if (or (<= (length (cdr thread
)) 1)
8087 (eq gnus-fetch-old-headers
'invisible
))
8088 (setq gnus-newsgroup-limit
8089 (delq (mail-header-number (car thread
))
8090 gnus-newsgroup-limit
)
8091 thread
(cadr thread
))
8092 (when (gnus-invisible-cut-children (cdr thread
))
8093 (let ((th (cdr thread
)))
8095 (if (memq (mail-header-number (caar th
))
8096 gnus-newsgroup-limit
)
8097 (setq thread
(car th
)
8099 (setq th
(cdr th
))))))))))
8102 (defun gnus-cut-threads (threads)
8103 "Cut off all uninteresting articles from the beginning of THREADS."
8104 (when (or (eq gnus-fetch-old-headers
'some
)
8105 (eq gnus-fetch-old-headers
'invisible
)
8106 (numberp gnus-fetch-old-headers
)
8107 (eq gnus-build-sparse-threads
'some
)
8108 (eq gnus-build-sparse-threads
'more
))
8111 (setcar th
(gnus-cut-thread (car th
)))
8112 (setq th
(cdr th
)))))
8113 ;; Remove nixed out threads.
8116 (defun gnus-summary-initial-limit (&optional show-if-empty
)
8117 "Figure out what the initial limit is supposed to be on group entry.
8118 This entails weeding out unwanted dormants, low-scored articles,
8119 fetch-old-headers verbiage, and so on."
8120 ;; Most groups have nothing to remove.
8121 (if (or gnus-inhibit-limiting
8122 (and (null gnus-newsgroup-dormant
)
8123 (eq gnus-newsgroup-display
'gnus-not-ignore
)
8124 (not (eq gnus-fetch-old-headers
'some
))
8125 (not (numberp gnus-fetch-old-headers
))
8126 (not (eq gnus-fetch-old-headers
'invisible
))
8127 (null gnus-summary-expunge-below
)
8128 (not (eq gnus-build-sparse-threads
'some
))
8129 (not (eq gnus-build-sparse-threads
'more
))
8130 (null gnus-thread-expunge-below
)
8131 (not gnus-use-nocem
)))
8133 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
8134 (setq gnus-newsgroup-limit nil
)
8137 (unless (car (symbol-value node
))
8138 ;; These threads have no parents -- they are roots.
8139 (let ((nodes (cdr (symbol-value node
)))
8142 (if (and gnus-thread-expunge-below
8143 (< (gnus-thread-total-score (car nodes
))
8144 gnus-thread-expunge-below
))
8145 (gnus-expunge-thread (pop nodes
))
8146 (setq thread
(pop nodes
))
8147 (gnus-summary-limit-children thread
))))))
8148 gnus-newsgroup-dependencies
)
8149 ;; If this limitation resulted in an empty group, we might
8150 ;; pop the previous limit and use it instead.
8151 (when (and (not gnus-newsgroup-limit
)
8153 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
8154 gnus-newsgroup-limit
))
8156 (defun gnus-summary-limit-children (thread)
8157 "Return 1 if this subthread is visible and 0 if it is not."
8158 ;; First we get the number of visible children to this thread. This
8159 ;; is done by recursing down the thread using this function, so this
8160 ;; will really go down to a leaf article first, before slowly
8161 ;; working its way up towards the root.
8163 (let* ((max-lisp-eval-depth 5000)
8166 (apply '+ (mapcar 'gnus-summary-limit-children
8169 (number (mail-header-number (car thread
)))
8172 (not (memq number gnus-newsgroup-marked
))
8174 ;; If this article is dormant and has absolutely no visible
8175 ;; children, then this article isn't visible.
8176 (and (memq number gnus-newsgroup-dormant
)
8178 ;; If this is "fetch-old-headered" and there is no
8179 ;; visible children, then we don't want this article.
8180 (and (or (eq gnus-fetch-old-headers
'some
)
8181 (numberp gnus-fetch-old-headers
))
8182 (gnus-summary-article-ancient-p number
)
8184 ;; If this is "fetch-old-headered" and `invisible', then
8185 ;; we don't want this article.
8186 (and (eq gnus-fetch-old-headers
'invisible
)
8187 (gnus-summary-article-ancient-p number
))
8188 ;; If this is a sparsely inserted article with no children,
8189 ;; we don't want it.
8190 (and (eq gnus-build-sparse-threads
'some
)
8191 (gnus-summary-article-sparse-p number
)
8193 ;; If we use expunging, and this article is really
8194 ;; low-scored, then we don't want this article.
8195 (when (and gnus-summary-expunge-below
8197 (or (cdr (assq number gnus-newsgroup-scored
))
8198 gnus-summary-default-score
))
8199 gnus-summary-expunge-below
))
8200 ;; We increase the expunge-tally here, but that has
8201 ;; nothing to do with the limits, really.
8202 (incf gnus-newsgroup-expunged-tally
)
8203 ;; We also mark as read here, if that's wanted.
8204 (when (and gnus-summary-mark-below
8205 (< score gnus-summary-mark-below
))
8206 (setq gnus-newsgroup-unreads
8207 (delq number gnus-newsgroup-unreads
))
8208 (if gnus-newsgroup-auto-expire
8209 (push number gnus-newsgroup-expirable
)
8210 (push (cons number gnus-low-score-mark
)
8211 gnus-newsgroup-reads
)))
8213 ;; Do the `display' group parameter.
8214 (and gnus-newsgroup-display
8215 (not (funcall gnus-newsgroup-display
)))
8216 ;; Check NoCeM things.
8217 (if (and gnus-use-nocem
8218 (gnus-nocem-unwanted-article-p
8219 (mail-header-id (car thread
))))
8221 (setq gnus-newsgroup-unreads
8222 (delq number gnus-newsgroup-unreads
))
8224 ;; Nope, invisible article.
8226 ;; Ok, this article is to be visible, so we add it to the limit
8228 (push number gnus-newsgroup-limit
)
8231 (defun gnus-expunge-thread (thread)
8232 "Mark all articles in THREAD as read."
8233 (let* ((number (mail-header-number (car thread
))))
8234 (incf gnus-newsgroup-expunged-tally
)
8235 ;; We also mark as read here, if that's wanted.
8236 (setq gnus-newsgroup-unreads
8237 (delq number gnus-newsgroup-unreads
))
8238 (if gnus-newsgroup-auto-expire
8239 (push number gnus-newsgroup-expirable
)
8240 (push (cons number gnus-low-score-mark
)
8241 gnus-newsgroup-reads
)))
8242 ;; Go recursively through all subthreads.
8243 (mapcar 'gnus-expunge-thread
(cdr thread
)))
8245 ;; Summary article oriented commands
8247 (defun gnus-summary-refer-parent-article (n)
8248 "Refer parent article N times.
8249 If N is negative, go to ancestor -N instead.
8250 The difference between N and the number of articles fetched is returned."
8254 (when (not (natnump n
))
8259 (setq header
(gnus-summary-article-header))
8260 (if (and (eq (mail-header-number header
)
8261 (cdr gnus-article-current
))
8262 (equal gnus-newsgroup-name
8263 (car gnus-article-current
)))
8264 ;; If we try to find the parent of the currently
8265 ;; displayed article, then we take a look at the actual
8266 ;; References header, since this is slightly more
8267 ;; reliable than the References field we got from the
8270 (set-buffer gnus-original-article-buffer
)
8271 (nnheader-narrow-to-headers)
8272 (unless (setq ref
(message-fetch-field "references"))
8273 (when (setq ref
(message-fetch-field "in-reply-to"))
8274 (setq ref
(gnus-extract-message-id-from-in-reply-to ref
))))
8277 ;; It's not the current article, so we take a bet on
8278 ;; the value we got from the server.
8279 (mail-header-references header
)))
8281 (not (equal ref
"")))
8282 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
8283 (gnus-message 1 "Couldn't find parent"))
8284 (gnus-message 1 "No references in article %d"
8285 (gnus-summary-article-number))
8288 (gnus-summary-position-point)
8291 (defun gnus-summary-refer-references ()
8292 "Fetch all articles mentioned in the References header.
8293 Return the number of articles fetched."
8295 (let ((ref (mail-header-references (gnus-summary-article-header)))
8296 (current (gnus-summary-article-number))
8300 (error "No References in the current article")
8301 ;; For each Message-ID in the References header...
8302 (while (string-match "<[^>]*>" ref
)
8304 ;; ... fetch that article.
8305 (gnus-summary-refer-article
8306 (prog1 (match-string 0 ref
)
8307 (setq ref
(substring ref
(match-end 0))))))
8308 (gnus-summary-goto-subject current
)
8309 (gnus-summary-position-point)
8312 (defun gnus-summary-refer-thread (&optional limit
)
8313 "Fetch all articles in the current thread.
8314 If LIMIT (the numerical prefix), fetch that many old headers instead
8315 of what's specified by the `gnus-refer-thread-limit' variable."
8317 (let ((id (mail-header-id (gnus-summary-article-header)))
8318 (limit (if limit
(prefix-numeric-value limit
)
8319 gnus-refer-thread-limit
)))
8320 (unless (eq gnus-fetch-old-headers
'invisible
)
8321 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
8322 ;; Retrieve the headers and read them in.
8323 (if (eq (if (numberp limit
)
8324 (gnus-retrieve-headers
8326 (+ (mail-header-number
8327 (gnus-summary-article-header))
8329 gnus-newsgroup-end
))
8330 gnus-newsgroup-name
(* limit
2))
8331 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8333 (gnus-retrieve-headers (list gnus-newsgroup-end
)
8334 gnus-newsgroup-name limit
))
8336 (gnus-build-all-threads)
8337 (error "Can't fetch thread from back ends that don't support NOV"))
8338 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
8339 (gnus-summary-limit-include-thread id
)))
8341 (defun gnus-summary-refer-article (message-id)
8342 "Fetch an article specified by MESSAGE-ID."
8343 (interactive "sMessage-ID: ")
8344 (when (and (stringp message-id
)
8345 (not (zerop (length message-id
))))
8346 (setq message-id
(gnus-replace-in-string message-id
" " ""))
8347 ;; Construct the correct Message-ID if necessary.
8348 ;; Suggested by tale@pawl.rpi.edu.
8349 (unless (string-match "^<" message-id
)
8350 (setq message-id
(concat "<" message-id
)))
8351 (unless (string-match ">$" message-id
)
8352 (setq message-id
(concat message-id
">")))
8353 ;; People often post MIDs from URLs, so unhex it:
8354 (unless (string-match "@" message-id
)
8355 (setq message-id
(gnus-url-unhex-string message-id
)))
8356 (let* ((header (gnus-id-to-header message-id
))
8358 (gnus-summary-article-sparse-p
8359 (mail-header-number header
))
8360 (memq (mail-header-number header
)
8361 gnus-newsgroup-limit
)))
8364 ;; If the article is present in the buffer we just go to it.
8366 (or (not (gnus-summary-article-sparse-p
8367 (mail-header-number header
)))
8370 (gnus-summary-goto-article
8371 (mail-header-number header
) nil t
)
8373 (gnus-summary-update-article (mail-header-number header
)))))
8375 ;; We fetch the article.
8377 (dolist (gnus-override-method (gnus-refer-article-methods))
8378 (when (and (gnus-check-server gnus-override-method
)
8379 ;; Fetch the header,
8380 (setq number
(gnus-summary-insert-subject message-id
)))
8381 ;; and display the article.
8382 (gnus-summary-select-article nil nil nil number
)
8384 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
8386 (defun gnus-refer-article-methods ()
8387 "Return a list of referable methods."
8389 ;; No method, so we default to current and native.
8390 ((null gnus-refer-article-method
)
8391 (list gnus-current-select-method gnus-select-method
))
8393 ((eq 'current gnus-refer-article-method
)
8394 (list gnus-current-select-method
))
8395 ;; List of select methods.
8396 ((not (and (symbolp (car gnus-refer-article-method
))
8397 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
8399 (dolist (method gnus-refer-article-method
)
8400 (push (if (eq 'current method
)
8401 gnus-current-select-method
8405 ;; One single select method.
8407 (list gnus-refer-article-method
))))
8409 (defun gnus-summary-edit-parameters ()
8410 "Edit the group parameters of the current group."
8412 (gnus-group-edit-group gnus-newsgroup-name
'params
))
8414 (defun gnus-summary-customize-parameters ()
8415 "Customize the group parameters of the current group."
8417 (gnus-group-customize gnus-newsgroup-name
))
8419 (defun gnus-summary-enter-digest-group (&optional force
)
8420 "Enter an nndoc group based on the current article.
8421 If FORCE, force a digest interpretation. If not, try
8422 to guess what the document format is."
8424 (let ((conf gnus-current-window-configuration
))
8425 (save-window-excursion
8427 (let (gnus-article-prepare-hook
8428 gnus-display-mime-function
8430 (gnus-summary-select-article))))
8431 (setq gnus-current-window-configuration conf
)
8432 (let* ((name (format "%s-%d"
8433 (gnus-group-prefixed-name
8434 gnus-newsgroup-name
(list 'nndoc
""))
8436 (set-buffer gnus-summary-buffer
)
8437 gnus-current-article
)))
8438 (ogroup gnus-newsgroup-name
)
8439 (params (append (gnus-info-params (gnus-get-info ogroup
))
8440 (list (cons 'to-group ogroup
))
8441 (list (cons 'parent-group ogroup
))
8442 (list (cons 'save-article-group ogroup
))))
8443 (case-fold-search t
)
8444 (buf (current-buffer))
8447 (set-buffer gnus-original-article-buffer
)
8448 ;; Have the digest group inherit the main mail address of
8449 ;; the parent article.
8450 (when (setq to-address
(or (gnus-fetch-field "reply-to")
8451 (gnus-fetch-field "from")))
8452 (setq params
(append
8453 (list (cons 'to-address
8454 (funcall gnus-decode-encoded-word-function
8456 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
8457 (insert-buffer-substring gnus-original-article-buffer
)
8458 ;; Remove lines that may lead nndoc to misinterpret the
8461 (goto-char (point-min))
8462 (or (search-forward "\n\n" nil t
) (point)))
8463 (goto-char (point-min))
8464 (delete-matching-lines "^Path:\\|^From ")
8467 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
8468 (gnus-newsgroup-ephemeral-ignored-charsets
8469 gnus-newsgroup-ignored-charsets
))
8470 (gnus-group-read-ephemeral-group
8471 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
8473 ,(if force
'mbox
'guess
)))
8475 `((adapt-file .
,(gnus-score-file-name gnus-newsgroup-name
8477 ;; Make all postings to this group go to the parent group.
8478 (nconc (gnus-info-params (gnus-get-info name
))
8480 ;; Couldn't select this doc group.
8481 (switch-to-buffer buf
)
8482 (gnus-set-global-variables)
8483 (gnus-configure-windows 'summary
)
8484 (gnus-message 3 "Article couldn't be entered?"))
8485 (kill-buffer dig
)))))
8487 (defun gnus-summary-read-document (n)
8488 "Open a new group based on the current article(s).
8489 This will allow you to read digests and other similar
8490 documents as newsgroups.
8491 Obeys the standard process/prefix convention."
8493 (let* ((articles (gnus-summary-work-articles n
))
8494 (ogroup gnus-newsgroup-name
)
8495 (params (append (gnus-info-params (gnus-get-info ogroup
))
8496 (list (cons 'to-group ogroup
))))
8497 article group egroup groups vgroup
)
8498 (while (setq article
(pop articles
))
8499 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
8500 (gnus-summary-remove-process-mark article
)
8501 (when (gnus-summary-display-article article
)
8504 (insert-buffer-substring gnus-original-article-buffer
)
8505 ;; Remove some headers that may lead nndoc to make
8507 (message-narrow-to-head)
8508 (goto-char (point-min))
8509 (delete-matching-lines "^\\(Path\\):\\|^From ")
8512 (gnus-group-read-ephemeral-group
8513 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
8514 (nndoc-article-type guess
))
8517 ;; Make all postings to this group go to the parent group.
8518 (nconc (gnus-info-params (gnus-get-info egroup
))
8520 (push egroup groups
))
8521 ;; Couldn't select this doc group.
8522 (gnus-error 3 "Article couldn't be entered"))))))
8523 ;; Now we have selected all the documents.
8526 (error "None of the articles could be interpreted as documents"))
8527 ((gnus-group-read-ephemeral-group
8528 (setq vgroup
(format
8529 "nnvirtual:%s-%s" gnus-newsgroup-name
8530 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8531 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
8533 (cons (current-buffer) 'summary
)))
8535 (error "Couldn't select virtual nndoc group")))))
8537 (defun gnus-summary-isearch-article (&optional regexp-p
)
8538 "Do incremental search forward on the current article.
8539 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8541 (gnus-summary-select-article)
8542 (gnus-configure-windows 'article
)
8543 (gnus-eval-in-buffer-window gnus-article-buffer
8546 (isearch-forward regexp-p
))))
8548 (defun gnus-summary-search-article-forward (regexp &optional backward
)
8549 "Search for an article containing REGEXP forward.
8550 If BACKWARD, search backward instead."
8553 (format "Search article %s (regexp%s): "
8554 (if current-prefix-arg
"backward" "forward")
8555 (if gnus-last-search-regexp
8556 (concat ", default " gnus-last-search-regexp
)
8558 current-prefix-arg
))
8559 (if (string-equal regexp
"")
8560 (setq regexp
(or gnus-last-search-regexp
""))
8561 (setq gnus-last-search-regexp regexp
)
8562 (setq gnus-article-before-search gnus-current-article
))
8563 ;; Intentionally set gnus-last-article.
8564 (setq gnus-last-article gnus-article-before-search
)
8565 (let ((gnus-last-article gnus-last-article
))
8566 (if (gnus-summary-search-article regexp backward
)
8567 (gnus-summary-show-thread)
8568 (signal 'search-failed
(list regexp
)))))
8570 (defun gnus-summary-search-article-backward (regexp)
8571 "Search for an article containing REGEXP backward."
8574 (format "Search article backward (regexp%s): "
8575 (if gnus-last-search-regexp
8576 (concat ", default " gnus-last-search-regexp
)
8578 (gnus-summary-search-article-forward regexp
'backward
))
8580 (defun gnus-summary-search-article (regexp &optional backward
)
8581 "Search for an article containing REGEXP.
8582 Optional argument BACKWARD means do search for backward.
8583 `gnus-select-article-hook' is not called during the search."
8584 ;; We have to require this here to make sure that the following
8585 ;; dynamic binding isn't shadowed by autoloading.
8586 (require 'gnus-async
)
8588 (let ((gnus-select-article-hook nil
) ;Disable hook.
8589 (gnus-article-prepare-hook nil
)
8590 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
8591 (gnus-use-article-prefetch nil
)
8592 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
8593 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
8595 (gnus-keep-backlog nil
)
8596 (gnus-break-pages nil
)
8597 (gnus-summary-display-arrow nil
)
8598 (gnus-updated-mode-lines nil
)
8599 (gnus-auto-center-summary nil
)
8600 (sum (current-buffer))
8601 (gnus-display-mime-function nil
)
8604 (gnus-save-hidden-threads
8605 (gnus-summary-select-article)
8606 (set-buffer gnus-article-buffer
)
8607 (goto-char (window-point (get-buffer-window (current-buffer))))
8611 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
8613 (re-search-backward regexp nil t
)
8614 (re-search-forward regexp nil t
))
8615 ;; We found the regexp.
8620 (get-buffer-window (current-buffer))
8624 (get-buffer-window (current-buffer))
8627 (setq point
(point)))
8628 ;; We didn't find it, so we go to the next article.
8631 (while (eq found
'not
)
8632 (if (not (if backward
(gnus-summary-find-prev)
8633 (gnus-summary-find-next)))
8634 ;; No more articles.
8636 ;; Select the next article and adjust point.
8637 (unless (gnus-summary-article-sparse-p
8638 (gnus-summary-article-number))
8640 (gnus-summary-select-article)
8641 (set-buffer gnus-article-buffer
)
8643 (goto-char (if backward
(point-max) (point-min))))))))
8644 (gnus-message 7 ""))
8645 ;; Return whether we found the regexp.
8646 (when (eq found
'found
)
8648 (gnus-summary-show-thread)
8649 (gnus-summary-goto-subject gnus-current-article
)
8650 (gnus-summary-position-point)
8653 (defun gnus-find-matching-articles (header regexp
)
8654 "Return a list of all articles that match REGEXP on HEADER.
8655 This search includes all articles in the current group that Gnus has
8656 fetched headers for, whether they are displayed or not."
8657 (let ((articles nil
)
8658 (func `(lambda (h) (,(intern (concat "mail-header-" header
)) h
)))
8659 (case-fold-search t
))
8660 (dolist (header gnus-newsgroup-headers
)
8661 (when (string-match regexp
(funcall func header
))
8662 (push (mail-header-number header
) articles
)))
8663 (nreverse articles
)))
8665 (defun gnus-summary-find-matching (header regexp
&optional backward unread
8666 not-case-fold not-matching
)
8667 "Return a list of all articles that match REGEXP on HEADER.
8668 The search stars on the current article and goes forwards unless
8669 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8670 If UNREAD is non-nil, only unread articles will
8671 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8672 in the comparisons. If NOT-MATCHING, return a list of all articles that
8673 not match REGEXP on HEADER."
8674 (let ((case-fold-search (not not-case-fold
))
8677 (if (eq (car header
) 'extra
)
8680 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
8682 (error "%s is an invalid header" header
))
8683 (unless (fboundp (intern (concat "mail-header-" header
)))
8684 (error "%s is not a valid header" header
))
8685 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
8686 (dolist (d (if (eq backward
'all
)
8688 (gnus-data-find-list
8689 (gnus-summary-article-number)
8690 (gnus-data-list backward
))))
8691 (when (and (or (not unread
) ; We want all articles...
8692 (gnus-data-unread-p d
)) ; Or just unreads.
8693 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
8697 (funcall func
(gnus-data-header d
))))
8698 (string-match regexp
8699 (funcall func
(gnus-data-header d
)))))
8700 (push (gnus-data-number d
) articles
))) ; Success!
8701 (nreverse articles
)))
8703 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
8704 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8705 If HEADER is an empty string (or nil), the match is done on the entire
8706 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8708 (list (let ((completion-ignore-case t
))
8711 (mapcar (lambda (header) (list (format "%s" header
)))
8713 '("Number" "Subject" "From" "Lines" "Date"
8714 "Message-ID" "Xref" "References" "Body")
8715 gnus-extra-headers
))
8716 nil
'require-match
))
8717 (read-string "Regexp: ")
8718 (read-key-sequence "Command: ")
8719 current-prefix-arg
))
8720 (when (equal header
"Body")
8722 ;; Hidden thread subtrees must be searched as well.
8723 (gnus-summary-show-all-threads)
8724 ;; We don't want to change current point nor window configuration.
8726 (save-window-excursion
8728 gnus-treat-strip-trailing-blank-lines
8729 gnus-treat-strip-leading-blank-lines
8730 gnus-treat-strip-multiple-blank-lines
8731 gnus-treat-hide-boring-headers
8732 gnus-treat-fold-newsgroups
8733 gnus-article-prepare-hook
)
8734 (gnus-message 6 "Executing %s..." (key-description command
))
8735 ;; We'd like to execute COMMAND interactively so as to give arguments.
8736 (gnus-execute header regexp
8737 `(call-interactively ',(key-binding command
))
8739 (gnus-message 6 "Executing %s...done" (key-description command
))))))
8741 (defun gnus-summary-beginning-of-article ()
8742 "Scroll the article back to the beginning."
8744 (gnus-summary-select-article)
8745 (gnus-configure-windows 'article
)
8746 (gnus-eval-in-buffer-window gnus-article-buffer
8748 (goto-char (point-min))
8749 (when gnus-break-pages
8750 (gnus-narrow-to-page))))
8752 (defun gnus-summary-end-of-article ()
8753 "Scroll to the end of the article."
8755 (gnus-summary-select-article)
8756 (gnus-configure-windows 'article
)
8757 (gnus-eval-in-buffer-window gnus-article-buffer
8759 (goto-char (point-max))
8761 (when gnus-break-pages
8762 (when (re-search-backward page-delimiter nil t
)
8763 (narrow-to-region (match-end 0) (point-max)))
8764 (gnus-narrow-to-page))))
8766 (defun gnus-summary-print-truncate-and-quote (string &optional len
)
8767 "Truncate to LEN and quote all \"(\"'s in STRING."
8768 (gnus-replace-in-string (if (and len
(> (length string
) len
))
8769 (substring string
0 len
)
8773 (defun gnus-summary-print-article (&optional filename n
)
8774 "Generate and print a PostScript image of the process-marked (mail) articles.
8776 If used interactively, print the current article if none are
8777 process-marked. With prefix arg, prompt the user for the name of the
8780 When used from Lisp, accept two optional args FILENAME and N. N means
8781 to print the next N articles. If N is negative, print the N previous
8782 articles. If N is nil and articles have been marked with the process
8783 mark, print these instead.
8785 If the optional first argument FILENAME is nil, send the image to the
8786 printer. If FILENAME is a string, save the PostScript image in a file with
8787 that name. If FILENAME is a number, prompt the user for the name of the file
8789 (interactive (list (ps-print-preprint current-prefix-arg
)))
8790 (dolist (article (gnus-summary-work-articles n
))
8791 (gnus-summary-select-article nil nil
'pseudo article
)
8792 (gnus-eval-in-buffer-window gnus-article-buffer
8793 (gnus-print-buffer))
8794 (gnus-summary-remove-process-mark article
))
8795 (ps-despool filename
))
8797 (defun gnus-print-buffer ()
8798 (let ((buffer (generate-new-buffer " *print*")))
8801 (copy-to-buffer buffer
(point-min) (point-max))
8803 (gnus-remove-text-with-property 'gnus-decoration
)
8804 (when (gnus-visual-p 'article-highlight
'highlight
)
8805 ;; Copy-to-buffer doesn't copy overlay. So redo
8807 (let ((gnus-article-buffer buffer
))
8808 (gnus-article-highlight-citation t
)
8809 (gnus-article-highlight-signature)
8810 (gnus-article-emphasize)
8811 (gnus-article-delete-invisible-text)))
8812 (let ((ps-left-header
8815 (gnus-summary-print-truncate-and-quote
8816 (mail-header-subject gnus-current-headers
)
8819 (gnus-summary-print-truncate-and-quote
8820 (mail-header-from gnus-current-headers
)
8824 "/pagenumberstring load"
8826 (mail-header-date gnus-current-headers
) ")"))))
8827 (gnus-run-hooks 'gnus-ps-print-hook
)
8830 (ps-spool-buffer-with-faces)
8831 (ps-spool-buffer)))))
8832 (kill-buffer buffer
))))
8834 (defun gnus-summary-show-article (&optional arg
)
8835 "Force redisplaying of the current article.
8836 If ARG (the prefix) is a number, show the article with the charset
8837 defined in `gnus-summary-show-article-charset-alist', or the charset
8839 If ARG (the prefix) is non-nil and not a number, show the raw article
8840 without any article massaging functions being run. Normally, the key
8841 strokes are `C-u g'."
8845 (gnus-summary-show-article t
)
8846 (let ((gnus-newsgroup-charset
8847 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
8848 (mm-read-coding-system
8849 "View as charset: " ;; actually it is coding system.
8851 (set-buffer gnus-article-buffer
)
8852 (mm-detect-coding-region (point) (point-max))))))
8853 (gnus-newsgroup-ignored-charsets 'gnus-all
))
8854 (gnus-summary-select-article nil
'force
)
8855 (let ((deps gnus-newsgroup-dependencies
)
8858 (set-buffer gnus-original-article-buffer
)
8860 (message-narrow-to-head)
8861 (setq head
(buffer-string))
8862 (goto-char (point-min))
8863 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t
)
8864 (goto-char (point-max))
8866 (setq lines
(1- (count-lines (point) (point-max))))))
8868 (insert (format "211 %d Article retrieved.\n"
8869 (cdr gnus-article-current
)))
8871 (if lines
(insert (format "Lines: %d\n" lines
)))
8873 (let ((nntp-server-buffer (current-buffer)))
8874 (setq header
(car (gnus-get-newsgroup-headers deps t
))))))
8875 (gnus-data-set-header
8876 (gnus-data-find (cdr gnus-article-current
))
8878 (gnus-summary-update-article-line
8879 (cdr gnus-article-current
) header
)
8880 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
8881 (gnus-summary-update-secondary-mark (cdr gnus-article-current
))))))
8883 ;; Select the article the normal way.
8884 (gnus-summary-select-article nil
'force
))
8886 ;; We have to require this here to make sure that the following
8887 ;; dynamic binding isn't shadowed by autoloading.
8888 (require 'gnus-async
)
8890 ;; Bind the article treatment functions to nil.
8891 (let ((gnus-have-all-headers t
)
8892 gnus-article-prepare-hook
8893 gnus-article-decode-hook
8894 gnus-display-mime-function
8896 ;; Destroy any MIME parts.
8897 (when (gnus-buffer-live-p gnus-article-buffer
)
8899 (set-buffer gnus-article-buffer
)
8900 (mm-destroy-parts gnus-article-mime-handles
)
8901 ;; Set it to nil for safety reason.
8902 (setq gnus-article-mime-handle-alist nil
)
8903 (setq gnus-article-mime-handles nil
)))
8904 (gnus-summary-select-article nil
'force
))))
8905 (gnus-summary-goto-subject gnus-current-article
)
8906 (gnus-summary-position-point))
8908 (defun gnus-summary-show-raw-article ()
8909 "Show the raw article without any article massaging functions being run."
8911 (gnus-summary-show-article t
))
8913 (defun gnus-summary-verbose-headers (&optional arg
)
8914 "Toggle permanent full header display.
8915 If ARG is a positive number, turn header display on.
8916 If ARG is a negative number, turn header display off."
8918 (setq gnus-show-all-headers
8919 (cond ((or (not (numberp arg
))
8921 (not gnus-show-all-headers
))
8924 (gnus-summary-show-article))
8926 (defun gnus-summary-toggle-header (&optional arg
)
8927 "Show the headers if they are hidden, or hide them if they are shown.
8928 If ARG is a positive number, show the entire header.
8929 If ARG is a negative number, hide the unwanted header lines."
8931 (let ((window (and (gnus-buffer-live-p gnus-article-buffer
)
8932 (get-buffer-window gnus-article-buffer t
))))
8933 (with-current-buffer gnus-article-buffer
8935 (article-narrow-to-head)
8936 (let* ((buffer-read-only nil
)
8937 (inhibit-point-motion-hooks t
)
8938 (hidden (if (numberp arg
)
8940 (or (not (looking-at "[^ \t\n]+:"))
8941 (gnus-article-hidden-text-p 'headers
))))
8943 (delete-region (point-min) (point-max))
8944 (with-current-buffer gnus-original-article-buffer
8945 (goto-char (setq s
(point-min)))
8946 (setq e
(if (search-forward "\n\n" nil t
)
8949 (insert-buffer-substring gnus-original-article-buffer s e
)
8950 (run-hooks 'gnus-article-decode-hook
)
8952 (let ((gnus-treat-hide-headers nil
)
8953 (gnus-treat-hide-boring-headers nil
))
8954 (gnus-delete-wash-type 'headers
)
8955 (gnus-treat-article 'head
))
8956 (gnus-treat-article 'head
))
8959 (set-window-start window
(goto-char (point-min))))
8960 (if gnus-break-pages
8961 (gnus-narrow-to-page)
8962 (when (gnus-visual-p 'page-marker
)
8963 (let ((buffer-read-only nil
))
8964 (gnus-remove-text-with-property 'gnus-prev
)
8965 (gnus-remove-text-with-property 'gnus-next
))))
8966 (gnus-set-mode-line 'article
)))))
8968 (defun gnus-summary-show-all-headers ()
8969 "Make all header lines visible."
8971 (gnus-summary-toggle-header 1))
8973 (defun gnus-summary-caesar-message (&optional arg
)
8974 "Caesar rotate the current article by 13.
8975 The numerical prefix specifies how many places to rotate each letter
8978 (gnus-summary-select-article)
8979 (let ((mail-header-separator ""))
8980 (gnus-eval-in-buffer-window gnus-article-buffer
8983 (let ((start (window-start))
8985 (message-caesar-buffer-body arg
)
8986 (set-window-start (get-buffer-window (current-buffer)) start
)))))
8987 ;; Create buttons and stuff...
8988 (gnus-treat-article nil
))
8990 (autoload 'unmorse-region
"morse"
8991 "Convert morse coded text in region to ordinary ASCII text."
8994 (defun gnus-summary-morse-message (&optional arg
)
8995 "Morse decode the current article."
8997 (gnus-summary-select-article)
8998 (let ((mail-header-separator ""))
8999 (gnus-eval-in-buffer-window gnus-article-buffer
9003 (let ((pos (window-start))
9005 (goto-char (point-min))
9006 (when (message-goto-body)
9007 (gnus-narrow-to-body))
9008 (goto-char (point-min))
9009 (while (re-search-forward "·" (point-max) t
)
9010 (replace-match "."))
9011 (unmorse-region (point-min) (point-max))
9013 (set-window-start (get-buffer-window (current-buffer)) pos
)))))))
9015 (defun gnus-summary-stop-page-breaking ()
9016 "Stop page breaking in the current article."
9018 (gnus-summary-select-article)
9019 (gnus-eval-in-buffer-window gnus-article-buffer
9021 (when (gnus-visual-p 'page-marker
)
9022 (let ((buffer-read-only nil
))
9023 (gnus-remove-text-with-property 'gnus-prev
)
9024 (gnus-remove-text-with-property 'gnus-next
))
9025 (setq gnus-page-broken nil
))))
9027 (defun gnus-summary-move-article (&optional n to-newsgroup
9028 select-method action
)
9029 "Move the current article to a different newsgroup.
9030 If N is a positive number, move the N next articles.
9031 If N is a negative number, move the N previous articles.
9032 If N is nil and any articles have been marked with the process mark,
9033 move those articles instead.
9034 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9035 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9036 re-spool using this method.
9038 When called interactively with TO-NEWSGROUP being nil, the value of
9039 the variable `gnus-move-split-methods' is used for finding a default
9040 for the target newsgroup.
9042 For this function to work, both the current newsgroup and the
9043 newsgroup that you want to move to have to support the `request-move'
9044 and `request-accept' functions.
9046 ACTION can be either `move' (the default), `crosspost' or `copy'."
9049 (setq action
'move
))
9050 ;; Check whether the source group supports the required functions.
9051 (cond ((and (eq action
'move
)
9052 (not (gnus-check-backend-function
9053 'request-move-article gnus-newsgroup-name
)))
9054 (error "The current group does not support article moving"))
9055 ((and (eq action
'crosspost
)
9056 (not (gnus-check-backend-function
9057 'request-replace-article gnus-newsgroup-name
)))
9058 (error "The current group does not support article editing")))
9059 (let ((articles (gnus-summary-work-articles n
))
9060 (prefix (if (gnus-check-backend-function
9061 'request-move-article gnus-newsgroup-name
)
9062 (gnus-group-real-prefix gnus-newsgroup-name
)
9064 (names '((move "Move" "Moving")
9065 (copy "Copy" "Copying")
9066 (crosspost "Crosspost" "Crossposting")))
9067 (copy-buf (save-excursion
9068 (nnheader-set-temp-buffer " *copy article*")))
9069 art-group to-method new-xref article to-groups
)
9070 (unless (assq action names
)
9071 (error "Unknown action %s" action
))
9072 ;; Read the newsgroup name.
9073 (when (and (not to-newsgroup
)
9074 (not select-method
))
9075 (if (and gnus-move-split-methods
9077 (and (memq gnus-current-article articles
)
9078 (gnus-buffer-live-p gnus-original-article-buffer
))))
9079 ;; When `gnus-move-split-methods' is non-nil, we have to
9080 ;; select an article to give `gnus-read-move-group-name' an
9081 ;; opportunity to suggest an appropriate default. However,
9082 ;; we needn't render or mark the article.
9083 (let ((gnus-display-mime-function nil
)
9084 (gnus-article-prepare-hook nil
)
9085 (gnus-mark-article-hook nil
))
9086 (gnus-summary-select-article nil nil nil
(car articles
))))
9088 (gnus-read-move-group-name
9089 (cadr (assq action names
))
9090 (symbol-value (intern (format "gnus-current-%s-group" action
)))
9092 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
9093 (setq to-method
(or select-method
9094 (gnus-server-to-method
9095 (gnus-group-method to-newsgroup
))))
9096 ;; Check the method we are to move this article to...
9097 (unless (gnus-check-backend-function
9098 'request-accept-article
(car to-method
))
9099 (error "%s does not support article copying" (car to-method
)))
9100 (unless (gnus-check-server to-method
)
9101 (error "Can't open server %s" (car to-method
)))
9102 (gnus-message 6 "%s to %s: %s..."
9103 (caddr (assq action names
))
9104 (or (car select-method
) to-newsgroup
) articles
)
9106 (setq article
(pop articles
))
9110 ;; Move the article.
9112 ;; Remove this article from future suppression.
9113 (gnus-dup-unsuppress-article article
)
9114 (gnus-request-move-article
9115 article
; Article to move
9116 gnus-newsgroup-name
; From newsgroup
9117 (nth 1 (gnus-find-method-for-group
9118 gnus-newsgroup-name
)) ; Server
9119 (list 'gnus-request-accept-article
9120 to-newsgroup
(list 'quote select-method
)
9121 (not articles
) t
) ; Accept form
9122 (not articles
))) ; Only save nov last time
9123 ;; Copy the article.
9126 (set-buffer copy-buf
)
9127 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9128 (gnus-request-accept-article
9129 to-newsgroup select-method
(not articles
) t
))))
9130 ;; Crosspost the article.
9131 ((eq action
'crosspost
)
9132 (let ((xref (message-tokenize-header
9133 (mail-header-xref (gnus-summary-article-header article
))
9135 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
9136 ":" (number-to-string article
)))
9138 (setq xref
(list (system-name))))
9141 (mapconcat 'identity
9142 (delete "Xref:" (delete new-xref xref
))
9146 (set-buffer copy-buf
)
9147 ;; First put the article in the destination group.
9148 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9149 (when (consp (setq art-group
9150 (gnus-request-accept-article
9151 to-newsgroup select-method
(not articles
))))
9152 (setq new-xref
(concat new-xref
" " (car art-group
)
9154 (number-to-string (cdr art-group
))))
9155 ;; Now we have the new Xrefs header, so we insert
9156 ;; it and replace the new article.
9157 (nnheader-replace-header "Xref" new-xref
)
9158 (gnus-request-replace-article
9159 (cdr art-group
) to-newsgroup
(current-buffer))
9163 (gnus-message 1 "Couldn't %s article %s: %s"
9164 (cadr (assq action names
)) article
9165 (nnheader-get-report (car to-method
))))
9166 ((eq art-group
'junk
)
9167 (when (eq action
'move
)
9168 (gnus-summary-mark-article article gnus-canceled-mark
)
9169 (gnus-message 4 "Deleted article %s" article
)
9170 ;; run the delete hook
9171 (run-hook-with-args 'gnus-summary-article-delete-hook
9174 (assoc article
(gnus-data-list nil
)))
9175 gnus-newsgroup-name nil
9178 (let* ((pto-group (gnus-group-prefixed-name
9179 (car art-group
) to-method
))
9181 (gnus-gethash pto-group gnus-newsrc-hashtb
))
9182 (info (nth 2 entry
))
9183 (to-group (gnus-info-group info
))
9185 ;; Update the group that has been moved to.
9187 (memq action
'(move copy
)))
9188 (unless (member to-group to-groups
)
9189 (push to-group to-groups
))
9191 (unless (memq article gnus-newsgroup-unreads
)
9192 (push 'read to-marks
)
9194 info
(gnus-add-to-range (gnus-info-read info
)
9195 (list (cdr art-group
)))))
9197 ;; See whether the article is to be put in the cache.
9198 (let ((marks (if (gnus-group-auto-expirable-p to-group
)
9199 gnus-article-mark-lists
9200 (delete '(expirable . expire
)
9201 (copy-sequence gnus-article-mark-lists
))))
9202 (to-article (cdr art-group
)))
9204 ;; Enter the article into the cache in the new group,
9205 ;; if that is required.
9206 (when gnus-use-cache
9207 (gnus-cache-possibly-enter-article
9209 (memq article gnus-newsgroup-marked
)
9210 (memq article gnus-newsgroup-dormant
)
9211 (memq article gnus-newsgroup-unreads
)))
9213 (when gnus-preserve-marks
9214 ;; Copy any marks over to the new group.
9215 (when (and (equal to-group gnus-newsgroup-name
)
9216 (not (memq article gnus-newsgroup-unreads
)))
9217 ;; Mark this article as read in this group.
9218 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
9219 (setcdr (gnus-active to-group
) to-article
)
9220 (setcdr gnus-newsgroup-active to-article
))
9223 (when (eq (gnus-article-mark-to-type (cdar marks
)) 'list
)
9224 (when (memq article
(symbol-value
9225 (intern (format "gnus-newsgroup-%s"
9227 (push (cdar marks
) to-marks
)
9228 ;; If the other group is the same as this group,
9229 ;; then we have to add the mark to the list.
9230 (when (equal to-group gnus-newsgroup-name
)
9231 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
9234 (intern (format "gnus-newsgroup-%s"
9236 ;; Copy the marks to other group.
9237 (gnus-add-marked-articles
9238 to-group
(cdar marks
) (list to-article
) info
)))
9239 (setq marks
(cdr marks
)))
9241 (gnus-request-set-mark
9242 to-group
(list (list (list to-article
) 'add to-marks
))))
9245 (concat "(gnus-group-set-info '"
9246 (gnus-prin1-to-string (gnus-get-info to-group
))
9249 ;; Update the Xref header in this article to point to
9250 ;; the new crossposted article we have just created.
9251 (when (eq action
'crosspost
)
9253 (set-buffer copy-buf
)
9254 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9255 (nnheader-replace-header "Xref" new-xref
)
9256 (gnus-request-replace-article
9257 article gnus-newsgroup-name
(current-buffer))))
9259 ;; run the move/copy/crosspost/respool hook
9260 (run-hook-with-args 'gnus-summary-article-move-hook
9263 (assoc article
(gnus-data-list nil
)))
9268 ;;;!!!Why is this necessary?
9269 (set-buffer gnus-summary-buffer
)
9271 (gnus-summary-goto-subject article
)
9272 (when (eq action
'move
)
9273 (gnus-summary-mark-article article gnus-canceled-mark
))))
9274 (gnus-summary-remove-process-mark article
))
9275 ;; Re-activate all groups that have been moved to.
9277 (set-buffer gnus-group-buffer
)
9278 (let ((gnus-group-marked to-groups
))
9279 (gnus-group-get-new-news-this-group nil t
)))
9281 (gnus-kill-buffer copy-buf
)
9282 (gnus-summary-position-point)
9283 (gnus-set-mode-line 'summary
)))
9285 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
9286 "Copy the current article to some other group.
9287 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9288 When called interactively, if TO-NEWSGROUP is nil, use the value of
9289 the variable `gnus-move-split-methods' for finding a default target
9291 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9292 re-spool using this method."
9294 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
9296 (defun gnus-summary-crosspost-article (&optional n
)
9297 "Crosspost the current article to some other group."
9299 (gnus-summary-move-article n nil nil
'crosspost
))
9301 (defcustom gnus-summary-respool-default-method nil
9302 "Default method type for respooling an article.
9303 If nil, use to the current newsgroup method."
9305 :group
'gnus-summary-mail
)
9307 (defcustom gnus-summary-display-while-building nil
9308 "If non-nil, show and update the summary buffer as it's being built.
9309 If the value is t, update the buffer after every line is inserted. If
9310 the value is an integer (N), update the display every N lines."
9313 :type
'(choice (const :tag
"off" nil
)
9315 (const :tag
"frequently" t
)))
9317 (defun gnus-summary-respool-article (&optional n method
)
9318 "Respool the current article.
9319 The article will be squeezed through the mail spooling process again,
9320 which means that it will be put in some mail newsgroup or other
9321 depending on `nnmail-split-methods'.
9322 If N is a positive number, respool the N next articles.
9323 If N is a negative number, respool the N previous articles.
9324 If N is nil and any articles have been marked with the process mark,
9325 respool those articles instead.
9327 Respooling can be done both from mail groups and \"real\" newsgroups.
9328 In the former case, the articles in question will be moved from the
9329 current group into whatever groups they are destined to. In the
9330 latter case, they will be copied into the relevant groups."
9332 (list current-prefix-arg
9333 (let* ((methods (gnus-methods-using 'respool
))
9335 (symbol-name (or gnus-summary-respool-default-method
9336 (car (gnus-find-method-for-group
9337 gnus-newsgroup-name
)))))
9339 (gnus-completing-read-with-default
9340 methname
"Backend to use when respooling"
9341 methods nil t nil
'gnus-mail-method-history
))
9344 ((zerop (length (setq ms
(gnus-servers-using-backend
9346 (list (intern method
) ""))
9350 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
9351 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
9354 (error "No method given for respooling"))
9355 (if (assoc (symbol-name
9356 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
9357 (gnus-methods-using 'respool
))
9358 (gnus-summary-move-article n nil method
)
9359 (gnus-summary-copy-article n nil method
)))
9361 (defun gnus-summary-import-article (file &optional edit
)
9362 "Import an arbitrary file into a mail newsgroup."
9363 (interactive "fImport file: \nP")
9364 (let ((group gnus-newsgroup-name
)
9365 (now (current-time))
9366 atts lines group-art
)
9367 (unless (gnus-check-backend-function 'request-accept-article group
)
9368 (error "%s does not support article importing" group
))
9369 (or (file-readable-p file
)
9370 (not (file-regular-p file
))
9371 (error "Can't read %s" file
))
9373 (set-buffer (gnus-get-buffer-create " *import file*"))
9375 (nnheader-insert-file-contents file
)
9376 (goto-char (point-min))
9377 (if (nnheader-article-p)
9379 (goto-char (point-min))
9380 (search-forward "\n\n" nil t
)
9381 (narrow-to-region (point-min) (1- (point)))
9382 (goto-char (point-min))
9383 (unless (re-search-forward "^date:" nil t
)
9384 (goto-char (point-max))
9385 (insert "Date: " (message-make-date (nth 5 atts
)) "\n")))
9386 ;; This doesn't look like an article, so we fudge some headers.
9387 (setq atts
(file-attributes file
)
9388 lines
(count-lines (point-min) (point-max)))
9389 (insert "From: " (read-string "From: ") "\n"
9390 "Subject: " (read-string "Subject: ") "\n"
9391 "Date: " (message-make-date (nth 5 atts
)) "\n"
9392 "Message-ID: " (message-make-message-id) "\n"
9393 "Lines: " (int-to-string lines
) "\n"
9394 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9395 (setq group-art
(gnus-request-accept-article group nil t
))
9396 (kill-buffer (current-buffer)))
9397 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9399 (gnus-summary-goto-article (cdr group-art
) nil t
)
9401 (gnus-summary-edit-article))))
9403 (defun gnus-summary-create-article ()
9404 "Create an article in a mail newsgroup."
9406 (let ((group gnus-newsgroup-name
)
9407 (now (current-time))
9409 (unless (gnus-check-backend-function 'request-accept-article group
)
9410 (error "%s does not support article importing" group
))
9412 (set-buffer (gnus-get-buffer-create " *import file*"))
9414 (goto-char (point-min))
9415 ;; This doesn't look like an article, so we fudge some headers.
9416 (insert "From: " (read-string "From: ") "\n"
9417 "Subject: " (read-string "Subject: ") "\n"
9418 "Date: " (message-make-date now
) "\n"
9419 "Message-ID: " (message-make-message-id) "\n")
9420 (setq group-art
(gnus-request-accept-article group nil t
))
9421 (kill-buffer (current-buffer)))
9422 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9424 (gnus-summary-goto-article (cdr group-art
) nil t
)
9425 (gnus-summary-edit-article)))
9427 (defun gnus-summary-article-posted-p ()
9428 "Say whether the current (mail) article is available from news as well.
9429 This will be the case if the article has both been mailed and posted."
9431 (let ((id (mail-header-references (gnus-summary-article-header)))
9432 (gnus-override-method (car (gnus-refer-article-methods))))
9433 (if (gnus-request-head id
"")
9434 (gnus-message 2 "The current message was found on %s"
9435 gnus-override-method
)
9436 (gnus-message 2 "The current message couldn't be found on %s"
9437 gnus-override-method
)
9440 (defun gnus-summary-expire-articles (&optional now
)
9441 "Expire all articles that are marked as expirable in the current group."
9443 (when (and (not gnus-group-is-exiting-without-update-p
)
9444 (gnus-check-backend-function
9445 'request-expire-articles gnus-newsgroup-name
))
9446 ;; This backend supports expiry.
9447 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
9448 (expirable (if total
9450 ;; We need to update the info for
9451 ;; this group for `gnus-list-of-read-articles'
9452 ;; to give us the right answer.
9453 (gnus-run-hooks 'gnus-exit-group-hook
)
9454 (gnus-summary-update-info)
9455 (gnus-list-of-read-articles gnus-newsgroup-name
))
9456 (setq gnus-newsgroup-expirable
9457 (sort gnus-newsgroup-expirable
'<))))
9458 (expiry-wait (if now
'immediate
9459 (gnus-group-find-parameter
9460 gnus-newsgroup-name
'expiry-wait
)))
9461 (nnmail-expiry-target
9462 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
9463 nnmail-expiry-target
))
9466 ;; There are expirable articles in this group, so we run them
9467 ;; through the expiry process.
9468 (gnus-message 6 "Expiring articles...")
9469 (unless (gnus-check-group gnus-newsgroup-name
)
9470 (error "Can't open server for %s" gnus-newsgroup-name
))
9471 ;; The list of articles that weren't expired is returned.
9474 (let ((nnmail-expiry-wait-function nil
)
9475 (nnmail-expiry-wait expiry-wait
))
9476 (setq es
(gnus-request-expire-articles
9477 expirable gnus-newsgroup-name
)))
9478 (setq es
(gnus-request-expire-articles
9479 expirable gnus-newsgroup-name
)))
9481 (setq gnus-newsgroup-expirable es
))
9482 ;; We go through the old list of expirable, and mark all
9483 ;; really expired articles as nonexistent.
9484 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
9485 (let ((gnus-use-cache nil
))
9486 (dolist (article expirable
)
9487 (when (and (not (memq article es
))
9488 (gnus-data-find article
))
9489 (gnus-summary-mark-article article gnus-canceled-mark
)
9490 (run-hook-with-args 'gnus-summary-article-expire-hook
9493 (assoc article
(gnus-data-list nil
)))
9497 (gnus-message 6 "Expiring articles...done")))))
9499 (defun gnus-summary-expire-articles-now ()
9500 "Expunge all expirable articles in the current group.
9501 This means that *all* articles that are marked as expirable will be
9502 deleted forever, right now."
9504 (or gnus-expert-user
9506 "Are you really, really sure you want to delete all expirable messages? ")
9508 (gnus-summary-expire-articles t
))
9510 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9511 (defun gnus-summary-delete-article (&optional n
)
9512 "Delete the N next (mail) articles.
9513 This command actually deletes articles. This is not a marking
9514 command. The article will disappear forever from your life, never to
9517 If N is negative, delete backwards.
9518 If N is nil and articles have been marked with the process mark,
9519 delete these instead.
9521 If `gnus-novice-user' is non-nil you will be asked for
9522 confirmation before the articles are deleted."
9524 (unless (gnus-check-backend-function 'request-expire-articles
9525 gnus-newsgroup-name
)
9526 (error "The current newsgroup does not support article deletion"))
9527 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
9528 (error "Couldn't open server"))
9529 ;; Compute the list of articles to delete.
9530 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
9531 (nnmail-expiry-target 'delete
)
9533 (if (and gnus-novice-user
9534 (not (gnus-yes-or-no-p
9535 (format "Do you really want to delete %s forever? "
9536 (if (> (length articles
) 1)
9537 (format "these %s articles" (length articles
))
9540 ;; Delete the articles.
9541 (setq not-deleted
(gnus-request-expire-articles
9542 articles gnus-newsgroup-name
'force
))
9544 (gnus-summary-remove-process-mark (car articles
))
9545 ;; The backend might not have been able to delete the article
9547 (unless (memq (car articles
) not-deleted
)
9548 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
9549 (let* ((article (car articles
))
9550 (id (mail-header-id (gnus-data-header
9551 (assoc article
(gnus-data-list nil
))))))
9552 (run-hook-with-args 'gnus-summary-article-delete-hook
9553 'delete id gnus-newsgroup-name nil
9555 (setq articles
(cdr articles
)))
9557 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
9558 (gnus-summary-position-point)
9559 (gnus-set-mode-line 'summary
)
9562 (defun gnus-summary-edit-article (&optional arg
)
9563 "Edit the current article.
9564 This will have permanent effect only in mail groups.
9565 If ARG is nil, edit the decoded articles.
9566 If ARG is 1, edit the raw articles.
9567 If ARG is 2, edit the raw articles even in read-only groups.
9568 If ARG is 3, edit the articles with the current handles.
9569 Otherwise, allow editing of articles even in read-only
9572 (let (force raw current-handles
)
9581 (setq current-handles
9582 (and (gnus-buffer-live-p gnus-article-buffer
)
9583 (with-current-buffer gnus-article-buffer
9585 gnus-article-mime-handles
9586 (setq gnus-article-mime-handles nil
))))))
9589 (when (and raw
(not force
)
9590 (member gnus-newsgroup-name
'("nndraft:delayed"
9593 (error "Can't edit the raw article in group %s"
9594 gnus-newsgroup-name
))
9596 (set-buffer gnus-summary-buffer
)
9597 (let ((mail-parse-charset gnus-newsgroup-charset
)
9598 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
9599 (gnus-set-global-variables)
9600 (when (and (not force
)
9601 (gnus-group-read-only-p))
9602 (error "The current newsgroup does not support article editing"))
9603 (gnus-summary-show-article t
)
9604 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
9605 (with-current-buffer gnus-article-buffer
9606 (mm-enable-multibyte)))
9607 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
9609 (gnus-article-edit-article
9612 (let ((mbl mml-buffer-list
))
9613 (setq mml-buffer-list nil
)
9614 (let ((rfc2047-quote-decoded-words-containing-tspecials t
))
9615 (mime-to-mml ,'current-handles
))
9616 (let ((mbl1 mml-buffer-list
))
9617 (setq mml-buffer-list mbl
)
9618 (set (make-local-variable 'mml-buffer-list
) mbl1
))
9619 (gnus-make-local-hook 'kill-buffer-hook
)
9620 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
9621 `(lambda (no-highlight)
9622 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
9623 (message-options message-options
)
9624 (message-options-set-recipient)
9625 (mail-parse-ignored-charsets
9626 ',gnus-newsgroup-ignored-charsets
))
9627 ,(if (not raw
) '(progn
9629 (mml-destroy-buffers)
9630 (remove-hook 'kill-buffer-hook
9631 'mml-destroy-buffers t
)
9632 (kill-local-variable 'mml-buffer-list
)))
9633 (gnus-summary-edit-article-done
9634 ,(or (mail-header-references gnus-current-headers
) "")
9635 ,(gnus-group-read-only-p)
9636 ,gnus-summary-buffer no-highlight
))))))))
9638 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
9640 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9642 "Make edits to the current article permanent."
9645 ;; The buffer restriction contains the entire article if it exists.
9646 (when (article-goto-body)
9647 (let ((lines (count-lines (point) (point-max)))
9648 (length (- (point-max) (point)))
9649 (case-fold-search t
)
9650 (body (copy-marker (point))))
9651 (goto-char (point-min))
9652 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t
)
9653 (delete-region (match-beginning 1) (match-end 1))
9654 (insert (number-to-string length
)))
9655 (goto-char (point-min))
9656 (when (re-search-forward
9657 "^x-content-length:[ \t]\\([0-9]+\\)" body t
)
9658 (delete-region (match-beginning 1) (match-end 1))
9659 (insert (number-to-string length
)))
9660 (goto-char (point-min))
9661 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t
)
9662 (delete-region (match-beginning 1) (match-end 1))
9663 (insert (number-to-string lines
))))))
9664 ;; Replace the article.
9665 (let ((buf (current-buffer)))
9667 (insert-buffer-substring buf
)
9669 (if (and (not read-only
)
9670 (not (gnus-request-replace-article
9671 (cdr gnus-article-current
) (car gnus-article-current
)
9672 (current-buffer) t
)))
9673 (error "Couldn't replace article")
9674 ;; Update the summary buffer.
9676 (equal (message-tokenize-header references
" ")
9677 (message-tokenize-header
9678 (or (message-fetch-field "references") "") " ")))
9679 ;; We only have to update this line.
9682 (message-narrow-to-head)
9683 (let ((head (buffer-substring-no-properties
9684 (point-min) (point-max)))
9687 (insert (format "211 %d Article retrieved.\n"
9688 (cdr gnus-article-current
)))
9691 (let ((nntp-server-buffer (current-buffer)))
9692 (setq header
(car (gnus-get-newsgroup-headers
9695 (set-buffer gnus-summary-buffer
)
9696 (gnus-data-set-header
9697 (gnus-data-find (cdr gnus-article-current
))
9699 (gnus-summary-update-article-line
9700 (cdr gnus-article-current
) header
)
9701 (if (gnus-summary-goto-subject
9702 (cdr gnus-article-current
) nil t
)
9703 (gnus-summary-update-secondary-mark
9704 (cdr gnus-article-current
))))))))
9706 (set-buffer (or buffer gnus-summary-buffer
))
9707 (gnus-summary-update-article (cdr gnus-article-current
))
9708 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
9709 (gnus-summary-update-secondary-mark
9710 (cdr gnus-article-current
))))
9711 ;; Prettify the article buffer again.
9712 (unless no-highlight
9714 (set-buffer gnus-article-buffer
)
9715 ;;;!!! Fix this -- article should be rehighlighted.
9716 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9717 (set-buffer gnus-original-article-buffer
)
9718 (gnus-request-article
9719 (cdr gnus-article-current
)
9720 (car gnus-article-current
) (current-buffer))))
9721 ;; Prettify the summary buffer line.
9722 (when (gnus-visual-p 'summary-highlight
'highlight
)
9723 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
9725 (defun gnus-summary-edit-wash (key)
9726 "Perform editing command KEY in the article buffer."
9730 (message "%s" (concat (this-command-keys) "- "))
9733 (gnus-summary-edit-article)
9734 (execute-kbd-macro (concat (this-command-keys) key
))
9735 (gnus-article-edit-done))
9739 (defun gnus-summary-respool-query (&optional silent trace
)
9740 "Query where the respool algorithm would put this article."
9742 (let (gnus-mark-article-hook)
9743 (gnus-summary-select-article)
9745 (set-buffer gnus-original-article-buffer
)
9746 (let ((groups (nnmail-article-group 'identity trace
)))
9749 (message "This message would go to %s"
9750 (mapconcat 'car groups
", "))
9751 (message "This message would go to no groups"))
9754 (defun gnus-summary-respool-trace ()
9755 "Trace where the respool algorithm would put this article.
9756 Display a buffer showing all fancy splitting patterns which matched."
9758 (gnus-summary-respool-query nil t
))
9760 ;; Summary marking commands.
9762 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
9763 "Mark articles which has the same subject as read, and then select the next.
9764 If UNMARK is positive, remove any kind of mark.
9765 If UNMARK is negative, tick articles."
9768 (setq unmark
(prefix-numeric-value unmark
)))
9770 (gnus-summary-mark-same-subject
9771 (gnus-summary-article-subject) unmark
)))
9772 ;; Select next unread article. If auto-select-same mode, should
9773 ;; select the first unread article.
9774 (gnus-summary-next-article t
(and gnus-auto-select-same
9775 (gnus-summary-article-subject)))
9776 (gnus-message 7 "%d article%s marked as %s"
9777 count
(if (= count
1) " is" "s are")
9778 (if unmark
"unread" "read"))))
9780 (defun gnus-summary-kill-same-subject (&optional unmark
)
9781 "Mark articles which has the same subject as read.
9782 If UNMARK is positive, remove any kind of mark.
9783 If UNMARK is negative, tick articles."
9786 (setq unmark
(prefix-numeric-value unmark
)))
9788 (gnus-summary-mark-same-subject
9789 (gnus-summary-article-subject) unmark
)))
9790 ;; If marked as read, go to next unread subject.
9792 ;; Go to next unread subject.
9793 (gnus-summary-next-subject 1 t
))
9794 (gnus-message 7 "%d articles are marked as %s"
9795 count
(if unmark
"unread" "read"))))
9797 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
9798 "Mark articles with same SUBJECT as read, and return marked number.
9799 If optional argument UNMARK is positive, remove any kinds of marks.
9800 If optional argument UNMARK is negative, mark articles as unread instead."
9804 ((null unmark
) ; Mark as read.
9807 (gnus-summary-mark-article-as-read gnus-killed-mark
)
9808 (gnus-summary-show-thread) t
)
9809 (gnus-summary-find-subject subject
))
9810 (setq count
(1+ count
))))
9811 ((> unmark
0) ; Tick.
9814 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
9815 (gnus-summary-show-thread) t
)
9816 (gnus-summary-find-subject subject
))
9817 (setq count
(1+ count
))))
9818 (t ; Mark as unread.
9821 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
9822 (gnus-summary-show-thread) t
)
9823 (gnus-summary-find-subject subject
))
9824 (setq count
(1+ count
)))))
9825 (gnus-set-mode-line 'summary
)
9826 ;; Return the number of marked articles.
9829 (defun gnus-summary-mark-as-processable (n &optional unmark
)
9830 "Set the process mark on the next N articles.
9831 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9832 the process mark instead. The difference between N and the actual
9833 number of articles marked is returned."
9835 (if (and (null n
) (gnus-region-active-p))
9836 (gnus-uu-mark-region (region-beginning) (region-end) unmark
)
9837 (setq n
(prefix-numeric-value n
))
9838 (let ((backward (< n
0))
9843 (gnus-summary-remove-process-mark
9844 (gnus-summary-article-number))
9845 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9846 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
9849 (gnus-message 7 "No more articles"))
9850 (gnus-summary-recenter)
9851 (gnus-summary-position-point)
9854 (defun gnus-summary-unmark-as-processable (n)
9855 "Remove the process mark from the next N articles.
9856 If N is negative, unmark backward instead. The difference between N and
9857 the actual number of articles unmarked is returned."
9859 (gnus-summary-mark-as-processable n t
))
9861 (defun gnus-summary-unmark-all-processable ()
9862 "Remove the process mark from all articles."
9865 (while gnus-newsgroup-processable
9866 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
9867 (gnus-summary-position-point))
9869 (defun gnus-summary-add-mark (article type
)
9870 "Mark ARTICLE with a mark of TYPE."
9871 (let ((vtype (car (assq type gnus-article-mark-lists
)))
9874 (error "No such mark type: %s" type
)
9875 (setq var
(intern (format "gnus-newsgroup-%s" type
)))
9876 (set var
(cons article
(symbol-value var
)))
9877 (if (memq type
'(processable cached replied forwarded recent saved
))
9878 (gnus-summary-update-secondary-mark article
)
9879 ;;; !!! This is bogus. We should find out what primary
9880 ;;; !!! mark we want to set.
9881 (gnus-summary-update-mark gnus-del-mark
'unread
)))))
9883 (defun gnus-summary-mark-as-expirable (n)
9884 "Mark N articles forward as expirable.
9885 If N is negative, mark backward instead. The difference between N and
9886 the actual number of articles marked is returned."
9888 (gnus-summary-mark-forward n gnus-expirable-mark
))
9890 (defun gnus-summary-mark-as-spam (n)
9891 "Mark N articles forward as spam.
9892 If N is negative, mark backward instead. The difference between N and
9893 the actual number of articles marked is returned."
9895 (gnus-summary-mark-forward n gnus-spam-mark
))
9897 (defun gnus-summary-mark-article-as-replied (article)
9898 "Mark ARTICLE as replied to and update the summary line.
9899 ARTICLE can also be a list of articles."
9900 (interactive (list (gnus-summary-article-number)))
9901 (let ((articles (if (listp article
) article
(list article
))))
9902 (dolist (article articles
)
9903 (unless (numberp article
)
9904 (error "%s is not a number" article
))
9905 (push article gnus-newsgroup-replied
)
9906 (let ((buffer-read-only nil
))
9907 (when (gnus-summary-goto-subject article nil t
)
9908 (gnus-summary-update-secondary-mark article
))))))
9910 (defun gnus-summary-mark-article-as-forwarded (article)
9911 "Mark ARTICLE as forwarded and update the summary line.
9912 ARTICLE can also be a list of articles."
9913 (let ((articles (if (listp article
) article
(list article
))))
9914 (dolist (article articles
)
9915 (push article gnus-newsgroup-forwarded
)
9916 (let ((buffer-read-only nil
))
9917 (when (gnus-summary-goto-subject article nil t
)
9918 (gnus-summary-update-secondary-mark article
))))))
9920 (defun gnus-summary-set-bookmark (article)
9921 "Set a bookmark in current article."
9922 (interactive (list (gnus-summary-article-number)))
9923 (when (or (not (get-buffer gnus-article-buffer
))
9924 (not gnus-current-article
)
9925 (not gnus-article-current
)
9926 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
9927 (error "No current article selected"))
9928 ;; Remove old bookmark, if one exists.
9929 (gnus-pull article gnus-newsgroup-bookmarks
)
9930 ;; Set the new bookmark, which is on the form
9931 ;; (article-number . line-number-in-body).
9935 (set-buffer gnus-article-buffer
)
9942 gnus-newsgroup-bookmarks
)
9943 (gnus-message 6 "A bookmark has been added to the current article."))
9945 (defun gnus-summary-remove-bookmark (article)
9946 "Remove the bookmark from the current article."
9947 (interactive (list (gnus-summary-article-number)))
9948 ;; Remove old bookmark, if one exists.
9949 (if (not (assq article gnus-newsgroup-bookmarks
))
9950 (gnus-message 6 "No bookmark in current article.")
9951 (gnus-pull article gnus-newsgroup-bookmarks
)
9952 (gnus-message 6 "Removed bookmark.")))
9954 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9955 (defun gnus-summary-mark-as-dormant (n)
9956 "Mark N articles forward as dormant.
9957 If N is negative, mark backward instead. The difference between N and
9958 the actual number of articles marked is returned."
9960 (gnus-summary-mark-forward n gnus-dormant-mark
))
9962 (defun gnus-summary-set-process-mark (article)
9963 "Set the process mark on ARTICLE and update the summary line."
9964 (setq gnus-newsgroup-processable
9966 (delq article gnus-newsgroup-processable
)))
9967 (when (gnus-summary-goto-subject article
)
9968 (gnus-summary-show-thread)
9969 (gnus-summary-goto-subject article
)
9970 (gnus-summary-update-secondary-mark article
)))
9972 (defun gnus-summary-remove-process-mark (article)
9973 "Remove the process mark from ARTICLE and update the summary line."
9974 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
9975 (when (gnus-summary-goto-subject article
)
9976 (gnus-summary-show-thread)
9977 (gnus-summary-goto-subject article
)
9978 (gnus-summary-update-secondary-mark article
)))
9980 (defun gnus-summary-set-saved-mark (article)
9981 "Set the process mark on ARTICLE and update the summary line."
9982 (push article gnus-newsgroup-saved
)
9983 (when (gnus-summary-goto-subject article
)
9984 (gnus-summary-update-secondary-mark article
)))
9986 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
9987 "Mark N articles as read forwards.
9988 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9989 The difference between N and the actual number of articles marked is
9991 If NO-EXPIRE, auto-expiry will be inhibited."
9993 (gnus-summary-show-thread)
9994 (let ((backward (< n
0))
9995 (gnus-summary-goto-unread
9996 (and gnus-summary-goto-unread
9997 (not (eq gnus-summary-goto-unread
'never
))
9998 (not (memq mark
(list gnus-unread-mark gnus-spam-mark
9999 gnus-ticked-mark gnus-dormant-mark
)))))
10001 (mark (or mark gnus-del-mark
)))
10002 (while (and (> n
0)
10003 (gnus-summary-mark-article nil mark no-expire
)
10004 (zerop (gnus-summary-next-subject
10006 (and gnus-summary-goto-unread
10007 (not (eq gnus-summary-goto-unread
'never
)))
10011 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
10012 (gnus-summary-recenter)
10013 (gnus-summary-position-point)
10014 (gnus-set-mode-line 'summary
)
10017 (defun gnus-summary-mark-article-as-read (mark)
10018 "Mark the current article quickly as read with MARK."
10019 (let ((article (gnus-summary-article-number)))
10020 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10021 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10022 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10023 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10024 (push (cons article mark
) gnus-newsgroup-reads
)
10025 ;; Possibly remove from cache, if that is used.
10026 (when gnus-use-cache
10027 (gnus-cache-enter-remove-article article
))
10028 ;; Allow the backend to change the mark.
10029 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10030 ;; Check for auto-expiry.
10031 (when (and gnus-newsgroup-auto-expire
10032 (memq mark gnus-auto-expirable-marks
))
10033 (setq mark gnus-expirable-mark
)
10034 ;; Let the backend know about the mark change.
10035 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10036 (push article gnus-newsgroup-expirable
))
10037 ;; Set the mark in the buffer.
10038 (gnus-summary-update-mark mark
'unread
)
10041 (defun gnus-summary-mark-article-as-unread (mark)
10042 "Mark the current article quickly as unread with MARK."
10043 (let* ((article (gnus-summary-article-number))
10044 (old-mark (gnus-summary-article-mark article
)))
10045 ;; Allow the backend to change the mark.
10046 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10047 (if (eq mark old-mark
)
10051 (gnus-error 1 "Can't mark negative article numbers")
10053 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10054 (setq gnus-newsgroup-spam-marked
10055 (delq article gnus-newsgroup-spam-marked
))
10056 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10057 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
10058 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
10059 (cond ((= mark gnus-ticked-mark
)
10060 (setq gnus-newsgroup-marked
10061 (gnus-add-to-sorted-list gnus-newsgroup-marked
10063 ((= mark gnus-spam-mark
)
10064 (setq gnus-newsgroup-spam-marked
10065 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10067 ((= mark gnus-dormant-mark
)
10068 (setq gnus-newsgroup-dormant
10069 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10072 (setq gnus-newsgroup-unreads
10073 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10075 (gnus-pull article gnus-newsgroup-reads
)
10077 ;; See whether the article is to be put in the cache.
10078 (and gnus-use-cache
10079 (vectorp (gnus-summary-article-header article
))
10081 (gnus-cache-possibly-enter-article
10082 gnus-newsgroup-name article
10083 (= mark gnus-ticked-mark
)
10084 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10087 (gnus-summary-update-mark mark
'unread
)
10090 (defun gnus-summary-mark-article (&optional article mark no-expire
)
10091 "Mark ARTICLE with MARK. MARK can be any character.
10092 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10093 `??' (dormant) and `?E' (expirable).
10094 If MARK is nil, then the default character `?r' is used.
10095 If ARTICLE is nil, then the article on the current line will be
10097 If NO-EXPIRE, auto-expiry will be inhibited."
10098 ;; The mark might be a string.
10099 (when (stringp mark
)
10100 (setq mark
(aref mark
0)))
10101 ;; If no mark is given, then we check auto-expiring.
10103 (setq mark gnus-del-mark
))
10104 (when (and (not no-expire
)
10105 gnus-newsgroup-auto-expire
10106 (memq mark gnus-auto-expirable-marks
))
10107 (setq mark gnus-expirable-mark
))
10108 (let ((article (or article
(gnus-summary-article-number)))
10109 (old-mark (gnus-summary-article-mark article
)))
10110 ;; Allow the backend to change the mark.
10111 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10112 (if (eq mark old-mark
)
10115 (error "No article on current line"))
10116 (if (not (if (or (= mark gnus-unread-mark
)
10117 (= mark gnus-ticked-mark
)
10118 (= mark gnus-spam-mark
)
10119 (= mark gnus-dormant-mark
))
10120 (gnus-mark-article-as-unread article mark
)
10121 (gnus-mark-article-as-read article mark
)))
10123 ;; See whether the article is to be put in the cache.
10124 (and gnus-use-cache
10125 (not (= mark gnus-canceled-mark
))
10126 (vectorp (gnus-summary-article-header article
))
10128 (gnus-cache-possibly-enter-article
10129 gnus-newsgroup-name article
10130 (= mark gnus-ticked-mark
)
10131 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10133 (when (gnus-summary-goto-subject article nil t
)
10134 (let ((buffer-read-only nil
))
10135 (gnus-summary-show-thread)
10137 (gnus-summary-update-mark mark
'unread
)
10140 (defun gnus-summary-update-secondary-mark (article)
10141 "Update the secondary (read, process, cache) mark."
10142 (gnus-summary-update-mark
10143 (cond ((memq article gnus-newsgroup-processable
)
10145 ((memq article gnus-newsgroup-cached
)
10147 ((memq article gnus-newsgroup-replied
)
10149 ((memq article gnus-newsgroup-forwarded
)
10150 gnus-forwarded-mark
)
10151 ((memq article gnus-newsgroup-saved
)
10153 ((memq article gnus-newsgroup-recent
)
10155 ((memq article gnus-newsgroup-unseen
)
10159 (when (gnus-visual-p 'summary-highlight
'highlight
)
10160 (gnus-run-hooks 'gnus-summary-update-hook
))
10163 (defun gnus-summary-update-download-mark (article)
10164 "Update the download mark."
10165 (gnus-summary-update-mark
10166 (cond ((memq article gnus-newsgroup-undownloaded
)
10167 gnus-undownloaded-mark
)
10168 (gnus-newsgroup-agentized
10169 gnus-downloaded-mark
)
10173 (gnus-summary-update-line t
)
10176 (defun gnus-summary-update-mark (mark type
)
10177 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
10178 (buffer-read-only nil
))
10179 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
10181 (when (looking-at "\r")
10183 (when (<= (+ forward
(point)) (point-max))
10184 ;; Go to the right position on the line.
10185 (goto-char (+ forward
(point)))
10186 ;; Replace the old mark with the new mark.
10187 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
10188 ;; Optionally update the marks by some user rule.
10189 (when (eq type
'unread
)
10190 (gnus-data-set-mark
10191 (gnus-data-find (gnus-summary-article-number)) mark
)
10192 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
10194 (defun gnus-mark-article-as-read (article &optional mark
)
10195 "Enter ARTICLE in the pertinent lists and remove it from others."
10196 ;; Make the article expirable.
10197 (let ((mark (or mark gnus-del-mark
)))
10198 (setq gnus-newsgroup-expirable
10199 (if (= mark gnus-expirable-mark
)
10200 (gnus-add-to-sorted-list gnus-newsgroup-expirable article
)
10201 (delq article gnus-newsgroup-expirable
)))
10202 ;; Remove from unread and marked lists.
10203 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10204 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10205 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10206 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10207 (push (cons article mark
) gnus-newsgroup-reads
)
10208 ;; Possibly remove from cache, if that is used.
10209 (when gnus-use-cache
10210 (gnus-cache-enter-remove-article article
))
10213 (defun gnus-mark-article-as-unread (article &optional mark
)
10214 "Enter ARTICLE in the pertinent lists and remove it from others."
10215 (let ((mark (or mark gnus-ticked-mark
)))
10218 (gnus-error 1 "Can't mark negative article numbers")
10220 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
10221 gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
)
10222 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
10223 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
10224 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10226 ;; Unsuppress duplicates?
10227 (when gnus-suppress-duplicates
10228 (gnus-dup-unsuppress-article article
))
10230 (cond ((= mark gnus-ticked-mark
)
10231 (setq gnus-newsgroup-marked
10232 (gnus-add-to-sorted-list gnus-newsgroup-marked article
)))
10233 ((= mark gnus-spam-mark
)
10234 (setq gnus-newsgroup-spam-marked
10235 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10237 ((= mark gnus-dormant-mark
)
10238 (setq gnus-newsgroup-dormant
10239 (gnus-add-to-sorted-list gnus-newsgroup-dormant article
)))
10241 (setq gnus-newsgroup-unreads
10242 (gnus-add-to-sorted-list gnus-newsgroup-unreads article
))))
10243 (gnus-pull article gnus-newsgroup-reads
)
10246 (defalias 'gnus-summary-mark-as-unread-forward
10247 'gnus-summary-tick-article-forward
)
10248 (make-obsolete 'gnus-summary-mark-as-unread-forward
10249 'gnus-summary-tick-article-forward
)
10250 (defun gnus-summary-tick-article-forward (n)
10251 "Tick N articles forwards.
10252 If N is negative, tick backwards instead.
10253 The difference between N and the number of articles ticked is returned."
10255 (gnus-summary-mark-forward n gnus-ticked-mark
))
10257 (defalias 'gnus-summary-mark-as-unread-backward
10258 'gnus-summary-tick-article-backward
)
10259 (make-obsolete 'gnus-summary-mark-as-unread-backward
10260 'gnus-summary-tick-article-backward
)
10261 (defun gnus-summary-tick-article-backward (n)
10262 "Tick N articles backwards.
10263 The difference between N and the number of articles ticked is returned."
10265 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
10267 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10268 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10269 (defun gnus-summary-tick-article (&optional article clear-mark
)
10270 "Mark current article as unread.
10271 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10272 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10274 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
10275 gnus-ticked-mark
)))
10277 (defun gnus-summary-mark-as-read-forward (n)
10278 "Mark N articles as read forwards.
10279 If N is negative, mark backwards instead.
10280 The difference between N and the actual number of articles marked is
10283 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
10285 (defun gnus-summary-mark-as-read-backward (n)
10286 "Mark the N articles as read backwards.
10287 The difference between N and the actual number of articles marked is
10290 (gnus-summary-mark-forward
10291 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
10293 (defun gnus-summary-mark-as-read (&optional article mark
)
10294 "Mark current article as read.
10295 ARTICLE specifies the article to be marked as read.
10296 MARK specifies a string to be inserted at the beginning of the line."
10297 (gnus-summary-mark-article article mark
))
10299 (defun gnus-summary-clear-mark-forward (n)
10300 "Clear marks from N articles forward.
10301 If N is negative, clear backward instead.
10302 The difference between N and the number of marks cleared is returned."
10304 (gnus-summary-mark-forward n gnus-unread-mark
))
10306 (defun gnus-summary-clear-mark-backward (n)
10307 "Clear marks from N articles backward.
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-mark-unread-as-read ()
10313 "Intended to be used by `gnus-summary-mark-article-hook'."
10314 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10315 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
10317 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark
)
10318 "Intended to be used by `gnus-summary-mark-article-hook'."
10319 (let ((mark (gnus-summary-article-mark)))
10320 (when (or (gnus-unread-mark-p mark
)
10321 (gnus-read-mark-p mark
))
10322 (gnus-summary-mark-article gnus-current-article
10323 (or new-mark gnus-read-mark
)))))
10325 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark
)
10326 "Intended to be used by `gnus-summary-mark-article-hook'."
10327 (let ((mark (gnus-summary-article-mark)))
10328 (when (or (gnus-unread-mark-p mark
)
10329 (gnus-read-mark-p mark
))
10330 (gnus-summary-mark-article (gnus-summary-article-number)
10331 (or new-mark gnus-read-mark
)))))
10333 (defun gnus-summary-mark-unread-as-ticked ()
10334 "Intended to be used by `gnus-summary-mark-article-hook'."
10335 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10336 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark
)))
10338 (defun gnus-summary-mark-region-as-read (point mark all
)
10339 "Mark all unread articles between point and mark as read.
10340 If given a prefix, mark all articles between point and mark as read,
10341 even ticked and dormant ones."
10342 (interactive "r\nP")
10346 (beginning-of-line)
10351 (memq (setq article
(gnus-summary-article-number))
10352 gnus-newsgroup-unreads
))
10353 (gnus-summary-mark-article article gnus-del-mark
))
10355 (gnus-summary-find-next))))))
10357 (defun gnus-summary-mark-below (score mark
)
10358 "Mark articles with score less than SCORE with MARK."
10359 (interactive "P\ncMark: ")
10360 (setq score
(if score
10361 (prefix-numeric-value score
)
10362 (or gnus-summary-default-score
0)))
10364 (set-buffer gnus-summary-buffer
)
10365 (goto-char (point-min))
10368 (and (< (gnus-summary-article-score) score
)
10369 (gnus-summary-mark-article nil mark
))
10370 (gnus-summary-find-next)))))
10372 (defun gnus-summary-kill-below (&optional score
)
10373 "Mark articles with score below SCORE as read."
10375 (gnus-summary-mark-below score gnus-killed-mark
))
10377 (defun gnus-summary-clear-above (&optional score
)
10378 "Clear all marks from articles with score above SCORE."
10380 (gnus-summary-mark-above score gnus-unread-mark
))
10382 (defun gnus-summary-tick-above (&optional score
)
10383 "Tick all articles with score above SCORE."
10385 (gnus-summary-mark-above score gnus-ticked-mark
))
10387 (defun gnus-summary-mark-above (score mark
)
10388 "Mark articles with score over SCORE with MARK."
10389 (interactive "P\ncMark: ")
10390 (setq score
(if score
10391 (prefix-numeric-value score
)
10392 (or gnus-summary-default-score
0)))
10394 (set-buffer gnus-summary-buffer
)
10395 (goto-char (point-min))
10397 (when (> (gnus-summary-article-score) score
)
10398 (gnus-summary-mark-article nil mark
))
10400 (gnus-summary-find-next)))))
10402 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10403 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
10404 (defun gnus-summary-limit-include-expunged (&optional no-error
)
10405 "Display all the hidden articles that were expunged for low scores."
10407 (let ((buffer-read-only nil
))
10408 (let ((scored gnus-newsgroup-scored
)
10411 (unless (gnus-summary-article-header (caar scored
))
10412 (and (setq h
(gnus-number-to-header (caar scored
)))
10413 (< (cdar scored
) gnus-summary-expunge-below
)
10415 (setq scored
(cdr scored
)))
10417 (when (not no-error
)
10418 (error "No expunged articles hidden"))
10419 (goto-char (point-min))
10420 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
10421 (setq gnus-newsgroup-limit
(copy-sequence gnus-newsgroup-limit
))
10422 (mapcar (lambda (x) (push (mail-header-number x
)
10423 gnus-newsgroup-limit
))
10425 (gnus-summary-prepare-unthreaded (nreverse headers
))
10426 (goto-char (point-min))
10427 (gnus-summary-position-point)
10430 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse
)
10431 "Mark all unread articles in this newsgroup as read.
10432 If prefix argument ALL is non-nil, ticked and dormant articles will
10433 also be marked as read.
10434 If QUIETLY is non-nil, no questions will be asked.
10436 If TO-HERE is non-nil, it should be a point in the buffer. All
10437 articles before (after, if REVERSE is set) this point will be marked
10440 Note that this function will only catch up the unread article
10441 in the current summary buffer limitation.
10443 The number of articles marked as read is returned."
10448 (not gnus-interactive-catchup
) ;Without confirmation?
10452 "Mark absolutely all articles as read? "
10453 "Mark all unread articles as read? ")))
10455 (not gnus-newsgroup-adaptive
)
10456 (not gnus-newsgroup-auto-expire
)
10457 (not gnus-suppress-duplicates
)
10458 (or (not gnus-use-cache
)
10459 (eq gnus-use-cache
'passive
)))
10462 (setq gnus-newsgroup-marked nil
10463 gnus-newsgroup-spam-marked nil
10464 gnus-newsgroup-dormant nil
))
10465 (setq gnus-newsgroup-unreads
10466 (gnus-sorted-nunion
10467 (gnus-intersection gnus-newsgroup-unreads
10468 gnus-newsgroup-downloadable
)
10469 gnus-newsgroup-unfetched
)))
10470 ;; We actually mark all articles as canceled, which we
10471 ;; have to do when using auto-expiry or adaptive scoring.
10472 (gnus-summary-show-all-threads)
10473 (if (and to-here reverse
)
10475 (goto-char to-here
)
10476 (gnus-summary-mark-current-read-and-unread-as-read
10478 (while (gnus-summary-find-next (not all
))
10479 (gnus-summary-mark-article-as-read gnus-catchup-mark
)))
10480 (when (gnus-summary-first-subject (not all
))
10482 (if to-here
(< (point) to-here
) t
)
10483 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
10484 (gnus-summary-find-next (not all
))))))
10485 (gnus-set-mode-line 'summary
))
10487 (gnus-summary-position-point)))
10489 (defun gnus-summary-catchup-to-here (&optional all
)
10490 "Mark all unticked articles before the current one as read.
10491 If ALL is non-nil, also mark ticked and dormant articles as read."
10494 (gnus-save-hidden-threads
10495 (let ((beg (point)))
10496 ;; We check that there are unread articles.
10497 (when (or all
(gnus-summary-find-prev))
10498 (gnus-summary-catchup all t beg
)))))
10499 (gnus-summary-position-point))
10501 (defun gnus-summary-catchup-from-here (&optional all
)
10502 "Mark all unticked articles after (and including) the current one as read.
10503 If ALL is non-nil, also mark ticked and dormant articles as read."
10506 (gnus-save-hidden-threads
10507 (let ((beg (point)))
10508 ;; We check that there are unread articles.
10509 (when (or all
(gnus-summary-find-next))
10510 (gnus-summary-catchup all t beg nil t
)))))
10511 (gnus-summary-position-point))
10513 (defun gnus-summary-catchup-all (&optional quietly
)
10514 "Mark all articles in this newsgroup as read.
10515 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10516 instead, which marks only unread articles as read."
10518 (gnus-summary-catchup t quietly
))
10520 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
10521 "Mark all unread articles in this group as read, then exit.
10522 If prefix argument ALL is non-nil, all articles are marked as read.
10523 If QUIETLY is non-nil, no questions will be asked."
10525 (when (gnus-summary-catchup all quietly nil
'fast
)
10526 ;; Select next newsgroup or exit.
10527 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
10528 (eq gnus-auto-select-next
'quietly
))
10529 (gnus-summary-next-group nil
)
10530 (gnus-summary-exit))))
10532 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
10533 "Mark all articles in this newsgroup as read, and then exit.
10534 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10535 instead, which marks only unread articles as read."
10537 (gnus-summary-catchup-and-exit t quietly
))
10539 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
10540 "Mark all articles in this group as read and select the next group.
10541 If given a prefix, mark all articles, unread as well as ticked, as
10545 (gnus-summary-catchup all
))
10546 (gnus-summary-next-group))
10552 (defmacro gnus-with-article
(article &rest forms
)
10553 "Select ARTICLE and perform FORMS in the original article buffer.
10554 Then replace the article with the result."
10556 ;; We don't want the article to be marked as read.
10557 (let (gnus-mark-article-hook)
10558 (gnus-summary-select-article t t nil
,article
))
10559 (set-buffer gnus-original-article-buffer
)
10561 (if (not (gnus-check-backend-function
10562 'request-replace-article
(car gnus-article-current
)))
10563 (gnus-message 5 "Read-only group; not replacing")
10564 (unless (gnus-request-replace-article
10565 ,article
(car gnus-article-current
)
10566 (current-buffer) t
)
10567 (error "Couldn't replace article")))
10568 ;; The cache and backlog have to be flushed somewhat.
10569 (when gnus-keep-backlog
10570 (gnus-backlog-remove-article
10571 (car gnus-article-current
) (cdr gnus-article-current
)))
10572 (when gnus-use-cache
10573 (gnus-cache-update-article
10574 (car gnus-article-current
) (cdr gnus-article-current
)))))
10576 (put 'gnus-with-article
'lisp-indent-function
1)
10577 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
10579 ;; Thread-based commands.
10581 (defun gnus-summary-articles-in-thread (&optional article
)
10582 "Return a list of all articles in the current thread.
10583 If ARTICLE is non-nil, return all articles in the thread that starts
10584 with that article."
10585 (let* ((article (or article
(gnus-summary-article-number)))
10586 (data (gnus-data-find-list article
))
10587 (top-level (gnus-data-level (car data
)))
10589 (cond ((null gnus-thread-operation-ignore-subject
)
10590 (gnus-simplify-subject-re
10591 (mail-header-subject (gnus-data-header (car data
)))))
10592 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
10593 (gnus-simplify-subject-fuzzy
10594 (mail-header-subject (gnus-data-header (car data
)))))
10596 (end-point (save-excursion
10597 (if (gnus-summary-go-to-next-thread)
10598 (point) (point-max))))
10601 (< (gnus-data-pos (car data
)) end-point
))
10602 (when (or (not top-subject
)
10603 (string= top-subject
10604 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
10605 (gnus-simplify-subject-fuzzy
10606 (mail-header-subject
10607 (gnus-data-header (car data
))))
10608 (gnus-simplify-subject-re
10609 (mail-header-subject
10610 (gnus-data-header (car data
)))))))
10611 (push (gnus-data-number (car data
)) articles
))
10612 (unless (and (setq data
(cdr data
))
10613 (> (gnus-data-level (car data
)) top-level
))
10615 ;; Return the list of articles.
10616 (nreverse articles
)))
10618 (defun gnus-summary-rethread-current ()
10619 "Rethread the thread the current article is part of."
10621 (let* ((gnus-show-threads t
)
10622 (article (gnus-summary-article-number))
10623 (id (mail-header-id (gnus-summary-article-header)))
10624 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
10626 (error "No article on the current line"))
10627 (gnus-rebuild-thread id
)
10628 (gnus-summary-goto-subject article
)))
10630 (defun gnus-summary-reparent-thread ()
10631 "Make the current article child of the marked (or previous) article.
10633 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10634 is non-nil or the Subject: of both articles are the same."
10636 (unless (not (gnus-group-read-only-p))
10637 (error "The current newsgroup does not support article editing"))
10638 (unless (<= (length gnus-newsgroup-processable
) 1)
10639 (error "No more than one article may be marked"))
10640 (save-window-excursion
10641 (let ((gnus-article-buffer " *reparent*")
10642 (current-article (gnus-summary-article-number))
10643 ;; First grab the marked article, otherwise one line up.
10644 (parent-article (if (not (null gnus-newsgroup-processable
))
10645 (car gnus-newsgroup-processable
)
10647 (if (eq (forward-line -
1) 0)
10648 (gnus-summary-article-number)
10649 (error "Beginning of summary buffer"))))))
10650 (unless (not (eq current-article parent-article
))
10651 (error "An article may not be self-referential"))
10652 (let ((message-id (mail-header-id
10653 (gnus-summary-article-header parent-article
))))
10654 (unless (and message-id
(not (equal message-id
"")))
10655 (error "No message-id in desired parent"))
10656 (gnus-with-article current-article
10658 (goto-char (point-min))
10659 (message-narrow-to-head)
10660 (if (re-search-forward "^References: " nil t
)
10662 (re-search-forward "^[^ \t]" nil t
)
10665 (insert " " message-id
))
10666 (insert "References: " message-id
"\n"))))
10667 (set-buffer gnus-summary-buffer
)
10668 (gnus-summary-unmark-all-processable)
10669 (gnus-summary-update-article current-article
)
10670 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
10671 (gnus-summary-update-secondary-mark (cdr gnus-article-current
)))
10672 (gnus-summary-rethread-current)
10673 (gnus-message 3 "Article %d is now the child of article %d"
10674 current-article parent-article
)))))
10676 (defun gnus-summary-toggle-threads (&optional arg
)
10677 "Toggle showing conversation threads.
10678 If ARG is positive number, turn showing conversation threads on."
10680 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
10681 (setq gnus-show-threads
10682 (if (null arg
) (not gnus-show-threads
)
10683 (> (prefix-numeric-value arg
) 0)))
10684 (gnus-summary-prepare)
10685 (gnus-summary-goto-subject current
)
10686 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
10687 (gnus-summary-position-point)))
10689 (defun gnus-summary-show-all-threads ()
10690 "Show all threads."
10693 (let ((buffer-read-only nil
))
10694 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
10695 (gnus-summary-position-point))
10697 (defun gnus-summary-show-thread ()
10698 "Show thread subtrees.
10699 Returns nil if no thread was there to be shown."
10701 (let ((buffer-read-only nil
)
10703 (end (gnus-point-at-eol))
10704 ;; Leave point at bol
10705 (beg (progn (beginning-of-line) (point))))
10707 ;; Any hidden lines here?
10708 (search-forward "\r" end t
)
10709 (subst-char-in-region beg end ?\^M ?
\n t
)
10711 (gnus-summary-position-point))))
10713 (defun gnus-summary-maybe-hide-threads ()
10714 "If requested, hide the threads that should be hidden."
10715 (when (and gnus-show-threads
10716 gnus-thread-hide-subtree
)
10717 (gnus-summary-hide-all-threads
10718 (if (or (consp gnus-thread-hide-subtree
)
10719 (functionp gnus-thread-hide-subtree
))
10720 (gnus-make-predicate gnus-thread-hide-subtree
)
10723 ;;; Hiding predicates.
10725 (defun gnus-article-unread-p (header)
10726 (memq (mail-header-number header
) gnus-newsgroup-unreads
))
10728 (defun gnus-article-unseen-p (header)
10729 (memq (mail-header-number header
) gnus-newsgroup-unseen
))
10731 (defun gnus-map-articles (predicate articles
)
10732 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10733 (apply 'gnus-or
(mapcar predicate
10734 (mapcar (lambda (number)
10735 (gnus-summary-article-header number
))
10738 (defun gnus-summary-hide-all-threads (&optional predicate
)
10739 "Hide all thread subtrees.
10740 If PREDICATE is supplied, threads that satisfy this predicate
10741 will not be hidden."
10744 (goto-char (point-min))
10747 (when (or (not predicate
)
10749 predicate
(gnus-summary-article-children)))
10750 (gnus-summary-hide-thread))
10751 (setq end
(not (zerop (gnus-summary-next-thread 1 t
)))))))
10752 (gnus-summary-position-point))
10754 (defun gnus-summary-hide-thread ()
10755 "Hide thread subtrees.
10756 If PREDICATE is supplied, threads that satisfy this predicate
10757 will not be hidden.
10758 Returns nil if no threads were there to be hidden."
10760 (let ((buffer-read-only nil
)
10762 (article (gnus-summary-article-number)))
10764 ;; Go forward until either the buffer ends or the subthread
10766 (when (and (not (eobp))
10767 (or (zerop (gnus-summary-next-thread 1 t
))
10768 (goto-char (point-max))))
10770 (if (and (> (point) start
)
10771 (search-backward "\n" start t
))
10773 (subst-char-in-region start
(point) ?
\n ?\^M
)
10774 (gnus-summary-goto-subject article
))
10778 (defun gnus-summary-go-to-next-thread (&optional previous
)
10779 "Go to the same level (or less) next thread.
10780 If PREVIOUS is non-nil, go to previous thread instead.
10781 Return the article number moved to, or nil if moving was impossible."
10782 (let ((level (gnus-summary-thread-level))
10783 (way (if previous -
1 1))
10786 (while (and (not (eobp))
10787 (< level
(gnus-summary-thread-level)))
10788 (forward-line way
))
10795 (gnus-summary-article-number)
10796 (goto-char beg
)))))
10798 (defun gnus-summary-next-thread (n &optional silent
)
10799 "Go to the same level next N'th thread.
10800 If N is negative, search backward instead.
10801 Returns the difference between N and the number of skips actually
10804 If SILENT, don't output messages."
10806 (let ((backward (< n
0))
10808 (while (and (> n
0)
10809 (gnus-summary-go-to-next-thread backward
))
10812 (gnus-summary-position-point))
10813 (when (and (not silent
) (/= 0 n
))
10814 (gnus-message 7 "No more threads"))
10817 (defun gnus-summary-prev-thread (n)
10818 "Go to the same level previous N'th thread.
10819 Returns the difference between N and the number of skips actually
10822 (gnus-summary-next-thread (- n
)))
10824 (defun gnus-summary-go-down-thread ()
10825 "Go down one level in the current thread."
10826 (let ((children (gnus-summary-article-children)))
10828 (gnus-summary-goto-subject (car children
)))))
10830 (defun gnus-summary-go-up-thread ()
10831 "Go up one level in the current thread."
10832 (let ((parent (gnus-summary-article-parent)))
10834 (gnus-summary-goto-subject parent
))))
10836 (defun gnus-summary-down-thread (n)
10837 "Go down thread N steps.
10838 If N is negative, go up instead.
10839 Returns the difference between N and how many steps down that were
10844 (while (and (> n
0)
10845 (if up
(gnus-summary-go-up-thread)
10846 (gnus-summary-go-down-thread)))
10848 (gnus-summary-position-point)
10850 (gnus-message 7 "Can't go further"))
10853 (defun gnus-summary-up-thread (n)
10854 "Go up thread N steps.
10855 If N is negative, go down instead.
10856 Returns the difference between N and how many steps down that were
10859 (gnus-summary-down-thread (- n
)))
10861 (defun gnus-summary-top-thread ()
10862 "Go to the top of the thread."
10864 (while (gnus-summary-go-up-thread))
10865 (gnus-summary-article-number))
10867 (defun gnus-summary-kill-thread (&optional unmark
)
10868 "Mark articles under current thread as read.
10869 If the prefix argument is positive, remove any kinds of marks.
10870 If the prefix argument is negative, tick articles instead."
10873 (setq unmark
(prefix-numeric-value unmark
)))
10874 (let ((articles (gnus-summary-articles-in-thread)))
10876 ;; Expand the thread.
10877 (gnus-summary-show-thread)
10878 ;; Mark all the articles.
10880 (gnus-summary-goto-subject (car articles
))
10881 (cond ((null unmark
)
10882 (gnus-summary-mark-article-as-read gnus-killed-mark
))
10884 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
10886 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
10887 (setq articles
(cdr articles
))))
10888 ;; Hide killed subtrees.
10890 gnus-thread-hide-killed
10891 (gnus-summary-hide-thread))
10892 ;; If marked as read, go to next unread subject.
10893 (when (null unmark
)
10894 ;; Go to next unread subject.
10895 (gnus-summary-next-subject 1 t
)))
10896 (gnus-set-mode-line 'summary
))
10898 ;; Summary sorting commands
10900 (defun gnus-summary-sort-by-number (&optional reverse
)
10901 "Sort the summary buffer by article number.
10902 Argument REVERSE means reverse order."
10904 (gnus-summary-sort 'number reverse
))
10906 (defun gnus-summary-sort-by-random (&optional reverse
)
10907 "Randomize the order in the summary buffer.
10908 Argument REVERSE means to randomize in reverse order."
10910 (gnus-summary-sort 'random reverse
))
10912 (defun gnus-summary-sort-by-author (&optional reverse
)
10913 "Sort the summary buffer by author name alphabetically.
10914 If `case-fold-search' is non-nil, case of letters is ignored.
10915 Argument REVERSE means reverse order."
10917 (gnus-summary-sort 'author reverse
))
10919 (defun gnus-summary-sort-by-subject (&optional reverse
)
10920 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10921 If `case-fold-search' is non-nil, case of letters is ignored.
10922 Argument REVERSE means reverse order."
10924 (gnus-summary-sort 'subject reverse
))
10926 (defun gnus-summary-sort-by-date (&optional reverse
)
10927 "Sort the summary buffer by date.
10928 Argument REVERSE means reverse order."
10930 (gnus-summary-sort 'date reverse
))
10932 (defun gnus-summary-sort-by-score (&optional reverse
)
10933 "Sort the summary buffer by score.
10934 Argument REVERSE means reverse order."
10936 (gnus-summary-sort 'score reverse
))
10938 (defun gnus-summary-sort-by-lines (&optional reverse
)
10939 "Sort the summary buffer by the number of lines.
10940 Argument REVERSE means reverse order."
10942 (gnus-summary-sort 'lines reverse
))
10944 (defun gnus-summary-sort-by-chars (&optional reverse
)
10945 "Sort the summary buffer by article length.
10946 Argument REVERSE means reverse order."
10948 (gnus-summary-sort 'chars reverse
))
10950 (defun gnus-summary-sort-by-original (&optional reverse
)
10951 "Sort the summary buffer using the default sorting method.
10952 Argument REVERSE means reverse order."
10954 (let* ((buffer-read-only)
10955 (gnus-summary-prepare-hook nil
))
10956 ;; We do the sorting by regenerating the threads.
10957 (gnus-summary-prepare)
10958 ;; Hide subthreads if needed.
10959 (gnus-summary-maybe-hide-threads)))
10961 (defun gnus-summary-sort (predicate reverse
)
10962 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10963 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
10964 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
10965 (gnus-thread-sort-functions
10970 (gnus-sort-gathered-threads-function
10971 gnus-thread-sort-functions
)
10972 (gnus-article-sort-functions
10976 (,article t2 t1
))))
10978 (gnus-summary-prepare-hook nil
))
10979 ;; We do the sorting by regenerating the threads.
10980 (gnus-summary-prepare)
10981 ;; Hide subthreads if needed.
10982 (gnus-summary-maybe-hide-threads)))
10984 ;; Summary saving commands.
10986 (defun gnus-summary-save-article (&optional n not-saved
)
10987 "Save the current article using the default saver function.
10988 If N is a positive number, save the N next articles.
10989 If N is a negative number, save the N previous articles.
10990 If N is nil and any articles have been marked with the process mark,
10991 save those articles instead.
10992 The variable `gnus-default-article-saver' specifies the saver function.
10994 If the optional second argument NOT-SAVED is non-nil, articles saved
10995 will not be marked as saved."
10997 (require 'gnus-art
)
10998 (let* ((articles (gnus-summary-work-articles n
))
10999 (save-buffer (save-excursion
11000 (nnheader-set-temp-buffer " *Gnus Save*")))
11001 (num (length articles
))
11002 ;; Whether to save decoded articles or raw articles.
11003 (decode (when gnus-article-save-coding-system
11004 (get gnus-default-article-saver
:decode
)))
11005 ;; When saving many articles in a single file, use the other
11006 ;; function to save articles other than the first one.
11007 (saver2 (get gnus-default-article-saver
:function
))
11008 (gnus-prompt-before-saving (if saver2
11010 gnus-prompt-before-saving
))
11011 (gnus-default-article-saver gnus-default-article-saver
)
11013 (dolist (article articles
)
11014 (setq header
(gnus-summary-article-header article
))
11015 (if (not (vectorp header
))
11016 ;; This is a pseudo-article.
11017 (if (assq 'name header
)
11018 (gnus-copy-file (cdr (assq 'name header
)))
11019 (gnus-message 1 "Article %d is unsaveable" article
))
11020 ;; This is a real article.
11021 (save-window-excursion
11022 (let ((gnus-display-mime-function (when decode
11023 gnus-display-mime-function
))
11024 (gnus-article-prepare-hook (when decode
11025 gnus-article-prepare-hook
)))
11026 (gnus-summary-select-article t nil nil article
)
11027 (gnus-summary-goto-subject article
)))
11029 (set-buffer save-buffer
)
11031 (insert-buffer-substring (if decode
11032 gnus-article-buffer
11033 gnus-original-article-buffer
)))
11034 (setq file
(gnus-article-save save-buffer file num
))
11035 (gnus-summary-remove-process-mark article
)
11037 (gnus-summary-set-saved-mark article
)))
11039 (setq gnus-default-article-saver saver2
11041 (gnus-kill-buffer save-buffer
)
11042 (gnus-summary-position-point)
11043 (gnus-set-mode-line 'summary
)
11046 (defun gnus-summary-pipe-output (&optional arg headers
)
11047 "Pipe the current article to a subprocess.
11048 If N is a positive number, pipe the N next articles.
11049 If N is a negative number, pipe the N previous articles.
11050 If N is nil and any articles have been marked with the process mark,
11051 pipe those articles instead.
11052 If HEADERS (the symbolic prefix), include the headers, too."
11053 (interactive (gnus-interactive "P\ny"))
11054 (require 'gnus-art
)
11055 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
)
11056 (gnus-save-all-headers (or headers gnus-save-all-headers
)))
11057 (gnus-summary-save-article arg t
))
11058 (let ((buffer (get-buffer "*Shell Command Output*")))
11060 (not (zerop (buffer-size buffer
))))
11061 (gnus-configure-windows 'pipe
))))
11063 (defun gnus-summary-save-article-mail (&optional arg
)
11064 "Append the current article to a Unix mail box file.
11065 If N is a positive number, save the N next articles.
11066 If N is a negative number, save the N previous articles.
11067 If N is nil and any articles have been marked with the process mark,
11068 save those articles instead."
11070 (require 'gnus-art
)
11071 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
11072 (gnus-summary-save-article arg
)))
11074 (defun gnus-summary-save-article-rmail (&optional arg
)
11075 "Append the current article to an rmail file.
11076 If N is a positive number, save the N next articles.
11077 If N is a negative number, save the N previous articles.
11078 If N is nil and any articles have been marked with the process mark,
11079 save those articles instead."
11081 (require 'gnus-art
)
11082 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
11083 (gnus-summary-save-article arg
)))
11085 (defun gnus-summary-save-article-file (&optional arg
)
11086 "Append the current article to a file.
11087 If N is a positive number, save the N next articles.
11088 If N is a negative number, save the N previous articles.
11089 If N is nil and any articles have been marked with the process mark,
11090 save those articles instead."
11092 (require 'gnus-art
)
11093 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
11094 (gnus-summary-save-article arg
)))
11096 (defun gnus-summary-write-article-file (&optional arg
)
11097 "Write the current article to a file, deleting the previous file.
11098 If N is a positive number, save the N next articles.
11099 If N is a negative number, save the N previous articles.
11100 If N is nil and any articles have been marked with the process mark,
11101 save those articles instead."
11103 (require 'gnus-art
)
11104 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
11105 (gnus-summary-save-article arg
)))
11107 (defun gnus-summary-save-article-body-file (&optional arg
)
11108 "Append the current article body to a file.
11109 If N is a positive number, save the N next articles.
11110 If N is a negative number, save the N previous articles.
11111 If N is nil and any articles have been marked with the process mark,
11112 save those articles instead."
11114 (require 'gnus-art
)
11115 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
11116 (gnus-summary-save-article arg
)))
11118 (defun gnus-summary-write-article-body-file (&optional arg
)
11119 "Write the current article body to a file, deleting the previous file.
11120 If N is a positive number, save the N next articles.
11121 If N is a negative number, save the N previous articles.
11122 If N is nil and any articles have been marked with the process mark,
11123 save those articles instead."
11125 (require 'gnus-art
)
11126 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file
))
11127 (gnus-summary-save-article arg
)))
11129 (defun gnus-summary-muttprint (&optional arg
)
11130 "Print the current article using Muttprint.
11131 If N is a positive number, save the N next articles.
11132 If N is a negative number, save the N previous articles.
11133 If N is nil and any articles have been marked with the process mark,
11134 save those articles instead."
11136 (require 'gnus-art
)
11137 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint
))
11138 (gnus-summary-save-article arg t
)))
11140 (defun gnus-summary-pipe-message (program)
11141 "Pipe the current article through PROGRAM."
11142 (interactive "sProgram: ")
11143 (gnus-summary-select-article)
11144 (let ((mail-header-separator ""))
11145 (gnus-eval-in-buffer-window gnus-article-buffer
11148 (let ((start (window-start))
11150 (message-pipe-buffer-body program
)
11151 (set-window-start (get-buffer-window (current-buffer)) start
))))))
11153 (defun gnus-get-split-value (methods)
11154 "Return a value based on the split METHODS."
11155 (let (split-name method result match
)
11158 (set-buffer gnus-original-article-buffer
)
11160 (nnheader-narrow-to-headers)
11161 (while (and methods
(not split-name
))
11162 (goto-char (point-min))
11163 (setq method
(pop methods
))
11164 (setq match
(car method
))
11167 ;; Regular expression.
11169 (re-search-forward match nil t
)))
11174 (setq result
(funcall match gnus-newsgroup-name
))))
11179 (setq result
(eval match
)))))
11180 (setq split-name
(cdr method
))
11181 (cond ((stringp result
)
11182 (push (expand-file-name
11183 result gnus-article-save-directory
)
11186 (setq split-name
(append result split-name
)))))))))
11187 (nreverse split-name
)))
11189 (defun gnus-valid-move-group-p (group)
11190 (and (boundp group
)
11191 (symbol-name group
)
11192 (symbol-value group
)
11193 (gnus-get-function (gnus-find-method-for-group
11194 (symbol-name group
)) 'request-accept-article t
)))
11196 (defun gnus-read-move-group-name (prompt default articles prefix
)
11197 "Read a group name."
11198 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
11199 (minibuffer-confirm-incomplete nil
) ; XEmacs
11203 (if (> (length articles
) 1)
11204 (format "these %d articles" (length articles
))
11209 (gnus-completing-read-with-default
11212 'gnus-valid-move-group-p
11214 'gnus-group-history
))
11215 ((= 1 (length split-name
))
11216 (gnus-completing-read-with-default
11217 (car split-name
) prom
11219 'gnus-valid-move-group-p
11221 'gnus-group-history
))
11223 (gnus-completing-read-with-default
11225 (mapcar (lambda (el) (list el
))
11226 (nreverse split-name
))
11228 'gnus-group-history
))))
11229 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
11231 (if (or (string= to-newsgroup
"")
11232 (string= to-newsgroup prefix
))
11233 (setq to-newsgroup default
))
11234 (unless to-newsgroup
11235 (error "No group name entered"))
11236 (or (gnus-active to-newsgroup
)
11237 (gnus-activate-group to-newsgroup nil nil to-method
)
11238 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11240 (or (and (gnus-request-create-group to-newsgroup to-method
)
11241 (gnus-activate-group
11242 to-newsgroup nil nil to-method
)
11243 (gnus-subscribe-group to-newsgroup
))
11244 (error "Couldn't create group %s" to-newsgroup
)))
11245 (error "No such group: %s" to-newsgroup
)))
11248 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
11249 "Save parts matching TYPE to DIR.
11250 If REVERSE, save parts that do not match TYPE."
11252 (list (read-string "Save parts of type: "
11253 (or (car gnus-summary-save-parts-type-history
)
11254 gnus-summary-save-parts-default-mime
)
11255 'gnus-summary-save-parts-type-history
)
11256 (setq gnus-summary-save-parts-last-directory
11257 (read-file-name "Save to directory: "
11258 gnus-summary-save-parts-last-directory
11260 current-prefix-arg
))
11261 (gnus-summary-iterate n
11262 (let ((gnus-display-mime-function nil
)
11263 (gnus-inhibit-treatment t
))
11264 (gnus-summary-select-article))
11266 (set-buffer gnus-article-buffer
)
11267 (let ((handles (or gnus-article-mime-handles
11268 (mm-dissect-buffer nil gnus-article-loose-mime
)
11269 (and gnus-article-emulate-mime
11270 (mm-uu-dissect)))))
11272 (gnus-summary-save-parts-1 type dir handles reverse
)
11273 (unless gnus-article-mime-handles
;; Don't destroy this case.
11274 (mm-destroy-parts handles
)))))))
11276 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
11277 (if (stringp (car handle
))
11278 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
11281 (not (string-match type
(mm-handle-media-type handle
)))
11282 (string-match type
(mm-handle-media-type handle
)))
11283 (let ((file (expand-file-name
11285 mm-file-name-rewrite-functions
11286 (file-name-nondirectory
11288 (mail-content-type-get
11289 (mm-handle-disposition handle
) 'filename
)
11290 (mail-content-type-get
11291 (mm-handle-type handle
) 'name
)
11292 (concat gnus-newsgroup-name
11293 "." (number-to-string
11294 (cdr gnus-article-current
))))))
11296 (unless (file-exists-p file
)
11297 (mm-save-part-to-file handle file
))))))
11299 ;; Summary extract commands
11301 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
11302 (let ((buffer-read-only nil
)
11303 (article (gnus-summary-article-number))
11305 (unless (gnus-summary-goto-subject article
)
11306 (error "No such article: %d" article
))
11307 (gnus-summary-position-point)
11308 ;; If all commands are to be bunched up on one line, we collect
11310 (unless gnus-view-pseudos-separately
11311 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
11314 (setq action
(cdr (assq 'action
(car ps
))))
11315 (setq files
(list (cdr (assq 'name
(car ps
)))))
11316 (while (and ps
(cdr ps
)
11317 (string= (or action
"1")
11318 (or (cdr (assq 'action
(cadr ps
))) "2")))
11319 (push (cdr (assq 'name
(cadr ps
))) files
)
11320 (setcdr ps
(cddr ps
)))
11322 (when (not (string-match "%s" action
))
11325 (when (assq 'execute
(car ps
))
11326 (setcdr (assq 'execute
(car ps
))
11327 (funcall (if (string-match "%s" action
)
11336 (setq ps
(cdr ps
)))))
11337 (if (and gnus-view-pseudos
(not not-view
))
11339 (when (assq 'execute
(car pslist
))
11340 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
11341 (eq gnus-view-pseudos
'not-confirm
)))
11342 (setq pslist
(cdr pslist
)))
11345 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
11346 (gnus-summary-article-number)))
11347 (gnus-summary-goto-subject after-article
)
11350 (insert " " (file-name-nondirectory
11351 (cdr (assq 'name
(car pslist
))))
11352 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
11354 (forward-line -
1) ; back to `b'
11355 (gnus-add-text-properties
11356 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
11357 gnus-mouse-face-prop gnus-mouse-face
))
11359 after-article gnus-reffed-article-number
11360 gnus-unread-mark b
(car pslist
) 0 (- e b
))
11361 (setq gnus-newsgroup-unreads
11362 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11363 gnus-reffed-article-number
))
11364 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
11365 (setq pslist
(cdr pslist
)))))))
11367 (defun gnus-pseudos< (p1 p2
)
11368 (let ((c1 (cdr (assq 'action p1
)))
11369 (c2 (cdr (assq 'action p2
))))
11370 (and c1 c2
(string< c1 c2
))))
11372 (defun gnus-request-pseudo-article (props)
11373 (cond ((assq 'execute props
)
11374 (gnus-execute-command (cdr (assq 'execute props
)))))
11375 (let ((gnus-current-article (gnus-summary-article-number)))
11376 (gnus-run-hooks 'gnus-mark-article-hook
)))
11378 (defun gnus-execute-command (command &optional automatic
)
11380 (gnus-article-setup-buffer)
11381 (set-buffer gnus-article-buffer
)
11382 (setq buffer-read-only nil
)
11383 (let ((command (if automatic command
11384 (read-string "Command: " (cons command
0)))))
11386 (insert "$ " command
"\n\n")
11387 (if gnus-view-pseudo-asynchronously
11388 (start-process "gnus-execute" (current-buffer) shell-file-name
11389 shell-command-switch command
)
11390 (call-process shell-file-name nil t nil
11391 shell-command-switch command
)))))
11393 ;; Summary kill commands.
11395 (defun gnus-summary-edit-global-kill (article)
11396 "Edit the \"global\" kill file."
11397 (interactive (list (gnus-summary-article-number)))
11398 (gnus-group-edit-global-kill article
))
11400 (defun gnus-summary-edit-local-kill ()
11401 "Edit a local kill file applied to the current newsgroup."
11403 (setq gnus-current-headers
(gnus-summary-article-header))
11404 (gnus-group-edit-local-kill
11405 (gnus-summary-article-number) gnus-newsgroup-name
))
11407 ;;; Header reading.
11409 (defun gnus-read-header (id &optional header
)
11410 "Read the headers of article ID and enter them into the Gnus system."
11411 (let ((group gnus-newsgroup-name
)
11412 (gnus-override-method
11414 gnus-override-method
11415 (and (gnus-news-group-p gnus-newsgroup-name
)
11416 (car (gnus-refer-article-methods)))))
11418 ;; First we check to see whether the header in question is already
11421 ;; This is a Message-ID.
11422 (setq header
(or header
(gnus-id-to-header id
)))
11423 ;; This is an article number.
11424 (setq header
(or header
(gnus-summary-article-header id
))))
11426 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
11427 ;; We have found the header.
11429 ;; We have to really fetch the header to this article.
11431 (set-buffer nntp-server-buffer
)
11432 (when (setq where
(gnus-request-head id group
))
11433 (nnheader-fold-continuation-lines)
11434 (goto-char (point-max))
11436 (goto-char (point-min))
11440 ((cdr where
) (cdr where
))
11441 (header (mail-header-number header
))
11442 (t gnus-reffed-article-number
))
11444 (insert " Article retrieved.\n"))
11445 (if (or (not where
)
11446 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
11447 () ; Malformed head.
11448 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
11449 (when (and (stringp id
)
11450 (not (string= (gnus-group-real-name group
)
11452 ;; If we fetched by Message-ID and the article came
11453 ;; from a different group, we fudge some bogus article
11454 ;; numbers for this article.
11455 (mail-header-set-number header gnus-reffed-article-number
))
11457 (set-buffer gnus-summary-buffer
)
11458 (decf gnus-reffed-article-number
)
11459 (gnus-remove-header (mail-header-number header
))
11460 (push header gnus-newsgroup-headers
)
11461 (setq gnus-current-headers header
)
11462 (push (mail-header-number header
) gnus-newsgroup-limit
)))
11465 (defun gnus-remove-header (number)
11466 "Remove header NUMBER from `gnus-newsgroup-headers'."
11467 (if (and gnus-newsgroup-headers
11468 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
11469 (pop gnus-newsgroup-headers
)
11470 (let ((headers gnus-newsgroup-headers
))
11471 (while (and (cdr headers
)
11472 (not (= number
(mail-header-number (cadr headers
)))))
11474 (when (cdr headers
)
11475 (setcdr headers
(cddr headers
))))))
11478 ;;; summary highlights
11481 (defun gnus-highlight-selected-summary ()
11482 "Highlight selected article in summary buffer."
11483 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11484 (when gnus-summary-selected-face
11486 (let* ((beg (gnus-point-at-bol))
11487 (end (gnus-point-at-eol))
11488 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11489 (from (if (get-text-property beg gnus-mouse-face-prop
)
11491 (or (next-single-property-change
11492 beg gnus-mouse-face-prop nil end
)
11497 (or (next-single-property-change
11498 from gnus-mouse-face-prop nil end
)
11500 ;; If no mouse-face prop on line we will have to = from = end,
11501 ;; so we highlight the entire line instead.
11502 (when (= (+ to
2) from
)
11505 (if gnus-newsgroup-selected-overlay
11506 ;; Move old overlay.
11508 gnus-newsgroup-selected-overlay from to
(current-buffer))
11509 ;; Create new overlay.
11511 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
11512 'face gnus-summary-selected-face
))))))
11514 (defvar gnus-summary-highlight-line-cached nil
)
11515 (defvar gnus-summary-highlight-line-trigger nil
)
11517 (defun gnus-summary-highlight-line-0 ()
11518 (if (and (eq gnus-summary-highlight-line-trigger
11519 gnus-summary-highlight
)
11520 gnus-summary-highlight-line-cached
)
11521 gnus-summary-highlight-line-cached
11522 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11523 gnus-summary-highlight-line-cached
11524 (let* ((cond (list 'cond
))
11526 (list gnus-summary-highlight
))
11528 (setcdr c
(cons (list (caar list
) (list 'quote
(cdar list
)))
11532 (gnus-byte-compile (list 'lambda nil cond
))))))
11534 (defun gnus-summary-highlight-line ()
11535 "Highlight current line according to `gnus-summary-highlight'."
11536 (let* ((beg (gnus-point-at-bol))
11537 (article (or (gnus-summary-article-number) gnus-current-article
))
11538 (score (or (cdr (assq article
11539 gnus-newsgroup-scored
))
11540 gnus-summary-default-score
0))
11541 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
11542 (inhibit-read-only t
)
11543 (default gnus-summary-default-score
)
11544 (default-high gnus-summary-default-high-score
)
11545 (default-low gnus-summary-default-low-score
)
11546 (uncached (and gnus-summary-use-undownloaded-faces
11547 (memq article gnus-newsgroup-undownloaded
)
11548 (not (memq article gnus-newsgroup-cached
)))))
11549 (let ((face (funcall (gnus-summary-highlight-line-0))))
11550 (unless (eq face
(get-text-property beg
'face
))
11551 (gnus-put-text-property-excluding-characters-with-faces
11552 beg
(gnus-point-at-eol) 'face
11553 (setq face
(if (boundp face
) (symbol-value face
) face
)))
11554 (when gnus-summary-highlight-line-function
11555 (funcall gnus-summary-highlight-line-function article face
))))))
11557 (defun gnus-update-read-articles (group unread
&optional compute
)
11558 "Update the list of read articles in GROUP.
11559 UNREAD is a sorted list."
11560 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
11561 (entry (gnus-gethash group gnus-newsrc-hashtb
))
11562 (info (nth 2 entry
))
11565 (if (or (not info
) (not active
))
11566 ;; There is no info on this group if it was, in fact,
11567 ;; killed. Gnus stores no information on killed groups, so
11568 ;; there's nothing to be done.
11569 ;; One could store the information somewhere temporarily,
11570 ;; perhaps... Hmmm...
11572 ;; Remove any negative articles numbers.
11573 (while (and unread
(< (car unread
) 0))
11574 (setq unread
(cdr unread
)))
11575 ;; Remove any expired article numbers
11576 (while (and unread
(< (car unread
) (car active
)))
11577 (setq unread
(cdr unread
)))
11578 ;; Compute the ranges of read articles by looking at the list of
11579 ;; unread articles.
11581 (when (/= (car unread
) prev
)
11582 (push (if (= prev
(1- (car unread
))) prev
11583 (cons prev
(1- (car unread
))))
11585 (setq prev
(1+ (car unread
)))
11586 (setq unread
(cdr unread
)))
11587 (when (<= prev
(cdr active
))
11588 (push (cons prev
(cdr active
)) read
))
11589 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
11594 ;; Propagate the read marks to the backend.
11595 (when (gnus-check-backend-function 'request-set-mark group
)
11596 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
11597 (add (gnus-remove-from-range read
(gnus-info-read info
))))
11599 (unless (gnus-check-group group
)
11600 (error "Can't open server for %s" group
))
11601 (gnus-request-set-mark
11602 group
(delq nil
(list (if add
(list add
'add
'(read)))
11603 (if del
(list del
'del
'(read))))))
11605 `(gnus-request-set-mark
11608 (if del
(list del
'add
'(read)))
11609 (if add
(list add
'del
'(read))))))))))
11610 (set-buffer gnus-group-buffer
)
11611 (gnus-undo-register
11613 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
11614 (gnus-info-set-read ',info
',(gnus-info-read info
))
11615 (gnus-get-unread-articles-in-group ',info
11616 (gnus-active ,group
))
11617 (gnus-group-update-group ,group t
)
11619 ;; Enter this list into the group info.
11620 (gnus-info-set-read info read
)
11621 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11622 (gnus-get-unread-articles-in-group info
(gnus-active group
))
11625 (defun gnus-offer-save-summaries ()
11626 "Offer to save all active summary buffers."
11628 ;; Go through all buffers and find all summaries.
11629 (dolist (buffer (buffer-list))
11630 (when (and (setq buffer
(buffer-name buffer
))
11631 (string-match "Summary" buffer
)
11633 (set-buffer buffer
)
11634 ;; We check that this is, indeed, a summary buffer.
11635 (and (eq major-mode
'gnus-summary-mode
)
11636 ;; Also make sure this isn't bogus.
11637 gnus-newsgroup-prepared
11638 ;; Also make sure that this isn't a
11639 ;; dead summary buffer.
11640 (not gnus-dead-summary-mode
))))
11641 (push buffer buffers
)))
11642 ;; Go through all these summary buffers and offer to save them.
11646 "Update summary buffer %s? "
11648 (switch-to-buffer buf
)
11649 (gnus-summary-exit))
11652 (defun gnus-summary-setup-default-charset ()
11653 "Setup newsgroup default charset."
11654 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
11655 (setq gnus-newsgroup-charset nil
)
11656 (let* ((ignored-charsets
11657 (or gnus-newsgroup-ephemeral-ignored-charsets
11659 (and gnus-newsgroup-name
11660 (gnus-parameter-ignored-charsets gnus-newsgroup-name
))
11661 gnus-newsgroup-ignored-charsets
))))
11662 (setq gnus-newsgroup-charset
11663 (or gnus-newsgroup-ephemeral-charset
11664 (and gnus-newsgroup-name
11665 (gnus-parameter-charset gnus-newsgroup-name
))
11666 gnus-default-charset
))
11667 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
11668 ignored-charsets
))))
11674 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
11675 "Display the current article buffer fully MIME-buttonized.
11676 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11677 treated as multipart/mixed."
11679 (require 'gnus-art
)
11680 (let ((gnus-unbuttonized-mime-types nil
)
11681 (gnus-mime-display-multipart-as-mixed show-all-parts
))
11682 (gnus-summary-show-article)))
11684 (defun gnus-summary-repair-multipart (article)
11685 "Add a Content-Type header to a multipart article without one."
11686 (interactive (list (gnus-summary-article-number)))
11687 (gnus-with-article article
11688 (message-narrow-to-head)
11689 (message-remove-header "Mime-Version")
11690 (goto-char (point-max))
11691 (insert "Mime-Version: 1.0\n")
11693 (when (search-forward "\n--" nil t
)
11694 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11695 (message-narrow-to-head)
11696 (message-remove-header "Content-Type")
11697 (goto-char (point-max))
11698 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11701 (let (gnus-mark-article-hook)
11702 (gnus-summary-select-article t t nil article
)))
11704 (defun gnus-summary-toggle-display-buttonized ()
11705 "Toggle the buttonizing of the article buffer."
11707 (require 'gnus-art
)
11708 (if (setq gnus-inhibit-mime-unbuttonizing
11709 (not gnus-inhibit-mime-unbuttonizing
))
11710 (let ((gnus-unbuttonized-mime-types nil
))
11711 (gnus-summary-show-article))
11712 (gnus-summary-show-article)))
11715 ;;; Generic summary marking commands
11718 (defvar gnus-summary-marking-alist
11719 '((read gnus-del-mark
"d")
11720 (unread gnus-unread-mark
"u")
11721 (ticked gnus-ticked-mark
"!")
11722 (dormant gnus-dormant-mark
"?")
11723 (expirable gnus-expirable-mark
"e"))
11724 "An alist of names/marks/keystrokes.")
11726 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
11727 (defvar gnus-summary-mark-map
)
11729 (defun gnus-summary-make-all-marking-commands ()
11730 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
11731 (dolist (elem gnus-summary-marking-alist
)
11732 (apply 'gnus-summary-make-marking-command elem
)))
11734 (defun gnus-summary-make-marking-command (name mark keystroke
)
11735 (let ((map (make-sparse-keymap)))
11736 (define-key gnus-summary-generic-mark-map keystroke map
)
11737 (dolist (lway `((next "next" next nil
"n")
11738 (next-unread "next unread" next t
"N")
11739 (prev "previous" prev nil
"p")
11740 (prev-unread "previous unread" prev t
"P")
11741 (nomove "" nil nil
,keystroke
)))
11742 (let ((func (gnus-summary-make-marking-command-1
11743 mark
(car lway
) lway name
)))
11744 (setq func
(eval func
))
11745 (define-key map
(nth 4 lway
) func
)))))
11747 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
11749 (format "gnus-summary-put-mark-as-%s%s"
11750 name
(if (eq way
'nomove
)
11752 (concat "-" (symbol-name way
)))))
11755 "Mark the current article as %s%s.
11756 If N, the prefix, then repeat N times.
11757 If N is negative, move in reverse order.
11758 The difference between N and the actual number of articles marked is
11762 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
11764 (defun gnus-summary-generic-mark (n mark move unread
)
11765 "Mark N articles with MARK."
11766 (unless (eq major-mode
'gnus-summary-mode
)
11767 (error "This command can only be used in the summary buffer"))
11768 (gnus-summary-show-thread)
11771 ((eq move
'next
) 1)
11772 ((eq move
'prev
) -
1)
11774 (if (zerop nummove
)
11778 nummove
(* -
1 nummove
))))
11779 (while (and (> n
0)
11780 (gnus-summary-mark-article nil mark
)
11781 (zerop (gnus-summary-next-subject nummove unread t
)))
11784 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
11785 (gnus-summary-recenter)
11786 (gnus-summary-position-point)
11787 (gnus-set-mode-line 'summary
)
11790 (defun gnus-summary-insert-articles (articles)
11791 (when (setq articles
11792 (gnus-sorted-difference articles
11793 (mapcar (lambda (h)
11794 (mail-header-number h
))
11795 gnus-newsgroup-headers
)))
11796 (setq gnus-newsgroup-headers
11798 gnus-newsgroup-headers
11799 (gnus-fetch-headers articles
)
11800 'gnus-article-sort-by-number
))
11801 ;; Suppress duplicates?
11802 (when gnus-suppress-duplicates
11803 (gnus-dup-suppress-articles))
11805 ;; We might want to build some more threads first.
11806 (when (and gnus-fetch-old-headers
11807 (eq gnus-headers-retrieved-by
'nov
))
11808 (if (eq gnus-fetch-old-headers
'invisible
)
11809 (gnus-build-all-threads)
11810 (gnus-build-old-threads)))
11811 ;; Let the Gnus agent mark articles as read.
11813 (gnus-agent-get-undownloaded-list))
11814 ;; Remove list identifiers from subject
11815 (when gnus-list-identifiers
11816 (gnus-summary-remove-list-identifiers))
11817 ;; First and last article in this newsgroup.
11818 (when gnus-newsgroup-headers
11819 (setq gnus-newsgroup-begin
11820 (mail-header-number (car gnus-newsgroup-headers
))
11822 (mail-header-number
11823 (gnus-last-element gnus-newsgroup-headers
))))
11824 (when gnus-use-scoring
11825 (gnus-possibly-score-headers))))
11827 (defun gnus-summary-insert-old-articles (&optional all
)
11828 "Insert all old articles in this group.
11829 If ALL is non-nil, already read articles become readable.
11830 If ALL is a number, fetch this number of articles."
11833 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11836 ;; Some nntp servers lie about their active range. When
11837 ;; this happens, the active range can be in the millions.
11838 ;; Use a compressed range to avoid creating a huge list.
11839 (gnus-range-difference (list gnus-newsgroup-active
) old
))
11840 (setq len
(gnus-range-length older
))
11845 (let ((older-range (nreverse older
)))
11849 (let* ((r (pop older-range
))
11850 (min (if (numberp r
) r
(car r
)))
11851 (max (if (numberp r
) r
(cdr r
))))
11852 (while (and (<= min max
)
11857 (setq older
(gnus-uncompress-range older
))))
11859 (setq older
(gnus-uncompress-range older
)))
11861 (when (and (numberp gnus-large-newsgroup
)
11862 (> len gnus-large-newsgroup
))
11863 (let* ((cursor-in-echo-area nil
)
11864 (initial (gnus-parameter-large-newsgroup-initial
11865 gnus-newsgroup-name
))
11869 "How many articles from %s (%s %d): "
11871 (gnus-group-decoded-name gnus-newsgroup-name
) 35)
11872 (if initial
"max" "default")
11875 (cons (number-to-string initial
)
11877 (unless (string-match "^[ \t]*$" input
)
11878 (setq all
(string-to-number input
))
11880 (let ((older-range (nreverse older
)))
11884 (let* ((r (pop older-range
))
11885 (min (if (numberp r
) r
(car r
)))
11886 (max (if (numberp r
) r
(cdr r
))))
11887 (while (and (<= min max
)
11891 max
(1- max
))))))))))
11892 (setq older
(gnus-uncompress-range older
))))
11894 (message "No old news.")
11895 (gnus-summary-insert-articles older
)
11896 (gnus-summary-limit (gnus-sorted-nunion old older
))))
11897 (gnus-summary-position-point)))
11899 (defun gnus-summary-insert-new-articles ()
11900 "Insert all new articles in this group."
11903 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11904 (old-active gnus-newsgroup-active
)
11905 (nnmail-fetched-sources (list t
))
11907 (setq gnus-newsgroup-active
11908 (gnus-activate-group gnus-newsgroup-name
'scan
))
11909 (setq i
(cdr gnus-newsgroup-active
))
11910 (while (> i
(cdr old-active
))
11914 (message "No gnus is bad news.")
11915 (gnus-summary-insert-articles new
)
11916 (setq gnus-newsgroup-unreads
11917 (gnus-sorted-nunion gnus-newsgroup-unreads new
))
11918 (gnus-summary-limit (gnus-sorted-nunion old new
))))
11919 (gnus-summary-position-point)))
11921 (gnus-summary-make-all-marking-commands)
11923 (gnus-ems-redefine)
11925 (provide 'gnus-sum
)
11927 (run-hooks 'gnus-sum-load-hook
)
11929 ;; Local Variables:
11930 ;; coding: iso-8859-1
11933 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11934 ;;; gnus-sum.el ends here