1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (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 an article on group entry.
308 An article is selected automatically when entering a group
309 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
310 `gnus-summary-catchup-and-goto-next-group'.
312 Which article is selected is controlled by the variable
313 `gnus-auto-select-subject'.
315 If you want to prevent automatic selection of articles in some
316 newsgroups, set the variable to nil in `gnus-select-group-hook'."
317 ;; Commands include...
318 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
319 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
320 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
321 :group
'gnus-group-select
322 :type
'(choice (const :tag
"none" nil
)
323 (sexp :menu-tag
"first" t
)))
325 (defcustom gnus-auto-select-subject
'unread
326 "*Says what subject to place under point when entering a group.
328 This variable can either be the symbols `first' (place point on the
329 first subject), `unread' (place point on the subject line of the first
330 unread article), `best' (place point on the subject line of the
331 higest-scored article), `unseen' (place point on the subject line of
332 the first unseen article), `unseen-or-unread' (place point on the subject
333 line of the first unseen article or, if all article have been seen, on the
334 subject line of the first unread article), or a function to be called to
335 place point on some subject line."
337 :group
'gnus-group-select
338 :type
'(choice (const best
)
342 (const unseen-or-unread
)))
344 (defcustom gnus-auto-select-next t
345 "*If non-nil, offer to go to the next group from the end of the previous.
346 If the value is t and the next newsgroup is empty, Gnus will exit
347 summary mode and go back to group mode. If the value is neither nil
348 nor t, Gnus will select the following unread newsgroup. In
349 particular, if the value is the symbol `quietly', the next unread
350 newsgroup will be selected without any confirmation, and if it is
351 `almost-quietly', the next group will be selected without any
352 confirmation if you are located on the last article in the group.
353 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
354 will go to the next group without confirmation."
355 :group
'gnus-summary-maneuvering
356 :type
'(choice (const :tag
"off" nil
)
358 (const almost-quietly
)
359 (const slightly-quietly
)
360 (sexp :menu-tag
"on" t
)))
362 (defcustom gnus-auto-select-same nil
363 "*If non-nil, select the next article with the same subject.
364 If there are no more articles with the same subject, go to
365 the first unread article."
366 :group
'gnus-summary-maneuvering
369 (defcustom gnus-auto-goto-ignores
'unfetched
370 "*Says how to handle unfetched articles when maneuvering.
372 This variable can either be the symbols nil (maneuver to any
373 article), `undownloaded' (maneuvering while unplugged ignores articles
374 that have not been fetched), `always-undownloaded' (maneuvering always
375 ignores articles that have not been fetched), `unfetched' (maneuvering
376 ignores articles whose headers have not been fetched).
378 NOTE: The list of unfetched articles will always be nil when plugged
379 and, when unplugged, a subset of the undownloaded article list."
381 :group
'gnus-summary-maneuvering
382 :type
'(choice (const :tag
"None" nil
)
383 (const :tag
"Undownloaded when unplugged" undownloaded
)
384 (const :tag
"Undownloaded" always-undownloaded
)
385 (const :tag
"Unfetched" unfetched
)))
387 (defcustom gnus-summary-check-current nil
388 "*If non-nil, consider the current article when moving.
389 The \"unread\" movement commands will stay on the same line if the
390 current article is unread."
391 :group
'gnus-summary-maneuvering
394 (defcustom gnus-auto-center-summary t
395 "*If non-nil, always center the current summary buffer.
396 In particular, if `vertical' do only vertical recentering. If non-nil
397 and non-`vertical', do both horizontal and vertical recentering."
398 :group
'gnus-summary-maneuvering
399 :type
'(choice (const :tag
"none" nil
)
401 (integer :tag
"height")
402 (sexp :menu-tag
"both" t
)))
404 (defvar gnus-auto-center-group t
405 "*If non-nil, always center the group buffer.")
407 (defcustom gnus-show-all-headers nil
408 "*If non-nil, don't hide any headers."
409 :group
'gnus-article-hiding
410 :group
'gnus-article-headers
413 (defcustom gnus-summary-ignore-duplicates nil
414 "*If non-nil, ignore articles with identical Message-ID headers."
418 (defcustom gnus-single-article-buffer t
419 "*If non-nil, display all articles in the same buffer.
420 If nil, each group will get its own article buffer."
421 :group
'gnus-article-various
424 (defcustom gnus-break-pages t
425 "*If non-nil, do page breaking on articles.
426 The page delimiter is specified by the `gnus-page-delimiter'
428 :group
'gnus-article-various
431 (defcustom gnus-move-split-methods nil
432 "*Variable used to suggest where articles are to be moved to.
433 It uses the same syntax as the `gnus-split-methods' variable.
434 However, whereas `gnus-split-methods' specifies file names as targets,
435 this variable specifies group names."
436 :group
'gnus-summary-mail
437 :type
'(repeat (choice (list :value
(fun) function
)
438 (cons :value
("" "") regexp
(repeat string
))
441 ;; FIXME: Although the custom type is `character' for the following variables,
442 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
444 (defcustom gnus-unread-mark ?
;Whitespace
445 "*Mark used for unread articles."
446 :group
'gnus-summary-marks
449 (defcustom gnus-ticked-mark ?
!
450 "*Mark used for ticked articles."
451 :group
'gnus-summary-marks
454 (defcustom gnus-dormant-mark ??
455 "*Mark used for dormant articles."
456 :group
'gnus-summary-marks
459 (defcustom gnus-del-mark ?r
460 "*Mark used for del'd articles."
461 :group
'gnus-summary-marks
464 (defcustom gnus-read-mark ?R
465 "*Mark used for read articles."
466 :group
'gnus-summary-marks
469 (defcustom gnus-expirable-mark ?E
470 "*Mark used for expirable articles."
471 :group
'gnus-summary-marks
474 (defcustom gnus-killed-mark ?K
475 "*Mark used for killed articles."
476 :group
'gnus-summary-marks
479 (defcustom gnus-spam-mark ?$
480 "*Mark used for spam articles."
482 :group
'gnus-summary-marks
485 (defcustom gnus-souped-mark ?F
486 "*Mark used for souped articles."
487 :group
'gnus-summary-marks
490 (defcustom gnus-kill-file-mark ?X
491 "*Mark used for articles killed by kill files."
492 :group
'gnus-summary-marks
495 (defcustom gnus-low-score-mark ?Y
496 "*Mark used for articles with a low score."
497 :group
'gnus-summary-marks
500 (defcustom gnus-catchup-mark ?C
501 "*Mark used for articles that are caught up."
502 :group
'gnus-summary-marks
505 (defcustom gnus-replied-mark ?A
506 "*Mark used for articles that have been replied to."
507 :group
'gnus-summary-marks
510 (defcustom gnus-forwarded-mark ?F
511 "*Mark used for articles that have been forwarded."
513 :group
'gnus-summary-marks
516 (defcustom gnus-recent-mark ?N
517 "*Mark used for articles that are recent."
519 :group
'gnus-summary-marks
522 (defcustom gnus-cached-mark ?
*
523 "*Mark used for articles that are in the cache."
524 :group
'gnus-summary-marks
527 (defcustom gnus-saved-mark ?S
528 "*Mark used for articles that have been saved."
529 :group
'gnus-summary-marks
532 (defcustom gnus-unseen-mark ?.
533 "*Mark used for articles that haven't been seen."
535 :group
'gnus-summary-marks
538 (defcustom gnus-no-mark ?
;Whitespace
539 "*Mark used for articles that have no other secondary mark."
541 :group
'gnus-summary-marks
544 (defcustom gnus-ancient-mark ?O
545 "*Mark used for ancient articles."
546 :group
'gnus-summary-marks
549 (defcustom gnus-sparse-mark ?Q
550 "*Mark used for sparsely reffed articles."
551 :group
'gnus-summary-marks
554 (defcustom gnus-canceled-mark ?G
555 "*Mark used for canceled articles."
556 :group
'gnus-summary-marks
559 (defcustom gnus-duplicate-mark ?M
560 "*Mark used for duplicate articles."
561 :group
'gnus-summary-marks
564 (defcustom gnus-undownloaded-mark ?-
565 "*Mark used for articles that weren't downloaded."
567 :group
'gnus-summary-marks
570 (defcustom gnus-downloaded-mark ?
+
571 "*Mark used for articles that were downloaded."
572 :group
'gnus-summary-marks
575 (defcustom gnus-downloadable-mark ?%
576 "*Mark used for articles that are to be downloaded."
577 :group
'gnus-summary-marks
580 (defcustom gnus-unsendable-mark ?
=
581 "*Mark used for articles that won't be sent."
582 :group
'gnus-summary-marks
585 (defcustom gnus-score-over-mark ?
+
586 "*Score mark used for articles with high scores."
587 :group
'gnus-summary-marks
590 (defcustom gnus-score-below-mark ?-
591 "*Score mark used for articles with low scores."
592 :group
'gnus-summary-marks
595 (defcustom gnus-empty-thread-mark ?
;Whitespace
596 "*There is no thread under the article."
597 :group
'gnus-summary-marks
600 (defcustom gnus-not-empty-thread-mark ?
=
601 "*There is a thread under the article."
602 :group
'gnus-summary-marks
605 (defcustom gnus-view-pseudo-asynchronously nil
606 "*If non-nil, Gnus will view pseudo-articles asynchronously."
607 :group
'gnus-extract-view
610 (defcustom gnus-auto-expirable-marks
611 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
612 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
613 gnus-souped-mark gnus-duplicate-mark
)
614 "*The list of marks converted into expiration if a group is auto-expirable."
617 :type
'(repeat character
))
619 (defcustom gnus-inhibit-user-auto-expire t
620 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
625 (defcustom gnus-view-pseudos nil
626 "*If `automatic', pseudo-articles will be viewed automatically.
627 If `not-confirm', pseudos will be viewed automatically, and the user
628 will not be asked to confirm the command."
629 :group
'gnus-extract-view
630 :type
'(choice (const :tag
"off" nil
)
632 (const not-confirm
)))
634 (defcustom gnus-view-pseudos-separately t
635 "*If non-nil, one pseudo-article will be created for each file to be viewed.
636 If nil, all files that use the same viewing command will be given as a
637 list of parameters to that command."
638 :group
'gnus-extract-view
641 (defcustom gnus-insert-pseudo-articles t
642 "*If non-nil, insert pseudo-articles when decoding articles."
643 :group
'gnus-extract-view
646 (defcustom gnus-summary-dummy-line-format
648 "*The format specification for the dummy roots in the summary buffer.
649 It works along the same lines as a normal formatting string,
650 with some simple extensions.
654 General format specifiers can also be used.
655 See `(gnus)Formatting Variables'."
656 :link
'(custom-manual "(gnus)Formatting Variables")
657 :group
'gnus-threading
660 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
661 "*The format specification for the summary mode line.
662 It works along the same lines as a normal formatting string,
663 with some simple extensions:
666 %p Unprefixed group name
667 %A Current article number
668 %z Current article score
670 %U Number of unread articles in the group
671 %e Number of unselected articles in the group
672 %Z A string with unread/unselected article counts
673 %g Shortish group name
674 %S Subject of the current article
676 %s Current score file name
677 %d Number of dormant articles
678 %r Number of articles that have been marked as read in this session
679 %E Number of articles expunged by the score files"
680 :group
'gnus-summary-format
683 (defcustom gnus-list-identifiers nil
684 "Regexp that matches list identifiers to be removed from subject.
685 This can also be a list of regexps."
687 :group
'gnus-summary-format
688 :group
'gnus-article-hiding
689 :type
'(choice (const :tag
"none" nil
)
691 (repeat :value
(".*") regexp
)))
693 (defcustom gnus-summary-mark-below
0
694 "*Mark all articles with a score below this variable as read.
695 This variable is local to each summary buffer and usually set by the
697 :group
'gnus-score-default
700 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
701 "*List of functions used for sorting articles in the summary buffer.
703 Each function takes two articles and returns non-nil if the first
704 article should be sorted before the other. If you use more than one
705 function, the primary sort function should be the last. You should
706 probably always include `gnus-article-sort-by-number' in the list of
707 sorting functions -- preferably first. Also note that sorting by date
708 is often much slower than sorting by number, and the sorting order is
709 very similar. (Sorting by date means sorting by the time the message
710 was sent, sorting by number means sorting by arrival time.)
712 Ready-made functions include `gnus-article-sort-by-number',
713 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
714 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
715 and `gnus-article-sort-by-score'.
717 When threading is turned on, the variable `gnus-thread-sort-functions'
718 controls how articles are sorted."
719 :group
'gnus-summary-sort
720 :type
'(repeat (choice (function-item gnus-article-sort-by-number
)
721 (function-item gnus-article-sort-by-author
)
722 (function-item gnus-article-sort-by-subject
)
723 (function-item gnus-article-sort-by-date
)
724 (function-item gnus-article-sort-by-score
)
725 (function-item gnus-article-sort-by-random
)
726 (function :tag
"other"))))
728 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
729 "*List of functions used for sorting threads in the summary buffer.
730 By default, threads are sorted by article number.
732 Each function takes two threads and returns non-nil if the first
733 thread should be sorted before the other. If you use more than one
734 function, the primary sort function should be the last. You should
735 probably always include `gnus-thread-sort-by-number' in the list of
736 sorting functions -- preferably first. Also note that sorting by date
737 is often much slower than sorting by number, and the sorting order is
738 very similar. (Sorting by date means sorting by the time the message
739 was sent, sorting by number means sorting by arrival time.)
741 Ready-made functions include `gnus-thread-sort-by-number',
742 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
743 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
744 `gnus-thread-sort-by-most-recent-number',
745 `gnus-thread-sort-by-most-recent-date',
746 `gnus-thread-sort-by-random', and
747 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
749 When threading is turned off, the variable
750 `gnus-article-sort-functions' controls how articles are sorted."
751 :group
'gnus-summary-sort
752 :type
'(repeat (choice (function-item gnus-thread-sort-by-number
)
753 (function-item gnus-thread-sort-by-author
)
754 (function-item gnus-thread-sort-by-subject
)
755 (function-item gnus-thread-sort-by-date
)
756 (function-item gnus-thread-sort-by-score
)
757 (function-item gnus-thread-sort-by-total-score
)
758 (function-item gnus-thread-sort-by-random
)
759 (function :tag
"other"))))
761 (defcustom gnus-thread-score-function
'+
762 "*Function used for calculating the total score of a thread.
764 The function is called with the scores of the article and each
765 subthread and should then return the score of the thread.
767 Some functions you can use are `+', `max', or `min'."
768 :group
'gnus-summary-sort
771 (defcustom gnus-summary-expunge-below nil
772 "All articles that have a score less than this variable will be expunged.
773 This variable is local to the summary buffers."
774 :group
'gnus-score-default
775 :type
'(choice (const :tag
"off" nil
)
778 (defcustom gnus-thread-expunge-below nil
779 "All threads that have a total score less than this variable will be expunged.
780 See `gnus-thread-score-function' for en explanation of what a
783 This variable is local to the summary buffers."
784 :group
'gnus-threading
785 :group
'gnus-score-default
786 :type
'(choice (const :tag
"off" nil
)
789 (defcustom gnus-summary-mode-hook nil
790 "*A hook for Gnus summary mode.
791 This hook is run before any variables are set in the summary buffer."
792 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
793 :group
'gnus-summary-various
796 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
797 (when (featurep 'xemacs
)
798 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-summary-menu-add
)
799 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-setup-summary-toolbar
)
800 (add-hook 'gnus-summary-mode-hook
801 'gnus-xmas-switch-horizontal-scrollbar-off
))
803 (defcustom gnus-summary-menu-hook nil
804 "*Hook run after the creation of the summary mode menu."
805 :group
'gnus-summary-visual
808 (defcustom gnus-summary-exit-hook nil
809 "*A hook called on exit from the summary buffer.
810 It will be called with point in the group buffer."
811 :group
'gnus-summary-exit
814 (defcustom gnus-summary-prepare-hook nil
815 "*A hook called after the summary buffer has been generated.
816 If you want to modify the summary buffer, you can use this hook."
817 :group
'gnus-summary-various
820 (defcustom gnus-summary-prepared-hook nil
821 "*A hook called as the last thing after the summary buffer has been generated."
822 :group
'gnus-summary-various
825 (defcustom gnus-summary-generate-hook nil
826 "*A hook run just before generating the summary buffer.
827 This hook is commonly used to customize threading variables and the
829 :group
'gnus-summary-various
832 (defcustom gnus-select-group-hook nil
833 "*A hook called when a newsgroup is selected.
835 If you'd like to simplify subjects like the
836 `gnus-summary-next-same-subject' command does, you can use the
839 (add-hook gnus-select-group-hook
841 (mapcar (lambda (header)
842 (mail-header-set-subject
844 (gnus-simplify-subject
845 (mail-header-subject header) 're-only)))
846 gnus-newsgroup-headers)))"
847 :group
'gnus-group-select
850 (defcustom gnus-select-article-hook nil
851 "*A hook called when an article is selected."
852 :group
'gnus-summary-choose
853 :options
'(gnus-agent-fetch-selected-article)
856 (defcustom gnus-visual-mark-article-hook
857 (list 'gnus-highlight-selected-summary
)
858 "*Hook run after selecting an article in the summary buffer.
859 It is meant to be used for highlighting the article in some way. It
860 is not run if `gnus-visual' is nil."
861 :group
'gnus-summary-visual
864 (defcustom gnus-parse-headers-hook nil
865 "*A hook called before parsing the headers."
869 (defcustom gnus-exit-group-hook nil
870 "*A hook called when exiting summary mode.
871 This hook is not called from the non-updating exit commands like `Q'."
875 (defcustom gnus-summary-update-hook
876 (list 'gnus-summary-highlight-line
)
877 "*A hook called when a summary line is changed.
878 The hook will not be called if `gnus-visual' is nil.
880 The default function `gnus-summary-highlight-line' will
881 highlight the line according to the `gnus-summary-highlight'
883 :group
'gnus-summary-visual
886 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
887 "*A hook called when an article is selected for the first time.
888 The hook is intended to mark an article as read (or unread)
889 automatically when it is selected."
890 :group
'gnus-summary-choose
893 (defcustom gnus-group-no-more-groups-hook nil
894 "*A hook run when returning to group mode having no more (unread) groups."
895 :group
'gnus-group-select
898 (defcustom gnus-ps-print-hook nil
899 "*A hook run before ps-printing something from Gnus."
903 (defcustom gnus-summary-article-move-hook nil
904 "*A hook called after an article is moved, copied, respooled, or crossposted."
909 (defcustom gnus-summary-article-delete-hook nil
910 "*A hook called after an article is deleted."
915 (defcustom gnus-summary-article-expire-hook nil
916 "*A hook called after an article is expired."
921 (defcustom gnus-summary-display-arrow
922 (and (fboundp 'display-graphic-p
)
924 "*If non-nil, display an arrow highlighting the current article."
929 (defcustom gnus-summary-selected-face
'gnus-summary-selected
930 "Face used for highlighting the current article in the summary buffer."
931 :group
'gnus-summary-visual
934 (defvar gnus-tmp-downloaded nil
)
936 (defcustom gnus-summary-highlight
937 '(((eq mark gnus-canceled-mark
)
938 . gnus-summary-cancelled
)
939 ((and uncached
(> score default-high
))
940 . gnus-summary-high-undownloaded
)
941 ((and uncached
(< score default-low
))
942 . gnus-summary-low-undownloaded
)
944 . gnus-summary-normal-undownloaded
)
945 ((and (> score default-high
)
946 (or (eq mark gnus-dormant-mark
)
947 (eq mark gnus-ticked-mark
)))
948 . gnus-summary-high-ticked
)
949 ((and (< score default-low
)
950 (or (eq mark gnus-dormant-mark
)
951 (eq mark gnus-ticked-mark
)))
952 . gnus-summary-low-ticked
)
953 ((or (eq mark gnus-dormant-mark
)
954 (eq mark gnus-ticked-mark
))
955 . gnus-summary-normal-ticked
)
956 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
957 . gnus-summary-high-ancient
)
958 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
959 . gnus-summary-low-ancient
)
960 ((eq mark gnus-ancient-mark
)
961 . gnus-summary-normal-ancient
)
962 ((and (> score default-high
) (eq mark gnus-unread-mark
))
963 . gnus-summary-high-unread
)
964 ((and (< score default-low
) (eq mark gnus-unread-mark
))
965 . gnus-summary-low-unread
)
966 ((eq mark gnus-unread-mark
)
967 . gnus-summary-normal-unread
)
968 ((> score default-high
)
969 . gnus-summary-high-read
)
970 ((< score default-low
)
971 . gnus-summary-low-read
)
973 . gnus-summary-normal-read
))
974 "*Controls the highlighting of summary buffer lines.
976 A list of (FORM . FACE) pairs. When deciding how a particular
977 summary line should be displayed, each form is evaluated. The content
978 of the face field after the first true form is used. You can change
979 how those summary lines are displayed, by editing the face field.
981 You can use the following variables in the FORM field.
983 score: The article's score.
984 default: The default article score.
985 default-high: The default score for high scored articles.
986 default-low: The default score for low scored articles.
987 below: The score below which articles are automatically marked as read.
988 mark: The article's mark.
989 uncached: Non-nil if the article is uncached."
990 :group
'gnus-summary-visual
991 :type
'(repeat (cons (sexp :tag
"Form" nil
)
994 (defcustom gnus-alter-header-function nil
995 "Function called to allow alteration of article header structures.
996 The function is called with one parameter, the article header vector,
997 which it may alter in any way."
998 :type
'(choice (const :tag
"None" nil
)
1000 :group
'gnus-summary
)
1002 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
1003 "Function used to decode a string with encoded words.")
1005 (defvar gnus-decode-encoded-address-function
1006 'mail-decode-encoded-address-string
1007 "Function used to decode addresses with encoded words.")
1009 (defcustom gnus-extra-headers
'(To Newsgroups
)
1010 "*Extra headers to parse."
1012 :group
'gnus-summary
1013 :type
'(repeat symbol
))
1015 (defcustom gnus-ignored-from-addresses
1016 (and user-mail-address
1017 (not (string= user-mail-address
""))
1018 (regexp-quote user-mail-address
))
1019 "*Regexp of From headers that may be suppressed in favor of To headers."
1021 :group
'gnus-summary
1024 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1025 "List of charsets that should be ignored.
1026 When these charsets are used in the \"charset\" parameter, the
1027 default charset will be used instead."
1029 :type
'(repeat symbol
)
1030 :group
'gnus-charset
)
1032 (defcustom gnus-newsgroup-maximum-articles nil
1033 "The maximum number of articles a newsgroup.
1034 If this is a number, old articles in a newsgroup exceeding this number
1035 are silently ignored. If it is nil, no article is ignored. Note that
1036 setting this variable to a number might prevent you from reading very
1038 :group
'gnus-group-select
1040 :type
'(choice (const :tag
"No limit" nil
)
1043 (gnus-define-group-parameter
1047 "Return the ignored charsets of GROUP."
1048 :variable gnus-group-ignored-charsets-alist
1050 '(("alt\\.chinese\\.text" iso-8859-1
))
1052 "Alist of regexps (to match group names) and charsets that should be ignored.
1053 When these charsets are used in the \"charset\" parameter, the
1054 default charset will be used instead."
1055 :variable-group gnus-charset
1056 :variable-type
'(repeat (cons (regexp :tag
"Group")
1058 :parameter-type
'(choice :tag
"Ignored charsets"
1061 :parameter-document
"\
1062 List of charsets that should be ignored.
1064 When these charsets are used in the \"charset\" parameter, the
1065 default charset will be used instead.")
1067 (defcustom gnus-group-highlight-words-alist nil
1068 "Alist of group regexps and highlight regexps.
1069 This variable uses the same syntax as `gnus-emphasis-alist'."
1071 :type
'(repeat (cons (regexp :tag
"Group")
1072 (repeat (list (regexp :tag
"Highlight regexp")
1073 (number :tag
"Group for entire word" 0)
1074 (number :tag
"Group for displayed part" 0)
1076 gnus-emphasis-highlight-words
)))))
1077 :group
'gnus-summary-visual
)
1079 (defcustom gnus-summary-show-article-charset-alist
1081 "Alist of number and charset.
1082 The article will be shown with the charset corresponding to the
1084 For example: ((1 . cn-gb-2312) (2 . big5))."
1086 :type
'(repeat (cons (number :tag
"Argument" 1)
1087 (symbol :tag
"Charset")))
1088 :group
'gnus-charset
)
1090 (defcustom gnus-preserve-marks t
1091 "Whether marks are preserved when moving, copying and respooling messages."
1094 :group
'gnus-summary-marks
)
1096 (defcustom gnus-alter-articles-to-read-function nil
1097 "Function to be called to alter the list of articles to be selected."
1098 :type
'(choice (const nil
) function
)
1099 :group
'gnus-summary
)
1101 (defcustom gnus-orphan-score nil
1102 "*All orphans get this score added. Set in the score file."
1103 :group
'gnus-score-default
1104 :type
'(choice (const nil
)
1107 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1108 "*A regexp to match MIME parts when saving multiple parts of a
1109 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1110 This regexp will be used by default when prompting the user for which
1111 type of files to save."
1112 :group
'gnus-summary
1115 (defcustom gnus-read-all-available-headers nil
1116 "Whether Gnus should parse all headers made available to it.
1117 This is mostly relevant for slow back ends where the user may
1118 wish to widen the summary buffer to include all headers
1119 that were fetched. Say, for nnultimate groups."
1121 :group
'gnus-summary
1122 :type
'(choice boolean regexp
))
1124 (defcustom gnus-summary-muttprint-program
"muttprint"
1125 "Command (and optional arguments) used to run Muttprint."
1127 :group
'gnus-summary
1130 (defcustom gnus-article-loose-mime nil
1131 "If non-nil, don't require MIME-Version header.
1132 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1133 supply the MIME-Version header or deliberately strip it from the mail.
1134 Set it to non-nil, Gnus will treat some articles as MIME even if
1135 the MIME-Version header is missed."
1138 :group
'gnus-article-mime
)
1140 (defcustom gnus-article-emulate-mime t
1141 "If non-nil, use MIME emulation for uuencode and the like.
1142 This means that Gnus will search message bodies for text that look
1143 like uuencoded bits, yEncoded bits, and so on, and present that using
1144 the normal Gnus MIME machinery."
1147 :group
'gnus-article-mime
)
1149 ;;; Internal variables
1151 (defvar gnus-summary-display-cache nil
)
1152 (defvar gnus-article-mime-handles nil
)
1153 (defvar gnus-article-decoded-p nil
)
1154 (defvar gnus-article-charset nil
)
1155 (defvar gnus-article-ignored-charsets nil
)
1156 (defvar gnus-scores-exclude-files nil
)
1157 (defvar gnus-page-broken nil
)
1159 (defvar gnus-original-article nil
)
1160 (defvar gnus-article-internal-prepare-hook nil
)
1161 (defvar gnus-newsgroup-process-stack nil
)
1163 (defvar gnus-thread-indent-array nil
)
1164 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1165 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1166 "Function called to sort the articles within a thread after it has been gathered together.")
1168 (defvar gnus-summary-save-parts-type-history nil
)
1169 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1171 ;; Avoid highlighting in kill files.
1172 (defvar gnus-summary-inhibit-highlight nil
)
1173 (defvar gnus-newsgroup-selected-overlay nil
)
1174 (defvar gnus-inhibit-limiting nil
)
1175 (defvar gnus-newsgroup-adaptive-score-file nil
)
1176 (defvar gnus-current-score-file nil
)
1177 (defvar gnus-current-move-group nil
)
1178 (defvar gnus-current-copy-group nil
)
1179 (defvar gnus-current-crosspost-group nil
)
1180 (defvar gnus-newsgroup-display nil
)
1182 (defvar gnus-newsgroup-dependencies nil
)
1183 (defvar gnus-newsgroup-adaptive nil
)
1184 (defvar gnus-summary-display-article-function nil
)
1185 (defvar gnus-summary-highlight-line-function nil
1186 "Function called after highlighting a summary line.")
1188 (defvar gnus-summary-line-format-alist
1189 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1190 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1191 (?s gnus-tmp-subject-or-nil ?s
)
1192 (?n gnus-tmp-name ?s
)
1193 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1195 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1197 (?F gnus-tmp-from ?s
)
1198 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1199 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1200 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1201 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1202 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1203 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1204 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1205 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1206 (?L gnus-tmp-lines ?s
)
1207 (?O gnus-tmp-downloaded ?c
)
1208 (?I gnus-tmp-indentation ?s
)
1209 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1210 (?R gnus-tmp-replied ?c
)
1211 (?\
[ gnus-tmp-opening-bracket ?c
)
1212 (?\
] gnus-tmp-closing-bracket ?c
)
1213 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1214 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1215 (?i gnus-tmp-score ?d
)
1216 (?z gnus-tmp-score-char ?c
)
1217 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
1218 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1219 (?U gnus-tmp-unread ?c
)
1220 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1222 (?t
(gnus-summary-number-of-articles-in-thread
1223 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1225 (?e
(gnus-summary-number-of-articles-in-thread
1226 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1228 (?u gnus-tmp-user-defined ?s
)
1229 (?P
(gnus-pick-line-number) ?d
)
1230 (?B gnus-tmp-thread-tree-header-string ?s
)
1231 (user-date (gnus-user-date
1232 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1233 "An alist of format specifications that can appear in summary lines.
1234 These are paired with what variables they correspond with, along with
1235 the type of the variable (string, integer, character, etc).")
1237 (defvar gnus-summary-dummy-line-format-alist
1238 `((?S gnus-tmp-subject ?s
)
1239 (?N gnus-tmp-number ?d
)
1240 (?u gnus-tmp-user-defined ?s
)))
1242 (defvar gnus-summary-mode-line-format-alist
1243 `((?G gnus-tmp-group-name ?s
)
1244 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1245 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1246 (?A gnus-tmp-article-number ?d
)
1247 (?Z gnus-tmp-unread-and-unselected ?s
)
1248 (?V gnus-version ?s
)
1249 (?U gnus-tmp-unread-and-unticked ?d
)
1250 (?S gnus-tmp-subject ?s
)
1251 (?e gnus-tmp-unselected ?d
)
1252 (?u gnus-tmp-user-defined ?s
)
1253 (?d
(length gnus-newsgroup-dormant
) ?d
)
1254 (?t
(length gnus-newsgroup-marked
) ?d
)
1255 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1256 (?r
(length gnus-newsgroup-reads
) ?d
)
1257 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1258 (?E gnus-newsgroup-expunged-tally ?d
)
1259 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1261 (defvar gnus-last-search-regexp nil
1262 "Default regexp for article search command.")
1264 (defvar gnus-last-shell-command nil
1265 "Default shell command on article.")
1267 (defvar gnus-newsgroup-agentized nil
1268 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1269 (defvar gnus-newsgroup-begin nil
)
1270 (defvar gnus-newsgroup-end nil
)
1271 (defvar gnus-newsgroup-last-rmail nil
)
1272 (defvar gnus-newsgroup-last-mail nil
)
1273 (defvar gnus-newsgroup-last-folder nil
)
1274 (defvar gnus-newsgroup-last-file nil
)
1275 (defvar gnus-newsgroup-last-directory nil
)
1276 (defvar gnus-newsgroup-auto-expire nil
)
1277 (defvar gnus-newsgroup-active nil
)
1279 (defvar gnus-newsgroup-data nil
)
1280 (defvar gnus-newsgroup-data-reverse nil
)
1281 (defvar gnus-newsgroup-limit nil
)
1282 (defvar gnus-newsgroup-limits nil
)
1283 (defvar gnus-summary-use-undownloaded-faces nil
)
1285 (defvar gnus-newsgroup-unreads nil
1286 "Sorted list of unread articles in the current newsgroup.")
1288 (defvar gnus-newsgroup-unselected nil
1289 "Sorted list of unselected unread articles in the current newsgroup.")
1291 (defvar gnus-newsgroup-reads nil
1292 "Alist of read articles and article marks in the current newsgroup.")
1294 (defvar gnus-newsgroup-expunged-tally nil
)
1296 (defvar gnus-newsgroup-marked nil
1297 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1299 (defvar gnus-newsgroup-spam-marked nil
1300 "List of ranges of articles that have been marked as spam.")
1302 (defvar gnus-newsgroup-killed nil
1303 "List of ranges of articles that have been through the scoring process.")
1305 (defvar gnus-newsgroup-cached nil
1306 "Sorted list of articles that come from the article cache.")
1308 (defvar gnus-newsgroup-saved nil
1309 "List of articles that have been saved.")
1311 (defvar gnus-newsgroup-kill-headers nil
)
1313 (defvar gnus-newsgroup-replied nil
1314 "List of articles that have been replied to in the current newsgroup.")
1316 (defvar gnus-newsgroup-forwarded nil
1317 "List of articles that have been forwarded in the current newsgroup.")
1319 (defvar gnus-newsgroup-recent nil
1320 "List of articles that have are recent in the current newsgroup.")
1322 (defvar gnus-newsgroup-expirable nil
1323 "Sorted list of articles in the current newsgroup that can be expired.")
1325 (defvar gnus-newsgroup-processable nil
1326 "List of articles in the current newsgroup that can be processed.")
1328 (defvar gnus-newsgroup-downloadable nil
1329 "Sorted list of articles in the current newsgroup that can be processed.")
1331 (defvar gnus-newsgroup-unfetched nil
1332 "Sorted list of articles in the current newsgroup whose headers have
1333 not been fetched into the agent.
1335 This list will always be a subset of gnus-newsgroup-undownloaded.")
1337 (defvar gnus-newsgroup-undownloaded nil
1338 "List of articles in the current newsgroup that haven't been downloaded.")
1340 (defvar gnus-newsgroup-unsendable nil
1341 "List of articles in the current newsgroup that won't be sent.")
1343 (defvar gnus-newsgroup-bookmarks nil
1344 "List of articles in the current newsgroup that have bookmarks.")
1346 (defvar gnus-newsgroup-dormant nil
1347 "Sorted list of dormant articles in the current newsgroup.")
1349 (defvar gnus-newsgroup-unseen nil
1350 "List of unseen articles in the current newsgroup.")
1352 (defvar gnus-newsgroup-seen nil
1353 "Range of seen articles in the current newsgroup.")
1355 (defvar gnus-newsgroup-articles nil
1356 "List of articles in the current newsgroup.")
1358 (defvar gnus-newsgroup-scored nil
1359 "List of scored articles in the current newsgroup.")
1361 (defvar gnus-newsgroup-headers nil
1362 "List of article headers in the current newsgroup.")
1364 (defvar gnus-newsgroup-threads nil
)
1366 (defvar gnus-newsgroup-prepared nil
1367 "Whether the current group has been prepared properly.")
1369 (defvar gnus-newsgroup-ancient nil
1370 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1372 (defvar gnus-newsgroup-sparse nil
)
1374 (defvar gnus-current-article nil
)
1375 (defvar gnus-article-current nil
)
1376 (defvar gnus-current-headers nil
)
1377 (defvar gnus-have-all-headers nil
)
1378 (defvar gnus-last-article nil
)
1379 (defvar gnus-newsgroup-history nil
)
1380 (defvar gnus-newsgroup-charset nil
)
1381 (defvar gnus-newsgroup-ephemeral-charset nil
)
1382 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1384 (defvar gnus-article-before-search nil
)
1386 (defvar gnus-summary-local-variables
1387 '(gnus-newsgroup-name
1388 gnus-newsgroup-begin gnus-newsgroup-end
1389 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1390 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1391 gnus-newsgroup-last-directory
1392 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1393 gnus-newsgroup-unselected gnus-newsgroup-marked
1394 gnus-newsgroup-spam-marked
1395 gnus-newsgroup-reads gnus-newsgroup-saved
1396 gnus-newsgroup-replied gnus-newsgroup-forwarded
1397 gnus-newsgroup-recent
1398 gnus-newsgroup-expirable
1399 gnus-newsgroup-processable gnus-newsgroup-killed
1400 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1401 gnus-newsgroup-unfetched
1402 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1403 gnus-newsgroup-seen gnus-newsgroup-articles
1404 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1405 gnus-newsgroup-headers gnus-newsgroup-threads
1406 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1407 gnus-current-article gnus-current-headers gnus-have-all-headers
1408 gnus-last-article gnus-article-internal-prepare-hook
1409 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1410 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1411 gnus-thread-expunge-below
1412 gnus-score-alist gnus-current-score-file
1413 (gnus-summary-expunge-below . global
)
1414 (gnus-summary-mark-below . global
)
1415 (gnus-orphan-score . global
)
1416 gnus-newsgroup-active gnus-scores-exclude-files
1417 gnus-newsgroup-history gnus-newsgroup-ancient
1418 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1419 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1420 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1421 (gnus-newsgroup-expunged-tally .
0)
1422 gnus-cache-removable-articles gnus-newsgroup-cached
1423 gnus-newsgroup-data gnus-newsgroup-data-reverse
1424 gnus-newsgroup-limit gnus-newsgroup-limits
1425 gnus-newsgroup-charset gnus-newsgroup-display
1426 gnus-summary-use-undownloaded-faces
)
1427 "Variables that are buffer-local to the summary buffers.")
1429 (defvar gnus-newsgroup-variables nil
1430 "A list of variables that have separate values in different newsgroups.
1431 A list of newsgroup (summary buffer) local variables, or cons of
1432 variables and their default expressions to be evalled (when the default
1433 values are not nil), that should be made global while the summary buffer
1436 Note: The default expressions will be evaluated (using function `eval')
1437 before assignment to the local variable rather than just assigned to it.
1438 If the default expression is the symbol `global', that symbol will not
1439 be evaluated but the global value of the local variable will be used
1442 These variables can be used to set variables in the group parameters
1443 while still allowing them to affect operations done in other buffers.
1446 \(setq gnus-newsgroup-variables
1447 '(message-use-followup-to
1448 (gnus-visible-headers .
1449 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1452 ;; Byte-compiler warning.
1454 ;; Bind features so that require will believe that gnus-sum has
1455 ;; already been loaded (avoids infinite recursion)
1456 (let ((features (cons 'gnus-sum features
)))
1457 ;; Several of the declarations in gnus-sum are needed to load the
1458 ;; following files. Right now, these definitions have been
1459 ;; compiled but not defined (evaluated). We could either do a
1460 ;; eval-and-compile about all of the declarations or evaluate the
1462 (if (boundp 'gnus-newsgroup-variables
)
1464 (load "gnus-sum.el" t t t
))
1466 (require 'gnus-agent
)
1467 (require 'gnus-art
)))
1471 (defvar gnus-decode-encoded-word-methods
1472 '(mail-decode-encoded-word-string)
1473 "List of methods used to decode encoded words.
1475 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1476 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1477 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1478 whose names match REGEXP.
1481 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1482 mail-decode-encoded-word-string
1483 (\"chinese\" . rfc1843-decode-string))")
1485 (defvar gnus-decode-encoded-word-methods-cache nil
)
1487 (defun gnus-multi-decode-encoded-word-string (string)
1488 "Apply the functions from `gnus-encoded-word-methods' that match."
1489 (unless (and gnus-decode-encoded-word-methods-cache
1490 (eq gnus-newsgroup-name
1491 (car gnus-decode-encoded-word-methods-cache
)))
1492 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1495 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1496 (if (and gnus-newsgroup-name
1497 (string-match (car x
) gnus-newsgroup-name
))
1498 (nconc gnus-decode-encoded-word-methods-cache
1500 gnus-decode-encoded-word-methods
))
1501 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1504 (setq string
(funcall (pop xlist
) string
))))
1507 ;; Subject simplification.
1509 (defun gnus-simplify-whitespace (str)
1510 "Remove excessive whitespace from STR."
1512 (while (string-match "[ \t][ \t]+" str
)
1513 (setq str
(concat (substring str
0 (match-beginning 0))
1515 (substring str
(match-end 0)))))
1517 (when (string-match "^[ \t]+" str
)
1518 (setq str
(substring str
(match-end 0))))
1520 (when (string-match "[ \t]+$" str
)
1521 (setq str
(substring str
0 (match-beginning 0))))
1524 (defun gnus-simplify-all-whitespace (str)
1525 "Remove all whitespace from STR."
1526 (while (string-match "[ \t\n]+" str
)
1527 (setq str
(replace-match "" nil nil str
)))
1530 (defsubst gnus-simplify-subject-re
(subject)
1531 "Remove \"Re:\" from subject lines."
1532 (if (string-match message-subject-re-regexp subject
)
1533 (substring subject
(match-end 0))
1536 (defun gnus-simplify-subject (subject &optional re-only
)
1537 "Remove `Re:' and words in parentheses.
1538 If RE-ONLY is non-nil, strip leading `Re:'s only."
1539 (let ((case-fold-search t
)) ;Ignore case.
1540 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1541 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1542 (setq subject
(substring subject
(match-end 0))))
1543 ;; Remove uninteresting prefixes.
1544 (when (and (not re-only
)
1545 gnus-simplify-ignored-prefixes
1546 (string-match gnus-simplify-ignored-prefixes subject
))
1547 (setq subject
(substring subject
(match-end 0))))
1548 ;; Remove words in parentheses from end.
1550 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1551 (setq subject
(substring subject
0 (match-beginning 0)))))
1552 ;; Return subject string.
1555 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1557 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1558 (goto-char (point-min))
1559 (while (re-search-forward regexp nil t
)
1560 (replace-match (or newtext
""))))
1562 (defun gnus-simplify-buffer-fuzzy ()
1563 "Simplify string in the buffer fuzzily.
1564 The string in the accessible portion of the current buffer is simplified.
1565 It is assumed to be a single-line subject.
1566 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1567 matter is removed. Additional things can be deleted by setting
1568 `gnus-simplify-subject-fuzzy-regexp'."
1569 (let ((case-fold-search t
)
1571 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1573 (while (not (eq modified-tick
(buffer-modified-tick)))
1574 (setq modified-tick
(buffer-modified-tick))
1576 ((listp gnus-simplify-subject-fuzzy-regexp
)
1577 (mapcar 'gnus-simplify-buffer-fuzzy-step
1578 gnus-simplify-subject-fuzzy-regexp
))
1579 (gnus-simplify-subject-fuzzy-regexp
1580 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1581 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1582 (gnus-simplify-buffer-fuzzy-step
1583 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1584 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1586 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1587 (gnus-simplify-buffer-fuzzy-step " +" " ")
1588 (gnus-simplify-buffer-fuzzy-step " $")
1589 (gnus-simplify-buffer-fuzzy-step "^ +")))
1591 (defun gnus-simplify-subject-fuzzy (subject)
1592 "Simplify a subject string fuzzily.
1593 See `gnus-simplify-buffer-fuzzy' for details."
1595 (gnus-set-work-buffer)
1596 (let ((case-fold-search t
))
1597 ;; Remove uninteresting prefixes.
1598 (when (and gnus-simplify-ignored-prefixes
1599 (string-match gnus-simplify-ignored-prefixes subject
))
1600 (setq subject
(substring subject
(match-end 0))))
1602 (inline (gnus-simplify-buffer-fuzzy))
1605 (defsubst gnus-simplify-subject-fully
(subject)
1606 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1608 (gnus-simplify-subject-functions
1609 (gnus-map-function gnus-simplify-subject-functions subject
))
1610 ((null gnus-summary-gather-subject-limit
)
1611 (gnus-simplify-subject-re subject
))
1612 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1613 (gnus-simplify-subject-fuzzy subject
))
1614 ((numberp gnus-summary-gather-subject-limit
)
1615 (gnus-limit-string (gnus-simplify-subject-re subject
)
1616 gnus-summary-gather-subject-limit
))
1620 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1621 "Check whether two subjects are equal.
1622 If optional argument SIMPLE-FIRST is t, first argument is already
1625 ((null simple-first
)
1626 (equal (gnus-simplify-subject-fully s1
)
1627 (gnus-simplify-subject-fully s2
)))
1630 (gnus-simplify-subject-fully s2
)))))
1632 (defun gnus-summary-bubble-group ()
1633 "Increase the score of the current group.
1634 This is a handy function to add to `gnus-summary-exit-hook' to
1635 increase the score of each group you read."
1636 (gnus-group-add-score gnus-newsgroup-name
))
1640 ;;; Gnus summary mode
1643 (put 'gnus-summary-mode
'mode-class
'special
)
1645 (defvar gnus-article-commands-menu
)
1647 ;; Non-orthogonal keys
1649 (gnus-define-keys gnus-summary-mode-map
1650 " " gnus-summary-next-page
1651 "\177" gnus-summary-prev-page
1652 [delete] gnus-summary-prev-page
1653 [backspace] gnus-summary-prev-page
1654 "\r" gnus-summary-scroll-up
1655 "\M-\r" gnus-summary-scroll-down
1656 "n" gnus-summary-next-unread-article
1657 "p" gnus-summary-prev-unread-article
1658 "N" gnus-summary-next-article
1659 "P" gnus-summary-prev-article
1660 "\M-\C-n" gnus-summary-next-same-subject
1661 "\M-\C-p" gnus-summary-prev-same-subject
1662 "\M-n" gnus-summary-next-unread-subject
1663 "\M-p" gnus-summary-prev-unread-subject
1664 "." gnus-summary-first-unread-article
1665 "," gnus-summary-best-unread-article
1666 "\M-s" gnus-summary-search-article-forward
1667 "\M-r" gnus-summary-search-article-backward
1668 "<" gnus-summary-beginning-of-article
1669 ">" gnus-summary-end-of-article
1670 "j" gnus-summary-goto-article
1671 "^" gnus-summary-refer-parent-article
1672 "\M-^" gnus-summary-refer-article
1673 "u" gnus-summary-tick-article-forward
1674 "!" gnus-summary-tick-article-forward
1675 "U" gnus-summary-tick-article-backward
1676 "d" gnus-summary-mark-as-read-forward
1677 "D" gnus-summary-mark-as-read-backward
1678 "E" gnus-summary-mark-as-expirable
1679 "\M-u" gnus-summary-clear-mark-forward
1680 "\M-U" gnus-summary-clear-mark-backward
1681 "k" gnus-summary-kill-same-subject-and-select
1682 "\C-k" gnus-summary-kill-same-subject
1683 "\M-\C-k" gnus-summary-kill-thread
1684 "\M-\C-l" gnus-summary-lower-thread
1685 "e" gnus-summary-edit-article
1686 "#" gnus-summary-mark-as-processable
1687 "\M-#" gnus-summary-unmark-as-processable
1688 "\M-\C-t" gnus-summary-toggle-threads
1689 "\M-\C-s" gnus-summary-show-thread
1690 "\M-\C-h" gnus-summary-hide-thread
1691 "\M-\C-f" gnus-summary-next-thread
1692 "\M-\C-b" gnus-summary-prev-thread
1693 [(meta down)] gnus-summary-next-thread
1694 [(meta up)] gnus-summary-prev-thread
1695 "\M-\C-u" gnus-summary-up-thread
1696 "\M-\C-d" gnus-summary-down-thread
1697 "&" gnus-summary-execute-command
1698 "c" gnus-summary-catchup-and-exit
1699 "\C-w" gnus-summary-mark-region-as-read
1700 "\C-t" gnus-summary-toggle-truncation
1701 "?" gnus-summary-mark-as-dormant
1702 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1703 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1704 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1705 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1706 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1707 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1708 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1709 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1710 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1711 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1712 "=" gnus-summary-expand-window
1713 "\C-x\C-s" gnus-summary-reselect-current-group
1714 "\M-g" gnus-summary-rescan-group
1715 "w" gnus-summary-stop-page-breaking
1716 "\C-c\C-r" gnus-summary-caesar-message
1717 "f" gnus-summary-followup
1718 "F" gnus-summary-followup-with-original
1719 "C" gnus-summary-cancel-article
1720 "r" gnus-summary-reply
1721 "R" gnus-summary-reply-with-original
1722 "\C-c\C-f" gnus-summary-mail-forward
1723 "o" gnus-summary-save-article
1724 "\C-o" gnus-summary-save-article-mail
1725 "|" gnus-summary-pipe-output
1726 "\M-k" gnus-summary-edit-local-kill
1727 "\M-K" gnus-summary-edit-global-kill
1729 "\C-c\C-d" gnus-summary-describe-group
1730 "q" gnus-summary-exit
1731 "Q" gnus-summary-exit-no-update
1732 "\C-c\C-i" gnus-info-find-node
1733 gnus-mouse-2 gnus-mouse-pick-article
1734 [follow-link] mouse-face
1735 "m" gnus-summary-mail-other-window
1736 "a" gnus-summary-post-news
1737 "i" gnus-summary-news-other-window
1738 "x" gnus-summary-limit-to-unread
1739 "s" gnus-summary-isearch-article
1740 "t" gnus-summary-toggle-header
1741 "g" gnus-summary-show-article
1742 "l" gnus-summary-goto-last-article
1743 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1744 "\C-d" gnus-summary-enter-digest-group
1745 "\M-\C-d" gnus-summary-read-document
1746 "\M-\C-e" gnus-summary-edit-parameters
1747 "\M-\C-a" gnus-summary-customize-parameters
1749 "*" gnus-cache-enter-article
1750 "\M-*" gnus-cache-remove-article
1751 "\M-&" gnus-summary-universal-argument
1752 "\C-l" gnus-recenter
1753 "I" gnus-summary-increase-score
1754 "L" gnus-summary-lower-score
1755 "\M-i" gnus-symbolic-argument
1756 "h" gnus-summary-select-article-buffer
1758 "b" gnus-article-view-part
1759 "\M-t" gnus-summary-toggle-display-buttonized
1761 "V" gnus-summary-score-map
1762 "X" gnus-uu-extract-map
1763 "S" gnus-summary-send-map)
1765 ;; Sort of orthogonal keymap
1766 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1767 "t" gnus-summary-tick-article-forward
1768 "!" gnus-summary-tick-article-forward
1769 "d" gnus-summary-mark-as-read-forward
1770 "r" gnus-summary-mark-as-read-forward
1771 "c" gnus-summary-clear-mark-forward
1772 " " gnus-summary-clear-mark-forward
1773 "e" gnus-summary-mark-as-expirable
1774 "x" gnus-summary-mark-as-expirable
1775 "?" gnus-summary-mark-as-dormant
1776 "b" gnus-summary-set-bookmark
1777 "B" gnus-summary-remove-bookmark
1778 "#" gnus-summary-mark-as-processable
1779 "\M-#" gnus-summary-unmark-as-processable
1780 "S" gnus-summary-limit-include-expunged
1781 "C" gnus-summary-catchup
1782 "H" gnus-summary-catchup-to-here
1783 "h" gnus-summary-catchup-from-here
1784 "\C-c" gnus-summary-catchup-all
1785 "k" gnus-summary-kill-same-subject-and-select
1786 "K" gnus-summary-kill-same-subject
1787 "P" gnus-uu-mark-map)
1789 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1790 "c" gnus-summary-clear-above
1791 "u" gnus-summary-tick-above
1792 "m" gnus-summary-mark-above
1793 "k" gnus-summary-kill-below)
1795 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1796 "/" gnus-summary-limit-to-subject
1797 "n" gnus-summary-limit-to-articles
1798 "w" gnus-summary-pop-limit
1799 "s" gnus-summary-limit-to-subject
1800 "a" gnus-summary-limit-to-author
1801 "u" gnus-summary-limit-to-unread
1802 "m" gnus-summary-limit-to-marks
1803 "M" gnus-summary-limit-exclude-marks
1804 "v" gnus-summary-limit-to-score
1805 "*" gnus-summary-limit-include-cached
1806 "D" gnus-summary-limit-include-dormant
1807 "T" gnus-summary-limit-include-thread
1808 "d" gnus-summary-limit-exclude-dormant
1809 "t" gnus-summary-limit-to-age
1810 "." gnus-summary-limit-to-unseen
1811 "x" gnus-summary-limit-to-extra
1812 "p" gnus-summary-limit-to-display-predicate
1813 "E" gnus-summary-limit-include-expunged
1814 "c" gnus-summary-limit-exclude-childless-dormant
1815 "C" gnus-summary-limit-mark-excluded-as-read
1816 "o" gnus-summary-insert-old-articles
1817 "N" gnus-summary-insert-new-articles)
1819 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1820 "n" gnus-summary-next-unread-article
1821 "p" gnus-summary-prev-unread-article
1822 "N" gnus-summary-next-article
1823 "P" gnus-summary-prev-article
1824 "\C-n" gnus-summary-next-same-subject
1825 "\C-p" gnus-summary-prev-same-subject
1826 "\M-n" gnus-summary-next-unread-subject
1827 "\M-p" gnus-summary-prev-unread-subject
1828 "f" gnus-summary-first-unread-article
1829 "b" gnus-summary-best-unread-article
1830 "j" gnus-summary-goto-article
1831 "g" gnus-summary-goto-subject
1832 "l" gnus-summary-goto-last-article
1833 "o" gnus-summary-pop-article)
1835 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1836 "k" gnus-summary-kill-thread
1837 "l" gnus-summary-lower-thread
1838 "i" gnus-summary-raise-thread
1839 "T" gnus-summary-toggle-threads
1840 "t" gnus-summary-rethread-current
1841 "^" gnus-summary-reparent-thread
1842 "s" gnus-summary-show-thread
1843 "S" gnus-summary-show-all-threads
1844 "h" gnus-summary-hide-thread
1845 "H" gnus-summary-hide-all-threads
1846 "n" gnus-summary-next-thread
1847 "p" gnus-summary-prev-thread
1848 "u" gnus-summary-up-thread
1849 "o" gnus-summary-top-thread
1850 "d" gnus-summary-down-thread
1851 "#" gnus-uu-mark-thread
1852 "\M-#" gnus-uu-unmark-thread)
1854 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1855 "g" gnus-summary-prepare
1856 "c" gnus-summary-insert-cached-articles
1857 "d" gnus-summary-insert-dormant-articles)
1859 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1860 "c" gnus-summary-catchup-and-exit
1861 "C" gnus-summary-catchup-all-and-exit
1862 "E" gnus-summary-exit-no-update
1863 "Q" gnus-summary-exit
1864 "Z" gnus-summary-exit
1865 "n" gnus-summary-catchup-and-goto-next-group
1866 "R" gnus-summary-reselect-current-group
1867 "G" gnus-summary-rescan-group
1868 "N" gnus-summary-next-group
1869 "s" gnus-summary-save-newsrc
1870 "P" gnus-summary-prev-group)
1872 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1873 " " gnus-summary-next-page
1874 "n" gnus-summary-next-page
1875 "\177" gnus-summary-prev-page
1876 [delete] gnus-summary-prev-page
1877 "p" gnus-summary-prev-page
1878 "\r" gnus-summary-scroll-up
1879 "\M-\r" gnus-summary-scroll-down
1880 "<" gnus-summary-beginning-of-article
1881 ">" gnus-summary-end-of-article
1882 "b" gnus-summary-beginning-of-article
1883 "e" gnus-summary-end-of-article
1884 "^" gnus-summary-refer-parent-article
1885 "r" gnus-summary-refer-parent-article
1886 "D" gnus-summary-enter-digest-group
1887 "R" gnus-summary-refer-references
1888 "T" gnus-summary-refer-thread
1889 "g" gnus-summary-show-article
1890 "s" gnus-summary-isearch-article
1891 "P" gnus-summary-print-article
1892 "M" gnus-mailing-list-insinuate
1893 "t" gnus-article-babel
)
1895 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1896 "b" gnus-article-add-buttons
1897 "B" gnus-article-add-buttons-to-head
1898 "o" gnus-article-treat-overstrike
1899 "e" gnus-article-emphasize
1900 "w" gnus-article-fill-cited-article
1901 "Q" gnus-article-fill-long-lines
1902 "C" gnus-article-capitalize-sentences
1903 "c" gnus-article-remove-cr
1904 "q" gnus-article-de-quoted-unreadable
1905 "6" gnus-article-de-base64-unreadable
1906 "Z" gnus-article-decode-HZ
1907 "h" gnus-article-wash-html
1908 "u" gnus-article-unsplit-urls
1909 "s" gnus-summary-force-verify-and-decrypt
1910 "f" gnus-article-display-x-face
1911 "l" gnus-summary-stop-page-breaking
1912 "r" gnus-summary-caesar-message
1913 "m" gnus-summary-morse-message
1914 "t" gnus-summary-toggle-header
1915 "g" gnus-treat-smiley
1916 "v" gnus-summary-verbose-headers
1917 "a" gnus-article-strip-headers-in-body
;; mnemonic: wash archive
1918 "p" gnus-article-verify-x-pgp-sig
1919 "d" gnus-article-treat-dumbquotes
)
1921 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map
)
1922 ;; mnemonic: deuglif*Y*
1923 "u" gnus-article-outlook-unwrap-lines
1924 "a" gnus-article-outlook-repair-attribution
1925 "c" gnus-article-outlook-rearrange-citation
1926 "f" gnus-article-outlook-deuglify-article
) ;; mnemonic: full deuglify
1928 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1929 "a" gnus-article-hide
1930 "h" gnus-article-hide-headers
1931 "b" gnus-article-hide-boring-headers
1932 "s" gnus-article-hide-signature
1933 "c" gnus-article-hide-citation
1934 "C" gnus-article-hide-citation-in-followups
1935 "l" gnus-article-hide-list-identifiers
1936 "B" gnus-article-strip-banner
1937 "P" gnus-article-hide-pem
1938 "\C-c" gnus-article-hide-citation-maybe
)
1940 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1941 "a" gnus-article-highlight
1942 "h" gnus-article-highlight-headers
1943 "c" gnus-article-highlight-citation
1944 "s" gnus-article-highlight-signature
)
1946 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map
)
1947 "f" gnus-article-treat-fold-headers
1948 "u" gnus-article-treat-unfold-headers
1949 "n" gnus-article-treat-fold-newsgroups
)
1951 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map
)
1952 "x" gnus-article-display-x-face
1953 "d" gnus-article-display-face
1954 "s" gnus-treat-smiley
1955 "D" gnus-article-remove-images
1956 "f" gnus-treat-from-picon
1957 "m" gnus-treat-mail-picon
1958 "n" gnus-treat-newsgroups-picon
)
1960 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1961 "w" gnus-article-decode-mime-words
1962 "c" gnus-article-decode-charset
1963 "v" gnus-mime-view-all-parts
1964 "b" gnus-article-view-part
)
1966 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1967 "z" gnus-article-date-ut
1968 "u" gnus-article-date-ut
1969 "l" gnus-article-date-local
1970 "p" gnus-article-date-english
1971 "e" gnus-article-date-lapsed
1972 "o" gnus-article-date-original
1973 "i" gnus-article-date-iso8601
1974 "s" gnus-article-date-user
)
1976 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1977 "t" gnus-article-remove-trailing-blank-lines
1978 "l" gnus-article-strip-leading-blank-lines
1979 "m" gnus-article-strip-multiple-blank-lines
1980 "a" gnus-article-strip-blank-lines
1981 "A" gnus-article-strip-all-blank-lines
1982 "s" gnus-article-strip-leading-space
1983 "e" gnus-article-strip-trailing-space
1984 "w" gnus-article-remove-leading-whitespace
)
1986 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1988 "f" gnus-summary-fetch-faq
1989 "d" gnus-summary-describe-group
1990 "h" gnus-summary-describe-briefly
1991 "i" gnus-info-find-node
1992 "c" gnus-group-fetch-charter
1993 "C" gnus-group-fetch-control
)
1995 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1996 "e" gnus-summary-expire-articles
1997 "\M-\C-e" gnus-summary-expire-articles-now
1998 "\177" gnus-summary-delete-article
1999 [delete] gnus-summary-delete-article
2000 [backspace] gnus-summary-delete-article
2001 "m" gnus-summary-move-article
2002 "r" gnus-summary-respool-article
2003 "w" gnus-summary-edit-article
2004 "c" gnus-summary-copy-article
2005 "B" gnus-summary-crosspost-article
2006 "q" gnus-summary-respool-query
2007 "t" gnus-summary-respool-trace
2008 "i" gnus-summary-import-article
2009 "I" gnus-summary-create-article
2010 "p" gnus-summary-article-posted-p)
2012 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2013 "o" gnus-summary-save-article
2014 "m" gnus-summary-save-article-mail
2015 "F" gnus-summary-write-article-file
2016 "r" gnus-summary-save-article-rmail
2017 "f" gnus-summary-save-article-file
2018 "b" gnus-summary-save-article-body-file
2019 "B" gnus-summary-write-article-body-file
2020 "h" gnus-summary-save-article-folder
2021 "v" gnus-summary-save-article-vm
2022 "p" gnus-summary-pipe-output
2023 "P" gnus-summary-muttprint
2024 "s" gnus-soup-add-article)
2026 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2027 "b" gnus-summary-display-buttonized
2028 "m" gnus-summary-repair-multipart
2029 "v" gnus-article-view-part
2030 "o" gnus-article-save-part
2031 "c" gnus-article-copy-part
2032 "C" gnus-article-view-part-as-charset
2033 "e" gnus-article-view-part-externally
2034 "E" gnus-article-encrypt-body
2035 "i" gnus-article-inline-part
2036 "|" gnus-article-pipe-part)
2038 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2039 "p" gnus-summary-mark-as-processable
2040 "u" gnus-summary-unmark-as-processable
2041 "U" gnus-summary-unmark-all-processable
2042 "v" gnus-uu-mark-over
2043 "s" gnus-uu-mark-series
2044 "r" gnus-uu-mark-region
2045 "g" gnus-uu-unmark-region
2046 "R" gnus-uu-mark-by-regexp
2047 "G" gnus-uu-unmark-by-regexp
2048 "t" gnus-uu-mark-thread
2049 "T" gnus-uu-unmark-thread
2050 "a" gnus-uu-mark-all
2051 "b" gnus-uu-mark-buffer
2052 "S" gnus-uu-mark-sparse
2053 "k" gnus-summary-kill-process-mark
2054 "y" gnus-summary-yank-process-mark
2055 "w" gnus-summary-save-process-mark
2056 "i" gnus-uu-invert-processable)
2058 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2059 ;;"x" gnus-uu-extract-any
2060 "m" gnus-summary-save-parts
2061 "u" gnus-uu-decode-uu
2062 "U" gnus-uu-decode-uu-and-save
2063 "s" gnus-uu-decode-unshar
2064 "S" gnus-uu-decode-unshar-and-save
2065 "o" gnus-uu-decode-save
2066 "O" gnus-uu-decode-save
2067 "b" gnus-uu-decode-binhex
2068 "B" gnus-uu-decode-binhex
2069 "p" gnus-uu-decode-postscript
2070 "P" gnus-uu-decode-postscript-and-save)
2073 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2074 "u" gnus-uu-decode-uu-view
2075 "U" gnus-uu-decode-uu-and-save-view
2076 "s" gnus-uu-decode-unshar-view
2077 "S" gnus-uu-decode-unshar-and-save-view
2078 "o" gnus-uu-decode-save-view
2079 "O" gnus-uu-decode-save-view
2080 "b" gnus-uu-decode-binhex-view
2081 "B" gnus-uu-decode-binhex-view
2082 "p" gnus-uu-decode-postscript-view
2083 "P" gnus-uu-decode-postscript-and-save-view)
2085 (defvar gnus-article-post-menu nil)
2087 (defconst gnus-summary-menu-maxlen 20)
2089 (defun gnus-summary-menu-split (menu)
2090 ;; If we have lots of elements, divide them into groups of 20
2091 ;; and make a pane (or submenu) for each one.
2092 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2093 (let ((menu menu) sublists next
2096 ;; Pull off the next gnus-summary-menu-maxlen elements
2097 ;; and make them the next element of sublist.
2098 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2100 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2102 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2103 (aref (car (last menu)) 0)) menu)
2107 (nreverse sublists))
2108 ;; Few elements--put them all in one pane.
2111 (defun gnus-summary-make-menu-bar ()
2112 (gnus-turn-off-edit-menu 'summary)
2114 (unless (boundp 'gnus-summary-misc-menu)
2117 gnus-summary-kill-menu gnus-summary-mode-map ""
2122 ["Customize" gnus-score-customize t])
2123 (gnus-make-score-map 'increase)
2124 (gnus-make-score-map 'lower)
2126 ["Kill below" gnus-summary-kill-below t]
2127 ["Mark above" gnus-summary-mark-above t]
2128 ["Tick above" gnus-summary-tick-above t]
2129 ["Clear above" gnus-summary-clear-above t])
2130 ["Current score" gnus-summary-current-score t]
2131 ["Set score" gnus-summary-set-score t]
2132 ["Switch current score file..." gnus-score-change-score-file t]
2133 ["Set mark below..." gnus-score-set-mark-below t]
2134 ["Set expunge below..." gnus-score-set-expunge-below t]
2135 ["Edit current score file" gnus-score-edit-current-scores t]
2136 ["Edit score file" gnus-score-edit-file t]
2137 ["Trace score" gnus-score-find-trace t]
2138 ["Find words" gnus-score-find-favourite-words t]
2139 ["Rescore buffer" gnus-summary-rescore t]
2140 ["Increase score..." gnus-summary-increase-score t]
2141 ["Lower score..." gnus-summary-lower-score t]))))
2143 ;; Define both the Article menu in the summary buffer and the
2144 ;; equivalent Commands menu in the article buffer here for
2148 ["All" gnus-article-hide t]
2149 ["Headers" gnus-article-hide-headers t]
2150 ["Signature" gnus-article-hide-signature t]
2151 ["Citation" gnus-article-hide-citation t]
2152 ["List identifiers" gnus-article-hide-list-identifiers t]
2153 ["Banner" gnus-article-strip-banner t]
2154 ["Boring headers" gnus-article-hide-boring-headers t])
2156 ["All" gnus-article-highlight t]
2157 ["Headers" gnus-article-highlight-headers t]
2158 ["Signature" gnus-article-highlight-signature t]
2159 ["Citation" gnus-article-highlight-citation t])
2161 ["Words" gnus-article-decode-mime-words t]
2162 ["Charset" gnus-article-decode-charset t]
2163 ["QP" gnus-article-de-quoted-unreadable t]
2164 ["Base64" gnus-article-de-base64-unreadable t]
2165 ["View MIME buttons" gnus-summary-display-buttonized t]
2166 ["View all" gnus-mime-view-all-parts t]
2167 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2168 ["Encrypt body" gnus-article-encrypt-body
2169 :active (not (gnus-group-read-only-p))
2170 ,@(if (featurep 'xemacs) nil
2171 '(:help "Encrypt the message body on disk"))]
2172 ["Extract all parts..." gnus-summary-save-parts t]
2174 ["Repair multipart" gnus-summary-repair-multipart t]
2175 ["Pipe part..." gnus-article-pipe-part t]
2176 ["Inline part" gnus-article-inline-part t]
2177 ["Encrypt body" gnus-article-encrypt-body
2178 :active (not (gnus-group-read-only-p))
2179 ,@(if (featurep 'xemacs) nil
2180 '(:help "Encrypt the message body on disk"))]
2181 ["View part externally" gnus-article-view-part-externally t]
2182 ["View part with charset..." gnus-article-view-part-as-charset t]
2183 ["Copy part" gnus-article-copy-part t]
2184 ["Save part..." gnus-article-save-part t]
2185 ["View part" gnus-article-view-part t]))
2187 ["Local" gnus-article-date-local t]
2188 ["ISO8601" gnus-article-date-iso8601 t]
2189 ["UT" gnus-article-date-ut t]
2190 ["Original" gnus-article-date-original t]
2191 ["Lapsed" gnus-article-date-lapsed t]
2192 ["User-defined" gnus-article-date-user t])
2194 ["Remove images" gnus-article-remove-images t]
2195 ["Toggle smiley" gnus-treat-smiley t]
2196 ["Show X-Face" gnus-article-display-x-face t]
2197 ["Show picons in From" gnus-treat-from-picon t]
2198 ["Show picons in mail headers" gnus-treat-mail-picon t]
2199 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2200 ("View as different encoding"
2201 ,@(gnus-summary-menu-split
2204 ;; Since easymenu under Emacs doesn't allow
2205 ;; lambda forms for menu commands, we should
2206 ;; provide intern'ed function symbols.
2207 (let ((command (intern (format "\
2208 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2212 (let ((gnus-summary-show-article-charset-alist
2214 (gnus-summary-show-article 1))))
2215 `[,(symbol-name cs) ,command t]))
2216 (sort (if (fboundp 'coding-system-list)
2217 (coding-system-list)
2218 (mapcar 'car mm-mime-mule-charset-alist))
2222 ["Leading" gnus-article-strip-leading-blank-lines t]
2223 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2224 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2225 ["All of the above" gnus-article-strip-blank-lines t]
2226 ["All" gnus-article-strip-all-blank-lines t]
2227 ["Leading space" gnus-article-strip-leading-space t]
2228 ["Trailing space" gnus-article-strip-trailing-space t]
2229 ["Leading space in headers"
2230 gnus-article-remove-leading-whitespace t])
2231 ["Overstrike" gnus-article-treat-overstrike t]
2232 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2233 ["Emphasis" gnus-article-emphasize t]
2234 ["Word wrap" gnus-article-fill-cited-article t]
2235 ["Fill long lines" gnus-article-fill-long-lines t]
2236 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2237 ["Remove CR" gnus-article-remove-cr t]
2238 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2239 ["Base64" gnus-article-de-base64-unreadable t]
2240 ["Rot 13" gnus-summary-caesar-message
2241 ,@(if (featurep 'xemacs) '(t)
2242 '(:help "\"Caesar rotate\" article by 13"))]
2243 ["Morse decode" gnus-summary-morse-message t]
2244 ["Unix pipe..." gnus-summary-pipe-message t]
2245 ["Add buttons" gnus-article-add-buttons t]
2246 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2247 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2248 ["Verbose header" gnus-summary-verbose-headers t]
2249 ["Toggle header" gnus-summary-toggle-header t]
2250 ["Unfold headers" gnus-article-treat-unfold-headers t]
2251 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2252 ["Html" gnus-article-wash-html t]
2253 ["Unsplit URLs" gnus-article-unsplit-urls t]
2254 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2255 ["Decode HZ" gnus-article-decode-HZ t]
2256 ("(Outlook) Deuglify"
2257 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2258 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2259 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2260 ["Full (Outlook) deuglify"
2261 gnus-article-outlook-deuglify-article t])
2264 ["Save in default format..." gnus-summary-save-article
2265 ,@(if (featurep 'xemacs) '(t)
2266 '(:help "Save article using default method"))]
2267 ["Save in file..." gnus-summary-save-article-file
2268 ,@(if (featurep 'xemacs) '(t)
2269 '(:help "Save article in file"))]
2270 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2271 ["Save in MH folder..." gnus-summary-save-article-folder t]
2272 ["Save in VM folder..." gnus-summary-save-article-vm t]
2273 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2274 ["Save body in file..." gnus-summary-save-article-body-file t]
2275 ["Pipe through a filter..." gnus-summary-pipe-output t]
2276 ["Add to SOUP packet" gnus-soup-add-article t]
2277 ["Print with Muttprint..." gnus-summary-muttprint t]
2278 ["Print" gnus-summary-print-article
2279 ,@(if (featurep 'xemacs) '(t)
2280 '(:help "Generate and print a PostScript image"))])
2281 ("Copy, move,... (Backend)"
2282 ,@(if (featurep 'xemacs) nil
2283 '(:help "Copying, moving, expiring articles..."))
2284 ["Respool article..." gnus-summary-respool-article t]
2285 ["Move article..." gnus-summary-move-article
2286 (gnus-check-backend-function
2287 'request-move-article gnus-newsgroup-name)]
2288 ["Copy article..." gnus-summary-copy-article t]
2289 ["Crosspost article..." gnus-summary-crosspost-article
2290 (gnus-check-backend-function
2291 'request-replace-article gnus-newsgroup-name)]
2292 ["Import file..." gnus-summary-import-article
2293 (gnus-check-backend-function
2294 'request-accept-article gnus-newsgroup-name)]
2295 ["Create article..." gnus-summary-create-article
2296 (gnus-check-backend-function
2297 'request-accept-article gnus-newsgroup-name)]
2298 ["Check if posted" gnus-summary-article-posted-p t]
2299 ["Edit article" gnus-summary-edit-article
2300 (not (gnus-group-read-only-p))]
2301 ["Delete article" gnus-summary-delete-article
2302 (gnus-check-backend-function
2303 'request-expire-articles gnus-newsgroup-name)]
2304 ["Query respool" gnus-summary-respool-query t]
2305 ["Trace respool" gnus-summary-respool-trace t]
2306 ["Delete expirable articles" gnus-summary-expire-articles-now
2307 (gnus-check-backend-function
2308 'request-expire-articles gnus-newsgroup-name)])
2310 ["Uudecode" gnus-uu-decode-uu
2311 ,@(if (featurep 'xemacs) '(t)
2312 '(:help "Decode uuencoded article(s)"))]
2313 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2314 ["Unshar" gnus-uu-decode-unshar t]
2315 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2316 ["Save" gnus-uu-decode-save t]
2317 ["Binhex" gnus-uu-decode-binhex t]
2318 ["Postscript" gnus-uu-decode-postscript t]
2319 ["All MIME parts" gnus-summary-save-parts t])
2321 ["Enter article" gnus-cache-enter-article t]
2322 ["Remove article" gnus-cache-remove-article t])
2323 ["Translate" gnus-article-babel t]
2324 ["Select article buffer" gnus-summary-select-article-buffer t]
2325 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2326 ["Isearch article..." gnus-summary-isearch-article t]
2327 ["Beginning of the article" gnus-summary-beginning-of-article t]
2328 ["End of the article" gnus-summary-end-of-article t]
2329 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2330 ["Fetch referenced articles" gnus-summary-refer-references t]
2331 ["Fetch current thread" gnus-summary-refer-thread t]
2332 ["Fetch article with id..." gnus-summary-refer-article t]
2333 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2334 ["Redisplay" gnus-summary-show-article t]
2335 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2337 gnus-summary-article-menu gnus-summary-mode-map ""
2338 (cons "Article" innards))
2340 (if (not (keymapp gnus-summary-article-menu))
2342 gnus-article-commands-menu gnus-article-mode-map ""
2343 (cons "Commands" innards))
2344 ;; in Emacs, don't share menu.
2345 (setq gnus-article-commands-menu
2346 (copy-keymap gnus-summary-article-menu))
2347 (define-key gnus-article-mode-map [menu-bar commands]
2348 (cons "Commands" gnus-article-commands-menu))))
2351 gnus-summary-thread-menu gnus-summary-mode-map ""
2353 ["Find all messages in thread" gnus-summary-refer-thread t]
2354 ["Toggle threading" gnus-summary-toggle-threads t]
2355 ["Hide threads" gnus-summary-hide-all-threads t]
2356 ["Show threads" gnus-summary-show-all-threads t]
2357 ["Hide thread" gnus-summary-hide-thread t]
2358 ["Show thread" gnus-summary-show-thread t]
2359 ["Go to next thread" gnus-summary-next-thread t]
2360 ["Go to previous thread" gnus-summary-prev-thread t]
2361 ["Go down thread" gnus-summary-down-thread t]
2362 ["Go up thread" gnus-summary-up-thread t]
2363 ["Top of thread" gnus-summary-top-thread t]
2364 ["Mark thread as read" gnus-summary-kill-thread t]
2365 ["Lower thread score" gnus-summary-lower-thread t]
2366 ["Raise thread score" gnus-summary-raise-thread t]
2367 ["Rethread current" gnus-summary-rethread-current t]))
2370 gnus-summary-post-menu gnus-summary-mode-map ""
2372 ["Send a message (mail or news)" gnus-summary-post-news
2373 ,@(if (featurep 'xemacs) '(t)
2374 '(:help "Compose a new message (mail or news)"))]
2375 ["Followup" gnus-summary-followup
2376 ,@(if (featurep 'xemacs) '(t)
2377 '(:help "Post followup to this article"))]
2378 ["Followup and yank" gnus-summary-followup-with-original
2379 ,@(if (featurep 'xemacs) '(t)
2380 '(:help "Post followup to this article, quoting its contents"))]
2381 ["Supersede article" gnus-summary-supersede-article t]
2382 ["Cancel article" gnus-summary-cancel-article
2383 ,@(if (featurep 'xemacs) '(t)
2384 '(:help "Cancel an article you posted"))]
2385 ["Reply" gnus-summary-reply t]
2386 ["Reply and yank" gnus-summary-reply-with-original t]
2387 ["Wide reply" gnus-summary-wide-reply t]
2388 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2389 ,@(if (featurep 'xemacs) '(t)
2390 '(:help "Mail a reply, quoting this article"))]
2391 ["Very wide reply" gnus-summary-very-wide-reply t]
2392 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2393 ,@(if (featurep 'xemacs) '(t)
2394 '(:help "Mail a very wide reply, quoting this article"))]
2395 ["Mail forward" gnus-summary-mail-forward t]
2396 ["Post forward" gnus-summary-post-forward t]
2397 ["Digest and mail" gnus-uu-digest-mail-forward t]
2398 ["Digest and post" gnus-uu-digest-post-forward t]
2399 ["Resend message" gnus-summary-resend-message t]
2400 ["Resend message edit" gnus-summary-resend-message-edit t]
2401 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2402 ["Send a mail" gnus-summary-mail-other-window t]
2403 ["Create a local message" gnus-summary-news-other-window t]
2404 ["Uuencode and post" gnus-uu-post-news
2405 ,@(if (featurep 'xemacs) '(t)
2406 '(:help "Post a uuencoded article"))]
2407 ["Followup via news" gnus-summary-followup-to-mail t]
2408 ["Followup via news and yank"
2409 gnus-summary-followup-to-mail-with-original t]
2411 ;;["Send" gnus-summary-send-draft t]
2412 ;;["Send bounced" gnus-resend-bounced-mail t])
2416 ((not (keymapp gnus-summary-post-menu))
2417 (setq gnus-article-post-menu gnus-summary-post-menu))
2418 ((not gnus-article-post-menu)
2419 ;; Don't share post menu.
2420 (setq gnus-article-post-menu
2421 (copy-keymap gnus-summary-post-menu))))
2422 (define-key gnus-article-mode-map [menu-bar post]
2423 (cons "Post" gnus-article-post-menu))
2426 gnus-summary-misc-menu gnus-summary-mode-map ""
2429 ["Mark as read" gnus-summary-mark-as-read-forward t]
2430 ["Mark same subject and select"
2431 gnus-summary-kill-same-subject-and-select t]
2432 ["Mark same subject" gnus-summary-kill-same-subject t]
2433 ["Catchup" gnus-summary-catchup
2434 ,@(if (featurep 'xemacs) '(t)
2435 '(:help "Mark unread articles in this group as read"))]
2436 ["Catchup all" gnus-summary-catchup-all t]
2437 ["Catchup to here" gnus-summary-catchup-to-here t]
2438 ["Catchup from here" gnus-summary-catchup-from-here t]
2439 ["Catchup region" gnus-summary-mark-region-as-read
2440 (gnus-mark-active-p)]
2441 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2443 ["Tick" gnus-summary-tick-article-forward t]
2444 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2445 ["Remove marks" gnus-summary-clear-mark-forward t]
2446 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2447 ["Set bookmark" gnus-summary-set-bookmark t]
2448 ["Remove bookmark" gnus-summary-remove-bookmark t])
2450 ["Marks..." gnus-summary-limit-to-marks t]
2451 ["Subject..." gnus-summary-limit-to-subject t]
2452 ["Author..." gnus-summary-limit-to-author t]
2453 ["Age..." gnus-summary-limit-to-age t]
2454 ["Extra..." gnus-summary-limit-to-extra t]
2455 ["Score..." gnus-summary-limit-to-score t]
2456 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2457 ["Unread" gnus-summary-limit-to-unread t]
2458 ["Unseen" gnus-summary-limit-to-unseen t]
2459 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2460 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2461 ["Pop limit" gnus-summary-pop-limit t]
2462 ["Show dormant" gnus-summary-limit-include-dormant t]
2463 ["Hide childless dormant"
2464 gnus-summary-limit-exclude-childless-dormant t]
2465 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2466 ["Hide marked" gnus-summary-limit-exclude-marks t]
2467 ["Show expunged" gnus-summary-limit-include-expunged t])
2469 ["Set mark" gnus-summary-mark-as-processable t]
2470 ["Remove mark" gnus-summary-unmark-as-processable t]
2471 ["Remove all marks" gnus-summary-unmark-all-processable t]
2472 ["Mark above" gnus-uu-mark-over t]
2473 ["Mark series" gnus-uu-mark-series t]
2474 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2475 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2476 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2477 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2478 ["Mark all" gnus-uu-mark-all t]
2479 ["Mark buffer" gnus-uu-mark-buffer t]
2480 ["Mark sparse" gnus-uu-mark-sparse t]
2481 ["Mark thread" gnus-uu-mark-thread t]
2482 ["Unmark thread" gnus-uu-unmark-thread t]
2483 ("Process Mark Sets"
2484 ["Kill" gnus-summary-kill-process-mark t]
2485 ["Yank" gnus-summary-yank-process-mark
2486 gnus-newsgroup-process-stack]
2487 ["Save" gnus-summary-save-process-mark t]
2488 ["Run command on marked..." gnus-summary-universal-argument t]))
2490 ["Page forward" gnus-summary-next-page
2491 ,@(if (featurep 'xemacs) '(t)
2492 '(:help "Show next page of article"))]
2493 ["Page backward" gnus-summary-prev-page
2494 ,@(if (featurep 'xemacs) '(t)
2495 '(:help "Show previous page of article"))]
2496 ["Line forward" gnus-summary-scroll-up t])
2498 ["Next unread article" gnus-summary-next-unread-article t]
2499 ["Previous unread article" gnus-summary-prev-unread-article t]
2500 ["Next article" gnus-summary-next-article t]
2501 ["Previous article" gnus-summary-prev-article t]
2502 ["Next unread subject" gnus-summary-next-unread-subject t]
2503 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2504 ["Next article same subject" gnus-summary-next-same-subject t]
2505 ["Previous article same subject" gnus-summary-prev-same-subject t]
2506 ["First unread article" gnus-summary-first-unread-article t]
2507 ["Best unread article" gnus-summary-best-unread-article t]
2508 ["Go to subject number..." gnus-summary-goto-subject t]
2509 ["Go to article number..." gnus-summary-goto-article t]
2510 ["Go to the last article" gnus-summary-goto-last-article t]
2511 ["Pop article off history" gnus-summary-pop-article t])
2513 ["Sort by number" gnus-summary-sort-by-number t]
2514 ["Sort by author" gnus-summary-sort-by-author t]
2515 ["Sort by subject" gnus-summary-sort-by-subject t]
2516 ["Sort by date" gnus-summary-sort-by-date t]
2517 ["Sort by score" gnus-summary-sort-by-score t]
2518 ["Sort by lines" gnus-summary-sort-by-lines t]
2519 ["Sort by characters" gnus-summary-sort-by-chars t]
2520 ["Randomize" gnus-summary-sort-by-random t]
2521 ["Original sort" gnus-summary-sort-by-original t])
2523 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2524 ["Describe group" gnus-summary-describe-group t]
2525 ["Fetch charter" gnus-group-fetch-charter
2526 ,@(if (featurep 'xemacs) nil
2527 '(:help "Display the charter of the current group"))]
2528 ["Fetch control message" gnus-group-fetch-control
2529 ,@(if (featurep 'xemacs) nil
2530 '(:help "Display the archived control message for the current group"))]
2531 ["Read manual" gnus-info-find-node t])
2533 ["Pick and read" gnus-pick-mode t]
2534 ["Binary" gnus-binary-mode t])
2536 ["Regenerate" gnus-summary-prepare t]
2537 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2538 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2539 ["Toggle threading" gnus-summary-toggle-threads t])
2540 ["See old articles" gnus-summary-insert-old-articles t]
2541 ["See new articles" gnus-summary-insert-new-articles t]
2542 ["Filter articles..." gnus-summary-execute-command t]
2543 ["Run command on articles..." gnus-summary-universal-argument t]
2544 ["Search articles forward..." gnus-summary-search-article-forward t]
2545 ["Search articles backward..." gnus-summary-search-article-backward t]
2546 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2547 ["Expand window" gnus-summary-expand-window t]
2548 ["Expire expirable articles" gnus-summary-expire-articles
2549 (gnus-check-backend-function
2550 'request-expire-articles gnus-newsgroup-name)]
2551 ["Edit local kill file" gnus-summary-edit-local-kill t]
2552 ["Edit main kill file" gnus-summary-edit-global-kill t]
2553 ["Edit group parameters" gnus-summary-edit-parameters t]
2554 ["Customize group parameters" gnus-summary-customize-parameters t]
2555 ["Send a bug report" gnus-bug t]
2557 ["Catchup and exit" gnus-summary-catchup-and-exit
2558 ,@(if (featurep 'xemacs) '(t)
2559 '(:help "Mark unread articles in this group as read, then exit"))]
2560 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2561 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2562 ["Exit group" gnus-summary-exit
2563 ,@(if (featurep 'xemacs) '(t)
2564 '(:help "Exit current group, return to group selection mode"))]
2565 ["Exit group without updating" gnus-summary-exit-no-update t]
2566 ["Exit and goto next group" gnus-summary-next-group t]
2567 ["Exit and goto prev group" gnus-summary-prev-group t]
2568 ["Reselect group" gnus-summary-reselect-current-group t]
2569 ["Rescan group" gnus-summary-rescan-group t]
2570 ["Update dribble" gnus-summary-save-newsrc t])))
2572 (gnus-run-hooks 'gnus-summary-menu-hook)))
2574 (defvar gnus-summary-tool-bar-map nil)
2576 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2577 ;; affect _new_ message buffers. We might add a function that walks thru all
2578 ;; summary-mode buffers and force the update.
2579 (defun gnus-summary-tool-bar-update (&optional symbol value)
2580 "Update summary mode toolbar.
2581 Setter function for custom variables."
2582 (setq-default gnus-summary-tool-bar-map nil)
2584 ;; When used as ":set" function:
2585 (set-default symbol value))
2586 (when (gnus-buffer-live-p gnus-summary-buffer)
2587 (with-current-buffer gnus-summary-buffer
2588 (gnus-summary-make-tool-bar))))
2590 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2591 'gnus-summary-tool-bar-gnome
2592 'gnus-summary-tool-bar-retro)
2593 "Specifies the Gnus summary tool bar.
2595 It can be either a list or a symbol refering to a list. See
2596 `gmm-tool-bar-from-list' for the format of the list. The
2597 default key map is `gnus-summary-mode-map'.
2599 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2600 `gnus-summary-tool-bar-retro'."
2601 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2602 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2603 (repeat :tag "User defined list" gmm-tool-bar-item)
2605 :version "22.1" ;; Gnus 5.10.9
2606 :initialize 'custom-initialize-default
2607 :set 'gnus-summary-tool-bar-update
2608 :group 'gnus-summary)
2610 (defcustom gnus-summary-tool-bar-gnome
2611 '((gnus-summary-post-news "mail/compose" nil)
2612 (gnus-summary-insert-new-articles "mail/inbox" nil
2613 :visible (or (not gnus-agent)
2615 (gnus-summary-reply-with-original "mail/reply")
2616 (gnus-summary-reply "mail/reply" nil :visible nil)
2617 (gnus-summary-followup-with-original "mail/reply-all")
2618 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2619 (gnus-summary-mail-forward "mail/forward")
2620 (gnus-summary-save-article "mail/save")
2621 (gnus-summary-search-article-forward "search" nil :visible nil)
2622 (gnus-summary-print-article "print")
2623 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2624 ;; Some new commands that may need more suitable icons:
2625 (gnus-summary-save-newsrc "save" nil :visible nil)
2626 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2627 (gnus-summary-prev-article "left-arrow")
2628 (gnus-summary-next-article "right-arrow")
2629 (gnus-summary-next-page "next-page")
2630 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2632 ;; Maybe some sort-by-... could be added:
2633 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2634 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2635 (gnus-summary-mark-as-expirable
2637 :visible (gnus-check-backend-function 'request-expire-articles
2638 gnus-newsgroup-name))
2639 (gnus-summary-mark-as-spam
2641 :visible (and (fboundp 'spam-group-ham-contents-p)
2642 (spam-group-ham-contents-p gnus-newsgroup-name))
2643 :help "Mark as spam")
2644 (gnus-summary-mark-as-read-forward
2646 :visible (and (fboundp 'spam-group-spam-contents-p)
2647 (spam-group-spam-contents-p gnus-newsgroup-name)))
2649 (gnus-summary-exit "exit")
2650 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2651 (gnus-info-find-node "help"))
2652 "List of functions for the summary tool bar (GNOME style).
2654 See `gmm-tool-bar-from-list' for the format of the list."
2655 :type '(repeat gmm-tool-bar-item)
2656 :version "22.1" ;; Gnus 5.10.9
2657 :initialize 'custom-initialize-default
2658 :set 'gnus-summary-tool-bar-update
2659 :group 'gnus-summary)
2661 (defcustom gnus-summary-tool-bar-retro
2662 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2663 (gnus-summary-next-unread-article "gnus/next-ur")
2664 (gnus-summary-post-news "gnus/post")
2665 (gnus-summary-followup-with-original "gnus/fuwo")
2666 (gnus-summary-followup "gnus/followup")
2667 (gnus-summary-reply-with-original "gnus/reply-wo")
2668 (gnus-summary-reply "gnus/reply")
2669 (gnus-summary-caesar-message "gnus/rot13")
2670 (gnus-uu-decode-uu "gnus/uu-decode")
2671 (gnus-summary-save-article-file "gnus/save-aif")
2672 (gnus-summary-save-article "gnus/save-art")
2673 (gnus-uu-post-news "gnus/uu-post")
2674 (gnus-summary-catchup "gnus/catchup")
2675 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2676 (gnus-summary-exit "gnus/exit-summ")
2677 ;; Some new command that may need more suitable icons:
2678 (gnus-summary-print-article "gnus/print" nil :visible nil)
2679 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2680 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2681 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2682 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2683 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2684 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2686 (gnus-info-find-node "gnus/help" nil :visible nil))
2687 "List of functions for the summary tool bar (retro look).
2689 See `gmm-tool-bar-from-list' for the format of the list."
2690 :type '(repeat gmm-tool-bar-item)
2691 :version "22.1" ;; Gnus 5.10.9
2692 :initialize 'custom-initialize-default
2693 :set 'gnus-summary-tool-bar-update
2694 :group 'gnus-summary)
2696 (defcustom gnus-summary-tool-bar-zap-list t
2697 "List of icon items from the global tool bar.
2698 These items are not displayed in the Gnus summary mode tool bar.
2700 See `gmm-tool-bar-from-list' for the format of the list."
2701 :type 'gmm-tool-bar-zap-list
2702 :version "22.1" ;; Gnus 5.10.9
2703 :initialize 'custom-initialize-default
2704 :set 'gnus-summary-tool-bar-update
2705 :group 'gnus-summary)
2707 (defvar image-load-path)
2709 (defun gnus-summary-make-tool-bar (&optional force)
2710 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2711 When FORCE, rebuild the tool bar."
2712 (when (and (not (featurep 'xemacs))
2713 (boundp 'tool-bar-mode)
2715 (or (not gnus-summary-tool-bar-map) force))
2717 (gmm-image-load-path-for-library "gnus"
2720 (image-load-path (cons (car load-path)
2721 (when (boundp 'image-load-path)
2723 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2724 gnus-summary-tool-bar-zap-list
2725 'gnus-summary-mode-map)))
2727 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2729 (setq gnus-summary-tool-bar-map map))))
2730 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2732 (defun gnus-score-set-default (var value)
2733 "A version of set that updates the GNU Emacs menu-bar."
2735 ;; It is the message that forces the active status to be updated.
2738 (defun gnus-make-score-map (type)
2739 "Make a summary score map of type TYPE."
2742 (let ((headers '(("author" "from" string)
2743 ("subject" "subject" string)
2744 ("article body" "body" string)
2745 ("article head" "head" string)
2746 ("xref" "xref" string)
2747 ("extra header" "extra" string)
2748 ("lines" "lines" number)
2749 ("followups to author" "followup" string)))
2750 (types '((number ("less than" <)
2753 (string ("substring" s)
2757 (perms '(("temporary" (current-time-string))
2765 (if (eq type 'lower)
2770 (setq header (car headers))
2776 (let ((ts (cdr (assoc (nth 2 header) types)))
2792 'gnus-summary-score-entry
2794 (if (or (string= (nth 1 header)
2796 (string= (nth 1 header)
2799 (list 'gnus-summary-header
2801 (list 'quote (nth 1 (car ts)))
2802 (list 'gnus-score-delta-default
2809 (list (nreverse outp))))
2812 (list (nreverse outt))))
2814 (setq headers (cdr headers)))
2815 (list (nreverse outh))))))))
2819 (defun gnus-summary-mode (&optional group)
2820 "Major mode for reading articles.
2822 All normal editing commands are switched off.
2823 \\<gnus-summary-mode-map>
2824 Each line in this buffer represents one article. To read an
2825 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2826 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2829 You can also post articles and send mail from this buffer. To
2830 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2831 of an article, type `\\[gnus-summary-reply]'.
2833 There are approx. one gazillion commands you can execute in this
2834 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2836 The following commands are available:
2838 \\{gnus-summary-mode-map}"
2840 (kill-all-local-variables)
2841 (when (gnus-visual-p 'summary-menu 'menu)
2842 (gnus-summary-make-menu-bar)
2843 (gnus-summary-make-tool-bar))
2844 (gnus-summary-make-local-variables)
2845 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2846 (gnus-summary-make-local-variables))
2847 (gnus-make-thread-indent-array)
2848 (gnus-simplify-mode-line)
2849 (setq major-mode 'gnus-summary-mode)
2850 (setq mode-name "Summary")
2851 (make-local-variable 'minor-mode-alist)
2852 (use-local-map gnus-summary-mode-map)
2853 (buffer-disable-undo)
2854 (setq buffer-read-only t) ;Disable modification
2855 (setq truncate-lines t)
2856 (setq selective-display t)
2857 (setq selective-display-ellipses t) ;Display `...'
2858 (gnus-summary-set-display-table)
2859 (gnus-set-default-directory)
2860 (setq gnus-newsgroup-name group)
2861 (make-local-variable 'gnus-summary-line-format)
2862 (make-local-variable 'gnus-summary-line-format-spec)
2863 (make-local-variable 'gnus-summary-dummy-line-format)
2864 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2865 (make-local-variable 'gnus-summary-mark-positions)
2866 (gnus-make-local-hook 'pre-command-hook)
2867 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2868 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2869 (turn-on-gnus-mailing-list-mode)
2870 (mm-enable-multibyte)
2871 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2872 (gnus-update-summary-mark-positions))
2874 (defun gnus-summary-make-local-variables ()
2875 "Make all the local summary buffer variables."
2877 (dolist (local gnus-summary-local-variables)
2880 (if (eq (cdr local) 'global)
2881 ;; Copy the global value of the variable.
2882 (setq global (symbol-value (car local)))
2883 ;; Use the value from the list.
2884 (setq global (eval (cdr local))))
2885 (set (make-local-variable (car local)) global))
2886 ;; Simple nil-valued local variable.
2887 (set (make-local-variable local) nil)))))
2889 (defun gnus-summary-clear-local-variables ()
2890 (let ((locals gnus-summary-local-variables))
2892 (if (consp (car locals))
2893 (and (vectorp (caar locals))
2894 (set (caar locals) nil))
2895 (and (vectorp (car locals))
2896 (set (car locals) nil)))
2897 (setq locals (cdr locals)))))
2899 ;; Summary data functions.
2901 (defmacro gnus-data-number (data)
2904 (defmacro gnus-data-set-number (data number)
2905 `(setcar ,data ,number))
2907 (defmacro gnus-data-mark (data)
2910 (defmacro gnus-data-set-mark (data mark)
2911 `(setcar (nthcdr 1 ,data) ,mark))
2913 (defmacro gnus-data-pos (data)
2916 (defmacro gnus-data-set-pos (data pos)
2917 `(setcar (nthcdr 2 ,data) ,pos))
2919 (defmacro gnus-data-header (data)
2922 (defmacro gnus-data-set-header (data header)
2923 `(setf (nth 3 ,data) ,header))
2925 (defmacro gnus-data-level (data)
2928 (defmacro gnus-data-unread-p (data)
2929 `(= (nth 1 ,data) gnus-unread-mark))
2931 (defmacro gnus-data-read-p (data)
2932 `(/= (nth 1 ,data) gnus-unread-mark))
2934 (defmacro gnus-data-pseudo-p (data)
2935 `(consp (nth 3 ,data)))
2937 (defmacro gnus-data-find (number)
2938 `(assq ,number gnus-newsgroup-data))
2940 (defmacro gnus-data-find-list (number &optional data)
2941 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2942 (memq (assq ,number bdata)
2945 (defmacro gnus-data-make (number mark pos header level)
2946 `(list ,number ,mark ,pos ,header ,level))
2948 (defun gnus-data-enter (after-article number mark pos header level offset)
2949 (let ((data (gnus-data-find-list after-article)))
2951 (error "No such article: %d" after-article))
2952 (setcdr data (cons (gnus-data-make number mark pos header level)
2954 (setq gnus-newsgroup-data-reverse nil)
2955 (gnus-data-update-list (cddr data) offset)))
2957 (defun gnus-data-enter-list (after-article list &optional offset)
2959 (let ((data (and after-article (gnus-data-find-list after-article)))
2963 (let ((odata gnus-newsgroup-data))
2964 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2966 (gnus-data-update-list odata offset)))
2967 ;; Find the last element in the list to be spliced into the main
2970 (setq list (cdr list)))
2973 (setcdr list gnus-newsgroup-data)
2974 (setq gnus-newsgroup-data ilist)
2976 (gnus-data-update-list (cdr list) offset)))
2977 (setcdr list (cdr data))
2980 (gnus-data-update-list (cdr list) offset))))
2981 (setq gnus-newsgroup-data-reverse nil))))
2983 (defun gnus-data-remove (article &optional offset)
2984 (let ((data gnus-newsgroup-data))
2985 (if (= (gnus-data-number (car data)) article)
2987 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2988 gnus-newsgroup-data-reverse nil)
2990 (gnus-data-update-list gnus-newsgroup-data offset)))
2992 (when (= (gnus-data-number (cadr data)) article)
2993 (setcdr data (cddr data))
2995 (gnus-data-update-list (cdr data) offset))
2997 gnus-newsgroup-data-reverse nil))
2998 (setq data (cdr data))))))
3000 (defmacro gnus-data-list (backward)
3002 (or gnus-newsgroup-data-reverse
3003 (setq gnus-newsgroup-data-reverse
3004 (reverse gnus-newsgroup-data)))
3005 gnus-newsgroup-data))
3007 (defun gnus-data-update-list (data offset)
3008 "Add OFFSET to the POS of all data entries in DATA."
3009 (setq gnus-newsgroup-data-reverse nil)
3011 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3012 (setq data (cdr data))))
3014 (defun gnus-summary-article-pseudo-p (article)
3015 "Say whether this article is a pseudo article or not."
3016 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3018 (defmacro gnus-summary-article-sparse-p (article)
3019 "Say whether this article is a sparse article or not."
3020 `(memq ,article gnus-newsgroup-sparse))
3022 (defmacro gnus-summary-article-ancient-p (article)
3023 "Say whether this article is a sparse article or not."
3024 `(memq ,article gnus-newsgroup-ancient))
3026 (defun gnus-article-parent-p (number)
3027 "Say whether this article is a parent or not."
3028 (let ((data (gnus-data-find-list number)))
3029 (and (cdr data) ; There has to be an article after...
3030 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3031 (gnus-data-level (nth 1 data))))))
3033 (defun gnus-article-children (number)
3034 "Return a list of all children to NUMBER."
3035 (let* ((data (gnus-data-find-list number))
3036 (level (gnus-data-level (car data)))
3038 (setq data (cdr data))
3040 (= (gnus-data-level (car data)) (1+ level)))
3041 (push (gnus-data-number (car data)) children)
3042 (setq data (cdr data)))
3045 (defmacro gnus-summary-skip-intangible ()
3046 "If the current article is intangible, then jump to a different article."
3047 '(let ((to (get-text-property (point) 'gnus-intangible)))
3048 (and to (gnus-summary-goto-subject to))))
3050 (defmacro gnus-summary-article-intangible-p ()
3051 "Say whether this article is intangible or not."
3052 '(get-text-property (point) 'gnus-intangible))
3054 (defun gnus-article-read-p (article)
3055 "Say whether ARTICLE is read or not."
3056 (not (or (memq article gnus-newsgroup-marked)
3057 (memq article gnus-newsgroup-spam-marked)
3058 (memq article gnus-newsgroup-unreads)
3059 (memq article gnus-newsgroup-unselected)
3060 (memq article gnus-newsgroup-dormant))))
3062 ;; Some summary mode macros.
3064 (defmacro gnus-summary-article-number ()
3065 "The article number of the article on the current line.
3066 If there isn't an article number here, then we return the current
3069 (gnus-summary-skip-intangible)
3070 (or (get-text-property (point) 'gnus-number)
3071 (gnus-summary-last-subject))))
3073 (defmacro gnus-summary-article-header (&optional number)
3074 "Return the header of article NUMBER."
3075 `(gnus-data-header (gnus-data-find
3076 ,(or number '(gnus-summary-article-number)))))
3078 (defmacro gnus-summary-thread-level (&optional number)
3079 "Return the level of thread that starts with article NUMBER."
3080 `(if (and (eq gnus-summary-make-false-root 'dummy)
3081 (get-text-property (point) 'gnus-intangible))
3083 (gnus-data-level (gnus-data-find
3084 ,(or number '(gnus-summary-article-number))))))
3086 (defmacro gnus-summary-article-mark (&optional number)
3087 "Return the mark of article NUMBER."
3088 `(gnus-data-mark (gnus-data-find
3089 ,(or number '(gnus-summary-article-number)))))
3091 (defmacro gnus-summary-article-pos (&optional number)
3092 "Return the position of the line of article NUMBER."
3093 `(gnus-data-pos (gnus-data-find
3094 ,(or number '(gnus-summary-article-number)))))
3096 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3097 (defmacro gnus-summary-article-subject (&optional number)
3098 "Return current subject string or nil if nothing."
3101 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3102 '(gnus-data-header (assq (gnus-summary-article-number)
3103 gnus-newsgroup-data)))))
3106 (mail-header-subject headers))))
3108 (defmacro gnus-summary-article-score (&optional number)
3109 "Return current article score."
3110 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3111 gnus-newsgroup-scored))
3112 gnus-summary-default-score 0))
3114 (defun gnus-summary-article-children (&optional number)
3115 "Return a list of article numbers that are children of article NUMBER."
3116 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3117 (level (gnus-data-level (car data)))
3119 (while (and (setq data (cdr data))
3120 (> (setq l (gnus-data-level (car data))) level))
3121 (and (= (1+ level) l)
3122 (push (gnus-data-number (car data))
3124 (nreverse children)))
3126 (defun gnus-summary-article-parent (&optional number)
3127 "Return the article number of the parent of article NUMBER."
3128 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3129 (gnus-data-list t)))
3130 (level (gnus-data-level (car data))))
3132 () ; This is a root.
3133 ;; We search until we find an article with a level less than
3134 ;; this one. That function has to be the parent.
3135 (while (and (setq data (cdr data))
3136 (not (< (gnus-data-level (car data)) level))))
3137 (and data (gnus-data-number (car data))))))
3139 (defun gnus-unread-mark-p (mark)
3140 "Say whether MARK is the unread mark."
3141 (= mark gnus-unread-mark))
3143 (defun gnus-read-mark-p (mark)
3144 "Say whether MARK is one of the marks that mark as read.
3145 This is all marks except unread, ticked, dormant, and expirable."
3146 (not (or (= mark gnus-unread-mark)
3147 (= mark gnus-ticked-mark)
3148 (= mark gnus-spam-mark)
3149 (= mark gnus-dormant-mark)
3150 (= mark gnus-expirable-mark))))
3152 (defmacro gnus-article-mark (number)
3153 "Return the MARK of article NUMBER.
3154 This macro should only be used when computing the mark the \"first\"
3155 time; i.e., when generating the summary lines. After that,
3156 `gnus-summary-article-mark' should be used to examine the
3159 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3160 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3161 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3162 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3163 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3164 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3165 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3166 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3167 gnus-ancient-mark))))
3169 ;; Saving hidden threads.
3171 (defmacro gnus-save-hidden-threads (&rest forms)
3172 "Save hidden threads, eval FORMS, and restore the hidden threads."
3173 (let ((config (make-symbol "config")))
3174 `(let ((,config (gnus-hidden-threads-configuration)))
3178 (gnus-restore-hidden-threads-configuration ,config)))))
3179 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3180 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3182 (defun gnus-data-compute-positions ()
3183 "Compute the positions of all articles."
3184 (setq gnus-newsgroup-data-reverse nil)
3185 (let ((data gnus-newsgroup-data))
3187 (gnus-save-hidden-threads
3188 (gnus-summary-show-all-threads)
3189 (goto-char (point-min))
3191 (while (get-text-property (point) 'gnus-intangible)
3193 (gnus-data-set-pos (car data) (+ (point) 3))
3194 (setq data (cdr data))
3195 (forward-line 1))))))
3197 (defun gnus-hidden-threads-configuration ()
3198 "Return the current hidden threads configuration."
3201 (goto-char (point-min))
3202 (while (search-forward "\r" nil t)
3203 (push (1- (point)) config))
3206 (defun gnus-restore-hidden-threads-configuration (config)
3207 "Restore hidden threads configuration from CONFIG."
3209 (let (point buffer-read-only)
3210 (while (setq point (pop config))
3211 (when (and (< point (point-max))
3213 (eq (char-after) ?\n))
3214 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3216 ;; Various summary mode internalish functions.
3218 (defun gnus-mouse-pick-article (e)
3221 (gnus-summary-next-page nil t))
3223 (defun gnus-summary-set-display-table ()
3224 "Change the display table.
3225 Odd characters have a tendency to mess
3226 up nicely formatted displays - we make all possible glyphs
3227 display only a single character."
3229 ;; We start from the standard display table, if any.
3230 (let ((table (or (copy-sequence standard-display-table)
3231 (make-display-table)))
3233 ;; Nix out all the control chars...
3234 (while (>= (setq i (1- i)) 0)
3235 (aset table i [??]))
3236 ;; ... but not newline and cr, of course. (cr is necessary for the
3237 ;; selective display).
3238 (aset table ?\n nil)
3239 (aset table ?\r nil)
3240 ;; We keep TAB as well.
3241 (aset table ?\t nil)
3242 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3243 ;; Emacs 23 (unicode), that are not set already.
3244 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3247 (while (>= (setq i (1- i)) 127)
3248 ;; Only modify if the entry is nil.
3249 (unless (aref table i)
3250 (aset table i [??]))))
3251 (setq buffer-display-table table)))
3253 (defun gnus-summary-set-article-display-arrow (pos)
3254 "Update the overlay arrow to point to line at position POS."
3255 (when (and gnus-summary-display-arrow
3256 (boundp 'overlay-arrow-position)
3257 (boundp 'overlay-arrow-string))
3261 (unless overlay-arrow-position
3262 (setq overlay-arrow-position (make-marker)))
3263 (setq overlay-arrow-string "=>"
3264 overlay-arrow-position (set-marker overlay-arrow-position
3266 (current-buffer))))))
3268 (defun gnus-summary-setup-buffer (group)
3269 "Initialize summary buffer."
3270 (let ((buffer (gnus-summary-buffer-name group))
3271 (dead-name (concat "*Dead Summary "
3272 (gnus-group-decoded-name group) "*")))
3273 ;; If a dead summary buffer exists, we kill it.
3274 (when (gnus-buffer-live-p dead-name)
3275 (gnus-kill-buffer dead-name))
3276 (if (get-buffer buffer)
3279 (setq gnus-summary-buffer (current-buffer))
3280 (not gnus-newsgroup-prepared))
3281 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3282 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3283 (gnus-summary-mode group)
3285 (gnus-carpal-setup-buffer 'summary))
3286 (unless gnus-single-article-buffer
3287 (make-local-variable 'gnus-article-buffer)
3288 (make-local-variable 'gnus-article-current)
3289 (make-local-variable 'gnus-original-article-buffer))
3290 (setq gnus-newsgroup-name group)
3291 ;; Set any local variables in the group parameters.
3292 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3295 (defun gnus-set-global-variables ()
3296 "Set the global equivalents of the buffer-local variables.
3297 They are set to the latest values they had. These reflect the summary
3298 buffer that was in action when the last article was fetched."
3299 (when (eq major-mode 'gnus-summary-mode)
3300 (setq gnus-summary-buffer (current-buffer))
3301 (let ((name gnus-newsgroup-name)
3302 (marked gnus-newsgroup-marked)
3303 (spam gnus-newsgroup-spam-marked)
3304 (unread gnus-newsgroup-unreads)
3305 (headers gnus-current-headers)
3306 (data gnus-newsgroup-data)
3307 (summary gnus-summary-buffer)
3308 (article-buffer gnus-article-buffer)
3309 (original gnus-original-article-buffer)
3310 (gac gnus-article-current)
3311 (reffed gnus-reffed-article-number)
3312 (score-file gnus-current-score-file)
3313 (default-charset gnus-newsgroup-charset)
3315 (let ((locals gnus-newsgroup-variables))
3317 (if (consp (car locals))
3318 (push (eval (caar locals)) vlist)
3319 (push (eval (car locals)) vlist))
3320 (setq locals (cdr locals)))
3321 (setq vlist (nreverse vlist)))
3323 (set-buffer gnus-group-buffer)
3324 (setq gnus-newsgroup-name name
3325 gnus-newsgroup-marked marked
3326 gnus-newsgroup-spam-marked spam
3327 gnus-newsgroup-unreads unread
3328 gnus-current-headers headers
3329 gnus-newsgroup-data data
3330 gnus-article-current gac
3331 gnus-summary-buffer summary
3332 gnus-article-buffer article-buffer
3333 gnus-original-article-buffer original
3334 gnus-reffed-article-number reffed
3335 gnus-current-score-file score-file
3336 gnus-newsgroup-charset default-charset)
3337 (let ((locals gnus-newsgroup-variables))
3339 (if (consp (car locals))
3340 (set (caar locals) (pop vlist))
3341 (set (car locals) (pop vlist)))
3342 (setq locals (cdr locals))))
3343 ;; The article buffer also has local variables.
3344 (when (gnus-buffer-live-p gnus-article-buffer)
3345 (set-buffer gnus-article-buffer)
3346 (setq gnus-summary-buffer summary))))))
3348 (defun gnus-summary-article-unread-p (article)
3349 "Say whether ARTICLE is unread or not."
3350 (memq article gnus-newsgroup-unreads))
3352 (defun gnus-summary-first-article-p (&optional article)
3353 "Return whether ARTICLE is the first article in the buffer."
3354 (if (not (setq article (or article (gnus-summary-article-number))))
3356 (eq article (caar gnus-newsgroup-data))))
3358 (defun gnus-summary-last-article-p (&optional article)
3359 "Return whether ARTICLE is the last article in the buffer."
3360 (if (not (setq article (or article (gnus-summary-article-number))))
3361 ;; All non-existent numbers are the last article. :-)
3363 (not (cdr (gnus-data-find-list article)))))
3365 (defun gnus-make-thread-indent-array (&optional n)
3367 (progn (setq n 200) nil)
3368 (null gnus-thread-indent-array)
3369 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3370 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3371 gnus-thread-indent-array-level gnus-thread-indent-level)
3373 (aset gnus-thread-indent-array n
3374 (make-string (* n gnus-thread-indent-level) ? ))
3377 (defun gnus-update-summary-mark-positions ()
3378 "Compute where the summary marks are to go."
3380 (when (gnus-buffer-exists-p gnus-summary-buffer)
3381 (set-buffer gnus-summary-buffer))
3382 (let ((spec gnus-summary-line-format-spec)
3385 (gnus-set-work-buffer)
3386 (let ((gnus-tmp-unread ?Z)
3387 (gnus-replied-mark ?Z)
3388 (gnus-score-below-mark ?Z)
3389 (gnus-score-over-mark ?Z)
3390 (gnus-undownloaded-mark ?Z)
3391 (gnus-summary-line-format-spec spec)
3392 (gnus-newsgroup-downloadable '(0))
3393 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3394 case-fold-search ignores)
3395 ;; Here, all marks are bound to Z.
3396 (gnus-summary-insert-line header
3397 0 nil t gnus-tmp-unread t nil "" nil 1)
3398 (goto-char (point-min))
3399 ;; Memorize the positions of the same characters as dummy marks.
3400 (while (re-search-forward "[A-D]" nil t)
3401 (push (point) ignores))
3403 ;; We use A-D as dummy marks in order to know column positions
3404 ;; where marks should be inserted.
3405 (setq gnus-tmp-unread ?A
3406 gnus-replied-mark ?B
3407 gnus-score-below-mark ?C
3408 gnus-score-over-mark ?C
3409 gnus-undownloaded-mark ?D)
3410 (gnus-summary-insert-line header
3411 0 nil t gnus-tmp-unread t nil "" nil 1)
3412 ;; Ignore characters which aren't dummy marks.
3414 (delete-region (goto-char (1- p)) p)
3416 (goto-char (point-min))
3417 (setq pos (list (cons 'unread
3418 (and (search-forward "A" nil t)
3419 (- (point) (point-min) 1)))))
3420 (goto-char (point-min))
3421 (push (cons 'replied (and (search-forward "B" nil t)
3422 (- (point) (point-min) 1)))
3424 (goto-char (point-min))
3425 (push (cons 'score (and (search-forward "C" nil t)
3426 (- (point) (point-min) 1)))
3428 (goto-char (point-min))
3429 (push (cons 'download (and (search-forward "D" nil t)
3430 (- (point) (point-min) 1)))
3432 (setq gnus-summary-mark-positions pos))))
3434 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3435 "Insert a dummy root in the summary buffer."
3437 (gnus-add-text-properties
3438 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3439 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3441 (defun gnus-summary-extract-address-component (from)
3442 (or (car (funcall gnus-extract-address-components from))
3445 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3446 (let ((mail-parse-charset gnus-newsgroup-charset)
3447 ; Is it really necessary to do this next part for each summary line?
3448 ; Luckily, doesn't seem to slow things down much.
3449 (mail-parse-ignored-charsets
3450 (save-excursion (set-buffer gnus-summary-buffer)
3451 gnus-newsgroup-ignored-charsets)))
3453 (and gnus-ignored-from-addresses
3454 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3455 (let ((extra-headers (mail-header-extra header))
3459 ((setq to (cdr (assq 'To extra-headers)))
3462 (gnus-summary-extract-address-component
3463 (funcall gnus-decode-encoded-address-function to)))))
3464 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3465 (concat "=> " newsgroups)))))
3466 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3468 (defun gnus-summary-insert-line (gnus-tmp-header
3469 gnus-tmp-level gnus-tmp-current
3470 undownloaded gnus-tmp-unread gnus-tmp-replied
3471 gnus-tmp-expirable gnus-tmp-subject-or-nil
3472 &optional gnus-tmp-dummy gnus-tmp-score
3474 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3475 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3477 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3478 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3479 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3480 (gnus-tmp-score-char
3481 (if (or (null gnus-summary-default-score)
3482 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3483 gnus-summary-zcore-fuzz))
3485 (if (< gnus-tmp-score gnus-summary-default-score)
3486 gnus-score-below-mark gnus-score-over-mark)))
3487 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3489 (cond (gnus-tmp-process gnus-process-mark)
3490 ((memq gnus-tmp-current gnus-newsgroup-cached)
3492 (gnus-tmp-replied gnus-replied-mark)
3493 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3494 gnus-forwarded-mark)
3495 ((memq gnus-tmp-current gnus-newsgroup-saved)
3497 ((memq gnus-tmp-number gnus-newsgroup-recent)
3499 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3502 (gnus-tmp-downloaded
3504 gnus-undownloaded-mark)
3505 (gnus-newsgroup-agentized
3506 gnus-downloaded-mark)
3509 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3512 ((string-match "<[^>]+> *$" gnus-tmp-from)
3513 (let ((beg (match-beginning 0)))
3514 (or (and (string-match "^\".+\"" gnus-tmp-from)
3515 (substring gnus-tmp-from 1 (1- (match-end 0))))
3516 (substring gnus-tmp-from 0 beg))))
3517 ((string-match "(.+)" gnus-tmp-from)
3518 (substring gnus-tmp-from
3519 (1+ (match-beginning 0)) (1- (match-end 0))))
3521 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3522 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3523 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3524 (buffer-read-only nil))
3525 (when (string= gnus-tmp-name "")
3526 (setq gnus-tmp-name gnus-tmp-from))
3527 (unless (numberp gnus-tmp-lines)
3528 (setq gnus-tmp-lines -1))
3529 (if (= gnus-tmp-lines -1)
3530 (setq gnus-tmp-lines "?")
3531 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3532 (gnus-put-text-property
3534 (progn (eval gnus-summary-line-format-spec) (point))
3535 'gnus-number gnus-tmp-number)
3536 (when (gnus-visual-p 'summary-highlight 'highlight)
3538 (gnus-run-hooks 'gnus-summary-update-hook)
3541 (defun gnus-summary-update-line (&optional dont-update)
3542 "Update summary line after change."
3543 (when (and gnus-summary-default-score
3544 (not gnus-summary-inhibit-highlight))
3545 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3546 (article (gnus-summary-article-number))
3547 (score (gnus-summary-article-score article)))
3549 (if (and gnus-summary-mark-below
3550 (< (gnus-summary-article-score)
3551 gnus-summary-mark-below))
3552 ;; This article has a low score, so we mark it as read.
3553 (when (memq article gnus-newsgroup-unreads)
3554 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3555 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3556 ;; This article was previously marked as read on account
3557 ;; of a low score, but now it has risen, so we mark it as
3559 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3560 (gnus-summary-update-mark
3561 (if (or (null gnus-summary-default-score)
3562 (<= (abs (- score gnus-summary-default-score))
3563 gnus-summary-zcore-fuzz))
3565 (if (< score gnus-summary-default-score)
3566 gnus-score-below-mark gnus-score-over-mark))
3568 ;; Do visual highlighting.
3569 (when (gnus-visual-p 'summary-highlight 'highlight)
3570 (gnus-run-hooks 'gnus-summary-update-hook)))))
3572 (defvar gnus-tmp-new-adopts nil)
3574 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3575 "Return the number of articles in THREAD.
3576 This may be 0 in some cases -- if none of the articles in
3577 the thread are to be displayed."
3579 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3581 ((not (listp thread))
3583 ((and (consp thread) (cdr thread))
3586 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3589 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3592 (when (and level (zerop level) gnus-tmp-new-adopts)
3595 'gnus-summary-number-of-articles-in-thread
3596 gnus-tmp-new-adopts))))
3598 (if (> number 1) gnus-not-empty-thread-mark
3599 gnus-empty-thread-mark)
3602 (defsubst gnus-summary-line-message-size (head)
3603 "Return pretty-printed version of message size.
3604 This function is intended to be used in
3605 `gnus-summary-line-format-alist'."
3606 (let ((c (or (mail-header-chars head) -1)))
3607 (cond ((< c 0) "n/a") ; chars not available
3608 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3609 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3610 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3611 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3614 (defun gnus-summary-set-local-parameters (group)
3615 "Go through the local params of GROUP and set all variable specs in that list."
3616 (let ((params (gnus-group-find-parameter group))
3617 (vars '(quit-config)) ; Ignore quit-config.
3620 (setq elem (car params)
3621 params (cdr params))
3622 (and (consp elem) ; Has to be a cons.
3623 (consp (cdr elem)) ; The cdr has to be a list.
3624 (symbolp (car elem)) ; Has to be a symbol in there.
3625 (not (memq (car elem) vars))
3626 (ignore-errors ; So we set it.
3627 (push (car elem) vars)
3628 (make-local-variable (car elem))
3629 (set (car elem) (eval (nth 1 elem))))))))
3631 (defun gnus-summary-read-group (group &optional show-all no-article
3632 kill-buffer no-display backward
3634 "Start reading news in newsgroup GROUP.
3635 If SHOW-ALL is non-nil, already read articles are also listed.
3636 If NO-ARTICLE is non-nil, no article is selected initially.
3637 If NO-DISPLAY, don't generate a summary buffer."
3641 (let ((gnus-auto-select-next nil))
3642 (or (gnus-summary-read-group-1
3643 group show-all no-article
3644 kill-buffer no-display
3647 select-articles nil)))))
3648 (eq gnus-auto-select-next 'quietly))
3649 (set-buffer gnus-group-buffer)
3650 ;; The entry function called above goes to the next
3651 ;; group automatically, so we go two groups back
3652 ;; if we are searching for the previous group.
3654 (gnus-group-prev-unread-group 2))
3655 (if (not (equal group (gnus-group-group-name)))
3656 (setq group (gnus-group-group-name))
3660 (defun gnus-summary-read-group-1 (group show-all no-article
3661 kill-buffer no-display
3662 &optional select-articles)
3663 ;; Killed foreign groups can't be entered.
3664 ;; (when (and (not (gnus-group-native-p group))
3665 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3666 ;; (error "Dead non-native groups can't be entered"))
3667 (gnus-message 5 "Retrieving newsgroup: %s..."
3668 (gnus-group-decoded-name group))
3669 (let* ((new-group (gnus-summary-setup-buffer group))
3670 (quit-config (gnus-group-quit-config group))
3671 (did-select (and new-group (gnus-select-newsgroup
3672 group show-all select-articles))))
3674 ;; This summary buffer exists already, so we just select it.
3676 (gnus-set-global-variables)
3678 (gnus-kill-or-deaden-summary kill-buffer))
3679 (gnus-configure-windows 'summary 'force)
3680 (gnus-set-mode-line 'summary)
3681 (gnus-summary-position-point)
3684 ;; We couldn't select this group.
3686 (when (and (eq major-mode 'gnus-summary-mode)
3687 (not (equal (current-buffer) kill-buffer)))
3688 (kill-buffer (current-buffer))
3689 (if (not quit-config)
3691 ;; Update the info -- marks might need to be removed,
3693 (gnus-summary-update-info)
3694 (set-buffer gnus-group-buffer)
3695 (gnus-group-jump-to-group group)
3696 (gnus-group-next-unread-group 1))
3697 (gnus-handle-ephemeral-exit quit-config)))
3698 (let ((grpinfo (gnus-get-info group)))
3699 (if (null (gnus-info-read grpinfo))
3700 (gnus-message 3 "Group %s contains no messages"
3701 (gnus-group-decoded-name group))
3702 (gnus-message 3 "Can't select group")))
3704 ;; The user did a `C-g' while prompting for number of articles,
3705 ;; so we exit this group.
3706 ((eq did-select 'quit)
3707 (and (eq major-mode 'gnus-summary-mode)
3708 (not (equal (current-buffer) kill-buffer))
3709 (kill-buffer (current-buffer)))
3711 (gnus-kill-or-deaden-summary kill-buffer))
3712 (if (not quit-config)
3714 (set-buffer gnus-group-buffer)
3715 (gnus-group-jump-to-group group)
3716 (gnus-group-next-unread-group 1)
3717 (gnus-configure-windows 'group 'force))
3718 (gnus-handle-ephemeral-exit quit-config))
3719 ;; Finally signal the quit.
3721 ;; The group was successfully selected.
3723 (gnus-set-global-variables)
3724 ;; Save the active value in effect when the group was entered.
3725 (setq gnus-newsgroup-active
3727 (gnus-active gnus-newsgroup-name)))
3728 ;; You can change the summary buffer in some way with this hook.
3729 (gnus-run-hooks 'gnus-select-group-hook)
3730 (when (memq 'summary (gnus-update-format-specifications
3731 nil 'summary 'summary-mode 'summary-dummy))
3732 ;; The format specification for the summary line was updated,
3733 ;; so we need to update the mark positions as well.
3734 (gnus-update-summary-mark-positions))
3735 ;; Do score processing.
3736 (when gnus-use-scoring
3737 (gnus-possibly-score-headers))
3738 ;; Check whether to fill in the gaps in the threads.
3739 (when gnus-build-sparse-threads
3740 (gnus-build-sparse-threads))
3741 ;; Find the initial limit.
3743 (let ((gnus-newsgroup-dormant nil))
3744 (gnus-summary-initial-limit show-all))
3745 (gnus-summary-initial-limit show-all))
3746 ;; Generate the summary buffer.
3748 (gnus-summary-prepare))
3749 (when gnus-use-trees
3750 (gnus-tree-open group)
3751 (setq gnus-summary-highlight-line-function
3752 'gnus-tree-highlight-article))
3753 ;; If the summary buffer is empty, but there are some low-scored
3754 ;; articles or some excluded dormants, we include these in the
3756 (when (and (zerop (buffer-size))
3758 (cond (gnus-newsgroup-dormant
3759 (gnus-summary-limit-include-dormant))
3760 ((and gnus-newsgroup-scored show-all)
3761 (gnus-summary-limit-include-expunged t))))
3762 ;; Function `gnus-apply-kill-file' must be called in this hook.
3763 (gnus-run-hooks 'gnus-apply-kill-hook)
3764 (if (and (zerop (buffer-size))
3767 ;; This newsgroup is empty.
3768 (gnus-summary-catchup-and-exit nil t)
3769 (gnus-message 6 "No unread news")
3771 (gnus-kill-or-deaden-summary kill-buffer))
3772 ;; Return nil from this function.
3774 ;; Hide conversation thread subtrees. We cannot do this in
3775 ;; gnus-summary-prepare-hook since kill processing may not
3776 ;; work with hidden articles.
3777 (gnus-summary-maybe-hide-threads)
3779 (gnus-kill-or-deaden-summary kill-buffer))
3780 (gnus-summary-auto-select-subject)
3781 ;; Show first unread article if requested.
3782 (if (and (not no-article)
3784 gnus-newsgroup-unreads
3785 gnus-auto-select-first)
3787 (gnus-configure-windows 'summary)
3788 (let ((art (gnus-summary-article-number)))
3789 (unless (and (not gnus-plugged)
3790 (or (memq art gnus-newsgroup-undownloaded)
3791 (memq art gnus-newsgroup-downloadable)))
3792 (gnus-summary-goto-article art))))
3793 ;; Don't select any articles.
3794 (gnus-summary-position-point)
3795 (gnus-configure-windows 'summary 'force)
3796 (gnus-set-mode-line 'summary))
3797 (when (and gnus-auto-center-group
3798 (get-buffer-window gnus-group-buffer t))
3799 ;; Gotta use windows, because recenter does weird stuff if
3800 ;; the current buffer ain't the displayed window.
3801 (let ((owin (selected-window)))
3802 (select-window (get-buffer-window gnus-group-buffer t))
3803 (when (gnus-group-goto-group group)
3805 (select-window owin)))
3806 ;; Mark this buffer as "prepared".
3807 (setq gnus-newsgroup-prepared t)
3808 (gnus-run-hooks 'gnus-summary-prepared-hook)
3809 (unless (gnus-ephemeral-group-p group)
3810 (gnus-group-update-group group))
3813 (defun gnus-summary-auto-select-subject ()
3814 "Select the subject line on initial group entry."
3815 (goto-char (point-min))
3817 ((eq gnus-auto-select-subject 'best)
3818 (gnus-summary-best-unread-subject))
3819 ((eq gnus-auto-select-subject 'unread)
3820 (gnus-summary-first-unread-subject))
3821 ((eq gnus-auto-select-subject 'unseen)
3822 (gnus-summary-first-unseen-subject))
3823 ((eq gnus-auto-select-subject 'unseen-or-unread)
3824 (gnus-summary-first-unseen-or-unread-subject))
3825 ((eq gnus-auto-select-subject 'first)
3828 ((functionp gnus-auto-select-subject)
3829 (funcall gnus-auto-select-subject))))
3831 (defun gnus-summary-prepare ()
3832 "Generate the summary buffer."
3834 (let ((buffer-read-only nil))
3836 (setq gnus-newsgroup-data nil
3837 gnus-newsgroup-data-reverse nil)
3838 (gnus-run-hooks 'gnus-summary-generate-hook)
3839 ;; Generate the buffer, either with threads or without.
3840 (when gnus-newsgroup-headers
3841 (gnus-summary-prepare-threads
3842 (if gnus-show-threads
3843 (gnus-sort-gathered-threads
3844 (funcall gnus-summary-thread-gathering-function
3846 (gnus-cut-threads (gnus-make-threads)))))
3847 ;; Unthreaded display.
3848 (gnus-sort-articles gnus-newsgroup-headers))))
3849 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3850 ;; Call hooks for modifying summary buffer.
3851 (goto-char (point-min))
3852 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3854 (defsubst gnus-general-simplify-subject (subject)
3855 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3858 ;; Truncate the subject.
3859 (gnus-simplify-subject-functions
3860 (gnus-map-function gnus-simplify-subject-functions subject))
3861 ((numberp gnus-summary-gather-subject-limit)
3862 (setq subject (gnus-simplify-subject-re subject))
3863 (if (> (length subject) gnus-summary-gather-subject-limit)
3864 (substring subject 0 gnus-summary-gather-subject-limit)
3866 ;; Fuzzily simplify it.
3867 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3868 (gnus-simplify-subject-fuzzy subject))
3869 ;; Just remove the leading "Re:".
3871 (gnus-simplify-subject-re subject))))
3873 (if (and gnus-summary-gather-exclude-subject
3874 (string-match gnus-summary-gather-exclude-subject subject))
3875 nil ; This article shouldn't be gathered
3878 (defun gnus-summary-simplify-subject-query ()
3879 "Query where the respool algorithm would put this article."
3881 (gnus-summary-select-article)
3882 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3884 (defun gnus-gather-threads-by-subject (threads)
3885 "Gather threads by looking at Subject headers."
3886 (if (not gnus-summary-make-false-root)
3888 (let ((hashtb (gnus-make-hashtable 1024))
3891 subject hthread whole-subject)
3893 (setq subject (gnus-general-simplify-subject
3894 (setq whole-subject (mail-header-subject
3897 (if (setq hthread (gnus-gethash subject hashtb))
3899 ;; We enter a dummy root into the thread, if we
3900 ;; haven't done that already.
3901 (unless (stringp (caar hthread))
3902 (setcar hthread (list whole-subject (car hthread))))
3903 ;; We add this new gathered thread to this gathered
3905 (setcdr (car hthread)
3906 (nconc (cdar hthread) (list (car threads))))
3907 ;; Remove it from the list of threads.
3908 (setcdr prev (cdr threads))
3909 (setq threads prev))
3910 ;; Enter this thread into the hash table.
3911 (gnus-sethash subject
3912 (if gnus-summary-make-false-root-always
3914 ;; If you want a dummy root above all
3916 (setcar threads (list whole-subject
3922 (setq threads (cdr threads)))
3925 (defun gnus-gather-threads-by-references (threads)
3926 "Gather threads by looking at References headers."
3927 (let ((idhashtb (gnus-make-hashtable 1024))
3928 (thhashtb (gnus-make-hashtable 1024))
3931 ids references id gthread gid entered ref)
3933 (when (setq references (mail-header-references (caar threads)))
3934 (setq id (mail-header-id (caar threads))
3935 ids (inline (gnus-split-references references))
3937 (while (setq ref (pop ids))
3938 (setq ids (delete ref ids))
3939 (if (not (setq gid (gnus-gethash ref idhashtb)))
3941 (gnus-sethash ref id idhashtb)
3942 (gnus-sethash id threads thhashtb))
3943 (setq gthread (gnus-gethash gid thhashtb))
3945 ;; We enter a dummy root into the thread, if we
3946 ;; haven't done that already.
3947 (unless (stringp (caar gthread))
3948 (setcar gthread (list (mail-header-subject (caar gthread))
3950 ;; We add this new gathered thread to this gathered
3952 (setcdr (car gthread)
3953 (nconc (cdar gthread) (list (car threads)))))
3954 ;; Add it into the thread hash table.
3955 (gnus-sethash id gthread thhashtb)
3957 ;; Remove it from the list of threads.
3958 (setcdr prev (cdr threads))
3959 (setq threads prev))))
3961 (setq threads (cdr threads)))
3964 (defun gnus-sort-gathered-threads (threads)
3965 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3966 (let ((result threads))
3968 (when (stringp (caar threads))
3969 (setcdr (car threads)
3970 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3971 (setq threads (cdr threads)))
3974 (defun gnus-thread-loop-p (root thread)
3975 "Say whether ROOT is in THREAD."
3976 (let ((stack (list thread))
3979 (while (setq thread (pop stack))
3980 (setq th (cdr thread))
3982 (not (eq (caar th) root)))
3985 ;; We have found a loop.
3987 (setcdr thread (delq (car th) (cdr thread)))
3988 (if (boundp (setq ref-dep (intern "none"
3989 gnus-newsgroup-dependencies)))
3990 (setcdr (symbol-value ref-dep)
3991 (nconc (cdr (symbol-value ref-dep))
3993 (set ref-dep (list nil (car th))))
3996 ;; Push all the subthreads onto the stack.
3997 (push (cdr thread) stack)))
4000 (defun gnus-make-threads ()
4001 "Go through the dependency hashtb and find the roots. Return all threads."
4003 (while (catch 'infloop
4006 ;; Deal with self-referencing References loops.
4007 (when (and (car (symbol-value refs))
4014 (car (symbol-value refs)) thread))
4015 (cdr (symbol-value refs)))))))
4018 (unless (car (symbol-value refs))
4019 ;; These threads do not refer back to any other
4020 ;; articles, so they're roots.
4021 (setq threads (append (cdr (symbol-value refs)) threads))))
4022 gnus-newsgroup-dependencies)))
4025 ;; Build the thread tree.
4026 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4027 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4029 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4030 if it was already present.
4032 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4033 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4034 Message-IDs will be renamed to a unique Message-ID before being
4037 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4038 (let* ((id (mail-header-id header))
4039 (id-dep (and id (intern id dependencies)))
4040 parent-id ref ref-dep ref-header replaced)
4041 ;; Enter this `header' in the `dependencies' table.
4045 ;; The first two cases do the normal part: enter a new `header'
4046 ;; in the `dependencies' table.
4047 ((not (boundp id-dep))
4048 (set id-dep (list header)))
4049 ((null (car (symbol-value id-dep)))
4050 (setcar (symbol-value id-dep) header))
4052 ;; From here the `header' was already present in the
4053 ;; `dependencies' table.
4055 ;; Overrides an existing entry;
4056 ;; just set the header part of the entry.
4057 (setcar (symbol-value id-dep) header)
4060 ;; Renames the existing `header' to a unique Message-ID.
4061 ((not gnus-summary-ignore-duplicates)
4062 ;; An article with this Message-ID has already been seen.
4063 ;; We rename the Message-ID.
4064 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4066 (mail-header-set-id header id))
4068 ;; The last case ignores an existing entry, except it adds any
4069 ;; additional Xrefs (in case the two articles came from different
4071 ;; Also sets `header' to `nil' meaning that the `dependencies'
4072 ;; table was *not* modified.
4074 (mail-header-set-xref
4075 (car (symbol-value id-dep))
4076 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4078 (or (mail-header-xref header) "")))
4081 (when (and header (not replaced))
4082 ;; First check that we are not creating a References loop.
4083 (setq parent-id (gnus-parent-id (mail-header-references header)))
4084 (setq ref parent-id)
4086 (setq ref-dep (intern-soft ref dependencies))
4088 (setq ref-header (car (symbol-value ref-dep))))
4089 (if (string= id ref)
4090 ;; Yuk! This is a reference loop. Make the article be a
4093 (mail-header-set-references (car (symbol-value id-dep)) "none")
4095 (setq parent-id nil))
4096 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4097 (setq ref-dep (intern (or parent-id "none") dependencies))
4098 (if (boundp ref-dep)
4099 (setcdr (symbol-value ref-dep)
4100 (nconc (cdr (symbol-value ref-dep))
4101 (list (symbol-value id-dep))))
4102 (set ref-dep (list nil (symbol-value id-dep)))))
4105 (defun gnus-extract-message-id-from-in-reply-to (string)
4106 (if (string-match "<[^>]+>" string)
4107 (substring string (match-beginning 0) (match-end 0))
4110 (defun gnus-build-sparse-threads ()
4111 (let ((headers gnus-newsgroup-headers)
4112 (mail-parse-charset gnus-newsgroup-charset)
4113 (gnus-summary-ignore-duplicates t)
4114 header references generation relations
4115 subject child end new-child date)
4116 ;; First we create an alist of generations/relations, where
4117 ;; generations is how much we trust the relation, and the relation
4119 (gnus-message 7 "Making sparse threads...")
4121 (nnheader-set-temp-buffer " *gnus sparse threads*")
4122 (while (setq header (pop headers))
4123 (when (and (setq references (mail-header-references header))
4124 (not (string= references "")))
4126 (setq child (mail-header-id header)
4127 subject (mail-header-subject header)
4128 date (mail-header-date header)
4130 (while (search-backward ">" nil t)
4131 (setq end (1+ (point)))
4132 (when (search-backward "<" nil t)
4133 (setq new-child (buffer-substring (point) end))
4134 (push (list (incf generation)
4135 child (setq child new-child)
4139 (push (list (1+ generation) child nil subject) relations))
4141 (kill-buffer (current-buffer)))
4142 ;; Sort over trustworthiness.
4145 (when (gnus-dependencies-add-header
4146 (make-full-mail-header
4147 gnus-reffed-article-number
4148 (nth 3 relation) "" (or (nth 4 relation) "")
4150 (or (nth 2 relation) "") 0 0 "")
4151 gnus-newsgroup-dependencies nil)
4152 (push gnus-reffed-article-number gnus-newsgroup-limit)
4153 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4154 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4155 gnus-newsgroup-reads)
4156 (decf gnus-reffed-article-number)))
4157 (sort relations 'car-less-than-car))
4158 (gnus-message 7 "Making sparse threads...done")))
4160 (defun gnus-build-old-threads ()
4161 ;; Look at all the articles that refer back to old articles, and
4162 ;; fetch the headers for the articles that aren't there. This will
4163 ;; build complete threads - if the roots haven't been expired by the
4165 (let ((mail-parse-charset gnus-newsgroup-charset)
4169 (when (not (car (symbol-value refs)))
4170 (setq heads (cdr (symbol-value refs)))
4172 (if (memq (mail-header-number (caar heads))
4173 gnus-newsgroup-dormant)
4174 (setq heads (cdr heads))
4175 (setq id (symbol-name refs))
4176 (while (and (setq id (gnus-build-get-header id))
4177 (not (car (gnus-id-to-thread id)))))
4178 (setq heads nil)))))
4179 gnus-newsgroup-dependencies)))
4181 (defsubst gnus-remove-odd-characters (string)
4182 "Translate STRING into something that doesn't contain weird characters."
4183 (mm-subst-char-in-string
4185 (mm-subst-char-in-string
4188 ;; This function has to be called with point after the article number
4189 ;; on the beginning of the line.
4190 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4191 (let ((eol (gnus-point-at-eol))
4192 (buffer (current-buffer))
4193 header references in-reply-to)
4195 ;; overview: [num subject from date id refs chars lines misc]
4198 (narrow-to-region (point) eol)
4203 (make-full-mail-header
4205 (condition-case () ; subject
4206 (gnus-remove-odd-characters
4207 (funcall gnus-decode-encoded-word-function
4208 (setq x (nnheader-nov-field))))
4210 (condition-case () ; from
4211 (gnus-remove-odd-characters
4212 (funcall gnus-decode-encoded-address-function
4213 (setq x (nnheader-nov-field))))
4215 (nnheader-nov-field) ; date
4216 (nnheader-nov-read-message-id) ; id
4217 (setq references (nnheader-nov-field)) ; refs
4218 (nnheader-nov-read-integer) ; chars
4219 (nnheader-nov-read-integer) ; lines
4221 (if (looking-at "Xref: ")
4222 (goto-char (match-end 0)))
4223 (nnheader-nov-field)) ; Xref
4224 (nnheader-nov-parse-extra)))) ; extra
4228 (when (and (string= references "")
4229 (setq in-reply-to (mail-header-extra header))
4230 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4231 (mail-header-set-references
4232 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4234 (when gnus-alter-header-function
4235 (funcall gnus-alter-header-function header))
4236 (gnus-dependencies-add-header header dependencies force-new)))
4238 (defun gnus-build-get-header (id)
4239 "Look through the buffer of NOV lines and find the header to ID.
4240 Enter this line into the dependencies hash table, and return
4241 the id of the parent article (if any)."
4242 (let ((deps gnus-newsgroup-dependencies)
4246 (set-buffer nntp-server-buffer)
4247 (let ((case-fold-search nil))
4248 (goto-char (point-min))
4249 (while (and (not found)
4250 (search-forward id nil t))
4252 (setq found (looking-at
4253 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4254 (regexp-quote id))))
4255 (or found (beginning-of-line 2)))
4259 (setq header (gnus-nov-parse-line
4260 (read (current-buffer)) deps))
4261 (gnus-parent-id (mail-header-references header))))))
4263 (let ((number (mail-header-number header)))
4264 (push number gnus-newsgroup-limit)
4265 (push header gnus-newsgroup-headers)
4266 (if (memq number gnus-newsgroup-unselected)
4268 (setq gnus-newsgroup-unreads
4269 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4271 (setq gnus-newsgroup-unselected
4272 (delq number gnus-newsgroup-unselected)))
4273 (push number gnus-newsgroup-ancient)))))))
4275 (defun gnus-build-all-threads ()
4276 "Read all the headers."
4277 (let ((gnus-summary-ignore-duplicates t)
4278 (mail-parse-charset gnus-newsgroup-charset)
4279 (dependencies gnus-newsgroup-dependencies)
4282 (set-buffer nntp-server-buffer)
4283 (let ((case-fold-search nil))
4284 (goto-char (point-min))
4287 (setq article (read (current-buffer))
4288 header (gnus-nov-parse-line article dependencies)))
4291 (set-buffer gnus-summary-buffer)
4292 (push header gnus-newsgroup-headers)
4293 (if (memq (setq article (mail-header-number header))
4294 gnus-newsgroup-unselected)
4296 (setq gnus-newsgroup-unreads
4297 (gnus-add-to-sorted-list
4298 gnus-newsgroup-unreads article))
4299 (setq gnus-newsgroup-unselected
4300 (delq article gnus-newsgroup-unselected)))
4301 (push article gnus-newsgroup-ancient)))
4302 (forward-line 1)))))))
4304 (defun gnus-summary-update-article-line (article header)
4305 "Update the line for ARTICLE using HEADER."
4306 (let* ((id (mail-header-id header))
4307 (thread (gnus-id-to-thread id)))
4309 (error "Article in no thread"))
4310 ;; Update the thread.
4311 (setcar thread header)
4312 (gnus-summary-goto-subject article)
4313 (let* ((datal (gnus-data-find-list article))
4315 (buffer-read-only nil)
4316 (level (gnus-summary-thread-level)))
4318 (let ((inserted (- (point)
4320 (gnus-summary-insert-line
4322 (memq article gnus-newsgroup-undownloaded)
4323 (gnus-article-mark article)
4324 (memq article gnus-newsgroup-replied)
4325 (memq article gnus-newsgroup-expirable)
4326 ;; Only insert the Subject string when it's different
4327 ;; from the previous Subject string.
4332 (mail-header-subject
4335 (gnus-data-find-list
4337 (gnus-data-list t)))))
4338 ;; Error on the side of excessive subjects.
4340 (mail-header-subject header)))
4342 (mail-header-subject header))
4343 nil (cdr (assq article gnus-newsgroup-scored))
4344 (memq article gnus-newsgroup-processable))
4347 (gnus-data-update-list
4349 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4351 (defun gnus-summary-update-article (article &optional iheader)
4352 "Update ARTICLE in the summary buffer."
4353 (set-buffer gnus-summary-buffer)
4354 (let* ((header (gnus-summary-article-header article))
4355 (id (mail-header-id header))
4356 (data (gnus-data-find article))
4357 (thread (gnus-id-to-thread id))
4358 (references (mail-header-references header))
4362 (when (and references
4363 (not (equal "" references)))
4366 (buffer-read-only nil)
4372 (delq thread parent)))
4373 (if (gnus-summary-insert-subject id header)
4374 ;; Set the (possibly) new article number in the data structure.
4375 (gnus-data-set-number data (gnus-id-to-article id))
4379 (defun gnus-rebuild-thread (id &optional line)
4380 "Rebuild the thread containing ID.
4381 If LINE, insert the rebuilt thread starting on line LINE."
4382 (let ((buffer-read-only nil)
4383 old-pos current thread data)
4384 (if (not gnus-show-threads)
4385 (setq thread (list (car (gnus-id-to-thread id))))
4386 ;; Get the thread this article is part of.
4387 (setq thread (gnus-remove-thread id)))
4388 (setq old-pos (gnus-point-at-bol))
4389 (setq current (save-excursion
4390 (and (re-search-backward "[\r\n]" nil t)
4391 (gnus-summary-article-number))))
4392 ;; If this is a gathered thread, we have to go some re-gathering.
4393 (when (stringp (car thread))
4394 (let ((subject (car thread))
4396 (setq thread (cdr thread))
4398 (unless (memq (setq thr (gnus-id-to-thread
4400 (mail-header-id (caar thread)))))
4403 (setq thread (cdr thread)))
4404 ;; We now have all (unique) roots.
4405 (if (= (length roots) 1)
4406 ;; All the loose roots are now one solid root.
4407 (setq thread (car roots))
4408 (setq thread (cons subject (gnus-sort-threads roots))))))
4410 ;; We then insert this thread into the summary buffer.
4412 (goto-char (point-min))
4413 (forward-line (1- line)))
4414 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4415 (if gnus-show-threads
4416 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4417 (gnus-summary-prepare-unthreaded thread))
4418 (setq data (nreverse gnus-newsgroup-data))
4419 (setq threads gnus-newsgroup-threads))
4420 ;; We splice the new data into the data structure.
4421 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4422 ;;!!! then we want to insert at the beginning of the buffer.
4423 ;;!!! That happens to be true with Gnus now, but that may
4424 ;;!!! change in the future. Perhaps.
4425 (gnus-data-enter-list
4426 (if line nil current) data (- (point) old-pos))
4427 (setq gnus-newsgroup-threads
4428 (nconc threads gnus-newsgroup-threads))
4429 (gnus-data-compute-positions))))
4431 (defun gnus-number-to-header (number)
4432 "Return the header for article NUMBER."
4433 (let ((headers gnus-newsgroup-headers))
4435 (not (= number (mail-header-number (car headers)))))
4440 (defun gnus-parent-headers (in-headers &optional generation)
4441 "Return the headers of the GENERATIONeth parent of HEADERS."
4443 (setq generation 1))
4445 (headers in-headers)
4448 (not (zerop generation))
4449 (setq references (mail-header-references headers)))
4450 (setq headers (if (and references
4451 (setq parent (gnus-parent-id references)))
4452 (car (gnus-id-to-thread parent))
4455 (and (not (eq headers in-headers))
4458 (defun gnus-id-to-thread (id)
4459 "Return the (sub-)thread where ID appears."
4460 (gnus-gethash id gnus-newsgroup-dependencies))
4462 (defun gnus-id-to-article (id)
4463 "Return the article number of ID."
4464 (let ((thread (gnus-id-to-thread id)))
4467 (mail-header-number (car thread)))))
4469 (defun gnus-id-to-header (id)
4470 "Return the article headers of ID."
4471 (car (gnus-id-to-thread id)))
4473 (defun gnus-article-displayed-root-p (article)
4474 "Say whether ARTICLE is a root(ish) article."
4475 (let ((level (gnus-summary-thread-level article))
4476 (refs (mail-header-references (gnus-summary-article-header article)))
4482 ((null (gnus-parent-id refs)) t)
4484 (null (setq particle (gnus-id-to-article
4485 (gnus-parent-id refs))))
4486 (null (gnus-summary-thread-level particle)))))))
4488 (defun gnus-root-id (id)
4489 "Return the id of the root of the thread where ID appears."
4491 (while (and id (setq prev (car (gnus-id-to-thread id))))
4493 id (gnus-parent-id (mail-header-references prev))))
4496 (defun gnus-articles-in-thread (thread)
4497 "Return the list of articles in THREAD."
4498 (cons (mail-header-number (car thread))
4499 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4501 (defun gnus-remove-thread (id &optional dont-remove)
4502 "Remove the thread that has ID in it."
4503 (let (headers thread last-id)
4504 ;; First go up in this thread until we find the root.
4505 (setq last-id (gnus-root-id id)
4506 headers (message-flatten-list (gnus-id-to-thread last-id)))
4507 ;; We have now found the real root of this thread. It might have
4508 ;; been gathered into some loose thread, so we have to search
4509 ;; through the threads to find the thread we wanted.
4510 (let ((threads gnus-newsgroup-threads)
4513 (setq sub (car threads))
4514 (if (stringp (car sub))
4515 ;; This is a gathered thread, so we look at the roots
4516 ;; below it to find whether this article is in this
4519 (setq sub (cdr sub))
4521 (when (member (caar sub) headers)
4522 (setq thread (car threads)
4525 (setq sub (cdr sub))))
4526 ;; It's an ordinary thread, so we check it.
4527 (when (eq (car sub) (car headers))
4530 (setq threads (cdr threads)))
4531 ;; If this article is in no thread, then it's a root.
4534 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4535 (setq thread (gnus-id-to-thread last-id)))
4538 thread ; We return this thread.
4540 (if (stringp (car thread))
4542 ;; If we use dummy roots, then we have to remove the
4543 ;; dummy root as well.
4544 (when (eq gnus-summary-make-false-root 'dummy)
4545 ;; We go to the dummy root by going to
4546 ;; the first sub-"thread", and then one line up.
4547 (gnus-summary-goto-article
4548 (mail-header-number (caadr thread)))
4551 (gnus-data-compute-positions))
4552 (setq thread (cdr thread))
4554 (gnus-remove-thread-1 (car thread))
4555 (setq thread (cdr thread))))
4556 (gnus-remove-thread-1 thread))))))))
4558 (defun gnus-remove-thread-1 (thread)
4559 "Remove the thread THREAD recursively."
4560 (let ((number (mail-header-number (pop thread)))
4562 (setq thread (reverse thread))
4564 (gnus-remove-thread-1 (pop thread)))
4565 (when (setq d (gnus-data-find number))
4566 (goto-char (gnus-data-pos d))
4567 (gnus-summary-show-thread)
4570 (- (gnus-point-at-bol)
4572 (1+ (gnus-point-at-eol))
4573 (gnus-delete-line)))))))
4575 (defun gnus-sort-threads-recursive (threads func)
4576 (sort (mapcar (lambda (thread)
4579 (gnus-sort-threads-recursive (cdr thread) func))))
4582 (defun gnus-sort-threads-loop (threads func)
4583 (let* ((superthread (cons nil threads))
4584 (stack (list (cons superthread threads)))
4585 remaining-threads thread)
4587 (setq remaining-threads (cdr (car stack)))
4588 (if remaining-threads
4589 (progn (setq thread (car remaining-threads))
4590 (setcdr (car stack) (cdr remaining-threads))
4592 (push (cons thread (cdr thread)) stack)))
4593 (setq thread (caar stack))
4594 (setcdr thread (sort (cdr thread) func))
4598 (defun gnus-sort-threads (threads)
4600 (if (not gnus-thread-sort-functions)
4602 (gnus-message 8 "Sorting threads...")
4605 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4606 (gnus-sort-threads-recursive
4607 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4608 ;; Even after binding max-lisp-eval-depth, the recursive
4609 ;; sorter might fail for very long threads. In that case,
4610 ;; try using a (less well-tested) non-recursive sorter.
4611 (error (gnus-sort-threads-loop
4612 threads (gnus-make-sort-function
4613 gnus-thread-sort-functions))))
4614 (gnus-message 8 "Sorting threads...done"))))
4616 (defun gnus-sort-articles (articles)
4618 (when gnus-article-sort-functions
4619 (gnus-message 7 "Sorting articles...")
4621 (setq gnus-newsgroup-headers
4622 (sort articles (gnus-make-sort-function
4623 gnus-article-sort-functions)))
4624 (gnus-message 7 "Sorting articles...done"))))
4626 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4627 (defmacro gnus-thread-header (thread)
4628 "Return header of first article in THREAD.
4629 Note that THREAD must never, ever be anything else than a variable -
4630 using some other form will lead to serious barfage."
4631 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4632 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4633 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4636 (defsubst gnus-article-sort-by-number (h1 h2)
4637 "Sort articles by article number."
4638 (< (mail-header-number h1)
4639 (mail-header-number h2)))
4641 (defun gnus-thread-sort-by-number (h1 h2)
4642 "Sort threads by root article number."
4643 (gnus-article-sort-by-number
4644 (gnus-thread-header h1) (gnus-thread-header h2)))
4646 (defsubst gnus-article-sort-by-random (h1 h2)
4647 "Sort articles by article number."
4650 (defun gnus-thread-sort-by-random (h1 h2)
4651 "Sort threads by root article number."
4652 (gnus-article-sort-by-random
4653 (gnus-thread-header h1) (gnus-thread-header h2)))
4655 (defsubst gnus-article-sort-by-lines (h1 h2)
4656 "Sort articles by article Lines header."
4657 (< (mail-header-lines h1)
4658 (mail-header-lines h2)))
4660 (defun gnus-thread-sort-by-lines (h1 h2)
4661 "Sort threads by root article Lines header."
4662 (gnus-article-sort-by-lines
4663 (gnus-thread-header h1) (gnus-thread-header h2)))
4665 (defsubst gnus-article-sort-by-chars (h1 h2)
4666 "Sort articles by octet length."
4667 (< (mail-header-chars h1)
4668 (mail-header-chars h2)))
4670 (defun gnus-thread-sort-by-chars (h1 h2)
4671 "Sort threads by root article octet length."
4672 (gnus-article-sort-by-chars
4673 (gnus-thread-header h1) (gnus-thread-header h2)))
4675 (defsubst gnus-article-sort-by-author (h1 h2)
4676 "Sort articles by root author."
4678 (let ((extract (funcall
4679 gnus-extract-address-components
4680 (mail-header-from h1))))
4681 (or (car extract) (cadr extract) ""))
4682 (let ((extract (funcall
4683 gnus-extract-address-components
4684 (mail-header-from h2))))
4685 (or (car extract) (cadr extract) ""))))
4687 (defun gnus-thread-sort-by-author (h1 h2)
4688 "Sort threads by root author."
4689 (gnus-article-sort-by-author
4690 (gnus-thread-header h1) (gnus-thread-header h2)))
4692 (defsubst gnus-article-sort-by-subject (h1 h2)
4693 "Sort articles by root subject."
4695 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4696 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4698 (defun gnus-thread-sort-by-subject (h1 h2)
4699 "Sort threads by root subject."
4700 (gnus-article-sort-by-subject
4701 (gnus-thread-header h1) (gnus-thread-header h2)))
4703 (defsubst gnus-article-sort-by-date (h1 h2)
4704 "Sort articles by root article date."
4706 (gnus-date-get-time (mail-header-date h1))
4707 (gnus-date-get-time (mail-header-date h2))))
4709 (defun gnus-thread-sort-by-date (h1 h2)
4710 "Sort threads by root article date."
4711 (gnus-article-sort-by-date
4712 (gnus-thread-header h1) (gnus-thread-header h2)))
4714 (defsubst gnus-article-sort-by-score (h1 h2)
4715 "Sort articles by root article score.
4716 Unscored articles will be counted as having a score of zero."
4717 (> (or (cdr (assq (mail-header-number h1)
4718 gnus-newsgroup-scored))
4719 gnus-summary-default-score 0)
4720 (or (cdr (assq (mail-header-number h2)
4721 gnus-newsgroup-scored))
4722 gnus-summary-default-score 0)))
4724 (defun gnus-thread-sort-by-score (h1 h2)
4725 "Sort threads by root article score."
4726 (gnus-article-sort-by-score
4727 (gnus-thread-header h1) (gnus-thread-header h2)))
4729 (defun gnus-thread-sort-by-total-score (h1 h2)
4730 "Sort threads by the sum of all scores in the thread.
4731 Unscored articles will be counted as having a score of zero."
4732 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4734 (defun gnus-thread-total-score (thread)
4735 ;; This function find the total score of THREAD.
4740 (if (stringp (car thread))
4741 (apply gnus-thread-score-function 0
4742 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4743 (gnus-thread-total-score-1 thread)))
4745 (gnus-thread-total-score-1 (list thread)))))
4747 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4748 "Sort threads such that the thread with the most recently arrived article comes first."
4749 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4751 (defun gnus-thread-highest-number (thread)
4752 "Return the highest article number in THREAD."
4753 (apply 'max (mapcar (lambda (header)
4754 (mail-header-number header))
4755 (message-flatten-list thread))))
4757 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4758 "Sort threads such that the thread with the most recently dated article comes first."
4759 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4761 (defun gnus-thread-latest-date (thread)
4762 "Return the highest article date in THREAD."
4763 (let ((previous-time 0))
4769 (time-to-seconds (mail-header-parse-date
4770 (mail-header-date header)))
4771 (error previous-time))))
4773 (message-flatten-list thread)
4775 (< (mail-header-number h1)
4776 (mail-header-number h2))))))))
4778 (defun gnus-thread-total-score-1 (root)
4779 ;; This function find the total score of the thread below ROOT.
4780 (setq root (car root))
4781 (apply gnus-thread-score-function
4783 (mapcar 'gnus-thread-total-score
4784 (cdr (gnus-id-to-thread (mail-header-id root))))
4785 (when (> (mail-header-number root) 0)
4786 (list (or (cdr (assq (mail-header-number root)
4787 gnus-newsgroup-scored))
4788 gnus-summary-default-score 0))))
4789 (list gnus-summary-default-score)
4792 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4793 (defvar gnus-tmp-prev-subject nil)
4794 (defvar gnus-tmp-false-parent nil)
4795 (defvar gnus-tmp-root-expunged nil)
4796 (defvar gnus-tmp-dummy-line nil)
4798 (eval-when-compile (defvar gnus-tmp-header))
4799 (defun gnus-extra-header (type &optional header)
4800 "Return the extra header of TYPE."
4801 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4804 (defvar gnus-tmp-thread-tree-header-string "")
4806 (defcustom gnus-sum-thread-tree-root "> "
4807 "With %B spec, used for the root of a thread.
4808 If nil, use subject instead."
4810 :type '(radio (const :format "%v " nil) string)
4811 :group 'gnus-thread)
4812 (defcustom gnus-sum-thread-tree-false-root "> "
4813 "With %B spec, used for a false root of a thread.
4814 If nil, use subject instead."
4816 :type '(radio (const :format "%v " nil) string)
4817 :group 'gnus-thread)
4818 (defcustom gnus-sum-thread-tree-single-indent ""
4819 "With %B spec, used for a thread with just one message.
4820 If nil, use subject instead."
4822 :type '(radio (const :format "%v " nil) string)
4823 :group 'gnus-thread)
4824 (defcustom gnus-sum-thread-tree-vertical "| "
4825 "With %B spec, used for drawing a vertical line."
4828 :group 'gnus-thread)
4829 (defcustom gnus-sum-thread-tree-indent " "
4830 "With %B spec, used for indenting."
4833 :group 'gnus-thread)
4834 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4835 "With %B spec, used for a leaf with brothers."
4838 :group 'gnus-thread)
4839 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4840 "With %B spec, used for a leaf without brothers."
4843 :group 'gnus-thread)
4845 (defun gnus-summary-prepare-threads (threads)
4846 "Prepare summary buffer from THREADS and indentation LEVEL.
4847 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4848 or a straight list of headers."
4849 (gnus-message 7 "Generating summary...")
4851 (setq gnus-newsgroup-threads threads)
4854 (let ((gnus-tmp-level 0)
4855 (default-score (or gnus-summary-default-score 0))
4856 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4857 (building-line-count gnus-summary-display-while-building)
4858 (building-count (integerp gnus-summary-display-while-building))
4859 thread number subject stack state gnus-tmp-gathered beg-match
4860 new-roots gnus-tmp-new-adopts thread-end simp-subject
4861 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4862 gnus-tmp-replied gnus-tmp-subject-or-nil
4863 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4864 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4865 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4868 (setq gnus-tmp-prev-subject nil
4869 gnus-tmp-thread-tree-header-string "")
4871 (if (vectorp (car threads))
4872 ;; If this is a straight (sic) list of headers, then a
4873 ;; threaded summary display isn't required, so we just create
4874 ;; an unthreaded one.
4875 (gnus-summary-prepare-unthreaded threads)
4877 ;; Do the threaded display.
4879 (if gnus-summary-display-while-building
4880 (switch-to-buffer (buffer-name)))
4881 (while (or threads stack gnus-tmp-new-adopts new-roots)
4883 (if (and (= gnus-tmp-level 0)
4886 (not gnus-tmp-false-parent)
4887 (or gnus-tmp-new-adopts new-roots))
4888 (if gnus-tmp-new-adopts
4889 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4890 thread (list (car gnus-tmp-new-adopts))
4891 gnus-tmp-header (caar thread)
4892 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4894 (setq thread (list (car new-roots))
4895 gnus-tmp-header (caar thread)
4896 new-roots (cdr new-roots))))
4899 ;; If there are some threads, we do them before the
4900 ;; threads on the stack.
4901 (setq thread threads
4902 gnus-tmp-header (caar thread))
4903 ;; There were no current threads, so we pop something off
4905 (setq state (car stack)
4906 gnus-tmp-level (car state)
4907 tree-stack (cadr state)
4908 thread (caddr state)
4910 gnus-tmp-header (caar thread))))
4912 (setq gnus-tmp-false-parent nil)
4913 (setq gnus-tmp-root-expunged nil)
4914 (setq thread-end nil)
4916 (if (stringp gnus-tmp-header)
4917 ;; The header is a dummy root.
4919 ((eq gnus-summary-make-false-root 'adopt)
4920 ;; We let the first article adopt the rest.
4921 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4923 (setq gnus-tmp-gathered
4925 (lambda (h) (mail-header-number (car h)))
4928 (setq thread (cons (list (caar thread)
4931 (setq gnus-tmp-level -1
4932 gnus-tmp-false-parent t))
4933 ((eq gnus-summary-make-false-root 'empty)
4934 ;; We print adopted articles with empty subject fields.
4935 (setq gnus-tmp-gathered
4937 (lambda (h) (mail-header-number (car h)))
4940 (setq gnus-tmp-level -1))
4941 ((eq gnus-summary-make-false-root 'dummy)
4942 ;; We remember that we probably want to output a dummy
4944 (setq gnus-tmp-dummy-line gnus-tmp-header)
4945 (setq gnus-tmp-prev-subject gnus-tmp-header))
4947 ;; We do not make a root for the gathered
4948 ;; sub-threads at all.
4949 (setq gnus-tmp-level -1)))
4951 (setq number (mail-header-number gnus-tmp-header)
4952 subject (mail-header-subject gnus-tmp-header)
4953 simp-subject (gnus-simplify-subject-fully subject))
4956 ;; If the thread has changed subject, we might want to make
4957 ;; this subthread into a root.
4958 ((and (null gnus-thread-ignore-subject)
4959 (not (zerop gnus-tmp-level))
4960 gnus-tmp-prev-subject
4961 (not (string= gnus-tmp-prev-subject simp-subject)))
4962 (setq new-roots (nconc new-roots (list (car thread)))
4964 gnus-tmp-header nil))
4965 ;; If the article lies outside the current limit,
4966 ;; then we do not display it.
4967 ((not (memq number gnus-newsgroup-limit))
4968 (setq gnus-tmp-gathered
4970 (lambda (h) (mail-header-number (car h)))
4973 (setq gnus-tmp-new-adopts (if (cdar thread)
4974 (append gnus-tmp-new-adopts
4976 gnus-tmp-new-adopts)
4978 gnus-tmp-header nil)
4979 (when (zerop gnus-tmp-level)
4980 (setq gnus-tmp-root-expunged t)))
4981 ;; Perhaps this article is to be marked as read?
4982 ((and gnus-summary-mark-below
4983 (< (or (cdr (assq number gnus-newsgroup-scored))
4985 gnus-summary-mark-below)
4986 ;; Don't touch sparse articles.
4987 (not (gnus-summary-article-sparse-p number))
4988 (not (gnus-summary-article-ancient-p number)))
4989 (setq gnus-newsgroup-unreads
4990 (delq number gnus-newsgroup-unreads))
4991 (if gnus-newsgroup-auto-expire
4992 (setq gnus-newsgroup-expirable
4993 (gnus-add-to-sorted-list
4994 gnus-newsgroup-expirable number))
4995 (push (cons number gnus-low-score-mark)
4996 gnus-newsgroup-reads))))
4998 (when gnus-tmp-header
4999 ;; We may have an old dummy line to output before this
5001 (when (and gnus-tmp-dummy-line
5004 (mail-header-subject gnus-tmp-header)))
5005 (gnus-summary-insert-dummy-line
5006 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5007 (setq gnus-tmp-dummy-line nil))
5009 ;; Compute the mark.
5010 (setq gnus-tmp-unread (gnus-article-mark number))
5012 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5013 gnus-tmp-header gnus-tmp-level)
5014 gnus-newsgroup-data)
5016 ;; Actually insert the line.
5018 gnus-tmp-subject-or-nil
5020 ((and gnus-thread-ignore-subject
5021 gnus-tmp-prev-subject
5022 (not (string= gnus-tmp-prev-subject simp-subject)))
5024 ((zerop gnus-tmp-level)
5025 (if (and (eq gnus-summary-make-false-root 'empty)
5026 (memq number gnus-tmp-gathered)
5027 gnus-tmp-prev-subject
5028 (string= gnus-tmp-prev-subject simp-subject))
5029 gnus-summary-same-subject
5031 (t gnus-summary-same-subject)))
5032 (if (and (eq gnus-summary-make-false-root 'adopt)
5033 (= gnus-tmp-level 1)
5034 (memq number gnus-tmp-gathered))
5035 (setq gnus-tmp-opening-bracket ?\<
5036 gnus-tmp-closing-bracket ?\>)
5037 (setq gnus-tmp-opening-bracket ?\[
5038 gnus-tmp-closing-bracket ?\]))
5039 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5040 (gnus-make-thread-indent-array
5041 (max (* 2 (length gnus-thread-indent-array))
5044 gnus-tmp-indentation
5045 (aref gnus-thread-indent-array gnus-tmp-level)
5046 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5047 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5048 gnus-summary-default-score 0)
5050 (if (or (null gnus-summary-default-score)
5051 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5052 gnus-summary-zcore-fuzz))
5054 (if (< gnus-tmp-score gnus-summary-default-score)
5055 gnus-score-below-mark gnus-score-over-mark))
5057 (cond ((memq number gnus-newsgroup-processable)
5059 ((memq number gnus-newsgroup-cached)
5061 ((memq number gnus-newsgroup-replied)
5063 ((memq number gnus-newsgroup-forwarded)
5064 gnus-forwarded-mark)
5065 ((memq number gnus-newsgroup-saved)
5067 ((memq number gnus-newsgroup-recent)
5069 ((memq number gnus-newsgroup-unseen)
5073 (cond ((memq number gnus-newsgroup-undownloaded)
5074 gnus-undownloaded-mark)
5075 (gnus-newsgroup-agentized
5076 gnus-downloaded-mark)
5079 gnus-tmp-from (mail-header-from gnus-tmp-header)
5082 ((string-match "<[^>]+> *$" gnus-tmp-from)
5083 (setq beg-match (match-beginning 0))
5084 (or (and (string-match "^\".+\"" gnus-tmp-from)
5085 (substring gnus-tmp-from 1 (1- (match-end 0))))
5086 (substring gnus-tmp-from 0 beg-match)))
5087 ((string-match "(.+)" gnus-tmp-from)
5088 (substring gnus-tmp-from
5089 (1+ (match-beginning 0)) (1- (match-end 0))))
5093 gnus-tmp-thread-tree-header-string
5095 ((not gnus-show-threads) "")
5096 ((zerop gnus-tmp-level)
5097 (cond ((cdar thread)
5098 (or gnus-sum-thread-tree-root subject))
5099 (gnus-tmp-new-adopts
5100 (or gnus-sum-thread-tree-false-root subject))
5102 (or gnus-sum-thread-tree-single-indent subject))))
5104 (concat (apply 'concat
5105 (mapcar (lambda (item)
5107 gnus-sum-thread-tree-vertical
5108 gnus-sum-thread-tree-indent))
5109 (cdr (reverse tree-stack))))
5111 gnus-sum-thread-tree-leaf-with-other
5112 gnus-sum-thread-tree-single-leaf)))))
5113 (when (string= gnus-tmp-name "")
5114 (setq gnus-tmp-name gnus-tmp-from))
5115 (unless (numberp gnus-tmp-lines)
5116 (setq gnus-tmp-lines -1))
5117 (if (= gnus-tmp-lines -1)
5118 (setq gnus-tmp-lines "?")
5119 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5120 (gnus-put-text-property
5122 (progn (eval gnus-summary-line-format-spec) (point))
5123 'gnus-number number)
5126 (gnus-run-hooks 'gnus-summary-update-hook)
5129 (setq gnus-tmp-prev-subject simp-subject)))
5131 (when (nth 1 thread)
5132 (push (list (max 0 gnus-tmp-level)
5133 (copy-sequence tree-stack)
5136 (push (if (nth 1 thread) 1 0) tree-stack)
5137 (incf gnus-tmp-level)
5138 (setq threads (if thread-end nil (cdar thread)))
5139 (if gnus-summary-display-while-building
5142 ;; use a set frequency
5143 (setq building-line-count (1- building-line-count))
5144 (when (= building-line-count 0)
5146 (setq building-line-count
5147 gnus-summary-display-while-building)))
5151 (setq gnus-tmp-level 0)))))
5152 (gnus-message 7 "Generating summary...done"))
5154 (defun gnus-summary-prepare-unthreaded (headers)
5155 "Generate an unthreaded summary buffer based on HEADERS."
5156 (let (header number mark)
5161 ;; We may have to root out some bad articles...
5162 (when (memq (setq number (mail-header-number
5163 (setq header (pop headers))))
5164 gnus-newsgroup-limit)
5165 ;; Mark article as read when it has a low score.
5166 (when (and gnus-summary-mark-below
5167 (< (or (cdr (assq number gnus-newsgroup-scored))
5168 gnus-summary-default-score 0)
5169 gnus-summary-mark-below)
5170 (not (gnus-summary-article-ancient-p number)))
5171 (setq gnus-newsgroup-unreads
5172 (delq number gnus-newsgroup-unreads))
5173 (if gnus-newsgroup-auto-expire
5174 (push number gnus-newsgroup-expirable)
5175 (push (cons number gnus-low-score-mark)
5176 gnus-newsgroup-reads)))
5178 (setq mark (gnus-article-mark number))
5179 (push (gnus-data-make number mark (1+ (point)) header 0)
5180 gnus-newsgroup-data)
5181 (gnus-summary-insert-line
5183 (memq number gnus-newsgroup-undownloaded)
5184 mark (memq number gnus-newsgroup-replied)
5185 (memq number gnus-newsgroup-expirable)
5186 (mail-header-subject header) nil
5187 (cdr (assq number gnus-newsgroup-scored))
5188 (memq number gnus-newsgroup-processable))))))
5190 (defun gnus-summary-remove-list-identifiers ()
5191 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5192 (let ((regexp (if (consp gnus-list-identifiers)
5193 (mapconcat 'identity gnus-list-identifiers " *\\|")
5194 gnus-list-identifiers))
5197 (dolist (header gnus-newsgroup-headers)
5198 (setq subject (mail-header-subject header)
5200 (while (string-match
5201 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
5204 (concat (substring subject 0 (match-beginning 2))
5205 (substring subject (match-end 0)))
5209 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
5211 (concat (substring subject 0 (match-beginning 1))
5212 (substring subject (match-end 1)))))
5214 (mail-header-set-subject header subject))))))
5216 (defun gnus-fetch-headers (articles)
5217 "Fetch headers of ARTICLES."
5218 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5219 (gnus-message 5 "Fetching headers for %s..." name)
5222 (setq gnus-headers-retrieved-by
5223 (gnus-retrieve-headers
5224 articles gnus-newsgroup-name
5225 ;; We might want to fetch old headers, but
5226 ;; not if there is only 1 article.
5228 (not (eq gnus-fetch-old-headers 'some))
5229 (not (numberp gnus-fetch-old-headers)))
5230 (> (length articles) 1))
5231 gnus-fetch-old-headers))))
5232 (gnus-get-newsgroup-headers-xover
5233 articles nil nil gnus-newsgroup-name t)
5234 (gnus-get-newsgroup-headers))
5235 (gnus-message 5 "Fetching headers for %s...done" name))))
5237 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5238 "Select newsgroup GROUP.
5239 If READ-ALL is non-nil, all articles in the group are selected.
5240 If SELECT-ARTICLES, only select those articles from GROUP."
5241 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5242 ;;!!! Dirty hack; should be removed.
5243 (gnus-summary-ignore-duplicates
5244 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5246 gnus-summary-ignore-duplicates))
5247 (info (nth 2 entry))
5248 articles fetched-articles cached)
5250 (unless (gnus-check-server
5251 (set (make-local-variable 'gnus-current-select-method)
5252 (gnus-find-method-for-group group)))
5253 (error "Couldn't open server"))
5255 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5256 (gnus-activate-group group) ; Or we can activate it...
5257 (progn ; Or we bug out.
5258 (when (equal major-mode 'gnus-summary-mode)
5259 (gnus-kill-buffer (current-buffer)))
5260 (error "Couldn't activate group %s: %s"
5261 (gnus-group-decoded-name group) (gnus-status-message group))))
5263 (unless (gnus-request-group group t)
5264 (when (equal major-mode 'gnus-summary-mode)
5265 (gnus-kill-buffer (current-buffer)))
5266 (error "Couldn't request group %s: %s"
5267 (gnus-group-decoded-name group) (gnus-status-message group)))
5270 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5272 (setq gnus-summary-use-undownloaded-faces
5273 (gnus-agent-find-parameter
5275 'agent-enable-undownloaded-faces)))
5277 (setq gnus-newsgroup-name group
5278 gnus-newsgroup-unselected nil
5279 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5281 (let ((display (gnus-group-find-parameter group 'display)))
5282 (setq gnus-newsgroup-display
5284 ((not (zerop (or (car-safe read-all) 0)))
5285 ;; The user entered the group with C-u SPC/RET, let's show
5291 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5293 ;; The following is probably the "correct" solution, but
5294 ;; it makes Gnus fetch all headers and then limit the
5295 ;; articles (which is slow), so instead we hack the
5296 ;; select-articles parameter instead. -- Simon Josefsson
5299 ;; (gnus-byte-compile
5300 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5302 (setq select-articles
5303 (gnus-uncompress-range
5304 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5308 (cdr (gnus-active group)))))
5313 (gnus-summary-setup-default-charset)
5315 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5316 (when (gnus-virtual-group-p group)
5317 (setq cached gnus-newsgroup-cached))
5319 (setq gnus-newsgroup-unreads
5320 (gnus-sorted-ndifference
5321 (gnus-sorted-ndifference gnus-newsgroup-unreads
5322 gnus-newsgroup-marked)
5323 gnus-newsgroup-dormant))
5325 (setq gnus-newsgroup-processable nil)
5327 (gnus-update-read-articles group gnus-newsgroup-unreads)
5329 ;; Adjust and set lists of article marks.
5331 (gnus-adjust-marked-articles info))
5332 (if (setq articles select-articles)
5333 (setq gnus-newsgroup-unselected
5334 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5335 (setq articles (gnus-articles-to-read group read-all)))
5339 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5341 ((eq articles 0) nil)
5343 ;; Init the dependencies hash table.
5344 (setq gnus-newsgroup-dependencies
5345 (gnus-make-hashtable (length articles)))
5346 (gnus-set-global-variables)
5347 ;; Retrieve the headers and read them in.
5349 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5351 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5353 (setq gnus-newsgroup-cached cached))
5355 ;; Suppress duplicates?
5356 (when gnus-suppress-duplicates
5357 (gnus-dup-suppress-articles))
5359 ;; Set the initial limit.
5360 (setq gnus-newsgroup-limit (copy-sequence articles))
5361 ;; Remove canceled articles from the list of unread articles.
5362 (setq fetched-articles
5363 (mapcar (lambda (headers) (mail-header-number headers))
5364 gnus-newsgroup-headers))
5365 (setq gnus-newsgroup-articles fetched-articles)
5366 (setq gnus-newsgroup-unreads
5367 (gnus-sorted-nintersection
5368 gnus-newsgroup-unreads fetched-articles))
5369 (gnus-compute-unseen-list)
5371 ;; Removed marked articles that do not exist.
5372 (gnus-update-missing-marks
5373 (gnus-sorted-difference articles fetched-articles))
5374 ;; We might want to build some more threads first.
5375 (when (and gnus-fetch-old-headers
5376 (eq gnus-headers-retrieved-by 'nov))
5377 (if (eq gnus-fetch-old-headers 'invisible)
5378 (gnus-build-all-threads)
5379 (gnus-build-old-threads)))
5380 ;; Let the Gnus agent mark articles as read.
5382 (gnus-agent-get-undownloaded-list))
5383 ;; Remove list identifiers from subject
5384 (when gnus-list-identifiers
5385 (gnus-summary-remove-list-identifiers))
5386 ;; Check whether auto-expire is to be done in this group.
5387 (setq gnus-newsgroup-auto-expire
5388 (gnus-group-auto-expirable-p group))
5389 ;; Set up the article buffer now, if necessary.
5390 (unless gnus-single-article-buffer
5391 (gnus-article-setup-buffer))
5392 ;; First and last article in this newsgroup.
5393 (when gnus-newsgroup-headers
5394 (setq gnus-newsgroup-begin
5395 (mail-header-number (car gnus-newsgroup-headers))
5398 (gnus-last-element gnus-newsgroup-headers))))
5399 ;; GROUP is successfully selected.
5400 (or gnus-newsgroup-headers t)))))
5402 (defun gnus-compute-unseen-list ()
5403 ;; The `seen' marks are treated specially.
5404 (if (not gnus-newsgroup-seen)
5405 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5406 (setq gnus-newsgroup-unseen
5407 (gnus-inverse-list-range-intersection
5408 gnus-newsgroup-articles gnus-newsgroup-seen))))
5410 (defun gnus-summary-display-make-predicate (display)
5411 (require 'gnus-agent)
5412 (when (= (length display) 1)
5413 (setq display (car display)))
5414 (unless gnus-summary-display-cache
5415 (dolist (elem (append '((unread . unread)
5418 gnus-article-mark-lists))
5419 (push (cons (cdr elem)
5421 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5422 gnus-summary-display-cache)))
5423 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5424 (gnus-category-predicate-cache gnus-summary-display-cache))
5425 (gnus-get-predicate display)))
5427 ;; Uses the dynamically bound `number' variable.
5430 (defun gnus-article-marked-p (type &optional article)
5431 (let ((article (or article number)))
5434 (memq article gnus-newsgroup-marked))
5436 (memq article gnus-newsgroup-spam-marked))
5438 (memq article gnus-newsgroup-unsendable))
5439 ((eq type 'undownload)
5440 (memq article gnus-newsgroup-undownloaded))
5441 ((eq type 'download)
5442 (memq article gnus-newsgroup-downloadable))
5444 (memq article gnus-newsgroup-unreads))
5446 (memq article gnus-newsgroup-reads))
5448 (memq article gnus-newsgroup-dormant) )
5450 (memq article gnus-newsgroup-expirable))
5452 (memq article gnus-newsgroup-replied))
5454 (memq article gnus-newsgroup-killed))
5455 ((eq type 'bookmark)
5456 (assq article gnus-newsgroup-bookmarks))
5458 (assq article gnus-newsgroup-scored))
5460 (memq article gnus-newsgroup-saved))
5462 (memq article gnus-newsgroup-cached))
5464 (memq article gnus-newsgroup-forwarded))
5466 (not (memq article gnus-newsgroup-unseen)))
5468 (memq article gnus-newsgroup-recent))
5471 (defun gnus-articles-to-read (group &optional read-all)
5472 "Find out what articles the user wants to read."
5474 ;; Select all articles if `read-all' is non-nil, or if there
5475 ;; are no unread articles.
5477 (and (zerop (length gnus-newsgroup-marked))
5478 (zerop (length gnus-newsgroup-unreads)))
5479 ;; Fetch all if the predicate is non-nil.
5480 gnus-newsgroup-display)
5481 ;; We want to select the headers for all the articles in
5482 ;; the group, so we select either all the active
5483 ;; articles in the group, or (if that's nil), the
5484 ;; articles in the cache.
5486 (if gnus-newsgroup-maximum-articles
5487 (let ((active (gnus-active group)))
5488 (gnus-uncompress-range
5489 (cons (max (car active)
5491 gnus-newsgroup-maximum-articles
5494 (gnus-uncompress-range (gnus-active group)))
5495 (gnus-cache-articles-in-group group))
5496 ;; Select only the "normal" subset of articles.
5498 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5499 gnus-newsgroup-unreads)))
5500 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5501 (scored (length scored-list))
5502 (number (length articles))
5503 (marked (+ (length gnus-newsgroup-marked)
5504 (length gnus-newsgroup-dormant)))
5509 ((numberp gnus-newsgroup-display)
5510 gnus-newsgroup-display)
5514 ((and (or (<= scored marked) (= scored number))
5515 (numberp gnus-large-newsgroup)
5516 (> number gnus-large-newsgroup))
5517 (let* ((cursor-in-echo-area nil)
5518 (initial (gnus-parameter-large-newsgroup-initial
5519 gnus-newsgroup-name))
5523 "How many articles from %s (%s %d): "
5525 (gnus-group-decoded-name gnus-newsgroup-name)
5527 (if initial "max" "default")
5530 (cons (number-to-string initial)
5532 (if (string-match "^[ \t]*$" input) number input)))
5533 ((and (> scored marked) (< scored number)
5534 (> (- scored number) 20))
5537 (format "%s %s (%d scored, %d total): "
5538 "How many articles from"
5539 (gnus-group-decoded-name group)
5541 (if (string-match "^[ \t]*$" input)
5545 (message "Quit getting the articles to read")
5547 (setq select (if (stringp select) (string-to-number select) select))
5548 (if (or (null select) (zerop select))
5550 (if (and (not (zerop scored)) (<= (abs select) scored))
5552 (setq articles (sort scored-list '<))
5553 (setq number (length articles)))
5554 (setq articles (copy-sequence articles)))
5556 (when (< (abs select) number)
5558 ;; Select the N oldest articles.
5559 (setcdr (nthcdr (1- (abs select)) articles) nil)
5560 ;; Select the N most recent articles.
5561 (setq articles (nthcdr (- number select) articles))))
5562 (setq gnus-newsgroup-unselected
5563 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5564 (when gnus-alter-articles-to-read-function
5567 (funcall gnus-alter-articles-to-read-function
5568 gnus-newsgroup-name articles)
5572 (defun gnus-killed-articles (killed articles)
5575 (when (inline (gnus-member-of-range (car articles) killed))
5576 (push (car articles) out))
5577 (setq articles (cdr articles)))
5580 (defun gnus-uncompress-marks (marks)
5581 "Uncompress the mark ranges in MARKS."
5582 (let ((uncompressed '(score bookmark))
5585 (if (memq (caar marks) uncompressed)
5586 (push (car marks) out)
5587 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5588 (setq marks (cdr marks)))
5591 (defun gnus-article-mark-to-type (mark)
5592 "Return the type of MARK."
5593 (or (cadr (assq mark gnus-article-special-mark-lists))
5596 (defun gnus-article-unpropagatable-p (mark)
5597 "Return whether MARK should be propagated to back end."
5598 (memq mark gnus-article-unpropagated-mark-lists))
5600 (defun gnus-adjust-marked-articles (info)
5601 "Set all article lists and remove all marks that are no longer valid."
5602 (let* ((marked-lists (gnus-info-marks info))
5603 (active (gnus-active (gnus-info-group info)))
5606 (types gnus-article-mark-lists)
5607 marks var articles article mark mark-type
5610 (dolist (marks marked-lists)
5611 (setq mark (car marks)
5612 mark-type (gnus-article-mark-to-type mark)
5613 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5615 ;; We set the variable according to the type of the marks list,
5616 ;; and then adjust the marks to a subset of the active articles.
5618 ;; Adjust "simple" lists - compressed yet unsorted
5619 ((eq mark-type 'list)
5620 ;; Simultaneously uncompress and clip to active range
5621 ;; See gnus-uncompress-range for a description of possible marks
5623 (if (not (cadr marks))
5625 (setq articles (if (numberp (cddr marks))
5631 (while (setq article (pop articles))
5632 (cond ((consp article)
5633 (setq bgn (max (car article) min)
5634 end (min (cdr article) max))
5636 (setq l (setcdr l (cons bgn nil))
5638 ((and (<= min article)
5640 (setq l (setcdr l (cons article nil))))))
5641 (set var (cdr lh)))))
5643 ((eq mark-type 'tuple)
5644 (set var (setq articles (cdr marks)))
5645 (when (not (listp (cdr (symbol-value var))))
5646 (set var (list (symbol-value var))))
5647 (when (not (listp (cdr articles)))
5648 (setq articles (list articles)))
5650 (when (or (not (consp (setq article (pop articles))))
5651 (< (car article) min)
5652 (> (car article) max))
5653 (set var (delq article (symbol-value var))))))
5654 ;; Adjust ranges (sloppily).
5655 ((eq mark-type 'range)
5658 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5659 ;; It should be (seen (NUM1 . NUM2)).
5660 (when (numberp (cddr marks))
5661 (setcdr marks (list (cdr marks))))
5662 (setq articles (cdr marks))
5663 (while (and articles
5664 (or (and (consp (car articles))
5665 (> min (cdar articles)))
5666 (and (numberp (car articles))
5667 (> min (car articles)))))
5669 (set var articles))))))))
5671 (defun gnus-update-missing-marks (missing)
5672 "Go through the list of MISSING articles and remove them from the mark lists."
5675 ;; Go through all types.
5676 (dolist (elem gnus-article-mark-lists)
5677 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5678 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5679 (when (symbol-value var)
5680 ;; This list has articles. So we delete all missing
5681 ;; articles from it.
5684 (set var (delq (pop m) (symbol-value var))))))))))
5686 (defun gnus-update-marks ()
5687 "Enter the various lists of marked articles into the newsgroup info list."
5688 (let ((types gnus-article-mark-lists)
5689 (info (gnus-get-info gnus-newsgroup-name))
5690 type list newmarked symbol delta-marks)
5692 ;; Add all marks lists to the list of marks lists.
5693 (while (setq type (pop types))
5694 (setq list (symbol-value
5696 (intern (format "gnus-newsgroup-%s" (car type))))))
5699 ;; Get rid of the entries of the articles that have the
5701 (when (and (eq (cdr type) 'score)
5705 (prev (cons nil list))
5708 (if (or (not (consp (car arts)))
5709 (= (cdar arts) gnus-summary-default-score))
5710 (setcdr prev (cdr arts))
5712 (setq arts (cdr arts)))
5713 (setq list (cdr all)))))
5715 (when (eq (cdr type) 'seen)
5716 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5718 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5719 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5721 (when (and (gnus-check-backend-function
5722 'request-set-mark gnus-newsgroup-name)
5723 (not (gnus-article-unpropagatable-p (cdr type))))
5724 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5725 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5726 (add (gnus-remove-from-range
5727 (gnus-copy-sequence list) old)))
5729 (push (list add 'add (list (cdr type))) delta-marks))
5731 (push (list del 'del (list (cdr type))) delta-marks))))
5734 (push (cons (cdr type) list) newmarked)))
5737 (unless (gnus-check-group gnus-newsgroup-name)
5738 (error "Can't open server for %s" gnus-newsgroup-name))
5739 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5741 ;; Enter these new marks into the info of the group.
5743 (setcar (nthcdr 3 info) newmarked)
5744 ;; Add the marks lists to the end of the info.
5746 (setcdr (nthcdr 2 info) (list newmarked))))
5748 ;; Cut off the end of the info if there's nothing else there.
5752 (when (nthcdr (decf i) info)
5753 (setcdr (nthcdr i info) nil)))))))
5755 (defun gnus-set-mode-line (where)
5756 "Set the mode line of the article or summary buffers.
5757 If WHERE is `summary', the summary mode line format will be used."
5758 ;; Is this mode line one we keep updated?
5759 (when (and (memq where gnus-updated-mode-lines)
5761 (intern (format "gnus-%s-mode-line-format-spec" where))))
5764 ;; We evaluate this in the summary buffer since these
5765 ;; variables are buffer-local to that buffer.
5766 (set-buffer gnus-summary-buffer)
5767 ;; We bind all these variables that are used in the `eval' form
5769 (let* ((mformat (symbol-value
5771 (format "gnus-%s-mode-line-format-spec" where))))
5772 (gnus-tmp-group-name (gnus-mode-string-quote
5773 (gnus-group-decoded-name
5774 gnus-newsgroup-name)))
5775 (gnus-tmp-article-number (or gnus-current-article 0))
5776 (gnus-tmp-unread gnus-newsgroup-unreads)
5777 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5778 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5779 (gnus-tmp-unread-and-unselected
5780 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5781 (zerop gnus-tmp-unselected))
5783 ((zerop gnus-tmp-unselected)
5784 (format "{%d more}" gnus-tmp-unread-and-unticked))
5785 (t (format "{%d(+%d) more}"
5786 gnus-tmp-unread-and-unticked
5787 gnus-tmp-unselected))))
5789 (if (and gnus-current-headers
5790 (vectorp gnus-current-headers))
5791 (gnus-mode-string-quote
5792 (mail-header-subject gnus-current-headers))
5794 bufname-length max-len
5795 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5796 (setq mode-string (eval mformat))
5797 (setq bufname-length (if (string-match "%b" mode-string)
5800 (if (eq where 'summary)
5802 (get-buffer gnus-article-buffer))))
5805 (setq max-len (max 4 (if gnus-mode-non-string-length
5807 gnus-mode-non-string-length
5809 (length mode-string))))
5810 ;; We might have to chop a bit of the string off...
5811 (when (> (length mode-string) max-len)
5813 (concat (truncate-string-to-width mode-string (- max-len 3))
5815 ;; Pad the mode string a bit.
5816 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5817 ;; Update the mode line.
5818 (setq mode-line-buffer-identification
5819 (gnus-mode-line-buffer-identification (list mode-string)))
5820 (set-buffer-modified-p t))))
5822 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5823 "Go through the HEADERS list and add all Xrefs to a hash table.
5824 The resulting hash table is returned, or nil if no Xrefs were found."
5825 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5826 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5827 (xref-hashtb (gnus-make-hashtable))
5828 start group entry number xrefs header)
5830 (setq header (pop headers))
5831 (when (and (setq xrefs (mail-header-xref header))
5832 (not (memq (setq number (mail-header-number header))
5835 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5836 (setq start (match-end 0))
5837 (setq group (if prefix
5838 (concat prefix (substring xrefs (match-beginning 1)
5840 (substring xrefs (match-beginning 1) (match-end 1))))
5842 (string-to-number (substring xrefs (match-beginning 2)
5844 (if (setq entry (gnus-gethash group xref-hashtb))
5845 (setcdr entry (cons number (cdr entry)))
5846 (gnus-sethash group (cons number nil) xref-hashtb)))))
5847 (and start xref-hashtb)))
5849 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5850 "Look through all the headers and mark the Xrefs as read."
5851 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5852 name entry info xref-hashtb idlist method nth4)
5854 (set-buffer gnus-group-buffer)
5855 (when (setq xref-hashtb
5856 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5859 (unless (string= from-newsgroup (setq name (symbol-name group)))
5860 (setq idlist (symbol-value group))
5861 ;; Dead groups are not updated.
5863 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5865 (when (stringp (setq nth4 (gnus-info-method info)))
5866 (setq nth4 (gnus-server-to-method nth4))))
5867 ;; Only do the xrefs if the group has the same
5868 ;; select method as the group we have just read.
5869 (or (gnus-methods-equal-p
5870 nth4 (gnus-find-method-for-group from-newsgroup))
5872 (equal nth4 (setq method (gnus-find-method-for-group
5874 (and (equal (car nth4) (car method))
5875 (equal (nth 1 nth4) (nth 1 method))))
5876 gnus-use-cross-reference
5877 (or (not (eq gnus-use-cross-reference t))
5879 ;; Only do cross-references on subscribed
5880 ;; groups, if that is what is wanted.
5881 (<= (gnus-info-level info) gnus-level-subscribed))
5882 (gnus-group-make-articles-read name idlist))))
5885 (defun gnus-compute-read-articles (group articles)
5886 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5887 (info (nth 2 entry))
5888 (active (gnus-active group))
5891 ;; First peel off all invalid article numbers.
5893 (let ((ids articles)
5895 (while (setq id (pop ids))
5896 (when (and first (> id (cdr active)))
5897 ;; We'll end up in this situation in one particular
5898 ;; obscure situation. If you re-scan a group and get
5899 ;; a new article that is cross-posted to a different
5900 ;; group that has not been re-scanned, you might get
5901 ;; crossposted article that has a higher number than
5902 ;; Gnus believes possible. So we re-activate this
5903 ;; group as well. This might mean doing the
5904 ;; crossposting thingy will *increase* the number
5905 ;; of articles in some groups. Tsk, tsk.
5906 (setq active (or (gnus-activate-group group) active)))
5907 (when (or (> id (cdr active))
5908 (< id (car active)))
5909 (setq articles (delq id articles))))))
5910 ;; If the read list is nil, we init it.
5912 (null (gnus-info-read info))
5914 (setq ninfo (cons 1 (1- (car active))))
5915 (setq ninfo (gnus-info-read info)))
5916 ;; Then we add the read articles to the range.
5918 ninfo (setq articles (sort articles '<))))))
5920 (defun gnus-group-make-articles-read (group articles)
5921 "Update the info of GROUP to say that ARTICLES are read."
5923 (entry (gnus-gethash group gnus-newsrc-hashtb))
5924 (info (nth 2 entry))
5925 (active (gnus-active group))
5928 (setq range (gnus-compute-read-articles group articles))
5930 (set-buffer gnus-group-buffer)
5933 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5934 (gnus-info-set-read ',info ',(gnus-info-read info))
5935 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5936 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5937 (gnus-group-update-group ,group t))))
5938 ;; Add the read articles to the range.
5939 (gnus-info-set-read info range)
5940 (gnus-request-set-mark group (list (list range 'add '(read))))
5941 ;; Then we have to re-compute how many unread
5942 ;; articles there are in this group.
5946 (setq num (- (1+ (cdr active)) (car active))))
5947 ((not (listp (cdr range)))
5948 (setq num (- (cdr active) (- (1+ (cdr range))
5952 (if (numberp (car range))
5954 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5955 (setq range (cdr range)))
5956 (setq num (- (cdr active) num))))
5957 ;; Update the number of unread articles.
5959 ;; Update the group buffer.
5960 (unless (gnus-ephemeral-group-p group)
5961 (gnus-group-update-group group t))))))
5963 (defvar gnus-newsgroup-none-id 0)
5965 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5966 (let ((cur nntp-server-buffer)
5969 (save-excursion (set-buffer gnus-summary-buffer)
5970 gnus-newsgroup-dependencies)))
5972 (mail-parse-charset gnus-newsgroup-charset)
5973 (mail-parse-ignored-charsets
5974 (save-excursion (condition-case nil
5975 (set-buffer gnus-summary-buffer)
5977 gnus-newsgroup-ignored-charsets)))
5979 (set-buffer nntp-server-buffer)
5980 ;; Translate all TAB characters into SPACE characters.
5981 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5982 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5983 (ietf-drums-unfold-fws)
5984 (gnus-run-hooks 'gnus-parse-headers-hook)
5985 (let ((case-fold-search t)
5986 in-reply-to header p lines chars)
5987 (goto-char (point-min))
5988 ;; Search to the beginning of the next header. Error messages
5989 ;; do not begin with 2 or 3.
5990 (while (re-search-forward "^[23][0-9]+ " nil t)
5993 ;; This implementation of this function, with nine
5994 ;; search-forwards instead of the one re-search-forward and
5995 ;; a case (which basically was the old function) is actually
5996 ;; about twice as fast, even though it looks messier. You
5997 ;; can't have everything, I guess. Speed and elegance
5998 ;; doesn't always go hand in hand.
6007 (narrow-to-region (point)
6008 (or (and (search-forward "\n.\n" nil t)
6014 (if (search-forward "\nsubject:" nil t)
6015 (funcall gnus-decode-encoded-word-function
6016 (nnheader-header-value))
6021 (if (search-forward "\nfrom:" nil t)
6022 (funcall gnus-decode-encoded-address-function
6023 (nnheader-header-value))
6028 (if (search-forward "\ndate:" nil t)
6029 (nnheader-header-value) ""))
6033 (setq id (if (re-search-forward
6034 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6035 ;; We do it this way to make sure the Message-ID
6036 ;; is (somewhat) syntactically valid.
6037 (buffer-substring (match-beginning 1)
6039 ;; If there was no message-id, we just fake one
6040 ;; to make subsequent routines simpler.
6041 (nnheader-generate-fake-message-id))))
6045 (if (search-forward "\nreferences:" nil t)
6049 (nnheader-header-value)
6054 (search-backward ">" end t)
6057 (search-backward "<" end t)
6059 ;; Get the references from the in-reply-to header if there
6060 ;; were no references and the in-reply-to header looks
6062 (if (and (search-forward "\nin-reply-to:" nil t)
6063 (setq in-reply-to (nnheader-header-value))
6064 (string-match "<[^>]+>" in-reply-to))
6066 (setq ref (substring in-reply-to (match-beginning 0)
6068 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6069 (setq ref2 (substring in-reply-to (match-beginning 0)
6071 (when (> (length ref2) (length ref))
6078 (if (search-forward "\nchars: " nil t)
6079 (if (numberp (setq chars (ignore-errors (read cur))))
6085 (if (search-forward "\nlines: " nil t)
6086 (if (numberp (setq lines (ignore-errors (read cur))))
6092 (and (search-forward "\nxref:" nil t)
6093 (nnheader-header-value)))
6095 (when gnus-extra-headers
6096 (let ((extra gnus-extra-headers)
6100 (when (search-forward
6101 (concat "\n" (symbol-name (car extra)) ":") nil t)
6102 (push (cons (car extra) (nnheader-header-value))
6106 (when (equal id ref)
6109 (when gnus-alter-header-function
6110 (funcall gnus-alter-header-function header)
6111 (setq id (mail-header-id header)
6112 ref (gnus-parent-id (mail-header-references header))))
6115 (gnus-dependencies-add-header
6116 header dependencies force-new))
6117 (push header headers))
6118 (goto-char (point-max))
6120 (nreverse headers)))))
6122 ;; Goes through the xover lines and returns a list of vectors
6123 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6124 force-new dependencies
6125 group also-fetch-heads)
6126 "Parse the news overview data in the server buffer.
6127 Return a list of headers that match SEQUENCE (see
6128 `nntp-retrieve-headers')."
6129 ;; Get the Xref when the users reads the articles since most/some
6130 ;; NNTP servers do not include Xrefs when using XOVER.
6131 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6132 (let ((mail-parse-charset gnus-newsgroup-charset)
6133 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6134 (cur nntp-server-buffer)
6135 (dependencies (or dependencies gnus-newsgroup-dependencies))
6137 ((eq gnus-read-all-available-headers t)
6139 ((and (stringp gnus-read-all-available-headers)
6141 (string-match gnus-read-all-available-headers group))
6144 number headers header)
6146 (set-buffer nntp-server-buffer)
6147 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6148 ;; Allow the user to mangle the headers before parsing them.
6149 (gnus-run-hooks 'gnus-parse-headers-hook)
6150 (goto-char (point-min))
6151 (gnus-parse-without-error
6152 (while (and (or sequence allp)
6154 (setq number (read cur))
6156 (while (and sequence
6157 (< (car sequence) number))
6158 (setq sequence (cdr sequence))))
6161 (eq number (car sequence))))
6163 (setq sequence (cdr sequence))
6164 (setq header (inline
6165 (gnus-nov-parse-line
6166 number dependencies force-new)))))
6167 (push header headers))
6169 ;; A common bug in inn is that if you have posted an article and
6170 ;; then retrieves the active file, it will answer correctly --
6171 ;; the new article is included. However, a NOV entry for the
6172 ;; article may not have been generated yet, so this may fail.
6173 ;; We work around this problem by retrieving the last few
6174 ;; headers using HEAD.
6175 (if (or (not also-fetch-heads)
6177 ;; We (probably) got all the headers.
6179 (let ((gnus-nov-is-evil t))
6182 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6183 (gnus-get-newsgroup-headers))))))))
6185 (defun gnus-article-get-xrefs ()
6186 "Fill in the Xref value in `gnus-current-headers', if necessary.
6187 This is meant to be called in `gnus-article-internal-prepare-hook'."
6188 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
6189 gnus-current-headers)))
6190 (or (not gnus-use-cross-reference)
6192 (and (mail-header-xref headers)
6193 (not (string= (mail-header-xref headers) "")))
6194 (let ((case-fold-search t)
6197 (nnheader-narrow-to-headers)
6198 (goto-char (point-min))
6199 (when (or (and (not (eobp))
6200 (eq (downcase (char-after)) ?x)
6201 (looking-at "Xref:"))
6202 (search-forward "\nXref:" nil t))
6203 (goto-char (1+ (match-end 0)))
6204 (setq xref (buffer-substring (point) (gnus-point-at-eol)))
6205 (mail-header-set-xref headers xref)))))))
6207 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6208 "Find article ID and insert the summary line for that article.
6209 OLD-HEADER can either be a header or a line number to insert
6210 the subject line on."
6211 (let* ((line (and (numberp old-header) old-header))
6212 (old-header (and (vectorp old-header) old-header))
6213 (header (cond ((and old-header use-old-header)
6216 (gnus-number-to-header id))
6217 (gnus-number-to-header id))
6219 (gnus-read-header id))))
6220 (number (and (numberp id) id))
6223 ;; Rebuild the thread that this article is part of and go to the
6224 ;; article we have fetched.
6225 (when (and (not gnus-show-threads)
6228 (setq d (gnus-data-find (mail-header-number old-header))))
6229 (goto-char (gnus-data-pos d))
6232 (- (gnus-point-at-bol)
6234 (1+ (gnus-point-at-eol))
6235 (gnus-delete-line))))))
6236 ;; Remove list identifiers from subject.
6237 (when gnus-list-identifiers
6238 (let ((gnus-newsgroup-headers (list header)))
6239 (gnus-summary-remove-list-identifiers)))
6241 (mail-header-set-number header (mail-header-number old-header)))
6242 (setq gnus-newsgroup-sparse
6243 (delq (setq number (mail-header-number header))
6244 gnus-newsgroup-sparse))
6245 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6246 (push number gnus-newsgroup-limit)
6247 (gnus-rebuild-thread (mail-header-id header) line)
6248 (gnus-summary-goto-subject number nil t))
6249 (when (and (numberp number)
6251 ;; We have to update the boundaries even if we can't fetch the
6252 ;; article if ID is a number -- so that the next `P' or `N'
6253 ;; command will fetch the previous (or next) article even
6254 ;; if the one we tried to fetch this time has been canceled.
6255 (when (> number gnus-newsgroup-end)
6256 (setq gnus-newsgroup-end number))
6257 (when (< number gnus-newsgroup-begin)
6258 (setq gnus-newsgroup-begin number))
6259 (setq gnus-newsgroup-unselected
6260 (delq number gnus-newsgroup-unselected)))
6261 ;; Report back a success?
6262 (and header (mail-header-number header))))
6264 ;;; Process/prefix in the summary buffer
6266 (defun gnus-summary-work-articles (n)
6267 "Return a list of articles to be worked upon.
6268 The prefix argument, the list of process marked articles, and the
6269 current article will be taken into consideration."
6271 (set-buffer gnus-summary-buffer)
6274 ;; A numerical prefix has been given.
6275 (setq n (prefix-numeric-value n))
6276 (let ((backward (< n 0))
6277 (n (abs (prefix-numeric-value n)))
6282 (push (setq article (gnus-summary-article-number))
6285 (gnus-summary-find-prev nil article)
6286 (gnus-summary-find-next nil article)))
6288 (nreverse articles)))
6289 ((and (gnus-region-active-p) (mark))
6290 (message "region active")
6291 ;; Work on the region between point and mark.
6292 (let ((max (max (point) (mark)))
6295 (goto-char (min (point) (mark)))
6298 (push (setq article (gnus-summary-article-number)) articles)
6299 (gnus-summary-find-next nil article)
6301 (nreverse articles))))
6302 (gnus-newsgroup-processable
6303 ;; There are process-marked articles present.
6304 ;; Save current state.
6305 (gnus-summary-save-process-mark)
6307 (reverse gnus-newsgroup-processable))
6309 ;; Just return the current article.
6310 (list (gnus-summary-article-number))))))
6312 (defmacro gnus-summary-iterate (arg &rest forms)
6313 "Iterate over the process/prefixed articles and do FORMS.
6314 ARG is the interactive prefix given to the command. FORMS will be
6315 executed with point over the summary line of the articles."
6316 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6317 `(let ((,articles (gnus-summary-work-articles ,arg)))
6319 (gnus-summary-goto-subject (car ,articles))
6323 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6324 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6326 (defun gnus-summary-save-process-mark ()
6327 "Push the current set of process marked articles on the stack."
6329 (push (copy-sequence gnus-newsgroup-processable)
6330 gnus-newsgroup-process-stack))
6332 (defun gnus-summary-kill-process-mark ()
6333 "Push the current set of process marked articles on the stack and unmark."
6335 (gnus-summary-save-process-mark)
6336 (gnus-summary-unmark-all-processable))
6338 (defun gnus-summary-yank-process-mark ()
6339 "Pop the last process mark state off the stack and restore it."
6341 (unless gnus-newsgroup-process-stack
6342 (error "Empty mark stack"))
6343 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6345 (defun gnus-summary-process-mark-set (set)
6346 "Make SET into the current process marked articles."
6347 (gnus-summary-unmark-all-processable)
6349 (gnus-summary-set-process-mark (pop set))))
6351 ;;; Searching and stuff
6353 (defun gnus-summary-search-group (&optional backward use-level)
6354 "Search for next unread newsgroup.
6355 If optional argument BACKWARD is non-nil, search backward instead."
6357 (set-buffer gnus-group-buffer)
6358 (when (gnus-group-search-forward
6359 backward nil (if use-level (gnus-group-group-level) nil))
6360 (gnus-group-group-name))))
6362 (defun gnus-summary-best-group (&optional exclude-group)
6363 "Find the name of the best unread group.
6364 If EXCLUDE-GROUP, do not go to this group."
6366 (set-buffer gnus-group-buffer)
6368 (gnus-group-best-unread-group exclude-group))))
6370 (defun gnus-summary-find-next (&optional unread article backward)
6372 (gnus-summary-find-prev unread article)
6373 (let* ((dummy (gnus-summary-article-intangible-p))
6374 (article (or article (gnus-summary-article-number)))
6375 (data (gnus-data-find-list article))
6377 (when (and (not dummy)
6378 (or (not gnus-summary-check-current)
6380 (not (gnus-data-unread-p (car data)))))
6381 (setq data (cdr data)))
6386 (unless (memq (gnus-data-number (car data))
6388 ((eq gnus-auto-goto-ignores
6389 'always-undownloaded)
6390 gnus-newsgroup-undownloaded)
6393 ((eq gnus-auto-goto-ignores
6395 gnus-newsgroup-unfetched)
6396 ((eq gnus-auto-goto-ignores
6398 gnus-newsgroup-undownloaded)))
6399 (when (gnus-data-unread-p (car data))
6400 (setq result (car data)
6402 (setq data (cdr data)))
6405 (goto-char (gnus-data-pos result))
6406 (gnus-data-number result)))))
6408 (defun gnus-summary-find-prev (&optional unread article)
6409 (let* ((eobp (eobp))
6410 (article (or article (gnus-summary-article-number)))
6411 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6413 (when (and (not eobp)
6414 (or (not gnus-summary-check-current)
6416 (not (gnus-data-unread-p (car data)))))
6417 (setq data (cdr data)))
6422 (unless (memq (gnus-data-number (car data))
6424 ((eq gnus-auto-goto-ignores
6425 'always-undownloaded)
6426 gnus-newsgroup-undownloaded)
6429 ((eq gnus-auto-goto-ignores
6431 gnus-newsgroup-unfetched)
6432 ((eq gnus-auto-goto-ignores
6434 gnus-newsgroup-undownloaded)))
6435 (when (gnus-data-unread-p (car data))
6436 (setq result (car data)
6438 (setq data (cdr data)))
6441 (goto-char (gnus-data-pos result))
6442 (gnus-data-number result))))
6444 (defun gnus-summary-find-subject (subject &optional unread backward article)
6445 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6446 (article (or article (gnus-summary-article-number)))
6447 (articles (gnus-data-list backward))
6448 (arts (gnus-data-find-list article articles))
6450 (when (or (not gnus-summary-check-current)
6452 (not (gnus-data-unread-p (car arts))))
6453 (setq arts (cdr arts)))
6455 (and (or (not unread)
6456 (gnus-data-unread-p (car arts)))
6457 (vectorp (gnus-data-header (car arts)))
6459 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6460 (setq result (car arts)
6462 (setq arts (cdr arts)))
6464 (goto-char (gnus-data-pos result))
6465 (gnus-data-number result))))
6467 (defun gnus-summary-search-forward (&optional unread subject backward)
6468 "Search forward for an article.
6469 If UNREAD, look for unread articles. If SUBJECT, look for
6470 articles with that subject. If BACKWARD, search backward instead."
6471 (cond (subject (gnus-summary-find-subject subject unread backward))
6472 (backward (gnus-summary-find-prev unread))
6473 (t (gnus-summary-find-next unread))))
6475 (defun gnus-recenter (&optional n)
6476 "Center point in window and redisplay frame.
6477 Also do horizontal recentering."
6479 (when (and gnus-auto-center-summary
6480 (not (eq gnus-auto-center-summary 'vertical)))
6481 (gnus-horizontal-recenter))
6484 (defun gnus-summary-recenter ()
6485 "Center point in the summary window.
6486 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6487 displayed, no centering will be performed."
6488 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6489 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6491 ;; The user has to want it.
6492 (when gnus-auto-center-summary
6493 (let* ((top (cond ((< (window-height) 4) 0)
6494 ((< (window-height) 7) 1)
6495 (t (if (numberp gnus-auto-center-summary)
6496 gnus-auto-center-summary
6498 (height (1- (window-height)))
6499 (bottom (save-excursion (goto-char (point-max))
6500 (forward-line (- height))
6502 (window (get-buffer-window (current-buffer))))
6503 (when (get-buffer-window gnus-article-buffer)
6504 ;; Only do recentering when the article buffer is displayed,
6505 ;; Set the window start to either `bottom', which is the biggest
6506 ;; possible valid number, or the second line from the top,
6507 ;; whichever is the least.
6508 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6509 (if (> bottom top-pos)
6510 ;; Keep the second line from the top visible
6511 (set-window-start window top-pos t)
6512 ;; Try to keep the bottom line visible; if it's partially
6513 ;; obscured, either scroll one more line to make it fully
6514 ;; visible, or revert to using TOP-POS.
6516 (goto-char (point-max))
6518 (let ((last-line-start (point)))
6520 (set-window-start window (point) t)
6521 (when (not (pos-visible-in-window-p last-line-start window))
6523 (set-window-start window (min (point) top-pos) t)))))))
6524 ;; Do horizontal recentering while we're at it.
6525 (when (and (get-buffer-window (current-buffer) t)
6526 (not (eq gnus-auto-center-summary 'vertical)))
6527 (let ((selected (selected-window)))
6528 (select-window (get-buffer-window (current-buffer) t))
6529 (gnus-summary-position-point)
6530 (gnus-horizontal-recenter)
6531 (select-window selected))))))
6533 (defun gnus-summary-jump-to-group (newsgroup)
6534 "Move point to NEWSGROUP in group mode buffer."
6535 ;; Keep update point of group mode buffer if visible.
6536 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6537 (save-window-excursion
6538 ;; Take care of tree window mode.
6539 (when (get-buffer-window gnus-group-buffer)
6540 (pop-to-buffer gnus-group-buffer))
6541 (gnus-group-jump-to-group newsgroup))
6543 ;; Take care of tree window mode.
6544 (if (get-buffer-window gnus-group-buffer)
6545 (pop-to-buffer gnus-group-buffer)
6546 (set-buffer gnus-group-buffer))
6547 (gnus-group-jump-to-group newsgroup))))
6549 ;; This function returns a list of article numbers based on the
6550 ;; difference between the ranges of read articles in this group and
6551 ;; the range of active articles.
6552 (defun gnus-list-of-unread-articles (group)
6553 (let* ((read (gnus-info-read (gnus-get-info group)))
6554 (active (or (gnus-active group) (gnus-activate-group group)))
6556 (bottom (if gnus-newsgroup-maximum-articles
6558 (- last gnus-newsgroup-maximum-articles -1))
6561 ;; If none are read, then all are unread.
6564 ;; If the range of read articles is a single range, then the
6565 ;; first unread article is the article after the last read
6566 ;; article. Sounds logical, doesn't it?
6567 (if (and (not (listp (cdr read)))
6568 (or (< (car read) bottom)
6569 (progn (setq read (list read))
6571 (setq first (max bottom (1+ (cdr read))))
6572 ;; `read' is a list of ranges.
6573 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6576 (setq first bottom))
6579 (while (< first nlast)
6580 (setq unread (cons first unread)
6582 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6583 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6584 (setq read (cdr read)))))
6585 ;; And add the last unread articles.
6586 (while (<= first last)
6587 (setq unread (cons first unread)
6589 ;; Return the list of unread articles.
6590 (delq 0 (nreverse unread))))
6592 (defun gnus-list-of-read-articles (group)
6593 "Return a list of unread, unticked and non-dormant articles."
6594 (let* ((info (gnus-get-info group))
6595 (marked (gnus-info-marks info))
6596 (active (gnus-active group)))
6598 (gnus-list-range-difference
6599 (gnus-list-range-difference
6600 (gnus-sorted-complement
6601 (gnus-uncompress-range
6602 (if gnus-newsgroup-maximum-articles
6603 (cons (max (car active)
6605 gnus-newsgroup-maximum-articles
6609 (gnus-list-of-unread-articles group))
6610 (cdr (assq 'dormant marked)))
6611 (cdr (assq 'tick marked))))))
6613 ;; This function returns a sequence of article numbers based on the
6614 ;; difference between the ranges of read articles in this group and
6615 ;; the range of active articles.
6616 (defun gnus-sequence-of-unread-articles (group)
6617 (let* ((read (gnus-info-read (gnus-get-info group)))
6618 (active (or (gnus-active group) (gnus-activate-group group)))
6620 (bottom (if gnus-newsgroup-maximum-articles
6622 (- last gnus-newsgroup-maximum-articles -1))
6625 ;; If none are read, then all are unread.
6628 ;; If the range of read articles is a single range, then the
6629 ;; first unread article is the article after the last read
6630 ;; article. Sounds logical, doesn't it?
6631 (if (and (not (listp (cdr read)))
6632 (or (< (car read) bottom)
6633 (progn (setq read (list read))
6635 (setq first (max bottom (1+ (cdr read))))
6636 ;; `read' is a list of ranges.
6637 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6640 (setq first bottom))
6643 (push (cons first nlast) unread))
6644 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6645 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6646 (setq read (cdr read)))))
6647 ;; And add the last unread articles.
6648 (cond ((not (and first last))
6651 (push (cons first last) unread))
6653 (push first unread)))
6654 ;; Return the sequence of unread articles.
6655 (delq 0 (nreverse unread))))
6657 ;; Various summary commands
6659 (defun gnus-summary-select-article-buffer ()
6660 "Reconfigure windows to show article buffer."
6662 (if (not (gnus-buffer-live-p gnus-article-buffer))
6663 (error "There is no article buffer for this summary buffer")
6664 (gnus-configure-windows 'article)
6665 (select-window (get-buffer-window gnus-article-buffer))))
6667 (defun gnus-summary-universal-argument (arg)
6668 "Perform any operation on all articles that are process/prefixed."
6670 (let ((articles (gnus-summary-work-articles arg))
6677 (substitute-command-keys
6678 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6680 (gnus-error 1 "Undefined key")
6683 (gnus-summary-goto-subject (setq article (pop articles)))
6684 (let (gnus-newsgroup-processable)
6685 (command-execute func))
6686 (gnus-summary-remove-process-mark article)))))
6687 (gnus-summary-position-point))
6689 (defun gnus-summary-toggle-truncation (&optional arg)
6690 "Toggle truncation of summary lines.
6691 With ARG, turn line truncation on if ARG is positive."
6693 (setq truncate-lines
6694 (if (null arg) (not truncate-lines)
6695 (> (prefix-numeric-value arg) 0)))
6698 (defun gnus-summary-find-for-reselect ()
6699 "Return the number of an article to stay on across a reselect.
6700 The current article is considered, then following articles, then previous
6701 articles. An article is sought which is not cancelled and isn't a temporary
6702 insertion from another group. If there's no such then return a dummy 0."
6704 (dolist (rev '(nil t))
6705 (unless found ; don't demand the reverse list if we don't need it
6706 (let ((data (gnus-data-find-list
6707 (gnus-summary-article-number) (gnus-data-list rev))))
6708 (while (and data (not found))
6709 (if (and (< 0 (gnus-data-number (car data)))
6710 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6711 (setq found (gnus-data-number (car data))))
6712 (setq data (cdr data))))))
6715 (defun gnus-summary-reselect-current-group (&optional all rescan)
6716 "Exit and then reselect the current newsgroup.
6717 The prefix argument ALL means to select all articles."
6719 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6720 (error "Ephemeral groups can't be reselected"))
6721 (let ((current-subject (gnus-summary-find-for-reselect))
6722 (group gnus-newsgroup-name))
6723 (setq gnus-newsgroup-begin nil)
6724 (gnus-summary-exit nil 'leave-hidden)
6725 ;; We have to adjust the point of group mode buffer because
6726 ;; point was moved to the next unread newsgroup by exiting.
6727 (gnus-summary-jump-to-group group)
6730 (gnus-group-get-new-news-this-group 1)))
6731 (gnus-group-read-group all t)
6732 (gnus-summary-goto-subject current-subject nil t)))
6734 (defun gnus-summary-rescan-group (&optional all)
6735 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6737 (gnus-summary-reselect-current-group all t))
6739 (defun gnus-summary-update-info (&optional non-destructive)
6741 (let ((group gnus-newsgroup-name))
6743 (when gnus-newsgroup-kill-headers
6744 (setq gnus-newsgroup-killed
6745 (gnus-compress-sequence
6747 (gnus-list-range-intersection
6748 gnus-newsgroup-unselected gnus-newsgroup-killed)
6749 gnus-newsgroup-unreads)
6751 (unless (listp (cdr gnus-newsgroup-killed))
6752 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6753 (let ((headers gnus-newsgroup-headers))
6754 ;; Set the new ranges of read articles.
6756 (set-buffer gnus-group-buffer)
6757 (gnus-undo-force-boundary))
6758 (gnus-update-read-articles
6759 group (gnus-sorted-union
6760 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6761 ;; Set the current article marks.
6762 (let ((gnus-newsgroup-scored
6763 (if (and (not gnus-save-score)
6764 (not non-destructive))
6766 gnus-newsgroup-scored)))
6768 (gnus-update-marks)))
6769 ;; Do the cross-ref thing.
6770 (when gnus-use-cross-reference
6771 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6772 ;; Do not switch windows but change the buffer to work.
6773 (set-buffer gnus-group-buffer)
6774 (unless (gnus-ephemeral-group-p group)
6775 (gnus-group-update-group group)))))))
6777 (defun gnus-summary-save-newsrc (&optional force)
6778 "Save the current number of read/marked articles in the dribble buffer.
6779 The dribble buffer will then be saved.
6780 If FORCE (the prefix), also save the .newsrc file(s)."
6782 (gnus-summary-update-info t)
6784 (gnus-save-newsrc-file)
6785 (gnus-dribble-save)))
6787 (defun gnus-summary-exit (&optional temporary leave-hidden)
6788 "Exit reading current newsgroup, and then return to group selection mode.
6789 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6791 (gnus-set-global-variables)
6792 (when (gnus-buffer-live-p gnus-article-buffer)
6794 (set-buffer gnus-article-buffer)
6795 (mm-destroy-parts gnus-article-mime-handles)
6796 ;; Set it to nil for safety reason.
6797 (setq gnus-article-mime-handle-alist nil)
6798 (setq gnus-article-mime-handles nil)))
6799 (gnus-kill-save-kill-buffer)
6800 (gnus-async-halt-prefetch)
6801 (let* ((group gnus-newsgroup-name)
6802 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6803 (gnus-group-is-exiting-p t)
6806 (buf (current-buffer)))
6808 ;; Do adaptive scoring, and possibly save score files.
6809 (when gnus-newsgroup-adaptive
6810 (gnus-score-adaptive))
6811 (when gnus-use-scoring
6813 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6814 ;; If we have several article buffers, we kill them at exit.
6815 (unless gnus-single-article-buffer
6816 (gnus-kill-buffer gnus-original-article-buffer)
6817 (setq gnus-article-current nil))
6818 (when gnus-use-cache
6819 (gnus-cache-possibly-remove-articles)
6820 (gnus-cache-save-buffers))
6821 (gnus-async-prefetch-remove-group group)
6822 (when gnus-suppress-duplicates
6823 (gnus-dup-enter-articles))
6824 (when gnus-use-trees
6825 (gnus-tree-close group))
6826 (when gnus-use-cache
6827 (gnus-cache-write-active))
6828 ;; Remove entries for this group.
6829 (nnmail-purge-split-history (gnus-group-real-name group))
6830 ;; Make all changes in this group permanent.
6832 (gnus-run-hooks 'gnus-exit-group-hook)
6833 (gnus-summary-update-info))
6834 (gnus-close-group group)
6835 ;; Make sure where we were, and go to next newsgroup.
6836 (set-buffer gnus-group-buffer)
6838 (gnus-group-jump-to-group group))
6839 (gnus-run-hooks 'gnus-summary-exit-hook)
6840 (unless (or quit-config
6841 ;; If this group has disappeared from the summary
6842 ;; buffer, don't skip forwards.
6843 (not (string= group (gnus-group-group-name))))
6844 (gnus-group-next-unread-group 1))
6845 (setq group-point (point))
6848 ;; If we have several article buffers, we kill them at exit.
6849 (unless gnus-single-article-buffer
6850 (gnus-kill-buffer gnus-article-buffer)
6851 (gnus-kill-buffer gnus-original-article-buffer)
6852 (setq gnus-article-current nil))
6854 (if (not gnus-kill-summary-on-exit)
6856 (gnus-deaden-summary)
6858 ;; We set all buffer-local variables to nil. It is unclear why
6859 ;; this is needed, but if we don't, buffer-local variables are
6860 ;; not garbage-collected, it seems. This would the lead to en
6861 ;; ever-growing Emacs.
6862 (gnus-summary-clear-local-variables)
6863 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6864 (gnus-summary-clear-local-variables))
6865 (when (get-buffer gnus-article-buffer)
6866 (bury-buffer gnus-article-buffer))
6867 ;; We clear the global counterparts of the buffer-local
6868 ;; variables as well, just to be on the safe side.
6869 (set-buffer gnus-group-buffer)
6870 (gnus-summary-clear-local-variables)
6871 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6872 (gnus-summary-clear-local-variables))
6873 ;; Return to group mode buffer.
6874 (when (eq mode 'gnus-summary-mode)
6875 (gnus-kill-buffer buf)))
6876 (setq gnus-current-select-method gnus-select-method)
6877 (set-buffer gnus-group-buffer)
6879 (gnus-handle-ephemeral-exit quit-config)
6880 (goto-char group-point)
6881 ;; If gnus-group-buffer is already displayed, make sure we also move
6882 ;; the cursor in the window that displays it.
6883 (let ((win (get-buffer-window (current-buffer) 0)))
6884 (if win (set-window-point win (point))))
6885 (unless leave-hidden
6886 (gnus-configure-windows 'group 'force)))
6887 ;; Clear the current group name.
6889 (setq gnus-newsgroup-name nil)))))
6891 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6892 (defun gnus-summary-exit-no-update (&optional no-questions)
6893 "Quit reading current newsgroup without updating read article info."
6895 (let* ((group gnus-newsgroup-name)
6896 (gnus-group-is-exiting-p t)
6897 (gnus-group-is-exiting-without-update-p t)
6898 (quit-config (gnus-group-quit-config group)))
6899 (when (or no-questions
6901 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6902 (gnus-async-halt-prefetch)
6903 (run-hooks 'gnus-summary-prepare-exit-hook)
6904 (when (gnus-buffer-live-p gnus-article-buffer)
6906 (set-buffer gnus-article-buffer)
6907 (mm-destroy-parts gnus-article-mime-handles)
6908 ;; Set it to nil for safety reason.
6909 (setq gnus-article-mime-handle-alist nil)
6910 (setq gnus-article-mime-handles nil)))
6911 ;; If we have several article buffers, we kill them at exit.
6912 (unless gnus-single-article-buffer
6913 (gnus-kill-buffer gnus-article-buffer)
6914 (gnus-kill-buffer gnus-original-article-buffer)
6915 (setq gnus-article-current nil))
6916 (if (not gnus-kill-summary-on-exit)
6917 (gnus-deaden-summary)
6918 (gnus-close-group group)
6919 (gnus-summary-clear-local-variables)
6920 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6921 (gnus-summary-clear-local-variables))
6922 (set-buffer gnus-group-buffer)
6923 (gnus-summary-clear-local-variables)
6924 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6925 (gnus-summary-clear-local-variables))
6926 (gnus-kill-buffer gnus-summary-buffer))
6927 (unless gnus-single-article-buffer
6928 (setq gnus-article-current nil))
6929 (when gnus-use-trees
6930 (gnus-tree-close group))
6931 (gnus-async-prefetch-remove-group group)
6932 (when (get-buffer gnus-article-buffer)
6933 (bury-buffer gnus-article-buffer))
6934 ;; Return to the group buffer.
6935 (gnus-configure-windows 'group 'force)
6936 ;; Clear the current group name.
6937 (setq gnus-newsgroup-name nil)
6938 (unless (gnus-ephemeral-group-p group)
6939 (gnus-group-update-group group))
6940 (when (equal (gnus-group-group-name) group)
6941 (gnus-group-next-unread-group 1))
6943 (gnus-handle-ephemeral-exit quit-config)))))
6945 (defun gnus-handle-ephemeral-exit (quit-config)
6946 "Handle movement when leaving an ephemeral group.
6947 The state which existed when entering the ephemeral is reset."
6948 (if (not (buffer-name (car quit-config)))
6949 (gnus-configure-windows 'group 'force)
6950 (set-buffer (car quit-config))
6951 (cond ((eq major-mode 'gnus-summary-mode)
6952 (gnus-set-global-variables))
6953 ((eq major-mode 'gnus-article-mode)
6955 ;; The `gnus-summary-buffer' variable may point
6956 ;; to the old summary buffer when using a single
6958 (unless (gnus-buffer-live-p gnus-summary-buffer)
6959 (set-buffer gnus-group-buffer))
6960 (set-buffer gnus-summary-buffer)
6961 (gnus-set-global-variables))))
6962 (if (or (eq (cdr quit-config) 'article)
6963 (eq (cdr quit-config) 'pick))
6965 ;; The current article may be from the ephemeral group
6966 ;; thus it is best that we reload this article
6968 ;; If we're exiting from a large digest, this can be
6969 ;; extremely slow. So, it's better not to reload it. -- jh.
6970 ;;(gnus-summary-show-article)
6971 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6972 (gnus-configure-windows 'pick 'force)
6973 (gnus-configure-windows (cdr quit-config) 'force)))
6974 (gnus-configure-windows (cdr quit-config) 'force))
6975 (when (eq major-mode 'gnus-summary-mode)
6976 (gnus-summary-next-subject 1 nil t)
6977 (gnus-summary-recenter)
6978 (gnus-summary-position-point))))
6982 (defvar gnus-dead-summary-mode-map nil)
6984 (unless gnus-dead-summary-mode-map
6985 (setq gnus-dead-summary-mode-map (make-keymap))
6986 (suppress-keymap gnus-dead-summary-mode-map)
6987 (substitute-key-definition
6988 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6989 (dolist (key '("\C-d" "\r" "\177" [delete]))
6990 (define-key gnus-dead-summary-mode-map
6991 key
'gnus-summary-wake-up-the-dead
))
6992 (dolist (key '("q" "Q"))
6993 (define-key gnus-dead-summary-mode-map key
'bury-buffer
)))
6995 (defvar gnus-dead-summary-mode nil
6996 "Minor mode for Gnus summary buffers.")
6998 (defun gnus-dead-summary-mode (&optional arg
)
6999 "Minor mode for Gnus summary buffers."
7001 (when (eq major-mode
'gnus-summary-mode
)
7002 (make-local-variable 'gnus-dead-summary-mode
)
7003 (setq gnus-dead-summary-mode
7004 (if (null arg
) (not gnus-dead-summary-mode
)
7005 (> (prefix-numeric-value arg
) 0)))
7006 (when gnus-dead-summary-mode
7007 (gnus-add-minor-mode
7008 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
7010 (defun gnus-deaden-summary ()
7011 "Make the current summary buffer into a dead summary buffer."
7012 ;; Kill any previous dead summary buffer.
7013 (when (and gnus-dead-summary
7014 (buffer-name gnus-dead-summary
))
7016 (set-buffer gnus-dead-summary
)
7017 (when gnus-dead-summary-mode
7018 (kill-buffer (current-buffer)))))
7019 ;; Make this the current dead summary.
7020 (setq gnus-dead-summary
(current-buffer))
7021 (gnus-dead-summary-mode 1)
7022 (let ((name (buffer-name)))
7023 (when (string-match "Summary" name
)
7025 (concat (substring name
0 (match-beginning 0)) "Dead "
7026 (substring name
(match-beginning 0)))
7030 (defun gnus-kill-or-deaden-summary (buffer)
7031 "Kill or deaden the summary BUFFER."
7033 (when (and (buffer-name buffer
)
7034 (not gnus-single-article-buffer
))
7037 (gnus-kill-buffer gnus-article-buffer
)
7038 (gnus-kill-buffer gnus-original-article-buffer
)))
7041 (gnus-kill-summary-on-exit
7042 (when (and gnus-use-trees
7043 (gnus-buffer-exists-p buffer
))
7046 (gnus-tree-close gnus-newsgroup-name
)))
7047 (gnus-kill-buffer buffer
))
7048 ;; Deaden the buffer.
7049 ((gnus-buffer-exists-p buffer
)
7052 (gnus-deaden-summary))))))
7054 (defun gnus-summary-wake-up-the-dead (&rest args
)
7055 "Wake up the dead summary buffer."
7057 (gnus-dead-summary-mode -
1)
7058 (let ((name (buffer-name)))
7059 (when (string-match "Dead " name
)
7061 (concat (substring name
0 (match-beginning 0))
7062 (substring name
(match-end 0)))
7064 (gnus-message 3 "This dead summary is now alive again"))
7066 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7067 (defun gnus-summary-fetch-faq (&optional faq-dir
)
7068 "Fetch the FAQ for the current group.
7069 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7073 (when current-prefix-arg
7075 "FAQ dir: " (and (listp gnus-group-faq-directory
)
7076 (mapcar (lambda (file) (list file
))
7077 gnus-group-faq-directory
))))))
7078 (let (gnus-faq-buffer)
7079 (when (setq gnus-faq-buffer
7080 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
7081 (gnus-configure-windows 'summary-faq
))))
7083 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7084 (defun gnus-summary-describe-group (&optional force
)
7085 "Describe the current newsgroup."
7087 (gnus-group-describe-group force gnus-newsgroup-name
))
7089 (defun gnus-summary-describe-briefly ()
7090 "Describe summary mode commands briefly."
7092 (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")))
7094 ;; Walking around group mode buffer from summary mode.
7096 (defun gnus-summary-next-group (&optional no-article target-group backward
)
7097 "Exit current newsgroup and then select next unread newsgroup.
7098 If prefix argument NO-ARTICLE is non-nil, no article is selected
7099 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7100 previous group instead."
7102 ;; Stop pre-fetching.
7103 (gnus-async-halt-prefetch)
7104 (let ((current-group gnus-newsgroup-name
)
7105 (current-buffer (current-buffer))
7107 ;; First we semi-exit this group to update Xrefs and all variables.
7108 ;; We can't do a real exit, because the window conf must remain
7109 ;; the same in case the user is prompted for info, and we don't
7110 ;; want the window conf to change before that...
7111 (gnus-summary-exit t
)
7112 (while (not entered
)
7113 ;; Then we find what group we are supposed to enter.
7114 (set-buffer gnus-group-buffer
)
7115 (gnus-group-jump-to-group current-group
)
7118 (if (eq gnus-keep-same-level
'best
)
7119 (gnus-summary-best-group gnus-newsgroup-name
)
7120 (gnus-summary-search-group backward gnus-keep-same-level
))))
7121 (if (not target-group
)
7122 ;; There are no further groups, so we return to the group
7125 (gnus-message 5 "Returning to the group buffer")
7127 (when (gnus-buffer-live-p current-buffer
)
7128 (set-buffer current-buffer
)
7129 (gnus-summary-exit))
7130 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
7131 ;; We try to enter the target group.
7132 (gnus-group-jump-to-group target-group
)
7133 (let ((unreads (gnus-group-group-unread)))
7134 (if (and (or (eq t unreads
)
7135 (and unreads
(not (zerop unreads
))))
7136 (gnus-summary-read-group
7137 target-group nil no-article
7138 (and (buffer-name current-buffer
) current-buffer
)
7141 (setq current-group target-group
7142 target-group nil
)))))))
7144 (defun gnus-summary-prev-group (&optional no-article
)
7145 "Exit current newsgroup and then select previous unread newsgroup.
7146 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7148 (gnus-summary-next-group no-article nil t
))
7150 ;; Walking around summary lines.
7152 (defun gnus-summary-first-subject (&optional unread undownloaded unseen
)
7153 "Go to the first subject satisfying any non-nil constraint.
7154 If UNREAD is non-nil, the article should be unread.
7155 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7156 If UNSEEN is non-nil, the article should be unseen.
7157 Returns the article selected or nil if there are no matching articles."
7161 ((null gnus-newsgroup-data
)
7162 (gnus-message 3 "No articles in the group")
7164 ;; Pick the first article.
7165 ((not (or unread undownloaded unseen
))
7166 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
7167 (gnus-data-number (car gnus-newsgroup-data
)))
7168 ;; Find the first unread article.
7170 (let ((data gnus-newsgroup-data
))
7172 (let ((num (gnus-data-number (car data
))))
7173 (or (memq num gnus-newsgroup-unfetched
)
7174 (not (or (and unread
7175 (memq num gnus-newsgroup-unreads
))
7177 (memq num gnus-newsgroup-undownloaded
))
7179 (memq num gnus-newsgroup-unseen
)))))))
7180 (setq data
(cdr data
)))
7184 (goto-char (gnus-data-pos (car data
)))
7185 (gnus-data-number (car data
)))
7186 (gnus-message 3 "No more%s articles"
7187 (let* ((r (when unread
" unread"))
7188 (d (when undownloaded
" undownloaded"))
7189 (s (when unseen
" unseen"))
7190 (l (delq nil
(list r d s
))))
7191 (cond ((= 3 (length l
))
7192 (concat r
"," d
", or" s
))
7194 (concat (car l
) ", or" (cadr l
)))
7201 (gnus-summary-position-point))))))
7203 (defun gnus-summary-next-subject (n &optional unread dont-display
)
7204 "Go to next N'th summary line.
7205 If N is negative, go to the previous N'th subject line.
7206 If UNREAD is non-nil, only unread articles are selected.
7207 The difference between N and the actual number of steps taken is
7210 (let ((backward (< n
0))
7214 (gnus-summary-find-prev unread
)
7215 (gnus-summary-find-next unread
)))
7216 (unless (zerop (setq n
(1- n
)))
7217 (gnus-summary-show-thread)))
7219 (gnus-message 7 "No more%s articles"
7220 (if unread
" unread" "")))
7221 (unless dont-display
7222 (gnus-summary-recenter)
7223 (gnus-summary-position-point))
7226 (defun gnus-summary-next-unread-subject (n)
7227 "Go to next N'th unread summary line."
7229 (gnus-summary-next-subject n t
))
7231 (defun gnus-summary-prev-subject (n &optional unread
)
7232 "Go to previous N'th summary line.
7233 If optional argument UNREAD is non-nil, only unread article is selected."
7235 (gnus-summary-next-subject (- n
) unread
))
7237 (defun gnus-summary-prev-unread-subject (n)
7238 "Go to previous N'th unread summary line."
7240 (gnus-summary-next-subject (- n
) t
))
7242 (defun gnus-summary-goto-subjects (articles)
7243 "Insert the subject header for ARTICLES in the current buffer."
7245 (dolist (article articles
)
7246 (gnus-summary-goto-subject article t
)))
7247 (gnus-summary-limit (append articles gnus-newsgroup-limit
))
7248 (gnus-summary-position-point))
7250 (defun gnus-summary-goto-subject (article &optional force silent
)
7251 "Go the subject line of ARTICLE.
7252 If FORCE, also allow jumping to articles not currently shown."
7253 (interactive "nArticle number: ")
7254 (unless (numberp article
)
7255 (error "Article %s is not a number" article
))
7257 (data (gnus-data-find article
)))
7258 ;; We read in the article if we have to.
7261 (gnus-summary-insert-subject
7263 (if (or (numberp force
) (vectorp force
)) force
)
7265 (setq data
(gnus-data-find article
)))
7270 (gnus-message 3 "Can't find article %d" article
))
7272 (let ((pt (gnus-data-pos data
)))
7274 (gnus-summary-set-article-display-arrow pt
))
7275 (gnus-summary-position-point)
7278 ;; Walking around summary lines with displaying articles.
7280 (defun gnus-summary-expand-window (&optional arg
)
7281 "Make the summary buffer take up the entire Emacs frame.
7282 Given a prefix, will force an `article' buffer configuration."
7285 (gnus-configure-windows 'article
'force
)
7286 (gnus-configure-windows 'summary
'force
)))
7288 (defun gnus-summary-display-article (article &optional all-header
)
7289 "Display ARTICLE in article buffer."
7290 (when (gnus-buffer-live-p gnus-article-buffer
)
7291 (with-current-buffer gnus-article-buffer
7292 (mm-enable-multibyte)))
7293 (gnus-set-global-variables)
7294 (when (gnus-buffer-live-p gnus-article-buffer
)
7295 (with-current-buffer gnus-article-buffer
7296 (setq gnus-article-charset gnus-newsgroup-charset
)
7297 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets
)
7298 (mm-enable-multibyte)))
7302 (if gnus-summary-display-article-function
7303 (funcall gnus-summary-display-article-function article all-header
)
7304 (gnus-article-prepare article all-header
))
7305 (gnus-run-hooks 'gnus-select-article-hook
)
7306 (when (and gnus-current-article
7307 (not (zerop gnus-current-article
)))
7308 (gnus-summary-goto-subject gnus-current-article
))
7309 (gnus-summary-recenter)
7310 (when (and gnus-use-trees gnus-show-threads
)
7311 (gnus-possibly-generate-tree article
)
7312 (gnus-highlight-selected-tree article
))
7313 ;; Successfully display article.
7314 (gnus-article-set-window-start
7315 (cdr (assq article gnus-newsgroup-bookmarks
))))))
7317 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
7318 "Select the current article.
7319 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7320 non-nil, the article will be re-fetched even if it already present in
7321 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7323 ;; Make sure we are in the summary buffer to work around bbdb bug.
7324 (unless (eq major-mode
'gnus-summary-mode
)
7325 (set-buffer gnus-summary-buffer
))
7326 (let ((article (or article
(gnus-summary-article-number)))
7327 (all-headers (not (not all-headers
))) ;Must be t or nil.
7328 gnus-summary-display-article-function
)
7330 (gnus-summary-article-pseudo-p article
)
7331 (error "This is a pseudo-article"))
7333 (set-buffer gnus-summary-buffer
)
7334 (if (or (and gnus-single-article-buffer
7335 (or (null gnus-current-article
)
7336 (null gnus-article-current
)
7337 (null (get-buffer gnus-article-buffer
))
7338 (not (eq article
(cdr gnus-article-current
)))
7339 (not (equal (car gnus-article-current
)
7340 gnus-newsgroup-name
))))
7341 (and (not gnus-single-article-buffer
)
7342 (or (null gnus-current-article
)
7343 (not (eq gnus-current-article article
))))
7345 ;; The requested article is different from the current article.
7347 (gnus-summary-display-article article all-headers
)
7348 (when (gnus-buffer-live-p gnus-article-buffer
)
7349 (with-current-buffer gnus-article-buffer
7350 (if (not gnus-article-decoded-p
) ;; a local variable
7351 (mm-disable-multibyte))))
7352 (gnus-article-set-window-start
7353 (cdr (assq article gnus-newsgroup-bookmarks
)))
7357 (defun gnus-summary-force-verify-and-decrypt ()
7358 "Display buttons for signed/encrypted parts and verify/decrypt them."
7360 (let ((mm-verify-option 'known
)
7361 (mm-decrypt-option 'known
)
7362 (gnus-article-emulate-mime t
)
7363 (gnus-buttonized-mime-types (append (list "multipart/signed"
7364 "multipart/encrypted")
7365 gnus-buttonized-mime-types
)))
7366 (gnus-summary-select-article nil
'force
)))
7368 (defun gnus-summary-set-current-mark (&optional current-mark
)
7369 "Obsolete function."
7372 (defun gnus-summary-next-article (&optional unread subject backward push
)
7373 "Select the next article.
7374 If UNREAD, only unread articles are selected.
7375 If SUBJECT, only articles with SUBJECT are selected.
7376 If BACKWARD, the previous article is selected instead of the next."
7378 ;; Make sure we are in the summary buffer.
7379 (unless (eq major-mode
'gnus-summary-mode
)
7380 (set-buffer gnus-summary-buffer
))
7382 ;; Is there such an article?
7383 ((and (gnus-summary-search-forward unread subject backward
)
7384 (or (gnus-summary-display-article (gnus-summary-article-number))
7385 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
7386 (gnus-summary-position-point))
7387 ;; If not, we try the first unread, if that is wanted.
7389 gnus-auto-select-same
7390 (gnus-summary-first-unread-article))
7391 (gnus-summary-position-point)
7392 (gnus-message 6 "Wrapped"))
7393 ;; Try to get next/previous article not displayed in this group.
7394 ((and gnus-auto-extend-newsgroup
7395 (not unread
) (not subject
))
7396 (gnus-summary-goto-article
7397 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
7398 nil
(count-lines (point-min) (point))))
7399 ;; Go to next/previous group.
7401 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
7402 (gnus-summary-jump-to-group gnus-newsgroup-name
))
7403 (let ((cmd last-command-char
)
7406 (set-buffer gnus-group-buffer
)
7409 (if (eq gnus-keep-same-level
'best
)
7410 (gnus-summary-best-group gnus-newsgroup-name
)
7411 (gnus-summary-search-group backward gnus-keep-same-level
))))
7412 ;; For some reason, the group window gets selected. We change
7414 (select-window (get-buffer-window (current-buffer)))
7415 ;; Select next unread newsgroup automagically.
7417 ((or (not gnus-auto-select-next
)
7419 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
7420 ((or (eq gnus-auto-select-next
'quietly
)
7421 (and (eq gnus-auto-select-next
'slightly-quietly
)
7423 (and (eq gnus-auto-select-next
'almost-quietly
)
7424 (gnus-summary-last-article-p)))
7426 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
7428 (gnus-message 7 "No more%s articles (%s)..."
7429 (if unread
" unread" "")
7430 (if group
(concat "selecting " group
)
7432 (gnus-summary-next-group nil group backward
)))
7434 (when (gnus-key-press-event-p last-input-event
)
7435 (gnus-summary-walk-group-buffer
7436 gnus-newsgroup-name cmd unread backward point
))))))))
7438 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
7439 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
7440 (?\C-p
(gnus-group-prev-unread-group 1))))
7441 (cursor-in-echo-area t
)
7442 keve key group ended prompt
)
7444 (set-buffer gnus-group-buffer
)
7447 (if (eq gnus-keep-same-level
'best
)
7448 (gnus-summary-best-group gnus-newsgroup-name
)
7449 (gnus-summary-search-group backward gnus-keep-same-level
))))
7453 "No more%s articles%s " (if unread
" unread" "")
7455 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
7456 (format " (Type %s for %s [%s])"
7457 (single-key-description cmd
)
7458 (gnus-group-decoded-name group
)
7459 (car (gnus-gethash group gnus-newsrc-hashtb
)))
7460 (format " (Type %s to exit %s)"
7461 (single-key-description cmd
)
7462 (gnus-group-decoded-name gnus-newsgroup-name
)))))
7463 ;; Confirm auto selection.
7464 (setq key
(car (setq keve
(gnus-read-event-char prompt
)))
7467 ((assq key keystrokes
)
7468 (let ((obuf (current-buffer)))
7469 (switch-to-buffer gnus-group-buffer
)
7471 (gnus-group-jump-to-group group
))
7472 (eval (cadr (assq key keystrokes
)))
7473 (setq group
(gnus-group-group-name))
7474 (switch-to-buffer obuf
))
7478 (gnus-ephemeral-group-p gnus-newsgroup-name
))
7480 (gnus-summary-next-group nil group backward
)))
7482 (push (cdr keve
) unread-command-events
))))))
7484 (defun gnus-summary-next-unread-article ()
7485 "Select unread article after current one."
7487 (gnus-summary-next-article
7488 (or (not (eq gnus-summary-goto-unread
'never
))
7489 (gnus-summary-last-article-p (gnus-summary-article-number)))
7490 (and gnus-auto-select-same
7491 (gnus-summary-article-subject))))
7493 (defun gnus-summary-prev-article (&optional unread subject
)
7494 "Select the article after the current one.
7495 If UNREAD is non-nil, only unread articles are selected."
7497 (gnus-summary-next-article unread subject t
))
7499 (defun gnus-summary-prev-unread-article ()
7500 "Select unread article before current one."
7502 (gnus-summary-prev-article
7503 (or (not (eq gnus-summary-goto-unread
'never
))
7504 (gnus-summary-first-article-p (gnus-summary-article-number)))
7505 (and gnus-auto-select-same
7506 (gnus-summary-article-subject))))
7508 (defun gnus-summary-next-page (&optional lines circular stop
)
7509 "Show next page of the selected article.
7510 If at the end of the current article, select the next article.
7511 LINES says how many lines should be scrolled up.
7513 If CIRCULAR is non-nil, go to the start of the article instead of
7514 selecting the next article when reaching the end of the current
7517 If STOP is non-nil, just stop when reaching the end of the message.
7519 Also see the variable `gnus-article-skip-boring'."
7521 (setq gnus-summary-buffer
(current-buffer))
7522 (gnus-set-global-variables)
7523 (let ((article (gnus-summary-article-number))
7524 (article-window (get-buffer-window gnus-article-buffer t
))
7526 ;; If the buffer is empty, we have no article.
7528 (error "No article to select"))
7529 (gnus-configure-windows 'article
)
7530 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
7531 (if (and (eq gnus-summary-goto-unread
'never
)
7532 (not (gnus-summary-last-article-p article
)))
7533 (gnus-summary-next-article)
7534 (gnus-summary-next-unread-article))
7535 (if (or (null gnus-current-article
)
7536 (null gnus-article-current
)
7537 (/= article
(cdr gnus-article-current
))
7538 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7539 ;; Selected subject is different from current article's.
7540 (gnus-summary-display-article article
)
7541 (when article-window
7542 (gnus-eval-in-buffer-window gnus-article-buffer
7543 (setq endp
(or (gnus-article-next-page lines
)
7544 (gnus-article-only-boring-p))))
7547 (gnus-message 3 "End of message"))
7549 (gnus-summary-beginning-of-article))
7551 (gnus-message 3 "End of message"))
7553 (if (and (eq gnus-summary-goto-unread
'never
)
7554 (not (gnus-summary-last-article-p article
)))
7555 (gnus-summary-next-article)
7556 (gnus-summary-next-unread-article))))))))
7557 (gnus-summary-recenter)
7558 (gnus-summary-position-point)))
7560 (defun gnus-summary-prev-page (&optional lines move
)
7561 "Show previous page of selected article.
7562 Argument LINES specifies lines to be scrolled down.
7563 If MOVE, move to the previous unread article if point is at
7564 the beginning of the buffer."
7566 (let ((article (gnus-summary-article-number))
7567 (article-window (get-buffer-window gnus-article-buffer t
))
7569 (gnus-configure-windows 'article
)
7570 (if (or (null gnus-current-article
)
7571 (null gnus-article-current
)
7572 (/= article
(cdr gnus-article-current
))
7573 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7574 ;; Selected subject is different from current article's.
7575 (gnus-summary-display-article article
)
7576 (gnus-summary-recenter)
7577 (when article-window
7578 (gnus-eval-in-buffer-window gnus-article-buffer
7579 (setq endp
(gnus-article-prev-page lines
)))
7580 (when (and move endp
)
7582 (gnus-message 3 "Beginning of message"))
7584 (if (and (eq gnus-summary-goto-unread
'never
)
7585 (not (gnus-summary-first-article-p article
)))
7586 (gnus-summary-prev-article)
7587 (gnus-summary-prev-unread-article))))))))
7588 (gnus-summary-position-point))
7590 (defun gnus-summary-prev-page-or-article (&optional lines
)
7591 "Show previous page of selected article.
7592 Argument LINES specifies lines to be scrolled down.
7593 If at the beginning of the article, go to the next article."
7595 (gnus-summary-prev-page lines t
))
7597 (defun gnus-summary-scroll-up (lines)
7598 "Scroll up (or down) one line current article.
7599 Argument LINES specifies lines to be scrolled up (or down if negative)."
7601 (gnus-configure-windows 'article
)
7602 (gnus-summary-show-thread)
7603 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
7604 (gnus-eval-in-buffer-window gnus-article-buffer
7606 (when (gnus-article-next-page lines
)
7607 (gnus-message 3 "End of message")))
7609 (gnus-article-prev-page (- lines
))))))
7610 (gnus-summary-recenter)
7611 (gnus-summary-position-point))
7613 (defun gnus-summary-scroll-down (lines)
7614 "Scroll down (or up) one line current article.
7615 Argument LINES specifies lines to be scrolled down (or up if negative)."
7617 (gnus-summary-scroll-up (- lines
)))
7619 (defun gnus-summary-next-same-subject ()
7620 "Select next article which has the same subject as current one."
7622 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
7624 (defun gnus-summary-prev-same-subject ()
7625 "Select previous article which has the same subject as current one."
7627 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
7629 (defun gnus-summary-next-unread-same-subject ()
7630 "Select next unread article which has the same subject as current one."
7632 (gnus-summary-next-article t
(gnus-summary-article-subject)))
7634 (defun gnus-summary-prev-unread-same-subject ()
7635 "Select previous unread article which has the same subject as current one."
7637 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
7639 (defun gnus-summary-first-unread-article ()
7640 "Select the first unread article.
7641 Return nil if there are no unread articles."
7644 (when (gnus-summary-first-subject t
)
7645 (gnus-summary-show-thread)
7646 (gnus-summary-first-subject t
)
7647 (gnus-summary-display-article (gnus-summary-article-number)))
7648 (gnus-summary-position-point)))
7650 (defun gnus-summary-first-unread-subject ()
7651 "Place the point on the subject line of the first unread article.
7652 Return nil if there are no unread articles."
7655 (when (gnus-summary-first-subject t
)
7656 (gnus-summary-show-thread)
7657 (gnus-summary-first-subject t
))
7658 (gnus-summary-position-point)))
7660 (defun gnus-summary-first-unseen-subject ()
7661 "Place the point on the subject line of the first unseen article.
7662 Return nil if there are no unseen articles."
7665 (when (gnus-summary-first-subject nil nil t
)
7666 (gnus-summary-show-thread)
7667 (gnus-summary-first-subject nil nil t
))
7668 (gnus-summary-position-point)))
7670 (defun gnus-summary-first-unseen-or-unread-subject ()
7671 "Place the point on the subject line of the first unseen article or,
7672 if all article have been seen, on the subject line of the first unread
7676 (unless (when (gnus-summary-first-subject nil nil t
)
7677 (gnus-summary-show-thread)
7678 (gnus-summary-first-subject nil nil t
))
7679 (when (gnus-summary-first-subject t
)
7680 (gnus-summary-show-thread)
7681 (gnus-summary-first-subject t
)))
7682 (gnus-summary-position-point)))
7684 (defun gnus-summary-first-article ()
7685 "Select the first article.
7686 Return nil if there are no articles."
7689 (when (gnus-summary-first-subject)
7690 (gnus-summary-show-thread)
7691 (gnus-summary-first-subject)
7692 (gnus-summary-display-article (gnus-summary-article-number)))
7693 (gnus-summary-position-point)))
7695 (defun gnus-summary-best-unread-article (&optional arg
)
7696 "Select the unread article with the highest score.
7697 If given a prefix argument, select the next unread article that has a
7698 score higher than the default score."
7700 (let ((article (if arg
7701 (gnus-summary-better-unread-subject)
7702 (gnus-summary-best-unread-subject))))
7704 (gnus-summary-goto-article article
)
7705 (error "No unread articles"))))
7707 (defun gnus-summary-best-unread-subject ()
7708 "Select the unread subject with the highest score."
7710 (let ((best -
1000000)
7711 (data gnus-newsgroup-data
)
7714 (and (gnus-data-unread-p (car data
))
7716 (gnus-summary-article-score (gnus-data-number (car data
))))
7719 article
(gnus-data-number (car data
))))
7720 (setq data
(cdr data
)))
7722 (gnus-summary-goto-subject article
))
7723 (gnus-summary-position-point)
7726 (defun gnus-summary-better-unread-subject ()
7727 "Select the first unread subject that has a score over the default score."
7729 (let ((data gnus-newsgroup-data
)
7731 (while (and (setq article
(gnus-data-number (car data
)))
7732 (or (gnus-data-read-p (car data
))
7733 (not (> (gnus-summary-article-score article
)
7734 gnus-summary-default-score
))))
7735 (setq data
(cdr data
)))
7737 (gnus-summary-goto-subject article
))
7738 (gnus-summary-position-point)
7741 (defun gnus-summary-last-subject ()
7742 "Go to the last displayed subject line in the group."
7743 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
7745 (gnus-summary-goto-subject article
))))
7747 (defun gnus-summary-goto-article (article &optional all-headers force
)
7748 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7749 If ALL-HEADERS is non-nil, no header lines are hidden.
7750 If FORCE, go to the article even if it isn't displayed. If FORCE
7751 is a number, it is the line the article is to be displayed on."
7755 "Article number or Message-ID: "
7756 (mapcar (lambda (number) (list (int-to-string number
)))
7757 gnus-newsgroup-limit
))
7761 (if (and (stringp article
)
7762 (string-match "@\\|%40" article
))
7763 (gnus-summary-refer-article article
)
7764 (when (stringp article
)
7765 (setq article
(string-to-number article
)))
7766 (if (gnus-summary-goto-subject article force
)
7767 (gnus-summary-display-article article all-headers
)
7768 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
7769 (gnus-summary-position-point)))
7771 (defun gnus-summary-goto-last-article ()
7772 "Go to the previously read article."
7775 (when gnus-last-article
7776 (gnus-summary-goto-article gnus-last-article nil t
))
7777 (gnus-summary-position-point)))
7779 (defun gnus-summary-pop-article (number)
7780 "Pop one article off the history and go to the previous.
7781 NUMBER articles will be popped off."
7784 (setq gnus-newsgroup-history
7785 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
7787 (gnus-summary-goto-article (car to
) nil t
)
7788 (error "Article history empty")))
7789 (gnus-summary-position-point))
7791 ;; Summary commands and functions for limiting the summary buffer.
7793 (defun gnus-summary-limit-to-articles (n)
7794 "Limit the summary buffer to the next N articles.
7795 If not given a prefix, use the process marked articles instead."
7798 (let ((articles (gnus-summary-work-articles n
)))
7799 (setq gnus-newsgroup-processable nil
)
7800 (gnus-summary-limit articles
))
7801 (gnus-summary-position-point)))
7803 (defun gnus-summary-pop-limit (&optional total
)
7804 "Restore the previous limit.
7805 If given a prefix, remove all limits."
7808 (setq gnus-newsgroup-limits
7809 (list (mapcar (lambda (h) (mail-header-number h
))
7810 gnus-newsgroup-headers
))))
7811 (unless gnus-newsgroup-limits
7812 (error "No limit to pop"))
7814 (gnus-summary-limit nil
'pop
)
7815 (gnus-summary-position-point)))
7817 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
7818 "Limit the summary buffer to articles that have subjects that match a regexp.
7819 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7821 (list (read-string (if current-prefix-arg
7822 "Exclude subject (regexp): "
7823 "Limit to subject (regexp): "))
7824 nil current-prefix-arg
))
7826 (setq header
"subject"))
7827 (when (not (equal "" subject
))
7829 (let ((articles (gnus-summary-find-matching
7830 (or header
"subject") subject
'all nil nil
7833 (error "Found no matches for \"%s\"" subject
))
7834 (gnus-summary-limit articles
))
7835 (gnus-summary-position-point))))
7837 (defun gnus-summary-limit-to-author (from &optional not-matching
)
7838 "Limit the summary buffer to articles that have authors that match a regexp.
7839 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7841 (list (read-string (if current-prefix-arg
7842 "Exclude author (regexp): "
7843 "Limit to author (regexp): "))
7844 current-prefix-arg
))
7845 (gnus-summary-limit-to-subject from
"from" not-matching
))
7847 (defun gnus-summary-limit-to-age (age &optional younger-p
)
7848 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7849 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7850 articles that are younger than AGE days."
7852 (let ((younger current-prefix-arg
)
7855 (while (not days-got
)
7856 (setq days
(if younger
7857 (read-string "Limit to articles younger than (in days, older when negative): ")
7859 "Limit to articles older than (in days, younger when negative): ")))
7860 (when (> (length days
) 0)
7861 (setq days
(read days
)))
7867 (setq younger
(not younger
))
7868 (setq days
(* days -
1)))))
7869 (message "Please enter a number.")
7871 (list days younger
)))
7873 (let ((data gnus-newsgroup-data
)
7874 (cutoff (days-to-time age
))
7875 articles d date is-younger
)
7876 (while (setq d
(pop data
))
7877 (when (and (vectorp (gnus-data-header d
))
7878 (setq date
(mail-header-date (gnus-data-header d
))))
7879 (setq is-younger
(time-less-p
7880 (time-since (condition-case ()
7887 (push (gnus-data-number d
) articles
))))
7888 (gnus-summary-limit (nreverse articles
)))
7889 (gnus-summary-position-point)))
7891 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
7892 "Limit the summary buffer to articles that match an 'extra' header."
7896 (gnus-completing-read-with-default
7897 (symbol-name (car gnus-extra-headers
))
7898 (if current-prefix-arg
7899 "Exclude extra header"
7900 "Limit extra header")
7902 (cons (symbol-name x
) x
))
7907 (read-string (format "%s header %s (regexp): "
7908 (if current-prefix-arg
"Exclude" "Limit to")
7910 current-prefix-arg
)))
7911 (when (not (equal "" regexp
))
7913 (let ((articles (gnus-summary-find-matching
7914 (cons 'extra header
) regexp
'all nil nil
7917 (error "Found no matches for \"%s\"" regexp
))
7918 (gnus-summary-limit articles
))
7919 (gnus-summary-position-point))))
7921 (defun gnus-summary-limit-to-display-predicate ()
7922 "Limit the summary buffer to the predicated in the `display' group parameter."
7924 (unless gnus-newsgroup-display
7925 (error "There is no `display' group parameter"))
7927 (dolist (number gnus-newsgroup-articles
)
7928 (when (funcall gnus-newsgroup-display
)
7929 (push number articles
)))
7930 (gnus-summary-limit articles
))
7931 (gnus-summary-position-point))
7933 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7935 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7937 (defun gnus-summary-limit-to-unread (&optional all
)
7938 "Limit the summary buffer to articles that are not marked as read.
7939 If ALL is non-nil, limit strictly to unread articles."
7942 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
7943 (gnus-summary-limit-to-marks
7944 ;; Concat all the marks that say that an article is read and have
7946 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7947 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7948 gnus-low-score-mark gnus-expirable-mark
7949 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7950 gnus-duplicate-mark gnus-souped-mark
)
7953 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
7954 (make-obsolete 'gnus-summary-delete-marked-with
7955 'gnus-summary-limit-exclude-marks
)
7957 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
7958 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7959 If REVERSE, limit the summary buffer to articles that are marked
7960 with MARKS. MARKS can either be a string of marks or a list of marks.
7961 Returns how many articles were removed."
7962 (interactive "sMarks: ")
7963 (gnus-summary-limit-to-marks marks t
))
7965 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
7966 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7967 If REVERSE (the prefix), limit the summary buffer to articles that are
7968 not marked with MARKS. MARKS can either be a string of marks or a
7970 Returns how many articles were removed."
7971 (interactive "sMarks: \nP")
7973 (let ((data gnus-newsgroup-data
)
7974 (marks (if (listp marks
) marks
7975 (append marks nil
))) ; Transform to list.
7978 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
7979 (memq (gnus-data-mark (car data
)) marks
))
7980 (push (gnus-data-number (car data
)) articles
))
7981 (setq data
(cdr data
)))
7982 (gnus-summary-limit articles
))
7983 (gnus-summary-position-point)))
7985 (defun gnus-summary-limit-to-score (score)
7986 "Limit to articles with score at or above SCORE."
7987 (interactive "NLimit to articles with score of at least: ")
7988 (let ((data gnus-newsgroup-data
)
7991 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
7993 (push (gnus-data-number (car data
)) articles
))
7994 (setq data
(cdr data
)))
7996 (gnus-summary-limit articles
)
7997 (gnus-summary-position-point))))
7999 (defun gnus-summary-limit-to-unseen ()
8000 "Limit to unseen articles."
8003 (gnus-summary-limit gnus-newsgroup-unseen
)
8004 (gnus-summary-position-point)))
8006 (defun gnus-summary-limit-include-thread (id)
8007 "Display all the hidden articles that is in the thread with ID in it.
8008 When called interactively, ID is the Message-ID of the current
8010 (interactive (list (mail-header-id (gnus-summary-article-header))))
8011 (let ((articles (gnus-articles-in-thread
8012 (gnus-id-to-thread (gnus-root-id id
)))))
8014 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
8015 (gnus-summary-limit-include-matching-articles
8017 (regexp-quote (gnus-simplify-subject-re
8018 (mail-header-subject (gnus-id-to-header id
)))))
8019 (gnus-summary-position-point))))
8021 (defun gnus-summary-limit-include-matching-articles (header regexp
)
8022 "Display all the hidden articles that have HEADERs that match REGEXP."
8023 (interactive (list (read-string "Match on header: ")
8024 (read-string "Regexp: ")))
8025 (let ((articles (gnus-find-matching-articles header regexp
)))
8027 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
8028 (gnus-summary-position-point))))
8030 (defun gnus-summary-insert-dormant-articles ()
8031 "Insert all the dormant articles for this group into the current buffer."
8033 (let ((gnus-verbose (max 6 gnus-verbose
)))
8034 (if (not gnus-newsgroup-dormant
)
8035 (gnus-message 3 "No dormant articles for this group")
8036 (gnus-summary-goto-subjects gnus-newsgroup-dormant
))))
8038 (defun gnus-summary-limit-include-dormant ()
8039 "Display all the hidden articles that are marked as dormant.
8040 Note that this command only works on a subset of the articles currently
8041 fetched for this group."
8043 (unless gnus-newsgroup-dormant
8044 (error "There are no dormant articles in this group"))
8046 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
8047 (gnus-summary-position-point)))
8049 (defun gnus-summary-limit-exclude-dormant ()
8050 "Hide all dormant articles."
8053 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
8054 (gnus-summary-position-point)))
8056 (defun gnus-summary-limit-exclude-childless-dormant ()
8057 "Hide all dormant articles that have no children."
8059 (let ((data (gnus-data-list t
))
8060 articles d children
)
8061 ;; Find all articles that are either not dormant or have
8063 (while (setq d
(pop data
))
8064 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
8066 (gnus-article-children (gnus-data-number d
)))
8069 (when (memq (car children
) articles
)
8074 (push (gnus-data-number d
) articles
)))
8077 (gnus-summary-limit articles
)
8078 (gnus-summary-position-point))))
8080 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
8081 "Mark all unread excluded articles as read.
8082 If ALL, mark even excluded ticked and dormants as read."
8084 (setq gnus-newsgroup-limit
(sort gnus-newsgroup-limit
'<))
8085 (let ((articles (gnus-sorted-ndifference
8087 (mapcar (lambda (h) (mail-header-number h
))
8088 gnus-newsgroup-headers
)
8090 gnus-newsgroup-limit
))
8092 (setq gnus-newsgroup-unreads
8093 (gnus-sorted-intersection gnus-newsgroup-unreads
8094 gnus-newsgroup-limit
))
8096 (setq gnus-newsgroup-dormant nil
8097 gnus-newsgroup-marked nil
8098 gnus-newsgroup-reads
8100 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
8101 gnus-newsgroup-reads
))
8102 (while (setq article
(pop articles
))
8103 (unless (or (memq article gnus-newsgroup-dormant
)
8104 (memq article gnus-newsgroup-marked
))
8105 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
8107 (defun gnus-summary-limit (articles &optional pop
)
8109 ;; We pop the previous limit off the stack and use that.
8110 (setq articles
(car gnus-newsgroup-limits
)
8111 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
8112 ;; We use the new limit, so we push the old limit on the stack.
8113 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
8115 (setq gnus-newsgroup-limit articles
)
8116 (let ((total (length gnus-newsgroup-data
))
8117 (data (gnus-data-find-list (gnus-summary-article-number)))
8118 (gnus-summary-mark-below nil
) ; Inhibit this.
8120 ;; This will do all the work of generating the new summary buffer
8121 ;; according to the new limit.
8122 (gnus-summary-prepare)
8123 ;; Hide any threads, possibly.
8124 (gnus-summary-maybe-hide-threads)
8125 ;; Try to return to the article you were at, or one in the
8128 ;; We try to find some article after the current one.
8130 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
8133 (setq data
(cdr data
))))
8135 ;; If there is no data, that means that we were after the last
8136 ;; article. The same goes when we can't find any articles
8137 ;; after the current one.
8138 (goto-char (point-max))
8139 (gnus-summary-find-prev))
8140 (gnus-set-mode-line 'summary
)
8141 ;; We return how many articles were removed from the summary
8142 ;; buffer as a result of the new limit.
8143 (- total
(length gnus-newsgroup-data
))))
8145 (defsubst gnus-invisible-cut-children
(threads)
8148 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
8153 (defsubst gnus-cut-thread
(thread)
8154 "Go forwards in the thread until we find an article that we want to display."
8155 (when (or (eq gnus-fetch-old-headers
'some
)
8156 (eq gnus-fetch-old-headers
'invisible
)
8157 (numberp gnus-fetch-old-headers
)
8158 (eq gnus-build-sparse-threads
'some
)
8159 (eq gnus-build-sparse-threads
'more
))
8160 ;; Deal with old-fetched headers and sparse threads.
8164 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
8165 (gnus-summary-article-ancient-p
8166 (mail-header-number (car thread
))))
8167 (if (or (<= (length (cdr thread
)) 1)
8168 (eq gnus-fetch-old-headers
'invisible
))
8169 (setq gnus-newsgroup-limit
8170 (delq (mail-header-number (car thread
))
8171 gnus-newsgroup-limit
)
8172 thread
(cadr thread
))
8173 (when (gnus-invisible-cut-children (cdr thread
))
8174 (let ((th (cdr thread
)))
8176 (if (memq (mail-header-number (caar th
))
8177 gnus-newsgroup-limit
)
8178 (setq thread
(car th
)
8180 (setq th
(cdr th
))))))))))
8183 (defun gnus-cut-threads (threads)
8184 "Cut off all uninteresting articles from the beginning of THREADS."
8185 (when (or (eq gnus-fetch-old-headers
'some
)
8186 (eq gnus-fetch-old-headers
'invisible
)
8187 (numberp gnus-fetch-old-headers
)
8188 (eq gnus-build-sparse-threads
'some
)
8189 (eq gnus-build-sparse-threads
'more
))
8192 (setcar th
(gnus-cut-thread (car th
)))
8193 (setq th
(cdr th
)))))
8194 ;; Remove nixed out threads.
8197 (defun gnus-summary-initial-limit (&optional show-if-empty
)
8198 "Figure out what the initial limit is supposed to be on group entry.
8199 This entails weeding out unwanted dormants, low-scored articles,
8200 fetch-old-headers verbiage, and so on."
8201 ;; Most groups have nothing to remove.
8202 (if (or gnus-inhibit-limiting
8203 (and (null gnus-newsgroup-dormant
)
8204 (eq gnus-newsgroup-display
'gnus-not-ignore
)
8205 (not (eq gnus-fetch-old-headers
'some
))
8206 (not (numberp gnus-fetch-old-headers
))
8207 (not (eq gnus-fetch-old-headers
'invisible
))
8208 (null gnus-summary-expunge-below
)
8209 (not (eq gnus-build-sparse-threads
'some
))
8210 (not (eq gnus-build-sparse-threads
'more
))
8211 (null gnus-thread-expunge-below
)
8212 (not gnus-use-nocem
)))
8214 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
8215 (setq gnus-newsgroup-limit nil
)
8218 (unless (car (symbol-value node
))
8219 ;; These threads have no parents -- they are roots.
8220 (let ((nodes (cdr (symbol-value node
)))
8223 (if (and gnus-thread-expunge-below
8224 (< (gnus-thread-total-score (car nodes
))
8225 gnus-thread-expunge-below
))
8226 (gnus-expunge-thread (pop nodes
))
8227 (setq thread
(pop nodes
))
8228 (gnus-summary-limit-children thread
))))))
8229 gnus-newsgroup-dependencies
)
8230 ;; If this limitation resulted in an empty group, we might
8231 ;; pop the previous limit and use it instead.
8232 (when (and (not gnus-newsgroup-limit
)
8234 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
8235 gnus-newsgroup-limit
))
8237 (defun gnus-summary-limit-children (thread)
8238 "Return 1 if this subthread is visible and 0 if it is not."
8239 ;; First we get the number of visible children to this thread. This
8240 ;; is done by recursing down the thread using this function, so this
8241 ;; will really go down to a leaf article first, before slowly
8242 ;; working its way up towards the root.
8244 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth
))
8247 (apply '+ (mapcar 'gnus-summary-limit-children
8250 (number (mail-header-number (car thread
)))
8253 (not (memq number gnus-newsgroup-marked
))
8255 ;; If this article is dormant and has absolutely no visible
8256 ;; children, then this article isn't visible.
8257 (and (memq number gnus-newsgroup-dormant
)
8259 ;; If this is "fetch-old-headered" and there is no
8260 ;; visible children, then we don't want this article.
8261 (and (or (eq gnus-fetch-old-headers
'some
)
8262 (numberp gnus-fetch-old-headers
))
8263 (gnus-summary-article-ancient-p number
)
8265 ;; If this is "fetch-old-headered" and `invisible', then
8266 ;; we don't want this article.
8267 (and (eq gnus-fetch-old-headers
'invisible
)
8268 (gnus-summary-article-ancient-p number
))
8269 ;; If this is a sparsely inserted article with no children,
8270 ;; we don't want it.
8271 (and (eq gnus-build-sparse-threads
'some
)
8272 (gnus-summary-article-sparse-p number
)
8274 ;; If we use expunging, and this article is really
8275 ;; low-scored, then we don't want this article.
8276 (when (and gnus-summary-expunge-below
8278 (or (cdr (assq number gnus-newsgroup-scored
))
8279 gnus-summary-default-score
))
8280 gnus-summary-expunge-below
))
8281 ;; We increase the expunge-tally here, but that has
8282 ;; nothing to do with the limits, really.
8283 (incf gnus-newsgroup-expunged-tally
)
8284 ;; We also mark as read here, if that's wanted.
8285 (when (and gnus-summary-mark-below
8286 (< score gnus-summary-mark-below
))
8287 (setq gnus-newsgroup-unreads
8288 (delq number gnus-newsgroup-unreads
))
8289 (if gnus-newsgroup-auto-expire
8290 (push number gnus-newsgroup-expirable
)
8291 (push (cons number gnus-low-score-mark
)
8292 gnus-newsgroup-reads
)))
8294 ;; Do the `display' group parameter.
8295 (and gnus-newsgroup-display
8296 (not (funcall gnus-newsgroup-display
)))
8297 ;; Check NoCeM things.
8298 (if (and gnus-use-nocem
8299 (gnus-nocem-unwanted-article-p
8300 (mail-header-id (car thread
))))
8302 (setq gnus-newsgroup-unreads
8303 (delq number gnus-newsgroup-unreads
))
8305 ;; Nope, invisible article.
8307 ;; Ok, this article is to be visible, so we add it to the limit
8309 (push number gnus-newsgroup-limit
)
8312 (defun gnus-expunge-thread (thread)
8313 "Mark all articles in THREAD as read."
8314 (let* ((number (mail-header-number (car thread
))))
8315 (incf gnus-newsgroup-expunged-tally
)
8316 ;; We also mark as read here, if that's wanted.
8317 (setq gnus-newsgroup-unreads
8318 (delq number gnus-newsgroup-unreads
))
8319 (if gnus-newsgroup-auto-expire
8320 (push number gnus-newsgroup-expirable
)
8321 (push (cons number gnus-low-score-mark
)
8322 gnus-newsgroup-reads
)))
8323 ;; Go recursively through all subthreads.
8324 (mapcar 'gnus-expunge-thread
(cdr thread
)))
8326 ;; Summary article oriented commands
8328 (defun gnus-summary-refer-parent-article (n)
8329 "Refer parent article N times.
8330 If N is negative, go to ancestor -N instead.
8331 The difference between N and the number of articles fetched is returned."
8335 (when (not (natnump n
))
8340 (setq header
(gnus-summary-article-header))
8341 (if (and (eq (mail-header-number header
)
8342 (cdr gnus-article-current
))
8343 (equal gnus-newsgroup-name
8344 (car gnus-article-current
)))
8345 ;; If we try to find the parent of the currently
8346 ;; displayed article, then we take a look at the actual
8347 ;; References header, since this is slightly more
8348 ;; reliable than the References field we got from the
8351 (set-buffer gnus-original-article-buffer
)
8352 (nnheader-narrow-to-headers)
8353 (unless (setq ref
(message-fetch-field "references"))
8354 (when (setq ref
(message-fetch-field "in-reply-to"))
8355 (setq ref
(gnus-extract-message-id-from-in-reply-to ref
))))
8358 ;; It's not the current article, so we take a bet on
8359 ;; the value we got from the server.
8360 (mail-header-references header
)))
8362 (not (equal ref
"")))
8363 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
8364 (gnus-message 1 "Couldn't find parent"))
8365 (gnus-message 1 "No references in article %d"
8366 (gnus-summary-article-number))
8369 (gnus-summary-position-point)
8372 (defun gnus-summary-refer-references ()
8373 "Fetch all articles mentioned in the References header.
8374 Return the number of articles fetched."
8376 (let ((ref (mail-header-references (gnus-summary-article-header)))
8377 (current (gnus-summary-article-number))
8381 (error "No References in the current article")
8382 ;; For each Message-ID in the References header...
8383 (while (string-match "<[^>]*>" ref
)
8385 ;; ... fetch that article.
8386 (gnus-summary-refer-article
8387 (prog1 (match-string 0 ref
)
8388 (setq ref
(substring ref
(match-end 0))))))
8389 (gnus-summary-goto-subject current
)
8390 (gnus-summary-position-point)
8393 (defun gnus-summary-refer-thread (&optional limit
)
8394 "Fetch all articles in the current thread.
8395 If LIMIT (the numerical prefix), fetch that many old headers instead
8396 of what's specified by the `gnus-refer-thread-limit' variable."
8398 (let ((id (mail-header-id (gnus-summary-article-header)))
8399 (limit (if limit
(prefix-numeric-value limit
)
8400 gnus-refer-thread-limit
)))
8401 (unless (eq gnus-fetch-old-headers
'invisible
)
8402 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
8403 ;; Retrieve the headers and read them in.
8404 (if (eq (if (numberp limit
)
8405 (gnus-retrieve-headers
8407 (+ (mail-header-number
8408 (gnus-summary-article-header))
8410 gnus-newsgroup-end
))
8411 gnus-newsgroup-name
(* limit
2))
8412 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8414 (gnus-retrieve-headers (list gnus-newsgroup-end
)
8415 gnus-newsgroup-name limit
))
8417 (gnus-build-all-threads)
8418 (error "Can't fetch thread from back ends that don't support NOV"))
8419 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
8420 (gnus-summary-limit-include-thread id
)))
8422 (defun gnus-summary-refer-article (message-id)
8423 "Fetch an article specified by MESSAGE-ID."
8424 (interactive "sMessage-ID: ")
8425 (when (and (stringp message-id
)
8426 (not (zerop (length message-id
))))
8427 (setq message-id
(gnus-replace-in-string message-id
" " ""))
8428 ;; Construct the correct Message-ID if necessary.
8429 ;; Suggested by tale@pawl.rpi.edu.
8430 (unless (string-match "^<" message-id
)
8431 (setq message-id
(concat "<" message-id
)))
8432 (unless (string-match ">$" message-id
)
8433 (setq message-id
(concat message-id
">")))
8434 ;; People often post MIDs from URLs, so unhex it:
8435 (unless (string-match "@" message-id
)
8436 (setq message-id
(gnus-url-unhex-string message-id
)))
8437 (let* ((header (gnus-id-to-header message-id
))
8439 (gnus-summary-article-sparse-p
8440 (mail-header-number header
))
8441 (memq (mail-header-number header
)
8442 gnus-newsgroup-limit
)))
8445 ;; If the article is present in the buffer we just go to it.
8447 (or (not (gnus-summary-article-sparse-p
8448 (mail-header-number header
)))
8451 (gnus-summary-goto-article
8452 (mail-header-number header
) nil t
)
8454 (gnus-summary-update-article (mail-header-number header
)))))
8456 ;; We fetch the article.
8458 (dolist (gnus-override-method (gnus-refer-article-methods))
8459 (when (and (gnus-check-server gnus-override-method
)
8460 ;; Fetch the header,
8461 (setq number
(gnus-summary-insert-subject message-id
)))
8462 ;; and display the article.
8463 (gnus-summary-select-article nil nil nil number
)
8465 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
8467 (defun gnus-refer-article-methods ()
8468 "Return a list of referable methods."
8470 ;; No method, so we default to current and native.
8471 ((null gnus-refer-article-method
)
8472 (list gnus-current-select-method gnus-select-method
))
8474 ((eq 'current gnus-refer-article-method
)
8475 (list gnus-current-select-method
))
8476 ;; List of select methods.
8477 ((not (and (symbolp (car gnus-refer-article-method
))
8478 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
8480 (dolist (method gnus-refer-article-method
)
8481 (push (if (eq 'current method
)
8482 gnus-current-select-method
8486 ;; One single select method.
8488 (list gnus-refer-article-method
))))
8490 (defun gnus-summary-edit-parameters ()
8491 "Edit the group parameters of the current group."
8493 (gnus-group-edit-group gnus-newsgroup-name
'params
))
8495 (defun gnus-summary-customize-parameters ()
8496 "Customize the group parameters of the current group."
8498 (gnus-group-customize gnus-newsgroup-name
))
8500 (defun gnus-summary-enter-digest-group (&optional force
)
8501 "Enter an nndoc group based on the current article.
8502 If FORCE, force a digest interpretation. If not, try
8503 to guess what the document format is."
8505 (let ((conf gnus-current-window-configuration
))
8506 (save-window-excursion
8508 (let (gnus-article-prepare-hook
8509 gnus-display-mime-function
8511 (gnus-summary-select-article))))
8512 (setq gnus-current-window-configuration conf
)
8513 (let* ((name (format "%s-%d"
8514 (gnus-group-prefixed-name
8515 gnus-newsgroup-name
(list 'nndoc
""))
8517 (set-buffer gnus-summary-buffer
)
8518 gnus-current-article
)))
8519 (ogroup gnus-newsgroup-name
)
8520 (params (append (gnus-info-params (gnus-get-info ogroup
))
8521 (list (cons 'to-group ogroup
))
8522 (list (cons 'parent-group ogroup
))
8523 (list (cons 'save-article-group ogroup
))))
8524 (case-fold-search t
)
8525 (buf (current-buffer))
8528 (set-buffer gnus-original-article-buffer
)
8529 ;; Have the digest group inherit the main mail address of
8530 ;; the parent article.
8531 (when (setq to-address
(or (gnus-fetch-field "reply-to")
8532 (gnus-fetch-field "from")))
8535 (list (cons 'to-address
8536 (funcall gnus-decode-encoded-address-function
8538 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
8539 (insert-buffer-substring gnus-original-article-buffer
)
8540 ;; Remove lines that may lead nndoc to misinterpret the
8543 (goto-char (point-min))
8544 (or (search-forward "\n\n" nil t
) (point)))
8545 (goto-char (point-min))
8546 (delete-matching-lines "^Path:\\|^From ")
8549 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
8550 (gnus-newsgroup-ephemeral-ignored-charsets
8551 gnus-newsgroup-ignored-charsets
))
8552 (gnus-group-read-ephemeral-group
8553 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
8555 ,(if force
'mbox
'guess
)))
8557 `((adapt-file .
,(gnus-score-file-name gnus-newsgroup-name
8559 ;; Make all postings to this group go to the parent group.
8560 (nconc (gnus-info-params (gnus-get-info name
))
8562 ;; Couldn't select this doc group.
8563 (switch-to-buffer buf
)
8564 (gnus-set-global-variables)
8565 (gnus-configure-windows 'summary
)
8566 (gnus-message 3 "Article couldn't be entered?"))
8567 (kill-buffer dig
)))))
8569 (defun gnus-summary-read-document (n)
8570 "Open a new group based on the current article(s).
8571 This will allow you to read digests and other similar
8572 documents as newsgroups.
8573 Obeys the standard process/prefix convention."
8575 (let* ((articles (gnus-summary-work-articles n
))
8576 (ogroup gnus-newsgroup-name
)
8577 (params (append (gnus-info-params (gnus-get-info ogroup
))
8578 (list (cons 'to-group ogroup
))))
8579 article group egroup groups vgroup
)
8580 (while (setq article
(pop articles
))
8581 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
8582 (gnus-summary-remove-process-mark article
)
8583 (when (gnus-summary-display-article article
)
8586 (insert-buffer-substring gnus-original-article-buffer
)
8587 ;; Remove some headers that may lead nndoc to make
8589 (message-narrow-to-head)
8590 (goto-char (point-min))
8591 (delete-matching-lines "^\\(Path\\):\\|^From ")
8594 (gnus-group-read-ephemeral-group
8595 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
8596 (nndoc-article-type guess
))
8599 ;; Make all postings to this group go to the parent group.
8600 (nconc (gnus-info-params (gnus-get-info egroup
))
8602 (push egroup groups
))
8603 ;; Couldn't select this doc group.
8604 (gnus-error 3 "Article couldn't be entered"))))))
8605 ;; Now we have selected all the documents.
8608 (error "None of the articles could be interpreted as documents"))
8609 ((gnus-group-read-ephemeral-group
8610 (setq vgroup
(format
8611 "nnvirtual:%s-%s" gnus-newsgroup-name
8612 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8613 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
8615 (cons (current-buffer) 'summary
)))
8617 (error "Couldn't select virtual nndoc group")))))
8619 (defun gnus-summary-isearch-article (&optional regexp-p
)
8620 "Do incremental search forward on the current article.
8621 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8623 (gnus-summary-select-article)
8624 (gnus-configure-windows 'article
)
8625 (gnus-eval-in-buffer-window gnus-article-buffer
8628 (isearch-forward regexp-p
))))
8630 (defun gnus-summary-search-article-forward (regexp &optional backward
)
8631 "Search for an article containing REGEXP forward.
8632 If BACKWARD, search backward instead."
8635 (format "Search article %s (regexp%s): "
8636 (if current-prefix-arg
"backward" "forward")
8637 (if gnus-last-search-regexp
8638 (concat ", default " gnus-last-search-regexp
)
8640 current-prefix-arg
))
8641 (if (string-equal regexp
"")
8642 (setq regexp
(or gnus-last-search-regexp
""))
8643 (setq gnus-last-search-regexp regexp
)
8644 (setq gnus-article-before-search gnus-current-article
))
8645 ;; Intentionally set gnus-last-article.
8646 (setq gnus-last-article gnus-article-before-search
)
8647 (let ((gnus-last-article gnus-last-article
))
8648 (if (gnus-summary-search-article regexp backward
)
8649 (gnus-summary-show-thread)
8650 (signal 'search-failed
(list regexp
)))))
8652 (defun gnus-summary-search-article-backward (regexp)
8653 "Search for an article containing REGEXP backward."
8656 (format "Search article backward (regexp%s): "
8657 (if gnus-last-search-regexp
8658 (concat ", default " gnus-last-search-regexp
)
8660 (gnus-summary-search-article-forward regexp
'backward
))
8662 (defun gnus-summary-search-article (regexp &optional backward
)
8663 "Search for an article containing REGEXP.
8664 Optional argument BACKWARD means do search for backward.
8665 `gnus-select-article-hook' is not called during the search."
8666 ;; We have to require this here to make sure that the following
8667 ;; dynamic binding isn't shadowed by autoloading.
8668 (require 'gnus-async
)
8670 (let ((gnus-select-article-hook nil
) ;Disable hook.
8671 (gnus-article-prepare-hook nil
)
8672 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
8673 (gnus-use-article-prefetch nil
)
8674 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
8675 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
8677 (gnus-keep-backlog nil
)
8678 (gnus-break-pages nil
)
8679 (gnus-summary-display-arrow nil
)
8680 (gnus-updated-mode-lines nil
)
8681 (gnus-auto-center-summary nil
)
8682 (sum (current-buffer))
8683 (gnus-display-mime-function nil
)
8686 (gnus-save-hidden-threads
8687 (gnus-summary-select-article)
8688 (set-buffer gnus-article-buffer
)
8689 (goto-char (window-point (get-buffer-window (current-buffer))))
8693 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
8695 (re-search-backward regexp nil t
)
8696 (re-search-forward regexp nil t
))
8697 ;; We found the regexp.
8702 (get-buffer-window (current-buffer))
8706 (get-buffer-window (current-buffer))
8709 (setq point
(point)))
8710 ;; We didn't find it, so we go to the next article.
8713 (while (eq found
'not
)
8714 (if (not (if backward
(gnus-summary-find-prev)
8715 (gnus-summary-find-next)))
8716 ;; No more articles.
8718 ;; Select the next article and adjust point.
8719 (unless (gnus-summary-article-sparse-p
8720 (gnus-summary-article-number))
8722 (gnus-summary-select-article)
8723 (set-buffer gnus-article-buffer
)
8725 (goto-char (if backward
(point-max) (point-min))))))))
8726 (gnus-message 7 ""))
8727 ;; Return whether we found the regexp.
8728 (when (eq found
'found
)
8730 (gnus-summary-show-thread)
8731 (gnus-summary-goto-subject gnus-current-article
)
8732 (gnus-summary-position-point)
8735 (defun gnus-find-matching-articles (header regexp
)
8736 "Return a list of all articles that match REGEXP on HEADER.
8737 This search includes all articles in the current group that Gnus has
8738 fetched headers for, whether they are displayed or not."
8739 (let ((articles nil
)
8740 (func `(lambda (h) (,(intern (concat "mail-header-" header
)) h
)))
8741 (case-fold-search t
))
8742 (dolist (header gnus-newsgroup-headers
)
8743 (when (string-match regexp
(funcall func header
))
8744 (push (mail-header-number header
) articles
)))
8745 (nreverse articles
)))
8747 (defun gnus-summary-find-matching (header regexp
&optional backward unread
8748 not-case-fold not-matching
)
8749 "Return a list of all articles that match REGEXP on HEADER.
8750 The search stars on the current article and goes forwards unless
8751 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8752 If UNREAD is non-nil, only unread articles will
8753 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8754 in the comparisons. If NOT-MATCHING, return a list of all articles that
8755 not match REGEXP on HEADER."
8756 (let ((case-fold-search (not not-case-fold
))
8759 (if (eq (car header
) 'extra
)
8762 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
8764 (error "%s is an invalid header" header
))
8765 (unless (fboundp (intern (concat "mail-header-" header
)))
8766 (error "%s is not a valid header" header
))
8767 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
8768 (dolist (d (if (eq backward
'all
)
8770 (gnus-data-find-list
8771 (gnus-summary-article-number)
8772 (gnus-data-list backward
))))
8773 (when (and (or (not unread
) ; We want all articles...
8774 (gnus-data-unread-p d
)) ; Or just unreads.
8775 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
8779 (funcall func
(gnus-data-header d
))))
8780 (string-match regexp
8781 (funcall func
(gnus-data-header d
)))))
8782 (push (gnus-data-number d
) articles
))) ; Success!
8783 (nreverse articles
)))
8785 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
8786 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8787 If HEADER is an empty string (or nil), the match is done on the entire
8788 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8790 (list (let ((completion-ignore-case t
))
8793 (mapcar (lambda (header) (list (format "%s" header
)))
8795 '("Number" "Subject" "From" "Lines" "Date"
8796 "Message-ID" "Xref" "References" "Body")
8797 gnus-extra-headers
))
8798 nil
'require-match
))
8799 (read-string "Regexp: ")
8800 (read-key-sequence "Command: ")
8801 current-prefix-arg
))
8802 (when (equal header
"Body")
8804 ;; Hidden thread subtrees must be searched as well.
8805 (gnus-summary-show-all-threads)
8806 ;; We don't want to change current point nor window configuration.
8808 (save-window-excursion
8810 gnus-treat-strip-trailing-blank-lines
8811 gnus-treat-strip-leading-blank-lines
8812 gnus-treat-strip-multiple-blank-lines
8813 gnus-treat-hide-boring-headers
8814 gnus-treat-fold-newsgroups
8815 gnus-article-prepare-hook
)
8816 (gnus-message 6 "Executing %s..." (key-description command
))
8817 ;; We'd like to execute COMMAND interactively so as to give arguments.
8818 (gnus-execute header regexp
8819 `(call-interactively ',(key-binding command
))
8821 (gnus-message 6 "Executing %s...done" (key-description command
))))))
8823 (defun gnus-summary-beginning-of-article ()
8824 "Scroll the article back to the beginning."
8826 (gnus-summary-select-article)
8827 (gnus-configure-windows 'article
)
8828 (gnus-eval-in-buffer-window gnus-article-buffer
8830 (goto-char (point-min))
8831 (when gnus-break-pages
8832 (gnus-narrow-to-page))))
8834 (defun gnus-summary-end-of-article ()
8835 "Scroll to the end of the article."
8837 (gnus-summary-select-article)
8838 (gnus-configure-windows 'article
)
8839 (gnus-eval-in-buffer-window gnus-article-buffer
8841 (goto-char (point-max))
8843 (when gnus-break-pages
8844 (when (re-search-backward page-delimiter nil t
)
8845 (narrow-to-region (match-end 0) (point-max)))
8846 (gnus-narrow-to-page))))
8848 (defun gnus-summary-print-truncate-and-quote (string &optional len
)
8849 "Truncate to LEN and quote all \"(\"'s in STRING."
8850 (gnus-replace-in-string (if (and len
(> (length string
) len
))
8851 (substring string
0 len
)
8855 (defun gnus-summary-print-article (&optional filename n
)
8856 "Generate and print a PostScript image of the process-marked (mail) articles.
8858 If used interactively, print the current article if none are
8859 process-marked. With prefix arg, prompt the user for the name of the
8862 When used from Lisp, accept two optional args FILENAME and N. N means
8863 to print the next N articles. If N is negative, print the N previous
8864 articles. If N is nil and articles have been marked with the process
8865 mark, print these instead.
8867 If the optional first argument FILENAME is nil, send the image to the
8868 printer. If FILENAME is a string, save the PostScript image in a file with
8869 that name. If FILENAME is a number, prompt the user for the name of the file
8871 (interactive (list (ps-print-preprint current-prefix-arg
)))
8872 (dolist (article (gnus-summary-work-articles n
))
8873 (gnus-summary-select-article nil nil
'pseudo article
)
8874 (gnus-eval-in-buffer-window gnus-article-buffer
8875 (gnus-print-buffer))
8876 (gnus-summary-remove-process-mark article
))
8877 (ps-despool filename
))
8879 (defun gnus-print-buffer ()
8880 (let ((buffer (generate-new-buffer " *print*")))
8883 (copy-to-buffer buffer
(point-min) (point-max))
8885 (gnus-remove-text-with-property 'gnus-decoration
)
8886 (when (gnus-visual-p 'article-highlight
'highlight
)
8887 ;; Copy-to-buffer doesn't copy overlay. So redo
8889 (let ((gnus-article-buffer buffer
))
8890 (gnus-article-highlight-citation t
)
8891 (gnus-article-highlight-signature)
8892 (gnus-article-emphasize)
8893 (gnus-article-delete-invisible-text)))
8894 (let ((ps-left-header
8897 (gnus-summary-print-truncate-and-quote
8898 (mail-header-subject gnus-current-headers
)
8901 (gnus-summary-print-truncate-and-quote
8902 (mail-header-from gnus-current-headers
)
8906 "/pagenumberstring load"
8908 (mail-header-date gnus-current-headers
) ")"))))
8909 (gnus-run-hooks 'gnus-ps-print-hook
)
8912 (ps-spool-buffer-with-faces)
8913 (ps-spool-buffer)))))
8914 (kill-buffer buffer
))))
8916 (defun gnus-summary-show-article (&optional arg
)
8917 "Force redisplaying of the current article.
8918 If ARG (the prefix) is a number, show the article with the charset
8919 defined in `gnus-summary-show-article-charset-alist', or the charset
8921 If ARG (the prefix) is non-nil and not a number, show the raw article
8922 without any article massaging functions being run. Normally, the key
8923 strokes are `C-u g'."
8927 (gnus-summary-show-article t
)
8928 (let ((gnus-newsgroup-charset
8929 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
8930 (mm-read-coding-system
8931 "View as charset: " ;; actually it is coding system.
8933 (set-buffer gnus-article-buffer
)
8934 (mm-detect-coding-region (point) (point-max))))))
8935 (gnus-newsgroup-ignored-charsets 'gnus-all
))
8936 (gnus-summary-select-article nil
'force
)
8937 (let ((deps gnus-newsgroup-dependencies
)
8940 (set-buffer gnus-original-article-buffer
)
8942 (message-narrow-to-head)
8943 (setq head
(buffer-string))
8944 (goto-char (point-min))
8945 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t
)
8946 (goto-char (point-max))
8948 (setq lines
(1- (count-lines (point) (point-max))))))
8950 (insert (format "211 %d Article retrieved.\n"
8951 (cdr gnus-article-current
)))
8953 (if lines
(insert (format "Lines: %d\n" lines
)))
8955 (let ((nntp-server-buffer (current-buffer)))
8956 (setq header
(car (gnus-get-newsgroup-headers deps t
))))))
8957 (gnus-data-set-header
8958 (gnus-data-find (cdr gnus-article-current
))
8960 (gnus-summary-update-article-line
8961 (cdr gnus-article-current
) header
)
8962 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
8963 (gnus-summary-update-secondary-mark (cdr gnus-article-current
))))))
8965 ;; Select the article the normal way.
8966 (gnus-summary-select-article nil
'force
))
8968 ;; We have to require this here to make sure that the following
8969 ;; dynamic binding isn't shadowed by autoloading.
8970 (require 'gnus-async
)
8972 ;; Bind the article treatment functions to nil.
8973 (let ((gnus-have-all-headers t
)
8974 gnus-article-prepare-hook
8975 gnus-article-decode-hook
8976 gnus-display-mime-function
8978 ;; Destroy any MIME parts.
8979 (when (gnus-buffer-live-p gnus-article-buffer
)
8981 (set-buffer gnus-article-buffer
)
8982 (mm-destroy-parts gnus-article-mime-handles
)
8983 ;; Set it to nil for safety reason.
8984 (setq gnus-article-mime-handle-alist nil
)
8985 (setq gnus-article-mime-handles nil
)))
8986 (gnus-summary-select-article nil
'force
))))
8987 (gnus-summary-goto-subject gnus-current-article
)
8988 (gnus-summary-position-point))
8990 (defun gnus-summary-show-raw-article ()
8991 "Show the raw article without any article massaging functions being run."
8993 (gnus-summary-show-article t
))
8995 (defun gnus-summary-verbose-headers (&optional arg
)
8996 "Toggle permanent full header display.
8997 If ARG is a positive number, turn header display on.
8998 If ARG is a negative number, turn header display off."
9000 (setq gnus-show-all-headers
9001 (cond ((or (not (numberp arg
))
9003 (not gnus-show-all-headers
))
9006 (gnus-summary-show-article))
9008 (defun gnus-summary-toggle-header (&optional arg
)
9009 "Show the headers if they are hidden, or hide them if they are shown.
9010 If ARG is a positive number, show the entire header.
9011 If ARG is a negative number, hide the unwanted header lines."
9013 (let ((window (and (gnus-buffer-live-p gnus-article-buffer
)
9014 (get-buffer-window gnus-article-buffer t
))))
9015 (with-current-buffer gnus-article-buffer
9017 (article-narrow-to-head)
9018 (let* ((buffer-read-only nil
)
9019 (inhibit-point-motion-hooks t
)
9020 (hidden (if (numberp arg
)
9022 (or (not (looking-at "[^ \t\n]+:"))
9023 (gnus-article-hidden-text-p 'headers
))))
9025 (delete-region (point-min) (point-max))
9026 (with-current-buffer gnus-original-article-buffer
9027 (goto-char (setq s
(point-min)))
9028 (setq e
(if (search-forward "\n\n" nil t
)
9031 (insert-buffer-substring gnus-original-article-buffer s e
)
9032 (run-hooks 'gnus-article-decode-hook
)
9034 (let ((gnus-treat-hide-headers nil
)
9035 (gnus-treat-hide-boring-headers nil
))
9036 (gnus-delete-wash-type 'headers
)
9037 (gnus-treat-article 'head
))
9038 (gnus-treat-article 'head
))
9041 (set-window-start window
(goto-char (point-min))))
9042 (if gnus-break-pages
9043 (gnus-narrow-to-page)
9044 (when (gnus-visual-p 'page-marker
)
9045 (let ((buffer-read-only nil
))
9046 (gnus-remove-text-with-property 'gnus-prev
)
9047 (gnus-remove-text-with-property 'gnus-next
))))
9048 (gnus-set-mode-line 'article
)))))
9050 (defun gnus-summary-show-all-headers ()
9051 "Make all header lines visible."
9053 (gnus-summary-toggle-header 1))
9055 (defun gnus-summary-caesar-message (&optional arg
)
9056 "Caesar rotate the current article by 13.
9057 The numerical prefix specifies how many places to rotate each letter
9060 (gnus-summary-select-article)
9061 (let ((mail-header-separator ""))
9062 (gnus-eval-in-buffer-window gnus-article-buffer
9065 (let ((start (window-start))
9067 (message-caesar-buffer-body arg
)
9068 (set-window-start (get-buffer-window (current-buffer)) start
)))))
9069 ;; Create buttons and stuff...
9070 (gnus-treat-article nil
))
9072 (autoload 'unmorse-region
"morse"
9073 "Convert morse coded text in region to ordinary ASCII text."
9076 (defun gnus-summary-morse-message (&optional arg
)
9077 "Morse decode the current article."
9079 (gnus-summary-select-article)
9080 (let ((mail-header-separator ""))
9081 (gnus-eval-in-buffer-window gnus-article-buffer
9085 (let ((pos (window-start))
9087 (goto-char (point-min))
9088 (when (message-goto-body)
9089 (gnus-narrow-to-body))
9090 (goto-char (point-min))
9091 (while (re-search-forward "·" (point-max) t
)
9092 (replace-match "."))
9093 (unmorse-region (point-min) (point-max))
9095 (set-window-start (get-buffer-window (current-buffer)) pos
)))))))
9097 (defun gnus-summary-stop-page-breaking ()
9098 "Stop page breaking in the current article."
9100 (gnus-summary-select-article)
9101 (gnus-eval-in-buffer-window gnus-article-buffer
9103 (when (gnus-visual-p 'page-marker
)
9104 (let ((buffer-read-only nil
))
9105 (gnus-remove-text-with-property 'gnus-prev
)
9106 (gnus-remove-text-with-property 'gnus-next
))
9107 (setq gnus-page-broken nil
))))
9109 (defun gnus-summary-move-article (&optional n to-newsgroup
9110 select-method action
)
9111 "Move the current article to a different newsgroup.
9112 If N is a positive number, move the N next articles.
9113 If N is a negative number, move the N previous articles.
9114 If N is nil and any articles have been marked with the process mark,
9115 move those articles instead.
9116 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9117 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9118 re-spool using this method.
9120 When called interactively with TO-NEWSGROUP being nil, the value of
9121 the variable `gnus-move-split-methods' is used for finding a default
9122 for the target newsgroup.
9124 For this function to work, both the current newsgroup and the
9125 newsgroup that you want to move to have to support the `request-move'
9126 and `request-accept' functions.
9128 ACTION can be either `move' (the default), `crosspost' or `copy'."
9131 (setq action
'move
))
9132 ;; Check whether the source group supports the required functions.
9133 (cond ((and (eq action
'move
)
9134 (not (gnus-check-backend-function
9135 'request-move-article gnus-newsgroup-name
)))
9136 (error "The current group does not support article moving"))
9137 ((and (eq action
'crosspost
)
9138 (not (gnus-check-backend-function
9139 'request-replace-article gnus-newsgroup-name
)))
9140 (error "The current group does not support article editing")))
9141 (let ((articles (gnus-summary-work-articles n
))
9142 (prefix (if (gnus-check-backend-function
9143 'request-move-article gnus-newsgroup-name
)
9144 (gnus-group-real-prefix gnus-newsgroup-name
)
9146 (names '((move "Move" "Moving")
9147 (copy "Copy" "Copying")
9148 (crosspost "Crosspost" "Crossposting")))
9149 (copy-buf (save-excursion
9150 (nnheader-set-temp-buffer " *copy article*")))
9151 art-group to-method new-xref article to-groups
)
9152 (unless (assq action names
)
9153 (error "Unknown action %s" action
))
9154 ;; Read the newsgroup name.
9155 (when (and (not to-newsgroup
)
9156 (not select-method
))
9157 (if (and gnus-move-split-methods
9159 (and (memq gnus-current-article articles
)
9160 (gnus-buffer-live-p gnus-original-article-buffer
))))
9161 ;; When `gnus-move-split-methods' is non-nil, we have to
9162 ;; select an article to give `gnus-read-move-group-name' an
9163 ;; opportunity to suggest an appropriate default. However,
9164 ;; we needn't render or mark the article.
9165 (let ((gnus-display-mime-function nil
)
9166 (gnus-article-prepare-hook nil
)
9167 (gnus-mark-article-hook nil
))
9168 (gnus-summary-select-article nil nil nil
(car articles
))))
9170 (gnus-read-move-group-name
9171 (cadr (assq action names
))
9172 (symbol-value (intern (format "gnus-current-%s-group" action
)))
9174 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
9175 (setq to-method
(or select-method
9176 (gnus-server-to-method
9177 (gnus-group-method to-newsgroup
))))
9178 ;; Check the method we are to move this article to...
9179 (unless (gnus-check-backend-function
9180 'request-accept-article
(car to-method
))
9181 (error "%s does not support article copying" (car to-method
)))
9182 (unless (gnus-check-server to-method
)
9183 (error "Can't open server %s" (car to-method
)))
9184 (gnus-message 6 "%s to %s: %s..."
9185 (caddr (assq action names
))
9186 (or (car select-method
) to-newsgroup
) articles
)
9188 (setq article
(pop articles
))
9192 ;; Move the article.
9194 ;; Remove this article from future suppression.
9195 (gnus-dup-unsuppress-article article
)
9196 (gnus-request-move-article
9197 article
; Article to move
9198 gnus-newsgroup-name
; From newsgroup
9199 (nth 1 (gnus-find-method-for-group
9200 gnus-newsgroup-name
)) ; Server
9201 (list 'gnus-request-accept-article
9202 to-newsgroup
(list 'quote select-method
)
9203 (not articles
) t
) ; Accept form
9204 (not articles
))) ; Only save nov last time
9205 ;; Copy the article.
9208 (set-buffer copy-buf
)
9209 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9210 (gnus-request-accept-article
9211 to-newsgroup select-method
(not articles
) t
))))
9212 ;; Crosspost the article.
9213 ((eq action
'crosspost
)
9214 (let ((xref (message-tokenize-header
9215 (mail-header-xref (gnus-summary-article-header article
))
9217 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
9218 ":" (number-to-string article
)))
9220 (setq xref
(list (system-name))))
9223 (mapconcat 'identity
9224 (delete "Xref:" (delete new-xref xref
))
9228 (set-buffer copy-buf
)
9229 ;; First put the article in the destination group.
9230 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9231 (when (consp (setq art-group
9232 (gnus-request-accept-article
9233 to-newsgroup select-method
(not articles
) t
)))
9234 (setq new-xref
(concat new-xref
" " (car art-group
)
9236 (number-to-string (cdr art-group
))))
9237 ;; Now we have the new Xrefs header, so we insert
9238 ;; it and replace the new article.
9239 (nnheader-replace-header "Xref" new-xref
)
9240 (gnus-request-replace-article
9241 (cdr art-group
) to-newsgroup
(current-buffer) t
)
9245 (gnus-message 1 "Couldn't %s article %s: %s"
9246 (cadr (assq action names
)) article
9247 (nnheader-get-report (car to-method
))))
9248 ((eq art-group
'junk
)
9249 (when (eq action
'move
)
9250 (gnus-summary-mark-article article gnus-canceled-mark
)
9251 (gnus-message 4 "Deleted article %s" article
)
9252 ;; run the delete hook
9253 (run-hook-with-args 'gnus-summary-article-delete-hook
9256 (assoc article
(gnus-data-list nil
)))
9257 gnus-newsgroup-name nil
9260 (let* ((pto-group (gnus-group-prefixed-name
9261 (car art-group
) to-method
))
9263 (gnus-gethash pto-group gnus-newsrc-hashtb
))
9264 (info (nth 2 entry
))
9265 (to-group (gnus-info-group info
))
9267 ;; Update the group that has been moved to.
9269 (memq action
'(move copy
)))
9270 (unless (member to-group to-groups
)
9271 (push to-group to-groups
))
9273 (unless (memq article gnus-newsgroup-unreads
)
9274 (push 'read to-marks
)
9276 info
(gnus-add-to-range (gnus-info-read info
)
9277 (list (cdr art-group
)))))
9279 ;; See whether the article is to be put in the cache.
9280 (let ((marks (if (gnus-group-auto-expirable-p to-group
)
9281 gnus-article-mark-lists
9282 (delete '(expirable . expire
)
9283 (copy-sequence gnus-article-mark-lists
))))
9284 (to-article (cdr art-group
)))
9286 ;; Enter the article into the cache in the new group,
9287 ;; if that is required.
9288 (when gnus-use-cache
9289 (gnus-cache-possibly-enter-article
9291 (memq article gnus-newsgroup-marked
)
9292 (memq article gnus-newsgroup-dormant
)
9293 (memq article gnus-newsgroup-unreads
)))
9295 (when gnus-preserve-marks
9296 ;; Copy any marks over to the new group.
9297 (when (and (equal to-group gnus-newsgroup-name
)
9298 (not (memq article gnus-newsgroup-unreads
)))
9299 ;; Mark this article as read in this group.
9300 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
9301 (setcdr (gnus-active to-group
) to-article
)
9302 (setcdr gnus-newsgroup-active to-article
))
9305 (when (eq (gnus-article-mark-to-type (cdar marks
)) 'list
)
9306 (when (memq article
(symbol-value
9307 (intern (format "gnus-newsgroup-%s"
9309 (push (cdar marks
) to-marks
)
9310 ;; If the other group is the same as this group,
9311 ;; then we have to add the mark to the list.
9312 (when (equal to-group gnus-newsgroup-name
)
9313 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
9316 (intern (format "gnus-newsgroup-%s"
9318 ;; Copy the marks to other group.
9319 (gnus-add-marked-articles
9320 to-group
(cdar marks
) (list to-article
) info
)))
9321 (setq marks
(cdr marks
)))
9323 (gnus-request-set-mark
9324 to-group
(list (list (list to-article
) 'add to-marks
))))
9327 (concat "(gnus-group-set-info '"
9328 (gnus-prin1-to-string (gnus-get-info to-group
))
9331 ;; Update the Xref header in this article to point to
9332 ;; the new crossposted article we have just created.
9333 (when (eq action
'crosspost
)
9335 (set-buffer copy-buf
)
9336 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9337 (nnheader-replace-header "Xref" new-xref
)
9338 (gnus-request-replace-article
9339 article gnus-newsgroup-name
(current-buffer) t
)))
9341 ;; run the move/copy/crosspost/respool hook
9342 (run-hook-with-args 'gnus-summary-article-move-hook
9345 (assoc article
(gnus-data-list nil
)))
9350 ;;;!!!Why is this necessary?
9351 (set-buffer gnus-summary-buffer
)
9353 (gnus-summary-goto-subject article
)
9354 (when (eq action
'move
)
9355 (gnus-summary-mark-article article gnus-canceled-mark
))))
9356 (gnus-summary-remove-process-mark article
))
9357 ;; Re-activate all groups that have been moved to.
9359 (set-buffer gnus-group-buffer
)
9360 (let ((gnus-group-marked to-groups
))
9361 (gnus-group-get-new-news-this-group nil t
)))
9363 (gnus-kill-buffer copy-buf
)
9364 (gnus-summary-position-point)
9365 (gnus-set-mode-line 'summary
)))
9367 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
9368 "Copy the current article to some other group.
9369 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9370 When called interactively, if TO-NEWSGROUP is nil, use the value of
9371 the variable `gnus-move-split-methods' for finding a default target
9373 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9374 re-spool using this method."
9376 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
9378 (defun gnus-summary-crosspost-article (&optional n
)
9379 "Crosspost the current article to some other group."
9381 (gnus-summary-move-article n nil nil
'crosspost
))
9383 (defcustom gnus-summary-respool-default-method nil
9384 "Default method type for respooling an article.
9385 If nil, use to the current newsgroup method."
9387 :group
'gnus-summary-mail
)
9389 (defcustom gnus-summary-display-while-building nil
9390 "If non-nil, show and update the summary buffer as it's being built.
9391 If the value is t, update the buffer after every line is inserted. If
9392 the value is an integer (N), update the display every N lines."
9395 :type
'(choice (const :tag
"off" nil
)
9397 (const :tag
"frequently" t
)))
9399 (defun gnus-summary-respool-article (&optional n method
)
9400 "Respool the current article.
9401 The article will be squeezed through the mail spooling process again,
9402 which means that it will be put in some mail newsgroup or other
9403 depending on `nnmail-split-methods'.
9404 If N is a positive number, respool the N next articles.
9405 If N is a negative number, respool the N previous articles.
9406 If N is nil and any articles have been marked with the process mark,
9407 respool those articles instead.
9409 Respooling can be done both from mail groups and \"real\" newsgroups.
9410 In the former case, the articles in question will be moved from the
9411 current group into whatever groups they are destined to. In the
9412 latter case, they will be copied into the relevant groups."
9414 (list current-prefix-arg
9415 (let* ((methods (gnus-methods-using 'respool
))
9417 (symbol-name (or gnus-summary-respool-default-method
9418 (car (gnus-find-method-for-group
9419 gnus-newsgroup-name
)))))
9421 (gnus-completing-read-with-default
9422 methname
"Backend to use when respooling"
9423 methods nil t nil
'gnus-mail-method-history
))
9426 ((zerop (length (setq ms
(gnus-servers-using-backend
9428 (list (intern method
) ""))
9432 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
9433 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
9436 (error "No method given for respooling"))
9437 (if (assoc (symbol-name
9438 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
9439 (gnus-methods-using 'respool
))
9440 (gnus-summary-move-article n nil method
)
9441 (gnus-summary-copy-article n nil method
)))
9443 (defun gnus-summary-import-article (file &optional edit
)
9444 "Import an arbitrary file into a mail newsgroup."
9445 (interactive "fImport file: \nP")
9446 (let ((group gnus-newsgroup-name
)
9447 (now (current-time))
9448 atts lines group-art
)
9449 (unless (gnus-check-backend-function 'request-accept-article group
)
9450 (error "%s does not support article importing" group
))
9451 (or (file-readable-p file
)
9452 (not (file-regular-p file
))
9453 (error "Can't read %s" file
))
9455 (set-buffer (gnus-get-buffer-create " *import file*"))
9457 (nnheader-insert-file-contents file
)
9458 (goto-char (point-min))
9459 (if (nnheader-article-p)
9461 (goto-char (point-min))
9462 (search-forward "\n\n" nil t
)
9463 (narrow-to-region (point-min) (1- (point)))
9464 (goto-char (point-min))
9465 (unless (re-search-forward "^date:" nil t
)
9466 (goto-char (point-max))
9467 (insert "Date: " (message-make-date (nth 5 atts
)) "\n")))
9468 ;; This doesn't look like an article, so we fudge some headers.
9469 (setq atts
(file-attributes file
)
9470 lines
(count-lines (point-min) (point-max)))
9471 (insert "From: " (read-string "From: ") "\n"
9472 "Subject: " (read-string "Subject: ") "\n"
9473 "Date: " (message-make-date (nth 5 atts
)) "\n"
9474 "Message-ID: " (message-make-message-id) "\n"
9475 "Lines: " (int-to-string lines
) "\n"
9476 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9477 (setq group-art
(gnus-request-accept-article group nil t
))
9478 (kill-buffer (current-buffer)))
9479 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9481 (gnus-summary-goto-article (cdr group-art
) nil t
)
9483 (gnus-summary-edit-article))))
9485 (defun gnus-summary-create-article ()
9486 "Create an article in a mail newsgroup."
9488 (let ((group gnus-newsgroup-name
)
9489 (now (current-time))
9491 (unless (gnus-check-backend-function 'request-accept-article group
)
9492 (error "%s does not support article importing" group
))
9494 (set-buffer (gnus-get-buffer-create " *import file*"))
9496 (goto-char (point-min))
9497 ;; This doesn't look like an article, so we fudge some headers.
9498 (insert "From: " (read-string "From: ") "\n"
9499 "Subject: " (read-string "Subject: ") "\n"
9500 "Date: " (message-make-date now
) "\n"
9501 "Message-ID: " (message-make-message-id) "\n")
9502 (setq group-art
(gnus-request-accept-article group nil t
))
9503 (kill-buffer (current-buffer)))
9504 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9506 (gnus-summary-goto-article (cdr group-art
) nil t
)
9507 (gnus-summary-edit-article)))
9509 (defun gnus-summary-article-posted-p ()
9510 "Say whether the current (mail) article is available from news as well.
9511 This will be the case if the article has both been mailed and posted."
9513 (let ((id (mail-header-references (gnus-summary-article-header)))
9514 (gnus-override-method (car (gnus-refer-article-methods))))
9515 (if (gnus-request-head id
"")
9516 (gnus-message 2 "The current message was found on %s"
9517 gnus-override-method
)
9518 (gnus-message 2 "The current message couldn't be found on %s"
9519 gnus-override-method
)
9522 (defun gnus-summary-expire-articles (&optional now
)
9523 "Expire all articles that are marked as expirable in the current group."
9525 (when (and (not gnus-group-is-exiting-without-update-p
)
9526 (gnus-check-backend-function
9527 'request-expire-articles gnus-newsgroup-name
))
9528 ;; This backend supports expiry.
9529 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
9530 (expirable (if total
9532 ;; We need to update the info for
9533 ;; this group for `gnus-list-of-read-articles'
9534 ;; to give us the right answer.
9535 (gnus-run-hooks 'gnus-exit-group-hook
)
9536 (gnus-summary-update-info)
9537 (gnus-list-of-read-articles gnus-newsgroup-name
))
9538 (setq gnus-newsgroup-expirable
9539 (sort gnus-newsgroup-expirable
'<))))
9540 (expiry-wait (if now
'immediate
9541 (gnus-group-find-parameter
9542 gnus-newsgroup-name
'expiry-wait
)))
9543 (nnmail-expiry-target
9544 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
9545 nnmail-expiry-target
))
9548 ;; There are expirable articles in this group, so we run them
9549 ;; through the expiry process.
9550 (gnus-message 6 "Expiring articles...")
9551 (unless (gnus-check-group gnus-newsgroup-name
)
9552 (error "Can't open server for %s" gnus-newsgroup-name
))
9553 ;; The list of articles that weren't expired is returned.
9556 (let ((nnmail-expiry-wait-function nil
)
9557 (nnmail-expiry-wait expiry-wait
))
9558 (setq es
(gnus-request-expire-articles
9559 expirable gnus-newsgroup-name
)))
9560 (setq es
(gnus-request-expire-articles
9561 expirable gnus-newsgroup-name
)))
9563 (setq gnus-newsgroup-expirable es
))
9564 ;; We go through the old list of expirable, and mark all
9565 ;; really expired articles as nonexistent.
9566 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
9567 (let ((gnus-use-cache nil
))
9568 (dolist (article expirable
)
9569 (when (and (not (memq article es
))
9570 (gnus-data-find article
))
9571 (gnus-summary-mark-article article gnus-canceled-mark
)
9572 (run-hook-with-args 'gnus-summary-article-expire-hook
9575 (assoc article
(gnus-data-list nil
)))
9579 (gnus-message 6 "Expiring articles...done")))))
9581 (defun gnus-summary-expire-articles-now ()
9582 "Expunge all expirable articles in the current group.
9583 This means that *all* articles that are marked as expirable will be
9584 deleted forever, right now."
9586 (or gnus-expert-user
9588 "Are you really, really sure you want to delete all expirable messages? ")
9590 (gnus-summary-expire-articles t
))
9592 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9593 (defun gnus-summary-delete-article (&optional n
)
9594 "Delete the N next (mail) articles.
9595 This command actually deletes articles. This is not a marking
9596 command. The article will disappear forever from your life, never to
9599 If N is negative, delete backwards.
9600 If N is nil and articles have been marked with the process mark,
9601 delete these instead.
9603 If `gnus-novice-user' is non-nil you will be asked for
9604 confirmation before the articles are deleted."
9606 (unless (gnus-check-backend-function 'request-expire-articles
9607 gnus-newsgroup-name
)
9608 (error "The current newsgroup does not support article deletion"))
9609 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
9610 (error "Couldn't open server"))
9611 ;; Compute the list of articles to delete.
9612 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
9613 (nnmail-expiry-target 'delete
)
9615 (if (and gnus-novice-user
9616 (not (gnus-yes-or-no-p
9617 (format "Do you really want to delete %s forever? "
9618 (if (> (length articles
) 1)
9619 (format "these %s articles" (length articles
))
9622 ;; Delete the articles.
9623 (setq not-deleted
(gnus-request-expire-articles
9624 articles gnus-newsgroup-name
'force
))
9626 (gnus-summary-remove-process-mark (car articles
))
9627 ;; The backend might not have been able to delete the article
9629 (unless (memq (car articles
) not-deleted
)
9630 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
9631 (let* ((article (car articles
))
9632 (id (mail-header-id (gnus-data-header
9633 (assoc article
(gnus-data-list nil
))))))
9634 (run-hook-with-args 'gnus-summary-article-delete-hook
9635 'delete id gnus-newsgroup-name nil
9637 (setq articles
(cdr articles
)))
9639 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
9640 (gnus-summary-position-point)
9641 (gnus-set-mode-line 'summary
)
9644 (defun gnus-summary-edit-article (&optional arg
)
9645 "Edit the current article.
9646 This will have permanent effect only in mail groups.
9647 If ARG is nil, edit the decoded articles.
9648 If ARG is 1, edit the raw articles.
9649 If ARG is 2, edit the raw articles even in read-only groups.
9650 If ARG is 3, edit the articles with the current handles.
9651 Otherwise, allow editing of articles even in read-only
9654 (let (force raw current-handles
)
9663 (setq current-handles
9664 (and (gnus-buffer-live-p gnus-article-buffer
)
9665 (with-current-buffer gnus-article-buffer
9667 gnus-article-mime-handles
9668 (setq gnus-article-mime-handles nil
))))))
9671 (when (and raw
(not force
)
9672 (member gnus-newsgroup-name
'("nndraft:delayed"
9675 (error "Can't edit the raw article in group %s"
9676 gnus-newsgroup-name
))
9678 (set-buffer gnus-summary-buffer
)
9679 (let ((mail-parse-charset gnus-newsgroup-charset
)
9680 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
9681 (gnus-set-global-variables)
9682 (when (and (not force
)
9683 (gnus-group-read-only-p))
9684 (error "The current newsgroup does not support article editing"))
9685 (gnus-summary-show-article t
)
9686 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
9687 (with-current-buffer gnus-article-buffer
9688 (mm-enable-multibyte)))
9689 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
9691 (gnus-article-edit-article
9694 (let ((mbl mml-buffer-list
))
9695 (setq mml-buffer-list nil
)
9696 (let ((rfc2047-quote-decoded-words-containing-tspecials t
))
9697 (mime-to-mml ,'current-handles
))
9698 (let ((mbl1 mml-buffer-list
))
9699 (setq mml-buffer-list mbl
)
9700 (set (make-local-variable 'mml-buffer-list
) mbl1
))
9701 (gnus-make-local-hook 'kill-buffer-hook
)
9702 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
9703 `(lambda (no-highlight)
9704 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
9705 (message-options message-options
)
9706 (message-options-set-recipient)
9707 (mail-parse-ignored-charsets
9708 ',gnus-newsgroup-ignored-charsets
))
9709 ,(if (not raw
) '(progn
9711 (mml-destroy-buffers)
9712 (remove-hook 'kill-buffer-hook
9713 'mml-destroy-buffers t
)
9714 (kill-local-variable 'mml-buffer-list
)))
9715 (gnus-summary-edit-article-done
9716 ,(or (mail-header-references gnus-current-headers
) "")
9717 ,(gnus-group-read-only-p)
9718 ,gnus-summary-buffer no-highlight
))))))))
9720 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
9722 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9724 "Make edits to the current article permanent."
9727 ;; The buffer restriction contains the entire article if it exists.
9728 (when (article-goto-body)
9729 (let ((lines (count-lines (point) (point-max)))
9730 (length (- (point-max) (point)))
9731 (case-fold-search t
)
9732 (body (copy-marker (point))))
9733 (goto-char (point-min))
9734 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t
)
9735 (delete-region (match-beginning 1) (match-end 1))
9736 (insert (number-to-string length
)))
9737 (goto-char (point-min))
9738 (when (re-search-forward
9739 "^x-content-length:[ \t]\\([0-9]+\\)" body t
)
9740 (delete-region (match-beginning 1) (match-end 1))
9741 (insert (number-to-string length
)))
9742 (goto-char (point-min))
9743 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t
)
9744 (delete-region (match-beginning 1) (match-end 1))
9745 (insert (number-to-string lines
))))))
9746 ;; Replace the article.
9747 (let ((buf (current-buffer)))
9749 (insert-buffer-substring buf
)
9751 (if (and (not read-only
)
9752 (not (gnus-request-replace-article
9753 (cdr gnus-article-current
) (car gnus-article-current
)
9754 (current-buffer) t
)))
9755 (error "Couldn't replace article")
9756 ;; Update the summary buffer.
9758 (equal (message-tokenize-header references
" ")
9759 (message-tokenize-header
9760 (or (message-fetch-field "references") "") " ")))
9761 ;; We only have to update this line.
9764 (message-narrow-to-head)
9765 (let ((head (buffer-substring-no-properties
9766 (point-min) (point-max)))
9769 (insert (format "211 %d Article retrieved.\n"
9770 (cdr gnus-article-current
)))
9773 (let ((nntp-server-buffer (current-buffer)))
9774 (setq header
(car (gnus-get-newsgroup-headers
9777 (set-buffer gnus-summary-buffer
)
9778 (gnus-data-set-header
9779 (gnus-data-find (cdr gnus-article-current
))
9781 (gnus-summary-update-article-line
9782 (cdr gnus-article-current
) header
)
9783 (if (gnus-summary-goto-subject
9784 (cdr gnus-article-current
) nil t
)
9785 (gnus-summary-update-secondary-mark
9786 (cdr gnus-article-current
))))))))
9788 (set-buffer (or buffer gnus-summary-buffer
))
9789 (gnus-summary-update-article (cdr gnus-article-current
))
9790 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
9791 (gnus-summary-update-secondary-mark
9792 (cdr gnus-article-current
))))
9793 ;; Prettify the article buffer again.
9794 (unless no-highlight
9796 (set-buffer gnus-article-buffer
)
9797 ;;;!!! Fix this -- article should be rehighlighted.
9798 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9799 (set-buffer gnus-original-article-buffer
)
9800 (gnus-request-article
9801 (cdr gnus-article-current
)
9802 (car gnus-article-current
) (current-buffer))))
9803 ;; Prettify the summary buffer line.
9804 (when (gnus-visual-p 'summary-highlight
'highlight
)
9805 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
9807 (defun gnus-summary-edit-wash (key)
9808 "Perform editing command KEY in the article buffer."
9812 (message "%s" (concat (this-command-keys) "- "))
9815 (gnus-summary-edit-article)
9816 (execute-kbd-macro (concat (this-command-keys) key
))
9817 (gnus-article-edit-done))
9821 (defun gnus-summary-respool-query (&optional silent trace
)
9822 "Query where the respool algorithm would put this article."
9824 (let (gnus-mark-article-hook)
9825 (gnus-summary-select-article)
9827 (set-buffer gnus-original-article-buffer
)
9828 (let ((groups (nnmail-article-group 'identity trace
)))
9831 (message "This message would go to %s"
9832 (mapconcat 'car groups
", "))
9833 (message "This message would go to no groups"))
9836 (defun gnus-summary-respool-trace ()
9837 "Trace where the respool algorithm would put this article.
9838 Display a buffer showing all fancy splitting patterns which matched."
9840 (gnus-summary-respool-query nil t
))
9842 ;; Summary marking commands.
9844 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
9845 "Mark articles which has the same subject as read, and then select the next.
9846 If UNMARK is positive, remove any kind of mark.
9847 If UNMARK is negative, tick articles."
9850 (setq unmark
(prefix-numeric-value unmark
)))
9852 (gnus-summary-mark-same-subject
9853 (gnus-summary-article-subject) unmark
)))
9854 ;; Select next unread article. If auto-select-same mode, should
9855 ;; select the first unread article.
9856 (gnus-summary-next-article t
(and gnus-auto-select-same
9857 (gnus-summary-article-subject)))
9858 (gnus-message 7 "%d article%s marked as %s"
9859 count
(if (= count
1) " is" "s are")
9860 (if unmark
"unread" "read"))))
9862 (defun gnus-summary-kill-same-subject (&optional unmark
)
9863 "Mark articles which has the same subject as read.
9864 If UNMARK is positive, remove any kind of mark.
9865 If UNMARK is negative, tick articles."
9868 (setq unmark
(prefix-numeric-value unmark
)))
9870 (gnus-summary-mark-same-subject
9871 (gnus-summary-article-subject) unmark
)))
9872 ;; If marked as read, go to next unread subject.
9874 ;; Go to next unread subject.
9875 (gnus-summary-next-subject 1 t
))
9876 (gnus-message 7 "%d articles are marked as %s"
9877 count
(if unmark
"unread" "read"))))
9879 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
9880 "Mark articles with same SUBJECT as read, and return marked number.
9881 If optional argument UNMARK is positive, remove any kinds of marks.
9882 If optional argument UNMARK is negative, mark articles as unread instead."
9886 ((null unmark
) ; Mark as read.
9889 (gnus-summary-mark-article-as-read gnus-killed-mark
)
9890 (gnus-summary-show-thread) t
)
9891 (gnus-summary-find-subject subject
))
9892 (setq count
(1+ count
))))
9893 ((> unmark
0) ; Tick.
9896 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
9897 (gnus-summary-show-thread) t
)
9898 (gnus-summary-find-subject subject
))
9899 (setq count
(1+ count
))))
9900 (t ; Mark as unread.
9903 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
9904 (gnus-summary-show-thread) t
)
9905 (gnus-summary-find-subject subject
))
9906 (setq count
(1+ count
)))))
9907 (gnus-set-mode-line 'summary
)
9908 ;; Return the number of marked articles.
9911 (defun gnus-summary-mark-as-processable (n &optional unmark
)
9912 "Set the process mark on the next N articles.
9913 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9914 the process mark instead. The difference between N and the actual
9915 number of articles marked is returned."
9917 (if (and (null n
) (gnus-region-active-p))
9918 (gnus-uu-mark-region (region-beginning) (region-end) unmark
)
9919 (setq n
(prefix-numeric-value n
))
9920 (let ((backward (< n
0))
9925 (gnus-summary-remove-process-mark
9926 (gnus-summary-article-number))
9927 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9928 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
9931 (gnus-message 7 "No more articles"))
9932 (gnus-summary-recenter)
9933 (gnus-summary-position-point)
9936 (defun gnus-summary-unmark-as-processable (n)
9937 "Remove the process mark from the next N articles.
9938 If N is negative, unmark backward instead. The difference between N and
9939 the actual number of articles unmarked is returned."
9941 (gnus-summary-mark-as-processable n t
))
9943 (defun gnus-summary-unmark-all-processable ()
9944 "Remove the process mark from all articles."
9947 (while gnus-newsgroup-processable
9948 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
9949 (gnus-summary-position-point))
9951 (defun gnus-summary-add-mark (article type
)
9952 "Mark ARTICLE with a mark of TYPE."
9953 (let ((vtype (car (assq type gnus-article-mark-lists
)))
9956 (error "No such mark type: %s" type
)
9957 (setq var
(intern (format "gnus-newsgroup-%s" type
)))
9958 (set var
(cons article
(symbol-value var
)))
9959 (if (memq type
'(processable cached replied forwarded recent saved
))
9960 (gnus-summary-update-secondary-mark article
)
9961 ;;; !!! This is bogus. We should find out what primary
9962 ;;; !!! mark we want to set.
9963 (gnus-summary-update-mark gnus-del-mark
'unread
)))))
9965 (defun gnus-summary-mark-as-expirable (n)
9966 "Mark N articles forward as expirable.
9967 If N is negative, mark backward instead. The difference between N and
9968 the actual number of articles marked is returned."
9970 (gnus-summary-mark-forward n gnus-expirable-mark
))
9972 (defun gnus-summary-mark-as-spam (n)
9973 "Mark N articles forward as spam.
9974 If N is negative, mark backward instead. The difference between N and
9975 the actual number of articles marked is returned."
9977 (gnus-summary-mark-forward n gnus-spam-mark
))
9979 (defun gnus-summary-mark-article-as-replied (article)
9980 "Mark ARTICLE as replied to and update the summary line.
9981 ARTICLE can also be a list of articles."
9982 (interactive (list (gnus-summary-article-number)))
9983 (let ((articles (if (listp article
) article
(list article
))))
9984 (dolist (article articles
)
9985 (unless (numberp article
)
9986 (error "%s is not a number" article
))
9987 (push article gnus-newsgroup-replied
)
9988 (let ((buffer-read-only nil
))
9989 (when (gnus-summary-goto-subject article nil t
)
9990 (gnus-summary-update-secondary-mark article
))))))
9992 (defun gnus-summary-mark-article-as-forwarded (article)
9993 "Mark ARTICLE as forwarded and update the summary line.
9994 ARTICLE can also be a list of articles."
9995 (let ((articles (if (listp article
) article
(list article
))))
9996 (dolist (article articles
)
9997 (push article gnus-newsgroup-forwarded
)
9998 (let ((buffer-read-only nil
))
9999 (when (gnus-summary-goto-subject article nil t
)
10000 (gnus-summary-update-secondary-mark article
))))))
10002 (defun gnus-summary-set-bookmark (article)
10003 "Set a bookmark in current article."
10004 (interactive (list (gnus-summary-article-number)))
10005 (when (or (not (get-buffer gnus-article-buffer
))
10006 (not gnus-current-article
)
10007 (not gnus-article-current
)
10008 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
10009 (error "No current article selected"))
10010 ;; Remove old bookmark, if one exists.
10011 (gnus-pull article gnus-newsgroup-bookmarks
)
10012 ;; Set the new bookmark, which is on the form
10013 ;; (article-number . line-number-in-body).
10017 (set-buffer gnus-article-buffer
)
10021 (article-goto-body)
10024 gnus-newsgroup-bookmarks
)
10025 (gnus-message 6 "A bookmark has been added to the current article."))
10027 (defun gnus-summary-remove-bookmark (article)
10028 "Remove the bookmark from the current article."
10029 (interactive (list (gnus-summary-article-number)))
10030 ;; Remove old bookmark, if one exists.
10031 (if (not (assq article gnus-newsgroup-bookmarks
))
10032 (gnus-message 6 "No bookmark in current article.")
10033 (gnus-pull article gnus-newsgroup-bookmarks
)
10034 (gnus-message 6 "Removed bookmark.")))
10036 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10037 (defun gnus-summary-mark-as-dormant (n)
10038 "Mark N articles forward as dormant.
10039 If N is negative, mark backward instead. The difference between N and
10040 the actual number of articles marked is returned."
10042 (gnus-summary-mark-forward n gnus-dormant-mark
))
10044 (defun gnus-summary-set-process-mark (article)
10045 "Set the process mark on ARTICLE and update the summary line."
10046 (setq gnus-newsgroup-processable
10048 (delq article gnus-newsgroup-processable
)))
10049 (when (gnus-summary-goto-subject article
)
10050 (gnus-summary-show-thread)
10051 (gnus-summary-goto-subject article
)
10052 (gnus-summary-update-secondary-mark article
)))
10054 (defun gnus-summary-remove-process-mark (article)
10055 "Remove the process mark from ARTICLE and update the summary line."
10056 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
10057 (when (gnus-summary-goto-subject article
)
10058 (gnus-summary-show-thread)
10059 (gnus-summary-goto-subject article
)
10060 (gnus-summary-update-secondary-mark article
)))
10062 (defun gnus-summary-set-saved-mark (article)
10063 "Set the process mark on ARTICLE and update the summary line."
10064 (push article gnus-newsgroup-saved
)
10065 (when (gnus-summary-goto-subject article
)
10066 (gnus-summary-update-secondary-mark article
)))
10068 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
10069 "Mark N articles as read forwards.
10070 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10071 The difference between N and the actual number of articles marked is
10073 If NO-EXPIRE, auto-expiry will be inhibited."
10075 (gnus-summary-show-thread)
10076 (let ((backward (< n
0))
10077 (gnus-summary-goto-unread
10078 (and gnus-summary-goto-unread
10079 (not (eq gnus-summary-goto-unread
'never
))
10080 (not (memq mark
(list gnus-unread-mark gnus-spam-mark
10081 gnus-ticked-mark gnus-dormant-mark
)))))
10083 (mark (or mark gnus-del-mark
)))
10084 (while (and (> n
0)
10085 (gnus-summary-mark-article nil mark no-expire
)
10086 (zerop (gnus-summary-next-subject
10088 (and gnus-summary-goto-unread
10089 (not (eq gnus-summary-goto-unread
'never
)))
10093 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
10094 (gnus-summary-recenter)
10095 (gnus-summary-position-point)
10096 (gnus-set-mode-line 'summary
)
10099 (defun gnus-summary-mark-article-as-read (mark)
10100 "Mark the current article quickly as read with MARK."
10101 (let ((article (gnus-summary-article-number)))
10102 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10103 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10104 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10105 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10106 (push (cons article mark
) gnus-newsgroup-reads
)
10107 ;; Possibly remove from cache, if that is used.
10108 (when gnus-use-cache
10109 (gnus-cache-enter-remove-article article
))
10110 ;; Allow the backend to change the mark.
10111 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10112 ;; Check for auto-expiry.
10113 (when (and gnus-newsgroup-auto-expire
10114 (memq mark gnus-auto-expirable-marks
))
10115 (setq mark gnus-expirable-mark
)
10116 ;; Let the backend know about the mark change.
10117 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10118 (push article gnus-newsgroup-expirable
))
10119 ;; Set the mark in the buffer.
10120 (gnus-summary-update-mark mark
'unread
)
10123 (defun gnus-summary-mark-article-as-unread (mark)
10124 "Mark the current article quickly as unread with MARK."
10125 (let* ((article (gnus-summary-article-number))
10126 (old-mark (gnus-summary-article-mark article
)))
10127 ;; Allow the backend to change the mark.
10128 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10129 (if (eq mark old-mark
)
10133 (gnus-error 1 "Can't mark negative article numbers")
10135 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10136 (setq gnus-newsgroup-spam-marked
10137 (delq article gnus-newsgroup-spam-marked
))
10138 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10139 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
10140 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
10141 (cond ((= mark gnus-ticked-mark
)
10142 (setq gnus-newsgroup-marked
10143 (gnus-add-to-sorted-list gnus-newsgroup-marked
10145 ((= mark gnus-spam-mark
)
10146 (setq gnus-newsgroup-spam-marked
10147 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10149 ((= mark gnus-dormant-mark
)
10150 (setq gnus-newsgroup-dormant
10151 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10154 (setq gnus-newsgroup-unreads
10155 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10157 (gnus-pull article gnus-newsgroup-reads
)
10159 ;; See whether the article is to be put in the cache.
10160 (and gnus-use-cache
10161 (vectorp (gnus-summary-article-header article
))
10163 (gnus-cache-possibly-enter-article
10164 gnus-newsgroup-name article
10165 (= mark gnus-ticked-mark
)
10166 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10169 (gnus-summary-update-mark mark
'unread
)
10172 (defun gnus-summary-mark-article (&optional article mark no-expire
)
10173 "Mark ARTICLE with MARK. MARK can be any character.
10174 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10175 `??' (dormant) and `?E' (expirable).
10176 If MARK is nil, then the default character `?r' is used.
10177 If ARTICLE is nil, then the article on the current line will be
10179 If NO-EXPIRE, auto-expiry will be inhibited."
10180 ;; The mark might be a string.
10181 (when (stringp mark
)
10182 (setq mark
(aref mark
0)))
10183 ;; If no mark is given, then we check auto-expiring.
10185 (setq mark gnus-del-mark
))
10186 (when (and (not no-expire
)
10187 gnus-newsgroup-auto-expire
10188 (memq mark gnus-auto-expirable-marks
))
10189 (setq mark gnus-expirable-mark
))
10190 (let ((article (or article
(gnus-summary-article-number)))
10191 (old-mark (gnus-summary-article-mark article
)))
10192 ;; Allow the backend to change the mark.
10193 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
10194 (if (eq mark old-mark
)
10197 (error "No article on current line"))
10198 (if (not (if (or (= mark gnus-unread-mark
)
10199 (= mark gnus-ticked-mark
)
10200 (= mark gnus-spam-mark
)
10201 (= mark gnus-dormant-mark
))
10202 (gnus-mark-article-as-unread article mark
)
10203 (gnus-mark-article-as-read article mark
)))
10205 ;; See whether the article is to be put in the cache.
10206 (and gnus-use-cache
10207 (not (= mark gnus-canceled-mark
))
10208 (vectorp (gnus-summary-article-header article
))
10210 (gnus-cache-possibly-enter-article
10211 gnus-newsgroup-name article
10212 (= mark gnus-ticked-mark
)
10213 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
10215 (when (gnus-summary-goto-subject article nil t
)
10216 (let ((buffer-read-only nil
))
10217 (gnus-summary-show-thread)
10219 (gnus-summary-update-mark mark
'unread
)
10222 (defun gnus-summary-update-secondary-mark (article)
10223 "Update the secondary (read, process, cache) mark."
10224 (gnus-summary-update-mark
10225 (cond ((memq article gnus-newsgroup-processable
)
10227 ((memq article gnus-newsgroup-cached
)
10229 ((memq article gnus-newsgroup-replied
)
10231 ((memq article gnus-newsgroup-forwarded
)
10232 gnus-forwarded-mark
)
10233 ((memq article gnus-newsgroup-saved
)
10235 ((memq article gnus-newsgroup-recent
)
10237 ((memq article gnus-newsgroup-unseen
)
10241 (when (gnus-visual-p 'summary-highlight
'highlight
)
10242 (gnus-run-hooks 'gnus-summary-update-hook
))
10245 (defun gnus-summary-update-download-mark (article)
10246 "Update the download mark."
10247 (gnus-summary-update-mark
10248 (cond ((memq article gnus-newsgroup-undownloaded
)
10249 gnus-undownloaded-mark
)
10250 (gnus-newsgroup-agentized
10251 gnus-downloaded-mark
)
10255 (gnus-summary-update-line t
)
10258 (defun gnus-summary-update-mark (mark type
)
10259 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
10260 (buffer-read-only nil
))
10261 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
10263 (when (looking-at "\r")
10265 (when (<= (+ forward
(point)) (point-max))
10266 ;; Go to the right position on the line.
10267 (goto-char (+ forward
(point)))
10268 ;; Replace the old mark with the new mark.
10269 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
10270 ;; Optionally update the marks by some user rule.
10271 (when (eq type
'unread
)
10272 (gnus-data-set-mark
10273 (gnus-data-find (gnus-summary-article-number)) mark
)
10274 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
10276 (defun gnus-mark-article-as-read (article &optional mark
)
10277 "Enter ARTICLE in the pertinent lists and remove it from others."
10278 ;; Make the article expirable.
10279 (let ((mark (or mark gnus-del-mark
)))
10280 (setq gnus-newsgroup-expirable
10281 (if (= mark gnus-expirable-mark
)
10282 (gnus-add-to-sorted-list gnus-newsgroup-expirable article
)
10283 (delq article gnus-newsgroup-expirable
)))
10284 ;; Remove from unread and marked lists.
10285 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10286 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
10287 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
10288 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
10289 (push (cons article mark
) gnus-newsgroup-reads
)
10290 ;; Possibly remove from cache, if that is used.
10291 (when gnus-use-cache
10292 (gnus-cache-enter-remove-article article
))
10295 (defun gnus-mark-article-as-unread (article &optional mark
)
10296 "Enter ARTICLE in the pertinent lists and remove it from others."
10297 (let ((mark (or mark gnus-ticked-mark
)))
10300 (gnus-error 1 "Can't mark negative article numbers")
10302 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
10303 gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
)
10304 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
10305 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
10306 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10308 ;; Unsuppress duplicates?
10309 (when gnus-suppress-duplicates
10310 (gnus-dup-unsuppress-article article
))
10312 (cond ((= mark gnus-ticked-mark
)
10313 (setq gnus-newsgroup-marked
10314 (gnus-add-to-sorted-list gnus-newsgroup-marked article
)))
10315 ((= mark gnus-spam-mark
)
10316 (setq gnus-newsgroup-spam-marked
10317 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10319 ((= mark gnus-dormant-mark
)
10320 (setq gnus-newsgroup-dormant
10321 (gnus-add-to-sorted-list gnus-newsgroup-dormant article
)))
10323 (setq gnus-newsgroup-unreads
10324 (gnus-add-to-sorted-list gnus-newsgroup-unreads article
))))
10325 (gnus-pull article gnus-newsgroup-reads
)
10328 (defalias 'gnus-summary-mark-as-unread-forward
10329 'gnus-summary-tick-article-forward
)
10330 (make-obsolete 'gnus-summary-mark-as-unread-forward
10331 'gnus-summary-tick-article-forward
)
10332 (defun gnus-summary-tick-article-forward (n)
10333 "Tick N articles forwards.
10334 If N is negative, tick backwards instead.
10335 The difference between N and the number of articles ticked is returned."
10337 (gnus-summary-mark-forward n gnus-ticked-mark
))
10339 (defalias 'gnus-summary-mark-as-unread-backward
10340 'gnus-summary-tick-article-backward
)
10341 (make-obsolete 'gnus-summary-mark-as-unread-backward
10342 'gnus-summary-tick-article-backward
)
10343 (defun gnus-summary-tick-article-backward (n)
10344 "Tick N articles backwards.
10345 The difference between N and the number of articles ticked is returned."
10347 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
10349 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10350 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10351 (defun gnus-summary-tick-article (&optional article clear-mark
)
10352 "Mark current article as unread.
10353 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10354 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10356 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
10357 gnus-ticked-mark
)))
10359 (defun gnus-summary-mark-as-read-forward (n)
10360 "Mark N articles as read forwards.
10361 If N is negative, mark backwards instead.
10362 The difference between N and the actual number of articles marked is
10365 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
10367 (defun gnus-summary-mark-as-read-backward (n)
10368 "Mark the N articles as read backwards.
10369 The difference between N and the actual number of articles marked is
10372 (gnus-summary-mark-forward
10373 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
10375 (defun gnus-summary-mark-as-read (&optional article mark
)
10376 "Mark current article as read.
10377 ARTICLE specifies the article to be marked as read.
10378 MARK specifies a string to be inserted at the beginning of the line."
10379 (gnus-summary-mark-article article mark
))
10381 (defun gnus-summary-clear-mark-forward (n)
10382 "Clear marks from N articles forward.
10383 If N is negative, clear backward instead.
10384 The difference between N and the number of marks cleared is returned."
10386 (gnus-summary-mark-forward n gnus-unread-mark
))
10388 (defun gnus-summary-clear-mark-backward (n)
10389 "Clear marks from N articles backward.
10390 The difference between N and the number of marks cleared is returned."
10392 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
10394 (defun gnus-summary-mark-unread-as-read ()
10395 "Intended to be used by `gnus-summary-mark-article-hook'."
10396 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10397 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
10399 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark
)
10400 "Intended to be used by `gnus-summary-mark-article-hook'."
10401 (let ((mark (gnus-summary-article-mark)))
10402 (when (or (gnus-unread-mark-p mark
)
10403 (gnus-read-mark-p mark
))
10404 (gnus-summary-mark-article gnus-current-article
10405 (or new-mark gnus-read-mark
)))))
10407 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark
)
10408 "Intended to be used by `gnus-summary-mark-article-hook'."
10409 (let ((mark (gnus-summary-article-mark)))
10410 (when (or (gnus-unread-mark-p mark
)
10411 (gnus-read-mark-p mark
))
10412 (gnus-summary-mark-article (gnus-summary-article-number)
10413 (or new-mark gnus-read-mark
)))))
10415 (defun gnus-summary-mark-unread-as-ticked ()
10416 "Intended to be used by `gnus-summary-mark-article-hook'."
10417 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10418 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark
)))
10420 (defun gnus-summary-mark-region-as-read (point mark all
)
10421 "Mark all unread articles between point and mark as read.
10422 If given a prefix, mark all articles between point and mark as read,
10423 even ticked and dormant ones."
10424 (interactive "r\nP")
10428 (beginning-of-line)
10433 (memq (setq article
(gnus-summary-article-number))
10434 gnus-newsgroup-unreads
))
10435 (gnus-summary-mark-article article gnus-del-mark
))
10437 (gnus-summary-find-next))))))
10439 (defun gnus-summary-mark-below (score mark
)
10440 "Mark articles with score less than SCORE with MARK."
10441 (interactive "P\ncMark: ")
10442 (setq score
(if score
10443 (prefix-numeric-value score
)
10444 (or gnus-summary-default-score
0)))
10446 (set-buffer gnus-summary-buffer
)
10447 (goto-char (point-min))
10450 (and (< (gnus-summary-article-score) score
)
10451 (gnus-summary-mark-article nil mark
))
10452 (gnus-summary-find-next)))))
10454 (defun gnus-summary-kill-below (&optional score
)
10455 "Mark articles with score below SCORE as read."
10457 (gnus-summary-mark-below score gnus-killed-mark
))
10459 (defun gnus-summary-clear-above (&optional score
)
10460 "Clear all marks from articles with score above SCORE."
10462 (gnus-summary-mark-above score gnus-unread-mark
))
10464 (defun gnus-summary-tick-above (&optional score
)
10465 "Tick all articles with score above SCORE."
10467 (gnus-summary-mark-above score gnus-ticked-mark
))
10469 (defun gnus-summary-mark-above (score mark
)
10470 "Mark articles with score over SCORE with MARK."
10471 (interactive "P\ncMark: ")
10472 (setq score
(if score
10473 (prefix-numeric-value score
)
10474 (or gnus-summary-default-score
0)))
10476 (set-buffer gnus-summary-buffer
)
10477 (goto-char (point-min))
10479 (when (> (gnus-summary-article-score) score
)
10480 (gnus-summary-mark-article nil mark
))
10482 (gnus-summary-find-next)))))
10484 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10485 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
10486 (defun gnus-summary-limit-include-expunged (&optional no-error
)
10487 "Display all the hidden articles that were expunged for low scores."
10489 (let ((buffer-read-only nil
))
10490 (let ((scored gnus-newsgroup-scored
)
10493 (unless (gnus-summary-article-header (caar scored
))
10494 (and (setq h
(gnus-number-to-header (caar scored
)))
10495 (< (cdar scored
) gnus-summary-expunge-below
)
10497 (setq scored
(cdr scored
)))
10499 (when (not no-error
)
10500 (error "No expunged articles hidden"))
10501 (goto-char (point-min))
10502 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
10503 (setq gnus-newsgroup-limit
(copy-sequence gnus-newsgroup-limit
))
10504 (mapcar (lambda (x) (push (mail-header-number x
)
10505 gnus-newsgroup-limit
))
10507 (gnus-summary-prepare-unthreaded (nreverse headers
))
10508 (goto-char (point-min))
10509 (gnus-summary-position-point)
10512 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse
)
10513 "Mark all unread articles in this newsgroup as read.
10514 If prefix argument ALL is non-nil, ticked and dormant articles will
10515 also be marked as read.
10516 If QUIETLY is non-nil, no questions will be asked.
10518 If TO-HERE is non-nil, it should be a point in the buffer. All
10519 articles before (after, if REVERSE is set) this point will be marked
10522 Note that this function will only catch up the unread article
10523 in the current summary buffer limitation.
10525 The number of articles marked as read is returned."
10530 (not gnus-interactive-catchup
) ;Without confirmation?
10534 "Mark absolutely all articles as read? "
10535 "Mark all unread articles as read? ")))
10537 (not gnus-newsgroup-adaptive
)
10538 (not gnus-newsgroup-auto-expire
)
10539 (not gnus-suppress-duplicates
)
10540 (or (not gnus-use-cache
)
10541 (eq gnus-use-cache
'passive
)))
10544 (setq gnus-newsgroup-marked nil
10545 gnus-newsgroup-spam-marked nil
10546 gnus-newsgroup-dormant nil
))
10547 (setq gnus-newsgroup-unreads
10548 (gnus-sorted-nunion
10549 (gnus-sorted-intersection gnus-newsgroup-unreads
10550 gnus-newsgroup-downloadable
)
10551 (gnus-sorted-difference gnus-newsgroup-unfetched
10552 gnus-newsgroup-cached
))))
10553 ;; We actually mark all articles as canceled, which we
10554 ;; have to do when using auto-expiry or adaptive scoring.
10555 (gnus-summary-show-all-threads)
10556 (if (and to-here reverse
)
10558 (goto-char to-here
)
10559 (gnus-summary-mark-current-read-and-unread-as-read
10561 (while (gnus-summary-find-next (not all
))
10562 (gnus-summary-mark-article-as-read gnus-catchup-mark
)))
10563 (when (gnus-summary-first-subject (not all
))
10565 (if to-here
(< (point) to-here
) t
)
10566 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
10567 (gnus-summary-find-next (not all
))))))
10568 (gnus-set-mode-line 'summary
))
10570 (gnus-summary-position-point)))
10572 (defun gnus-summary-catchup-to-here (&optional all
)
10573 "Mark all unticked articles before the current one as read.
10574 If ALL is non-nil, also mark ticked and dormant articles as read."
10577 (gnus-save-hidden-threads
10578 (let ((beg (point)))
10579 ;; We check that there are unread articles.
10580 (when (or all
(gnus-summary-find-prev))
10581 (gnus-summary-catchup all t beg
)))))
10582 (gnus-summary-position-point))
10584 (defun gnus-summary-catchup-from-here (&optional all
)
10585 "Mark all unticked articles after (and including) the current one as read.
10586 If ALL is non-nil, also mark ticked and dormant articles as read."
10589 (gnus-save-hidden-threads
10590 (let ((beg (point)))
10591 ;; We check that there are unread articles.
10592 (when (or all
(gnus-summary-find-next))
10593 (gnus-summary-catchup all t beg nil t
)))))
10594 (gnus-summary-position-point))
10596 (defun gnus-summary-catchup-all (&optional quietly
)
10597 "Mark all articles in this newsgroup as read.
10598 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10599 instead, which marks only unread articles as read."
10601 (gnus-summary-catchup t quietly
))
10603 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
10604 "Mark all unread articles in this group as read, then exit.
10605 If prefix argument ALL is non-nil, all articles are marked as read.
10606 If QUIETLY is non-nil, no questions will be asked."
10608 (when (gnus-summary-catchup all quietly nil
'fast
)
10609 ;; Select next newsgroup or exit.
10610 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
10611 (eq gnus-auto-select-next
'quietly
))
10612 (gnus-summary-next-group nil
)
10613 (gnus-summary-exit))))
10615 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
10616 "Mark all articles in this newsgroup as read, and then exit.
10617 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10618 instead, which marks only unread articles as read."
10620 (gnus-summary-catchup-and-exit t quietly
))
10622 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
10623 "Mark all articles in this group as read and select the next group.
10624 If given a prefix, mark all articles, unread as well as ticked, as
10628 (gnus-summary-catchup all
))
10629 (gnus-summary-next-group))
10635 (defmacro gnus-with-article
(article &rest forms
)
10636 "Select ARTICLE and perform FORMS in the original article buffer.
10637 Then replace the article with the result."
10639 ;; We don't want the article to be marked as read.
10640 (let (gnus-mark-article-hook)
10641 (gnus-summary-select-article t t nil
,article
))
10642 (set-buffer gnus-original-article-buffer
)
10644 (if (not (gnus-check-backend-function
10645 'request-replace-article
(car gnus-article-current
)))
10646 (gnus-message 5 "Read-only group; not replacing")
10647 (unless (gnus-request-replace-article
10648 ,article
(car gnus-article-current
)
10649 (current-buffer) t
)
10650 (error "Couldn't replace article")))
10651 ;; The cache and backlog have to be flushed somewhat.
10652 (when gnus-keep-backlog
10653 (gnus-backlog-remove-article
10654 (car gnus-article-current
) (cdr gnus-article-current
)))
10655 (when gnus-use-cache
10656 (gnus-cache-update-article
10657 (car gnus-article-current
) (cdr gnus-article-current
)))))
10659 (put 'gnus-with-article
'lisp-indent-function
1)
10660 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
10662 ;; Thread-based commands.
10664 (defun gnus-summary-articles-in-thread (&optional article
)
10665 "Return a list of all articles in the current thread.
10666 If ARTICLE is non-nil, return all articles in the thread that starts
10667 with that article."
10668 (let* ((article (or article
(gnus-summary-article-number)))
10669 (data (gnus-data-find-list article
))
10670 (top-level (gnus-data-level (car data
)))
10672 (cond ((null gnus-thread-operation-ignore-subject
)
10673 (gnus-simplify-subject-re
10674 (mail-header-subject (gnus-data-header (car data
)))))
10675 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
10676 (gnus-simplify-subject-fuzzy
10677 (mail-header-subject (gnus-data-header (car data
)))))
10679 (end-point (save-excursion
10680 (if (gnus-summary-go-to-next-thread)
10681 (point) (point-max))))
10684 (< (gnus-data-pos (car data
)) end-point
))
10685 (when (or (not top-subject
)
10686 (string= top-subject
10687 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
10688 (gnus-simplify-subject-fuzzy
10689 (mail-header-subject
10690 (gnus-data-header (car data
))))
10691 (gnus-simplify-subject-re
10692 (mail-header-subject
10693 (gnus-data-header (car data
)))))))
10694 (push (gnus-data-number (car data
)) articles
))
10695 (unless (and (setq data
(cdr data
))
10696 (> (gnus-data-level (car data
)) top-level
))
10698 ;; Return the list of articles.
10699 (nreverse articles
)))
10701 (defun gnus-summary-rethread-current ()
10702 "Rethread the thread the current article is part of."
10704 (let* ((gnus-show-threads t
)
10705 (article (gnus-summary-article-number))
10706 (id (mail-header-id (gnus-summary-article-header)))
10707 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
10709 (error "No article on the current line"))
10710 (gnus-rebuild-thread id
)
10711 (gnus-summary-goto-subject article
)))
10713 (defun gnus-summary-reparent-thread ()
10714 "Make the current article child of the marked (or previous) article.
10716 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10717 is non-nil or the Subject: of both articles are the same."
10719 (unless (not (gnus-group-read-only-p))
10720 (error "The current newsgroup does not support article editing"))
10721 (unless (<= (length gnus-newsgroup-processable
) 1)
10722 (error "No more than one article may be marked"))
10723 (save-window-excursion
10724 (let ((gnus-article-buffer " *reparent*")
10725 (current-article (gnus-summary-article-number))
10726 ;; First grab the marked article, otherwise one line up.
10727 (parent-article (if (not (null gnus-newsgroup-processable
))
10728 (car gnus-newsgroup-processable
)
10730 (if (eq (forward-line -
1) 0)
10731 (gnus-summary-article-number)
10732 (error "Beginning of summary buffer"))))))
10733 (unless (not (eq current-article parent-article
))
10734 (error "An article may not be self-referential"))
10735 (let ((message-id (mail-header-id
10736 (gnus-summary-article-header parent-article
))))
10737 (unless (and message-id
(not (equal message-id
"")))
10738 (error "No message-id in desired parent"))
10739 (gnus-with-article current-article
10741 (goto-char (point-min))
10742 (message-narrow-to-head)
10743 (if (re-search-forward "^References: " nil t
)
10745 (re-search-forward "^[^ \t]" nil t
)
10748 (insert " " message-id
))
10749 (insert "References: " message-id
"\n"))))
10750 (set-buffer gnus-summary-buffer
)
10751 (gnus-summary-unmark-all-processable)
10752 (gnus-summary-update-article current-article
)
10753 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
10754 (gnus-summary-update-secondary-mark (cdr gnus-article-current
)))
10755 (gnus-summary-rethread-current)
10756 (gnus-message 3 "Article %d is now the child of article %d"
10757 current-article parent-article
)))))
10759 (defun gnus-summary-toggle-threads (&optional arg
)
10760 "Toggle showing conversation threads.
10761 If ARG is positive number, turn showing conversation threads on."
10763 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
10764 (setq gnus-show-threads
10765 (if (null arg
) (not gnus-show-threads
)
10766 (> (prefix-numeric-value arg
) 0)))
10767 (gnus-summary-prepare)
10768 (gnus-summary-goto-subject current
)
10769 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
10770 (gnus-summary-position-point)))
10772 (defun gnus-summary-show-all-threads ()
10773 "Show all threads."
10776 (let ((buffer-read-only nil
))
10777 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
10778 (gnus-summary-position-point))
10780 (defun gnus-summary-show-thread ()
10781 "Show thread subtrees.
10782 Returns nil if no thread was there to be shown."
10784 (let ((buffer-read-only nil
)
10786 (end (gnus-point-at-eol))
10787 ;; Leave point at bol
10788 (beg (progn (beginning-of-line) (point))))
10790 ;; Any hidden lines here?
10791 (search-forward "\r" end t
)
10792 (subst-char-in-region beg end ?\^M ?
\n t
)
10794 (gnus-summary-position-point))))
10796 (defun gnus-summary-maybe-hide-threads ()
10797 "If requested, hide the threads that should be hidden."
10798 (when (and gnus-show-threads
10799 gnus-thread-hide-subtree
)
10800 (gnus-summary-hide-all-threads
10801 (if (or (consp gnus-thread-hide-subtree
)
10802 (functionp gnus-thread-hide-subtree
))
10803 (gnus-make-predicate gnus-thread-hide-subtree
)
10806 ;;; Hiding predicates.
10808 (defun gnus-article-unread-p (header)
10809 (memq (mail-header-number header
) gnus-newsgroup-unreads
))
10811 (defun gnus-article-unseen-p (header)
10812 (memq (mail-header-number header
) gnus-newsgroup-unseen
))
10814 (defun gnus-map-articles (predicate articles
)
10815 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10816 (apply 'gnus-or
(mapcar predicate
10817 (mapcar (lambda (number)
10818 (gnus-summary-article-header number
))
10821 (defun gnus-summary-hide-all-threads (&optional predicate
)
10822 "Hide all thread subtrees.
10823 If PREDICATE is supplied, threads that satisfy this predicate
10824 will not be hidden."
10827 (goto-char (point-min))
10830 (when (or (not predicate
)
10832 predicate
(gnus-summary-article-children)))
10833 (gnus-summary-hide-thread))
10834 (setq end
(not (zerop (gnus-summary-next-thread 1 t
)))))))
10835 (gnus-summary-position-point))
10837 (defun gnus-summary-hide-thread ()
10838 "Hide thread subtrees.
10839 If PREDICATE is supplied, threads that satisfy this predicate
10840 will not be hidden.
10841 Returns nil if no threads were there to be hidden."
10843 (let ((buffer-read-only nil
)
10845 (article (gnus-summary-article-number)))
10847 ;; Go forward until either the buffer ends or the subthread
10849 (when (and (not (eobp))
10850 (or (zerop (gnus-summary-next-thread 1 t
))
10851 (goto-char (point-max))))
10853 (if (and (> (point) start
)
10854 (search-backward "\n" start t
))
10856 (subst-char-in-region start
(point) ?
\n ?\^M
)
10857 (gnus-summary-goto-subject article
))
10861 (defun gnus-summary-go-to-next-thread (&optional previous
)
10862 "Go to the same level (or less) next thread.
10863 If PREVIOUS is non-nil, go to previous thread instead.
10864 Return the article number moved to, or nil if moving was impossible."
10865 (let ((level (gnus-summary-thread-level))
10866 (way (if previous -
1 1))
10869 (while (and (not (eobp))
10870 (< level
(gnus-summary-thread-level)))
10871 (forward-line way
))
10878 (gnus-summary-article-number)
10879 (goto-char beg
)))))
10881 (defun gnus-summary-next-thread (n &optional silent
)
10882 "Go to the same level next N'th thread.
10883 If N is negative, search backward instead.
10884 Returns the difference between N and the number of skips actually
10887 If SILENT, don't output messages."
10889 (let ((backward (< n
0))
10891 (while (and (> n
0)
10892 (gnus-summary-go-to-next-thread backward
))
10895 (gnus-summary-position-point))
10896 (when (and (not silent
) (/= 0 n
))
10897 (gnus-message 7 "No more threads"))
10900 (defun gnus-summary-prev-thread (n)
10901 "Go to the same level previous N'th thread.
10902 Returns the difference between N and the number of skips actually
10905 (gnus-summary-next-thread (- n
)))
10907 (defun gnus-summary-go-down-thread ()
10908 "Go down one level in the current thread."
10909 (let ((children (gnus-summary-article-children)))
10911 (gnus-summary-goto-subject (car children
)))))
10913 (defun gnus-summary-go-up-thread ()
10914 "Go up one level in the current thread."
10915 (let ((parent (gnus-summary-article-parent)))
10917 (gnus-summary-goto-subject parent
))))
10919 (defun gnus-summary-down-thread (n)
10920 "Go down thread N steps.
10921 If N is negative, go up instead.
10922 Returns the difference between N and how many steps down that were
10927 (while (and (> n
0)
10928 (if up
(gnus-summary-go-up-thread)
10929 (gnus-summary-go-down-thread)))
10931 (gnus-summary-position-point)
10933 (gnus-message 7 "Can't go further"))
10936 (defun gnus-summary-up-thread (n)
10937 "Go up thread N steps.
10938 If N is negative, go down instead.
10939 Returns the difference between N and how many steps down that were
10942 (gnus-summary-down-thread (- n
)))
10944 (defun gnus-summary-top-thread ()
10945 "Go to the top of the thread."
10947 (while (gnus-summary-go-up-thread))
10948 (gnus-summary-article-number))
10950 (defun gnus-summary-kill-thread (&optional unmark
)
10951 "Mark articles under current thread as read.
10952 If the prefix argument is positive, remove any kinds of marks.
10953 If the prefix argument is negative, tick articles instead."
10956 (setq unmark
(prefix-numeric-value unmark
)))
10957 (let ((articles (gnus-summary-articles-in-thread)))
10959 ;; Expand the thread.
10960 (gnus-summary-show-thread)
10961 ;; Mark all the articles.
10963 (gnus-summary-goto-subject (car articles
))
10964 (cond ((null unmark
)
10965 (gnus-summary-mark-article-as-read gnus-killed-mark
))
10967 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
10969 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
10970 (setq articles
(cdr articles
))))
10971 ;; Hide killed subtrees.
10973 gnus-thread-hide-killed
10974 (gnus-summary-hide-thread))
10975 ;; If marked as read, go to next unread subject.
10976 (when (null unmark
)
10977 ;; Go to next unread subject.
10978 (gnus-summary-next-subject 1 t
)))
10979 (gnus-set-mode-line 'summary
))
10981 ;; Summary sorting commands
10983 (defun gnus-summary-sort-by-number (&optional reverse
)
10984 "Sort the summary buffer by article number.
10985 Argument REVERSE means reverse order."
10987 (gnus-summary-sort 'number reverse
))
10989 (defun gnus-summary-sort-by-random (&optional reverse
)
10990 "Randomize the order in the summary buffer.
10991 Argument REVERSE means to randomize in reverse order."
10993 (gnus-summary-sort 'random reverse
))
10995 (defun gnus-summary-sort-by-author (&optional reverse
)
10996 "Sort the summary buffer by author name alphabetically.
10997 If `case-fold-search' is non-nil, case of letters is ignored.
10998 Argument REVERSE means reverse order."
11000 (gnus-summary-sort 'author reverse
))
11002 (defun gnus-summary-sort-by-subject (&optional reverse
)
11003 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11004 If `case-fold-search' is non-nil, case of letters is ignored.
11005 Argument REVERSE means reverse order."
11007 (gnus-summary-sort 'subject reverse
))
11009 (defun gnus-summary-sort-by-date (&optional reverse
)
11010 "Sort the summary buffer by date.
11011 Argument REVERSE means reverse order."
11013 (gnus-summary-sort 'date reverse
))
11015 (defun gnus-summary-sort-by-score (&optional reverse
)
11016 "Sort the summary buffer by score.
11017 Argument REVERSE means reverse order."
11019 (gnus-summary-sort 'score reverse
))
11021 (defun gnus-summary-sort-by-lines (&optional reverse
)
11022 "Sort the summary buffer by the number of lines.
11023 Argument REVERSE means reverse order."
11025 (gnus-summary-sort 'lines reverse
))
11027 (defun gnus-summary-sort-by-chars (&optional reverse
)
11028 "Sort the summary buffer by article length.
11029 Argument REVERSE means reverse order."
11031 (gnus-summary-sort 'chars reverse
))
11033 (defun gnus-summary-sort-by-original (&optional reverse
)
11034 "Sort the summary buffer using the default sorting method.
11035 Argument REVERSE means reverse order."
11037 (let* ((buffer-read-only)
11038 (gnus-summary-prepare-hook nil
))
11039 ;; We do the sorting by regenerating the threads.
11040 (gnus-summary-prepare)
11041 ;; Hide subthreads if needed.
11042 (gnus-summary-maybe-hide-threads)))
11044 (defun gnus-summary-sort (predicate reverse
)
11045 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11046 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
11047 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
11048 (gnus-thread-sort-functions
11053 (gnus-sort-gathered-threads-function
11054 gnus-thread-sort-functions
)
11055 (gnus-article-sort-functions
11059 (,article t2 t1
))))
11061 (gnus-summary-prepare-hook nil
))
11062 ;; We do the sorting by regenerating the threads.
11063 (gnus-summary-prepare)
11064 ;; Hide subthreads if needed.
11065 (gnus-summary-maybe-hide-threads)))
11067 ;; Summary saving commands.
11069 (defun gnus-summary-save-article (&optional n not-saved
)
11070 "Save the current article using the default saver function.
11071 If N is a positive number, save the N next articles.
11072 If N is a negative number, save the N previous articles.
11073 If N is nil and any articles have been marked with the process mark,
11074 save those articles instead.
11075 The variable `gnus-default-article-saver' specifies the saver function.
11077 If the optional second argument NOT-SAVED is non-nil, articles saved
11078 will not be marked as saved."
11080 (require 'gnus-art
)
11081 (let* ((articles (gnus-summary-work-articles n
))
11082 (save-buffer (save-excursion
11083 (nnheader-set-temp-buffer " *Gnus Save*")))
11084 (num (length articles
))
11085 ;; Whether to save decoded articles or raw articles.
11086 (decode (when gnus-article-save-coding-system
11087 (get gnus-default-article-saver
:decode
)))
11088 ;; When saving many articles in a single file, use the other
11089 ;; function to save articles other than the first one.
11090 (saver2 (get gnus-default-article-saver
:function
))
11091 (gnus-prompt-before-saving (if saver2
11093 gnus-prompt-before-saving
))
11094 (gnus-default-article-saver gnus-default-article-saver
)
11096 (dolist (article articles
)
11097 (setq header
(gnus-summary-article-header article
))
11098 (if (not (vectorp header
))
11099 ;; This is a pseudo-article.
11100 (if (assq 'name header
)
11101 (gnus-copy-file (cdr (assq 'name header
)))
11102 (gnus-message 1 "Article %d is unsaveable" article
))
11103 ;; This is a real article.
11104 (save-window-excursion
11105 (let ((gnus-display-mime-function (when decode
11106 gnus-display-mime-function
))
11107 (gnus-article-prepare-hook (when decode
11108 gnus-article-prepare-hook
)))
11109 (gnus-summary-select-article t nil nil article
)
11110 (gnus-summary-goto-subject article
)))
11112 (set-buffer save-buffer
)
11114 (insert-buffer-substring (if decode
11115 gnus-article-buffer
11116 gnus-original-article-buffer
)))
11117 (setq file
(gnus-article-save save-buffer file num
))
11118 (gnus-summary-remove-process-mark article
)
11120 (gnus-summary-set-saved-mark article
)))
11122 (setq gnus-default-article-saver saver2
11124 (gnus-kill-buffer save-buffer
)
11125 (gnus-summary-position-point)
11126 (gnus-set-mode-line 'summary
)
11129 (defun gnus-summary-pipe-output (&optional arg headers
)
11130 "Pipe the current article to a subprocess.
11131 If N is a positive number, pipe the N next articles.
11132 If N is a negative number, pipe the N previous articles.
11133 If N is nil and any articles have been marked with the process mark,
11134 pipe those articles instead.
11135 If HEADERS (the symbolic prefix), include the headers, too."
11136 (interactive (gnus-interactive "P\ny"))
11137 (require 'gnus-art
)
11138 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
)
11139 (gnus-save-all-headers (or headers gnus-save-all-headers
)))
11140 (gnus-summary-save-article arg t
))
11141 (let ((buffer (get-buffer "*Shell Command Output*")))
11143 (not (zerop (buffer-size buffer
))))
11144 (gnus-configure-windows 'pipe
))))
11146 (defun gnus-summary-save-article-mail (&optional arg
)
11147 "Append the current article to a Unix mail box file.
11148 If N is a positive number, save the N next articles.
11149 If N is a negative number, save the N previous articles.
11150 If N is nil and any articles have been marked with the process mark,
11151 save those articles instead."
11153 (require 'gnus-art
)
11154 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
11155 (gnus-summary-save-article arg
)))
11157 (defun gnus-summary-save-article-rmail (&optional arg
)
11158 "Append the current article to an rmail file.
11159 If N is a positive number, save the N next articles.
11160 If N is a negative number, save the N previous articles.
11161 If N is nil and any articles have been marked with the process mark,
11162 save those articles instead."
11164 (require 'gnus-art
)
11165 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
11166 (gnus-summary-save-article arg
)))
11168 (defun gnus-summary-save-article-file (&optional arg
)
11169 "Append the current article to a file.
11170 If N is a positive number, save the N next articles.
11171 If N is a negative number, save the N previous articles.
11172 If N is nil and any articles have been marked with the process mark,
11173 save those articles instead."
11175 (require 'gnus-art
)
11176 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
11177 (gnus-summary-save-article arg
)))
11179 (defun gnus-summary-write-article-file (&optional arg
)
11180 "Write the current article to a file, deleting the previous file.
11181 If N is a positive number, save the N next articles.
11182 If N is a negative number, save the N previous articles.
11183 If N is nil and any articles have been marked with the process mark,
11184 save those articles instead."
11186 (require 'gnus-art
)
11187 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
11188 (gnus-summary-save-article arg
)))
11190 (defun gnus-summary-save-article-body-file (&optional arg
)
11191 "Append the current article body to a file.
11192 If N is a positive number, save the N next articles.
11193 If N is a negative number, save the N previous articles.
11194 If N is nil and any articles have been marked with the process mark,
11195 save those articles instead."
11197 (require 'gnus-art
)
11198 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
11199 (gnus-summary-save-article arg
)))
11201 (defun gnus-summary-write-article-body-file (&optional arg
)
11202 "Write the current article body to a file, deleting the previous file.
11203 If N is a positive number, save the N next articles.
11204 If N is a negative number, save the N previous articles.
11205 If N is nil and any articles have been marked with the process mark,
11206 save those articles instead."
11208 (require 'gnus-art
)
11209 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file
))
11210 (gnus-summary-save-article arg
)))
11212 (defun gnus-summary-muttprint (&optional arg
)
11213 "Print the current article using Muttprint.
11214 If N is a positive number, save the N next articles.
11215 If N is a negative number, save the N previous articles.
11216 If N is nil and any articles have been marked with the process mark,
11217 save those articles instead."
11219 (require 'gnus-art
)
11220 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint
))
11221 (gnus-summary-save-article arg t
)))
11223 (defun gnus-summary-pipe-message (program)
11224 "Pipe the current article through PROGRAM."
11225 (interactive "sProgram: ")
11226 (gnus-summary-select-article)
11227 (let ((mail-header-separator ""))
11228 (gnus-eval-in-buffer-window gnus-article-buffer
11231 (let ((start (window-start))
11233 (message-pipe-buffer-body program
)
11234 (set-window-start (get-buffer-window (current-buffer)) start
))))))
11236 (defun gnus-get-split-value (methods)
11237 "Return a value based on the split METHODS."
11238 (let (split-name method result match
)
11241 (set-buffer gnus-original-article-buffer
)
11243 (nnheader-narrow-to-headers)
11244 (while (and methods
(not split-name
))
11245 (goto-char (point-min))
11246 (setq method
(pop methods
))
11247 (setq match
(car method
))
11250 ;; Regular expression.
11252 (re-search-forward match nil t
)))
11257 (setq result
(funcall match gnus-newsgroup-name
))))
11262 (setq result
(eval match
)))))
11263 (setq split-name
(cdr method
))
11264 (cond ((stringp result
)
11265 (push (expand-file-name
11266 result gnus-article-save-directory
)
11269 (setq split-name
(append result split-name
)))))))))
11270 (nreverse split-name
)))
11272 (defun gnus-valid-move-group-p (group)
11273 (and (boundp group
)
11274 (symbol-name group
)
11275 (symbol-value group
)
11276 (gnus-get-function (gnus-find-method-for-group
11277 (symbol-name group
)) 'request-accept-article t
)))
11279 (defun gnus-read-move-group-name (prompt default articles prefix
)
11280 "Read a group name."
11281 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
11282 (minibuffer-confirm-incomplete nil
) ; XEmacs
11286 (if (> (length articles
) 1)
11287 (format "these %d articles" (length articles
))
11292 (gnus-completing-read-with-default
11295 'gnus-valid-move-group-p
11297 'gnus-group-history
))
11298 ((= 1 (length split-name
))
11299 (gnus-completing-read-with-default
11300 (car split-name
) prom
11302 'gnus-valid-move-group-p
11304 'gnus-group-history
))
11306 (gnus-completing-read-with-default
11308 (mapcar (lambda (el) (list el
))
11309 (nreverse split-name
))
11311 'gnus-group-history
))))
11312 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
11314 (if (or (string= to-newsgroup
"")
11315 (string= to-newsgroup prefix
))
11316 (setq to-newsgroup default
))
11317 (unless to-newsgroup
11318 (error "No group name entered"))
11319 (or (gnus-active to-newsgroup
)
11320 (gnus-activate-group to-newsgroup nil nil to-method
)
11321 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11323 (or (and (gnus-request-create-group to-newsgroup to-method
)
11324 (gnus-activate-group
11325 to-newsgroup nil nil to-method
)
11326 (gnus-subscribe-group to-newsgroup
))
11327 (error "Couldn't create group %s" to-newsgroup
)))
11328 (error "No such group: %s" to-newsgroup
)))
11331 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
11332 "Save parts matching TYPE to DIR.
11333 If REVERSE, save parts that do not match TYPE."
11335 (list (read-string "Save parts of type: "
11336 (or (car gnus-summary-save-parts-type-history
)
11337 gnus-summary-save-parts-default-mime
)
11338 'gnus-summary-save-parts-type-history
)
11339 (setq gnus-summary-save-parts-last-directory
11340 (read-file-name "Save to directory: "
11341 gnus-summary-save-parts-last-directory
11343 current-prefix-arg
))
11344 (gnus-summary-iterate n
11345 (let ((gnus-display-mime-function nil
)
11346 (gnus-inhibit-treatment t
))
11347 (gnus-summary-select-article))
11349 (set-buffer gnus-article-buffer
)
11350 (let ((handles (or gnus-article-mime-handles
11351 (mm-dissect-buffer nil gnus-article-loose-mime
)
11352 (and gnus-article-emulate-mime
11353 (mm-uu-dissect)))))
11355 (gnus-summary-save-parts-1 type dir handles reverse
)
11356 (unless gnus-article-mime-handles
;; Don't destroy this case.
11357 (mm-destroy-parts handles
)))))))
11359 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
11360 (if (stringp (car handle
))
11361 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
11364 (not (string-match type
(mm-handle-media-type handle
)))
11365 (string-match type
(mm-handle-media-type handle
)))
11366 (let ((file (expand-file-name
11368 mm-file-name-rewrite-functions
11369 (file-name-nondirectory
11371 (mail-content-type-get
11372 (mm-handle-disposition handle
) 'filename
)
11373 (mail-content-type-get
11374 (mm-handle-type handle
) 'name
)
11375 (concat gnus-newsgroup-name
11376 "." (number-to-string
11377 (cdr gnus-article-current
))))))
11379 (unless (file-exists-p file
)
11380 (mm-save-part-to-file handle file
))))))
11382 ;; Summary extract commands
11384 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
11385 (let ((buffer-read-only nil
)
11386 (article (gnus-summary-article-number))
11388 (unless (gnus-summary-goto-subject article
)
11389 (error "No such article: %d" article
))
11390 (gnus-summary-position-point)
11391 ;; If all commands are to be bunched up on one line, we collect
11393 (unless gnus-view-pseudos-separately
11394 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
11397 (setq action
(cdr (assq 'action
(car ps
))))
11398 (setq files
(list (cdr (assq 'name
(car ps
)))))
11399 (while (and ps
(cdr ps
)
11400 (string= (or action
"1")
11401 (or (cdr (assq 'action
(cadr ps
))) "2")))
11402 (push (cdr (assq 'name
(cadr ps
))) files
)
11403 (setcdr ps
(cddr ps
)))
11405 (when (not (string-match "%s" action
))
11408 (when (assq 'execute
(car ps
))
11409 (setcdr (assq 'execute
(car ps
))
11410 (funcall (if (string-match "%s" action
)
11419 (setq ps
(cdr ps
)))))
11420 (if (and gnus-view-pseudos
(not not-view
))
11422 (when (assq 'execute
(car pslist
))
11423 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
11424 (eq gnus-view-pseudos
'not-confirm
)))
11425 (setq pslist
(cdr pslist
)))
11428 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
11429 (gnus-summary-article-number)))
11430 (gnus-summary-goto-subject after-article
)
11433 (insert " " (file-name-nondirectory
11434 (cdr (assq 'name
(car pslist
))))
11435 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
11437 (forward-line -
1) ; back to `b'
11438 (gnus-add-text-properties
11439 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
11440 gnus-mouse-face-prop gnus-mouse-face
))
11442 after-article gnus-reffed-article-number
11443 gnus-unread-mark b
(car pslist
) 0 (- e b
))
11444 (setq gnus-newsgroup-unreads
11445 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11446 gnus-reffed-article-number
))
11447 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
11448 (setq pslist
(cdr pslist
)))))))
11450 (defun gnus-pseudos< (p1 p2
)
11451 (let ((c1 (cdr (assq 'action p1
)))
11452 (c2 (cdr (assq 'action p2
))))
11453 (and c1 c2
(string< c1 c2
))))
11455 (defun gnus-request-pseudo-article (props)
11456 (cond ((assq 'execute props
)
11457 (gnus-execute-command (cdr (assq 'execute props
)))))
11458 (let ((gnus-current-article (gnus-summary-article-number)))
11459 (gnus-run-hooks 'gnus-mark-article-hook
)))
11461 (defun gnus-execute-command (command &optional automatic
)
11463 (gnus-article-setup-buffer)
11464 (set-buffer gnus-article-buffer
)
11465 (setq buffer-read-only nil
)
11466 (let ((command (if automatic command
11467 (read-string "Command: " (cons command
0)))))
11469 (insert "$ " command
"\n\n")
11470 (if gnus-view-pseudo-asynchronously
11471 (start-process "gnus-execute" (current-buffer) shell-file-name
11472 shell-command-switch command
)
11473 (call-process shell-file-name nil t nil
11474 shell-command-switch command
)))))
11476 ;; Summary kill commands.
11478 (defun gnus-summary-edit-global-kill (article)
11479 "Edit the \"global\" kill file."
11480 (interactive (list (gnus-summary-article-number)))
11481 (gnus-group-edit-global-kill article
))
11483 (defun gnus-summary-edit-local-kill ()
11484 "Edit a local kill file applied to the current newsgroup."
11486 (setq gnus-current-headers
(gnus-summary-article-header))
11487 (gnus-group-edit-local-kill
11488 (gnus-summary-article-number) gnus-newsgroup-name
))
11490 ;;; Header reading.
11492 (defun gnus-read-header (id &optional header
)
11493 "Read the headers of article ID and enter them into the Gnus system."
11494 (let ((group gnus-newsgroup-name
)
11495 (gnus-override-method
11497 gnus-override-method
11498 (and (gnus-news-group-p gnus-newsgroup-name
)
11499 (car (gnus-refer-article-methods)))))
11501 ;; First we check to see whether the header in question is already
11504 ;; This is a Message-ID.
11505 (setq header
(or header
(gnus-id-to-header id
)))
11506 ;; This is an article number.
11507 (setq header
(or header
(gnus-summary-article-header id
))))
11509 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
11510 ;; We have found the header.
11512 ;; We have to really fetch the header to this article.
11514 (set-buffer nntp-server-buffer
)
11515 (when (setq where
(gnus-request-head id group
))
11516 (nnheader-fold-continuation-lines)
11517 (goto-char (point-max))
11519 (goto-char (point-min))
11523 ((cdr where
) (cdr where
))
11524 (header (mail-header-number header
))
11525 (t gnus-reffed-article-number
))
11527 (insert " Article retrieved.\n"))
11528 (if (or (not where
)
11529 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
11530 () ; Malformed head.
11531 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
11532 (when (and (stringp id
)
11533 (not (string= (gnus-group-real-name group
)
11535 ;; If we fetched by Message-ID and the article came
11536 ;; from a different group, we fudge some bogus article
11537 ;; numbers for this article.
11538 (mail-header-set-number header gnus-reffed-article-number
))
11540 (set-buffer gnus-summary-buffer
)
11541 (decf gnus-reffed-article-number
)
11542 (gnus-remove-header (mail-header-number header
))
11543 (push header gnus-newsgroup-headers
)
11544 (setq gnus-current-headers header
)
11545 (push (mail-header-number header
) gnus-newsgroup-limit
)))
11548 (defun gnus-remove-header (number)
11549 "Remove header NUMBER from `gnus-newsgroup-headers'."
11550 (if (and gnus-newsgroup-headers
11551 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
11552 (pop gnus-newsgroup-headers
)
11553 (let ((headers gnus-newsgroup-headers
))
11554 (while (and (cdr headers
)
11555 (not (= number
(mail-header-number (cadr headers
)))))
11557 (when (cdr headers
)
11558 (setcdr headers
(cddr headers
))))))
11561 ;;; summary highlights
11564 (defun gnus-highlight-selected-summary ()
11565 "Highlight selected article in summary buffer."
11566 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11567 (when gnus-summary-selected-face
11569 (let* ((beg (gnus-point-at-bol))
11570 (end (gnus-point-at-eol))
11571 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11572 (from (if (get-text-property beg gnus-mouse-face-prop
)
11574 (or (next-single-property-change
11575 beg gnus-mouse-face-prop nil end
)
11580 (or (next-single-property-change
11581 from gnus-mouse-face-prop nil end
)
11583 ;; If no mouse-face prop on line we will have to = from = end,
11584 ;; so we highlight the entire line instead.
11585 (when (= (+ to
2) from
)
11588 (if gnus-newsgroup-selected-overlay
11589 ;; Move old overlay.
11591 gnus-newsgroup-selected-overlay from to
(current-buffer))
11592 ;; Create new overlay.
11594 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
11595 'face gnus-summary-selected-face
))))))
11597 (defvar gnus-summary-highlight-line-cached nil
)
11598 (defvar gnus-summary-highlight-line-trigger nil
)
11600 (defun gnus-summary-highlight-line-0 ()
11601 (if (and (eq gnus-summary-highlight-line-trigger
11602 gnus-summary-highlight
)
11603 gnus-summary-highlight-line-cached
)
11604 gnus-summary-highlight-line-cached
11605 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11606 gnus-summary-highlight-line-cached
11607 (let* ((cond (list 'cond
))
11609 (list gnus-summary-highlight
))
11611 (setcdr c
(cons (list (caar list
) (list 'quote
(cdar list
)))
11615 (gnus-byte-compile (list 'lambda nil cond
))))))
11617 (defun gnus-summary-highlight-line ()
11618 "Highlight current line according to `gnus-summary-highlight'."
11619 (let* ((beg (gnus-point-at-bol))
11620 (article (or (gnus-summary-article-number) gnus-current-article
))
11621 (score (or (cdr (assq article
11622 gnus-newsgroup-scored
))
11623 gnus-summary-default-score
0))
11624 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
11625 (inhibit-read-only t
)
11626 (default gnus-summary-default-score
)
11627 (default-high gnus-summary-default-high-score
)
11628 (default-low gnus-summary-default-low-score
)
11629 (uncached (and gnus-summary-use-undownloaded-faces
11630 (memq article gnus-newsgroup-undownloaded
)
11631 (not (memq article gnus-newsgroup-cached
)))))
11632 (let ((face (funcall (gnus-summary-highlight-line-0))))
11633 (unless (eq face
(get-text-property beg
'face
))
11634 (gnus-put-text-property-excluding-characters-with-faces
11635 beg
(gnus-point-at-eol) 'face
11636 (setq face
(if (boundp face
) (symbol-value face
) face
)))
11637 (when gnus-summary-highlight-line-function
11638 (funcall gnus-summary-highlight-line-function article face
))))))
11640 (defun gnus-update-read-articles (group unread
&optional compute
)
11641 "Update the list of read articles in GROUP.
11642 UNREAD is a sorted list."
11643 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
11644 (entry (gnus-gethash group gnus-newsrc-hashtb
))
11645 (info (nth 2 entry
))
11648 (if (or (not info
) (not active
))
11649 ;; There is no info on this group if it was, in fact,
11650 ;; killed. Gnus stores no information on killed groups, so
11651 ;; there's nothing to be done.
11652 ;; One could store the information somewhere temporarily,
11653 ;; perhaps... Hmmm...
11655 ;; Remove any negative articles numbers.
11656 (while (and unread
(< (car unread
) 0))
11657 (setq unread
(cdr unread
)))
11658 ;; Remove any expired article numbers
11659 (while (and unread
(< (car unread
) (car active
)))
11660 (setq unread
(cdr unread
)))
11661 ;; Compute the ranges of read articles by looking at the list of
11662 ;; unread articles.
11664 (when (/= (car unread
) prev
)
11665 (push (if (= prev
(1- (car unread
))) prev
11666 (cons prev
(1- (car unread
))))
11668 (setq prev
(1+ (car unread
)))
11669 (setq unread
(cdr unread
)))
11670 (when (<= prev
(cdr active
))
11671 (push (cons prev
(cdr active
)) read
))
11672 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
11677 ;; Propagate the read marks to the backend.
11678 (when (gnus-check-backend-function 'request-set-mark group
)
11679 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
11680 (add (gnus-remove-from-range read
(gnus-info-read info
))))
11682 (unless (gnus-check-group group
)
11683 (error "Can't open server for %s" group
))
11684 (gnus-request-set-mark
11685 group
(delq nil
(list (if add
(list add
'add
'(read)))
11686 (if del
(list del
'del
'(read))))))
11688 `(gnus-request-set-mark
11691 (if del
(list del
'add
'(read)))
11692 (if add
(list add
'del
'(read))))))))))
11693 (set-buffer gnus-group-buffer
)
11694 (gnus-undo-register
11696 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
11697 (gnus-info-set-read ',info
',(gnus-info-read info
))
11698 (gnus-get-unread-articles-in-group ',info
11699 (gnus-active ,group
))
11700 (gnus-group-update-group ,group t
)
11702 ;; Enter this list into the group info.
11703 (gnus-info-set-read info read
)
11704 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11705 (gnus-get-unread-articles-in-group info
(gnus-active group
))
11708 (defun gnus-offer-save-summaries ()
11709 "Offer to save all active summary buffers."
11711 ;; Go through all buffers and find all summaries.
11712 (dolist (buffer (buffer-list))
11713 (when (and (setq buffer
(buffer-name buffer
))
11714 (string-match "Summary" buffer
)
11716 (set-buffer buffer
)
11717 ;; We check that this is, indeed, a summary buffer.
11718 (and (eq major-mode
'gnus-summary-mode
)
11719 ;; Also make sure this isn't bogus.
11720 gnus-newsgroup-prepared
11721 ;; Also make sure that this isn't a
11722 ;; dead summary buffer.
11723 (not gnus-dead-summary-mode
))))
11724 (push buffer buffers
)))
11725 ;; Go through all these summary buffers and offer to save them.
11729 "Update summary buffer %s? "
11731 (switch-to-buffer buf
)
11732 (gnus-summary-exit))
11735 (defun gnus-summary-setup-default-charset ()
11736 "Setup newsgroup default charset."
11737 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
11738 (setq gnus-newsgroup-charset nil
)
11739 (let* ((ignored-charsets
11740 (or gnus-newsgroup-ephemeral-ignored-charsets
11742 (and gnus-newsgroup-name
11743 (gnus-parameter-ignored-charsets gnus-newsgroup-name
))
11744 gnus-newsgroup-ignored-charsets
))))
11745 (setq gnus-newsgroup-charset
11746 (or gnus-newsgroup-ephemeral-charset
11747 (and gnus-newsgroup-name
11748 (gnus-parameter-charset gnus-newsgroup-name
))
11749 gnus-default-charset
))
11750 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
11751 ignored-charsets
))))
11757 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
11758 "Display the current article buffer fully MIME-buttonized.
11759 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11760 treated as multipart/mixed."
11762 (require 'gnus-art
)
11763 (let ((gnus-unbuttonized-mime-types nil
)
11764 (gnus-mime-display-multipart-as-mixed show-all-parts
))
11765 (gnus-summary-show-article)))
11767 (defun gnus-summary-repair-multipart (article)
11768 "Add a Content-Type header to a multipart article without one."
11769 (interactive (list (gnus-summary-article-number)))
11770 (gnus-with-article article
11771 (message-narrow-to-head)
11772 (message-remove-header "Mime-Version")
11773 (goto-char (point-max))
11774 (insert "Mime-Version: 1.0\n")
11776 (when (search-forward "\n--" nil t
)
11777 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11778 (message-narrow-to-head)
11779 (message-remove-header "Content-Type")
11780 (goto-char (point-max))
11781 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11784 (let (gnus-mark-article-hook)
11785 (gnus-summary-select-article t t nil article
)))
11787 (defun gnus-summary-toggle-display-buttonized ()
11788 "Toggle the buttonizing of the article buffer."
11790 (require 'gnus-art
)
11791 (if (setq gnus-inhibit-mime-unbuttonizing
11792 (not gnus-inhibit-mime-unbuttonizing
))
11793 (let ((gnus-unbuttonized-mime-types nil
))
11794 (gnus-summary-show-article))
11795 (gnus-summary-show-article)))
11798 ;;; Generic summary marking commands
11801 (defvar gnus-summary-marking-alist
11802 '((read gnus-del-mark
"d")
11803 (unread gnus-unread-mark
"u")
11804 (ticked gnus-ticked-mark
"!")
11805 (dormant gnus-dormant-mark
"?")
11806 (expirable gnus-expirable-mark
"e"))
11807 "An alist of names/marks/keystrokes.")
11809 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
11810 (defvar gnus-summary-mark-map
)
11812 (defun gnus-summary-make-all-marking-commands ()
11813 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
11814 (dolist (elem gnus-summary-marking-alist
)
11815 (apply 'gnus-summary-make-marking-command elem
)))
11817 (defun gnus-summary-make-marking-command (name mark keystroke
)
11818 (let ((map (make-sparse-keymap)))
11819 (define-key gnus-summary-generic-mark-map keystroke map
)
11820 (dolist (lway `((next "next" next nil
"n")
11821 (next-unread "next unread" next t
"N")
11822 (prev "previous" prev nil
"p")
11823 (prev-unread "previous unread" prev t
"P")
11824 (nomove "" nil nil
,keystroke
)))
11825 (let ((func (gnus-summary-make-marking-command-1
11826 mark
(car lway
) lway name
)))
11827 (setq func
(eval func
))
11828 (define-key map
(nth 4 lway
) func
)))))
11830 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
11832 (format "gnus-summary-put-mark-as-%s%s"
11833 name
(if (eq way
'nomove
)
11835 (concat "-" (symbol-name way
)))))
11838 "Mark the current article as %s%s.
11839 If N, the prefix, then repeat N times.
11840 If N is negative, move in reverse order.
11841 The difference between N and the actual number of articles marked is
11845 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
11847 (defun gnus-summary-generic-mark (n mark move unread
)
11848 "Mark N articles with MARK."
11849 (unless (eq major-mode
'gnus-summary-mode
)
11850 (error "This command can only be used in the summary buffer"))
11851 (gnus-summary-show-thread)
11854 ((eq move
'next
) 1)
11855 ((eq move
'prev
) -
1)
11857 (if (zerop nummove
)
11861 nummove
(* -
1 nummove
))))
11862 (while (and (> n
0)
11863 (gnus-summary-mark-article nil mark
)
11864 (zerop (gnus-summary-next-subject nummove unread t
)))
11867 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
11868 (gnus-summary-recenter)
11869 (gnus-summary-position-point)
11870 (gnus-set-mode-line 'summary
)
11873 (defun gnus-summary-insert-articles (articles)
11874 (when (setq articles
11875 (gnus-sorted-difference articles
11876 (mapcar (lambda (h)
11877 (mail-header-number h
))
11878 gnus-newsgroup-headers
)))
11879 (setq gnus-newsgroup-headers
11881 gnus-newsgroup-headers
11882 (gnus-fetch-headers articles
)
11883 'gnus-article-sort-by-number
))
11884 ;; Suppress duplicates?
11885 (when gnus-suppress-duplicates
11886 (gnus-dup-suppress-articles))
11888 ;; We might want to build some more threads first.
11889 (when (and gnus-fetch-old-headers
11890 (eq gnus-headers-retrieved-by
'nov
))
11891 (if (eq gnus-fetch-old-headers
'invisible
)
11892 (gnus-build-all-threads)
11893 (gnus-build-old-threads)))
11894 ;; Let the Gnus agent mark articles as read.
11896 (gnus-agent-get-undownloaded-list))
11897 ;; Remove list identifiers from subject
11898 (when gnus-list-identifiers
11899 (gnus-summary-remove-list-identifiers))
11900 ;; First and last article in this newsgroup.
11901 (when gnus-newsgroup-headers
11902 (setq gnus-newsgroup-begin
11903 (mail-header-number (car gnus-newsgroup-headers
))
11905 (mail-header-number
11906 (gnus-last-element gnus-newsgroup-headers
))))
11907 (when gnus-use-scoring
11908 (gnus-possibly-score-headers))))
11910 (defun gnus-summary-insert-old-articles (&optional all
)
11911 "Insert all old articles in this group.
11912 If ALL is non-nil, already read articles become readable.
11913 If ALL is a number, fetch this number of articles."
11916 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11919 ;; Some nntp servers lie about their active range. When
11920 ;; this happens, the active range can be in the millions.
11921 ;; Use a compressed range to avoid creating a huge list.
11922 (gnus-range-difference (list gnus-newsgroup-active
) old
))
11923 (setq len
(gnus-range-length older
))
11928 (let ((older-range (nreverse older
)))
11932 (let* ((r (pop older-range
))
11933 (min (if (numberp r
) r
(car r
)))
11934 (max (if (numberp r
) r
(cdr r
))))
11935 (while (and (<= min max
)
11940 (setq older
(gnus-uncompress-range older
))))
11942 (setq older
(gnus-uncompress-range older
)))
11944 (when (and (numberp gnus-large-newsgroup
)
11945 (> len gnus-large-newsgroup
))
11946 (let* ((cursor-in-echo-area nil
)
11947 (initial (gnus-parameter-large-newsgroup-initial
11948 gnus-newsgroup-name
))
11952 "How many articles from %s (%s %d): "
11954 (gnus-group-decoded-name gnus-newsgroup-name
) 35)
11955 (if initial
"max" "default")
11958 (cons (number-to-string initial
)
11960 (unless (string-match "^[ \t]*$" input
)
11961 (setq all
(string-to-number input
))
11963 (let ((older-range (nreverse older
)))
11967 (let* ((r (pop older-range
))
11968 (min (if (numberp r
) r
(car r
)))
11969 (max (if (numberp r
) r
(cdr r
))))
11970 (while (and (<= min max
)
11974 max
(1- max
))))))))))
11975 (setq older
(gnus-uncompress-range older
))))
11977 (message "No old news.")
11978 (gnus-summary-insert-articles older
)
11979 (gnus-summary-limit (gnus-sorted-nunion old older
))))
11980 (gnus-summary-position-point)))
11982 (defun gnus-summary-insert-new-articles ()
11983 "Insert all new articles in this group."
11986 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11987 (old-active gnus-newsgroup-active
)
11988 (nnmail-fetched-sources (list t
))
11990 (setq gnus-newsgroup-active
11991 (gnus-activate-group gnus-newsgroup-name
'scan
))
11992 (setq i
(cdr gnus-newsgroup-active
))
11993 (while (> i
(cdr old-active
))
11997 (message "No gnus is bad news.")
11998 (gnus-summary-insert-articles new
)
11999 (setq gnus-newsgroup-unreads
12000 (gnus-sorted-nunion gnus-newsgroup-unreads new
))
12001 (gnus-summary-limit (gnus-sorted-nunion old new
))))
12002 (gnus-summary-position-point)))
12004 (gnus-summary-make-all-marking-commands)
12006 (gnus-ems-redefine)
12008 (provide 'gnus-sum
)
12010 (run-hooks 'gnus-sum-load-hook
)
12012 ;; Local Variables:
12013 ;; coding: iso-8859-1
12016 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12017 ;;; gnus-sum.el ends here