1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (defvar tool-bar-map
))
43 (autoload 'gnus-summary-limit-include-cached
"gnus-cache" nil t
)
44 (autoload 'gnus-cache-write-active
"gnus-cache")
45 (autoload 'gnus-mailing-list-insinuate
"gnus-ml" nil t
)
46 (autoload 'turn-on-gnus-mailing-list-mode
"gnus-ml" nil t
)
47 (autoload 'mm-uu-dissect
"mm-uu")
48 (autoload 'gnus-article-outlook-deuglify-article
"deuglify"
49 "Deuglify broken Outlook (Express) articles and redisplay."
51 (autoload 'gnus-article-outlook-unwrap-lines
"deuglify" nil t
)
52 (autoload 'gnus-article-outlook-repair-attribution
"deuglify" nil t
)
53 (autoload 'gnus-article-outlook-rearrange-citation
"deuglify" nil t
)
55 (defcustom gnus-kill-summary-on-exit t
56 "*If non-nil, kill the summary buffer when you exit from it.
57 If nil, the summary will become a \"*Dead Summary*\" buffer, and
58 it will be killed sometime later."
59 :group
'gnus-summary-exit
62 (defcustom gnus-fetch-old-headers nil
63 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
64 If an unread article in the group refers to an older, already read (or
65 just marked as read) article, the old article will not normally be
66 displayed in the Summary buffer. If this variable is t, Gnus
67 will attempt to grab the headers to the old articles, and thereby
68 build complete threads. If it has the value `some', only enough
69 headers to connect otherwise loose threads will be displayed. This
70 variable can also be a number. In that case, no more than that number
71 of old headers will be fetched. If it has the value `invisible', all
72 old headers will be fetched, but none will be displayed.
74 The server has to support NOV for any of this to work."
76 :type
'(choice (const :tag
"off" nil
)
81 (sexp :menu-tag
"other" t
)))
83 (defcustom gnus-refer-thread-limit
200
84 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
85 If t, fetch all the available old headers."
88 (sexp :menu-tag
"other" t
)))
90 (defcustom gnus-summary-make-false-root
'adopt
91 "*nil means that Gnus won't gather loose threads.
92 If the root of a thread has expired or been read in a previous
93 session, the information necessary to build a complete thread has been
94 lost. Instead of having many small sub-threads from this original thread
95 scattered all over the summary buffer, Gnus can gather them.
97 If non-nil, Gnus will try to gather all loose sub-threads from an
98 original thread into one large thread.
100 If this variable is non-nil, it should be one of `none', `adopt',
103 If this variable is `none', Gnus will not make a false root, but just
104 present the sub-threads after another.
105 If this variable is `dummy', Gnus will create a dummy root that will
106 have all the sub-threads as children.
107 If this variable is `adopt', Gnus will make one of the \"children\"
108 the parent and mark all the step-children as such.
109 If this variable is `empty', the \"children\" are printed with empty
110 subject fields. (Or rather, they will be printed with a string
111 given by the `gnus-summary-same-subject' variable.)"
113 :type
'(choice (const :tag
"off" nil
)
119 (defcustom gnus-summary-make-false-root-always nil
120 "Always make a false dummy root."
125 (defcustom gnus-summary-gather-exclude-subject
"^ *$\\|^(none)$"
126 "*A regexp to match subjects to be excluded from loose thread gathering.
127 As loose thread gathering is done on subjects only, that means that
128 there can be many false gatherings performed. By rooting out certain
129 common subjects, gathering might become saner."
133 (defcustom gnus-summary-gather-subject-limit nil
134 "*Maximum length of subject comparisons when gathering loose threads.
135 Use nil to compare full subjects. Setting this variable to a low
136 number will help gather threads that have been corrupted by
137 newsreaders chopping off subject lines, but it might also mean that
138 unrelated articles that have subject that happen to begin with the
139 same few characters will be incorrectly gathered.
141 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
144 :type
'(choice (const :tag
"off" nil
)
146 (sexp :menu-tag
"on" t
)))
148 (defcustom gnus-simplify-subject-functions nil
149 "List of functions taking a string argument that simplify subjects.
150 The functions are applied recursively.
152 Useful functions to put in this list include:
153 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
154 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
156 :type
'(repeat function
))
158 (defcustom gnus-simplify-ignored-prefixes nil
159 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
161 :type
'(choice (const :tag
"off" nil
)
164 (defcustom gnus-build-sparse-threads nil
165 "*If non-nil, fill in the gaps in threads.
166 If `some', only fill in the gaps that are needed to tie loose threads
167 together. If `more', fill in all leaf nodes that Gnus can find. If
168 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
170 :type
'(choice (const :tag
"off" nil
)
173 (sexp :menu-tag
"all" t
)))
175 (defcustom gnus-summary-thread-gathering-function
176 'gnus-gather-threads-by-subject
177 "*Function used for gathering loose threads.
178 There are two pre-defined functions: `gnus-gather-threads-by-subject',
179 which only takes Subjects into consideration; and
180 `gnus-gather-threads-by-references', which compared the References
181 headers of the articles to find matches."
183 :type
'(radio (function-item gnus-gather-threads-by-subject
)
184 (function-item gnus-gather-threads-by-references
)
185 (function :tag
"other")))
187 (defcustom gnus-summary-same-subject
""
188 "*String indicating that the current article has the same subject as the previous.
189 This variable will only be used if the value of
190 `gnus-summary-make-false-root' is `empty'."
191 :group
'gnus-summary-format
194 (defcustom gnus-summary-goto-unread t
195 "*If t, many commands will go to the next unread article.
196 This applies to marking commands as well as other commands that
197 \"naturally\" select the next article, like, for instance, `SPC' at
198 the end of an article.
200 If nil, the marking commands do NOT go to the next unread article
201 \(they go to the next article instead). If `never', commands that
202 usually go to the next unread article, will go to the next article,
203 whether it is read or not."
204 :group
'gnus-summary-marks
205 :link
'(custom-manual "(gnus)Setting Marks")
206 :type
'(choice (const :tag
"off" nil
)
208 (sexp :menu-tag
"on" t
)))
210 (defcustom gnus-summary-default-score
0
211 "*Default article score level.
212 All scores generated by the score files will be added to this score.
213 If this variable is nil, scoring will be disabled."
214 :group
'gnus-score-default
215 :type
'(choice (const :tag
"disable")
218 (defcustom gnus-summary-default-high-score
0
219 "*Default threshold for a high scored article.
220 An article will be highlighted as high scored if its score is greater
223 :group
'gnus-score-default
226 (defcustom gnus-summary-default-low-score
0
227 "*Default threshold for a low scored article.
228 An article will be highlighted as low scored if its score is smaller
231 :group
'gnus-score-default
234 (defcustom gnus-summary-zcore-fuzz
0
235 "*Fuzziness factor for the zcore in the summary buffer.
236 Articles with scores closer than this to `gnus-summary-default-score'
238 :group
'gnus-summary-format
241 (defcustom gnus-simplify-subject-fuzzy-regexp nil
242 "*Strings to be removed when doing fuzzy matches.
243 This can either be a regular expression or list of regular expressions
244 that will be removed from subject strings if fuzzy subject
245 simplification is selected."
247 :type
'(repeat regexp
))
249 (defcustom gnus-show-threads t
250 "*If non-nil, display threads in summary mode."
254 (defcustom gnus-thread-hide-subtree nil
255 "*If non-nil, hide all threads initially.
256 This can be a predicate specifier which says which threads to hide.
257 If threads are hidden, you have to run the command
258 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
259 to expose hidden threads."
261 :type
'(radio (sexp :format
"Non-nil\n"
262 :match
(lambda (widget value
)
263 (not (or (consp value
) (functionp value
))))
266 (sexp :tag
"Predicate specifier" :size
0)))
268 (defcustom gnus-thread-hide-killed t
269 "*If non-nil, hide killed threads automatically."
273 (defcustom gnus-thread-ignore-subject t
274 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
275 If nil, articles that have different subjects from their parents will
276 start separate threads."
280 (defcustom gnus-thread-operation-ignore-subject t
281 "*If non-nil, subjects will be ignored when doing thread commands.
282 This affects commands like `gnus-summary-kill-thread' and
283 `gnus-summary-lower-thread'.
285 If this variable is nil, articles in the same thread with different
286 subjects will not be included in the operation in question. If this
287 variable is `fuzzy', only articles that have subjects that are fuzzily
288 equal will be included."
290 :type
'(choice (const :tag
"off" nil
)
294 (defcustom gnus-thread-indent-level
4
295 "*Number that says how much each sub-thread should be indented."
299 (defcustom gnus-auto-extend-newsgroup t
300 "*If non-nil, extend newsgroup forward and backward when requested."
301 :group
'gnus-summary-choose
304 (defcustom gnus-auto-select-first t
305 "*If non-nil, select the article under point.
306 Which article this is is controlled by the `gnus-auto-select-subject'
309 If you want to prevent automatic selection of articles in some
310 newsgroups, set the variable to nil in `gnus-select-group-hook'."
311 :group
'gnus-group-select
312 :type
'(choice (const :tag
"none" nil
)
313 (sexp :menu-tag
"first" t
)))
315 (defcustom gnus-auto-select-subject
'unread
316 "*Says what subject to place under point when entering a group.
318 This variable can either be the symbols `first' (place point on the
319 first subject), `unread' (place point on the subject line of the first
320 unread article), `best' (place point on the subject line of the
321 higest-scored article), `unseen' (place point on the subject line of
322 the first unseen article), 'unseen-or-unread' (place point on the subject
323 line of the first unseen article or, if all article have been seen, on the
324 subject line of the first unread article), or a function to be called to
325 place point on some subject line."
327 :group
'gnus-group-select
328 :type
'(choice (const best
)
332 (const unseen-or-unread
)))
334 (defcustom gnus-auto-select-next t
335 "*If non-nil, offer to go to the next group from the end of the previous.
336 If the value is t and the next newsgroup is empty, Gnus will exit
337 summary mode and go back to group mode. If the value is neither nil
338 nor t, Gnus will select the following unread newsgroup. In
339 particular, if the value is the symbol `quietly', the next unread
340 newsgroup will be selected without any confirmation, and if it is
341 `almost-quietly', the next group will be selected without any
342 confirmation if you are located on the last article in the group.
343 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
344 will go to the next group without confirmation."
345 :group
'gnus-summary-maneuvering
346 :type
'(choice (const :tag
"off" nil
)
348 (const almost-quietly
)
349 (const slightly-quietly
)
350 (sexp :menu-tag
"on" t
)))
352 (defcustom gnus-auto-select-same nil
353 "*If non-nil, select the next article with the same subject.
354 If there are no more articles with the same subject, go to
355 the first unread article."
356 :group
'gnus-summary-maneuvering
359 (defcustom gnus-auto-goto-ignores
'unfetched
360 "*Says how to handle unfetched articles when maneuvering.
362 This variable can either be the symbols nil (maneuver to any
363 article), `undownloaded' (maneuvering while unplugged ignores articles
364 that have not been fetched), `always-undownloaded' (maneuvering always
365 ignores articles that have not been fetched), `unfetched' (maneuvering
366 ignores articles whose headers have not been fetched).
368 NOTE: The list of unfetched articles will always be nil when plugged
369 and, when unplugged, a subset of the undownloaded article list."
371 :group
'gnus-summary-maneuvering
372 :type
'(choice (const :tag
"None" nil
)
373 (const :tag
"Undownloaded when unplugged" undownloaded
)
374 (const :tag
"Undownloaded" always-undownloaded
)
375 (const :tag
"Unfetched" unfetched
)))
377 (defcustom gnus-summary-check-current nil
378 "*If non-nil, consider the current article when moving.
379 The \"unread\" movement commands will stay on the same line if the
380 current article is unread."
381 :group
'gnus-summary-maneuvering
384 (defcustom gnus-auto-center-summary t
385 "*If non-nil, always center the current summary buffer.
386 In particular, if `vertical' do only vertical recentering. If non-nil
387 and non-`vertical', do both horizontal and vertical recentering."
388 :group
'gnus-summary-maneuvering
389 :type
'(choice (const :tag
"none" nil
)
391 (integer :tag
"height")
392 (sexp :menu-tag
"both" t
)))
394 (defvar gnus-auto-center-group t
395 "*If non-nil, always center the group buffer.")
397 (defcustom gnus-show-all-headers nil
398 "*If non-nil, don't hide any headers."
399 :group
'gnus-article-hiding
400 :group
'gnus-article-headers
403 (defcustom gnus-summary-ignore-duplicates nil
404 "*If non-nil, ignore articles with identical Message-ID headers."
408 (defcustom gnus-single-article-buffer t
409 "*If non-nil, display all articles in the same buffer.
410 If nil, each group will get its own article buffer."
411 :group
'gnus-article-various
414 (defcustom gnus-break-pages t
415 "*If non-nil, do page breaking on articles.
416 The page delimiter is specified by the `gnus-page-delimiter'
418 :group
'gnus-article-various
421 (defcustom gnus-move-split-methods nil
422 "*Variable used to suggest where articles are to be moved to.
423 It uses the same syntax as the `gnus-split-methods' variable.
424 However, whereas `gnus-split-methods' specifies file names as targets,
425 this variable specifies group names."
426 :group
'gnus-summary-mail
427 :type
'(repeat (choice (list :value
(fun) function
)
428 (cons :value
("" "") regexp
(repeat string
))
431 (defcustom gnus-unread-mark ?
;Whitespace
432 "*Mark used for unread articles."
433 :group
'gnus-summary-marks
436 (defcustom gnus-ticked-mark ?
!
437 "*Mark used for ticked articles."
438 :group
'gnus-summary-marks
441 (defcustom gnus-dormant-mark ??
442 "*Mark used for dormant articles."
443 :group
'gnus-summary-marks
446 (defcustom gnus-del-mark ?r
447 "*Mark used for del'd articles."
448 :group
'gnus-summary-marks
451 (defcustom gnus-read-mark ?R
452 "*Mark used for read articles."
453 :group
'gnus-summary-marks
456 (defcustom gnus-expirable-mark ?E
457 "*Mark used for expirable articles."
458 :group
'gnus-summary-marks
461 (defcustom gnus-killed-mark ?K
462 "*Mark used for killed articles."
463 :group
'gnus-summary-marks
466 (defcustom gnus-spam-mark ?$
467 "*Mark used for spam articles."
468 :group
'gnus-summary-marks
471 (defcustom gnus-souped-mark ?F
472 "*Mark used for souped articles."
473 :group
'gnus-summary-marks
476 (defcustom gnus-kill-file-mark ?X
477 "*Mark used for articles killed by kill files."
478 :group
'gnus-summary-marks
481 (defcustom gnus-low-score-mark ?Y
482 "*Mark used for articles with a low score."
483 :group
'gnus-summary-marks
486 (defcustom gnus-catchup-mark ?C
487 "*Mark used for articles that are caught up."
488 :group
'gnus-summary-marks
491 (defcustom gnus-replied-mark ?A
492 "*Mark used for articles that have been replied to."
493 :group
'gnus-summary-marks
496 (defcustom gnus-forwarded-mark ?F
497 "*Mark used for articles that have been forwarded."
499 :group
'gnus-summary-marks
502 (defcustom gnus-recent-mark ?N
503 "*Mark used for articles that are recent."
504 :group
'gnus-summary-marks
507 (defcustom gnus-cached-mark ?
*
508 "*Mark used for articles that are in the cache."
509 :group
'gnus-summary-marks
512 (defcustom gnus-saved-mark ?S
513 "*Mark used for articles that have been saved."
514 :group
'gnus-summary-marks
517 (defcustom gnus-unseen-mark ?.
518 "*Mark used for articles that haven't been seen."
520 :group
'gnus-summary-marks
523 (defcustom gnus-no-mark ?
;Whitespace
524 "*Mark used for articles that have no other secondary mark."
526 :group
'gnus-summary-marks
529 (defcustom gnus-ancient-mark ?O
530 "*Mark used for ancient articles."
531 :group
'gnus-summary-marks
534 (defcustom gnus-sparse-mark ?Q
535 "*Mark used for sparsely reffed articles."
536 :group
'gnus-summary-marks
539 (defcustom gnus-canceled-mark ?G
540 "*Mark used for canceled articles."
541 :group
'gnus-summary-marks
544 (defcustom gnus-duplicate-mark ?M
545 "*Mark used for duplicate articles."
546 :group
'gnus-summary-marks
549 (defcustom gnus-undownloaded-mark ?-
550 "*Mark used for articles that weren't downloaded."
551 :group
'gnus-summary-marks
554 (defcustom gnus-downloaded-mark ?
+
555 "*Mark used for articles that were downloaded."
556 :group
'gnus-summary-marks
559 (defcustom gnus-downloadable-mark ?%
560 "*Mark used for articles that are to be downloaded."
561 :group
'gnus-summary-marks
564 (defcustom gnus-unsendable-mark ?
=
565 "*Mark used for articles that won't be sent."
566 :group
'gnus-summary-marks
569 (defcustom gnus-score-over-mark ?
+
570 "*Score mark used for articles with high scores."
571 :group
'gnus-summary-marks
574 (defcustom gnus-score-below-mark ?-
575 "*Score mark used for articles with low scores."
576 :group
'gnus-summary-marks
579 (defcustom gnus-empty-thread-mark ?
;Whitespace
580 "*There is no thread under the article."
581 :group
'gnus-summary-marks
584 (defcustom gnus-not-empty-thread-mark ?
=
585 "*There is a thread under the article."
586 :group
'gnus-summary-marks
589 (defcustom gnus-view-pseudo-asynchronously nil
590 "*If non-nil, Gnus will view pseudo-articles asynchronously."
591 :group
'gnus-extract-view
594 (defcustom gnus-auto-expirable-marks
595 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
596 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
597 gnus-souped-mark gnus-duplicate-mark
)
598 "*The list of marks converted into expiration if a group is auto-expirable."
601 :type
'(repeat character
))
603 (defcustom gnus-inhibit-user-auto-expire t
604 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
609 (defcustom gnus-view-pseudos nil
610 "*If `automatic', pseudo-articles will be viewed automatically.
611 If `not-confirm', pseudos will be viewed automatically, and the user
612 will not be asked to confirm the command."
613 :group
'gnus-extract-view
614 :type
'(choice (const :tag
"off" nil
)
616 (const not-confirm
)))
618 (defcustom gnus-view-pseudos-separately t
619 "*If non-nil, one pseudo-article will be created for each file to be viewed.
620 If nil, all files that use the same viewing command will be given as a
621 list of parameters to that command."
622 :group
'gnus-extract-view
625 (defcustom gnus-insert-pseudo-articles t
626 "*If non-nil, insert pseudo-articles when decoding articles."
627 :group
'gnus-extract-view
630 (defcustom gnus-summary-dummy-line-format
632 "*The format specification for the dummy roots in the summary buffer.
633 It works along the same lines as a normal formatting string,
634 with some simple extensions.
638 General format specifiers can also be used.
639 See `(gnus)Formatting Variables'."
640 :link
'(custom-manual "(gnus)Formatting Variables")
641 :group
'gnus-threading
644 (defcustom gnus-summary-mode-line-format
"Gnus: %g [%A] %Z"
645 "*The format specification for the summary mode line.
646 It works along the same lines as a normal formatting string,
647 with some simple extensions:
650 %p Unprefixed group name
651 %A Current article number
652 %z Current article score
654 %U Number of unread articles in the group
655 %e Number of unselected articles in the group
656 %Z A string with unread/unselected article counts
657 %g Shortish group name
658 %S Subject of the current article
660 %s Current score file name
661 %d Number of dormant articles
662 %r Number of articles that have been marked as read in this session
663 %E Number of articles expunged by the score files"
664 :group
'gnus-summary-format
667 (defcustom gnus-list-identifiers nil
668 "Regexp that matches list identifiers to be removed from subject.
669 This can also be a list of regexps."
671 :group
'gnus-summary-format
672 :group
'gnus-article-hiding
673 :type
'(choice (const :tag
"none" nil
)
675 (repeat :value
(".*") regexp
)))
677 (defcustom gnus-summary-mark-below
0
678 "*Mark all articles with a score below this variable as read.
679 This variable is local to each summary buffer and usually set by the
681 :group
'gnus-score-default
684 (defcustom gnus-article-sort-functions
'(gnus-article-sort-by-number)
685 "*List of functions used for sorting articles in the summary buffer.
687 Each function takes two articles and returns non-nil if the first
688 article should be sorted before the other. If you use more than one
689 function, the primary sort function should be the last. You should
690 probably always include `gnus-article-sort-by-number' in the list of
691 sorting functions -- preferably first. Also note that sorting by date
692 is often much slower than sorting by number, and the sorting order is
693 very similar. (Sorting by date means sorting by the time the message
694 was sent, sorting by number means sorting by arrival time.)
696 Ready-made functions include `gnus-article-sort-by-number',
697 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
698 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
699 and `gnus-article-sort-by-score'.
701 When threading is turned on, the variable `gnus-thread-sort-functions'
702 controls how articles are sorted."
703 :group
'gnus-summary-sort
704 :type
'(repeat (choice (function-item gnus-article-sort-by-number
)
705 (function-item gnus-article-sort-by-author
)
706 (function-item gnus-article-sort-by-subject
)
707 (function-item gnus-article-sort-by-date
)
708 (function-item gnus-article-sort-by-score
)
709 (function-item gnus-article-sort-by-random
)
710 (function :tag
"other"))))
712 (defcustom gnus-thread-sort-functions
'(gnus-thread-sort-by-number)
713 "*List of functions used for sorting threads in the summary buffer.
714 By default, threads are sorted by article number.
716 Each function takes two threads and returns non-nil if the first
717 thread should be sorted before the other. If you use more than one
718 function, the primary sort function should be the last. You should
719 probably always include `gnus-thread-sort-by-number' in the list of
720 sorting functions -- preferably first. Also note that sorting by date
721 is often much slower than sorting by number, and the sorting order is
722 very similar. (Sorting by date means sorting by the time the message
723 was sent, sorting by number means sorting by arrival time.)
725 Ready-made functions include `gnus-thread-sort-by-number',
726 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
727 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
728 `gnus-thread-sort-by-most-recent-number',
729 `gnus-thread-sort-by-most-recent-date',
730 `gnus-thread-sort-by-random', and
731 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
733 When threading is turned off, the variable
734 `gnus-article-sort-functions' controls how articles are sorted."
735 :group
'gnus-summary-sort
736 :type
'(repeat (choice (function-item gnus-thread-sort-by-number
)
737 (function-item gnus-thread-sort-by-author
)
738 (function-item gnus-thread-sort-by-subject
)
739 (function-item gnus-thread-sort-by-date
)
740 (function-item gnus-thread-sort-by-score
)
741 (function-item gnus-thread-sort-by-total-score
)
742 (function-item gnus-thread-sort-by-random
)
743 (function :tag
"other"))))
745 (defcustom gnus-thread-score-function
'+
746 "*Function used for calculating the total score of a thread.
748 The function is called with the scores of the article and each
749 subthread and should then return the score of the thread.
751 Some functions you can use are `+', `max', or `min'."
752 :group
'gnus-summary-sort
755 (defcustom gnus-summary-expunge-below nil
756 "All articles that have a score less than this variable will be expunged.
757 This variable is local to the summary buffers."
758 :group
'gnus-score-default
759 :type
'(choice (const :tag
"off" nil
)
762 (defcustom gnus-thread-expunge-below nil
763 "All threads that have a total score less than this variable will be expunged.
764 See `gnus-thread-score-function' for en explanation of what a
767 This variable is local to the summary buffers."
768 :group
'gnus-threading
769 :group
'gnus-score-default
770 :type
'(choice (const :tag
"off" nil
)
773 (defcustom gnus-summary-mode-hook nil
774 "*A hook for Gnus summary mode.
775 This hook is run before any variables are set in the summary buffer."
776 :options
'(turn-on-gnus-mailing-list-mode gnus-pick-mode
)
777 :group
'gnus-summary-various
780 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
781 (when (featurep 'xemacs
)
782 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-summary-menu-add
)
783 (add-hook 'gnus-summary-mode-hook
'gnus-xmas-setup-summary-toolbar
)
784 (add-hook 'gnus-summary-mode-hook
785 'gnus-xmas-switch-horizontal-scrollbar-off
))
787 (defcustom gnus-summary-menu-hook nil
788 "*Hook run after the creation of the summary mode menu."
789 :group
'gnus-summary-visual
792 (defcustom gnus-summary-exit-hook nil
793 "*A hook called on exit from the summary buffer.
794 It will be called with point in the group buffer."
795 :group
'gnus-summary-exit
798 (defcustom gnus-summary-prepare-hook nil
799 "*A hook called after the summary buffer has been generated.
800 If you want to modify the summary buffer, you can use this hook."
801 :group
'gnus-summary-various
804 (defcustom gnus-summary-prepared-hook nil
805 "*A hook called as the last thing after the summary buffer has been generated."
806 :group
'gnus-summary-various
809 (defcustom gnus-summary-generate-hook nil
810 "*A hook run just before generating the summary buffer.
811 This hook is commonly used to customize threading variables and the
813 :group
'gnus-summary-various
816 (defcustom gnus-select-group-hook nil
817 "*A hook called when a newsgroup is selected.
819 If you'd like to simplify subjects like the
820 `gnus-summary-next-same-subject' command does, you can use the
823 (add-hook gnus-select-group-hook
825 (mapcar (lambda (header)
826 (mail-header-set-subject
828 (gnus-simplify-subject
829 (mail-header-subject header) 're-only)))
830 gnus-newsgroup-headers)))"
831 :group
'gnus-group-select
834 (defcustom gnus-select-article-hook nil
835 "*A hook called when an article is selected."
836 :group
'gnus-summary-choose
837 :options
'(gnus-agent-fetch-selected-article)
840 (defcustom gnus-visual-mark-article-hook
841 (list 'gnus-highlight-selected-summary
)
842 "*Hook run after selecting an article in the summary buffer.
843 It is meant to be used for highlighting the article in some way. It
844 is not run if `gnus-visual' is nil."
845 :group
'gnus-summary-visual
848 (defcustom gnus-parse-headers-hook nil
849 "*A hook called before parsing the headers."
853 (defcustom gnus-exit-group-hook nil
854 "*A hook called when exiting summary mode.
855 This hook is not called from the non-updating exit commands like `Q'."
859 (defcustom gnus-summary-update-hook
860 (list 'gnus-summary-highlight-line
)
861 "*A hook called when a summary line is changed.
862 The hook will not be called if `gnus-visual' is nil.
864 The default function `gnus-summary-highlight-line' will
865 highlight the line according to the `gnus-summary-highlight'
867 :group
'gnus-summary-visual
870 (defcustom gnus-mark-article-hook
'(gnus-summary-mark-read-and-unread-as-read)
871 "*A hook called when an article is selected for the first time.
872 The hook is intended to mark an article as read (or unread)
873 automatically when it is selected."
874 :group
'gnus-summary-choose
877 (defcustom gnus-group-no-more-groups-hook nil
878 "*A hook run when returning to group mode having no more (unread) groups."
879 :group
'gnus-group-select
882 (defcustom gnus-ps-print-hook nil
883 "*A hook run before ps-printing something from Gnus."
887 (defcustom gnus-summary-article-move-hook nil
888 "*A hook called after an article is moved, copied, respooled, or crossposted."
892 (defcustom gnus-summary-article-delete-hook nil
893 "*A hook called after an article is deleted."
897 (defcustom gnus-summary-article-expire-hook nil
898 "*A hook called after an article is expired."
902 (defcustom gnus-summary-display-arrow
903 (and (fboundp 'display-graphic-p
)
905 "*If non-nil, display an arrow highlighting the current article."
910 (defcustom gnus-summary-selected-face
'gnus-summary-selected-face
911 "Face used for highlighting the current article in the summary buffer."
912 :group
'gnus-summary-visual
915 (defvar gnus-tmp-downloaded nil
)
917 (defcustom gnus-summary-highlight
918 '(((eq mark gnus-canceled-mark
)
919 . gnus-summary-cancelled-face
)
920 ((and uncached
(> score default-high
))
921 . gnus-summary-high-undownloaded-face
)
922 ((and uncached
(< score default-low
))
923 . gnus-summary-low-undownloaded-face
)
925 . gnus-summary-normal-undownloaded-face
)
926 ((and (> score default-high
)
927 (or (eq mark gnus-dormant-mark
)
928 (eq mark gnus-ticked-mark
)))
929 . gnus-summary-high-ticked-face
)
930 ((and (< score default-low
)
931 (or (eq mark gnus-dormant-mark
)
932 (eq mark gnus-ticked-mark
)))
933 . gnus-summary-low-ticked-face
)
934 ((or (eq mark gnus-dormant-mark
)
935 (eq mark gnus-ticked-mark
))
936 . gnus-summary-normal-ticked-face
)
937 ((and (> score default-high
) (eq mark gnus-ancient-mark
))
938 . gnus-summary-high-ancient-face
)
939 ((and (< score default-low
) (eq mark gnus-ancient-mark
))
940 . gnus-summary-low-ancient-face
)
941 ((eq mark gnus-ancient-mark
)
942 . gnus-summary-normal-ancient-face
)
943 ((and (> score default-high
) (eq mark gnus-unread-mark
))
944 . gnus-summary-high-unread-face
)
945 ((and (< score default-low
) (eq mark gnus-unread-mark
))
946 . gnus-summary-low-unread-face
)
947 ((eq mark gnus-unread-mark
)
948 . gnus-summary-normal-unread-face
)
949 ((> score default-high
)
950 . gnus-summary-high-read-face
)
951 ((< score default-low
)
952 . gnus-summary-low-read-face
)
954 . gnus-summary-normal-read-face
))
955 "*Controls the highlighting of summary buffer lines.
957 A list of (FORM . FACE) pairs. When deciding how a a particular
958 summary line should be displayed, each form is evaluated. The content
959 of the face field after the first true form is used. You can change
960 how those summary lines are displayed, by editing the face field.
962 You can use the following variables in the FORM field.
964 score: The article's score
965 default: The default article score.
966 default-high: The default score for high scored articles.
967 default-low: The default score for low scored articles.
968 below: The score below which articles are automatically marked as read.
969 mark: The article's mark.
970 uncached: Non-nil if the article is uncached."
971 :group
'gnus-summary-visual
972 :type
'(repeat (cons (sexp :tag
"Form" nil
)
975 (defcustom gnus-alter-header-function nil
976 "Function called to allow alteration of article header structures.
977 The function is called with one parameter, the article header vector,
978 which it may alter in any way."
979 :type
'(choice (const :tag
"None" nil
)
981 :group
'gnus-summary
)
983 (defvar gnus-decode-encoded-word-function
'mail-decode-encoded-word-string
984 "Variable that says which function should be used to decode a string with encoded words.")
986 (defcustom gnus-extra-headers
'(To Newsgroups
)
987 "*Extra headers to parse."
990 :type
'(repeat symbol
))
992 (defcustom gnus-ignored-from-addresses
993 (and user-mail-address
(regexp-quote user-mail-address
))
994 "*Regexp of From headers that may be suppressed in favor of To headers."
999 (defcustom gnus-newsgroup-ignored-charsets
'(unknown-8bit x-unknown
)
1000 "List of charsets that should be ignored.
1001 When these charsets are used in the \"charset\" parameter, the
1002 default charset will be used instead."
1004 :type
'(repeat symbol
)
1005 :group
'gnus-charset
)
1007 (gnus-define-group-parameter
1011 "Return the ignored charsets of GROUP."
1012 :variable gnus-group-ignored-charsets-alist
1014 '(("alt\\.chinese\\.text" iso-8859-1
))
1016 "Alist of regexps (to match group names) and charsets that should be ignored.
1017 When these charsets are used in the \"charset\" parameter, the
1018 default charset will be used instead."
1019 :variable-group gnus-charset
1020 :variable-type
'(repeat (cons (regexp :tag
"Group")
1022 :parameter-type
'(choice :tag
"Ignored charsets"
1025 :parameter-document
"\
1026 List of charsets that should be ignored.
1028 When these charsets are used in the \"charset\" parameter, the
1029 default charset will be used instead.")
1031 (defcustom gnus-group-highlight-words-alist nil
1032 "Alist of group regexps and highlight regexps.
1033 This variable uses the same syntax as `gnus-emphasis-alist'."
1035 :type
'(repeat (cons (regexp :tag
"Group")
1036 (repeat (list (regexp :tag
"Highlight regexp")
1037 (number :tag
"Group for entire word" 0)
1038 (number :tag
"Group for displayed part" 0)
1040 gnus-emphasis-highlight-words
)))))
1041 :group
'gnus-summary-visual
)
1043 (defcustom gnus-summary-show-article-charset-alist
1045 "Alist of number and charset.
1046 The article will be shown with the charset corresponding to the
1048 For example: ((1 . cn-gb-2312) (2 . big5))."
1050 :type
'(repeat (cons (number :tag
"Argument" 1)
1051 (symbol :tag
"Charset")))
1052 :group
'gnus-charset
)
1054 (defcustom gnus-preserve-marks t
1055 "Whether marks are preserved when moving, copying and respooling messages."
1058 :group
'gnus-summary-marks
)
1060 (defcustom gnus-alter-articles-to-read-function nil
1061 "Function to be called to alter the list of articles to be selected."
1062 :type
'(choice (const nil
) function
)
1063 :group
'gnus-summary
)
1065 (defcustom gnus-orphan-score nil
1066 "*All orphans get this score added. Set in the score file."
1067 :group
'gnus-score-default
1068 :type
'(choice (const nil
)
1071 (defcustom gnus-summary-save-parts-default-mime
"image/.*"
1072 "*A regexp to match MIME parts when saving multiple parts of a
1073 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1074 This regexp will be used by default when prompting the user for which
1075 type of files to save."
1076 :group
'gnus-summary
1079 (defcustom gnus-read-all-available-headers nil
1080 "Whether Gnus should parse all headers made available to it.
1081 This is mostly relevant for slow back ends where the user may
1082 wish to widen the summary buffer to include all headers
1083 that were fetched. Say, for nnultimate groups."
1085 :group
'gnus-summary
1086 :type
'(choice boolean regexp
))
1088 (defcustom gnus-summary-muttprint-program
"muttprint"
1089 "Command (and optional arguments) used to run Muttprint."
1091 :group
'gnus-summary
1094 (defcustom gnus-article-loose-mime nil
1095 "If non-nil, don't require MIME-Version header.
1096 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1097 supply the MIME-Version header or deliberately strip it from the mail.
1098 Set it to non-nil, Gnus will treat some articles as MIME even if
1099 the MIME-Version header is missed."
1102 :group
'gnus-article-mime
)
1104 (defcustom gnus-article-emulate-mime t
1105 "If non-nil, use MIME emulation for uuencode and the like.
1106 This means that Gnus will search message bodies for text that look
1107 like uuencoded bits, yEncoded bits, and so on, and present that using
1108 the normal Gnus MIME machinery."
1111 :group
'gnus-article-mime
)
1113 ;;; Internal variables
1115 (defvar gnus-summary-display-cache nil
)
1116 (defvar gnus-article-mime-handles nil
)
1117 (defvar gnus-article-decoded-p nil
)
1118 (defvar gnus-article-charset nil
)
1119 (defvar gnus-article-ignored-charsets nil
)
1120 (defvar gnus-scores-exclude-files nil
)
1121 (defvar gnus-page-broken nil
)
1123 (defvar gnus-original-article nil
)
1124 (defvar gnus-article-internal-prepare-hook nil
)
1125 (defvar gnus-newsgroup-process-stack nil
)
1127 (defvar gnus-thread-indent-array nil
)
1128 (defvar gnus-thread-indent-array-level gnus-thread-indent-level
)
1129 (defvar gnus-sort-gathered-threads-function
'gnus-thread-sort-by-number
1130 "Function called to sort the articles within a thread after it has been gathered together.")
1132 (defvar gnus-summary-save-parts-type-history nil
)
1133 (defvar gnus-summary-save-parts-last-directory mm-default-directory
)
1135 ;; Avoid highlighting in kill files.
1136 (defvar gnus-summary-inhibit-highlight nil
)
1137 (defvar gnus-newsgroup-selected-overlay nil
)
1138 (defvar gnus-inhibit-limiting nil
)
1139 (defvar gnus-newsgroup-adaptive-score-file nil
)
1140 (defvar gnus-current-score-file nil
)
1141 (defvar gnus-current-move-group nil
)
1142 (defvar gnus-current-copy-group nil
)
1143 (defvar gnus-current-crosspost-group nil
)
1144 (defvar gnus-newsgroup-display nil
)
1146 (defvar gnus-newsgroup-dependencies nil
)
1147 (defvar gnus-newsgroup-adaptive nil
)
1148 (defvar gnus-summary-display-article-function nil
)
1149 (defvar gnus-summary-highlight-line-function nil
1150 "Function called after highlighting a summary line.")
1152 (defvar gnus-summary-line-format-alist
1153 `((?N
,(macroexpand '(mail-header-number gnus-tmp-header
)) ?d
)
1154 (?S
,(macroexpand '(mail-header-subject gnus-tmp-header
)) ?s
)
1155 (?s gnus-tmp-subject-or-nil ?s
)
1156 (?n gnus-tmp-name ?s
)
1157 (?A
(car (cdr (funcall gnus-extract-address-components gnus-tmp-from
)))
1159 (?a
(or (car (funcall gnus-extract-address-components gnus-tmp-from
))
1161 (?F gnus-tmp-from ?s
)
1162 (?x
,(macroexpand '(mail-header-xref gnus-tmp-header
)) ?s
)
1163 (?D
,(macroexpand '(mail-header-date gnus-tmp-header
)) ?s
)
1164 (?d
(gnus-dd-mmm (mail-header-date gnus-tmp-header
)) ?s
)
1165 (?o
(gnus-date-iso8601 (mail-header-date gnus-tmp-header
)) ?s
)
1166 (?M
,(macroexpand '(mail-header-id gnus-tmp-header
)) ?s
)
1167 (?r
,(macroexpand '(mail-header-references gnus-tmp-header
)) ?s
)
1168 (?c
(or (mail-header-chars gnus-tmp-header
) 0) ?d
)
1169 (?k
(gnus-summary-line-message-size gnus-tmp-header
) ?s
)
1170 (?L gnus-tmp-lines ?s
)
1171 (?O gnus-tmp-downloaded ?c
)
1172 (?I gnus-tmp-indentation ?s
)
1173 (?T
(if (= gnus-tmp-level
0) "" (make-string (frame-width) ?
)) ?s
)
1174 (?R gnus-tmp-replied ?c
)
1175 (?\
[ gnus-tmp-opening-bracket ?c
)
1176 (?\
] gnus-tmp-closing-bracket ?c
)
1177 (?\
> (make-string gnus-tmp-level ?
) ?s
)
1178 (?\
< (make-string (max 0 (- 20 gnus-tmp-level
)) ?
) ?s
)
1179 (?i gnus-tmp-score ?d
)
1180 (?z gnus-tmp-score-char ?c
)
1181 (?l
(bbb-grouplens-score gnus-tmp-header
) ?s
)
1182 (?V
(gnus-thread-total-score (and (boundp 'thread
) (car thread
))) ?d
)
1183 (?U gnus-tmp-unread ?c
)
1184 (?f
(gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from
)
1186 (?t
(gnus-summary-number-of-articles-in-thread
1187 (and (boundp 'thread
) (car thread
)) gnus-tmp-level
)
1189 (?e
(gnus-summary-number-of-articles-in-thread
1190 (and (boundp 'thread
) (car thread
)) gnus-tmp-level t
)
1192 (?u gnus-tmp-user-defined ?s
)
1193 (?P
(gnus-pick-line-number) ?d
)
1194 (?B gnus-tmp-thread-tree-header-string ?s
)
1195 (user-date (gnus-user-date
1196 ,(macroexpand '(mail-header-date gnus-tmp-header
))) ?s
))
1197 "An alist of format specifications that can appear in summary lines.
1198 These are paired with what variables they correspond with, along with
1199 the type of the variable (string, integer, character, etc).")
1201 (defvar gnus-summary-dummy-line-format-alist
1202 `((?S gnus-tmp-subject ?s
)
1203 (?N gnus-tmp-number ?d
)
1204 (?u gnus-tmp-user-defined ?s
)))
1206 (defvar gnus-summary-mode-line-format-alist
1207 `((?G gnus-tmp-group-name ?s
)
1208 (?g
(gnus-short-group-name gnus-tmp-group-name
) ?s
)
1209 (?p
(gnus-group-real-name gnus-tmp-group-name
) ?s
)
1210 (?A gnus-tmp-article-number ?d
)
1211 (?Z gnus-tmp-unread-and-unselected ?s
)
1212 (?V gnus-version ?s
)
1213 (?U gnus-tmp-unread-and-unticked ?d
)
1214 (?S gnus-tmp-subject ?s
)
1215 (?e gnus-tmp-unselected ?d
)
1216 (?u gnus-tmp-user-defined ?s
)
1217 (?d
(length gnus-newsgroup-dormant
) ?d
)
1218 (?t
(length gnus-newsgroup-marked
) ?d
)
1219 (?h
(length gnus-newsgroup-spam-marked
) ?d
)
1220 (?r
(length gnus-newsgroup-reads
) ?d
)
1221 (?z
(gnus-summary-article-score gnus-tmp-article-number
) ?d
)
1222 (?E gnus-newsgroup-expunged-tally ?d
)
1223 (?s
(gnus-current-score-file-nondirectory) ?s
)))
1225 (defvar gnus-last-search-regexp nil
1226 "Default regexp for article search command.")
1228 (defvar gnus-last-shell-command nil
1229 "Default shell command on article.")
1231 (defvar gnus-newsgroup-agentized nil
1232 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1233 (defvar gnus-newsgroup-begin nil
)
1234 (defvar gnus-newsgroup-end nil
)
1235 (defvar gnus-newsgroup-last-rmail nil
)
1236 (defvar gnus-newsgroup-last-mail nil
)
1237 (defvar gnus-newsgroup-last-folder nil
)
1238 (defvar gnus-newsgroup-last-file nil
)
1239 (defvar gnus-newsgroup-auto-expire nil
)
1240 (defvar gnus-newsgroup-active nil
)
1242 (defvar gnus-newsgroup-data nil
)
1243 (defvar gnus-newsgroup-data-reverse nil
)
1244 (defvar gnus-newsgroup-limit nil
)
1245 (defvar gnus-newsgroup-limits nil
)
1246 (defvar gnus-summary-use-undownloaded-faces nil
)
1248 (defvar gnus-newsgroup-unreads nil
1249 "Sorted list of unread articles in the current newsgroup.")
1251 (defvar gnus-newsgroup-unselected nil
1252 "Sorted list of unselected unread articles in the current newsgroup.")
1254 (defvar gnus-newsgroup-reads nil
1255 "Alist of read articles and article marks in the current newsgroup.")
1257 (defvar gnus-newsgroup-expunged-tally nil
)
1259 (defvar gnus-newsgroup-marked nil
1260 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1262 (defvar gnus-newsgroup-spam-marked nil
1263 "List of ranges of articles that have been marked as spam.")
1265 (defvar gnus-newsgroup-killed nil
1266 "List of ranges of articles that have been through the scoring process.")
1268 (defvar gnus-newsgroup-cached nil
1269 "Sorted list of articles that come from the article cache.")
1271 (defvar gnus-newsgroup-saved nil
1272 "List of articles that have been saved.")
1274 (defvar gnus-newsgroup-kill-headers nil
)
1276 (defvar gnus-newsgroup-replied nil
1277 "List of articles that have been replied to in the current newsgroup.")
1279 (defvar gnus-newsgroup-forwarded nil
1280 "List of articles that have been forwarded in the current newsgroup.")
1282 (defvar gnus-newsgroup-recent nil
1283 "List of articles that have are recent in the current newsgroup.")
1285 (defvar gnus-newsgroup-expirable nil
1286 "Sorted list of articles in the current newsgroup that can be expired.")
1288 (defvar gnus-newsgroup-processable nil
1289 "List of articles in the current newsgroup that can be processed.")
1291 (defvar gnus-newsgroup-downloadable nil
1292 "Sorted list of articles in the current newsgroup that can be processed.")
1294 (defvar gnus-newsgroup-unfetched nil
1295 "Sorted list of articles in the current newsgroup whose headers have
1296 not been fetched into the agent.
1298 This list will always be a subset of gnus-newsgroup-undownloaded.")
1300 (defvar gnus-newsgroup-undownloaded nil
1301 "List of articles in the current newsgroup that haven't been downloaded.")
1303 (defvar gnus-newsgroup-unsendable nil
1304 "List of articles in the current newsgroup that won't be sent.")
1306 (defvar gnus-newsgroup-bookmarks nil
1307 "List of articles in the current newsgroup that have bookmarks.")
1309 (defvar gnus-newsgroup-dormant nil
1310 "Sorted list of dormant articles in the current newsgroup.")
1312 (defvar gnus-newsgroup-unseen nil
1313 "List of unseen articles in the current newsgroup.")
1315 (defvar gnus-newsgroup-seen nil
1316 "Range of seen articles in the current newsgroup.")
1318 (defvar gnus-newsgroup-articles nil
1319 "List of articles in the current newsgroup.")
1321 (defvar gnus-newsgroup-scored nil
1322 "List of scored articles in the current newsgroup.")
1324 (defvar gnus-newsgroup-headers nil
1325 "List of article headers in the current newsgroup.")
1327 (defvar gnus-newsgroup-threads nil
)
1329 (defvar gnus-newsgroup-prepared nil
1330 "Whether the current group has been prepared properly.")
1332 (defvar gnus-newsgroup-ancient nil
1333 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1335 (defvar gnus-newsgroup-sparse nil
)
1337 (defvar gnus-current-article nil
)
1338 (defvar gnus-article-current nil
)
1339 (defvar gnus-current-headers nil
)
1340 (defvar gnus-have-all-headers nil
)
1341 (defvar gnus-last-article nil
)
1342 (defvar gnus-newsgroup-history nil
)
1343 (defvar gnus-newsgroup-charset nil
)
1344 (defvar gnus-newsgroup-ephemeral-charset nil
)
1345 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil
)
1347 (defvar gnus-article-before-search nil
)
1349 (defvar gnus-summary-local-variables
1350 '(gnus-newsgroup-name
1351 gnus-newsgroup-begin gnus-newsgroup-end
1352 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1353 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1354 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1355 gnus-newsgroup-unselected gnus-newsgroup-marked
1356 gnus-newsgroup-spam-marked
1357 gnus-newsgroup-reads gnus-newsgroup-saved
1358 gnus-newsgroup-replied gnus-newsgroup-forwarded
1359 gnus-newsgroup-recent
1360 gnus-newsgroup-expirable
1361 gnus-newsgroup-processable gnus-newsgroup-killed
1362 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1363 gnus-newsgroup-unfetched
1364 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1365 gnus-newsgroup-seen gnus-newsgroup-articles
1366 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1367 gnus-newsgroup-headers gnus-newsgroup-threads
1368 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1369 gnus-current-article gnus-current-headers gnus-have-all-headers
1370 gnus-last-article gnus-article-internal-prepare-hook
1371 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1372 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1373 gnus-thread-expunge-below
1374 gnus-score-alist gnus-current-score-file
1375 (gnus-summary-expunge-below . global
)
1376 (gnus-summary-mark-below . global
)
1377 (gnus-orphan-score . global
)
1378 gnus-newsgroup-active gnus-scores-exclude-files
1379 gnus-newsgroup-history gnus-newsgroup-ancient
1380 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1381 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring
)
1382 gnus-newsgroup-adaptive-score-file
(gnus-reffed-article-number . -
1)
1383 (gnus-newsgroup-expunged-tally .
0)
1384 gnus-cache-removable-articles gnus-newsgroup-cached
1385 gnus-newsgroup-data gnus-newsgroup-data-reverse
1386 gnus-newsgroup-limit gnus-newsgroup-limits
1387 gnus-newsgroup-charset gnus-newsgroup-display
1388 gnus-summary-use-undownloaded-faces
)
1389 "Variables that are buffer-local to the summary buffers.")
1391 (defvar gnus-newsgroup-variables nil
1392 "A list of variables that have separate values in different newsgroups.
1393 A list of newsgroup (summary buffer) local variables, or cons of
1394 variables and their default expressions to be evalled (when the default
1395 values are not nil), that should be made global while the summary buffer
1398 Note: The default expressions will be evaluated (using function `eval')
1399 before assignment to the local variable rather than just assigned to it.
1400 If the default expression is the symbol `global', that symbol will not
1401 be evaluated but the global value of the local variable will be used
1404 These variables can be used to set variables in the group parameters
1405 while still allowing them to affect operations done in other buffers.
1408 \(setq gnus-newsgroup-variables
1409 '(message-use-followup-to
1410 (gnus-visible-headers .
1411 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1414 ;; Byte-compiler warning.
1416 ;; Bind features so that require will believe that gnus-sum has
1417 ;; already been loaded (avoids infinite recursion)
1418 (let ((features (cons 'gnus-sum features
)))
1419 ;; Several of the declarations in gnus-sum are needed to load the
1420 ;; following files. Right now, these definitions have been
1421 ;; compiled but not defined (evaluated). We could either do a
1422 ;; eval-and-compile about all of the declarations or evaluate the
1424 (if (boundp 'gnus-newsgroup-variables
)
1426 (load "gnus-sum.el" t t t
))
1428 (require 'gnus-agent
)
1429 (require 'gnus-art
)))
1433 (defvar gnus-decode-encoded-word-methods
1434 '(mail-decode-encoded-word-string)
1435 "List of methods used to decode encoded words.
1437 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1438 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1439 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1440 whose names match REGEXP.
1443 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1444 mail-decode-encoded-word-string
1445 (\"chinese\" . rfc1843-decode-string))")
1447 (defvar gnus-decode-encoded-word-methods-cache nil
)
1449 (defun gnus-multi-decode-encoded-word-string (string)
1450 "Apply the functions from `gnus-encoded-word-methods' that match."
1451 (unless (and gnus-decode-encoded-word-methods-cache
1452 (eq gnus-newsgroup-name
1453 (car gnus-decode-encoded-word-methods-cache
)))
1454 (setq gnus-decode-encoded-word-methods-cache
(list gnus-newsgroup-name
))
1457 (nconc gnus-decode-encoded-word-methods-cache
(list x
))
1458 (if (and gnus-newsgroup-name
1459 (string-match (car x
) gnus-newsgroup-name
))
1460 (nconc gnus-decode-encoded-word-methods-cache
1462 gnus-decode-encoded-word-methods
))
1463 (let ((xlist gnus-decode-encoded-word-methods-cache
))
1466 (setq string
(funcall (pop xlist
) string
))))
1469 ;; Subject simplification.
1471 (defun gnus-simplify-whitespace (str)
1472 "Remove excessive whitespace from STR."
1474 (while (string-match "[ \t][ \t]+" str
)
1475 (setq str
(concat (substring str
0 (match-beginning 0))
1477 (substring str
(match-end 0)))))
1479 (when (string-match "^[ \t]+" str
)
1480 (setq str
(substring str
(match-end 0))))
1482 (when (string-match "[ \t]+$" str
)
1483 (setq str
(substring str
0 (match-beginning 0))))
1486 (defun gnus-simplify-all-whitespace (str)
1487 "Remove all whitespace from STR."
1488 (while (string-match "[ \t\n]+" str
)
1489 (setq str
(replace-match "" nil nil str
)))
1492 (defsubst gnus-simplify-subject-re
(subject)
1493 "Remove \"Re:\" from subject lines."
1494 (if (string-match message-subject-re-regexp subject
)
1495 (substring subject
(match-end 0))
1498 (defun gnus-simplify-subject (subject &optional re-only
)
1499 "Remove `Re:' and words in parentheses.
1500 If RE-ONLY is non-nil, strip leading `Re:'s only."
1501 (let ((case-fold-search t
)) ;Ignore case.
1502 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1503 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject
)
1504 (setq subject
(substring subject
(match-end 0))))
1505 ;; Remove uninteresting prefixes.
1506 (when (and (not re-only
)
1507 gnus-simplify-ignored-prefixes
1508 (string-match gnus-simplify-ignored-prefixes subject
))
1509 (setq subject
(substring subject
(match-end 0))))
1510 ;; Remove words in parentheses from end.
1512 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject
)
1513 (setq subject
(substring subject
0 (match-beginning 0)))))
1514 ;; Return subject string.
1517 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1519 (defsubst gnus-simplify-buffer-fuzzy-step
(regexp &optional newtext
)
1520 (goto-char (point-min))
1521 (while (re-search-forward regexp nil t
)
1522 (replace-match (or newtext
""))))
1524 (defun gnus-simplify-buffer-fuzzy ()
1525 "Simplify string in the buffer fuzzily.
1526 The string in the accessible portion of the current buffer is simplified.
1527 It is assumed to be a single-line subject.
1528 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1529 matter is removed. Additional things can be deleted by setting
1530 `gnus-simplify-subject-fuzzy-regexp'."
1531 (let ((case-fold-search t
)
1533 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1535 (while (not (eq modified-tick
(buffer-modified-tick)))
1536 (setq modified-tick
(buffer-modified-tick))
1538 ((listp gnus-simplify-subject-fuzzy-regexp
)
1539 (mapcar 'gnus-simplify-buffer-fuzzy-step
1540 gnus-simplify-subject-fuzzy-regexp
))
1541 (gnus-simplify-subject-fuzzy-regexp
1542 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp
)))
1543 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1544 (gnus-simplify-buffer-fuzzy-step
1545 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1546 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1548 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1549 (gnus-simplify-buffer-fuzzy-step " +" " ")
1550 (gnus-simplify-buffer-fuzzy-step " $")
1551 (gnus-simplify-buffer-fuzzy-step "^ +")))
1553 (defun gnus-simplify-subject-fuzzy (subject)
1554 "Simplify a subject string fuzzily.
1555 See `gnus-simplify-buffer-fuzzy' for details."
1557 (gnus-set-work-buffer)
1558 (let ((case-fold-search t
))
1559 ;; Remove uninteresting prefixes.
1560 (when (and gnus-simplify-ignored-prefixes
1561 (string-match gnus-simplify-ignored-prefixes subject
))
1562 (setq subject
(substring subject
(match-end 0))))
1564 (inline (gnus-simplify-buffer-fuzzy))
1567 (defsubst gnus-simplify-subject-fully
(subject)
1568 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1570 (gnus-simplify-subject-functions
1571 (gnus-map-function gnus-simplify-subject-functions subject
))
1572 ((null gnus-summary-gather-subject-limit
)
1573 (gnus-simplify-subject-re subject
))
1574 ((eq gnus-summary-gather-subject-limit
'fuzzy
)
1575 (gnus-simplify-subject-fuzzy subject
))
1576 ((numberp gnus-summary-gather-subject-limit
)
1577 (gnus-limit-string (gnus-simplify-subject-re subject
)
1578 gnus-summary-gather-subject-limit
))
1582 (defsubst gnus-subject-equal
(s1 s2
&optional simple-first
)
1583 "Check whether two subjects are equal.
1584 If optional argument SIMPLE-FIRST is t, first argument is already
1587 ((null simple-first
)
1588 (equal (gnus-simplify-subject-fully s1
)
1589 (gnus-simplify-subject-fully s2
)))
1592 (gnus-simplify-subject-fully s2
)))))
1594 (defun gnus-summary-bubble-group ()
1595 "Increase the score of the current group.
1596 This is a handy function to add to `gnus-summary-exit-hook' to
1597 increase the score of each group you read."
1598 (gnus-group-add-score gnus-newsgroup-name
))
1602 ;;; Gnus summary mode
1605 (put 'gnus-summary-mode
'mode-class
'special
)
1607 (defvar gnus-article-commands-menu
)
1609 ;; Non-orthogonal keys
1611 (gnus-define-keys gnus-summary-mode-map
1612 " " gnus-summary-next-page
1613 "\177" gnus-summary-prev-page
1614 [delete] gnus-summary-prev-page
1615 [backspace] gnus-summary-prev-page
1616 "\r" gnus-summary-scroll-up
1617 "\M-\r" gnus-summary-scroll-down
1618 "n" gnus-summary-next-unread-article
1619 "p" gnus-summary-prev-unread-article
1620 "N" gnus-summary-next-article
1621 "P" gnus-summary-prev-article
1622 "\M-\C-n" gnus-summary-next-same-subject
1623 "\M-\C-p" gnus-summary-prev-same-subject
1624 "\M-n" gnus-summary-next-unread-subject
1625 "\M-p" gnus-summary-prev-unread-subject
1626 "." gnus-summary-first-unread-article
1627 "," gnus-summary-best-unread-article
1628 "\M-s" gnus-summary-search-article-forward
1629 "\M-r" gnus-summary-search-article-backward
1630 "<" gnus-summary-beginning-of-article
1631 ">" gnus-summary-end-of-article
1632 "j" gnus-summary-goto-article
1633 "^" gnus-summary-refer-parent-article
1634 "\M-^" gnus-summary-refer-article
1635 "u" gnus-summary-tick-article-forward
1636 "!" gnus-summary-tick-article-forward
1637 "U" gnus-summary-tick-article-backward
1638 "d" gnus-summary-mark-as-read-forward
1639 "D" gnus-summary-mark-as-read-backward
1640 "E" gnus-summary-mark-as-expirable
1641 "\M-u" gnus-summary-clear-mark-forward
1642 "\M-U" gnus-summary-clear-mark-backward
1643 "k" gnus-summary-kill-same-subject-and-select
1644 "\C-k" gnus-summary-kill-same-subject
1645 "\M-\C-k" gnus-summary-kill-thread
1646 "\M-\C-l" gnus-summary-lower-thread
1647 "e" gnus-summary-edit-article
1648 "#" gnus-summary-mark-as-processable
1649 "\M-#" gnus-summary-unmark-as-processable
1650 "\M-\C-t" gnus-summary-toggle-threads
1651 "\M-\C-s" gnus-summary-show-thread
1652 "\M-\C-h" gnus-summary-hide-thread
1653 "\M-\C-f" gnus-summary-next-thread
1654 "\M-\C-b" gnus-summary-prev-thread
1655 [(meta down)] gnus-summary-next-thread
1656 [(meta up)] gnus-summary-prev-thread
1657 "\M-\C-u" gnus-summary-up-thread
1658 "\M-\C-d" gnus-summary-down-thread
1659 "&" gnus-summary-execute-command
1660 "c" gnus-summary-catchup-and-exit
1661 "\C-w" gnus-summary-mark-region-as-read
1662 "\C-t" gnus-summary-toggle-truncation
1663 "?" gnus-summary-mark-as-dormant
1664 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1665 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1666 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1667 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1668 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1669 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1670 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1671 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1672 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1673 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1674 "=" gnus-summary-expand-window
1675 "\C-x\C-s" gnus-summary-reselect-current-group
1676 "\M-g" gnus-summary-rescan-group
1677 "w" gnus-summary-stop-page-breaking
1678 "\C-c\C-r" gnus-summary-caesar-message
1679 "f" gnus-summary-followup
1680 "F" gnus-summary-followup-with-original
1681 "C" gnus-summary-cancel-article
1682 "r" gnus-summary-reply
1683 "R" gnus-summary-reply-with-original
1684 "\C-c\C-f" gnus-summary-mail-forward
1685 "o" gnus-summary-save-article
1686 "\C-o" gnus-summary-save-article-mail
1687 "|" gnus-summary-pipe-output
1688 "\M-k" gnus-summary-edit-local-kill
1689 "\M-K" gnus-summary-edit-global-kill
1691 "\C-c\C-d" gnus-summary-describe-group
1692 "q" gnus-summary-exit
1693 "Q" gnus-summary-exit-no-update
1694 "\C-c\C-i" gnus-info-find-node
1695 gnus-mouse-2 gnus-mouse-pick-article
1696 "m" gnus-summary-mail-other-window
1697 "a" gnus-summary-post-news
1698 "i" gnus-summary-news-other-window
1699 "x" gnus-summary-limit-to-unread
1700 "s" gnus-summary-isearch-article
1701 "t" gnus-summary-toggle-header
1702 "g" gnus-summary-show-article
1703 "l" gnus-summary-goto-last-article
1704 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1705 "\C-d" gnus-summary-enter-digest-group
1706 "\M-\C-d" gnus-summary-read-document
1707 "\M-\C-e" gnus-summary-edit-parameters
1708 "\M-\C-a" gnus-summary-customize-parameters
1710 "*" gnus-cache-enter-article
1711 "\M-*" gnus-cache-remove-article
1712 "\M-&" gnus-summary-universal-argument
1713 "\C-l" gnus-recenter
1714 "I" gnus-summary-increase-score
1715 "L" gnus-summary-lower-score
1716 "\M-i" gnus-symbolic-argument
1717 "h" gnus-summary-select-article-buffer
1719 "b" gnus-article-view-part
1720 "\M-t" gnus-summary-toggle-display-buttonized
1722 "V" gnus-summary-score-map
1723 "X" gnus-uu-extract-map
1724 "S" gnus-summary-send-map)
1726 ;; Sort of orthogonal keymap
1727 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1728 "t" gnus-summary-tick-article-forward
1729 "!" gnus-summary-tick-article-forward
1730 "d" gnus-summary-mark-as-read-forward
1731 "r" gnus-summary-mark-as-read-forward
1732 "c" gnus-summary-clear-mark-forward
1733 " " gnus-summary-clear-mark-forward
1734 "e" gnus-summary-mark-as-expirable
1735 "x" gnus-summary-mark-as-expirable
1736 "?" gnus-summary-mark-as-dormant
1737 "b" gnus-summary-set-bookmark
1738 "B" gnus-summary-remove-bookmark
1739 "#" gnus-summary-mark-as-processable
1740 "\M-#" gnus-summary-unmark-as-processable
1741 "S" gnus-summary-limit-include-expunged
1742 "C" gnus-summary-catchup
1743 "H" gnus-summary-catchup-to-here
1744 "h" gnus-summary-catchup-from-here
1745 "\C-c" gnus-summary-catchup-all
1746 "k" gnus-summary-kill-same-subject-and-select
1747 "K" gnus-summary-kill-same-subject
1748 "P" gnus-uu-mark-map)
1750 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1751 "c" gnus-summary-clear-above
1752 "u" gnus-summary-tick-above
1753 "m" gnus-summary-mark-above
1754 "k" gnus-summary-kill-below)
1756 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1757 "/" gnus-summary-limit-to-subject
1758 "n" gnus-summary-limit-to-articles
1759 "w" gnus-summary-pop-limit
1760 "s" gnus-summary-limit-to-subject
1761 "a" gnus-summary-limit-to-author
1762 "u" gnus-summary-limit-to-unread
1763 "m" gnus-summary-limit-to-marks
1764 "M" gnus-summary-limit-exclude-marks
1765 "v" gnus-summary-limit-to-score
1766 "*" gnus-summary-limit-include-cached
1767 "D" gnus-summary-limit-include-dormant
1768 "T" gnus-summary-limit-include-thread
1769 "d" gnus-summary-limit-exclude-dormant
1770 "t" gnus-summary-limit-to-age
1771 "." gnus-summary-limit-to-unseen
1772 "x" gnus-summary-limit-to-extra
1773 "p" gnus-summary-limit-to-display-predicate
1774 "E" gnus-summary-limit-include-expunged
1775 "c" gnus-summary-limit-exclude-childless-dormant
1776 "C" gnus-summary-limit-mark-excluded-as-read
1777 "o" gnus-summary-insert-old-articles
1778 "N" gnus-summary-insert-new-articles)
1780 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1781 "n" gnus-summary-next-unread-article
1782 "p" gnus-summary-prev-unread-article
1783 "N" gnus-summary-next-article
1784 "P" gnus-summary-prev-article
1785 "\C-n" gnus-summary-next-same-subject
1786 "\C-p" gnus-summary-prev-same-subject
1787 "\M-n" gnus-summary-next-unread-subject
1788 "\M-p" gnus-summary-prev-unread-subject
1789 "f" gnus-summary-first-unread-article
1790 "b" gnus-summary-best-unread-article
1791 "j" gnus-summary-goto-article
1792 "g" gnus-summary-goto-subject
1793 "l" gnus-summary-goto-last-article
1794 "o" gnus-summary-pop-article)
1796 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1797 "k" gnus-summary-kill-thread
1798 "l" gnus-summary-lower-thread
1799 "i" gnus-summary-raise-thread
1800 "T" gnus-summary-toggle-threads
1801 "t" gnus-summary-rethread-current
1802 "^" gnus-summary-reparent-thread
1803 "s" gnus-summary-show-thread
1804 "S" gnus-summary-show-all-threads
1805 "h" gnus-summary-hide-thread
1806 "H" gnus-summary-hide-all-threads
1807 "n" gnus-summary-next-thread
1808 "p" gnus-summary-prev-thread
1809 "u" gnus-summary-up-thread
1810 "o" gnus-summary-top-thread
1811 "d" gnus-summary-down-thread
1812 "#" gnus-uu-mark-thread
1813 "\M-#" gnus-uu-unmark-thread)
1815 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1816 "g" gnus-summary-prepare
1817 "c" gnus-summary-insert-cached-articles
1818 "d" gnus-summary-insert-dormant-articles)
1820 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1821 "c" gnus-summary-catchup-and-exit
1822 "C" gnus-summary-catchup-all-and-exit
1823 "E" gnus-summary-exit-no-update
1824 "Q" gnus-summary-exit
1825 "Z" gnus-summary-exit
1826 "n" gnus-summary-catchup-and-goto-next-group
1827 "R" gnus-summary-reselect-current-group
1828 "G" gnus-summary-rescan-group
1829 "N" gnus-summary-next-group
1830 "s" gnus-summary-save-newsrc
1831 "P" gnus-summary-prev-group)
1833 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1834 " " gnus-summary-next-page
1835 "n" gnus-summary-next-page
1836 "\177" gnus-summary-prev-page
1837 [delete] gnus-summary-prev-page
1838 "p" gnus-summary-prev-page
1839 "\r" gnus-summary-scroll-up
1840 "\M-\r" gnus-summary-scroll-down
1841 "<" gnus-summary-beginning-of-article
1842 ">" gnus-summary-end-of-article
1843 "b" gnus-summary-beginning-of-article
1844 "e" gnus-summary-end-of-article
1845 "^" gnus-summary-refer-parent-article
1846 "r" gnus-summary-refer-parent-article
1847 "D" gnus-summary-enter-digest-group
1848 "R" gnus-summary-refer-references
1849 "T" gnus-summary-refer-thread
1850 "g" gnus-summary-show-article
1851 "s" gnus-summary-isearch-article
1852 "P" gnus-summary-print-article
1853 "M" gnus-mailing-list-insinuate
1854 "t" gnus-article-babel
)
1856 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map
)
1857 "b" gnus-article-add-buttons
1858 "B" gnus-article-add-buttons-to-head
1859 "o" gnus-article-treat-overstrike
1860 "e" gnus-article-emphasize
1861 "w" gnus-article-fill-cited-article
1862 "Q" gnus-article-fill-long-lines
1863 "C" gnus-article-capitalize-sentences
1864 "c" gnus-article-remove-cr
1865 "q" gnus-article-de-quoted-unreadable
1866 "6" gnus-article-de-base64-unreadable
1867 "Z" gnus-article-decode-HZ
1868 "h" gnus-article-wash-html
1869 "u" gnus-article-unsplit-urls
1870 "s" gnus-summary-force-verify-and-decrypt
1871 "f" gnus-article-display-x-face
1872 "l" gnus-summary-stop-page-breaking
1873 "r" gnus-summary-caesar-message
1874 "m" gnus-summary-morse-message
1875 "t" gnus-summary-toggle-header
1876 "g" gnus-treat-smiley
1877 "v" gnus-summary-verbose-headers
1878 "a" gnus-article-strip-headers-in-body
;; mnemonic: wash archive
1879 "p" gnus-article-verify-x-pgp-sig
1880 "d" gnus-article-treat-dumbquotes
)
1882 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map
)
1883 ;; mnemonic: deuglif*Y*
1884 "u" gnus-article-outlook-unwrap-lines
1885 "a" gnus-article-outlook-repair-attribution
1886 "c" gnus-article-outlook-rearrange-citation
1887 "f" gnus-article-outlook-deuglify-article
) ;; mnemonic: full deuglify
1889 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map
)
1890 "a" gnus-article-hide
1891 "h" gnus-article-hide-headers
1892 "b" gnus-article-hide-boring-headers
1893 "s" gnus-article-hide-signature
1894 "c" gnus-article-hide-citation
1895 "C" gnus-article-hide-citation-in-followups
1896 "l" gnus-article-hide-list-identifiers
1897 "B" gnus-article-strip-banner
1898 "P" gnus-article-hide-pem
1899 "\C-c" gnus-article-hide-citation-maybe
)
1901 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map
)
1902 "a" gnus-article-highlight
1903 "h" gnus-article-highlight-headers
1904 "c" gnus-article-highlight-citation
1905 "s" gnus-article-highlight-signature
)
1907 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map
)
1908 "f" gnus-article-treat-fold-headers
1909 "u" gnus-article-treat-unfold-headers
1910 "n" gnus-article-treat-fold-newsgroups
)
1912 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map
)
1913 "x" gnus-article-display-x-face
1914 "d" gnus-article-display-face
1915 "s" gnus-treat-smiley
1916 "D" gnus-article-remove-images
1917 "f" gnus-treat-from-picon
1918 "m" gnus-treat-mail-picon
1919 "n" gnus-treat-newsgroups-picon
)
1921 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map
)
1922 "w" gnus-article-decode-mime-words
1923 "c" gnus-article-decode-charset
1924 "v" gnus-mime-view-all-parts
1925 "b" gnus-article-view-part
)
1927 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map
)
1928 "z" gnus-article-date-ut
1929 "u" gnus-article-date-ut
1930 "l" gnus-article-date-local
1931 "p" gnus-article-date-english
1932 "e" gnus-article-date-lapsed
1933 "o" gnus-article-date-original
1934 "i" gnus-article-date-iso8601
1935 "s" gnus-article-date-user
)
1937 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map
)
1938 "t" gnus-article-remove-trailing-blank-lines
1939 "l" gnus-article-strip-leading-blank-lines
1940 "m" gnus-article-strip-multiple-blank-lines
1941 "a" gnus-article-strip-blank-lines
1942 "A" gnus-article-strip-all-blank-lines
1943 "s" gnus-article-strip-leading-space
1944 "e" gnus-article-strip-trailing-space
1945 "w" gnus-article-remove-leading-whitespace
)
1947 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map
)
1949 "f" gnus-summary-fetch-faq
1950 "d" gnus-summary-describe-group
1951 "h" gnus-summary-describe-briefly
1952 "i" gnus-info-find-node
1953 "c" gnus-group-fetch-charter
1954 "C" gnus-group-fetch-control
)
1956 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map
)
1957 "e" gnus-summary-expire-articles
1958 "\M-\C-e" gnus-summary-expire-articles-now
1959 "\177" gnus-summary-delete-article
1960 [delete] gnus-summary-delete-article
1961 [backspace] gnus-summary-delete-article
1962 "m" gnus-summary-move-article
1963 "r" gnus-summary-respool-article
1964 "w" gnus-summary-edit-article
1965 "c" gnus-summary-copy-article
1966 "B" gnus-summary-crosspost-article
1967 "q" gnus-summary-respool-query
1968 "t" gnus-summary-respool-trace
1969 "i" gnus-summary-import-article
1970 "I" gnus-summary-create-article
1971 "p" gnus-summary-article-posted-p)
1973 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1974 "o" gnus-summary-save-article
1975 "m" gnus-summary-save-article-mail
1976 "F" gnus-summary-write-article-file
1977 "r" gnus-summary-save-article-rmail
1978 "f" gnus-summary-save-article-file
1979 "b" gnus-summary-save-article-body-file
1980 "h" gnus-summary-save-article-folder
1981 "v" gnus-summary-save-article-vm
1982 "p" gnus-summary-pipe-output
1983 "P" gnus-summary-muttprint
1984 "s" gnus-soup-add-article)
1986 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1987 "b" gnus-summary-display-buttonized
1988 "m" gnus-summary-repair-multipart
1989 "v" gnus-article-view-part
1990 "o" gnus-article-save-part
1991 "c" gnus-article-copy-part
1992 "C" gnus-article-view-part-as-charset
1993 "e" gnus-article-view-part-externally
1994 "E" gnus-article-encrypt-body
1995 "i" gnus-article-inline-part
1996 "|" gnus-article-pipe-part)
1998 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1999 "p" gnus-summary-mark-as-processable
2000 "u" gnus-summary-unmark-as-processable
2001 "U" gnus-summary-unmark-all-processable
2002 "v" gnus-uu-mark-over
2003 "s" gnus-uu-mark-series
2004 "r" gnus-uu-mark-region
2005 "g" gnus-uu-unmark-region
2006 "R" gnus-uu-mark-by-regexp
2007 "G" gnus-uu-unmark-by-regexp
2008 "t" gnus-uu-mark-thread
2009 "T" gnus-uu-unmark-thread
2010 "a" gnus-uu-mark-all
2011 "b" gnus-uu-mark-buffer
2012 "S" gnus-uu-mark-sparse
2013 "k" gnus-summary-kill-process-mark
2014 "y" gnus-summary-yank-process-mark
2015 "w" gnus-summary-save-process-mark
2016 "i" gnus-uu-invert-processable)
2018 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2019 ;;"x" gnus-uu-extract-any
2020 "m" gnus-summary-save-parts
2021 "u" gnus-uu-decode-uu
2022 "U" gnus-uu-decode-uu-and-save
2023 "s" gnus-uu-decode-unshar
2024 "S" gnus-uu-decode-unshar-and-save
2025 "o" gnus-uu-decode-save
2026 "O" gnus-uu-decode-save
2027 "b" gnus-uu-decode-binhex
2028 "B" gnus-uu-decode-binhex
2029 "p" gnus-uu-decode-postscript
2030 "P" gnus-uu-decode-postscript-and-save)
2033 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2034 "u" gnus-uu-decode-uu-view
2035 "U" gnus-uu-decode-uu-and-save-view
2036 "s" gnus-uu-decode-unshar-view
2037 "S" gnus-uu-decode-unshar-and-save-view
2038 "o" gnus-uu-decode-save-view
2039 "O" gnus-uu-decode-save-view
2040 "b" gnus-uu-decode-binhex-view
2041 "B" gnus-uu-decode-binhex-view
2042 "p" gnus-uu-decode-postscript-view
2043 "P" gnus-uu-decode-postscript-and-save-view)
2045 (defvar gnus-article-post-menu nil)
2047 (defconst gnus-summary-menu-maxlen 20)
2049 (defun gnus-summary-menu-split (menu)
2050 ;; If we have lots of elements, divide them into groups of 20
2051 ;; and make a pane (or submenu) for each one.
2052 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2053 (let ((menu menu) sublists next
2056 ;; Pull off the next gnus-summary-menu-maxlen elements
2057 ;; and make them the next element of sublist.
2058 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2060 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2062 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2063 (aref (car (last menu)) 0)) menu)
2067 (nreverse sublists))
2068 ;; Few elements--put them all in one pane.
2071 (defun gnus-summary-make-menu-bar ()
2072 (gnus-turn-off-edit-menu 'summary)
2074 (unless (boundp 'gnus-summary-misc-menu)
2077 gnus-summary-kill-menu gnus-summary-mode-map ""
2082 ["Customize" gnus-score-customize t])
2083 (gnus-make-score-map 'increase)
2084 (gnus-make-score-map 'lower)
2086 ["Kill below" gnus-summary-kill-below t]
2087 ["Mark above" gnus-summary-mark-above t]
2088 ["Tick above" gnus-summary-tick-above t]
2089 ["Clear above" gnus-summary-clear-above t])
2090 ["Current score" gnus-summary-current-score t]
2091 ["Set score" gnus-summary-set-score t]
2092 ["Switch current score file..." gnus-score-change-score-file t]
2093 ["Set mark below..." gnus-score-set-mark-below t]
2094 ["Set expunge below..." gnus-score-set-expunge-below t]
2095 ["Edit current score file" gnus-score-edit-current-scores t]
2096 ["Edit score file" gnus-score-edit-file t]
2097 ["Trace score" gnus-score-find-trace t]
2098 ["Find words" gnus-score-find-favourite-words t]
2099 ["Rescore buffer" gnus-summary-rescore t]
2100 ["Increase score..." gnus-summary-increase-score t]
2101 ["Lower score..." gnus-summary-lower-score t]))))
2103 ;; Define both the Article menu in the summary buffer and the
2104 ;; equivalent Commands menu in the article buffer here for
2108 ["All" gnus-article-hide t]
2109 ["Headers" gnus-article-hide-headers t]
2110 ["Signature" gnus-article-hide-signature t]
2111 ["Citation" gnus-article-hide-citation t]
2112 ["List identifiers" gnus-article-hide-list-identifiers t]
2113 ["Banner" gnus-article-strip-banner t]
2114 ["Boring headers" gnus-article-hide-boring-headers t])
2116 ["All" gnus-article-highlight t]
2117 ["Headers" gnus-article-highlight-headers t]
2118 ["Signature" gnus-article-highlight-signature t]
2119 ["Citation" gnus-article-highlight-citation t])
2121 ["Words" gnus-article-decode-mime-words t]
2122 ["Charset" gnus-article-decode-charset t]
2123 ["QP" gnus-article-de-quoted-unreadable t]
2124 ["Base64" gnus-article-de-base64-unreadable t]
2125 ["View MIME buttons" gnus-summary-display-buttonized t]
2126 ["View all" gnus-mime-view-all-parts t]
2127 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2128 ["Encrypt body" gnus-article-encrypt-body
2129 :active (not (gnus-group-read-only-p))
2130 ,@(if (featurep 'xemacs) nil
2131 '(:help "Encrypt the message body on disk"))]
2132 ["Extract all parts..." gnus-summary-save-parts t]
2134 ["Repair multipart" gnus-summary-repair-multipart t]
2135 ["Pipe part..." gnus-article-pipe-part t]
2136 ["Inline part" gnus-article-inline-part t]
2137 ["Encrypt body" gnus-article-encrypt-body
2138 :active (not (gnus-group-read-only-p))
2139 ,@(if (featurep 'xemacs) nil
2140 '(:help "Encrypt the message body on disk"))]
2141 ["View part externally" gnus-article-view-part-externally t]
2142 ["View part with charset..." gnus-article-view-part-as-charset t]
2143 ["Copy part" gnus-article-copy-part t]
2144 ["Save part..." gnus-article-save-part t]
2145 ["View part" gnus-article-view-part t]))
2147 ["Local" gnus-article-date-local t]
2148 ["ISO8601" gnus-article-date-iso8601 t]
2149 ["UT" gnus-article-date-ut t]
2150 ["Original" gnus-article-date-original t]
2151 ["Lapsed" gnus-article-date-lapsed t]
2152 ["User-defined" gnus-article-date-user t])
2154 ["Remove images" gnus-article-remove-images t]
2155 ["Toggle smiley" gnus-treat-smiley t]
2156 ["Show X-Face" gnus-article-display-x-face t]
2157 ["Show picons in From" gnus-treat-from-picon t]
2158 ["Show picons in mail headers" gnus-treat-mail-picon t]
2159 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2160 ("View as different encoding"
2161 ,@(gnus-summary-menu-split
2164 ;; Since easymenu under Emacs doesn't allow
2165 ;; lambda forms for menu commands, we should
2166 ;; provide intern'ed function symbols.
2167 (let ((command (intern (format "\
2168 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2172 (let ((gnus-summary-show-article-charset-alist
2174 (gnus-summary-show-article 1))))
2175 `[,(symbol-name cs) ,command t]))
2176 (sort (if (fboundp 'coding-system-list)
2177 (coding-system-list)
2178 (mapcar 'car mm-mime-mule-charset-alist))
2182 ["Leading" gnus-article-strip-leading-blank-lines t]
2183 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2184 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2185 ["All of the above" gnus-article-strip-blank-lines t]
2186 ["All" gnus-article-strip-all-blank-lines t]
2187 ["Leading space" gnus-article-strip-leading-space t]
2188 ["Trailing space" gnus-article-strip-trailing-space t]
2189 ["Leading space in headers"
2190 gnus-article-remove-leading-whitespace t])
2191 ["Overstrike" gnus-article-treat-overstrike t]
2192 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2193 ["Emphasis" gnus-article-emphasize t]
2194 ["Word wrap" gnus-article-fill-cited-article t]
2195 ["Fill long lines" gnus-article-fill-long-lines t]
2196 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2197 ["Remove CR" gnus-article-remove-cr t]
2198 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2199 ["Base64" gnus-article-de-base64-unreadable t]
2200 ["Rot 13" gnus-summary-caesar-message
2201 ,@(if (featurep 'xemacs) '(t)
2202 '(:help "\"Caesar rotate\" article by 13"))]
2203 ["Morse decode" gnus-summary-morse-message t]
2204 ["Unix pipe..." gnus-summary-pipe-message t]
2205 ["Add buttons" gnus-article-add-buttons t]
2206 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2207 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2208 ["Verbose header" gnus-summary-verbose-headers t]
2209 ["Toggle header" gnus-summary-toggle-header t]
2210 ["Unfold headers" gnus-article-treat-unfold-headers t]
2211 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2212 ["Html" gnus-article-wash-html t]
2213 ["Unsplit URLs" gnus-article-unsplit-urls t]
2214 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2215 ["Decode HZ" gnus-article-decode-HZ t]
2216 ("(Outlook) Deuglify"
2217 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2218 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2219 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2220 ["Full (Outlook) deuglify"
2221 gnus-article-outlook-deuglify-article t])
2224 ["Save in default format..." gnus-summary-save-article
2225 ,@(if (featurep 'xemacs) '(t)
2226 '(:help "Save article using default method"))]
2227 ["Save in file..." gnus-summary-save-article-file
2228 ,@(if (featurep 'xemacs) '(t)
2229 '(:help "Save article in file"))]
2230 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2231 ["Save in MH folder..." gnus-summary-save-article-folder t]
2232 ["Save in VM folder..." gnus-summary-save-article-vm t]
2233 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2234 ["Save body in file..." gnus-summary-save-article-body-file t]
2235 ["Pipe through a filter..." gnus-summary-pipe-output t]
2236 ["Add to SOUP packet" gnus-soup-add-article t]
2237 ["Print with Muttprint..." gnus-summary-muttprint t]
2238 ["Print" gnus-summary-print-article t])
2240 ["Respool article..." gnus-summary-respool-article t]
2241 ["Move article..." gnus-summary-move-article
2242 (gnus-check-backend-function
2243 'request-move-article gnus-newsgroup-name)]
2244 ["Copy article..." gnus-summary-copy-article t]
2245 ["Crosspost article..." gnus-summary-crosspost-article
2246 (gnus-check-backend-function
2247 'request-replace-article gnus-newsgroup-name)]
2248 ["Import file..." gnus-summary-import-article
2249 (gnus-check-backend-function
2250 'request-accept-article gnus-newsgroup-name)]
2251 ["Create article..." gnus-summary-create-article
2252 (gnus-check-backend-function
2253 'request-accept-article gnus-newsgroup-name)]
2254 ["Check if posted" gnus-summary-article-posted-p t]
2255 ["Edit article" gnus-summary-edit-article
2256 (not (gnus-group-read-only-p))]
2257 ["Delete article" gnus-summary-delete-article
2258 (gnus-check-backend-function
2259 'request-expire-articles gnus-newsgroup-name)]
2260 ["Query respool" gnus-summary-respool-query t]
2261 ["Trace respool" gnus-summary-respool-trace t]
2262 ["Delete expirable articles" gnus-summary-expire-articles-now
2263 (gnus-check-backend-function
2264 'request-expire-articles gnus-newsgroup-name)])
2266 ["Uudecode" gnus-uu-decode-uu
2267 ,@(if (featurep 'xemacs) '(t)
2268 '(:help "Decode uuencoded article(s)"))]
2269 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2270 ["Unshar" gnus-uu-decode-unshar t]
2271 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2272 ["Save" gnus-uu-decode-save t]
2273 ["Binhex" gnus-uu-decode-binhex t]
2274 ["Postscript" gnus-uu-decode-postscript t]
2275 ["All MIME parts" gnus-summary-save-parts t])
2277 ["Enter article" gnus-cache-enter-article t]
2278 ["Remove article" gnus-cache-remove-article t])
2279 ["Translate" gnus-article-babel t]
2280 ["Select article buffer" gnus-summary-select-article-buffer t]
2281 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2282 ["Isearch article..." gnus-summary-isearch-article t]
2283 ["Beginning of the article" gnus-summary-beginning-of-article t]
2284 ["End of the article" gnus-summary-end-of-article t]
2285 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2286 ["Fetch referenced articles" gnus-summary-refer-references t]
2287 ["Fetch current thread" gnus-summary-refer-thread t]
2288 ["Fetch article with id..." gnus-summary-refer-article t]
2289 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2290 ["Redisplay" gnus-summary-show-article t]
2291 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2293 gnus-summary-article-menu gnus-summary-mode-map ""
2294 (cons "Article" innards))
2296 (if (not (keymapp gnus-summary-article-menu))
2298 gnus-article-commands-menu gnus-article-mode-map ""
2299 (cons "Commands" innards))
2300 ;; in Emacs, don't share menu.
2301 (setq gnus-article-commands-menu
2302 (copy-keymap gnus-summary-article-menu))
2303 (define-key gnus-article-mode-map [menu-bar commands]
2304 (cons "Commands" gnus-article-commands-menu))))
2307 gnus-summary-thread-menu gnus-summary-mode-map ""
2309 ["Find all messages in thread" gnus-summary-refer-thread t]
2310 ["Toggle threading" gnus-summary-toggle-threads t]
2311 ["Hide threads" gnus-summary-hide-all-threads t]
2312 ["Show threads" gnus-summary-show-all-threads t]
2313 ["Hide thread" gnus-summary-hide-thread t]
2314 ["Show thread" gnus-summary-show-thread t]
2315 ["Go to next thread" gnus-summary-next-thread t]
2316 ["Go to previous thread" gnus-summary-prev-thread t]
2317 ["Go down thread" gnus-summary-down-thread t]
2318 ["Go up thread" gnus-summary-up-thread t]
2319 ["Top of thread" gnus-summary-top-thread t]
2320 ["Mark thread as read" gnus-summary-kill-thread t]
2321 ["Lower thread score" gnus-summary-lower-thread t]
2322 ["Raise thread score" gnus-summary-raise-thread t]
2323 ["Rethread current" gnus-summary-rethread-current t]))
2326 gnus-summary-post-menu gnus-summary-mode-map ""
2328 ["Send a message (mail or news)" gnus-summary-post-news
2329 ,@(if (featurep 'xemacs) '(t)
2330 '(:help "Post an article"))]
2331 ["Followup" gnus-summary-followup
2332 ,@(if (featurep 'xemacs) '(t)
2333 '(:help "Post followup to this article"))]
2334 ["Followup and yank" gnus-summary-followup-with-original
2335 ,@(if (featurep 'xemacs) '(t)
2336 '(:help "Post followup to this article, quoting its contents"))]
2337 ["Supersede article" gnus-summary-supersede-article t]
2338 ["Cancel article" gnus-summary-cancel-article
2339 ,@(if (featurep 'xemacs) '(t)
2340 '(:help "Cancel an article you posted"))]
2341 ["Reply" gnus-summary-reply t]
2342 ["Reply and yank" gnus-summary-reply-with-original t]
2343 ["Wide reply" gnus-summary-wide-reply t]
2344 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2345 ,@(if (featurep 'xemacs) '(t)
2346 '(:help "Mail a reply, quoting this article"))]
2347 ["Very wide reply" gnus-summary-very-wide-reply t]
2348 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2349 ,@(if (featurep 'xemacs) '(t)
2350 '(:help "Mail a very wide reply, quoting this article"))]
2351 ["Mail forward" gnus-summary-mail-forward t]
2352 ["Post forward" gnus-summary-post-forward t]
2353 ["Digest and mail" gnus-uu-digest-mail-forward t]
2354 ["Digest and post" gnus-uu-digest-post-forward t]
2355 ["Resend message" gnus-summary-resend-message t]
2356 ["Resend message edit" gnus-summary-resend-message-edit t]
2357 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2358 ["Send a mail" gnus-summary-mail-other-window t]
2359 ["Create a local message" gnus-summary-news-other-window t]
2360 ["Uuencode and post" gnus-uu-post-news
2361 ,@(if (featurep 'xemacs) '(t)
2362 '(:help "Post a uuencoded article"))]
2363 ["Followup via news" gnus-summary-followup-to-mail t]
2364 ["Followup via news and yank"
2365 gnus-summary-followup-to-mail-with-original t]
2367 ;;["Send" gnus-summary-send-draft t]
2368 ;;["Send bounced" gnus-resend-bounced-mail t])
2372 ((not (keymapp gnus-summary-post-menu))
2373 (setq gnus-article-post-menu gnus-summary-post-menu))
2374 ((not gnus-article-post-menu)
2375 ;; Don't share post menu.
2376 (setq gnus-article-post-menu
2377 (copy-keymap gnus-summary-post-menu))))
2378 (define-key gnus-article-mode-map [menu-bar post]
2379 (cons "Post" gnus-article-post-menu))
2382 gnus-summary-misc-menu gnus-summary-mode-map ""
2385 ["Mark as read" gnus-summary-mark-as-read-forward t]
2386 ["Mark same subject and select"
2387 gnus-summary-kill-same-subject-and-select t]
2388 ["Mark same subject" gnus-summary-kill-same-subject t]
2389 ["Catchup" gnus-summary-catchup
2390 ,@(if (featurep 'xemacs) '(t)
2391 '(:help "Mark unread articles in this group as read"))]
2392 ["Catchup all" gnus-summary-catchup-all t]
2393 ["Catchup to here" gnus-summary-catchup-to-here t]
2394 ["Catchup from here" gnus-summary-catchup-from-here t]
2395 ["Catchup region" gnus-summary-mark-region-as-read
2396 (gnus-mark-active-p)]
2397 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2399 ["Tick" gnus-summary-tick-article-forward t]
2400 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2401 ["Remove marks" gnus-summary-clear-mark-forward t]
2402 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2403 ["Set bookmark" gnus-summary-set-bookmark t]
2404 ["Remove bookmark" gnus-summary-remove-bookmark t])
2406 ["Marks..." gnus-summary-limit-to-marks t]
2407 ["Subject..." gnus-summary-limit-to-subject t]
2408 ["Author..." gnus-summary-limit-to-author t]
2409 ["Age..." gnus-summary-limit-to-age t]
2410 ["Extra..." gnus-summary-limit-to-extra t]
2411 ["Score..." gnus-summary-limit-to-score t]
2412 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2413 ["Unread" gnus-summary-limit-to-unread t]
2414 ["Unseen" gnus-summary-limit-to-unseen t]
2415 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2416 ["Next articles" gnus-summary-limit-to-articles t]
2417 ["Pop limit" gnus-summary-pop-limit t]
2418 ["Show dormant" gnus-summary-limit-include-dormant t]
2419 ["Hide childless dormant"
2420 gnus-summary-limit-exclude-childless-dormant t]
2421 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2422 ["Hide marked" gnus-summary-limit-exclude-marks t]
2423 ["Show expunged" gnus-summary-limit-include-expunged t])
2425 ["Set mark" gnus-summary-mark-as-processable t]
2426 ["Remove mark" gnus-summary-unmark-as-processable t]
2427 ["Remove all marks" gnus-summary-unmark-all-processable t]
2428 ["Mark above" gnus-uu-mark-over t]
2429 ["Mark series" gnus-uu-mark-series t]
2430 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2431 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2432 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2433 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2434 ["Mark all" gnus-uu-mark-all t]
2435 ["Mark buffer" gnus-uu-mark-buffer t]
2436 ["Mark sparse" gnus-uu-mark-sparse t]
2437 ["Mark thread" gnus-uu-mark-thread t]
2438 ["Unmark thread" gnus-uu-unmark-thread t]
2439 ("Process Mark Sets"
2440 ["Kill" gnus-summary-kill-process-mark t]
2441 ["Yank" gnus-summary-yank-process-mark
2442 gnus-newsgroup-process-stack]
2443 ["Save" gnus-summary-save-process-mark t]
2444 ["Run command on marked..." gnus-summary-universal-argument t]))
2446 ["Page forward" gnus-summary-next-page
2447 ,@(if (featurep 'xemacs) '(t)
2448 '(:help "Show next page of article"))]
2449 ["Page backward" gnus-summary-prev-page
2450 ,@(if (featurep 'xemacs) '(t)
2451 '(:help "Show previous page of article"))]
2452 ["Line forward" gnus-summary-scroll-up t])
2454 ["Next unread article" gnus-summary-next-unread-article t]
2455 ["Previous unread article" gnus-summary-prev-unread-article t]
2456 ["Next article" gnus-summary-next-article t]
2457 ["Previous article" gnus-summary-prev-article t]
2458 ["Next unread subject" gnus-summary-next-unread-subject t]
2459 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2460 ["Next article same subject" gnus-summary-next-same-subject t]
2461 ["Previous article same subject" gnus-summary-prev-same-subject t]
2462 ["First unread article" gnus-summary-first-unread-article t]
2463 ["Best unread article" gnus-summary-best-unread-article t]
2464 ["Go to subject number..." gnus-summary-goto-subject t]
2465 ["Go to article number..." gnus-summary-goto-article t]
2466 ["Go to the last article" gnus-summary-goto-last-article t]
2467 ["Pop article off history" gnus-summary-pop-article t])
2469 ["Sort by number" gnus-summary-sort-by-number t]
2470 ["Sort by author" gnus-summary-sort-by-author t]
2471 ["Sort by subject" gnus-summary-sort-by-subject t]
2472 ["Sort by date" gnus-summary-sort-by-date t]
2473 ["Sort by score" gnus-summary-sort-by-score t]
2474 ["Sort by lines" gnus-summary-sort-by-lines t]
2475 ["Sort by characters" gnus-summary-sort-by-chars t]
2476 ["Randomize" gnus-summary-sort-by-random t]
2477 ["Original sort" gnus-summary-sort-by-original t])
2479 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2480 ["Describe group" gnus-summary-describe-group t]
2481 ["Fetch charter" gnus-group-fetch-charter
2482 ,@(if (featurep 'xemacs) nil
2483 '(:help "Display the charter of the current group"))]
2484 ["Fetch control message" gnus-group-fetch-control
2485 ,@(if (featurep 'xemacs) nil
2486 '(:help "Display the archived control message for the current group"))]
2487 ["Read manual" gnus-info-find-node t])
2489 ["Pick and read" gnus-pick-mode t]
2490 ["Binary" gnus-binary-mode t])
2492 ["Regenerate" gnus-summary-prepare t]
2493 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2494 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2495 ["Toggle threading" gnus-summary-toggle-threads t])
2496 ["See old articles" gnus-summary-insert-old-articles t]
2497 ["See new articles" gnus-summary-insert-new-articles t]
2498 ["Filter articles..." gnus-summary-execute-command t]
2499 ["Run command on articles..." gnus-summary-universal-argument t]
2500 ["Search articles forward..." gnus-summary-search-article-forward t]
2501 ["Search articles backward..." gnus-summary-search-article-backward t]
2502 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2503 ["Expand window" gnus-summary-expand-window t]
2504 ["Expire expirable articles" gnus-summary-expire-articles
2505 (gnus-check-backend-function
2506 'request-expire-articles gnus-newsgroup-name)]
2507 ["Edit local kill file" gnus-summary-edit-local-kill t]
2508 ["Edit main kill file" gnus-summary-edit-global-kill t]
2509 ["Edit group parameters" gnus-summary-edit-parameters t]
2510 ["Customize group parameters" gnus-summary-customize-parameters t]
2511 ["Send a bug report" gnus-bug t]
2513 ["Catchup and exit" gnus-summary-catchup-and-exit
2514 ,@(if (featurep 'xemacs) '(t)
2515 '(:help "Mark unread articles in this group as read, then exit"))]
2516 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2517 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2518 ["Exit group" gnus-summary-exit
2519 ,@(if (featurep 'xemacs) '(t)
2520 '(:help "Exit current group, return to group selection mode"))]
2521 ["Exit group without updating" gnus-summary-exit-no-update t]
2522 ["Exit and goto next group" gnus-summary-next-group t]
2523 ["Exit and goto prev group" gnus-summary-prev-group t]
2524 ["Reselect group" gnus-summary-reselect-current-group t]
2525 ["Rescan group" gnus-summary-rescan-group t]
2526 ["Update dribble" gnus-summary-save-newsrc t])))
2528 (gnus-run-hooks 'gnus-summary-menu-hook)))
2530 (defvar gnus-summary-tool-bar-map nil)
2532 ;; Emacs 21 tool bar. Should be no-op otherwise.
2533 (defun gnus-summary-make-tool-bar ()
2534 (if (and (fboundp 'tool-bar-add-item-from-menu)
2535 (default-value 'tool-bar-mode)
2536 (not gnus-summary-tool-bar-map))
2537 (setq gnus-summary-tool-bar-map
2538 (let ((tool-bar-map (make-sparse-keymap))
2539 (load-path (mm-image-load-path)))
2540 (tool-bar-add-item-from-menu
2541 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2542 (tool-bar-add-item-from-menu
2543 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2544 (tool-bar-add-item-from-menu
2545 'gnus-summary-post-news "post" gnus-summary-mode-map)
2546 (tool-bar-add-item-from-menu
2547 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2548 (tool-bar-add-item-from-menu
2549 'gnus-summary-followup "followup" gnus-summary-mode-map)
2550 (tool-bar-add-item-from-menu
2551 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2552 (tool-bar-add-item-from-menu
2553 'gnus-summary-reply "reply" gnus-summary-mode-map)
2554 (tool-bar-add-item-from-menu
2555 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2556 (tool-bar-add-item-from-menu
2557 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2558 (tool-bar-add-item-from-menu
2559 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2560 (tool-bar-add-item-from-menu
2561 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2562 (tool-bar-add-item-from-menu
2563 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2564 (tool-bar-add-item-from-menu
2565 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2566 (tool-bar-add-item-from-menu
2567 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2568 (tool-bar-add-item-from-menu
2569 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2571 (if gnus-summary-tool-bar-map
2572 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2574 (defun gnus-score-set-default (var value)
2575 "A version of set that updates the GNU Emacs menu-bar."
2577 ;; It is the message that forces the active status to be updated.
2580 (defun gnus-make-score-map (type)
2581 "Make a summary score map of type TYPE."
2584 (let ((headers '(("author" "from" string)
2585 ("subject" "subject" string)
2586 ("article body" "body" string)
2587 ("article head" "head" string)
2588 ("xref" "xref" string)
2589 ("extra header" "extra" string)
2590 ("lines" "lines" number)
2591 ("followups to author" "followup" string)))
2592 (types '((number ("less than" <)
2595 (string ("substring" s)
2599 (perms '(("temporary" (current-time-string))
2607 (if (eq type 'lower)
2612 (setq header (car headers))
2618 (let ((ts (cdr (assoc (nth 2 header) types)))
2634 'gnus-summary-score-entry
2636 (if (or (string= (nth 1 header)
2638 (string= (nth 1 header)
2641 (list 'gnus-summary-header
2643 (list 'quote (nth 1 (car ts)))
2644 (list 'gnus-score-delta-default
2651 (list (nreverse outp))))
2654 (list (nreverse outt))))
2656 (setq headers (cdr headers)))
2657 (list (nreverse outh))))))))
2661 (defun gnus-summary-mode (&optional group)
2662 "Major mode for reading articles.
2664 All normal editing commands are switched off.
2665 \\<gnus-summary-mode-map>
2666 Each line in this buffer represents one article. To read an
2667 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2668 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2671 You can also post articles and send mail from this buffer. To
2672 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2673 of an article, type `\\[gnus-summary-reply]'.
2675 There are approx. one gazillion commands you can execute in this
2676 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2678 The following commands are available:
2680 \\{gnus-summary-mode-map}"
2682 (kill-all-local-variables)
2683 (when (gnus-visual-p 'summary-menu 'menu)
2684 (gnus-summary-make-menu-bar)
2685 (gnus-summary-make-tool-bar))
2686 (gnus-summary-make-local-variables)
2687 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2688 (gnus-summary-make-local-variables))
2689 (gnus-make-thread-indent-array)
2690 (gnus-simplify-mode-line)
2691 (setq major-mode 'gnus-summary-mode)
2692 (setq mode-name "Summary")
2693 (make-local-variable 'minor-mode-alist)
2694 (use-local-map gnus-summary-mode-map)
2695 (buffer-disable-undo)
2696 (setq buffer-read-only t) ;Disable modification
2697 (setq truncate-lines t)
2698 (setq selective-display t)
2699 (setq selective-display-ellipses t) ;Display `...'
2700 (gnus-summary-set-display-table)
2701 (gnus-set-default-directory)
2702 (setq gnus-newsgroup-name group)
2703 (make-local-variable 'gnus-summary-line-format)
2704 (make-local-variable 'gnus-summary-line-format-spec)
2705 (make-local-variable 'gnus-summary-dummy-line-format)
2706 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2707 (make-local-variable 'gnus-summary-mark-positions)
2708 (gnus-make-local-hook 'pre-command-hook)
2709 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2710 (gnus-run-hooks 'gnus-summary-mode-hook)
2711 (turn-on-gnus-mailing-list-mode)
2712 (mm-enable-multibyte)
2713 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2714 (gnus-update-summary-mark-positions))
2716 (defun gnus-summary-make-local-variables ()
2717 "Make all the local summary buffer variables."
2719 (dolist (local gnus-summary-local-variables)
2722 (if (eq (cdr local) 'global)
2723 ;; Copy the global value of the variable.
2724 (setq global (symbol-value (car local)))
2725 ;; Use the value from the list.
2726 (setq global (eval (cdr local))))
2727 (set (make-local-variable (car local)) global))
2728 ;; Simple nil-valued local variable.
2729 (set (make-local-variable local) nil)))))
2731 (defun gnus-summary-clear-local-variables ()
2732 (let ((locals gnus-summary-local-variables))
2734 (if (consp (car locals))
2735 (and (vectorp (caar locals))
2736 (set (caar locals) nil))
2737 (and (vectorp (car locals))
2738 (set (car locals) nil)))
2739 (setq locals (cdr locals)))))
2741 ;; Summary data functions.
2743 (defmacro gnus-data-number (data)
2746 (defmacro gnus-data-set-number (data number)
2747 `(setcar ,data ,number))
2749 (defmacro gnus-data-mark (data)
2752 (defmacro gnus-data-set-mark (data mark)
2753 `(setcar (nthcdr 1 ,data) ,mark))
2755 (defmacro gnus-data-pos (data)
2758 (defmacro gnus-data-set-pos (data pos)
2759 `(setcar (nthcdr 2 ,data) ,pos))
2761 (defmacro gnus-data-header (data)
2764 (defmacro gnus-data-set-header (data header)
2765 `(setf (nth 3 ,data) ,header))
2767 (defmacro gnus-data-level (data)
2770 (defmacro gnus-data-unread-p (data)
2771 `(= (nth 1 ,data) gnus-unread-mark))
2773 (defmacro gnus-data-read-p (data)
2774 `(/= (nth 1 ,data) gnus-unread-mark))
2776 (defmacro gnus-data-pseudo-p (data)
2777 `(consp (nth 3 ,data)))
2779 (defmacro gnus-data-find (number)
2780 `(assq ,number gnus-newsgroup-data))
2782 (defmacro gnus-data-find-list (number &optional data)
2783 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2784 (memq (assq ,number bdata)
2787 (defmacro gnus-data-make (number mark pos header level)
2788 `(list ,number ,mark ,pos ,header ,level))
2790 (defun gnus-data-enter (after-article number mark pos header level offset)
2791 (let ((data (gnus-data-find-list after-article)))
2793 (error "No such article: %d" after-article))
2794 (setcdr data (cons (gnus-data-make number mark pos header level)
2796 (setq gnus-newsgroup-data-reverse nil)
2797 (gnus-data-update-list (cddr data) offset)))
2799 (defun gnus-data-enter-list (after-article list &optional offset)
2801 (let ((data (and after-article (gnus-data-find-list after-article)))
2805 (let ((odata gnus-newsgroup-data))
2806 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2808 (gnus-data-update-list odata offset)))
2809 ;; Find the last element in the list to be spliced into the main
2812 (setq list (cdr list)))
2815 (setcdr list gnus-newsgroup-data)
2816 (setq gnus-newsgroup-data ilist)
2818 (gnus-data-update-list (cdr list) offset)))
2819 (setcdr list (cdr data))
2822 (gnus-data-update-list (cdr list) offset))))
2823 (setq gnus-newsgroup-data-reverse nil))))
2825 (defun gnus-data-remove (article &optional offset)
2826 (let ((data gnus-newsgroup-data))
2827 (if (= (gnus-data-number (car data)) article)
2829 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2830 gnus-newsgroup-data-reverse nil)
2832 (gnus-data-update-list gnus-newsgroup-data offset)))
2834 (when (= (gnus-data-number (cadr data)) article)
2835 (setcdr data (cddr data))
2837 (gnus-data-update-list (cdr data) offset))
2839 gnus-newsgroup-data-reverse nil))
2840 (setq data (cdr data))))))
2842 (defmacro gnus-data-list (backward)
2844 (or gnus-newsgroup-data-reverse
2845 (setq gnus-newsgroup-data-reverse
2846 (reverse gnus-newsgroup-data)))
2847 gnus-newsgroup-data))
2849 (defun gnus-data-update-list (data offset)
2850 "Add OFFSET to the POS of all data entries in DATA."
2851 (setq gnus-newsgroup-data-reverse nil)
2853 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2854 (setq data (cdr data))))
2856 (defun gnus-summary-article-pseudo-p (article)
2857 "Say whether this article is a pseudo article or not."
2858 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2860 (defmacro gnus-summary-article-sparse-p (article)
2861 "Say whether this article is a sparse article or not."
2862 `(memq ,article gnus-newsgroup-sparse))
2864 (defmacro gnus-summary-article-ancient-p (article)
2865 "Say whether this article is a sparse article or not."
2866 `(memq ,article gnus-newsgroup-ancient))
2868 (defun gnus-article-parent-p (number)
2869 "Say whether this article is a parent or not."
2870 (let ((data (gnus-data-find-list number)))
2871 (and (cdr data) ; There has to be an article after...
2872 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2873 (gnus-data-level (nth 1 data))))))
2875 (defun gnus-article-children (number)
2876 "Return a list of all children to NUMBER."
2877 (let* ((data (gnus-data-find-list number))
2878 (level (gnus-data-level (car data)))
2880 (setq data (cdr data))
2882 (= (gnus-data-level (car data)) (1+ level)))
2883 (push (gnus-data-number (car data)) children)
2884 (setq data (cdr data)))
2887 (defmacro gnus-summary-skip-intangible ()
2888 "If the current article is intangible, then jump to a different article."
2889 '(let ((to (get-text-property (point) 'gnus-intangible)))
2890 (and to (gnus-summary-goto-subject to))))
2892 (defmacro gnus-summary-article-intangible-p ()
2893 "Say whether this article is intangible or not."
2894 '(get-text-property (point) 'gnus-intangible))
2896 (defun gnus-article-read-p (article)
2897 "Say whether ARTICLE is read or not."
2898 (not (or (memq article gnus-newsgroup-marked)
2899 (memq article gnus-newsgroup-spam-marked)
2900 (memq article gnus-newsgroup-unreads)
2901 (memq article gnus-newsgroup-unselected)
2902 (memq article gnus-newsgroup-dormant))))
2904 ;; Some summary mode macros.
2906 (defmacro gnus-summary-article-number ()
2907 "The article number of the article on the current line.
2908 If there isn't an article number here, then we return the current
2911 (gnus-summary-skip-intangible)
2912 (or (get-text-property (point) 'gnus-number)
2913 (gnus-summary-last-subject))))
2915 (defmacro gnus-summary-article-header (&optional number)
2916 "Return the header of article NUMBER."
2917 `(gnus-data-header (gnus-data-find
2918 ,(or number '(gnus-summary-article-number)))))
2920 (defmacro gnus-summary-thread-level (&optional number)
2921 "Return the level of thread that starts with article NUMBER."
2922 `(if (and (eq gnus-summary-make-false-root 'dummy)
2923 (get-text-property (point) 'gnus-intangible))
2925 (gnus-data-level (gnus-data-find
2926 ,(or number '(gnus-summary-article-number))))))
2928 (defmacro gnus-summary-article-mark (&optional number)
2929 "Return the mark of article NUMBER."
2930 `(gnus-data-mark (gnus-data-find
2931 ,(or number '(gnus-summary-article-number)))))
2933 (defmacro gnus-summary-article-pos (&optional number)
2934 "Return the position of the line of article NUMBER."
2935 `(gnus-data-pos (gnus-data-find
2936 ,(or number '(gnus-summary-article-number)))))
2938 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2939 (defmacro gnus-summary-article-subject (&optional number)
2940 "Return current subject string or nil if nothing."
2943 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2944 '(gnus-data-header (assq (gnus-summary-article-number)
2945 gnus-newsgroup-data)))))
2948 (mail-header-subject headers))))
2950 (defmacro gnus-summary-article-score (&optional number)
2951 "Return current article score."
2952 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2953 gnus-newsgroup-scored))
2954 gnus-summary-default-score 0))
2956 (defun gnus-summary-article-children (&optional number)
2957 "Return a list of article numbers that are children of article NUMBER."
2958 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2959 (level (gnus-data-level (car data)))
2961 (while (and (setq data (cdr data))
2962 (> (setq l (gnus-data-level (car data))) level))
2963 (and (= (1+ level) l)
2964 (push (gnus-data-number (car data))
2966 (nreverse children)))
2968 (defun gnus-summary-article-parent (&optional number)
2969 "Return the article number of the parent of article NUMBER."
2970 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2971 (gnus-data-list t)))
2972 (level (gnus-data-level (car data))))
2974 () ; This is a root.
2975 ;; We search until we find an article with a level less than
2976 ;; this one. That function has to be the parent.
2977 (while (and (setq data (cdr data))
2978 (not (< (gnus-data-level (car data)) level))))
2979 (and data (gnus-data-number (car data))))))
2981 (defun gnus-unread-mark-p (mark)
2982 "Say whether MARK is the unread mark."
2983 (= mark gnus-unread-mark))
2985 (defun gnus-read-mark-p (mark)
2986 "Say whether MARK is one of the marks that mark as read.
2987 This is all marks except unread, ticked, dormant, and expirable."
2988 (not (or (= mark gnus-unread-mark)
2989 (= mark gnus-ticked-mark)
2990 (= mark gnus-spam-mark)
2991 (= mark gnus-dormant-mark)
2992 (= mark gnus-expirable-mark))))
2994 (defmacro gnus-article-mark (number)
2995 "Return the MARK of article NUMBER.
2996 This macro should only be used when computing the mark the \"first\"
2997 time; i.e., when generating the summary lines. After that,
2998 `gnus-summary-article-mark' should be used to examine the
3001 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3002 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3003 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3004 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3005 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3006 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3007 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3008 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3009 gnus-ancient-mark))))
3011 ;; Saving hidden threads.
3013 (defmacro gnus-save-hidden-threads (&rest forms)
3014 "Save hidden threads, eval FORMS, and restore the hidden threads."
3015 (let ((config (make-symbol "config")))
3016 `(let ((,config (gnus-hidden-threads-configuration)))
3020 (gnus-restore-hidden-threads-configuration ,config)))))
3021 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3022 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3024 (defun gnus-data-compute-positions ()
3025 "Compute the positions of all articles."
3026 (setq gnus-newsgroup-data-reverse nil)
3027 (let ((data gnus-newsgroup-data))
3029 (gnus-save-hidden-threads
3030 (gnus-summary-show-all-threads)
3031 (goto-char (point-min))
3033 (while (get-text-property (point) 'gnus-intangible)
3035 (gnus-data-set-pos (car data) (+ (point) 3))
3036 (setq data (cdr data))
3037 (forward-line 1))))))
3039 (defun gnus-hidden-threads-configuration ()
3040 "Return the current hidden threads configuration."
3043 (goto-char (point-min))
3044 (while (search-forward "\r" nil t)
3045 (push (1- (point)) config))
3048 (defun gnus-restore-hidden-threads-configuration (config)
3049 "Restore hidden threads configuration from CONFIG."
3051 (let (point buffer-read-only)
3052 (while (setq point (pop config))
3053 (when (and (< point (point-max))
3055 (eq (char-after) ?\n))
3056 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3058 ;; Various summary mode internalish functions.
3060 (defun gnus-mouse-pick-article (e)
3063 (gnus-summary-next-page nil t))
3065 (defun gnus-summary-set-display-table ()
3066 "Change the display table.
3067 Odd characters have a tendency to mess
3068 up nicely formatted displays - we make all possible glyphs
3069 display only a single character."
3071 ;; We start from the standard display table, if any.
3072 (let ((table (or (copy-sequence standard-display-table)
3073 (make-display-table)))
3075 ;; Nix out all the control chars...
3076 (while (>= (setq i (1- i)) 0)
3077 (aset table i [??]))
3078 ;; ... but not newline and cr, of course. (cr is necessary for the
3079 ;; selective display).
3080 (aset table ?\n nil)
3081 (aset table ?\r nil)
3082 ;; We keep TAB as well.
3083 (aset table ?\t nil)
3084 ;; We nix out any glyphs over 126 that are not set already.
3086 (while (>= (setq i (1- i)) 127)
3087 ;; Only modify if the entry is nil.
3088 (unless (aref table i)
3089 (aset table i [??]))))
3090 (setq buffer-display-table table)))
3092 (defun gnus-summary-set-article-display-arrow (pos)
3093 "Update the overlay arrow to point to line at position POS."
3094 (when (and gnus-summary-display-arrow
3095 (boundp 'overlay-arrow-position)
3096 (boundp 'overlay-arrow-string))
3100 (unless overlay-arrow-position
3101 (setq overlay-arrow-position (make-marker)))
3102 (setq overlay-arrow-string "=>"
3103 overlay-arrow-position (set-marker overlay-arrow-position
3105 (current-buffer))))))
3107 (defun gnus-summary-setup-buffer (group)
3108 "Initialize summary buffer."
3109 (let ((buffer (gnus-summary-buffer-name group))
3110 (dead-name (concat "*Dead Summary "
3111 (gnus-group-decoded-name group) "*")))
3112 ;; If a dead summary buffer exists, we kill it.
3113 (when (gnus-buffer-live-p dead-name)
3114 (gnus-kill-buffer dead-name))
3115 (if (get-buffer buffer)
3118 (setq gnus-summary-buffer (current-buffer))
3119 (not gnus-newsgroup-prepared))
3120 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3121 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3122 (gnus-summary-mode group)
3124 (gnus-carpal-setup-buffer 'summary))
3125 (unless gnus-single-article-buffer
3126 (make-local-variable 'gnus-article-buffer)
3127 (make-local-variable 'gnus-article-current)
3128 (make-local-variable 'gnus-original-article-buffer))
3129 (setq gnus-newsgroup-name group)
3130 ;; Set any local variables in the group parameters.
3131 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3134 (defun gnus-set-global-variables ()
3135 "Set the global equivalents of the buffer-local variables.
3136 They are set to the latest values they had. These reflect the summary
3137 buffer that was in action when the last article was fetched."
3138 (when (eq major-mode 'gnus-summary-mode)
3139 (setq gnus-summary-buffer (current-buffer))
3140 (let ((name gnus-newsgroup-name)
3141 (marked gnus-newsgroup-marked)
3142 (spam gnus-newsgroup-spam-marked)
3143 (unread gnus-newsgroup-unreads)
3144 (headers gnus-current-headers)
3145 (data gnus-newsgroup-data)
3146 (summary gnus-summary-buffer)
3147 (article-buffer gnus-article-buffer)
3148 (original gnus-original-article-buffer)
3149 (gac gnus-article-current)
3150 (reffed gnus-reffed-article-number)
3151 (score-file gnus-current-score-file)
3152 (default-charset gnus-newsgroup-charset)
3154 (let ((locals gnus-newsgroup-variables))
3156 (if (consp (car locals))
3157 (push (eval (caar locals)) vlist)
3158 (push (eval (car locals)) vlist))
3159 (setq locals (cdr locals)))
3160 (setq vlist (nreverse vlist)))
3162 (set-buffer gnus-group-buffer)
3163 (setq gnus-newsgroup-name name
3164 gnus-newsgroup-marked marked
3165 gnus-newsgroup-spam-marked spam
3166 gnus-newsgroup-unreads unread
3167 gnus-current-headers headers
3168 gnus-newsgroup-data data
3169 gnus-article-current gac
3170 gnus-summary-buffer summary
3171 gnus-article-buffer article-buffer
3172 gnus-original-article-buffer original
3173 gnus-reffed-article-number reffed
3174 gnus-current-score-file score-file
3175 gnus-newsgroup-charset default-charset)
3176 (let ((locals gnus-newsgroup-variables))
3178 (if (consp (car locals))
3179 (set (caar locals) (pop vlist))
3180 (set (car locals) (pop vlist)))
3181 (setq locals (cdr locals))))
3182 ;; The article buffer also has local variables.
3183 (when (gnus-buffer-live-p gnus-article-buffer)
3184 (set-buffer gnus-article-buffer)
3185 (setq gnus-summary-buffer summary))))))
3187 (defun gnus-summary-article-unread-p (article)
3188 "Say whether ARTICLE is unread or not."
3189 (memq article gnus-newsgroup-unreads))
3191 (defun gnus-summary-first-article-p (&optional article)
3192 "Return whether ARTICLE is the first article in the buffer."
3193 (if (not (setq article (or article (gnus-summary-article-number))))
3195 (eq article (caar gnus-newsgroup-data))))
3197 (defun gnus-summary-last-article-p (&optional article)
3198 "Return whether ARTICLE is the last article in the buffer."
3199 (if (not (setq article (or article (gnus-summary-article-number))))
3200 ;; All non-existent numbers are the last article. :-)
3202 (not (cdr (gnus-data-find-list article)))))
3204 (defun gnus-make-thread-indent-array ()
3206 (unless (and gnus-thread-indent-array
3207 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3208 (setq gnus-thread-indent-array (make-vector 201 "")
3209 gnus-thread-indent-array-level gnus-thread-indent-level)
3211 (aset gnus-thread-indent-array n
3212 (make-string (* n gnus-thread-indent-level) ? ))
3215 (defun gnus-update-summary-mark-positions ()
3216 "Compute where the summary marks are to go."
3218 (when (gnus-buffer-exists-p gnus-summary-buffer)
3219 (set-buffer gnus-summary-buffer))
3220 (let ((gnus-replied-mark 129)
3221 (gnus-score-below-mark 130)
3222 (gnus-score-over-mark 130)
3223 (gnus-undownloaded-mark 131)
3224 (spec gnus-summary-line-format-spec)
3227 (gnus-set-work-buffer)
3228 (let ((gnus-summary-line-format-spec spec)
3229 (gnus-newsgroup-downloadable '(0)))
3230 (gnus-summary-insert-line
3231 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3232 0 nil t 128 t nil "" nil 1)
3233 (goto-char (point-min))
3234 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3235 (- (point) (point-min) 1)))))
3236 (goto-char (point-min))
3237 (push (cons 'replied (and (search-forward "\201" nil t)
3238 (- (point) (point-min) 1)))
3240 (goto-char (point-min))
3241 (push (cons 'score (and (search-forward "\202" nil t)
3242 (- (point) (point-min) 1)))
3244 (goto-char (point-min))
3245 (push (cons 'download
3246 (and (search-forward "\203" nil t)
3247 (- (point) (point-min) 1)))
3249 (setq gnus-summary-mark-positions pos))))
3251 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3252 "Insert a dummy root in the summary buffer."
3254 (gnus-add-text-properties
3255 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3256 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3258 (defun gnus-summary-extract-address-component (from)
3259 (or (car (funcall gnus-extract-address-components from))
3262 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3263 (let ((mail-parse-charset gnus-newsgroup-charset)
3264 ; Is it really necessary to do this next part for each summary line?
3265 ; Luckily, doesn't seem to slow things down much.
3266 (mail-parse-ignored-charsets
3267 (save-excursion (set-buffer gnus-summary-buffer)
3268 gnus-newsgroup-ignored-charsets)))
3270 (and gnus-ignored-from-addresses
3271 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3272 (let ((extra-headers (mail-header-extra header))
3276 ((setq to (cdr (assq 'To extra-headers)))
3279 (gnus-summary-extract-address-component
3280 (funcall gnus-decode-encoded-word-function to)))))
3281 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3282 (concat "=> " newsgroups)))))
3283 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3285 (defun gnus-summary-insert-line (gnus-tmp-header
3286 gnus-tmp-level gnus-tmp-current
3287 undownloaded gnus-tmp-unread gnus-tmp-replied
3288 gnus-tmp-expirable gnus-tmp-subject-or-nil
3289 &optional gnus-tmp-dummy gnus-tmp-score
3291 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3292 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3293 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3294 (gnus-tmp-score-char
3295 (if (or (null gnus-summary-default-score)
3296 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3297 gnus-summary-zcore-fuzz))
3299 (if (< gnus-tmp-score gnus-summary-default-score)
3300 gnus-score-below-mark gnus-score-over-mark)))
3301 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3303 (cond (gnus-tmp-process gnus-process-mark)
3304 ((memq gnus-tmp-current gnus-newsgroup-cached)
3306 (gnus-tmp-replied gnus-replied-mark)
3307 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3308 gnus-forwarded-mark)
3309 ((memq gnus-tmp-current gnus-newsgroup-saved)
3311 ((memq gnus-tmp-number gnus-newsgroup-recent)
3313 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3316 (gnus-tmp-downloaded
3318 gnus-undownloaded-mark)
3319 (gnus-newsgroup-agentized
3320 gnus-downloaded-mark)
3323 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3326 ((string-match "<[^>]+> *$" gnus-tmp-from)
3327 (let ((beg (match-beginning 0)))
3328 (or (and (string-match "^\".+\"" gnus-tmp-from)
3329 (substring gnus-tmp-from 1 (1- (match-end 0))))
3330 (substring gnus-tmp-from 0 beg))))
3331 ((string-match "(.+)" gnus-tmp-from)
3332 (substring gnus-tmp-from
3333 (1+ (match-beginning 0)) (1- (match-end 0))))
3335 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3336 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3337 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3338 (buffer-read-only nil))
3339 (when (string= gnus-tmp-name "")
3340 (setq gnus-tmp-name gnus-tmp-from))
3341 (unless (numberp gnus-tmp-lines)
3342 (setq gnus-tmp-lines -1))
3343 (if (= gnus-tmp-lines -1)
3344 (setq gnus-tmp-lines "?")
3345 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3346 (gnus-put-text-property
3348 (progn (eval gnus-summary-line-format-spec) (point))
3349 'gnus-number gnus-tmp-number)
3350 (when (gnus-visual-p 'summary-highlight 'highlight)
3352 (gnus-run-hooks 'gnus-summary-update-hook)
3355 (defun gnus-summary-update-line (&optional dont-update)
3356 "Update summary line after change."
3357 (when (and gnus-summary-default-score
3358 (not gnus-summary-inhibit-highlight))
3359 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3360 (article (gnus-summary-article-number))
3361 (score (gnus-summary-article-score article)))
3363 (if (and gnus-summary-mark-below
3364 (< (gnus-summary-article-score)
3365 gnus-summary-mark-below))
3366 ;; This article has a low score, so we mark it as read.
3367 (when (memq article gnus-newsgroup-unreads)
3368 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3369 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3370 ;; This article was previously marked as read on account
3371 ;; of a low score, but now it has risen, so we mark it as
3373 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3374 (gnus-summary-update-mark
3375 (if (or (null gnus-summary-default-score)
3376 (<= (abs (- score gnus-summary-default-score))
3377 gnus-summary-zcore-fuzz))
3379 (if (< score gnus-summary-default-score)
3380 gnus-score-below-mark gnus-score-over-mark))
3382 ;; Do visual highlighting.
3383 (when (gnus-visual-p 'summary-highlight 'highlight)
3384 (gnus-run-hooks 'gnus-summary-update-hook)))))
3386 (defvar gnus-tmp-new-adopts nil)
3388 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3389 "Return the number of articles in THREAD.
3390 This may be 0 in some cases -- if none of the articles in
3391 the thread are to be displayed."
3393 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3395 ((not (listp thread))
3397 ((and (consp thread) (cdr thread))
3400 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3403 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3406 (when (and level (zerop level) gnus-tmp-new-adopts)
3409 'gnus-summary-number-of-articles-in-thread
3410 gnus-tmp-new-adopts))))
3412 (if (> number 1) gnus-not-empty-thread-mark
3413 gnus-empty-thread-mark)
3416 (defsubst gnus-summary-line-message-size (head)
3417 "Return pretty-printed version of message size.
3418 This function is intended to be used in
3419 `gnus-summary-line-format-alist'."
3420 (let ((c (or (mail-header-chars head) -1)))
3421 (cond ((< c 0) "n/a") ; chars not available
3422 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3423 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3424 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3425 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3428 (defun gnus-summary-set-local-parameters (group)
3429 "Go through the local params of GROUP and set all variable specs in that list."
3430 (let ((params (gnus-group-find-parameter group))
3431 (vars '(quit-config)) ; Ignore quit-config.
3434 (setq elem (car params)
3435 params (cdr params))
3436 (and (consp elem) ; Has to be a cons.
3437 (consp (cdr elem)) ; The cdr has to be a list.
3438 (symbolp (car elem)) ; Has to be a symbol in there.
3439 (not (memq (car elem) vars))
3440 (ignore-errors ; So we set it.
3441 (push (car elem) vars)
3442 (make-local-variable (car elem))
3443 (set (car elem) (eval (nth 1 elem))))))))
3445 (defun gnus-summary-read-group (group &optional show-all no-article
3446 kill-buffer no-display backward
3448 "Start reading news in newsgroup GROUP.
3449 If SHOW-ALL is non-nil, already read articles are also listed.
3450 If NO-ARTICLE is non-nil, no article is selected initially.
3451 If NO-DISPLAY, don't generate a summary buffer."
3455 (let ((gnus-auto-select-next nil))
3456 (or (gnus-summary-read-group-1
3457 group show-all no-article
3458 kill-buffer no-display
3461 select-articles nil)))))
3462 (eq gnus-auto-select-next 'quietly))
3463 (set-buffer gnus-group-buffer)
3464 ;; The entry function called above goes to the next
3465 ;; group automatically, so we go two groups back
3466 ;; if we are searching for the previous group.
3468 (gnus-group-prev-unread-group 2))
3469 (if (not (equal group (gnus-group-group-name)))
3470 (setq group (gnus-group-group-name))
3474 (defun gnus-summary-read-group-1 (group show-all no-article
3475 kill-buffer no-display
3476 &optional select-articles)
3477 ;; Killed foreign groups can't be entered.
3478 ;; (when (and (not (gnus-group-native-p group))
3479 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3480 ;; (error "Dead non-native groups can't be entered"))
3481 (gnus-message 5 "Retrieving newsgroup: %s..."
3482 (gnus-group-decoded-name group))
3483 (let* ((new-group (gnus-summary-setup-buffer group))
3484 (quit-config (gnus-group-quit-config group))
3485 (did-select (and new-group (gnus-select-newsgroup
3486 group show-all select-articles))))
3488 ;; This summary buffer exists already, so we just select it.
3490 (gnus-set-global-variables)
3492 (gnus-kill-or-deaden-summary kill-buffer))
3493 (gnus-configure-windows 'summary 'force)
3494 (gnus-set-mode-line 'summary)
3495 (gnus-summary-position-point)
3498 ;; We couldn't select this group.
3500 (when (and (eq major-mode 'gnus-summary-mode)
3501 (not (equal (current-buffer) kill-buffer)))
3502 (kill-buffer (current-buffer))
3503 (if (not quit-config)
3505 ;; Update the info -- marks might need to be removed,
3507 (gnus-summary-update-info)
3508 (set-buffer gnus-group-buffer)
3509 (gnus-group-jump-to-group group)
3510 (gnus-group-next-unread-group 1))
3511 (gnus-handle-ephemeral-exit quit-config)))
3512 (let ((grpinfo (gnus-get-info group)))
3513 (if (null (gnus-info-read grpinfo))
3514 (gnus-message 3 "Group %s contains no messages"
3515 (gnus-group-decoded-name group))
3516 (gnus-message 3 "Can't select group")))
3518 ;; The user did a `C-g' while prompting for number of articles,
3519 ;; so we exit this group.
3520 ((eq did-select 'quit)
3521 (and (eq major-mode 'gnus-summary-mode)
3522 (not (equal (current-buffer) kill-buffer))
3523 (kill-buffer (current-buffer)))
3525 (gnus-kill-or-deaden-summary kill-buffer))
3526 (if (not quit-config)
3528 (set-buffer gnus-group-buffer)
3529 (gnus-group-jump-to-group group)
3530 (gnus-group-next-unread-group 1)
3531 (gnus-configure-windows 'group 'force))
3532 (gnus-handle-ephemeral-exit quit-config))
3533 ;; Finally signal the quit.
3535 ;; The group was successfully selected.
3537 (gnus-set-global-variables)
3538 ;; Save the active value in effect when the group was entered.
3539 (setq gnus-newsgroup-active
3541 (gnus-active gnus-newsgroup-name)))
3542 ;; You can change the summary buffer in some way with this hook.
3543 (gnus-run-hooks 'gnus-select-group-hook)
3544 (gnus-update-format-specifications
3545 nil 'summary 'summary-mode 'summary-dummy)
3546 (gnus-update-summary-mark-positions)
3547 ;; Do score processing.
3548 (when gnus-use-scoring
3549 (gnus-possibly-score-headers))
3550 ;; Check whether to fill in the gaps in the threads.
3551 (when gnus-build-sparse-threads
3552 (gnus-build-sparse-threads))
3553 ;; Find the initial limit.
3554 (if gnus-show-threads
3556 (let ((gnus-newsgroup-dormant nil))
3557 (gnus-summary-initial-limit show-all))
3558 (gnus-summary-initial-limit show-all))
3559 ;; When unthreaded, all articles are always shown.
3560 (setq gnus-newsgroup-limit
3562 (lambda (header) (mail-header-number header))
3563 gnus-newsgroup-headers)))
3564 ;; Generate the summary buffer.
3566 (gnus-summary-prepare))
3567 (when gnus-use-trees
3568 (gnus-tree-open group)
3569 (setq gnus-summary-highlight-line-function
3570 'gnus-tree-highlight-article))
3571 ;; If the summary buffer is empty, but there are some low-scored
3572 ;; articles or some excluded dormants, we include these in the
3574 (when (and (zerop (buffer-size))
3576 (cond (gnus-newsgroup-dormant
3577 (gnus-summary-limit-include-dormant))
3578 ((and gnus-newsgroup-scored show-all)
3579 (gnus-summary-limit-include-expunged t))))
3580 ;; Function `gnus-apply-kill-file' must be called in this hook.
3581 (gnus-run-hooks 'gnus-apply-kill-hook)
3582 (if (and (zerop (buffer-size))
3585 ;; This newsgroup is empty.
3586 (gnus-summary-catchup-and-exit nil t)
3587 (gnus-message 6 "No unread news")
3589 (gnus-kill-or-deaden-summary kill-buffer))
3590 ;; Return nil from this function.
3592 ;; Hide conversation thread subtrees. We cannot do this in
3593 ;; gnus-summary-prepare-hook since kill processing may not
3594 ;; work with hidden articles.
3595 (gnus-summary-maybe-hide-threads)
3597 (gnus-kill-or-deaden-summary kill-buffer))
3598 (gnus-summary-auto-select-subject)
3599 ;; Show first unread article if requested.
3600 (if (and (not no-article)
3602 gnus-newsgroup-unreads
3603 gnus-auto-select-first)
3605 (gnus-configure-windows 'summary)
3606 (let ((art (gnus-summary-article-number)))
3607 (unless (and (not gnus-plugged)
3608 (or (memq art gnus-newsgroup-undownloaded)
3609 (memq art gnus-newsgroup-downloadable)))
3610 (gnus-summary-goto-article art))))
3611 ;; Don't select any articles.
3612 (gnus-summary-position-point)
3613 (gnus-configure-windows 'summary 'force)
3614 (gnus-set-mode-line 'summary))
3615 (when (and gnus-auto-center-group
3616 (get-buffer-window gnus-group-buffer t))
3617 ;; Gotta use windows, because recenter does weird stuff if
3618 ;; the current buffer ain't the displayed window.
3619 (let ((owin (selected-window)))
3620 (select-window (get-buffer-window gnus-group-buffer t))
3621 (when (gnus-group-goto-group group)
3623 (select-window owin)))
3624 ;; Mark this buffer as "prepared".
3625 (setq gnus-newsgroup-prepared t)
3626 (gnus-run-hooks 'gnus-summary-prepared-hook)
3627 (unless (gnus-ephemeral-group-p group)
3628 (gnus-group-update-group group))
3631 (defun gnus-summary-auto-select-subject ()
3632 "Select the subject line on initial group entry."
3633 (goto-char (point-min))
3635 ((eq gnus-auto-select-subject 'best)
3636 (gnus-summary-best-unread-subject))
3637 ((eq gnus-auto-select-subject 'unread)
3638 (gnus-summary-first-unread-subject))
3639 ((eq gnus-auto-select-subject 'unseen)
3640 (gnus-summary-first-unseen-subject))
3641 ((eq gnus-auto-select-subject 'unseen-or-unread)
3642 (gnus-summary-first-unseen-or-unread-subject))
3643 ((eq gnus-auto-select-subject 'first)
3646 ((functionp gnus-auto-select-subject)
3647 (funcall gnus-auto-select-subject))))
3649 (defun gnus-summary-prepare ()
3650 "Generate the summary buffer."
3652 (let ((buffer-read-only nil))
3654 (setq gnus-newsgroup-data nil
3655 gnus-newsgroup-data-reverse nil)
3656 (gnus-run-hooks 'gnus-summary-generate-hook)
3657 ;; Generate the buffer, either with threads or without.
3658 (when gnus-newsgroup-headers
3659 (gnus-summary-prepare-threads
3660 (if gnus-show-threads
3661 (gnus-sort-gathered-threads
3662 (funcall gnus-summary-thread-gathering-function
3664 (gnus-cut-threads (gnus-make-threads)))))
3665 ;; Unthreaded display.
3666 (gnus-sort-articles gnus-newsgroup-headers))))
3667 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3668 ;; Call hooks for modifying summary buffer.
3669 (goto-char (point-min))
3670 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3672 (defsubst gnus-general-simplify-subject (subject)
3673 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3676 ;; Truncate the subject.
3677 (gnus-simplify-subject-functions
3678 (gnus-map-function gnus-simplify-subject-functions subject))
3679 ((numberp gnus-summary-gather-subject-limit)
3680 (setq subject (gnus-simplify-subject-re subject))
3681 (if (> (length subject) gnus-summary-gather-subject-limit)
3682 (substring subject 0 gnus-summary-gather-subject-limit)
3684 ;; Fuzzily simplify it.
3685 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3686 (gnus-simplify-subject-fuzzy subject))
3687 ;; Just remove the leading "Re:".
3689 (gnus-simplify-subject-re subject))))
3691 (if (and gnus-summary-gather-exclude-subject
3692 (string-match gnus-summary-gather-exclude-subject subject))
3693 nil ; This article shouldn't be gathered
3696 (defun gnus-summary-simplify-subject-query ()
3697 "Query where the respool algorithm would put this article."
3699 (gnus-summary-select-article)
3700 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3702 (defun gnus-gather-threads-by-subject (threads)
3703 "Gather threads by looking at Subject headers."
3704 (if (not gnus-summary-make-false-root)
3706 (let ((hashtb (gnus-make-hashtable 1024))
3709 subject hthread whole-subject)
3711 (setq subject (gnus-general-simplify-subject
3712 (setq whole-subject (mail-header-subject
3715 (if (setq hthread (gnus-gethash subject hashtb))
3717 ;; We enter a dummy root into the thread, if we
3718 ;; haven't done that already.
3719 (unless (stringp (caar hthread))
3720 (setcar hthread (list whole-subject (car hthread))))
3721 ;; We add this new gathered thread to this gathered
3723 (setcdr (car hthread)
3724 (nconc (cdar hthread) (list (car threads))))
3725 ;; Remove it from the list of threads.
3726 (setcdr prev (cdr threads))
3727 (setq threads prev))
3728 ;; Enter this thread into the hash table.
3729 (gnus-sethash subject
3730 (if gnus-summary-make-false-root-always
3732 ;; If you want a dummy root above all
3734 (setcar threads (list whole-subject
3740 (setq threads (cdr threads)))
3743 (defun gnus-gather-threads-by-references (threads)
3744 "Gather threads by looking at References headers."
3745 (let ((idhashtb (gnus-make-hashtable 1024))
3746 (thhashtb (gnus-make-hashtable 1024))
3749 ids references id gthread gid entered ref)
3751 (when (setq references (mail-header-references (caar threads)))
3752 (setq id (mail-header-id (caar threads))
3753 ids (inline (gnus-split-references references))
3755 (while (setq ref (pop ids))
3756 (setq ids (delete ref ids))
3757 (if (not (setq gid (gnus-gethash ref idhashtb)))
3759 (gnus-sethash ref id idhashtb)
3760 (gnus-sethash id threads thhashtb))
3761 (setq gthread (gnus-gethash gid thhashtb))
3763 ;; We enter a dummy root into the thread, if we
3764 ;; haven't done that already.
3765 (unless (stringp (caar gthread))
3766 (setcar gthread (list (mail-header-subject (caar gthread))
3768 ;; We add this new gathered thread to this gathered
3770 (setcdr (car gthread)
3771 (nconc (cdar gthread) (list (car threads)))))
3772 ;; Add it into the thread hash table.
3773 (gnus-sethash id gthread thhashtb)
3775 ;; Remove it from the list of threads.
3776 (setcdr prev (cdr threads))
3777 (setq threads prev))))
3779 (setq threads (cdr threads)))
3782 (defun gnus-sort-gathered-threads (threads)
3783 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3784 (let ((result threads))
3786 (when (stringp (caar threads))
3787 (setcdr (car threads)
3788 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3789 (setq threads (cdr threads)))
3792 (defun gnus-thread-loop-p (root thread)
3793 "Say whether ROOT is in THREAD."
3794 (let ((stack (list thread))
3797 (while (setq thread (pop stack))
3798 (setq th (cdr thread))
3800 (not (eq (caar th) root)))
3803 ;; We have found a loop.
3805 (setcdr thread (delq (car th) (cdr thread)))
3806 (if (boundp (setq ref-dep (intern "none"
3807 gnus-newsgroup-dependencies)))
3808 (setcdr (symbol-value ref-dep)
3809 (nconc (cdr (symbol-value ref-dep))
3811 (set ref-dep (list nil (car th))))
3814 ;; Push all the subthreads onto the stack.
3815 (push (cdr thread) stack)))
3818 (defun gnus-make-threads ()
3819 "Go through the dependency hashtb and find the roots. Return all threads."
3821 (while (catch 'infloop
3824 ;; Deal with self-referencing References loops.
3825 (when (and (car (symbol-value refs))
3832 (car (symbol-value refs)) thread))
3833 (cdr (symbol-value refs)))))))
3836 (unless (car (symbol-value refs))
3837 ;; These threads do not refer back to any other
3838 ;; articles, so they're roots.
3839 (setq threads (append (cdr (symbol-value refs)) threads))))
3840 gnus-newsgroup-dependencies)))
3843 ;; Build the thread tree.
3844 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3845 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3847 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3848 if it was already present.
3850 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3851 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3852 Message-IDs will be renamed to a unique Message-ID before being
3855 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3856 (let* ((id (mail-header-id header))
3857 (id-dep (and id (intern id dependencies)))
3858 parent-id ref ref-dep ref-header replaced)
3859 ;; Enter this `header' in the `dependencies' table.
3863 ;; The first two cases do the normal part: enter a new `header'
3864 ;; in the `dependencies' table.
3865 ((not (boundp id-dep))
3866 (set id-dep (list header)))
3867 ((null (car (symbol-value id-dep)))
3868 (setcar (symbol-value id-dep) header))
3870 ;; From here the `header' was already present in the
3871 ;; `dependencies' table.
3873 ;; Overrides an existing entry;
3874 ;; just set the header part of the entry.
3875 (setcar (symbol-value id-dep) header)
3878 ;; Renames the existing `header' to a unique Message-ID.
3879 ((not gnus-summary-ignore-duplicates)
3880 ;; An article with this Message-ID has already been seen.
3881 ;; We rename the Message-ID.
3882 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3884 (mail-header-set-id header id))
3886 ;; The last case ignores an existing entry, except it adds any
3887 ;; additional Xrefs (in case the two articles came from different
3889 ;; Also sets `header' to `nil' meaning that the `dependencies'
3890 ;; table was *not* modified.
3892 (mail-header-set-xref
3893 (car (symbol-value id-dep))
3894 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3896 (or (mail-header-xref header) "")))
3899 (when (and header (not replaced))
3900 ;; First check that we are not creating a References loop.
3901 (setq parent-id (gnus-parent-id (mail-header-references header)))
3902 (setq ref parent-id)
3904 (setq ref-dep (intern-soft ref dependencies))
3906 (setq ref-header (car (symbol-value ref-dep))))
3907 (if (string= id ref)
3908 ;; Yuk! This is a reference loop. Make the article be a
3911 (mail-header-set-references (car (symbol-value id-dep)) "none")
3913 (setq parent-id nil))
3914 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3915 (setq ref-dep (intern (or parent-id "none") dependencies))
3916 (if (boundp ref-dep)
3917 (setcdr (symbol-value ref-dep)
3918 (nconc (cdr (symbol-value ref-dep))
3919 (list (symbol-value id-dep))))
3920 (set ref-dep (list nil (symbol-value id-dep)))))
3923 (defun gnus-extract-message-id-from-in-reply-to (string)
3924 (if (string-match "<[^>]+>" string)
3925 (substring string (match-beginning 0) (match-end 0))
3928 (defun gnus-build-sparse-threads ()
3929 (let ((headers gnus-newsgroup-headers)
3930 (mail-parse-charset gnus-newsgroup-charset)
3931 (gnus-summary-ignore-duplicates t)
3932 header references generation relations
3933 subject child end new-child date)
3934 ;; First we create an alist of generations/relations, where
3935 ;; generations is how much we trust the relation, and the relation
3937 (gnus-message 7 "Making sparse threads...")
3939 (nnheader-set-temp-buffer " *gnus sparse threads*")
3940 (while (setq header (pop headers))
3941 (when (and (setq references (mail-header-references header))
3942 (not (string= references "")))
3944 (setq child (mail-header-id header)
3945 subject (mail-header-subject header)
3946 date (mail-header-date header)
3948 (while (search-backward ">" nil t)
3949 (setq end (1+ (point)))
3950 (when (search-backward "<" nil t)
3951 (setq new-child (buffer-substring (point) end))
3952 (push (list (incf generation)
3953 child (setq child new-child)
3957 (push (list (1+ generation) child nil subject) relations))
3959 (kill-buffer (current-buffer)))
3960 ;; Sort over trustworthiness.
3963 (when (gnus-dependencies-add-header
3964 (make-full-mail-header
3965 gnus-reffed-article-number
3966 (nth 3 relation) "" (or (nth 4 relation) "")
3968 (or (nth 2 relation) "") 0 0 "")
3969 gnus-newsgroup-dependencies nil)
3970 (push gnus-reffed-article-number gnus-newsgroup-limit)
3971 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3972 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3973 gnus-newsgroup-reads)
3974 (decf gnus-reffed-article-number)))
3975 (sort relations 'car-less-than-car))
3976 (gnus-message 7 "Making sparse threads...done")))
3978 (defun gnus-build-old-threads ()
3979 ;; Look at all the articles that refer back to old articles, and
3980 ;; fetch the headers for the articles that aren't there. This will
3981 ;; build complete threads - if the roots haven't been expired by the
3983 (let ((mail-parse-charset gnus-newsgroup-charset)
3987 (when (not (car (symbol-value refs)))
3988 (setq heads (cdr (symbol-value refs)))
3990 (if (memq (mail-header-number (caar heads))
3991 gnus-newsgroup-dormant)
3992 (setq heads (cdr heads))
3993 (setq id (symbol-name refs))
3994 (while (and (setq id (gnus-build-get-header id))
3995 (not (car (gnus-id-to-thread id)))))
3996 (setq heads nil)))))
3997 gnus-newsgroup-dependencies)))
3999 (defsubst gnus-remove-odd-characters (string)
4000 "Translate STRING into something that doesn't contain weird characters."
4001 (mm-subst-char-in-string
4003 (mm-subst-char-in-string
4006 ;; This function has to be called with point after the article number
4007 ;; on the beginning of the line.
4008 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4009 (let ((eol (gnus-point-at-eol))
4010 (buffer (current-buffer))
4011 header references in-reply-to)
4013 ;; overview: [num subject from date id refs chars lines misc]
4016 (narrow-to-region (point) eol)
4021 (make-full-mail-header
4023 (condition-case () ; subject
4024 (gnus-remove-odd-characters
4025 (funcall gnus-decode-encoded-word-function
4026 (setq x (nnheader-nov-field))))
4028 (condition-case () ; from
4029 (gnus-remove-odd-characters
4030 (funcall gnus-decode-encoded-word-function
4031 (setq x (nnheader-nov-field))))
4033 (nnheader-nov-field) ; date
4034 (nnheader-nov-read-message-id) ; id
4035 (setq references (nnheader-nov-field)) ; refs
4036 (nnheader-nov-read-integer) ; chars
4037 (nnheader-nov-read-integer) ; lines
4039 (if (looking-at "Xref: ")
4040 (goto-char (match-end 0)))
4041 (nnheader-nov-field)) ; Xref
4042 (nnheader-nov-parse-extra)))) ; extra
4046 (when (and (string= references "")
4047 (setq in-reply-to (mail-header-extra header))
4048 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4049 (mail-header-set-references
4050 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4052 (when gnus-alter-header-function
4053 (funcall gnus-alter-header-function header))
4054 (gnus-dependencies-add-header header dependencies force-new)))
4056 (defun gnus-build-get-header (id)
4057 "Look through the buffer of NOV lines and find the header to ID.
4058 Enter this line into the dependencies hash table, and return
4059 the id of the parent article (if any)."
4060 (let ((deps gnus-newsgroup-dependencies)
4064 (set-buffer nntp-server-buffer)
4065 (let ((case-fold-search nil))
4066 (goto-char (point-min))
4067 (while (and (not found)
4068 (search-forward id nil t))
4070 (setq found (looking-at
4071 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4072 (regexp-quote id))))
4073 (or found (beginning-of-line 2)))
4077 (setq header (gnus-nov-parse-line
4078 (read (current-buffer)) deps))
4079 (gnus-parent-id (mail-header-references header))))))
4081 (let ((number (mail-header-number header)))
4082 (push number gnus-newsgroup-limit)
4083 (push header gnus-newsgroup-headers)
4084 (if (memq number gnus-newsgroup-unselected)
4086 (setq gnus-newsgroup-unreads
4087 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4089 (setq gnus-newsgroup-unselected
4090 (delq number gnus-newsgroup-unselected)))
4091 (push number gnus-newsgroup-ancient)))))))
4093 (defun gnus-build-all-threads ()
4094 "Read all the headers."
4095 (let ((gnus-summary-ignore-duplicates t)
4096 (mail-parse-charset gnus-newsgroup-charset)
4097 (dependencies gnus-newsgroup-dependencies)
4100 (set-buffer nntp-server-buffer)
4101 (let ((case-fold-search nil))
4102 (goto-char (point-min))
4105 (setq article (read (current-buffer))
4106 header (gnus-nov-parse-line article dependencies)))
4109 (set-buffer gnus-summary-buffer)
4110 (push header gnus-newsgroup-headers)
4111 (if (memq (setq article (mail-header-number header))
4112 gnus-newsgroup-unselected)
4114 (setq gnus-newsgroup-unreads
4115 (gnus-add-to-sorted-list
4116 gnus-newsgroup-unreads article))
4117 (setq gnus-newsgroup-unselected
4118 (delq article gnus-newsgroup-unselected)))
4119 (push article gnus-newsgroup-ancient)))
4120 (forward-line 1)))))))
4122 (defun gnus-summary-update-article-line (article header)
4123 "Update the line for ARTICLE using HEADER."
4124 (let* ((id (mail-header-id header))
4125 (thread (gnus-id-to-thread id)))
4127 (error "Article in no thread"))
4128 ;; Update the thread.
4129 (setcar thread header)
4130 (gnus-summary-goto-subject article)
4131 (let* ((datal (gnus-data-find-list article))
4133 (buffer-read-only nil)
4134 (level (gnus-summary-thread-level)))
4136 (let ((inserted (- (point)
4138 (gnus-summary-insert-line
4140 (memq article gnus-newsgroup-undownloaded)
4141 (gnus-article-mark article)
4142 (memq article gnus-newsgroup-replied)
4143 (memq article gnus-newsgroup-expirable)
4144 ;; Only insert the Subject string when it's different
4145 ;; from the previous Subject string.
4150 (mail-header-subject
4153 (gnus-data-find-list
4155 (gnus-data-list t)))))
4156 ;; Error on the side of excessive subjects.
4158 (mail-header-subject header)))
4160 (mail-header-subject header))
4161 nil (cdr (assq article gnus-newsgroup-scored))
4162 (memq article gnus-newsgroup-processable))
4165 (gnus-data-update-list
4167 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4169 (defun gnus-summary-update-article (article &optional iheader)
4170 "Update ARTICLE in the summary buffer."
4171 (set-buffer gnus-summary-buffer)
4172 (let* ((header (gnus-summary-article-header article))
4173 (id (mail-header-id header))
4174 (data (gnus-data-find article))
4175 (thread (gnus-id-to-thread id))
4176 (references (mail-header-references header))
4180 (when (and references
4181 (not (equal "" references)))
4184 (buffer-read-only nil)
4190 (delq thread parent)))
4191 (if (gnus-summary-insert-subject id header)
4192 ;; Set the (possibly) new article number in the data structure.
4193 (gnus-data-set-number data (gnus-id-to-article id))
4197 (defun gnus-rebuild-thread (id &optional line)
4198 "Rebuild the thread containing ID.
4199 If LINE, insert the rebuilt thread starting on line LINE."
4200 (let ((buffer-read-only nil)
4201 old-pos current thread data)
4202 (if (not gnus-show-threads)
4203 (setq thread (list (car (gnus-id-to-thread id))))
4204 ;; Get the thread this article is part of.
4205 (setq thread (gnus-remove-thread id)))
4206 (setq old-pos (gnus-point-at-bol))
4207 (setq current (save-excursion
4208 (and (re-search-backward "[\r\n]" nil t)
4209 (gnus-summary-article-number))))
4210 ;; If this is a gathered thread, we have to go some re-gathering.
4211 (when (stringp (car thread))
4212 (let ((subject (car thread))
4214 (setq thread (cdr thread))
4216 (unless (memq (setq thr (gnus-id-to-thread
4218 (mail-header-id (caar thread)))))
4221 (setq thread (cdr thread)))
4222 ;; We now have all (unique) roots.
4223 (if (= (length roots) 1)
4224 ;; All the loose roots are now one solid root.
4225 (setq thread (car roots))
4226 (setq thread (cons subject (gnus-sort-threads roots))))))
4228 ;; We then insert this thread into the summary buffer.
4230 (goto-char (point-min))
4231 (forward-line (1- line)))
4232 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4233 (if gnus-show-threads
4234 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4235 (gnus-summary-prepare-unthreaded thread))
4236 (setq data (nreverse gnus-newsgroup-data))
4237 (setq threads gnus-newsgroup-threads))
4238 ;; We splice the new data into the data structure.
4239 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4240 ;;!!! then we want to insert at the beginning of the buffer.
4241 ;;!!! That happens to be true with Gnus now, but that may
4242 ;;!!! change in the future. Perhaps.
4243 (gnus-data-enter-list
4244 (if line nil current) data (- (point) old-pos))
4245 (setq gnus-newsgroup-threads
4246 (nconc threads gnus-newsgroup-threads))
4247 (gnus-data-compute-positions))))
4249 (defun gnus-number-to-header (number)
4250 "Return the header for article NUMBER."
4251 (let ((headers gnus-newsgroup-headers))
4253 (not (= number (mail-header-number (car headers)))))
4258 (defun gnus-parent-headers (in-headers &optional generation)
4259 "Return the headers of the GENERATIONeth parent of HEADERS."
4261 (setq generation 1))
4263 (headers in-headers)
4266 (not (zerop generation))
4267 (setq references (mail-header-references headers)))
4268 (setq headers (if (and references
4269 (setq parent (gnus-parent-id references)))
4270 (car (gnus-id-to-thread parent))
4273 (and (not (eq headers in-headers))
4276 (defun gnus-id-to-thread (id)
4277 "Return the (sub-)thread where ID appears."
4278 (gnus-gethash id gnus-newsgroup-dependencies))
4280 (defun gnus-id-to-article (id)
4281 "Return the article number of ID."
4282 (let ((thread (gnus-id-to-thread id)))
4285 (mail-header-number (car thread)))))
4287 (defun gnus-id-to-header (id)
4288 "Return the article headers of ID."
4289 (car (gnus-id-to-thread id)))
4291 (defun gnus-article-displayed-root-p (article)
4292 "Say whether ARTICLE is a root(ish) article."
4293 (let ((level (gnus-summary-thread-level article))
4294 (refs (mail-header-references (gnus-summary-article-header article)))
4300 ((null (gnus-parent-id refs)) t)
4302 (null (setq particle (gnus-id-to-article
4303 (gnus-parent-id refs))))
4304 (null (gnus-summary-thread-level particle)))))))
4306 (defun gnus-root-id (id)
4307 "Return the id of the root of the thread where ID appears."
4309 (while (and id (setq prev (car (gnus-id-to-thread id))))
4311 id (gnus-parent-id (mail-header-references prev))))
4314 (defun gnus-articles-in-thread (thread)
4315 "Return the list of articles in THREAD."
4316 (cons (mail-header-number (car thread))
4317 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4319 (defun gnus-remove-thread (id &optional dont-remove)
4320 "Remove the thread that has ID in it."
4321 (let (headers thread last-id)
4322 ;; First go up in this thread until we find the root.
4323 (setq last-id (gnus-root-id id)
4324 headers (message-flatten-list (gnus-id-to-thread last-id)))
4325 ;; We have now found the real root of this thread. It might have
4326 ;; been gathered into some loose thread, so we have to search
4327 ;; through the threads to find the thread we wanted.
4328 (let ((threads gnus-newsgroup-threads)
4331 (setq sub (car threads))
4332 (if (stringp (car sub))
4333 ;; This is a gathered thread, so we look at the roots
4334 ;; below it to find whether this article is in this
4337 (setq sub (cdr sub))
4339 (when (member (caar sub) headers)
4340 (setq thread (car threads)
4343 (setq sub (cdr sub))))
4344 ;; It's an ordinary thread, so we check it.
4345 (when (eq (car sub) (car headers))
4348 (setq threads (cdr threads)))
4349 ;; If this article is in no thread, then it's a root.
4352 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4353 (setq thread (gnus-id-to-thread last-id)))
4356 thread ; We return this thread.
4358 (if (stringp (car thread))
4360 ;; If we use dummy roots, then we have to remove the
4361 ;; dummy root as well.
4362 (when (eq gnus-summary-make-false-root 'dummy)
4363 ;; We go to the dummy root by going to
4364 ;; the first sub-"thread", and then one line up.
4365 (gnus-summary-goto-article
4366 (mail-header-number (caadr thread)))
4369 (gnus-data-compute-positions))
4370 (setq thread (cdr thread))
4372 (gnus-remove-thread-1 (car thread))
4373 (setq thread (cdr thread))))
4374 (gnus-remove-thread-1 thread))))))))
4376 (defun gnus-remove-thread-1 (thread)
4377 "Remove the thread THREAD recursively."
4378 (let ((number (mail-header-number (pop thread)))
4380 (setq thread (reverse thread))
4382 (gnus-remove-thread-1 (pop thread)))
4383 (when (setq d (gnus-data-find number))
4384 (goto-char (gnus-data-pos d))
4385 (gnus-summary-show-thread)
4388 (- (gnus-point-at-bol)
4390 (1+ (gnus-point-at-eol))
4391 (gnus-delete-line)))))))
4393 (defun gnus-sort-threads-1 (threads func)
4394 (sort (mapcar (lambda (thread)
4397 (gnus-sort-threads-1 (cdr thread) func))))
4400 (defun gnus-sort-threads (threads)
4402 (if (not gnus-thread-sort-functions)
4404 (gnus-message 8 "Sorting threads...")
4405 (let ((max-lisp-eval-depth 5000))
4406 (prog1 (gnus-sort-threads-1
4408 (gnus-make-sort-function gnus-thread-sort-functions))
4409 (gnus-message 8 "Sorting threads...done")))))
4411 (defun gnus-sort-articles (articles)
4413 (when gnus-article-sort-functions
4414 (gnus-message 7 "Sorting articles...")
4416 (setq gnus-newsgroup-headers
4417 (sort articles (gnus-make-sort-function
4418 gnus-article-sort-functions)))
4419 (gnus-message 7 "Sorting articles...done"))))
4421 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4422 (defmacro gnus-thread-header (thread)
4423 "Return header of first article in THREAD.
4424 Note that THREAD must never, ever be anything else than a variable -
4425 using some other form will lead to serious barfage."
4426 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4427 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4428 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4431 (defsubst gnus-article-sort-by-number (h1 h2)
4432 "Sort articles by article number."
4433 (< (mail-header-number h1)
4434 (mail-header-number h2)))
4436 (defun gnus-thread-sort-by-number (h1 h2)
4437 "Sort threads by root article number."
4438 (gnus-article-sort-by-number
4439 (gnus-thread-header h1) (gnus-thread-header h2)))
4441 (defsubst gnus-article-sort-by-random (h1 h2)
4442 "Sort articles by article number."
4445 (defun gnus-thread-sort-by-random (h1 h2)
4446 "Sort threads by root article number."
4447 (gnus-article-sort-by-random
4448 (gnus-thread-header h1) (gnus-thread-header h2)))
4450 (defsubst gnus-article-sort-by-lines (h1 h2)
4451 "Sort articles by article Lines header."
4452 (< (mail-header-lines h1)
4453 (mail-header-lines h2)))
4455 (defun gnus-thread-sort-by-lines (h1 h2)
4456 "Sort threads by root article Lines header."
4457 (gnus-article-sort-by-lines
4458 (gnus-thread-header h1) (gnus-thread-header h2)))
4460 (defsubst gnus-article-sort-by-chars (h1 h2)
4461 "Sort articles by octet length."
4462 (< (mail-header-chars h1)
4463 (mail-header-chars h2)))
4465 (defun gnus-thread-sort-by-chars (h1 h2)
4466 "Sort threads by root article octet length."
4467 (gnus-article-sort-by-chars
4468 (gnus-thread-header h1) (gnus-thread-header h2)))
4470 (defsubst gnus-article-sort-by-author (h1 h2)
4471 "Sort articles by root author."
4473 (let ((extract (funcall
4474 gnus-extract-address-components
4475 (mail-header-from h1))))
4476 (or (car extract) (cadr extract) ""))
4477 (let ((extract (funcall
4478 gnus-extract-address-components
4479 (mail-header-from h2))))
4480 (or (car extract) (cadr extract) ""))))
4482 (defun gnus-thread-sort-by-author (h1 h2)
4483 "Sort threads by root author."
4484 (gnus-article-sort-by-author
4485 (gnus-thread-header h1) (gnus-thread-header h2)))
4487 (defsubst gnus-article-sort-by-subject (h1 h2)
4488 "Sort articles by root subject."
4490 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4491 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4493 (defun gnus-thread-sort-by-subject (h1 h2)
4494 "Sort threads by root subject."
4495 (gnus-article-sort-by-subject
4496 (gnus-thread-header h1) (gnus-thread-header h2)))
4498 (defsubst gnus-article-sort-by-date (h1 h2)
4499 "Sort articles by root article date."
4501 (gnus-date-get-time (mail-header-date h1))
4502 (gnus-date-get-time (mail-header-date h2))))
4504 (defun gnus-thread-sort-by-date (h1 h2)
4505 "Sort threads by root article date."
4506 (gnus-article-sort-by-date
4507 (gnus-thread-header h1) (gnus-thread-header h2)))
4509 (defsubst gnus-article-sort-by-score (h1 h2)
4510 "Sort articles by root article score.
4511 Unscored articles will be counted as having a score of zero."
4512 (> (or (cdr (assq (mail-header-number h1)
4513 gnus-newsgroup-scored))
4514 gnus-summary-default-score 0)
4515 (or (cdr (assq (mail-header-number h2)
4516 gnus-newsgroup-scored))
4517 gnus-summary-default-score 0)))
4519 (defun gnus-thread-sort-by-score (h1 h2)
4520 "Sort threads by root article score."
4521 (gnus-article-sort-by-score
4522 (gnus-thread-header h1) (gnus-thread-header h2)))
4524 (defun gnus-thread-sort-by-total-score (h1 h2)
4525 "Sort threads by the sum of all scores in the thread.
4526 Unscored articles will be counted as having a score of zero."
4527 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4529 (defun gnus-thread-total-score (thread)
4530 ;; This function find the total score of THREAD.
4535 (if (stringp (car thread))
4536 (apply gnus-thread-score-function 0
4537 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4538 (gnus-thread-total-score-1 thread)))
4540 (gnus-thread-total-score-1 (list thread)))))
4542 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4543 "Sort threads such that the thread with the most recently arrived article comes first."
4544 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4546 (defun gnus-thread-highest-number (thread)
4547 "Return the highest article number in THREAD."
4548 (apply 'max (mapcar (lambda (header)
4549 (mail-header-number header))
4550 (message-flatten-list thread))))
4552 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4553 "Sort threads such that the thread with the most recently dated article comes first."
4554 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4556 (defun gnus-thread-latest-date (thread)
4557 "Return the highest article date in THREAD."
4558 (let ((previous-time 0))
4564 (time-to-seconds (mail-header-parse-date
4565 (mail-header-date header)))
4566 (error previous-time))))
4568 (message-flatten-list thread)
4570 (< (mail-header-number h1)
4571 (mail-header-number h2))))))))
4573 (defun gnus-thread-total-score-1 (root)
4574 ;; This function find the total score of the thread below ROOT.
4575 (setq root (car root))
4576 (apply gnus-thread-score-function
4578 (mapcar 'gnus-thread-total-score
4579 (cdr (gnus-id-to-thread (mail-header-id root))))
4580 (when (> (mail-header-number root) 0)
4581 (list (or (cdr (assq (mail-header-number root)
4582 gnus-newsgroup-scored))
4583 gnus-summary-default-score 0))))
4584 (list gnus-summary-default-score)
4587 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4588 (defvar gnus-tmp-prev-subject nil)
4589 (defvar gnus-tmp-false-parent nil)
4590 (defvar gnus-tmp-root-expunged nil)
4591 (defvar gnus-tmp-dummy-line nil)
4593 (eval-when-compile (defvar gnus-tmp-header))
4594 (defun gnus-extra-header (type &optional header)
4595 "Return the extra header of TYPE."
4596 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4599 (defvar gnus-tmp-thread-tree-header-string "")
4601 (defcustom gnus-sum-thread-tree-root "> "
4602 "With %B spec, used for the root of a thread.
4603 If nil, use subject instead."
4605 :type '(radio (const :format "%v " nil) (string :size 0))
4606 :group 'gnus-thread)
4607 (defcustom gnus-sum-thread-tree-false-root "> "
4608 "With %B spec, used for a false root of a thread.
4609 If nil, use subject instead."
4611 :type '(radio (const :format "%v " nil) (string :size 0))
4612 :group 'gnus-thread)
4613 (defcustom gnus-sum-thread-tree-single-indent ""
4614 "With %B spec, used for a thread with just one message.
4615 If nil, use subject instead."
4617 :type '(radio (const :format "%v " nil) (string :size 0))
4618 :group 'gnus-thread)
4619 (defcustom gnus-sum-thread-tree-vertical "| "
4620 "With %B spec, used for drawing a vertical line."
4623 :group 'gnus-thread)
4624 (defcustom gnus-sum-thread-tree-indent " "
4625 "With %B spec, used for indenting."
4628 :group 'gnus-thread)
4629 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4630 "With %B spec, used for a leaf with brothers."
4633 :group 'gnus-thread)
4634 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4635 "With %B spec, used for a leaf without brothers."
4638 :group 'gnus-thread)
4640 (defun gnus-summary-prepare-threads (threads)
4641 "Prepare summary buffer from THREADS and indentation LEVEL.
4642 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4643 or a straight list of headers."
4644 (gnus-message 7 "Generating summary...")
4646 (setq gnus-newsgroup-threads threads)
4649 (let ((gnus-tmp-level 0)
4650 (default-score (or gnus-summary-default-score 0))
4651 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4652 (building-line-count gnus-summary-display-while-building)
4653 (building-count (integerp gnus-summary-display-while-building))
4654 thread number subject stack state gnus-tmp-gathered beg-match
4655 new-roots gnus-tmp-new-adopts thread-end simp-subject
4656 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4657 gnus-tmp-replied gnus-tmp-subject-or-nil
4658 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4659 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4660 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4663 (setq gnus-tmp-prev-subject nil
4664 gnus-tmp-thread-tree-header-string "")
4666 (if (vectorp (car threads))
4667 ;; If this is a straight (sic) list of headers, then a
4668 ;; threaded summary display isn't required, so we just create
4669 ;; an unthreaded one.
4670 (gnus-summary-prepare-unthreaded threads)
4672 ;; Do the threaded display.
4674 (if gnus-summary-display-while-building
4675 (switch-to-buffer (buffer-name)))
4676 (while (or threads stack gnus-tmp-new-adopts new-roots)
4678 (if (and (= gnus-tmp-level 0)
4681 (not gnus-tmp-false-parent)
4682 (or gnus-tmp-new-adopts new-roots))
4683 (if gnus-tmp-new-adopts
4684 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4685 thread (list (car gnus-tmp-new-adopts))
4686 gnus-tmp-header (caar thread)
4687 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4689 (setq thread (list (car new-roots))
4690 gnus-tmp-header (caar thread)
4691 new-roots (cdr new-roots))))
4694 ;; If there are some threads, we do them before the
4695 ;; threads on the stack.
4696 (setq thread threads
4697 gnus-tmp-header (caar thread))
4698 ;; There were no current threads, so we pop something off
4700 (setq state (car stack)
4701 gnus-tmp-level (car state)
4702 tree-stack (cadr state)
4703 thread (caddr state)
4705 gnus-tmp-header (caar thread))))
4707 (setq gnus-tmp-false-parent nil)
4708 (setq gnus-tmp-root-expunged nil)
4709 (setq thread-end nil)
4711 (if (stringp gnus-tmp-header)
4712 ;; The header is a dummy root.
4714 ((eq gnus-summary-make-false-root 'adopt)
4715 ;; We let the first article adopt the rest.
4716 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4718 (setq gnus-tmp-gathered
4720 (lambda (h) (mail-header-number (car h)))
4723 (setq thread (cons (list (caar thread)
4726 (setq gnus-tmp-level -1
4727 gnus-tmp-false-parent t))
4728 ((eq gnus-summary-make-false-root 'empty)
4729 ;; We print adopted articles with empty subject fields.
4730 (setq gnus-tmp-gathered
4732 (lambda (h) (mail-header-number (car h)))
4735 (setq gnus-tmp-level -1))
4736 ((eq gnus-summary-make-false-root 'dummy)
4737 ;; We remember that we probably want to output a dummy
4739 (setq gnus-tmp-dummy-line gnus-tmp-header)
4740 (setq gnus-tmp-prev-subject gnus-tmp-header))
4742 ;; We do not make a root for the gathered
4743 ;; sub-threads at all.
4744 (setq gnus-tmp-level -1)))
4746 (setq number (mail-header-number gnus-tmp-header)
4747 subject (mail-header-subject gnus-tmp-header)
4748 simp-subject (gnus-simplify-subject-fully subject))
4751 ;; If the thread has changed subject, we might want to make
4752 ;; this subthread into a root.
4753 ((and (null gnus-thread-ignore-subject)
4754 (not (zerop gnus-tmp-level))
4755 gnus-tmp-prev-subject
4756 (not (string= gnus-tmp-prev-subject simp-subject)))
4757 (setq new-roots (nconc new-roots (list (car thread)))
4759 gnus-tmp-header nil))
4760 ;; If the article lies outside the current limit,
4761 ;; then we do not display it.
4762 ((not (memq number gnus-newsgroup-limit))
4763 (setq gnus-tmp-gathered
4765 (lambda (h) (mail-header-number (car h)))
4768 (setq gnus-tmp-new-adopts (if (cdar thread)
4769 (append gnus-tmp-new-adopts
4771 gnus-tmp-new-adopts)
4773 gnus-tmp-header nil)
4774 (when (zerop gnus-tmp-level)
4775 (setq gnus-tmp-root-expunged t)))
4776 ;; Perhaps this article is to be marked as read?
4777 ((and gnus-summary-mark-below
4778 (< (or (cdr (assq number gnus-newsgroup-scored))
4780 gnus-summary-mark-below)
4781 ;; Don't touch sparse articles.
4782 (not (gnus-summary-article-sparse-p number))
4783 (not (gnus-summary-article-ancient-p number)))
4784 (setq gnus-newsgroup-unreads
4785 (delq number gnus-newsgroup-unreads))
4786 (if gnus-newsgroup-auto-expire
4787 (setq gnus-newsgroup-expirable
4788 (gnus-add-to-sorted-list
4789 gnus-newsgroup-expirable number))
4790 (push (cons number gnus-low-score-mark)
4791 gnus-newsgroup-reads))))
4793 (when gnus-tmp-header
4794 ;; We may have an old dummy line to output before this
4796 (when (and gnus-tmp-dummy-line
4799 (mail-header-subject gnus-tmp-header)))
4800 (gnus-summary-insert-dummy-line
4801 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4802 (setq gnus-tmp-dummy-line nil))
4804 ;; Compute the mark.
4805 (setq gnus-tmp-unread (gnus-article-mark number))
4807 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4808 gnus-tmp-header gnus-tmp-level)
4809 gnus-newsgroup-data)
4811 ;; Actually insert the line.
4813 gnus-tmp-subject-or-nil
4815 ((and gnus-thread-ignore-subject
4816 gnus-tmp-prev-subject
4817 (not (string= gnus-tmp-prev-subject simp-subject)))
4819 ((zerop gnus-tmp-level)
4820 (if (and (eq gnus-summary-make-false-root 'empty)
4821 (memq number gnus-tmp-gathered)
4822 gnus-tmp-prev-subject
4823 (string= gnus-tmp-prev-subject simp-subject))
4824 gnus-summary-same-subject
4826 (t gnus-summary-same-subject)))
4827 (if (and (eq gnus-summary-make-false-root 'adopt)
4828 (= gnus-tmp-level 1)
4829 (memq number gnus-tmp-gathered))
4830 (setq gnus-tmp-opening-bracket ?\<
4831 gnus-tmp-closing-bracket ?\>)
4832 (setq gnus-tmp-opening-bracket ?\[
4833 gnus-tmp-closing-bracket ?\]))
4835 gnus-tmp-indentation
4836 (aref gnus-thread-indent-array gnus-tmp-level)
4837 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4838 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4839 gnus-summary-default-score 0)
4841 (if (or (null gnus-summary-default-score)
4842 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4843 gnus-summary-zcore-fuzz))
4845 (if (< gnus-tmp-score gnus-summary-default-score)
4846 gnus-score-below-mark gnus-score-over-mark))
4848 (cond ((memq number gnus-newsgroup-processable)
4850 ((memq number gnus-newsgroup-cached)
4852 ((memq number gnus-newsgroup-replied)
4854 ((memq number gnus-newsgroup-forwarded)
4855 gnus-forwarded-mark)
4856 ((memq number gnus-newsgroup-saved)
4858 ((memq number gnus-newsgroup-recent)
4860 ((memq number gnus-newsgroup-unseen)
4864 (cond ((memq number gnus-newsgroup-undownloaded)
4865 gnus-undownloaded-mark)
4866 (gnus-newsgroup-agentized
4867 gnus-downloaded-mark)
4870 gnus-tmp-from (mail-header-from gnus-tmp-header)
4873 ((string-match "<[^>]+> *$" gnus-tmp-from)
4874 (setq beg-match (match-beginning 0))
4875 (or (and (string-match "^\".+\"" gnus-tmp-from)
4876 (substring gnus-tmp-from 1 (1- (match-end 0))))
4877 (substring gnus-tmp-from 0 beg-match)))
4878 ((string-match "(.+)" gnus-tmp-from)
4879 (substring gnus-tmp-from
4880 (1+ (match-beginning 0)) (1- (match-end 0))))
4884 gnus-tmp-thread-tree-header-string
4886 ((not gnus-show-threads) "")
4887 ((zerop gnus-tmp-level)
4888 (cond ((cdar thread)
4889 (or gnus-sum-thread-tree-root subject))
4890 (gnus-tmp-new-adopts
4891 (or gnus-sum-thread-tree-false-root subject))
4893 (or gnus-sum-thread-tree-single-indent subject))))
4895 (concat (apply 'concat
4896 (mapcar (lambda (item)
4898 gnus-sum-thread-tree-vertical
4899 gnus-sum-thread-tree-indent))
4900 (cdr (reverse tree-stack))))
4902 gnus-sum-thread-tree-leaf-with-other
4903 gnus-sum-thread-tree-single-leaf)))))
4904 (when (string= gnus-tmp-name "")
4905 (setq gnus-tmp-name gnus-tmp-from))
4906 (unless (numberp gnus-tmp-lines)
4907 (setq gnus-tmp-lines -1))
4908 (if (= gnus-tmp-lines -1)
4909 (setq gnus-tmp-lines "?")
4910 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4911 (gnus-put-text-property
4913 (progn (eval gnus-summary-line-format-spec) (point))
4914 'gnus-number number)
4917 (gnus-run-hooks 'gnus-summary-update-hook)
4920 (setq gnus-tmp-prev-subject simp-subject)))
4922 (when (nth 1 thread)
4923 (push (list (max 0 gnus-tmp-level)
4924 (copy-sequence tree-stack)
4927 (push (if (nth 1 thread) 1 0) tree-stack)
4928 (incf gnus-tmp-level)
4929 (setq threads (if thread-end nil (cdar thread)))
4930 (if gnus-summary-display-while-building
4933 ;; use a set frequency
4934 (setq building-line-count (1- building-line-count))
4935 (when (= building-line-count 0)
4937 (setq building-line-count
4938 gnus-summary-display-while-building)))
4942 (setq gnus-tmp-level 0)))))
4943 (gnus-message 7 "Generating summary...done"))
4945 (defun gnus-summary-prepare-unthreaded (headers)
4946 "Generate an unthreaded summary buffer based on HEADERS."
4947 (let (header number mark)
4952 ;; We may have to root out some bad articles...
4953 (when (memq (setq number (mail-header-number
4954 (setq header (pop headers))))
4955 gnus-newsgroup-limit)
4956 ;; Mark article as read when it has a low score.
4957 (when (and gnus-summary-mark-below
4958 (< (or (cdr (assq number gnus-newsgroup-scored))
4959 gnus-summary-default-score 0)
4960 gnus-summary-mark-below)
4961 (not (gnus-summary-article-ancient-p number)))
4962 (setq gnus-newsgroup-unreads
4963 (delq number gnus-newsgroup-unreads))
4964 (if gnus-newsgroup-auto-expire
4965 (push number gnus-newsgroup-expirable)
4966 (push (cons number gnus-low-score-mark)
4967 gnus-newsgroup-reads)))
4969 (setq mark (gnus-article-mark number))
4970 (push (gnus-data-make number mark (1+ (point)) header 0)
4971 gnus-newsgroup-data)
4972 (gnus-summary-insert-line
4974 (memq number gnus-newsgroup-undownloaded)
4975 mark (memq number gnus-newsgroup-replied)
4976 (memq number gnus-newsgroup-expirable)
4977 (mail-header-subject header) nil
4978 (cdr (assq number gnus-newsgroup-scored))
4979 (memq number gnus-newsgroup-processable))))))
4981 (defun gnus-summary-remove-list-identifiers ()
4982 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4983 (let ((regexp (if (consp gnus-list-identifiers)
4984 (mapconcat 'identity gnus-list-identifiers " *\\|")
4985 gnus-list-identifiers))
4988 (dolist (header gnus-newsgroup-headers)
4989 (setq subject (mail-header-subject header)
4991 (while (string-match
4992 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4995 (concat (substring subject 0 (match-beginning 2))
4996 (substring subject (match-end 0)))
5000 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
5002 (concat (substring subject 0 (match-beginning 1))
5003 (substring subject (match-end 1)))))
5005 (mail-header-set-subject header subject))))))
5007 (defun gnus-fetch-headers (articles)
5008 "Fetch headers of ARTICLES."
5009 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5010 (gnus-message 5 "Fetching headers for %s..." name)
5013 (setq gnus-headers-retrieved-by
5014 (gnus-retrieve-headers
5015 articles gnus-newsgroup-name
5016 ;; We might want to fetch old headers, but
5017 ;; not if there is only 1 article.
5019 (not (eq gnus-fetch-old-headers 'some))
5020 (not (numberp gnus-fetch-old-headers)))
5021 (> (length articles) 1))
5022 gnus-fetch-old-headers))))
5023 (gnus-get-newsgroup-headers-xover
5024 articles nil nil gnus-newsgroup-name t)
5025 (gnus-get-newsgroup-headers))
5026 (gnus-message 5 "Fetching headers for %s...done" name))))
5028 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5029 "Select newsgroup GROUP.
5030 If READ-ALL is non-nil, all articles in the group are selected.
5031 If SELECT-ARTICLES, only select those articles from GROUP."
5032 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5033 ;;!!! Dirty hack; should be removed.
5034 (gnus-summary-ignore-duplicates
5035 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5037 gnus-summary-ignore-duplicates))
5038 (info (nth 2 entry))
5039 articles fetched-articles cached)
5041 (unless (gnus-check-server
5042 (set (make-local-variable 'gnus-current-select-method)
5043 (gnus-find-method-for-group group)))
5044 (error "Couldn't open server"))
5046 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5047 (gnus-activate-group group) ; Or we can activate it...
5048 (progn ; Or we bug out.
5049 (when (equal major-mode 'gnus-summary-mode)
5050 (gnus-kill-buffer (current-buffer)))
5051 (error "Couldn't activate group %s: %s"
5052 group (gnus-status-message group))))
5054 (unless (gnus-request-group group t)
5055 (when (equal major-mode 'gnus-summary-mode)
5056 (gnus-kill-buffer (current-buffer)))
5057 (error "Couldn't request group %s: %s"
5058 group (gnus-status-message group)))
5061 ;; The agent may be storing articles that are no longer in the
5062 ;; server's active range. If that is the case, the active range
5063 ;; needs to be expanded such that the agent's articles can be
5064 ;; included in the summary.
5065 (let* ((gnus-command-method (gnus-find-method-for-group group))
5066 (alist (gnus-agent-load-alist group))
5067 (active (gnus-active group)))
5068 (if (and (car alist)
5069 (< (caar alist) (car active)))
5070 (gnus-set-active group (cons (caar alist) (cdr active)))))
5072 (setq gnus-summary-use-undownloaded-faces
5073 (gnus-agent-find-parameter
5075 'agent-enable-undownloaded-faces)))
5077 (setq gnus-newsgroup-name group
5078 gnus-newsgroup-unselected nil
5079 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5081 (let ((display (gnus-group-find-parameter group 'display)))
5082 (setq gnus-newsgroup-display
5084 ((not (zerop (or (car-safe read-all) 0)))
5085 ;; The user entered the group with C-u SPC/RET, let's show
5091 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5093 ;; The following is probably the "correct" solution, but
5094 ;; it makes Gnus fetch all headers and then limit the
5095 ;; articles (which is slow), so instead we hack the
5096 ;; select-articles parameter instead. -- Simon Josefsson
5099 ;; (gnus-byte-compile
5100 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5102 (setq select-articles
5103 (gnus-uncompress-range
5104 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5108 (cdr (gnus-active group)))))
5113 (gnus-summary-setup-default-charset)
5115 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5116 (when (gnus-virtual-group-p group)
5117 (setq cached gnus-newsgroup-cached))
5119 (setq gnus-newsgroup-unreads
5120 (gnus-sorted-ndifference
5121 (gnus-sorted-ndifference gnus-newsgroup-unreads
5122 gnus-newsgroup-marked)
5123 gnus-newsgroup-dormant))
5125 (setq gnus-newsgroup-processable nil)
5127 (gnus-update-read-articles group gnus-newsgroup-unreads)
5129 ;; Adjust and set lists of article marks.
5131 (gnus-adjust-marked-articles info))
5132 (if (setq articles select-articles)
5133 (setq gnus-newsgroup-unselected
5134 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5135 (setq articles (gnus-articles-to-read group read-all)))
5139 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5141 ((eq articles 0) nil)
5143 ;; Init the dependencies hash table.
5144 (setq gnus-newsgroup-dependencies
5145 (gnus-make-hashtable (length articles)))
5146 (gnus-set-global-variables)
5147 ;; Retrieve the headers and read them in.
5149 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5151 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5153 (setq gnus-newsgroup-cached cached))
5155 ;; Suppress duplicates?
5156 (when gnus-suppress-duplicates
5157 (gnus-dup-suppress-articles))
5159 ;; Set the initial limit.
5160 (setq gnus-newsgroup-limit (copy-sequence articles))
5161 ;; Remove canceled articles from the list of unread articles.
5162 (setq fetched-articles
5163 (mapcar (lambda (headers) (mail-header-number headers))
5164 gnus-newsgroup-headers))
5165 (setq gnus-newsgroup-articles fetched-articles)
5166 (setq gnus-newsgroup-unreads
5167 (gnus-sorted-nintersection
5168 gnus-newsgroup-unreads fetched-articles))
5169 (gnus-compute-unseen-list)
5171 ;; Removed marked articles that do not exist.
5172 (gnus-update-missing-marks
5173 (gnus-sorted-difference articles fetched-articles))
5174 ;; We might want to build some more threads first.
5175 (when (and gnus-fetch-old-headers
5176 (eq gnus-headers-retrieved-by 'nov))
5177 (if (eq gnus-fetch-old-headers 'invisible)
5178 (gnus-build-all-threads)
5179 (gnus-build-old-threads)))
5180 ;; Let the Gnus agent mark articles as read.
5182 (gnus-agent-get-undownloaded-list))
5183 ;; Remove list identifiers from subject
5184 (when gnus-list-identifiers
5185 (gnus-summary-remove-list-identifiers))
5186 ;; Check whether auto-expire is to be done in this group.
5187 (setq gnus-newsgroup-auto-expire
5188 (gnus-group-auto-expirable-p group))
5189 ;; Set up the article buffer now, if necessary.
5190 (unless gnus-single-article-buffer
5191 (gnus-article-setup-buffer))
5192 ;; First and last article in this newsgroup.
5193 (when gnus-newsgroup-headers
5194 (setq gnus-newsgroup-begin
5195 (mail-header-number (car gnus-newsgroup-headers))
5198 (gnus-last-element gnus-newsgroup-headers))))
5199 ;; GROUP is successfully selected.
5200 (or gnus-newsgroup-headers t)))))
5202 (defun gnus-compute-unseen-list ()
5203 ;; The `seen' marks are treated specially.
5204 (if (not gnus-newsgroup-seen)
5205 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5206 (setq gnus-newsgroup-unseen
5207 (gnus-inverse-list-range-intersection
5208 gnus-newsgroup-articles gnus-newsgroup-seen))))
5210 (defun gnus-summary-display-make-predicate (display)
5211 (require 'gnus-agent)
5212 (when (= (length display) 1)
5213 (setq display (car display)))
5214 (unless gnus-summary-display-cache
5215 (dolist (elem (append '((unread . unread)
5218 gnus-article-mark-lists))
5219 (push (cons (cdr elem)
5221 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5222 gnus-summary-display-cache)))
5223 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5224 (gnus-category-predicate-cache gnus-summary-display-cache))
5225 (gnus-get-predicate display)))
5227 ;; Uses the dynamically bound `number' variable.
5230 (defun gnus-article-marked-p (type &optional article)
5231 (let ((article (or article number)))
5234 (memq article gnus-newsgroup-marked))
5236 (memq article gnus-newsgroup-spam-marked))
5238 (memq article gnus-newsgroup-unsendable))
5239 ((eq type 'undownload)
5240 (memq article gnus-newsgroup-undownloaded))
5241 ((eq type 'download)
5242 (memq article gnus-newsgroup-downloadable))
5244 (memq article gnus-newsgroup-unreads))
5246 (memq article gnus-newsgroup-reads))
5248 (memq article gnus-newsgroup-dormant) )
5250 (memq article gnus-newsgroup-expirable))
5252 (memq article gnus-newsgroup-replied))
5254 (memq article gnus-newsgroup-killed))
5255 ((eq type 'bookmark)
5256 (assq article gnus-newsgroup-bookmarks))
5258 (assq article gnus-newsgroup-scored))
5260 (memq article gnus-newsgroup-saved))
5262 (memq article gnus-newsgroup-cached))
5264 (memq article gnus-newsgroup-forwarded))
5266 (not (memq article gnus-newsgroup-unseen)))
5268 (memq article gnus-newsgroup-recent))
5271 (defun gnus-articles-to-read (group &optional read-all)
5272 "Find out what articles the user wants to read."
5273 (let* ((display (gnus-group-find-parameter group 'display))
5275 ;; Select all articles if `read-all' is non-nil, or if there
5276 ;; are no unread articles.
5278 (and (zerop (length gnus-newsgroup-marked))
5279 (zerop (length gnus-newsgroup-unreads)))
5280 ;; Fetch all if the predicate is non-nil.
5281 gnus-newsgroup-display)
5282 ;; We want to select the headers for all the articles in
5283 ;; the group, so we select either all the active
5284 ;; articles in the group, or (if that's nil), the
5285 ;; articles in the cache.
5287 (gnus-uncompress-range (gnus-active group))
5288 (gnus-cache-articles-in-group group))
5289 ;; Select only the "normal" subset of articles.
5291 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5292 gnus-newsgroup-unreads)))
5293 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5294 (scored (length scored-list))
5295 (number (length articles))
5296 (marked (+ (length gnus-newsgroup-marked)
5297 (length gnus-newsgroup-dormant)))
5302 ((numberp gnus-newsgroup-display)
5303 gnus-newsgroup-display)
5307 ((and (or (<= scored marked) (= scored number))
5308 (numberp gnus-large-newsgroup)
5309 (> number gnus-large-newsgroup))
5310 (let* ((cursor-in-echo-area nil)
5311 (initial (gnus-parameter-large-newsgroup-initial
5312 gnus-newsgroup-name))
5316 "How many articles from %s (%s %d): "
5318 (gnus-group-decoded-name gnus-newsgroup-name)
5320 (if initial "max" "default")
5323 (cons (number-to-string initial)
5325 (if (string-match "^[ \t]*$" input) number input)))
5326 ((and (> scored marked) (< scored number)
5327 (> (- scored number) 20))
5330 (format "%s %s (%d scored, %d total): "
5331 "How many articles from"
5332 (gnus-group-decoded-name group)
5334 (if (string-match "^[ \t]*$" input)
5338 (message "Quit getting the articles to read")
5340 (setq select (if (stringp select) (string-to-number select) select))
5341 (if (or (null select) (zerop select))
5343 (if (and (not (zerop scored)) (<= (abs select) scored))
5345 (setq articles (sort scored-list '<))
5346 (setq number (length articles)))
5347 (setq articles (copy-sequence articles)))
5349 (when (< (abs select) number)
5351 ;; Select the N oldest articles.
5352 (setcdr (nthcdr (1- (abs select)) articles) nil)
5353 ;; Select the N most recent articles.
5354 (setq articles (nthcdr (- number select) articles))))
5355 (setq gnus-newsgroup-unselected
5356 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5357 (when gnus-alter-articles-to-read-function
5360 (funcall gnus-alter-articles-to-read-function
5361 gnus-newsgroup-name articles)
5365 (defun gnus-killed-articles (killed articles)
5368 (when (inline (gnus-member-of-range (car articles) killed))
5369 (push (car articles) out))
5370 (setq articles (cdr articles)))
5373 (defun gnus-uncompress-marks (marks)
5374 "Uncompress the mark ranges in MARKS."
5375 (let ((uncompressed '(score bookmark))
5378 (if (memq (caar marks) uncompressed)
5379 (push (car marks) out)
5380 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5381 (setq marks (cdr marks)))
5384 (defun gnus-article-mark-to-type (mark)
5385 "Return the type of MARK."
5386 (or (cadr (assq mark gnus-article-special-mark-lists))
5389 (defun gnus-article-unpropagatable-p (mark)
5390 "Return whether MARK should be propagated to back end."
5391 (memq mark gnus-article-unpropagated-mark-lists))
5393 (defun gnus-adjust-marked-articles (info)
5394 "Set all article lists and remove all marks that are no longer valid."
5395 (let* ((marked-lists (gnus-info-marks info))
5396 (active (gnus-active (gnus-info-group info)))
5399 (types gnus-article-mark-lists)
5400 marks var articles article mark mark-type)
5402 (dolist (marks marked-lists)
5403 (setq mark (car marks)
5404 mark-type (gnus-article-mark-to-type mark)
5405 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5407 ;; We set the variable according to the type of the marks list,
5408 ;; and then adjust the marks to a subset of the active articles.
5410 ;; Adjust "simple" lists.
5411 ((eq mark-type 'list)
5412 (set var (setq articles (gnus-uncompress-range (cdr marks))))
5413 (when (memq mark '(tick dormant expire reply save))
5415 (when (or (< (setq article (pop articles)) min) (> article max))
5416 (set var (delq article (symbol-value var)))))))
5418 ((eq mark-type 'tuple)
5419 (set var (setq articles (cdr marks)))
5420 (when (not (listp (cdr (symbol-value var))))
5421 (set var (list (symbol-value var))))
5422 (when (not (listp (cdr articles)))
5423 (setq articles (list articles)))
5425 (when (or (not (consp (setq article (pop articles))))
5426 (< (car article) min)
5427 (> (car article) max))
5428 (set var (delq article (symbol-value var))))))
5429 ;; Adjust ranges (sloppily).
5430 ((eq mark-type 'range)
5433 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5434 ;; It should be (seen (NUM1 . NUM2)).
5435 (when (numberp (cddr marks))
5436 (setcdr marks (list (cdr marks))))
5437 (setq articles (cdr marks))
5438 (while (and articles
5439 (or (and (consp (car articles))
5440 (> min (cdar articles)))
5441 (and (numberp (car articles))
5442 (> min (car articles)))))
5444 (set var articles))))))))
5446 (defun gnus-update-missing-marks (missing)
5447 "Go through the list of MISSING articles and remove them from the mark lists."
5450 ;; Go through all types.
5451 (dolist (elem gnus-article-mark-lists)
5452 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5453 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5454 (when (symbol-value var)
5455 ;; This list has articles. So we delete all missing
5456 ;; articles from it.
5459 (set var (delq (pop m) (symbol-value var))))))))))
5461 (defun gnus-update-marks ()
5462 "Enter the various lists of marked articles into the newsgroup info list."
5463 (let ((types gnus-article-mark-lists)
5464 (info (gnus-get-info gnus-newsgroup-name))
5465 type list newmarked symbol delta-marks)
5467 ;; Add all marks lists to the list of marks lists.
5468 (while (setq type (pop types))
5469 (setq list (symbol-value
5471 (intern (format "gnus-newsgroup-%s" (car type))))))
5474 ;; Get rid of the entries of the articles that have the
5476 (when (and (eq (cdr type) 'score)
5480 (prev (cons nil list))
5483 (if (or (not (consp (car arts)))
5484 (= (cdar arts) gnus-summary-default-score))
5485 (setcdr prev (cdr arts))
5487 (setq arts (cdr arts)))
5488 (setq list (cdr all)))))
5490 (when (eq (cdr type) 'seen)
5491 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5493 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5494 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5496 (when (and (gnus-check-backend-function
5497 'request-set-mark gnus-newsgroup-name)
5498 (not (gnus-article-unpropagatable-p (cdr type))))
5499 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5500 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5501 (add (gnus-remove-from-range
5502 (gnus-copy-sequence list) old)))
5504 (push (list add 'add (list (cdr type))) delta-marks))
5506 (push (list del 'del (list (cdr type))) delta-marks))))
5509 (push (cons (cdr type) list) newmarked)))
5512 (unless (gnus-check-group gnus-newsgroup-name)
5513 (error "Can't open server for %s" gnus-newsgroup-name))
5514 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5516 ;; Enter these new marks into the info of the group.
5518 (setcar (nthcdr 3 info) newmarked)
5519 ;; Add the marks lists to the end of the info.
5521 (setcdr (nthcdr 2 info) (list newmarked))))
5523 ;; Cut off the end of the info if there's nothing else there.
5527 (when (nthcdr (decf i) info)
5528 (setcdr (nthcdr i info) nil)))))))
5530 (defun gnus-set-mode-line (where)
5531 "Set the mode line of the article or summary buffers.
5532 If WHERE is `summary', the summary mode line format will be used."
5533 ;; Is this mode line one we keep updated?
5534 (when (and (memq where gnus-updated-mode-lines)
5536 (intern (format "gnus-%s-mode-line-format-spec" where))))
5539 ;; We evaluate this in the summary buffer since these
5540 ;; variables are buffer-local to that buffer.
5541 (set-buffer gnus-summary-buffer)
5542 ;; We bind all these variables that are used in the `eval' form
5544 (let* ((mformat (symbol-value
5546 (format "gnus-%s-mode-line-format-spec" where))))
5547 (gnus-tmp-group-name (gnus-group-decoded-name
5548 gnus-newsgroup-name))
5549 (gnus-tmp-article-number (or gnus-current-article 0))
5550 (gnus-tmp-unread gnus-newsgroup-unreads)
5551 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5552 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5553 (gnus-tmp-unread-and-unselected
5554 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5555 (zerop gnus-tmp-unselected))
5557 ((zerop gnus-tmp-unselected)
5558 (format "{%d more}" gnus-tmp-unread-and-unticked))
5559 (t (format "{%d(+%d) more}"
5560 gnus-tmp-unread-and-unticked
5561 gnus-tmp-unselected))))
5563 (if (and gnus-current-headers
5564 (vectorp gnus-current-headers))
5565 (gnus-mode-string-quote
5566 (mail-header-subject gnus-current-headers))
5568 bufname-length max-len
5569 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5570 (setq mode-string (eval mformat))
5571 (setq bufname-length (if (string-match "%b" mode-string)
5574 (if (eq where 'summary)
5576 (get-buffer gnus-article-buffer))))
5579 (setq max-len (max 4 (if gnus-mode-non-string-length
5581 gnus-mode-non-string-length
5583 (length mode-string))))
5584 ;; We might have to chop a bit of the string off...
5585 (when (> (length mode-string) max-len)
5587 (concat (truncate-string-to-width mode-string (- max-len 3))
5589 ;; Pad the mode string a bit.
5590 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5591 ;; Update the mode line.
5592 (setq mode-line-buffer-identification
5593 (gnus-mode-line-buffer-identification (list mode-string)))
5594 (set-buffer-modified-p t))))
5596 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5597 "Go through the HEADERS list and add all Xrefs to a hash table.
5598 The resulting hash table is returned, or nil if no Xrefs were found."
5599 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5600 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5601 (xref-hashtb (gnus-make-hashtable))
5602 start group entry number xrefs header)
5604 (setq header (pop headers))
5605 (when (and (setq xrefs (mail-header-xref header))
5606 (not (memq (setq number (mail-header-number header))
5609 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5610 (setq start (match-end 0))
5611 (setq group (if prefix
5612 (concat prefix (substring xrefs (match-beginning 1)
5614 (substring xrefs (match-beginning 1) (match-end 1))))
5616 (string-to-int (substring xrefs (match-beginning 2)
5618 (if (setq entry (gnus-gethash group xref-hashtb))
5619 (setcdr entry (cons number (cdr entry)))
5620 (gnus-sethash group (cons number nil) xref-hashtb)))))
5621 (and start xref-hashtb)))
5623 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5624 "Look through all the headers and mark the Xrefs as read."
5625 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5626 name entry info xref-hashtb idlist method nth4)
5628 (set-buffer gnus-group-buffer)
5629 (when (setq xref-hashtb
5630 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5633 (unless (string= from-newsgroup (setq name (symbol-name group)))
5634 (setq idlist (symbol-value group))
5635 ;; Dead groups are not updated.
5637 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5639 (when (stringp (setq nth4 (gnus-info-method info)))
5640 (setq nth4 (gnus-server-to-method nth4))))
5641 ;; Only do the xrefs if the group has the same
5642 ;; select method as the group we have just read.
5643 (or (gnus-methods-equal-p
5644 nth4 (gnus-find-method-for-group from-newsgroup))
5646 (equal nth4 (setq method (gnus-find-method-for-group
5648 (and (equal (car nth4) (car method))
5649 (equal (nth 1 nth4) (nth 1 method))))
5650 gnus-use-cross-reference
5651 (or (not (eq gnus-use-cross-reference t))
5653 ;; Only do cross-references on subscribed
5654 ;; groups, if that is what is wanted.
5655 (<= (gnus-info-level info) gnus-level-subscribed))
5656 (gnus-group-make-articles-read name idlist))))
5659 (defun gnus-compute-read-articles (group articles)
5660 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5661 (info (nth 2 entry))
5662 (active (gnus-active group))
5665 ;; First peel off all invalid article numbers.
5667 (let ((ids articles)
5669 (while (setq id (pop ids))
5670 (when (and first (> id (cdr active)))
5671 ;; We'll end up in this situation in one particular
5672 ;; obscure situation. If you re-scan a group and get
5673 ;; a new article that is cross-posted to a different
5674 ;; group that has not been re-scanned, you might get
5675 ;; crossposted article that has a higher number than
5676 ;; Gnus believes possible. So we re-activate this
5677 ;; group as well. This might mean doing the
5678 ;; crossposting thingy will *increase* the number
5679 ;; of articles in some groups. Tsk, tsk.
5680 (setq active (or (gnus-activate-group group) active)))
5681 (when (or (> id (cdr active))
5682 (< id (car active)))
5683 (setq articles (delq id articles))))))
5684 ;; If the read list is nil, we init it.
5686 (null (gnus-info-read info))
5688 (setq ninfo (cons 1 (1- (car active))))
5689 (setq ninfo (gnus-info-read info)))
5690 ;; Then we add the read articles to the range.
5692 ninfo (setq articles (sort articles '<))))))
5694 (defun gnus-group-make-articles-read (group articles)
5695 "Update the info of GROUP to say that ARTICLES are read."
5697 (entry (gnus-gethash group gnus-newsrc-hashtb))
5698 (info (nth 2 entry))
5699 (active (gnus-active group))
5702 (setq range (gnus-compute-read-articles group articles))
5704 (set-buffer gnus-group-buffer)
5707 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5708 (gnus-info-set-read ',info ',(gnus-info-read info))
5709 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5710 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5711 (gnus-group-update-group ,group t))))
5712 ;; Add the read articles to the range.
5713 (gnus-info-set-read info range)
5714 (gnus-request-set-mark group (list (list range 'add '(read))))
5715 ;; Then we have to re-compute how many unread
5716 ;; articles there are in this group.
5720 (setq num (- (1+ (cdr active)) (car active))))
5721 ((not (listp (cdr range)))
5722 (setq num (- (cdr active) (- (1+ (cdr range))
5726 (if (numberp (car range))
5728 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5729 (setq range (cdr range)))
5730 (setq num (- (cdr active) num))))
5731 ;; Update the number of unread articles.
5733 ;; Update the group buffer.
5734 (unless (gnus-ephemeral-group-p group)
5735 (gnus-group-update-group group t))))))
5737 (defvar gnus-newsgroup-none-id 0)
5739 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5740 (let ((cur nntp-server-buffer)
5743 (save-excursion (set-buffer gnus-summary-buffer)
5744 gnus-newsgroup-dependencies)))
5746 (mail-parse-charset gnus-newsgroup-charset)
5747 (mail-parse-ignored-charsets
5748 (save-excursion (condition-case nil
5749 (set-buffer gnus-summary-buffer)
5751 gnus-newsgroup-ignored-charsets)))
5753 (set-buffer nntp-server-buffer)
5754 ;; Translate all TAB characters into SPACE characters.
5755 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5756 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5757 (ietf-drums-unfold-fws)
5758 (gnus-run-hooks 'gnus-parse-headers-hook)
5759 (let ((case-fold-search t)
5760 in-reply-to header p lines chars)
5761 (goto-char (point-min))
5762 ;; Search to the beginning of the next header. Error messages
5763 ;; do not begin with 2 or 3.
5764 (while (re-search-forward "^[23][0-9]+ " nil t)
5767 ;; This implementation of this function, with nine
5768 ;; search-forwards instead of the one re-search-forward and
5769 ;; a case (which basically was the old function) is actually
5770 ;; about twice as fast, even though it looks messier. You
5771 ;; can't have everything, I guess. Speed and elegance
5772 ;; doesn't always go hand in hand.
5781 (narrow-to-region (point)
5782 (or (and (search-forward "\n.\n" nil t)
5788 (if (search-forward "\nsubject:" nil t)
5789 (funcall gnus-decode-encoded-word-function
5790 (nnheader-header-value))
5795 (if (search-forward "\nfrom:" nil t)
5796 (funcall gnus-decode-encoded-word-function
5797 (nnheader-header-value))
5802 (if (search-forward "\ndate:" nil t)
5803 (nnheader-header-value) ""))
5807 (setq id (if (re-search-forward
5808 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5809 ;; We do it this way to make sure the Message-ID
5810 ;; is (somewhat) syntactically valid.
5811 (buffer-substring (match-beginning 1)
5813 ;; If there was no message-id, we just fake one
5814 ;; to make subsequent routines simpler.
5815 (nnheader-generate-fake-message-id))))
5819 (if (search-forward "\nreferences:" nil t)
5823 (nnheader-header-value)
5828 (search-backward ">" end t)
5831 (search-backward "<" end t)
5833 ;; Get the references from the in-reply-to header if there
5834 ;; were no references and the in-reply-to header looks
5836 (if (and (search-forward "\nin-reply-to:" nil t)
5837 (setq in-reply-to (nnheader-header-value))
5838 (string-match "<[^>]+>" in-reply-to))
5840 (setq ref (substring in-reply-to (match-beginning 0)
5842 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5843 (setq ref2 (substring in-reply-to (match-beginning 0)
5845 (when (> (length ref2) (length ref))
5852 (if (search-forward "\nchars: " nil t)
5853 (if (numberp (setq chars (ignore-errors (read cur))))
5859 (if (search-forward "\nlines: " nil t)
5860 (if (numberp (setq lines (ignore-errors (read cur))))
5866 (and (search-forward "\nxref:" nil t)
5867 (nnheader-header-value)))
5869 (when gnus-extra-headers
5870 (let ((extra gnus-extra-headers)
5874 (when (search-forward
5875 (concat "\n" (symbol-name (car extra)) ":") nil t)
5876 (push (cons (car extra) (nnheader-header-value))
5880 (when (equal id ref)
5883 (when gnus-alter-header-function
5884 (funcall gnus-alter-header-function header)
5885 (setq id (mail-header-id header)
5886 ref (gnus-parent-id (mail-header-references header))))
5889 (gnus-dependencies-add-header
5890 header dependencies force-new))
5891 (push header headers))
5892 (goto-char (point-max))
5894 (nreverse headers)))))
5896 ;; Goes through the xover lines and returns a list of vectors
5897 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5898 force-new dependencies
5899 group also-fetch-heads)
5900 "Parse the news overview data in the server buffer.
5901 Return a list of headers that match SEQUENCE (see
5902 `nntp-retrieve-headers')."
5903 ;; Get the Xref when the users reads the articles since most/some
5904 ;; NNTP servers do not include Xrefs when using XOVER.
5905 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5906 (let ((mail-parse-charset gnus-newsgroup-charset)
5907 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5908 (cur nntp-server-buffer)
5909 (dependencies (or dependencies gnus-newsgroup-dependencies))
5911 ((eq gnus-read-all-available-headers t)
5913 ((stringp gnus-read-all-available-headers)
5914 (string-match gnus-read-all-available-headers group))
5917 number headers header)
5919 (set-buffer nntp-server-buffer)
5920 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5921 ;; Allow the user to mangle the headers before parsing them.
5922 (gnus-run-hooks 'gnus-parse-headers-hook)
5923 (goto-char (point-min))
5924 (gnus-parse-without-error
5925 (while (and (or sequence allp)
5927 (setq number (read cur))
5929 (while (and sequence
5930 (< (car sequence) number))
5931 (setq sequence (cdr sequence))))
5934 (eq number (car sequence))))
5936 (setq sequence (cdr sequence))
5937 (setq header (inline
5938 (gnus-nov-parse-line
5939 number dependencies force-new)))))
5940 (push header headers))
5942 ;; A common bug in inn is that if you have posted an article and
5943 ;; then retrieves the active file, it will answer correctly --
5944 ;; the new article is included. However, a NOV entry for the
5945 ;; article may not have been generated yet, so this may fail.
5946 ;; We work around this problem by retrieving the last few
5947 ;; headers using HEAD.
5948 (if (or (not also-fetch-heads)
5950 ;; We (probably) got all the headers.
5952 (let ((gnus-nov-is-evil t))
5955 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5956 (gnus-get-newsgroup-headers))))))))
5958 (defun gnus-article-get-xrefs ()
5959 "Fill in the Xref value in `gnus-current-headers', if necessary.
5960 This is meant to be called in `gnus-article-internal-prepare-hook'."
5961 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5962 gnus-current-headers)))
5963 (or (not gnus-use-cross-reference)
5965 (and (mail-header-xref headers)
5966 (not (string= (mail-header-xref headers) "")))
5967 (let ((case-fold-search t)
5970 (nnheader-narrow-to-headers)
5971 (goto-char (point-min))
5972 (when (or (and (not (eobp))
5973 (eq (downcase (char-after)) ?x)
5974 (looking-at "Xref:"))
5975 (search-forward "\nXref:" nil t))
5976 (goto-char (1+ (match-end 0)))
5977 (setq xref (buffer-substring (point) (gnus-point-at-eol)))
5978 (mail-header-set-xref headers xref)))))))
5980 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5981 "Find article ID and insert the summary line for that article.
5982 OLD-HEADER can either be a header or a line number to insert
5983 the subject line on."
5984 (let* ((line (and (numberp old-header) old-header))
5985 (old-header (and (vectorp old-header) old-header))
5986 (header (cond ((and old-header use-old-header)
5989 (gnus-number-to-header id))
5990 (gnus-number-to-header id))
5992 (gnus-read-header id))))
5993 (number (and (numberp id) id))
5996 ;; Rebuild the thread that this article is part of and go to the
5997 ;; article we have fetched.
5998 (when (and (not gnus-show-threads)
6001 (setq d (gnus-data-find (mail-header-number old-header))))
6002 (goto-char (gnus-data-pos d))
6005 (- (gnus-point-at-bol)
6007 (1+ (gnus-point-at-eol))
6008 (gnus-delete-line))))))
6009 ;; Remove list identifiers from subject.
6010 (when gnus-list-identifiers
6011 (let ((gnus-newsgroup-headers (list header)))
6012 (gnus-summary-remove-list-identifiers)
6013 (setq header (car gnus-newsgroup-headers))))
6015 (mail-header-set-number header (mail-header-number old-header)))
6016 (setq gnus-newsgroup-sparse
6017 (delq (setq number (mail-header-number header))
6018 gnus-newsgroup-sparse))
6019 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6020 (push number gnus-newsgroup-limit)
6021 (gnus-rebuild-thread (mail-header-id header) line)
6022 (gnus-summary-goto-subject number nil t))
6023 (when (and (numberp number)
6025 ;; We have to update the boundaries even if we can't fetch the
6026 ;; article if ID is a number -- so that the next `P' or `N'
6027 ;; command will fetch the previous (or next) article even
6028 ;; if the one we tried to fetch this time has been canceled.
6029 (when (> number gnus-newsgroup-end)
6030 (setq gnus-newsgroup-end number))
6031 (when (< number gnus-newsgroup-begin)
6032 (setq gnus-newsgroup-begin number))
6033 (setq gnus-newsgroup-unselected
6034 (delq number gnus-newsgroup-unselected)))
6035 ;; Report back a success?
6036 (and header (mail-header-number header))))
6038 ;;; Process/prefix in the summary buffer
6040 (defun gnus-summary-work-articles (n)
6041 "Return a list of articles to be worked upon.
6042 The prefix argument, the list of process marked articles, and the
6043 current article will be taken into consideration."
6045 (set-buffer gnus-summary-buffer)
6048 ;; A numerical prefix has been given.
6049 (setq n (prefix-numeric-value n))
6050 (let ((backward (< n 0))
6051 (n (abs (prefix-numeric-value n)))
6056 (push (setq article (gnus-summary-article-number))
6059 (gnus-summary-find-prev nil article)
6060 (gnus-summary-find-next nil article)))
6062 (nreverse articles)))
6063 ((and (gnus-region-active-p) (mark))
6064 (message "region active")
6065 ;; Work on the region between point and mark.
6066 (let ((max (max (point) (mark)))
6069 (goto-char (min (min (point) (mark))))
6072 (push (setq article (gnus-summary-article-number)) articles)
6073 (gnus-summary-find-next nil article)
6075 (nreverse articles))))
6076 (gnus-newsgroup-processable
6077 ;; There are process-marked articles present.
6078 ;; Save current state.
6079 (gnus-summary-save-process-mark)
6081 (reverse gnus-newsgroup-processable))
6083 ;; Just return the current article.
6084 (list (gnus-summary-article-number))))))
6086 (defmacro gnus-summary-iterate (arg &rest forms)
6087 "Iterate over the process/prefixed articles and do FORMS.
6088 ARG is the interactive prefix given to the command. FORMS will be
6089 executed with point over the summary line of the articles."
6090 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6091 `(let ((,articles (gnus-summary-work-articles ,arg)))
6093 (gnus-summary-goto-subject (car ,articles))
6097 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6098 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6100 (defun gnus-summary-save-process-mark ()
6101 "Push the current set of process marked articles on the stack."
6103 (push (copy-sequence gnus-newsgroup-processable)
6104 gnus-newsgroup-process-stack))
6106 (defun gnus-summary-kill-process-mark ()
6107 "Push the current set of process marked articles on the stack and unmark."
6109 (gnus-summary-save-process-mark)
6110 (gnus-summary-unmark-all-processable))
6112 (defun gnus-summary-yank-process-mark ()
6113 "Pop the last process mark state off the stack and restore it."
6115 (unless gnus-newsgroup-process-stack
6116 (error "Empty mark stack"))
6117 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6119 (defun gnus-summary-process-mark-set (set)
6120 "Make SET into the current process marked articles."
6121 (gnus-summary-unmark-all-processable)
6123 (gnus-summary-set-process-mark (pop set))))
6125 ;;; Searching and stuff
6127 (defun gnus-summary-search-group (&optional backward use-level)
6128 "Search for next unread newsgroup.
6129 If optional argument BACKWARD is non-nil, search backward instead."
6131 (set-buffer gnus-group-buffer)
6132 (when (gnus-group-search-forward
6133 backward nil (if use-level (gnus-group-group-level) nil))
6134 (gnus-group-group-name))))
6136 (defun gnus-summary-best-group (&optional exclude-group)
6137 "Find the name of the best unread group.
6138 If EXCLUDE-GROUP, do not go to this group."
6140 (set-buffer gnus-group-buffer)
6142 (gnus-group-best-unread-group exclude-group))))
6144 (defun gnus-summary-find-next (&optional unread article backward)
6146 (gnus-summary-find-prev unread article)
6147 (let* ((dummy (gnus-summary-article-intangible-p))
6148 (article (or article (gnus-summary-article-number)))
6149 (data (gnus-data-find-list article))
6151 (when (and (not dummy)
6152 (or (not gnus-summary-check-current)
6154 (not (gnus-data-unread-p (car data)))))
6155 (setq data (cdr data)))
6160 (unless (memq (gnus-data-number (car data))
6162 ((eq gnus-auto-goto-ignores
6163 'always-undownloaded)
6164 gnus-newsgroup-undownloaded)
6167 ((eq gnus-auto-goto-ignores
6169 gnus-newsgroup-unfetched)
6170 ((eq gnus-auto-goto-ignores
6172 gnus-newsgroup-undownloaded)))
6173 (when (gnus-data-unread-p (car data))
6174 (setq result (car data)
6176 (setq data (cdr data)))
6179 (goto-char (gnus-data-pos result))
6180 (gnus-data-number result)))))
6182 (defun gnus-summary-find-prev (&optional unread article)
6183 (let* ((eobp (eobp))
6184 (article (or article (gnus-summary-article-number)))
6185 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6187 (when (and (not eobp)
6188 (or (not gnus-summary-check-current)
6190 (not (gnus-data-unread-p (car data)))))
6191 (setq data (cdr data)))
6196 (unless (memq (gnus-data-number (car data))
6198 ((eq gnus-auto-goto-ignores
6199 'always-undownloaded)
6200 gnus-newsgroup-undownloaded)
6203 ((eq gnus-auto-goto-ignores
6205 gnus-newsgroup-unfetched)
6206 ((eq gnus-auto-goto-ignores
6208 gnus-newsgroup-undownloaded)))
6209 (when (gnus-data-unread-p (car data))
6210 (setq result (car data)
6212 (setq data (cdr data)))
6215 (goto-char (gnus-data-pos result))
6216 (gnus-data-number result))))
6218 (defun gnus-summary-find-subject (subject &optional unread backward article)
6219 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6220 (article (or article (gnus-summary-article-number)))
6221 (articles (gnus-data-list backward))
6222 (arts (gnus-data-find-list article articles))
6224 (when (or (not gnus-summary-check-current)
6226 (not (gnus-data-unread-p (car arts))))
6227 (setq arts (cdr arts)))
6229 (and (or (not unread)
6230 (gnus-data-unread-p (car arts)))
6231 (vectorp (gnus-data-header (car arts)))
6233 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6234 (setq result (car arts)
6236 (setq arts (cdr arts)))
6238 (goto-char (gnus-data-pos result))
6239 (gnus-data-number result))))
6241 (defun gnus-summary-search-forward (&optional unread subject backward)
6242 "Search forward for an article.
6243 If UNREAD, look for unread articles. If SUBJECT, look for
6244 articles with that subject. If BACKWARD, search backward instead."
6245 (cond (subject (gnus-summary-find-subject subject unread backward))
6246 (backward (gnus-summary-find-prev unread))
6247 (t (gnus-summary-find-next unread))))
6249 (defun gnus-recenter (&optional n)
6250 "Center point in window and redisplay frame.
6251 Also do horizontal recentering."
6253 (when (and gnus-auto-center-summary
6254 (not (eq gnus-auto-center-summary 'vertical)))
6255 (gnus-horizontal-recenter))
6258 (defun gnus-summary-recenter ()
6259 "Center point in the summary window.
6260 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6261 displayed, no centering will be performed."
6262 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6263 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6265 ;; The user has to want it.
6266 (when gnus-auto-center-summary
6267 (let* ((top (cond ((< (window-height) 4) 0)
6268 ((< (window-height) 7) 1)
6269 (t (if (numberp gnus-auto-center-summary)
6270 gnus-auto-center-summary
6272 (height (1- (window-height)))
6273 (bottom (save-excursion (goto-char (point-max))
6274 (forward-line (- height))
6276 (window (get-buffer-window (current-buffer))))
6277 (when (get-buffer-window gnus-article-buffer)
6278 ;; Only do recentering when the article buffer is displayed,
6279 ;; Set the window start to either `bottom', which is the biggest
6280 ;; possible valid number, or the second line from the top,
6281 ;; whichever is the least.
6282 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6283 (if (> bottom top-pos)
6284 ;; Keep the second line from the top visible
6285 (set-window-start window top-pos t)
6286 ;; Try to keep the bottom line visible; if it's partially
6287 ;; obscured, either scroll one more line to make it fully
6288 ;; visible, or revert to using TOP-POS.
6290 (goto-char (point-max))
6292 (let ((last-line-start (point)))
6294 (set-window-start window (point) t)
6295 (when (not (pos-visible-in-window-p last-line-start window))
6297 (set-window-start window (min (point) top-pos) t)))))))
6298 ;; Do horizontal recentering while we're at it.
6299 (when (and (get-buffer-window (current-buffer) t)
6300 (not (eq gnus-auto-center-summary 'vertical)))
6301 (let ((selected (selected-window)))
6302 (select-window (get-buffer-window (current-buffer) t))
6303 (gnus-summary-position-point)
6304 (gnus-horizontal-recenter)
6305 (select-window selected))))))
6307 (defun gnus-summary-jump-to-group (newsgroup)
6308 "Move point to NEWSGROUP in group mode buffer."
6309 ;; Keep update point of group mode buffer if visible.
6310 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6311 (save-window-excursion
6312 ;; Take care of tree window mode.
6313 (when (get-buffer-window gnus-group-buffer)
6314 (pop-to-buffer gnus-group-buffer))
6315 (gnus-group-jump-to-group newsgroup))
6317 ;; Take care of tree window mode.
6318 (if (get-buffer-window gnus-group-buffer)
6319 (pop-to-buffer gnus-group-buffer)
6320 (set-buffer gnus-group-buffer))
6321 (gnus-group-jump-to-group newsgroup))))
6323 ;; This function returns a list of article numbers based on the
6324 ;; difference between the ranges of read articles in this group and
6325 ;; the range of active articles.
6326 (defun gnus-list-of-unread-articles (group)
6327 (let* ((read (gnus-info-read (gnus-get-info group)))
6328 (active (or (gnus-active group) (gnus-activate-group group)))
6331 ;; If none are read, then all are unread.
6333 (setq first (car active))
6334 ;; If the range of read articles is a single range, then the
6335 ;; first unread article is the article after the last read
6336 ;; article. Sounds logical, doesn't it?
6337 (if (and (not (listp (cdr read)))
6338 (or (< (car read) (car active))
6339 (progn (setq read (list read))
6341 (setq first (max (car active) (1+ (cdr read))))
6342 ;; `read' is a list of ranges.
6343 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6346 (setq first (car active)))
6349 (while (< first nlast)
6351 (setq first (1+ first))))
6352 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6353 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6354 (setq read (cdr read)))))
6355 ;; And add the last unread articles.
6356 (while (<= first last)
6358 (setq first (1+ first)))
6359 ;; Return the list of unread articles.
6360 (delq 0 (nreverse unread))))
6362 (defun gnus-list-of-read-articles (group)
6363 "Return a list of unread, unticked and non-dormant articles."
6364 (let* ((info (gnus-get-info group))
6365 (marked (gnus-info-marks info))
6366 (active (gnus-active group)))
6368 (gnus-list-range-difference
6369 (gnus-list-range-difference
6370 (gnus-sorted-complement
6371 (gnus-uncompress-range active)
6372 (gnus-list-of-unread-articles group))
6373 (cdr (assq 'dormant marked)))
6374 (cdr (assq 'tick marked))))))
6376 ;; Various summary commands
6378 (defun gnus-summary-select-article-buffer ()
6379 "Reconfigure windows to show article buffer."
6381 (if (not (gnus-buffer-live-p gnus-article-buffer))
6382 (error "There is no article buffer for this summary buffer")
6383 (gnus-configure-windows 'article)
6384 (select-window (get-buffer-window gnus-article-buffer))))
6386 (defun gnus-summary-universal-argument (arg)
6387 "Perform any operation on all articles that are process/prefixed."
6389 (let ((articles (gnus-summary-work-articles arg))
6396 (substitute-command-keys
6397 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6399 (gnus-error 1 "Undefined key")
6402 (gnus-summary-goto-subject (setq article (pop articles)))
6403 (let (gnus-newsgroup-processable)
6404 (command-execute func))
6405 (gnus-summary-remove-process-mark article)))))
6406 (gnus-summary-position-point))
6408 (defun gnus-summary-toggle-truncation (&optional arg)
6409 "Toggle truncation of summary lines.
6410 With ARG, turn line truncation on if ARG is positive."
6412 (setq truncate-lines
6413 (if (null arg) (not truncate-lines)
6414 (> (prefix-numeric-value arg) 0)))
6417 (defun gnus-summary-find-for-reselect ()
6418 "Return the number of an article to stay on across a reselect.
6419 The current article is considered, then following articles, then previous
6420 articles. An article is sought which is not cancelled and isn't a temporary
6421 insertion from another group. If there's no such then return a dummy 0."
6423 (dolist (rev '(nil t))
6424 (unless found ; don't demand the reverse list if we don't need it
6425 (let ((data (gnus-data-find-list
6426 (gnus-summary-article-number) (gnus-data-list rev))))
6427 (while (and data (not found))
6428 (if (and (< 0 (gnus-data-number (car data)))
6429 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6430 (setq found (gnus-data-number (car data))))
6431 (setq data (cdr data))))))
6434 (defun gnus-summary-reselect-current-group (&optional all rescan)
6435 "Exit and then reselect the current newsgroup.
6436 The prefix argument ALL means to select all articles."
6438 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6439 (error "Ephemeral groups can't be reselected"))
6440 (let ((current-subject (gnus-summary-find-for-reselect))
6441 (group gnus-newsgroup-name))
6442 (setq gnus-newsgroup-begin nil)
6443 (gnus-summary-exit nil 'leave-hidden)
6444 ;; We have to adjust the point of group mode buffer because
6445 ;; point was moved to the next unread newsgroup by exiting.
6446 (gnus-summary-jump-to-group group)
6449 (gnus-group-get-new-news-this-group 1)))
6450 (gnus-group-read-group all t)
6451 (gnus-summary-goto-subject current-subject nil t)))
6453 (defun gnus-summary-rescan-group (&optional all)
6454 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6456 (gnus-summary-reselect-current-group all t))
6458 (defun gnus-summary-update-info (&optional non-destructive)
6460 (let ((group gnus-newsgroup-name))
6462 (when gnus-newsgroup-kill-headers
6463 (setq gnus-newsgroup-killed
6464 (gnus-compress-sequence
6466 (gnus-list-range-intersection
6467 gnus-newsgroup-unselected gnus-newsgroup-killed)
6468 gnus-newsgroup-unreads)
6470 (unless (listp (cdr gnus-newsgroup-killed))
6471 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6472 (let ((headers gnus-newsgroup-headers))
6473 ;; Set the new ranges of read articles.
6475 (set-buffer gnus-group-buffer)
6476 (gnus-undo-force-boundary))
6477 (gnus-update-read-articles
6478 group (gnus-sorted-union
6479 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6480 ;; Set the current article marks.
6481 (let ((gnus-newsgroup-scored
6482 (if (and (not gnus-save-score)
6483 (not non-destructive))
6485 gnus-newsgroup-scored)))
6487 (gnus-update-marks)))
6488 ;; Do the cross-ref thing.
6489 (when gnus-use-cross-reference
6490 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6491 ;; Do not switch windows but change the buffer to work.
6492 (set-buffer gnus-group-buffer)
6493 (unless (gnus-ephemeral-group-p group)
6494 (gnus-group-update-group group)))))))
6496 (defun gnus-summary-save-newsrc (&optional force)
6497 "Save the current number of read/marked articles in the dribble buffer.
6498 The dribble buffer will then be saved.
6499 If FORCE (the prefix), also save the .newsrc file(s)."
6501 (gnus-summary-update-info t)
6503 (gnus-save-newsrc-file)
6504 (gnus-dribble-save)))
6506 (defun gnus-summary-exit (&optional temporary leave-hidden)
6507 "Exit reading current newsgroup, and then return to group selection mode.
6508 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6510 (gnus-set-global-variables)
6511 (when (gnus-buffer-live-p gnus-article-buffer)
6513 (set-buffer gnus-article-buffer)
6514 (mm-destroy-parts gnus-article-mime-handles)
6515 ;; Set it to nil for safety reason.
6516 (setq gnus-article-mime-handle-alist nil)
6517 (setq gnus-article-mime-handles nil)))
6518 (gnus-kill-save-kill-buffer)
6519 (gnus-async-halt-prefetch)
6520 (let* ((group gnus-newsgroup-name)
6521 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6522 (gnus-group-is-exiting-p t)
6525 (buf (current-buffer)))
6527 ;; Do adaptive scoring, and possibly save score files.
6528 (when gnus-newsgroup-adaptive
6529 (gnus-score-adaptive))
6530 (when gnus-use-scoring
6532 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6533 ;; If we have several article buffers, we kill them at exit.
6534 (unless gnus-single-article-buffer
6535 (gnus-kill-buffer gnus-original-article-buffer)
6536 (setq gnus-article-current nil))
6537 (when gnus-use-cache
6538 (gnus-cache-possibly-remove-articles)
6539 (gnus-cache-save-buffers))
6540 (gnus-async-prefetch-remove-group group)
6541 (when gnus-suppress-duplicates
6542 (gnus-dup-enter-articles))
6543 (when gnus-use-trees
6544 (gnus-tree-close group))
6545 (when gnus-use-cache
6546 (gnus-cache-write-active))
6547 ;; Remove entries for this group.
6548 (nnmail-purge-split-history (gnus-group-real-name group))
6549 ;; Make all changes in this group permanent.
6551 (gnus-run-hooks 'gnus-exit-group-hook)
6552 (gnus-summary-update-info))
6553 (gnus-close-group group)
6554 ;; Make sure where we were, and go to next newsgroup.
6555 (set-buffer gnus-group-buffer)
6557 (gnus-group-jump-to-group group))
6558 (gnus-run-hooks 'gnus-summary-exit-hook)
6559 (unless (or quit-config
6560 ;; If this group has disappeared from the summary
6561 ;; buffer, don't skip forwards.
6562 (not (string= group (gnus-group-group-name))))
6563 (gnus-group-next-unread-group 1))
6564 (setq group-point (point))
6567 ;; If we have several article buffers, we kill them at exit.
6568 (unless gnus-single-article-buffer
6569 (gnus-kill-buffer gnus-article-buffer)
6570 (gnus-kill-buffer gnus-original-article-buffer)
6571 (setq gnus-article-current nil))
6573 (if (not gnus-kill-summary-on-exit)
6575 (gnus-deaden-summary)
6577 ;; We set all buffer-local variables to nil. It is unclear why
6578 ;; this is needed, but if we don't, buffer-local variables are
6579 ;; not garbage-collected, it seems. This would the lead to en
6580 ;; ever-growing Emacs.
6581 (gnus-summary-clear-local-variables)
6582 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6583 (gnus-summary-clear-local-variables))
6584 (when (get-buffer gnus-article-buffer)
6585 (bury-buffer gnus-article-buffer))
6586 ;; We clear the global counterparts of the buffer-local
6587 ;; variables as well, just to be on the safe side.
6588 (set-buffer gnus-group-buffer)
6589 (gnus-summary-clear-local-variables)
6590 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6591 (gnus-summary-clear-local-variables))
6592 ;; Return to group mode buffer.
6593 (when (eq mode 'gnus-summary-mode)
6594 (gnus-kill-buffer buf)))
6595 (setq gnus-current-select-method gnus-select-method)
6597 (set-buffer gnus-group-buffer)
6598 (pop-to-buffer gnus-group-buffer))
6599 (if (not quit-config)
6601 (goto-char group-point)
6602 (unless leave-hidden
6603 (gnus-configure-windows 'group 'force)))
6604 (gnus-handle-ephemeral-exit quit-config))
6605 ;; Clear the current group name.
6607 (setq gnus-newsgroup-name nil)))))
6609 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6610 (defun gnus-summary-exit-no-update (&optional no-questions)
6611 "Quit reading current newsgroup without updating read article info."
6613 (let* ((group gnus-newsgroup-name)
6614 (gnus-group-is-exiting-p t)
6615 (gnus-group-is-exiting-without-update-p t)
6616 (quit-config (gnus-group-quit-config group)))
6617 (when (or no-questions
6619 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6620 (gnus-async-halt-prefetch)
6621 (run-hooks 'gnus-summary-prepare-exit-hook)
6622 (when (gnus-buffer-live-p gnus-article-buffer)
6624 (set-buffer gnus-article-buffer)
6625 (mm-destroy-parts gnus-article-mime-handles)
6626 ;; Set it to nil for safety reason.
6627 (setq gnus-article-mime-handle-alist nil)
6628 (setq gnus-article-mime-handles nil)))
6629 ;; If we have several article buffers, we kill them at exit.
6630 (unless gnus-single-article-buffer
6631 (gnus-kill-buffer gnus-article-buffer)
6632 (gnus-kill-buffer gnus-original-article-buffer)
6633 (setq gnus-article-current nil))
6634 (if (not gnus-kill-summary-on-exit)
6635 (gnus-deaden-summary)
6636 (gnus-close-group group)
6637 (gnus-summary-clear-local-variables)
6638 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6639 (gnus-summary-clear-local-variables))
6640 (set-buffer gnus-group-buffer)
6641 (gnus-summary-clear-local-variables)
6642 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6643 (gnus-summary-clear-local-variables))
6644 (gnus-kill-buffer gnus-summary-buffer))
6645 (unless gnus-single-article-buffer
6646 (setq gnus-article-current nil))
6647 (when gnus-use-trees
6648 (gnus-tree-close group))
6649 (gnus-async-prefetch-remove-group group)
6650 (when (get-buffer gnus-article-buffer)
6651 (bury-buffer gnus-article-buffer))
6652 ;; Return to the group buffer.
6653 (gnus-configure-windows 'group 'force)
6654 ;; Clear the current group name.
6655 (setq gnus-newsgroup-name nil)
6656 (unless (gnus-ephemeral-group-p group)
6657 (gnus-group-update-group group))
6658 (when (equal (gnus-group-group-name) group)
6659 (gnus-group-next-unread-group 1))
6661 (gnus-handle-ephemeral-exit quit-config)))))
6663 (defun gnus-handle-ephemeral-exit (quit-config)
6664 "Handle movement when leaving an ephemeral group.
6665 The state which existed when entering the ephemeral is reset."
6666 (if (not (buffer-name (car quit-config)))
6667 (gnus-configure-windows 'group 'force)
6668 (set-buffer (car quit-config))
6669 (cond ((eq major-mode 'gnus-summary-mode)
6670 (gnus-set-global-variables))
6671 ((eq major-mode 'gnus-article-mode)
6673 ;; The `gnus-summary-buffer' variable may point
6674 ;; to the old summary buffer when using a single
6676 (unless (gnus-buffer-live-p gnus-summary-buffer)
6677 (set-buffer gnus-group-buffer))
6678 (set-buffer gnus-summary-buffer)
6679 (gnus-set-global-variables))))
6680 (if (or (eq (cdr quit-config) 'article)
6681 (eq (cdr quit-config) 'pick))
6683 ;; The current article may be from the ephemeral group
6684 ;; thus it is best that we reload this article
6686 ;; If we're exiting from a large digest, this can be
6687 ;; extremely slow. So, it's better not to reload it. -- jh.
6688 ;;(gnus-summary-show-article)
6689 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6690 (gnus-configure-windows 'pick 'force)
6691 (gnus-configure-windows (cdr quit-config) 'force)))
6692 (gnus-configure-windows (cdr quit-config) 'force))
6693 (when (eq major-mode 'gnus-summary-mode)
6694 (gnus-summary-next-subject 1 nil t)
6695 (gnus-summary-recenter)
6696 (gnus-summary-position-point))))
6700 (defvar gnus-dead-summary-mode-map nil)
6702 (unless gnus-dead-summary-mode-map
6703 (setq gnus-dead-summary-mode-map (make-keymap))
6704 (suppress-keymap gnus-dead-summary-mode-map)
6705 (substitute-key-definition
6706 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6707 (dolist (key '("\C-d" "\r" "\177" [delete]))
6708 (define-key gnus-dead-summary-mode-map
6709 key
'gnus-summary-wake-up-the-dead
))
6710 (dolist (key '("q" "Q"))
6711 (define-key gnus-dead-summary-mode-map key
'bury-buffer
)))
6713 (defvar gnus-dead-summary-mode nil
6714 "Minor mode for Gnus summary buffers.")
6716 (defun gnus-dead-summary-mode (&optional arg
)
6717 "Minor mode for Gnus summary buffers."
6719 (when (eq major-mode
'gnus-summary-mode
)
6720 (make-local-variable 'gnus-dead-summary-mode
)
6721 (setq gnus-dead-summary-mode
6722 (if (null arg
) (not gnus-dead-summary-mode
)
6723 (> (prefix-numeric-value arg
) 0)))
6724 (when gnus-dead-summary-mode
6725 (gnus-add-minor-mode
6726 'gnus-dead-summary-mode
" Dead" gnus-dead-summary-mode-map
))))
6728 (defun gnus-deaden-summary ()
6729 "Make the current summary buffer into a dead summary buffer."
6730 ;; Kill any previous dead summary buffer.
6731 (when (and gnus-dead-summary
6732 (buffer-name gnus-dead-summary
))
6734 (set-buffer gnus-dead-summary
)
6735 (when gnus-dead-summary-mode
6736 (kill-buffer (current-buffer)))))
6737 ;; Make this the current dead summary.
6738 (setq gnus-dead-summary
(current-buffer))
6739 (gnus-dead-summary-mode 1)
6740 (let ((name (buffer-name)))
6741 (when (string-match "Summary" name
)
6743 (concat (substring name
0 (match-beginning 0)) "Dead "
6744 (substring name
(match-beginning 0)))
6748 (defun gnus-kill-or-deaden-summary (buffer)
6749 "Kill or deaden the summary BUFFER."
6751 (when (and (buffer-name buffer
)
6752 (not gnus-single-article-buffer
))
6755 (gnus-kill-buffer gnus-article-buffer
)
6756 (gnus-kill-buffer gnus-original-article-buffer
)))
6759 (gnus-kill-summary-on-exit
6760 (when (and gnus-use-trees
6761 (gnus-buffer-exists-p buffer
))
6764 (gnus-tree-close gnus-newsgroup-name
)))
6765 (gnus-kill-buffer buffer
))
6766 ;; Deaden the buffer.
6767 ((gnus-buffer-exists-p buffer
)
6770 (gnus-deaden-summary))))))
6772 (defun gnus-summary-wake-up-the-dead (&rest args
)
6773 "Wake up the dead summary buffer."
6775 (gnus-dead-summary-mode -
1)
6776 (let ((name (buffer-name)))
6777 (when (string-match "Dead " name
)
6779 (concat (substring name
0 (match-beginning 0))
6780 (substring name
(match-end 0)))
6782 (gnus-message 3 "This dead summary is now alive again"))
6784 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6785 (defun gnus-summary-fetch-faq (&optional faq-dir
)
6786 "Fetch the FAQ for the current group.
6787 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6791 (when current-prefix-arg
6793 "FAQ dir: " (and (listp gnus-group-faq-directory
)
6794 (mapcar (lambda (file) (list file
))
6795 gnus-group-faq-directory
))))))
6796 (let (gnus-faq-buffer)
6797 (when (setq gnus-faq-buffer
6798 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir
))
6799 (gnus-configure-windows 'summary-faq
))))
6801 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6802 (defun gnus-summary-describe-group (&optional force
)
6803 "Describe the current newsgroup."
6805 (gnus-group-describe-group force gnus-newsgroup-name
))
6807 (defun gnus-summary-describe-briefly ()
6808 "Describe summary mode commands briefly."
6810 (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")))
6812 ;; Walking around group mode buffer from summary mode.
6814 (defun gnus-summary-next-group (&optional no-article target-group backward
)
6815 "Exit current newsgroup and then select next unread newsgroup.
6816 If prefix argument NO-ARTICLE is non-nil, no article is selected
6817 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6818 previous group instead."
6820 ;; Stop pre-fetching.
6821 (gnus-async-halt-prefetch)
6822 (let ((current-group gnus-newsgroup-name
)
6823 (current-buffer (current-buffer))
6825 ;; First we semi-exit this group to update Xrefs and all variables.
6826 ;; We can't do a real exit, because the window conf must remain
6827 ;; the same in case the user is prompted for info, and we don't
6828 ;; want the window conf to change before that...
6829 (gnus-summary-exit t
)
6830 (while (not entered
)
6831 ;; Then we find what group we are supposed to enter.
6832 (set-buffer gnus-group-buffer
)
6833 (gnus-group-jump-to-group current-group
)
6836 (if (eq gnus-keep-same-level
'best
)
6837 (gnus-summary-best-group gnus-newsgroup-name
)
6838 (gnus-summary-search-group backward gnus-keep-same-level
))))
6839 (if (not target-group
)
6840 ;; There are no further groups, so we return to the group
6843 (gnus-message 5 "Returning to the group buffer")
6845 (when (gnus-buffer-live-p current-buffer
)
6846 (set-buffer current-buffer
)
6847 (gnus-summary-exit))
6848 (gnus-run-hooks 'gnus-group-no-more-groups-hook
))
6849 ;; We try to enter the target group.
6850 (gnus-group-jump-to-group target-group
)
6851 (let ((unreads (gnus-group-group-unread)))
6852 (if (and (or (eq t unreads
)
6853 (and unreads
(not (zerop unreads
))))
6854 (gnus-summary-read-group
6855 target-group nil no-article
6856 (and (buffer-name current-buffer
) current-buffer
)
6859 (setq current-group target-group
6860 target-group nil
)))))))
6862 (defun gnus-summary-prev-group (&optional no-article
)
6863 "Exit current newsgroup and then select previous unread newsgroup.
6864 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6866 (gnus-summary-next-group no-article nil t
))
6868 ;; Walking around summary lines.
6870 (defun gnus-summary-first-subject (&optional unread undownloaded unseen
)
6871 "Go to the first subject satisfying any non-nil constraint.
6872 If UNREAD is non-nil, the article should be unread.
6873 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6874 If UNSEEN is non-nil, the article should be unseen.
6875 Returns the article selected or nil if there are no matching articles."
6879 ((null gnus-newsgroup-data
)
6880 (gnus-message 3 "No articles in the group")
6882 ;; Pick the first article.
6883 ((not (or unread undownloaded unseen
))
6884 (goto-char (gnus-data-pos (car gnus-newsgroup-data
)))
6885 (gnus-data-number (car gnus-newsgroup-data
)))
6886 ;; Find the first unread article.
6888 (let ((data gnus-newsgroup-data
))
6890 (let ((num (gnus-data-number (car data
))))
6891 (or (memq num gnus-newsgroup-unfetched
)
6892 (not (or (and unread
6893 (memq num gnus-newsgroup-unreads
))
6895 (memq num gnus-newsgroup-undownloaded
))
6897 (memq num gnus-newsgroup-unseen
)))))))
6898 (setq data
(cdr data
)))
6902 (goto-char (gnus-data-pos (car data
)))
6903 (gnus-data-number (car data
)))
6904 (gnus-message 3 "No more%s articles"
6905 (let* ((r (when unread
" unread"))
6906 (d (when undownloaded
" undownloaded"))
6907 (s (when unseen
" unseen"))
6908 (l (delq nil
(list r d s
))))
6909 (cond ((= 3 (length l
))
6910 (concat r
"," d
", or" s
))
6912 (concat (car l
) ", or" (cadr l
)))
6919 (gnus-summary-position-point))))))
6921 (defun gnus-summary-next-subject (n &optional unread dont-display
)
6922 "Go to next N'th summary line.
6923 If N is negative, go to the previous N'th subject line.
6924 If UNREAD is non-nil, only unread articles are selected.
6925 The difference between N and the actual number of steps taken is
6928 (let ((backward (< n
0))
6932 (gnus-summary-find-prev unread
)
6933 (gnus-summary-find-next unread
)))
6934 (unless (zerop (setq n
(1- n
)))
6935 (gnus-summary-show-thread)))
6937 (gnus-message 7 "No more%s articles"
6938 (if unread
" unread" "")))
6939 (unless dont-display
6940 (gnus-summary-recenter)
6941 (gnus-summary-position-point))
6944 (defun gnus-summary-next-unread-subject (n)
6945 "Go to next N'th unread summary line."
6947 (gnus-summary-next-subject n t
))
6949 (defun gnus-summary-prev-subject (n &optional unread
)
6950 "Go to previous N'th summary line.
6951 If optional argument UNREAD is non-nil, only unread article is selected."
6953 (gnus-summary-next-subject (- n
) unread
))
6955 (defun gnus-summary-prev-unread-subject (n)
6956 "Go to previous N'th unread summary line."
6958 (gnus-summary-next-subject (- n
) t
))
6960 (defun gnus-summary-goto-subjects (articles)
6961 "Insert the subject header for ARTICLES in the current buffer."
6963 (dolist (article articles
)
6964 (gnus-summary-goto-subject article t
)))
6965 (gnus-summary-limit (append articles gnus-newsgroup-limit
))
6966 (gnus-summary-position-point))
6968 (defun gnus-summary-goto-subject (article &optional force silent
)
6969 "Go the subject line of ARTICLE.
6970 If FORCE, also allow jumping to articles not currently shown."
6971 (interactive "nArticle number: ")
6972 (unless (numberp article
)
6973 (error "Article %s is not a number" article
))
6975 (data (gnus-data-find article
)))
6976 ;; We read in the article if we have to.
6979 (gnus-summary-insert-subject
6981 (if (or (numberp force
) (vectorp force
)) force
)
6983 (setq data
(gnus-data-find article
)))
6988 (gnus-message 3 "Can't find article %d" article
))
6990 (let ((pt (gnus-data-pos data
)))
6992 (gnus-summary-set-article-display-arrow pt
))
6993 (gnus-summary-position-point)
6996 ;; Walking around summary lines with displaying articles.
6998 (defun gnus-summary-expand-window (&optional arg
)
6999 "Make the summary buffer take up the entire Emacs frame.
7000 Given a prefix, will force an `article' buffer configuration."
7003 (gnus-configure-windows 'article
'force
)
7004 (gnus-configure-windows 'summary
'force
)))
7006 (defun gnus-summary-display-article (article &optional all-header
)
7007 "Display ARTICLE in article buffer."
7008 (when (gnus-buffer-live-p gnus-article-buffer
)
7009 (with-current-buffer gnus-article-buffer
7010 (mm-enable-multibyte)))
7011 (gnus-set-global-variables)
7012 (when (gnus-buffer-live-p gnus-article-buffer
)
7013 (with-current-buffer gnus-article-buffer
7014 (setq gnus-article-charset gnus-newsgroup-charset
)
7015 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets
)
7016 (mm-enable-multibyte)))
7020 (if gnus-summary-display-article-function
7021 (funcall gnus-summary-display-article-function article all-header
)
7022 (gnus-article-prepare article all-header
))
7023 (gnus-run-hooks 'gnus-select-article-hook
)
7024 (when (and gnus-current-article
7025 (not (zerop gnus-current-article
)))
7026 (gnus-summary-goto-subject gnus-current-article
))
7027 (gnus-summary-recenter)
7028 (when (and gnus-use-trees gnus-show-threads
)
7029 (gnus-possibly-generate-tree article
)
7030 (gnus-highlight-selected-tree article
))
7031 ;; Successfully display article.
7032 (gnus-article-set-window-start
7033 (cdr (assq article gnus-newsgroup-bookmarks
))))))
7035 (defun gnus-summary-select-article (&optional all-headers force pseudo article
)
7036 "Select the current article.
7037 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7038 non-nil, the article will be re-fetched even if it already present in
7039 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7041 ;; Make sure we are in the summary buffer to work around bbdb bug.
7042 (unless (eq major-mode
'gnus-summary-mode
)
7043 (set-buffer gnus-summary-buffer
))
7044 (let ((article (or article
(gnus-summary-article-number)))
7045 (all-headers (not (not all-headers
))) ;Must be t or nil.
7046 gnus-summary-display-article-function
)
7048 (gnus-summary-article-pseudo-p article
)
7049 (error "This is a pseudo-article"))
7051 (set-buffer gnus-summary-buffer
)
7052 (if (or (and gnus-single-article-buffer
7053 (or (null gnus-current-article
)
7054 (null gnus-article-current
)
7055 (null (get-buffer gnus-article-buffer
))
7056 (not (eq article
(cdr gnus-article-current
)))
7057 (not (equal (car gnus-article-current
)
7058 gnus-newsgroup-name
))))
7059 (and (not gnus-single-article-buffer
)
7060 (or (null gnus-current-article
)
7061 (not (eq gnus-current-article article
))))
7063 ;; The requested article is different from the current article.
7065 (gnus-summary-display-article article all-headers
)
7066 (when (gnus-buffer-live-p gnus-article-buffer
)
7067 (with-current-buffer gnus-article-buffer
7068 (if (not gnus-article-decoded-p
) ;; a local variable
7069 (mm-disable-multibyte))))
7070 (gnus-article-set-window-start
7071 (cdr (assq article gnus-newsgroup-bookmarks
)))
7075 (defun gnus-summary-force-verify-and-decrypt ()
7076 "Display buttons for signed/encrypted parts and verify/decrypt them."
7078 (let ((mm-verify-option 'known
)
7079 (mm-decrypt-option 'known
)
7080 (gnus-article-emulate-mime t
)
7081 (gnus-buttonized-mime-types (append (list "multipart/signed"
7082 "multipart/encrypted")
7083 gnus-buttonized-mime-types
)))
7084 (gnus-summary-select-article nil
'force
)))
7086 (defun gnus-summary-set-current-mark (&optional current-mark
)
7087 "Obsolete function."
7090 (defun gnus-summary-next-article (&optional unread subject backward push
)
7091 "Select the next article.
7092 If UNREAD, only unread articles are selected.
7093 If SUBJECT, only articles with SUBJECT are selected.
7094 If BACKWARD, the previous article is selected instead of the next."
7097 ;; Is there such an article?
7098 ((and (gnus-summary-search-forward unread subject backward
)
7099 (or (gnus-summary-display-article (gnus-summary-article-number))
7100 (eq (gnus-summary-article-mark) gnus-canceled-mark
)))
7101 (gnus-summary-position-point))
7102 ;; If not, we try the first unread, if that is wanted.
7104 gnus-auto-select-same
7105 (gnus-summary-first-unread-article))
7106 (gnus-summary-position-point)
7107 (gnus-message 6 "Wrapped"))
7108 ;; Try to get next/previous article not displayed in this group.
7109 ((and gnus-auto-extend-newsgroup
7110 (not unread
) (not subject
))
7111 (gnus-summary-goto-article
7112 (if backward
(1- gnus-newsgroup-begin
) (1+ gnus-newsgroup-end
))
7113 nil
(count-lines (point-min) (point))))
7114 ;; Go to next/previous group.
7116 (unless (gnus-ephemeral-group-p gnus-newsgroup-name
)
7117 (gnus-summary-jump-to-group gnus-newsgroup-name
))
7118 (let ((cmd last-command-char
)
7121 (set-buffer gnus-group-buffer
)
7124 (if (eq gnus-keep-same-level
'best
)
7125 (gnus-summary-best-group gnus-newsgroup-name
)
7126 (gnus-summary-search-group backward gnus-keep-same-level
))))
7127 ;; For some reason, the group window gets selected. We change
7129 (select-window (get-buffer-window (current-buffer)))
7130 ;; Select next unread newsgroup automagically.
7132 ((or (not gnus-auto-select-next
)
7134 (gnus-message 7 "No more%s articles" (if unread
" unread" "")))
7135 ((or (eq gnus-auto-select-next
'quietly
)
7136 (and (eq gnus-auto-select-next
'slightly-quietly
)
7138 (and (eq gnus-auto-select-next
'almost-quietly
)
7139 (gnus-summary-last-article-p)))
7141 (if (gnus-ephemeral-group-p gnus-newsgroup-name
)
7143 (gnus-message 7 "No more%s articles (%s)..."
7144 (if unread
" unread" "")
7145 (if group
(concat "selecting " group
)
7147 (gnus-summary-next-group nil group backward
)))
7149 (when (gnus-key-press-event-p last-input-event
)
7150 (gnus-summary-walk-group-buffer
7151 gnus-newsgroup-name cmd unread backward point
))))))))
7153 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start
)
7154 (let ((keystrokes '((?\C-n
(gnus-group-next-unread-group 1))
7155 (?\C-p
(gnus-group-prev-unread-group 1))))
7156 (cursor-in-echo-area t
)
7157 keve key group ended prompt
)
7159 (set-buffer gnus-group-buffer
)
7162 (if (eq gnus-keep-same-level
'best
)
7163 (gnus-summary-best-group gnus-newsgroup-name
)
7164 (gnus-summary-search-group backward gnus-keep-same-level
))))
7168 "No more%s articles%s " (if unread
" unread" "")
7170 (not (gnus-ephemeral-group-p gnus-newsgroup-name
)))
7171 (format " (Type %s for %s [%s])"
7172 (single-key-description cmd
) group
7173 (car (gnus-gethash group gnus-newsrc-hashtb
)))
7174 (format " (Type %s to exit %s)"
7175 (single-key-description cmd
)
7176 gnus-newsgroup-name
))))
7177 ;; Confirm auto selection.
7178 (setq key
(car (setq keve
(gnus-read-event-char prompt
)))
7181 ((assq key keystrokes
)
7182 (let ((obuf (current-buffer)))
7183 (switch-to-buffer gnus-group-buffer
)
7185 (gnus-group-jump-to-group group
))
7186 (eval (cadr (assq key keystrokes
)))
7187 (setq group
(gnus-group-group-name))
7188 (switch-to-buffer obuf
))
7192 (gnus-ephemeral-group-p gnus-newsgroup-name
))
7194 (gnus-summary-next-group nil group backward
)))
7196 (push (cdr keve
) unread-command-events
))))))
7198 (defun gnus-summary-next-unread-article ()
7199 "Select unread article after current one."
7201 (gnus-summary-next-article
7202 (or (not (eq gnus-summary-goto-unread
'never
))
7203 (gnus-summary-last-article-p (gnus-summary-article-number)))
7204 (and gnus-auto-select-same
7205 (gnus-summary-article-subject))))
7207 (defun gnus-summary-prev-article (&optional unread subject
)
7208 "Select the article after the current one.
7209 If UNREAD is non-nil, only unread articles are selected."
7211 (gnus-summary-next-article unread subject t
))
7213 (defun gnus-summary-prev-unread-article ()
7214 "Select unread article before current one."
7216 (gnus-summary-prev-article
7217 (or (not (eq gnus-summary-goto-unread
'never
))
7218 (gnus-summary-first-article-p (gnus-summary-article-number)))
7219 (and gnus-auto-select-same
7220 (gnus-summary-article-subject))))
7222 (defun gnus-summary-next-page (&optional lines circular stop
)
7223 "Show next page of the selected article.
7224 If at the end of the current article, select the next article.
7225 LINES says how many lines should be scrolled up.
7227 If CIRCULAR is non-nil, go to the start of the article instead of
7228 selecting the next article when reaching the end of the current
7231 If STOP is non-nil, just stop when reaching the end of the message.
7233 Also see the variable `gnus-article-skip-boring'."
7235 (setq gnus-summary-buffer
(current-buffer))
7236 (gnus-set-global-variables)
7237 (let ((article (gnus-summary-article-number))
7238 (article-window (get-buffer-window gnus-article-buffer t
))
7240 ;; If the buffer is empty, we have no article.
7242 (error "No article to select"))
7243 (gnus-configure-windows 'article
)
7244 (if (eq (cdr (assq article gnus-newsgroup-reads
)) gnus-canceled-mark
)
7245 (if (and (eq gnus-summary-goto-unread
'never
)
7246 (not (gnus-summary-last-article-p article
)))
7247 (gnus-summary-next-article)
7248 (gnus-summary-next-unread-article))
7249 (if (or (null gnus-current-article
)
7250 (null gnus-article-current
)
7251 (/= article
(cdr gnus-article-current
))
7252 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7253 ;; Selected subject is different from current article's.
7254 (gnus-summary-display-article article
)
7255 (when article-window
7256 (gnus-eval-in-buffer-window gnus-article-buffer
7257 (setq endp
(or (gnus-article-next-page lines
)
7258 (gnus-article-only-boring-p))))
7261 (gnus-message 3 "End of message"))
7263 (gnus-summary-beginning-of-article))
7265 (gnus-message 3 "End of message"))
7267 (if (and (eq gnus-summary-goto-unread
'never
)
7268 (not (gnus-summary-last-article-p article
)))
7269 (gnus-summary-next-article)
7270 (gnus-summary-next-unread-article))))))))
7271 (gnus-summary-recenter)
7272 (gnus-summary-position-point)))
7274 (defun gnus-summary-prev-page (&optional lines move
)
7275 "Show previous page of selected article.
7276 Argument LINES specifies lines to be scrolled down.
7277 If MOVE, move to the previous unread article if point is at
7278 the beginning of the buffer."
7280 (let ((article (gnus-summary-article-number))
7281 (article-window (get-buffer-window gnus-article-buffer t
))
7283 (gnus-configure-windows 'article
)
7284 (if (or (null gnus-current-article
)
7285 (null gnus-article-current
)
7286 (/= article
(cdr gnus-article-current
))
7287 (not (equal (car gnus-article-current
) gnus-newsgroup-name
)))
7288 ;; Selected subject is different from current article's.
7289 (gnus-summary-display-article article
)
7290 (gnus-summary-recenter)
7291 (when article-window
7292 (gnus-eval-in-buffer-window gnus-article-buffer
7293 (setq endp
(gnus-article-prev-page lines
)))
7294 (when (and move endp
)
7296 (gnus-message 3 "Beginning of message"))
7298 (if (and (eq gnus-summary-goto-unread
'never
)
7299 (not (gnus-summary-first-article-p article
)))
7300 (gnus-summary-prev-article)
7301 (gnus-summary-prev-unread-article))))))))
7302 (gnus-summary-position-point))
7304 (defun gnus-summary-prev-page-or-article (&optional lines
)
7305 "Show previous page of selected article.
7306 Argument LINES specifies lines to be scrolled down.
7307 If at the beginning of the article, go to the next article."
7309 (gnus-summary-prev-page lines t
))
7311 (defun gnus-summary-scroll-up (lines)
7312 "Scroll up (or down) one line current article.
7313 Argument LINES specifies lines to be scrolled up (or down if negative)."
7315 (gnus-configure-windows 'article
)
7316 (gnus-summary-show-thread)
7317 (when (eq (gnus-summary-select-article nil nil
'pseudo
) 'old
)
7318 (gnus-eval-in-buffer-window gnus-article-buffer
7320 (when (gnus-article-next-page lines
)
7321 (gnus-message 3 "End of message")))
7323 (gnus-article-prev-page (- lines
))))))
7324 (gnus-summary-recenter)
7325 (gnus-summary-position-point))
7327 (defun gnus-summary-scroll-down (lines)
7328 "Scroll down (or up) one line current article.
7329 Argument LINES specifies lines to be scrolled down (or up if negative)."
7331 (gnus-summary-scroll-up (- lines
)))
7333 (defun gnus-summary-next-same-subject ()
7334 "Select next article which has the same subject as current one."
7336 (gnus-summary-next-article nil
(gnus-summary-article-subject)))
7338 (defun gnus-summary-prev-same-subject ()
7339 "Select previous article which has the same subject as current one."
7341 (gnus-summary-prev-article nil
(gnus-summary-article-subject)))
7343 (defun gnus-summary-next-unread-same-subject ()
7344 "Select next unread article which has the same subject as current one."
7346 (gnus-summary-next-article t
(gnus-summary-article-subject)))
7348 (defun gnus-summary-prev-unread-same-subject ()
7349 "Select previous unread article which has the same subject as current one."
7351 (gnus-summary-prev-article t
(gnus-summary-article-subject)))
7353 (defun gnus-summary-first-unread-article ()
7354 "Select the first unread article.
7355 Return nil if there are no unread articles."
7358 (when (gnus-summary-first-subject t
)
7359 (gnus-summary-show-thread)
7360 (gnus-summary-first-subject t
)
7361 (gnus-summary-display-article (gnus-summary-article-number)))
7362 (gnus-summary-position-point)))
7364 (defun gnus-summary-first-unread-subject ()
7365 "Place the point on the subject line of the first unread article.
7366 Return nil if there are no unread articles."
7369 (when (gnus-summary-first-subject t
)
7370 (gnus-summary-show-thread)
7371 (gnus-summary-first-subject t
))
7372 (gnus-summary-position-point)))
7374 (defun gnus-summary-first-unseen-subject ()
7375 "Place the point on the subject line of the first unseen article.
7376 Return nil if there are no unseen articles."
7379 (when (gnus-summary-first-subject nil nil t
)
7380 (gnus-summary-show-thread)
7381 (gnus-summary-first-subject nil nil t
))
7382 (gnus-summary-position-point)))
7384 (defun gnus-summary-first-unseen-or-unread-subject ()
7385 "Place the point on the subject line of the first unseen article or,
7386 if all article have been seen, on the subject line of the first unread
7390 (unless (when (gnus-summary-first-subject nil nil t
)
7391 (gnus-summary-show-thread)
7392 (gnus-summary-first-subject nil nil t
))
7393 (when (gnus-summary-first-subject t
)
7394 (gnus-summary-show-thread)
7395 (gnus-summary-first-subject t
)))
7396 (gnus-summary-position-point)))
7398 (defun gnus-summary-first-article ()
7399 "Select the first article.
7400 Return nil if there are no articles."
7403 (when (gnus-summary-first-subject)
7404 (gnus-summary-show-thread)
7405 (gnus-summary-first-subject)
7406 (gnus-summary-display-article (gnus-summary-article-number)))
7407 (gnus-summary-position-point)))
7409 (defun gnus-summary-best-unread-article (&optional arg
)
7410 "Select the unread article with the highest score.
7411 If given a prefix argument, select the next unread article that has a
7412 score higher than the default score."
7414 (let ((article (if arg
7415 (gnus-summary-better-unread-subject)
7416 (gnus-summary-best-unread-subject))))
7418 (gnus-summary-goto-article article
)
7419 (error "No unread articles"))))
7421 (defun gnus-summary-best-unread-subject ()
7422 "Select the unread subject with the highest score."
7424 (let ((best -
1000000)
7425 (data gnus-newsgroup-data
)
7428 (and (gnus-data-unread-p (car data
))
7430 (gnus-summary-article-score (gnus-data-number (car data
))))
7433 article
(gnus-data-number (car data
))))
7434 (setq data
(cdr data
)))
7436 (gnus-summary-goto-subject article
))
7437 (gnus-summary-position-point)
7440 (defun gnus-summary-better-unread-subject ()
7441 "Select the first unread subject that has a score over the default score."
7443 (let ((data gnus-newsgroup-data
)
7445 (while (and (setq article
(gnus-data-number (car data
)))
7446 (or (gnus-data-read-p (car data
))
7447 (not (> (gnus-summary-article-score article
)
7448 gnus-summary-default-score
))))
7449 (setq data
(cdr data
)))
7451 (gnus-summary-goto-subject article
))
7452 (gnus-summary-position-point)
7455 (defun gnus-summary-last-subject ()
7456 "Go to the last displayed subject line in the group."
7457 (let ((article (gnus-data-number (car (gnus-data-list t
)))))
7459 (gnus-summary-goto-subject article
))))
7461 (defun gnus-summary-goto-article (article &optional all-headers force
)
7462 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7463 If ALL-HEADERS is non-nil, no header lines are hidden.
7464 If FORCE, go to the article even if it isn't displayed. If FORCE
7465 is a number, it is the line the article is to be displayed on."
7469 "Article number or Message-ID: "
7470 (mapcar (lambda (number) (list (int-to-string number
)))
7471 gnus-newsgroup-limit
))
7475 (if (and (stringp article
)
7476 (string-match "@\\|%40" article
))
7477 (gnus-summary-refer-article article
)
7478 (when (stringp article
)
7479 (setq article
(string-to-number article
)))
7480 (if (gnus-summary-goto-subject article force
)
7481 (gnus-summary-display-article article all-headers
)
7482 (gnus-message 4 "Couldn't go to article %s" article
) nil
))
7483 (gnus-summary-position-point)))
7485 (defun gnus-summary-goto-last-article ()
7486 "Go to the previously read article."
7489 (when gnus-last-article
7490 (gnus-summary-goto-article gnus-last-article nil t
))
7491 (gnus-summary-position-point)))
7493 (defun gnus-summary-pop-article (number)
7494 "Pop one article off the history and go to the previous.
7495 NUMBER articles will be popped off."
7498 (setq gnus-newsgroup-history
7499 (cdr (setq to
(nthcdr number gnus-newsgroup-history
))))
7501 (gnus-summary-goto-article (car to
) nil t
)
7502 (error "Article history empty")))
7503 (gnus-summary-position-point))
7505 ;; Summary commands and functions for limiting the summary buffer.
7507 (defun gnus-summary-limit-to-articles (n)
7508 "Limit the summary buffer to the next N articles.
7509 If not given a prefix, use the process marked articles instead."
7512 (let ((articles (gnus-summary-work-articles n
)))
7513 (setq gnus-newsgroup-processable nil
)
7514 (gnus-summary-limit articles
))
7515 (gnus-summary-position-point)))
7517 (defun gnus-summary-pop-limit (&optional total
)
7518 "Restore the previous limit.
7519 If given a prefix, remove all limits."
7522 (setq gnus-newsgroup-limits
7523 (list (mapcar (lambda (h) (mail-header-number h
))
7524 gnus-newsgroup-headers
))))
7525 (unless gnus-newsgroup-limits
7526 (error "No limit to pop"))
7528 (gnus-summary-limit nil
'pop
)
7529 (gnus-summary-position-point)))
7531 (defun gnus-summary-limit-to-subject (subject &optional header not-matching
)
7532 "Limit the summary buffer to articles that have subjects that match a regexp.
7533 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7535 (list (read-string (if current-prefix-arg
7536 "Exclude subject (regexp): "
7537 "Limit to subject (regexp): "))
7538 nil current-prefix-arg
))
7540 (setq header
"subject"))
7541 (when (not (equal "" subject
))
7543 (let ((articles (gnus-summary-find-matching
7544 (or header
"subject") subject
'all nil nil
7547 (error "Found no matches for \"%s\"" subject
))
7548 (gnus-summary-limit articles
))
7549 (gnus-summary-position-point))))
7551 (defun gnus-summary-limit-to-author (from &optional not-matching
)
7552 "Limit the summary buffer to articles that have authors that match a regexp.
7553 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7555 (list (read-string (if current-prefix-arg
7556 "Exclude author (regexp): "
7557 "Limit to author (regexp): "))
7558 current-prefix-arg
))
7559 (gnus-summary-limit-to-subject from
"from" not-matching
))
7561 (defun gnus-summary-limit-to-age (age &optional younger-p
)
7562 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7563 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7564 articles that are younger than AGE days."
7566 (let ((younger current-prefix-arg
)
7569 (while (not days-got
)
7570 (setq days
(if younger
7571 (read-string "Limit to articles younger than (in days, older when negative): ")
7573 "Limit to articles older than (in days, younger when negative): ")))
7574 (when (> (length days
) 0)
7575 (setq days
(read days
)))
7581 (setq younger
(not younger
))
7582 (setq days
(* days -
1)))))
7583 (message "Please enter a number.")
7585 (list days younger
)))
7587 (let ((data gnus-newsgroup-data
)
7588 (cutoff (days-to-time age
))
7589 articles d date is-younger
)
7590 (while (setq d
(pop data
))
7591 (when (and (vectorp (gnus-data-header d
))
7592 (setq date
(mail-header-date (gnus-data-header d
))))
7593 (setq is-younger
(time-less-p
7594 (time-since (condition-case ()
7601 (push (gnus-data-number d
) articles
))))
7602 (gnus-summary-limit (nreverse articles
)))
7603 (gnus-summary-position-point)))
7605 (defun gnus-summary-limit-to-extra (header regexp
&optional not-matching
)
7606 "Limit the summary buffer to articles that match an 'extra' header."
7610 (gnus-completing-read-with-default
7611 (symbol-name (car gnus-extra-headers
))
7612 (if current-prefix-arg
7613 "Exclude extra header:"
7614 "Limit extra header:")
7616 (cons (symbol-name x
) x
))
7621 (read-string (format "%s header %s (regexp): "
7622 (if current-prefix-arg
"Exclude" "Limit to")
7624 current-prefix-arg
)))
7625 (when (not (equal "" regexp
))
7627 (let ((articles (gnus-summary-find-matching
7628 (cons 'extra header
) regexp
'all nil nil
7631 (error "Found no matches for \"%s\"" regexp
))
7632 (gnus-summary-limit articles
))
7633 (gnus-summary-position-point))))
7635 (defun gnus-summary-limit-to-display-predicate ()
7636 "Limit the summary buffer to the predicated in the `display' group parameter."
7638 (unless gnus-newsgroup-display
7639 (error "There is no `display' group parameter"))
7641 (dolist (number gnus-newsgroup-articles
)
7642 (when (funcall gnus-newsgroup-display
)
7643 (push number articles
)))
7644 (gnus-summary-limit articles
))
7645 (gnus-summary-position-point))
7647 (defalias 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7649 'gnus-summary-delete-marked-as-read
'gnus-summary-limit-to-unread
)
7651 (defun gnus-summary-limit-to-unread (&optional all
)
7652 "Limit the summary buffer to articles that are not marked as read.
7653 If ALL is non-nil, limit strictly to unread articles."
7656 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark
))
7657 (gnus-summary-limit-to-marks
7658 ;; Concat all the marks that say that an article is read and have
7660 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7661 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7662 gnus-low-score-mark gnus-expirable-mark
7663 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7664 gnus-duplicate-mark gnus-souped-mark
)
7667 (defalias 'gnus-summary-delete-marked-with
'gnus-summary-limit-exclude-marks
)
7668 (make-obsolete 'gnus-summary-delete-marked-with
7669 'gnus-summary-limit-exclude-marks
)
7671 (defun gnus-summary-limit-exclude-marks (marks &optional reverse
)
7672 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7673 If REVERSE, limit the summary buffer to articles that are marked
7674 with MARKS. MARKS can either be a string of marks or a list of marks.
7675 Returns how many articles were removed."
7676 (interactive "sMarks: ")
7677 (gnus-summary-limit-to-marks marks t
))
7679 (defun gnus-summary-limit-to-marks (marks &optional reverse
)
7680 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7681 If REVERSE (the prefix), limit the summary buffer to articles that are
7682 not marked with MARKS. MARKS can either be a string of marks or a
7684 Returns how many articles were removed."
7685 (interactive "sMarks: \nP")
7687 (let ((data gnus-newsgroup-data
)
7688 (marks (if (listp marks
) marks
7689 (append marks nil
))) ; Transform to list.
7692 (when (if reverse
(not (memq (gnus-data-mark (car data
)) marks
))
7693 (memq (gnus-data-mark (car data
)) marks
))
7694 (push (gnus-data-number (car data
)) articles
))
7695 (setq data
(cdr data
)))
7696 (gnus-summary-limit articles
))
7697 (gnus-summary-position-point)))
7699 (defun gnus-summary-limit-to-score (score)
7700 "Limit to articles with score at or above SCORE."
7701 (interactive "NLimit to articles with score of at least: ")
7702 (let ((data gnus-newsgroup-data
)
7705 (when (>= (gnus-summary-article-score (gnus-data-number (car data
)))
7707 (push (gnus-data-number (car data
)) articles
))
7708 (setq data
(cdr data
)))
7710 (gnus-summary-limit articles
)
7711 (gnus-summary-position-point))))
7713 (defun gnus-summary-limit-to-unseen ()
7714 "Limit to unseen articles."
7717 (gnus-summary-limit gnus-newsgroup-unseen
)
7718 (gnus-summary-position-point)))
7720 (defun gnus-summary-limit-include-thread (id)
7721 "Display all the hidden articles that is in the thread with ID in it.
7722 When called interactively, ID is the Message-ID of the current
7724 (interactive (list (mail-header-id (gnus-summary-article-header))))
7725 (let ((articles (gnus-articles-in-thread
7726 (gnus-id-to-thread (gnus-root-id id
)))))
7728 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
7729 (gnus-summary-limit-include-matching-articles
7731 (regexp-quote (gnus-simplify-subject-re
7732 (mail-header-subject (gnus-id-to-header id
)))))
7733 (gnus-summary-position-point))))
7735 (defun gnus-summary-limit-include-matching-articles (header regexp
)
7736 "Display all the hidden articles that have HEADERs that match REGEXP."
7737 (interactive (list (read-string "Match on header: ")
7738 (read-string "Regexp: ")))
7739 (let ((articles (gnus-find-matching-articles header regexp
)))
7741 (gnus-summary-limit (nconc articles gnus-newsgroup-limit
))
7742 (gnus-summary-position-point))))
7744 (defun gnus-summary-insert-dormant-articles ()
7745 "Insert all the dormant articles for this group into the current buffer."
7747 (let ((gnus-verbose (max 6 gnus-verbose
)))
7748 (if (not gnus-newsgroup-dormant
)
7749 (gnus-message 3 "No cached articles for this group")
7750 (gnus-summary-goto-subjects gnus-newsgroup-dormant
))))
7752 (defun gnus-summary-limit-include-dormant ()
7753 "Display all the hidden articles that are marked as dormant.
7754 Note that this command only works on a subset of the articles currently
7755 fetched for this group."
7757 (unless gnus-newsgroup-dormant
7758 (error "There are no dormant articles in this group"))
7760 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit
))
7761 (gnus-summary-position-point)))
7763 (defun gnus-summary-limit-exclude-dormant ()
7764 "Hide all dormant articles."
7767 (gnus-summary-limit-to-marks (list gnus-dormant-mark
) 'reverse
)
7768 (gnus-summary-position-point)))
7770 (defun gnus-summary-limit-exclude-childless-dormant ()
7771 "Hide all dormant articles that have no children."
7773 (let ((data (gnus-data-list t
))
7774 articles d children
)
7775 ;; Find all articles that are either not dormant or have
7777 (while (setq d
(pop data
))
7778 (when (or (not (= (gnus-data-mark d
) gnus-dormant-mark
))
7780 (gnus-article-children (gnus-data-number d
)))
7783 (when (memq (car children
) articles
)
7788 (push (gnus-data-number d
) articles
)))
7791 (gnus-summary-limit articles
)
7792 (gnus-summary-position-point))))
7794 (defun gnus-summary-limit-mark-excluded-as-read (&optional all
)
7795 "Mark all unread excluded articles as read.
7796 If ALL, mark even excluded ticked and dormants as read."
7798 (setq gnus-newsgroup-limit
(sort gnus-newsgroup-limit
'<))
7799 (let ((articles (gnus-sorted-ndifference
7801 (mapcar (lambda (h) (mail-header-number h
))
7802 gnus-newsgroup-headers
)
7804 gnus-newsgroup-limit
))
7806 (setq gnus-newsgroup-unreads
7807 (gnus-sorted-intersection gnus-newsgroup-unreads
7808 gnus-newsgroup-limit
))
7810 (setq gnus-newsgroup-dormant nil
7811 gnus-newsgroup-marked nil
7812 gnus-newsgroup-reads
7814 (mapcar (lambda (n) (cons n gnus-catchup-mark
)) articles
)
7815 gnus-newsgroup-reads
))
7816 (while (setq article
(pop articles
))
7817 (unless (or (memq article gnus-newsgroup-dormant
)
7818 (memq article gnus-newsgroup-marked
))
7819 (push (cons article gnus-catchup-mark
) gnus-newsgroup-reads
))))))
7821 (defun gnus-summary-limit (articles &optional pop
)
7823 ;; We pop the previous limit off the stack and use that.
7824 (setq articles
(car gnus-newsgroup-limits
)
7825 gnus-newsgroup-limits
(cdr gnus-newsgroup-limits
))
7826 ;; We use the new limit, so we push the old limit on the stack.
7827 (push gnus-newsgroup-limit gnus-newsgroup-limits
))
7829 (setq gnus-newsgroup-limit articles
)
7830 (let ((total (length gnus-newsgroup-data
))
7831 (data (gnus-data-find-list (gnus-summary-article-number)))
7832 (gnus-summary-mark-below nil
) ; Inhibit this.
7834 ;; This will do all the work of generating the new summary buffer
7835 ;; according to the new limit.
7836 (gnus-summary-prepare)
7837 ;; Hide any threads, possibly.
7838 (gnus-summary-maybe-hide-threads)
7839 ;; Try to return to the article you were at, or one in the
7842 ;; We try to find some article after the current one.
7844 (when (gnus-summary-goto-subject (gnus-data-number (car data
)) nil t
)
7847 (setq data
(cdr data
))))
7849 ;; If there is no data, that means that we were after the last
7850 ;; article. The same goes when we can't find any articles
7851 ;; after the current one.
7852 (goto-char (point-max))
7853 (gnus-summary-find-prev))
7854 (gnus-set-mode-line 'summary
)
7855 ;; We return how many articles were removed from the summary
7856 ;; buffer as a result of the new limit.
7857 (- total
(length gnus-newsgroup-data
))))
7859 (defsubst gnus-invisible-cut-children
(threads)
7862 (when (memq (mail-header-number (caar threads
)) gnus-newsgroup-limit
)
7867 (defsubst gnus-cut-thread
(thread)
7868 "Go forwards in the thread until we find an article that we want to display."
7869 (when (or (eq gnus-fetch-old-headers
'some
)
7870 (eq gnus-fetch-old-headers
'invisible
)
7871 (numberp gnus-fetch-old-headers
)
7872 (eq gnus-build-sparse-threads
'some
)
7873 (eq gnus-build-sparse-threads
'more
))
7874 ;; Deal with old-fetched headers and sparse threads.
7878 (gnus-summary-article-sparse-p (mail-header-number (car thread
)))
7879 (gnus-summary-article-ancient-p
7880 (mail-header-number (car thread
))))
7881 (if (or (<= (length (cdr thread
)) 1)
7882 (eq gnus-fetch-old-headers
'invisible
))
7883 (setq gnus-newsgroup-limit
7884 (delq (mail-header-number (car thread
))
7885 gnus-newsgroup-limit
)
7886 thread
(cadr thread
))
7887 (when (gnus-invisible-cut-children (cdr thread
))
7888 (let ((th (cdr thread
)))
7890 (if (memq (mail-header-number (caar th
))
7891 gnus-newsgroup-limit
)
7892 (setq thread
(car th
)
7894 (setq th
(cdr th
))))))))))
7897 (defun gnus-cut-threads (threads)
7898 "Cut off all uninteresting articles from the beginning of THREADS."
7899 (when (or (eq gnus-fetch-old-headers
'some
)
7900 (eq gnus-fetch-old-headers
'invisible
)
7901 (numberp gnus-fetch-old-headers
)
7902 (eq gnus-build-sparse-threads
'some
)
7903 (eq gnus-build-sparse-threads
'more
))
7906 (setcar th
(gnus-cut-thread (car th
)))
7907 (setq th
(cdr th
)))))
7908 ;; Remove nixed out threads.
7911 (defun gnus-summary-initial-limit (&optional show-if-empty
)
7912 "Figure out what the initial limit is supposed to be on group entry.
7913 This entails weeding out unwanted dormants, low-scored articles,
7914 fetch-old-headers verbiage, and so on."
7915 ;; Most groups have nothing to remove.
7916 (if (or gnus-inhibit-limiting
7917 (and (null gnus-newsgroup-dormant
)
7918 (eq gnus-newsgroup-display
'gnus-not-ignore
)
7919 (not (eq gnus-fetch-old-headers
'some
))
7920 (not (numberp gnus-fetch-old-headers
))
7921 (not (eq gnus-fetch-old-headers
'invisible
))
7922 (null gnus-summary-expunge-below
)
7923 (not (eq gnus-build-sparse-threads
'some
))
7924 (not (eq gnus-build-sparse-threads
'more
))
7925 (null gnus-thread-expunge-below
)
7926 (not gnus-use-nocem
)))
7928 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
7929 (setq gnus-newsgroup-limit nil
)
7932 (unless (car (symbol-value node
))
7933 ;; These threads have no parents -- they are roots.
7934 (let ((nodes (cdr (symbol-value node
)))
7937 (if (and gnus-thread-expunge-below
7938 (< (gnus-thread-total-score (car nodes
))
7939 gnus-thread-expunge-below
))
7940 (gnus-expunge-thread (pop nodes
))
7941 (setq thread
(pop nodes
))
7942 (gnus-summary-limit-children thread
))))))
7943 gnus-newsgroup-dependencies
)
7944 ;; If this limitation resulted in an empty group, we might
7945 ;; pop the previous limit and use it instead.
7946 (when (and (not gnus-newsgroup-limit
)
7948 (setq gnus-newsgroup-limit
(pop gnus-newsgroup-limits
)))
7949 gnus-newsgroup-limit
))
7951 (defun gnus-summary-limit-children (thread)
7952 "Return 1 if this subthread is visible and 0 if it is not."
7953 ;; First we get the number of visible children to this thread. This
7954 ;; is done by recursing down the thread using this function, so this
7955 ;; will really go down to a leaf article first, before slowly
7956 ;; working its way up towards the root.
7958 (let* ((max-lisp-eval-depth 5000)
7961 (apply '+ (mapcar 'gnus-summary-limit-children
7964 (number (mail-header-number (car thread
)))
7967 (not (memq number gnus-newsgroup-marked
))
7969 ;; If this article is dormant and has absolutely no visible
7970 ;; children, then this article isn't visible.
7971 (and (memq number gnus-newsgroup-dormant
)
7973 ;; If this is "fetch-old-headered" and there is no
7974 ;; visible children, then we don't want this article.
7975 (and (or (eq gnus-fetch-old-headers
'some
)
7976 (numberp gnus-fetch-old-headers
))
7977 (gnus-summary-article-ancient-p number
)
7979 ;; If this is "fetch-old-headered" and `invisible', then
7980 ;; we don't want this article.
7981 (and (eq gnus-fetch-old-headers
'invisible
)
7982 (gnus-summary-article-ancient-p number
))
7983 ;; If this is a sparsely inserted article with no children,
7984 ;; we don't want it.
7985 (and (eq gnus-build-sparse-threads
'some
)
7986 (gnus-summary-article-sparse-p number
)
7988 ;; If we use expunging, and this article is really
7989 ;; low-scored, then we don't want this article.
7990 (when (and gnus-summary-expunge-below
7992 (or (cdr (assq number gnus-newsgroup-scored
))
7993 gnus-summary-default-score
))
7994 gnus-summary-expunge-below
))
7995 ;; We increase the expunge-tally here, but that has
7996 ;; nothing to do with the limits, really.
7997 (incf gnus-newsgroup-expunged-tally
)
7998 ;; We also mark as read here, if that's wanted.
7999 (when (and gnus-summary-mark-below
8000 (< score gnus-summary-mark-below
))
8001 (setq gnus-newsgroup-unreads
8002 (delq number gnus-newsgroup-unreads
))
8003 (if gnus-newsgroup-auto-expire
8004 (push number gnus-newsgroup-expirable
)
8005 (push (cons number gnus-low-score-mark
)
8006 gnus-newsgroup-reads
)))
8008 ;; Do the `display' group parameter.
8009 (and gnus-newsgroup-display
8010 (not (funcall gnus-newsgroup-display
)))
8011 ;; Check NoCeM things.
8012 (if (and gnus-use-nocem
8013 (gnus-nocem-unwanted-article-p
8014 (mail-header-id (car thread
))))
8016 (setq gnus-newsgroup-unreads
8017 (delq number gnus-newsgroup-unreads
))
8019 ;; Nope, invisible article.
8021 ;; Ok, this article is to be visible, so we add it to the limit
8023 (push number gnus-newsgroup-limit
)
8026 (defun gnus-expunge-thread (thread)
8027 "Mark all articles in THREAD as read."
8028 (let* ((number (mail-header-number (car thread
))))
8029 (incf gnus-newsgroup-expunged-tally
)
8030 ;; We also mark as read here, if that's wanted.
8031 (setq gnus-newsgroup-unreads
8032 (delq number gnus-newsgroup-unreads
))
8033 (if gnus-newsgroup-auto-expire
8034 (push number gnus-newsgroup-expirable
)
8035 (push (cons number gnus-low-score-mark
)
8036 gnus-newsgroup-reads
)))
8037 ;; Go recursively through all subthreads.
8038 (mapcar 'gnus-expunge-thread
(cdr thread
)))
8040 ;; Summary article oriented commands
8042 (defun gnus-summary-refer-parent-article (n)
8043 "Refer parent article N times.
8044 If N is negative, go to ancestor -N instead.
8045 The difference between N and the number of articles fetched is returned."
8049 (when (not (natnump n
))
8054 (setq header
(gnus-summary-article-header))
8055 (if (and (eq (mail-header-number header
)
8056 (cdr gnus-article-current
))
8057 (equal gnus-newsgroup-name
8058 (car gnus-article-current
)))
8059 ;; If we try to find the parent of the currently
8060 ;; displayed article, then we take a look at the actual
8061 ;; References header, since this is slightly more
8062 ;; reliable than the References field we got from the
8065 (set-buffer gnus-original-article-buffer
)
8066 (nnheader-narrow-to-headers)
8067 (unless (setq ref
(message-fetch-field "references"))
8068 (when (setq ref
(message-fetch-field "in-reply-to"))
8069 (setq ref
(gnus-extract-message-id-from-in-reply-to ref
))))
8072 ;; It's not the current article, so we take a bet on
8073 ;; the value we got from the server.
8074 (mail-header-references header
)))
8076 (not (equal ref
"")))
8077 (unless (gnus-summary-refer-article (gnus-parent-id ref skip
))
8078 (gnus-message 1 "Couldn't find parent"))
8079 (gnus-message 1 "No references in article %d"
8080 (gnus-summary-article-number))
8083 (gnus-summary-position-point)
8086 (defun gnus-summary-refer-references ()
8087 "Fetch all articles mentioned in the References header.
8088 Return the number of articles fetched."
8090 (let ((ref (mail-header-references (gnus-summary-article-header)))
8091 (current (gnus-summary-article-number))
8095 (error "No References in the current article")
8096 ;; For each Message-ID in the References header...
8097 (while (string-match "<[^>]*>" ref
)
8099 ;; ... fetch that article.
8100 (gnus-summary-refer-article
8101 (prog1 (match-string 0 ref
)
8102 (setq ref
(substring ref
(match-end 0))))))
8103 (gnus-summary-goto-subject current
)
8104 (gnus-summary-position-point)
8107 (defun gnus-summary-refer-thread (&optional limit
)
8108 "Fetch all articles in the current thread.
8109 If LIMIT (the numerical prefix), fetch that many old headers instead
8110 of what's specified by the `gnus-refer-thread-limit' variable."
8112 (let ((id (mail-header-id (gnus-summary-article-header)))
8113 (limit (if limit
(prefix-numeric-value limit
)
8114 gnus-refer-thread-limit
)))
8115 (unless (eq gnus-fetch-old-headers
'invisible
)
8116 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name
)
8117 ;; Retrieve the headers and read them in.
8118 (if (eq (if (numberp limit
)
8119 (gnus-retrieve-headers
8121 (+ (mail-header-number
8122 (gnus-summary-article-header))
8124 gnus-newsgroup-end
))
8125 gnus-newsgroup-name
(* limit
2))
8126 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8128 (gnus-retrieve-headers (list gnus-newsgroup-end
)
8129 gnus-newsgroup-name limit
))
8131 (gnus-build-all-threads)
8132 (error "Can't fetch thread from back ends that don't support NOV"))
8133 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name
))
8134 (gnus-summary-limit-include-thread id
)))
8136 (defun gnus-summary-refer-article (message-id)
8137 "Fetch an article specified by MESSAGE-ID."
8138 (interactive "sMessage-ID: ")
8139 (when (and (stringp message-id
)
8140 (not (zerop (length message-id
))))
8141 (setq message-id
(gnus-replace-in-string message-id
" " ""))
8142 ;; Construct the correct Message-ID if necessary.
8143 ;; Suggested by tale@pawl.rpi.edu.
8144 (unless (string-match "^<" message-id
)
8145 (setq message-id
(concat "<" message-id
)))
8146 (unless (string-match ">$" message-id
)
8147 (setq message-id
(concat message-id
">")))
8148 ;; People often post MIDs from URLs, so unhex it:
8149 (unless (string-match "@" message-id
)
8150 (setq message-id
(gnus-url-unhex-string message-id
)))
8151 (let* ((header (gnus-id-to-header message-id
))
8153 (gnus-summary-article-sparse-p
8154 (mail-header-number header
))
8155 (memq (mail-header-number header
)
8156 gnus-newsgroup-limit
)))
8159 ;; If the article is present in the buffer we just go to it.
8161 (or (not (gnus-summary-article-sparse-p
8162 (mail-header-number header
)))
8165 (gnus-summary-goto-article
8166 (mail-header-number header
) nil t
)
8168 (gnus-summary-update-article (mail-header-number header
)))))
8170 ;; We fetch the article.
8172 (dolist (gnus-override-method (gnus-refer-article-methods))
8173 (when (and (gnus-check-server gnus-override-method
)
8174 ;; Fetch the header,
8175 (setq number
(gnus-summary-insert-subject message-id
)))
8176 ;; and display the article.
8177 (gnus-summary-select-article nil nil nil number
)
8179 (gnus-message 3 "Couldn't fetch article %s" message-id
)))))))
8181 (defun gnus-refer-article-methods ()
8182 "Return a list of referable methods."
8184 ;; No method, so we default to current and native.
8185 ((null gnus-refer-article-method
)
8186 (list gnus-current-select-method gnus-select-method
))
8188 ((eq 'current gnus-refer-article-method
)
8189 (list gnus-current-select-method
))
8190 ;; List of select methods.
8191 ((not (and (symbolp (car gnus-refer-article-method
))
8192 (assq (car gnus-refer-article-method
) nnoo-definition-alist
)))
8194 (dolist (method gnus-refer-article-method
)
8195 (push (if (eq 'current method
)
8196 gnus-current-select-method
8200 ;; One single select method.
8202 (list gnus-refer-article-method
))))
8204 (defun gnus-summary-edit-parameters ()
8205 "Edit the group parameters of the current group."
8207 (gnus-group-edit-group gnus-newsgroup-name
'params
))
8209 (defun gnus-summary-customize-parameters ()
8210 "Customize the group parameters of the current group."
8212 (gnus-group-customize gnus-newsgroup-name
))
8214 (defun gnus-summary-enter-digest-group (&optional force
)
8215 "Enter an nndoc group based on the current article.
8216 If FORCE, force a digest interpretation. If not, try
8217 to guess what the document format is."
8219 (let ((conf gnus-current-window-configuration
))
8220 (save-window-excursion
8222 (let (gnus-article-prepare-hook
8223 gnus-display-mime-function
8225 (gnus-summary-select-article))))
8226 (setq gnus-current-window-configuration conf
)
8227 (let* ((name (format "%s-%d"
8228 (gnus-group-prefixed-name
8229 gnus-newsgroup-name
(list 'nndoc
""))
8231 (set-buffer gnus-summary-buffer
)
8232 gnus-current-article
)))
8233 (ogroup gnus-newsgroup-name
)
8234 (params (append (gnus-info-params (gnus-get-info ogroup
))
8235 (list (cons 'to-group ogroup
))
8236 (list (cons 'parent-group ogroup
))
8237 (list (cons 'save-article-group ogroup
))))
8238 (case-fold-search t
)
8239 (buf (current-buffer))
8242 (set-buffer gnus-original-article-buffer
)
8243 ;; Have the digest group inherit the main mail address of
8244 ;; the parent article.
8245 (when (setq to-address
(or (gnus-fetch-field "reply-to")
8246 (gnus-fetch-field "from")))
8247 (setq params
(append
8248 (list (cons 'to-address
8249 (funcall gnus-decode-encoded-word-function
8251 (setq dig
(nnheader-set-temp-buffer " *gnus digest buffer*"))
8252 (insert-buffer-substring gnus-original-article-buffer
)
8253 ;; Remove lines that may lead nndoc to misinterpret the
8256 (goto-char (point-min))
8257 (or (search-forward "\n\n" nil t
) (point)))
8258 (goto-char (point-min))
8259 (delete-matching-lines "^Path:\\|^From ")
8262 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset
)
8263 (gnus-newsgroup-ephemeral-ignored-charsets
8264 gnus-newsgroup-ignored-charsets
))
8265 (gnus-group-read-ephemeral-group
8266 name
`(nndoc ,name
(nndoc-address ,(get-buffer dig
))
8268 ,(if force
'mbox
'guess
)))
8270 `((adapt-file .
,(gnus-score-file-name gnus-newsgroup-name
8272 ;; Make all postings to this group go to the parent group.
8273 (nconc (gnus-info-params (gnus-get-info name
))
8275 ;; Couldn't select this doc group.
8276 (switch-to-buffer buf
)
8277 (gnus-set-global-variables)
8278 (gnus-configure-windows 'summary
)
8279 (gnus-message 3 "Article couldn't be entered?"))
8280 (kill-buffer dig
)))))
8282 (defun gnus-summary-read-document (n)
8283 "Open a new group based on the current article(s).
8284 This will allow you to read digests and other similar
8285 documents as newsgroups.
8286 Obeys the standard process/prefix convention."
8288 (let* ((articles (gnus-summary-work-articles n
))
8289 (ogroup gnus-newsgroup-name
)
8290 (params (append (gnus-info-params (gnus-get-info ogroup
))
8291 (list (cons 'to-group ogroup
))))
8292 article group egroup groups vgroup
)
8293 (while (setq article
(pop articles
))
8294 (setq group
(format "%s-%d" gnus-newsgroup-name article
))
8295 (gnus-summary-remove-process-mark article
)
8296 (when (gnus-summary-display-article article
)
8299 (insert-buffer-substring gnus-original-article-buffer
)
8300 ;; Remove some headers that may lead nndoc to make
8302 (message-narrow-to-head)
8303 (goto-char (point-min))
8304 (delete-matching-lines "^\\(Path\\):\\|^From ")
8307 (gnus-group-read-ephemeral-group
8308 group
`(nndoc ,group
(nndoc-address ,(current-buffer))
8309 (nndoc-article-type guess
))
8312 ;; Make all postings to this group go to the parent group.
8313 (nconc (gnus-info-params (gnus-get-info egroup
))
8315 (push egroup groups
))
8316 ;; Couldn't select this doc group.
8317 (gnus-error 3 "Article couldn't be entered"))))))
8318 ;; Now we have selected all the documents.
8321 (error "None of the articles could be interpreted as documents"))
8322 ((gnus-group-read-ephemeral-group
8323 (setq vgroup
(format
8324 "nnvirtual:%s-%s" gnus-newsgroup-name
8325 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8326 `(nnvirtual ,vgroup
(nnvirtual-component-groups ,groups
))
8328 (cons (current-buffer) 'summary
)))
8330 (error "Couldn't select virtual nndoc group")))))
8332 (defun gnus-summary-isearch-article (&optional regexp-p
)
8333 "Do incremental search forward on the current article.
8334 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8336 (gnus-summary-select-article)
8337 (gnus-configure-windows 'article
)
8338 (gnus-eval-in-buffer-window gnus-article-buffer
8341 (isearch-forward regexp-p
))))
8343 (defun gnus-summary-search-article-forward (regexp &optional backward
)
8344 "Search for an article containing REGEXP forward.
8345 If BACKWARD, search backward instead."
8348 (format "Search article %s (regexp%s): "
8349 (if current-prefix-arg
"backward" "forward")
8350 (if gnus-last-search-regexp
8351 (concat ", default " gnus-last-search-regexp
)
8353 current-prefix-arg
))
8354 (if (string-equal regexp
"")
8355 (setq regexp
(or gnus-last-search-regexp
""))
8356 (setq gnus-last-search-regexp regexp
)
8357 (setq gnus-article-before-search gnus-current-article
))
8358 ;; Intentionally set gnus-last-article.
8359 (setq gnus-last-article gnus-article-before-search
)
8360 (let ((gnus-last-article gnus-last-article
))
8361 (if (gnus-summary-search-article regexp backward
)
8362 (gnus-summary-show-thread)
8363 (signal 'search-failed
(list regexp
)))))
8365 (defun gnus-summary-search-article-backward (regexp)
8366 "Search for an article containing REGEXP backward."
8369 (format "Search article backward (regexp%s): "
8370 (if gnus-last-search-regexp
8371 (concat ", default " gnus-last-search-regexp
)
8373 (gnus-summary-search-article-forward regexp
'backward
))
8375 (defun gnus-summary-search-article (regexp &optional backward
)
8376 "Search for an article containing REGEXP.
8377 Optional argument BACKWARD means do search for backward.
8378 `gnus-select-article-hook' is not called during the search."
8379 ;; We have to require this here to make sure that the following
8380 ;; dynamic binding isn't shadowed by autoloading.
8381 (require 'gnus-async
)
8383 (let ((gnus-select-article-hook nil
) ;Disable hook.
8384 (gnus-article-prepare-hook nil
)
8385 (gnus-mark-article-hook nil
) ;Inhibit marking as read.
8386 (gnus-use-article-prefetch nil
)
8387 (gnus-xmas-force-redisplay nil
) ;Inhibit XEmacs redisplay.
8388 (gnus-use-trees nil
) ;Inhibit updating tree buffer.
8390 (gnus-keep-backlog nil
)
8391 (gnus-break-pages nil
)
8392 (gnus-summary-display-arrow nil
)
8393 (gnus-updated-mode-lines nil
)
8394 (gnus-auto-center-summary nil
)
8395 (sum (current-buffer))
8396 (gnus-display-mime-function nil
)
8399 (gnus-save-hidden-threads
8400 (gnus-summary-select-article)
8401 (set-buffer gnus-article-buffer
)
8402 (goto-char (window-point (get-buffer-window (current-buffer))))
8406 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current
))
8408 (re-search-backward regexp nil t
)
8409 (re-search-forward regexp nil t
))
8410 ;; We found the regexp.
8415 (get-buffer-window (current-buffer))
8419 (get-buffer-window (current-buffer))
8422 (setq point
(point)))
8423 ;; We didn't find it, so we go to the next article.
8426 (while (eq found
'not
)
8427 (if (not (if backward
(gnus-summary-find-prev)
8428 (gnus-summary-find-next)))
8429 ;; No more articles.
8431 ;; Select the next article and adjust point.
8432 (unless (gnus-summary-article-sparse-p
8433 (gnus-summary-article-number))
8435 (gnus-summary-select-article)
8436 (set-buffer gnus-article-buffer
)
8438 (goto-char (if backward
(point-max) (point-min))))))))
8439 (gnus-message 7 ""))
8440 ;; Return whether we found the regexp.
8441 (when (eq found
'found
)
8443 (gnus-summary-show-thread)
8444 (gnus-summary-goto-subject gnus-current-article
)
8445 (gnus-summary-position-point)
8448 (defun gnus-find-matching-articles (header regexp
)
8449 "Return a list of all articles that match REGEXP on HEADER.
8450 This search includes all articles in the current group that Gnus has
8451 fetched headers for, whether they are displayed or not."
8452 (let ((articles nil
)
8453 (func `(lambda (h) (,(intern (concat "mail-header-" header
)) h
)))
8454 (case-fold-search t
))
8455 (dolist (header gnus-newsgroup-headers
)
8456 (when (string-match regexp
(funcall func header
))
8457 (push (mail-header-number header
) articles
)))
8458 (nreverse articles
)))
8460 (defun gnus-summary-find-matching (header regexp
&optional backward unread
8461 not-case-fold not-matching
)
8462 "Return a list of all articles that match REGEXP on HEADER.
8463 The search stars on the current article and goes forwards unless
8464 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8465 If UNREAD is non-nil, only unread articles will
8466 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8467 in the comparisons. If NOT-MATCHING, return a list of all articles that
8468 not match REGEXP on HEADER."
8469 (let ((case-fold-search (not not-case-fold
))
8472 (if (eq (car header
) 'extra
)
8475 (or (cdr (assq ',(cdr header
) (mail-header-extra h
)))
8477 (error "%s is an invalid header" header
))
8478 (unless (fboundp (intern (concat "mail-header-" header
)))
8479 (error "%s is not a valid header" header
))
8480 (setq func
`(lambda (h) (,(intern (concat "mail-header-" header
)) h
))))
8481 (dolist (d (if (eq backward
'all
)
8483 (gnus-data-find-list
8484 (gnus-summary-article-number)
8485 (gnus-data-list backward
))))
8486 (when (and (or (not unread
) ; We want all articles...
8487 (gnus-data-unread-p d
)) ; Or just unreads.
8488 (vectorp (gnus-data-header d
)) ; It's not a pseudo.
8492 (funcall func
(gnus-data-header d
))))
8493 (string-match regexp
8494 (funcall func
(gnus-data-header d
)))))
8495 (push (gnus-data-number d
) articles
))) ; Success!
8496 (nreverse articles
)))
8498 (defun gnus-summary-execute-command (header regexp command
&optional backward
)
8499 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8500 If HEADER is an empty string (or nil), the match is done on the entire
8501 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8503 (list (let ((completion-ignore-case t
))
8506 (mapcar (lambda (header) (list (format "%s" header
)))
8508 '("Number" "Subject" "From" "Lines" "Date"
8509 "Message-ID" "Xref" "References" "Body")
8510 gnus-extra-headers
))
8511 nil
'require-match
))
8512 (read-string "Regexp: ")
8513 (read-key-sequence "Command: ")
8514 current-prefix-arg
))
8515 (when (equal header
"Body")
8517 ;; Hidden thread subtrees must be searched as well.
8518 (gnus-summary-show-all-threads)
8519 ;; We don't want to change current point nor window configuration.
8521 (save-window-excursion
8523 gnus-treat-strip-trailing-blank-lines
8524 gnus-treat-strip-leading-blank-lines
8525 gnus-treat-strip-multiple-blank-lines
8526 gnus-treat-hide-boring-headers
8527 gnus-treat-fold-newsgroups
8528 gnus-article-prepare-hook
)
8529 (gnus-message 6 "Executing %s..." (key-description command
))
8530 ;; We'd like to execute COMMAND interactively so as to give arguments.
8531 (gnus-execute header regexp
8532 `(call-interactively ',(key-binding command
))
8534 (gnus-message 6 "Executing %s...done" (key-description command
))))))
8536 (defun gnus-summary-beginning-of-article ()
8537 "Scroll the article back to the beginning."
8539 (gnus-summary-select-article)
8540 (gnus-configure-windows 'article
)
8541 (gnus-eval-in-buffer-window gnus-article-buffer
8543 (goto-char (point-min))
8544 (when gnus-break-pages
8545 (gnus-narrow-to-page))))
8547 (defun gnus-summary-end-of-article ()
8548 "Scroll to the end of the article."
8550 (gnus-summary-select-article)
8551 (gnus-configure-windows 'article
)
8552 (gnus-eval-in-buffer-window gnus-article-buffer
8554 (goto-char (point-max))
8556 (when gnus-break-pages
8557 (when (re-search-backward page-delimiter nil t
)
8558 (narrow-to-region (match-end 0) (point-max)))
8559 (gnus-narrow-to-page))))
8561 (defun gnus-summary-print-truncate-and-quote (string &optional len
)
8562 "Truncate to LEN and quote all \"(\"'s in STRING."
8563 (gnus-replace-in-string (if (and len
(> (length string
) len
))
8564 (substring string
0 len
)
8568 (defun gnus-summary-print-article (&optional filename n
)
8569 "Generate and print a PostScript image of the process-marked (mail) articles.
8571 If used interactively, print the current article if none are
8572 process-marked. With prefix arg, prompt the user for the name of the
8575 When used from Lisp, accept two optional args FILENAME and N. N means
8576 to print the next N articles. If N is negative, print the N previous
8577 articles. If N is nil and articles have been marked with the process
8578 mark, print these instead.
8580 If the optional first argument FILENAME is nil, send the image to the
8581 printer. If FILENAME is a string, save the PostScript image in a file with
8582 that name. If FILENAME is a number, prompt the user for the name of the file
8584 (interactive (list (ps-print-preprint current-prefix-arg
)))
8585 (dolist (article (gnus-summary-work-articles n
))
8586 (gnus-summary-select-article nil nil
'pseudo article
)
8587 (gnus-eval-in-buffer-window gnus-article-buffer
8588 (gnus-print-buffer))
8589 (gnus-summary-remove-process-mark article
))
8590 (ps-despool filename
))
8592 (defun gnus-print-buffer ()
8593 (let ((buffer (generate-new-buffer " *print*")))
8596 (copy-to-buffer buffer
(point-min) (point-max))
8598 (gnus-remove-text-with-property 'gnus-decoration
)
8599 (when (gnus-visual-p 'article-highlight
'highlight
)
8600 ;; Copy-to-buffer doesn't copy overlay. So redo
8602 (let ((gnus-article-buffer buffer
))
8603 (gnus-article-highlight-citation t
)
8604 (gnus-article-highlight-signature)
8605 (gnus-article-emphasize)
8606 (gnus-article-delete-invisible-text)))
8607 (let ((ps-left-header
8610 (gnus-summary-print-truncate-and-quote
8611 (mail-header-subject gnus-current-headers
)
8614 (gnus-summary-print-truncate-and-quote
8615 (mail-header-from gnus-current-headers
)
8619 "/pagenumberstring load"
8621 (mail-header-date gnus-current-headers
) ")"))))
8622 (gnus-run-hooks 'gnus-ps-print-hook
)
8625 (ps-spool-buffer-with-faces)
8626 (ps-spool-buffer)))))
8627 (kill-buffer buffer
))))
8629 (defun gnus-summary-show-article (&optional arg
)
8630 "Force redisplaying of the current article.
8631 If ARG (the prefix) is a number, show the article with the charset
8632 defined in `gnus-summary-show-article-charset-alist', or the charset
8634 If ARG (the prefix) is non-nil and not a number, show the raw article
8635 without any article massaging functions being run. Normally, the key
8636 strokes are `C-u g'."
8640 (gnus-summary-show-article t
)
8641 (let ((gnus-newsgroup-charset
8642 (or (cdr (assq arg gnus-summary-show-article-charset-alist
))
8643 (mm-read-coding-system
8644 "View as charset: " ;; actually it is coding system.
8646 (set-buffer gnus-article-buffer
)
8647 (mm-detect-coding-region (point) (point-max))))))
8648 (gnus-newsgroup-ignored-charsets 'gnus-all
))
8649 (gnus-summary-select-article nil
'force
)
8650 (let ((deps gnus-newsgroup-dependencies
)
8653 (set-buffer gnus-original-article-buffer
)
8655 (message-narrow-to-head)
8656 (setq head
(buffer-string))
8657 (goto-char (point-min))
8658 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t
)
8659 (goto-char (point-max))
8661 (setq lines
(1- (count-lines (point) (point-max))))))
8663 (insert (format "211 %d Article retrieved.\n"
8664 (cdr gnus-article-current
)))
8666 (if lines
(insert (format "Lines: %d\n" lines
)))
8668 (let ((nntp-server-buffer (current-buffer)))
8669 (setq header
(car (gnus-get-newsgroup-headers deps t
))))))
8670 (gnus-data-set-header
8671 (gnus-data-find (cdr gnus-article-current
))
8673 (gnus-summary-update-article-line
8674 (cdr gnus-article-current
) header
)
8675 (when (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
8676 (gnus-summary-update-secondary-mark (cdr gnus-article-current
))))))
8678 ;; Select the article the normal way.
8679 (gnus-summary-select-article nil
'force
))
8681 ;; We have to require this here to make sure that the following
8682 ;; dynamic binding isn't shadowed by autoloading.
8683 (require 'gnus-async
)
8685 ;; Bind the article treatment functions to nil.
8686 (let ((gnus-have-all-headers t
)
8687 gnus-article-prepare-hook
8688 gnus-article-decode-hook
8689 gnus-display-mime-function
8691 ;; Destroy any MIME parts.
8692 (when (gnus-buffer-live-p gnus-article-buffer
)
8694 (set-buffer gnus-article-buffer
)
8695 (mm-destroy-parts gnus-article-mime-handles
)
8696 ;; Set it to nil for safety reason.
8697 (setq gnus-article-mime-handle-alist nil
)
8698 (setq gnus-article-mime-handles nil
)))
8699 (gnus-summary-select-article nil
'force
))))
8700 (gnus-summary-goto-subject gnus-current-article
)
8701 (gnus-summary-position-point))
8703 (defun gnus-summary-show-raw-article ()
8704 "Show the raw article without any article massaging functions being run."
8706 (gnus-summary-show-article t
))
8708 (defun gnus-summary-verbose-headers (&optional arg
)
8709 "Toggle permanent full header display.
8710 If ARG is a positive number, turn header display on.
8711 If ARG is a negative number, turn header display off."
8713 (setq gnus-show-all-headers
8714 (cond ((or (not (numberp arg
))
8716 (not gnus-show-all-headers
))
8719 (gnus-summary-show-article))
8721 (defun gnus-summary-toggle-header (&optional arg
)
8722 "Show the headers if they are hidden, or hide them if they are shown.
8723 If ARG is a positive number, show the entire header.
8724 If ARG is a negative number, hide the unwanted header lines."
8726 (let ((window (and (gnus-buffer-live-p gnus-article-buffer
)
8727 (get-buffer-window gnus-article-buffer t
))))
8728 (with-current-buffer gnus-article-buffer
8730 (article-narrow-to-head)
8731 (let* ((buffer-read-only nil
)
8732 (inhibit-point-motion-hooks t
)
8733 (hidden (if (numberp arg
)
8735 (gnus-article-hidden-text-p 'headers
)))
8737 (delete-region (point-min) (point-max))
8738 (with-current-buffer gnus-original-article-buffer
8739 (goto-char (setq s
(point-min)))
8740 (setq e
(if (search-forward "\n\n" nil t
)
8743 (insert-buffer-substring gnus-original-article-buffer s e
)
8744 (run-hooks 'gnus-article-decode-hook
)
8746 (let ((gnus-treat-hide-headers nil
)
8747 (gnus-treat-hide-boring-headers nil
))
8748 (gnus-delete-wash-type 'headers
)
8749 (gnus-treat-article 'head
))
8750 (gnus-treat-article 'head
))
8753 (set-window-start window
(goto-char (point-min))))
8754 (if gnus-break-pages
8755 (gnus-narrow-to-page)
8756 (when (gnus-visual-p 'page-marker
)
8757 (let ((buffer-read-only nil
))
8758 (gnus-remove-text-with-property 'gnus-prev
)
8759 (gnus-remove-text-with-property 'gnus-next
))))
8760 (gnus-set-mode-line 'article
)))))
8762 (defun gnus-summary-show-all-headers ()
8763 "Make all header lines visible."
8765 (gnus-summary-toggle-header 1))
8767 (defun gnus-summary-caesar-message (&optional arg
)
8768 "Caesar rotate the current article by 13.
8769 The numerical prefix specifies how many places to rotate each letter
8772 (gnus-summary-select-article)
8773 (let ((mail-header-separator ""))
8774 (gnus-eval-in-buffer-window gnus-article-buffer
8777 (let ((start (window-start))
8779 (message-caesar-buffer-body arg
)
8780 (set-window-start (get-buffer-window (current-buffer)) start
))))))
8782 (autoload 'unmorse-region
"morse"
8783 "Convert morse coded text in region to ordinary ASCII text."
8786 (defun gnus-summary-morse-message (&optional arg
)
8787 "Morse decode the current article."
8789 (gnus-summary-select-article)
8790 (let ((mail-header-separator ""))
8791 (gnus-eval-in-buffer-window gnus-article-buffer
8795 (let ((pos (window-start))
8797 (goto-char (point-min))
8798 (when (message-goto-body)
8799 (gnus-narrow-to-body))
8800 (goto-char (point-min))
8801 (while (re-search-forward "·" (point-max) t
)
8802 (replace-match "."))
8803 (unmorse-region (point-min) (point-max))
8805 (set-window-start (get-buffer-window (current-buffer)) pos
)))))))
8807 (defun gnus-summary-stop-page-breaking ()
8808 "Stop page breaking in the current article."
8810 (gnus-summary-select-article)
8811 (gnus-eval-in-buffer-window gnus-article-buffer
8813 (when (gnus-visual-p 'page-marker
)
8814 (let ((buffer-read-only nil
))
8815 (gnus-remove-text-with-property 'gnus-prev
)
8816 (gnus-remove-text-with-property 'gnus-next
))
8817 (setq gnus-page-broken nil
))))
8819 (defun gnus-summary-move-article (&optional n to-newsgroup
8820 select-method action
)
8821 "Move the current article to a different newsgroup.
8822 If N is a positive number, move the N next articles.
8823 If N is a negative number, move the N previous articles.
8824 If N is nil and any articles have been marked with the process mark,
8825 move those articles instead.
8826 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8827 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8828 re-spool using this method.
8830 When called interactively with TO-NEWSGROUP being nil, the value of
8831 the variable `gnus-move-split-methods' is used for finding a default
8832 for the target newsgroup.
8834 For this function to work, both the current newsgroup and the
8835 newsgroup that you want to move to have to support the `request-move'
8836 and `request-accept' functions.
8838 ACTION can be either `move' (the default), `crosspost' or `copy'."
8841 (setq action
'move
))
8842 ;; Check whether the source group supports the required functions.
8843 (cond ((and (eq action
'move
)
8844 (not (gnus-check-backend-function
8845 'request-move-article gnus-newsgroup-name
)))
8846 (error "The current group does not support article moving"))
8847 ((and (eq action
'crosspost
)
8848 (not (gnus-check-backend-function
8849 'request-replace-article gnus-newsgroup-name
)))
8850 (error "The current group does not support article editing")))
8851 (let ((articles (gnus-summary-work-articles n
))
8852 (prefix (if (gnus-check-backend-function
8853 'request-move-article gnus-newsgroup-name
)
8854 (gnus-group-real-prefix gnus-newsgroup-name
)
8856 (names '((move "Move" "Moving")
8857 (copy "Copy" "Copying")
8858 (crosspost "Crosspost" "Crossposting")))
8859 (copy-buf (save-excursion
8860 (nnheader-set-temp-buffer " *copy article*")))
8861 art-group to-method new-xref article to-groups
)
8862 (unless (assq action names
)
8863 (error "Unknown action %s" action
))
8864 ;; Read the newsgroup name.
8865 (when (and (not to-newsgroup
)
8866 (not select-method
))
8867 (if (and gnus-move-split-methods
8869 (and (memq gnus-current-article articles
)
8870 (gnus-buffer-live-p gnus-original-article-buffer
))))
8871 ;; When `gnus-move-split-methods' is non-nil, we have to
8872 ;; select an article to give `gnus-read-move-group-name' an
8873 ;; opportunity to suggest an appropriate default. However,
8874 ;; we needn't render or mark the article.
8875 (let ((gnus-display-mime-function nil
)
8876 (gnus-article-prepare-hook nil
)
8877 (gnus-mark-article-hook nil
))
8878 (gnus-summary-select-article nil nil nil
(car articles
))))
8880 (gnus-read-move-group-name
8881 (cadr (assq action names
))
8882 (symbol-value (intern (format "gnus-current-%s-group" action
)))
8884 (set (intern (format "gnus-current-%s-group" action
)) to-newsgroup
))
8885 (setq to-method
(or select-method
8886 (gnus-server-to-method
8887 (gnus-group-method to-newsgroup
))))
8888 ;; Check the method we are to move this article to...
8889 (unless (gnus-check-backend-function
8890 'request-accept-article
(car to-method
))
8891 (error "%s does not support article copying" (car to-method
)))
8892 (unless (gnus-check-server to-method
)
8893 (error "Can't open server %s" (car to-method
)))
8894 (gnus-message 6 "%s to %s: %s..."
8895 (caddr (assq action names
))
8896 (or (car select-method
) to-newsgroup
) articles
)
8898 (setq article
(pop articles
))
8902 ;; Move the article.
8904 ;; Remove this article from future suppression.
8905 (gnus-dup-unsuppress-article article
)
8906 (gnus-request-move-article
8907 article
; Article to move
8908 gnus-newsgroup-name
; From newsgroup
8909 (nth 1 (gnus-find-method-for-group
8910 gnus-newsgroup-name
)) ; Server
8911 (list 'gnus-request-accept-article
8912 to-newsgroup
(list 'quote select-method
)
8913 (not articles
) t
) ; Accept form
8914 (not articles
))) ; Only save nov last time
8915 ;; Copy the article.
8918 (set-buffer copy-buf
)
8919 (when (gnus-request-article-this-buffer article gnus-newsgroup-name
)
8920 (gnus-request-accept-article
8921 to-newsgroup select-method
(not articles
) t
))))
8922 ;; Crosspost the article.
8923 ((eq action
'crosspost
)
8924 (let ((xref (message-tokenize-header
8925 (mail-header-xref (gnus-summary-article-header article
))
8927 (setq new-xref
(concat (gnus-group-real-name gnus-newsgroup-name
)
8928 ":" (number-to-string article
)))
8930 (setq xref
(list (system-name))))
8933 (mapconcat 'identity
8934 (delete "Xref:" (delete new-xref xref
))
8938 (set-buffer copy-buf
)
8939 ;; First put the article in the destination group.
8940 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
8941 (when (consp (setq art-group
8942 (gnus-request-accept-article
8943 to-newsgroup select-method
(not articles
))))
8944 (setq new-xref
(concat new-xref
" " (car art-group
)
8946 (number-to-string (cdr art-group
))))
8947 ;; Now we have the new Xrefs header, so we insert
8948 ;; it and replace the new article.
8949 (nnheader-replace-header "Xref" new-xref
)
8950 (gnus-request-replace-article
8951 (cdr art-group
) to-newsgroup
(current-buffer))
8955 (gnus-message 1 "Couldn't %s article %s: %s"
8956 (cadr (assq action names
)) article
8957 (nnheader-get-report (car to-method
))))
8958 ((eq art-group
'junk
)
8959 (when (eq action
'move
)
8960 (gnus-summary-mark-article article gnus-canceled-mark
)
8961 (gnus-message 4 "Deleted article %s" article
)
8962 ;; run the delete hook
8963 (run-hook-with-args 'gnus-summary-article-delete-hook
8966 (assoc article
(gnus-data-list nil
)))
8967 gnus-newsgroup-name nil
8970 (let* ((pto-group (gnus-group-prefixed-name
8971 (car art-group
) to-method
))
8973 (gnus-gethash pto-group gnus-newsrc-hashtb
))
8974 (info (nth 2 entry
))
8975 (to-group (gnus-info-group info
))
8977 ;; Update the group that has been moved to.
8979 (memq action
'(move copy
)))
8980 (unless (member to-group to-groups
)
8981 (push to-group to-groups
))
8983 (unless (memq article gnus-newsgroup-unreads
)
8984 (push 'read to-marks
)
8986 info
(gnus-add-to-range (gnus-info-read info
)
8987 (list (cdr art-group
)))))
8989 ;; See whether the article is to be put in the cache.
8990 (let ((marks (if (gnus-group-auto-expirable-p to-group
)
8991 gnus-article-mark-lists
8992 (delete '(expirable . expire
)
8993 (copy-sequence gnus-article-mark-lists
))))
8994 (to-article (cdr art-group
)))
8996 ;; Enter the article into the cache in the new group,
8997 ;; if that is required.
8998 (when gnus-use-cache
8999 (gnus-cache-possibly-enter-article
9001 (memq article gnus-newsgroup-marked
)
9002 (memq article gnus-newsgroup-dormant
)
9003 (memq article gnus-newsgroup-unreads
)))
9005 (when gnus-preserve-marks
9006 ;; Copy any marks over to the new group.
9007 (when (and (equal to-group gnus-newsgroup-name
)
9008 (not (memq article gnus-newsgroup-unreads
)))
9009 ;; Mark this article as read in this group.
9010 (push (cons to-article gnus-read-mark
) gnus-newsgroup-reads
)
9011 (setcdr (gnus-active to-group
) to-article
)
9012 (setcdr gnus-newsgroup-active to-article
))
9015 (when (eq (gnus-article-mark-to-type (cdar marks
)) 'list
)
9016 (when (memq article
(symbol-value
9017 (intern (format "gnus-newsgroup-%s"
9019 (push (cdar marks
) to-marks
)
9020 ;; If the other group is the same as this group,
9021 ;; then we have to add the mark to the list.
9022 (when (equal to-group gnus-newsgroup-name
)
9023 (set (intern (format "gnus-newsgroup-%s" (caar marks
)))
9026 (intern (format "gnus-newsgroup-%s"
9028 ;; Copy the marks to other group.
9029 (gnus-add-marked-articles
9030 to-group
(cdar marks
) (list to-article
) info
)))
9031 (setq marks
(cdr marks
)))
9033 (gnus-request-set-mark
9034 to-group
(list (list (list to-article
) 'add to-marks
))))
9037 (concat "(gnus-group-set-info '"
9038 (gnus-prin1-to-string (gnus-get-info to-group
))
9041 ;; Update the Xref header in this article to point to
9042 ;; the new crossposted article we have just created.
9043 (when (eq action
'crosspost
)
9045 (set-buffer copy-buf
)
9046 (gnus-request-article-this-buffer article gnus-newsgroup-name
)
9047 (nnheader-replace-header "Xref" new-xref
)
9048 (gnus-request-replace-article
9049 article gnus-newsgroup-name
(current-buffer))))
9051 ;; run the move/copy/crosspost/respool hook
9052 (run-hook-with-args 'gnus-summary-article-move-hook
9055 (assoc article
(gnus-data-list nil
)))
9060 ;;;!!!Why is this necessary?
9061 (set-buffer gnus-summary-buffer
)
9063 (gnus-summary-goto-subject article
)
9064 (when (eq action
'move
)
9065 (gnus-summary-mark-article article gnus-canceled-mark
))))
9066 (gnus-summary-remove-process-mark article
))
9067 ;; Re-activate all groups that have been moved to.
9069 (set-buffer gnus-group-buffer
)
9070 (let ((gnus-group-marked to-groups
))
9071 (gnus-group-get-new-news-this-group nil t
)))
9073 (gnus-kill-buffer copy-buf
)
9074 (gnus-summary-position-point)
9075 (gnus-set-mode-line 'summary
)))
9077 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method
)
9078 "Copy the current article to some other group.
9079 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9080 When called interactively, if TO-NEWSGROUP is nil, use the value of
9081 the variable `gnus-move-split-methods' for finding a default target
9083 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9084 re-spool using this method."
9086 (gnus-summary-move-article n to-newsgroup select-method
'copy
))
9088 (defun gnus-summary-crosspost-article (&optional n
)
9089 "Crosspost the current article to some other group."
9091 (gnus-summary-move-article n nil nil
'crosspost
))
9093 (defcustom gnus-summary-respool-default-method nil
9094 "Default method type for respooling an article.
9095 If nil, use to the current newsgroup method."
9097 :group
'gnus-summary-mail
)
9099 (defcustom gnus-summary-display-while-building nil
9100 "If non-nil, show and update the summary buffer as it's being built.
9101 If the value is t, update the buffer after every line is inserted. If
9102 the value is an integer (N), update the display every N lines."
9104 :type
'(choice (const :tag
"off" nil
)
9106 (const :tag
"frequently" t
)))
9108 (defun gnus-summary-respool-article (&optional n method
)
9109 "Respool the current article.
9110 The article will be squeezed through the mail spooling process again,
9111 which means that it will be put in some mail newsgroup or other
9112 depending on `nnmail-split-methods'.
9113 If N is a positive number, respool the N next articles.
9114 If N is a negative number, respool the N previous articles.
9115 If N is nil and any articles have been marked with the process mark,
9116 respool those articles instead.
9118 Respooling can be done both from mail groups and \"real\" newsgroups.
9119 In the former case, the articles in question will be moved from the
9120 current group into whatever groups they are destined to. In the
9121 latter case, they will be copied into the relevant groups."
9123 (list current-prefix-arg
9124 (let* ((methods (gnus-methods-using 'respool
))
9126 (symbol-name (or gnus-summary-respool-default-method
9127 (car (gnus-find-method-for-group
9128 gnus-newsgroup-name
)))))
9130 (gnus-completing-read-with-default
9131 methname
"What backend do you want to use when respooling?"
9132 methods nil t nil
'gnus-mail-method-history
))
9135 ((zerop (length (setq ms
(gnus-servers-using-backend
9137 (list (intern method
) ""))
9141 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m
) m
)) ms
)))
9142 (cdr (assoc (completing-read "Server name: " ms-alist nil t
)
9145 (error "No method given for respooling"))
9146 (if (assoc (symbol-name
9147 (car (gnus-find-method-for-group gnus-newsgroup-name
)))
9148 (gnus-methods-using 'respool
))
9149 (gnus-summary-move-article n nil method
)
9150 (gnus-summary-copy-article n nil method
)))
9152 (defun gnus-summary-import-article (file &optional edit
)
9153 "Import an arbitrary file into a mail newsgroup."
9154 (interactive "fImport file: \nP")
9155 (let ((group gnus-newsgroup-name
)
9156 (now (current-time))
9157 atts lines group-art
)
9158 (unless (gnus-check-backend-function 'request-accept-article group
)
9159 (error "%s does not support article importing" group
))
9160 (or (file-readable-p file
)
9161 (not (file-regular-p file
))
9162 (error "Can't read %s" file
))
9164 (set-buffer (gnus-get-buffer-create " *import file*"))
9166 (nnheader-insert-file-contents file
)
9167 (goto-char (point-min))
9168 (if (nnheader-article-p)
9170 (goto-char (point-min))
9171 (search-forward "\n\n" nil t
)
9172 (narrow-to-region (point-min) (1- (point)))
9173 (goto-char (point-min))
9174 (unless (re-search-forward "^date:" nil t
)
9175 (goto-char (point-max))
9176 (insert "Date: " (message-make-date (nth 5 atts
)) "\n")))
9177 ;; This doesn't look like an article, so we fudge some headers.
9178 (setq atts
(file-attributes file
)
9179 lines
(count-lines (point-min) (point-max)))
9180 (insert "From: " (read-string "From: ") "\n"
9181 "Subject: " (read-string "Subject: ") "\n"
9182 "Date: " (message-make-date (nth 5 atts
)) "\n"
9183 "Message-ID: " (message-make-message-id) "\n"
9184 "Lines: " (int-to-string lines
) "\n"
9185 "Chars: " (int-to-string (nth 7 atts
)) "\n\n"))
9186 (setq group-art
(gnus-request-accept-article group nil t
))
9187 (kill-buffer (current-buffer)))
9188 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9190 (gnus-summary-goto-article (cdr group-art
) nil t
)
9192 (gnus-summary-edit-article))))
9194 (defun gnus-summary-create-article ()
9195 "Create an article in a mail newsgroup."
9197 (let ((group gnus-newsgroup-name
)
9198 (now (current-time))
9200 (unless (gnus-check-backend-function 'request-accept-article group
)
9201 (error "%s does not support article importing" group
))
9203 (set-buffer (gnus-get-buffer-create " *import file*"))
9205 (goto-char (point-min))
9206 ;; This doesn't look like an article, so we fudge some headers.
9207 (insert "From: " (read-string "From: ") "\n"
9208 "Subject: " (read-string "Subject: ") "\n"
9209 "Date: " (message-make-date now
) "\n"
9210 "Message-ID: " (message-make-message-id) "\n")
9211 (setq group-art
(gnus-request-accept-article group nil t
))
9212 (kill-buffer (current-buffer)))
9213 (setq gnus-newsgroup-active
(gnus-activate-group group
))
9215 (gnus-summary-goto-article (cdr group-art
) nil t
)
9216 (gnus-summary-edit-article)))
9218 (defun gnus-summary-article-posted-p ()
9219 "Say whether the current (mail) article is available from news as well.
9220 This will be the case if the article has both been mailed and posted."
9222 (let ((id (mail-header-references (gnus-summary-article-header)))
9223 (gnus-override-method (car (gnus-refer-article-methods))))
9224 (if (gnus-request-head id
"")
9225 (gnus-message 2 "The current message was found on %s"
9226 gnus-override-method
)
9227 (gnus-message 2 "The current message couldn't be found on %s"
9228 gnus-override-method
)
9231 (defun gnus-summary-expire-articles (&optional now
)
9232 "Expire all articles that are marked as expirable in the current group."
9234 (when (and (not gnus-group-is-exiting-without-update-p
)
9235 (gnus-check-backend-function
9236 'request-expire-articles gnus-newsgroup-name
))
9237 ;; This backend supports expiry.
9238 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name
))
9239 (expirable (if total
9241 ;; We need to update the info for
9242 ;; this group for `gnus-list-of-read-articles'
9243 ;; to give us the right answer.
9244 (gnus-run-hooks 'gnus-exit-group-hook
)
9245 (gnus-summary-update-info)
9246 (gnus-list-of-read-articles gnus-newsgroup-name
))
9247 (setq gnus-newsgroup-expirable
9248 (sort gnus-newsgroup-expirable
'<))))
9249 (expiry-wait (if now
'immediate
9250 (gnus-group-find-parameter
9251 gnus-newsgroup-name
'expiry-wait
)))
9252 (nnmail-expiry-target
9253 (or (gnus-group-find-parameter gnus-newsgroup-name
'expiry-target
)
9254 nnmail-expiry-target
))
9257 ;; There are expirable articles in this group, so we run them
9258 ;; through the expiry process.
9259 (gnus-message 6 "Expiring articles...")
9260 (unless (gnus-check-group gnus-newsgroup-name
)
9261 (error "Can't open server for %s" gnus-newsgroup-name
))
9262 ;; The list of articles that weren't expired is returned.
9265 (let ((nnmail-expiry-wait-function nil
)
9266 (nnmail-expiry-wait expiry-wait
))
9267 (setq es
(gnus-request-expire-articles
9268 expirable gnus-newsgroup-name
)))
9269 (setq es
(gnus-request-expire-articles
9270 expirable gnus-newsgroup-name
)))
9272 (setq gnus-newsgroup-expirable es
))
9273 ;; We go through the old list of expirable, and mark all
9274 ;; really expired articles as nonexistent.
9275 (unless (eq es expirable
) ;If nothing was expired, we don't mark.
9276 (let ((gnus-use-cache nil
))
9277 (dolist (article expirable
)
9278 (when (and (not (memq article es
))
9279 (gnus-data-find article
))
9280 (gnus-summary-mark-article article gnus-canceled-mark
)
9281 (run-hook-with-args 'gnus-summary-article-expire-hook
9284 (assoc article
(gnus-data-list nil
)))
9288 (gnus-message 6 "Expiring articles...done")))))
9290 (defun gnus-summary-expire-articles-now ()
9291 "Expunge all expirable articles in the current group.
9292 This means that *all* articles that are marked as expirable will be
9293 deleted forever, right now."
9295 (or gnus-expert-user
9297 "Are you really, really, really sure you want to delete all these messages? ")
9299 (gnus-summary-expire-articles t
))
9301 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9302 (defun gnus-summary-delete-article (&optional n
)
9303 "Delete the N next (mail) articles.
9304 This command actually deletes articles. This is not a marking
9305 command. The article will disappear forever from your life, never to
9308 If N is negative, delete backwards.
9309 If N is nil and articles have been marked with the process mark,
9310 delete these instead.
9312 If `gnus-novice-user' is non-nil you will be asked for
9313 confirmation before the articles are deleted."
9315 (unless (gnus-check-backend-function 'request-expire-articles
9316 gnus-newsgroup-name
)
9317 (error "The current newsgroup does not support article deletion"))
9318 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name
))
9319 (error "Couldn't open server"))
9320 ;; Compute the list of articles to delete.
9321 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n
)) '<))
9322 (nnmail-expiry-target 'delete
)
9324 (if (and gnus-novice-user
9325 (not (gnus-yes-or-no-p
9326 (format "Do you really want to delete %s forever? "
9327 (if (> (length articles
) 1)
9328 (format "these %s articles" (length articles
))
9331 ;; Delete the articles.
9332 (setq not-deleted
(gnus-request-expire-articles
9333 articles gnus-newsgroup-name
'force
))
9335 (gnus-summary-remove-process-mark (car articles
))
9336 ;; The backend might not have been able to delete the article
9338 (unless (memq (car articles
) not-deleted
)
9339 (gnus-summary-mark-article (car articles
) gnus-canceled-mark
))
9340 (let* ((article (car articles
))
9341 (id (mail-header-id (gnus-data-header
9342 (assoc article
(gnus-data-list nil
))))))
9343 (run-hook-with-args 'gnus-summary-article-delete-hook
9344 'delete id gnus-newsgroup-name nil
9346 (setq articles
(cdr articles
)))
9348 (gnus-message 4 "Couldn't delete articles %s" not-deleted
)))
9349 (gnus-summary-position-point)
9350 (gnus-set-mode-line 'summary
)
9353 (defun gnus-summary-edit-article (&optional arg
)
9354 "Edit the current article.
9355 This will have permanent effect only in mail groups.
9356 If ARG is nil, edit the decoded articles.
9357 If ARG is 1, edit the raw articles.
9358 If ARG is 2, edit the raw articles even in read-only groups.
9359 If ARG is 3, edit the articles with the current handles.
9360 Otherwise, allow editing of articles even in read-only
9363 (let (force raw current-handles
)
9372 (setq current-handles
9373 (and (gnus-buffer-live-p gnus-article-buffer
)
9374 (with-current-buffer gnus-article-buffer
9376 gnus-article-mime-handles
9377 (setq gnus-article-mime-handles nil
))))))
9380 (when (and raw
(not force
)
9381 (member gnus-newsgroup-name
'("nndraft:delayed"
9384 (error "Can't edit the raw article in group %s"
9385 gnus-newsgroup-name
))
9387 (set-buffer gnus-summary-buffer
)
9388 (let ((mail-parse-charset gnus-newsgroup-charset
)
9389 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets
))
9390 (gnus-set-global-variables)
9391 (when (and (not force
)
9392 (gnus-group-read-only-p))
9393 (error "The current newsgroup does not support article editing"))
9394 (gnus-summary-show-article t
)
9395 (when (and (not raw
) (gnus-buffer-live-p gnus-article-buffer
))
9396 (with-current-buffer gnus-article-buffer
9397 (mm-enable-multibyte)))
9398 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
9400 (gnus-article-edit-article
9403 (let ((mbl mml-buffer-list
))
9404 (setq mml-buffer-list nil
)
9405 (mime-to-mml ,'current-handles
)
9406 (let ((mbl1 mml-buffer-list
))
9407 (setq mml-buffer-list mbl
)
9408 (set (make-local-variable 'mml-buffer-list
) mbl1
))
9409 (gnus-make-local-hook 'kill-buffer-hook
)
9410 (add-hook 'kill-buffer-hook
'mml-destroy-buffers t t
))))
9411 `(lambda (no-highlight)
9412 (let ((mail-parse-charset ',gnus-newsgroup-charset
)
9413 (message-options message-options
)
9414 (message-options-set-recipient)
9415 (mail-parse-ignored-charsets
9416 ',gnus-newsgroup-ignored-charsets
))
9417 ,(if (not raw
) '(progn
9419 (mml-destroy-buffers)
9420 (remove-hook 'kill-buffer-hook
9421 'mml-destroy-buffers t
)
9422 (kill-local-variable 'mml-buffer-list
)))
9423 (gnus-summary-edit-article-done
9424 ,(or (mail-header-references gnus-current-headers
) "")
9425 ,(gnus-group-read-only-p)
9426 ,gnus-summary-buffer no-highlight
))))))))
9428 (defalias 'gnus-summary-edit-article-postpone
'gnus-article-edit-exit
)
9430 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9432 "Make edits to the current article permanent."
9435 ;; The buffer restriction contains the entire article if it exists.
9436 (when (article-goto-body)
9437 (let ((lines (count-lines (point) (point-max)))
9438 (length (- (point-max) (point)))
9439 (case-fold-search t
)
9440 (body (copy-marker (point))))
9441 (goto-char (point-min))
9442 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t
)
9443 (delete-region (match-beginning 1) (match-end 1))
9444 (insert (number-to-string length
)))
9445 (goto-char (point-min))
9446 (when (re-search-forward
9447 "^x-content-length:[ \t]\\([0-9]+\\)" body t
)
9448 (delete-region (match-beginning 1) (match-end 1))
9449 (insert (number-to-string length
)))
9450 (goto-char (point-min))
9451 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t
)
9452 (delete-region (match-beginning 1) (match-end 1))
9453 (insert (number-to-string lines
))))))
9454 ;; Replace the article.
9455 (let ((buf (current-buffer)))
9457 (insert-buffer-substring buf
)
9459 (if (and (not read-only
)
9460 (not (gnus-request-replace-article
9461 (cdr gnus-article-current
) (car gnus-article-current
)
9462 (current-buffer) t
)))
9463 (error "Couldn't replace article")
9464 ;; Update the summary buffer.
9466 (equal (message-tokenize-header references
" ")
9467 (message-tokenize-header
9468 (or (message-fetch-field "references") "") " ")))
9469 ;; We only have to update this line.
9472 (message-narrow-to-head)
9473 (let ((head (buffer-string))
9476 (insert (format "211 %d Article retrieved.\n"
9477 (cdr gnus-article-current
)))
9480 (let ((nntp-server-buffer (current-buffer)))
9481 (setq header
(car (gnus-get-newsgroup-headers
9484 (set-buffer gnus-summary-buffer
)
9485 (gnus-data-set-header
9486 (gnus-data-find (cdr gnus-article-current
))
9488 (gnus-summary-update-article-line
9489 (cdr gnus-article-current
) header
)
9490 (if (gnus-summary-goto-subject
9491 (cdr gnus-article-current
) nil t
)
9492 (gnus-summary-update-secondary-mark
9493 (cdr gnus-article-current
))))))))
9495 (set-buffer (or buffer gnus-summary-buffer
))
9496 (gnus-summary-update-article (cdr gnus-article-current
))
9497 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
9498 (gnus-summary-update-secondary-mark
9499 (cdr gnus-article-current
))))
9500 ;; Prettify the article buffer again.
9501 (unless no-highlight
9503 (set-buffer gnus-article-buffer
)
9504 ;;;!!! Fix this -- article should be rehighlighted.
9505 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9506 (set-buffer gnus-original-article-buffer
)
9507 (gnus-request-article
9508 (cdr gnus-article-current
)
9509 (car gnus-article-current
) (current-buffer))))
9510 ;; Prettify the summary buffer line.
9511 (when (gnus-visual-p 'summary-highlight
'highlight
)
9512 (gnus-run-hooks 'gnus-visual-mark-article-hook
))))))
9514 (defun gnus-summary-edit-wash (key)
9515 "Perform editing command KEY in the article buffer."
9519 (message "%s" (concat (this-command-keys) "- "))
9522 (gnus-summary-edit-article)
9523 (execute-kbd-macro (concat (this-command-keys) key
))
9524 (gnus-article-edit-done))
9528 (defun gnus-summary-respool-query (&optional silent trace
)
9529 "Query where the respool algorithm would put this article."
9531 (let (gnus-mark-article-hook)
9532 (gnus-summary-select-article)
9534 (set-buffer gnus-original-article-buffer
)
9535 (let ((groups (nnmail-article-group 'identity trace
)))
9538 (message "This message would go to %s"
9539 (mapconcat 'car groups
", "))
9540 (message "This message would go to no groups"))
9543 (defun gnus-summary-respool-trace ()
9544 "Trace where the respool algorithm would put this article.
9545 Display a buffer showing all fancy splitting patterns which matched."
9547 (gnus-summary-respool-query nil t
))
9549 ;; Summary marking commands.
9551 (defun gnus-summary-kill-same-subject-and-select (&optional unmark
)
9552 "Mark articles which has the same subject as read, and then select the next.
9553 If UNMARK is positive, remove any kind of mark.
9554 If UNMARK is negative, tick articles."
9557 (setq unmark
(prefix-numeric-value unmark
)))
9559 (gnus-summary-mark-same-subject
9560 (gnus-summary-article-subject) unmark
)))
9561 ;; Select next unread article. If auto-select-same mode, should
9562 ;; select the first unread article.
9563 (gnus-summary-next-article t
(and gnus-auto-select-same
9564 (gnus-summary-article-subject)))
9565 (gnus-message 7 "%d article%s marked as %s"
9566 count
(if (= count
1) " is" "s are")
9567 (if unmark
"unread" "read"))))
9569 (defun gnus-summary-kill-same-subject (&optional unmark
)
9570 "Mark articles which has the same subject as read.
9571 If UNMARK is positive, remove any kind of mark.
9572 If UNMARK is negative, tick articles."
9575 (setq unmark
(prefix-numeric-value unmark
)))
9577 (gnus-summary-mark-same-subject
9578 (gnus-summary-article-subject) unmark
)))
9579 ;; If marked as read, go to next unread subject.
9581 ;; Go to next unread subject.
9582 (gnus-summary-next-subject 1 t
))
9583 (gnus-message 7 "%d articles are marked as %s"
9584 count
(if unmark
"unread" "read"))))
9586 (defun gnus-summary-mark-same-subject (subject &optional unmark
)
9587 "Mark articles with same SUBJECT as read, and return marked number.
9588 If optional argument UNMARK is positive, remove any kinds of marks.
9589 If optional argument UNMARK is negative, mark articles as unread instead."
9593 ((null unmark
) ; Mark as read.
9596 (gnus-summary-mark-article-as-read gnus-killed-mark
)
9597 (gnus-summary-show-thread) t
)
9598 (gnus-summary-find-subject subject
))
9599 (setq count
(1+ count
))))
9600 ((> unmark
0) ; Tick.
9603 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)
9604 (gnus-summary-show-thread) t
)
9605 (gnus-summary-find-subject subject
))
9606 (setq count
(1+ count
))))
9607 (t ; Mark as unread.
9610 (gnus-summary-mark-article-as-unread gnus-unread-mark
)
9611 (gnus-summary-show-thread) t
)
9612 (gnus-summary-find-subject subject
))
9613 (setq count
(1+ count
)))))
9614 (gnus-set-mode-line 'summary
)
9615 ;; Return the number of marked articles.
9618 (defun gnus-summary-mark-as-processable (n &optional unmark
)
9619 "Set the process mark on the next N articles.
9620 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9621 the process mark instead. The difference between N and the actual
9622 number of articles marked is returned."
9624 (if (and (null n
) (gnus-region-active-p))
9625 (gnus-uu-mark-region (region-beginning) (region-end) unmark
)
9626 (setq n
(prefix-numeric-value n
))
9627 (let ((backward (< n
0))
9632 (gnus-summary-remove-process-mark
9633 (gnus-summary-article-number))
9634 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9635 (zerop (gnus-summary-next-subject (if backward -
1 1) nil t
)))
9638 (gnus-message 7 "No more articles"))
9639 (gnus-summary-recenter)
9640 (gnus-summary-position-point)
9643 (defun gnus-summary-unmark-as-processable (n)
9644 "Remove the process mark from the next N articles.
9645 If N is negative, unmark backward instead. The difference between N and
9646 the actual number of articles unmarked is returned."
9648 (gnus-summary-mark-as-processable n t
))
9650 (defun gnus-summary-unmark-all-processable ()
9651 "Remove the process mark from all articles."
9654 (while gnus-newsgroup-processable
9655 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable
))))
9656 (gnus-summary-position-point))
9658 (defun gnus-summary-add-mark (article type
)
9659 "Mark ARTICLE with a mark of TYPE."
9660 (let ((vtype (car (assq type gnus-article-mark-lists
)))
9663 (error "No such mark type: %s" type
)
9664 (setq var
(intern (format "gnus-newsgroup-%s" type
)))
9665 (set var
(cons article
(symbol-value var
)))
9666 (if (memq type
'(processable cached replied forwarded recent saved
))
9667 (gnus-summary-update-secondary-mark article
)
9668 ;;; !!! This is bogus. We should find out what primary
9669 ;;; !!! mark we want to set.
9670 (gnus-summary-update-mark gnus-del-mark
'unread
)))))
9672 (defun gnus-summary-mark-as-expirable (n)
9673 "Mark N articles forward as expirable.
9674 If N is negative, mark backward instead. The difference between N and
9675 the actual number of articles marked is returned."
9677 (gnus-summary-mark-forward n gnus-expirable-mark
))
9679 (defun gnus-summary-mark-as-spam (n)
9680 "Mark N articles forward as spam.
9681 If N is negative, mark backward instead. The difference between N and
9682 the actual number of articles marked is returned."
9684 (gnus-summary-mark-forward n gnus-spam-mark
))
9686 (defun gnus-summary-mark-article-as-replied (article)
9687 "Mark ARTICLE as replied to and update the summary line.
9688 ARTICLE can also be a list of articles."
9689 (interactive (list (gnus-summary-article-number)))
9690 (let ((articles (if (listp article
) article
(list article
))))
9691 (dolist (article articles
)
9692 (unless (numberp article
)
9693 (error "%s is not a number" article
))
9694 (push article gnus-newsgroup-replied
)
9695 (let ((buffer-read-only nil
))
9696 (when (gnus-summary-goto-subject article nil t
)
9697 (gnus-summary-update-secondary-mark article
))))))
9699 (defun gnus-summary-mark-article-as-forwarded (article)
9700 "Mark ARTICLE as forwarded and update the summary line.
9701 ARTICLE can also be a list of articles."
9702 (let ((articles (if (listp article
) article
(list article
))))
9703 (dolist (article articles
)
9704 (push article gnus-newsgroup-forwarded
)
9705 (let ((buffer-read-only nil
))
9706 (when (gnus-summary-goto-subject article nil t
)
9707 (gnus-summary-update-secondary-mark article
))))))
9709 (defun gnus-summary-set-bookmark (article)
9710 "Set a bookmark in current article."
9711 (interactive (list (gnus-summary-article-number)))
9712 (when (or (not (get-buffer gnus-article-buffer
))
9713 (not gnus-current-article
)
9714 (not gnus-article-current
)
9715 (not (equal gnus-newsgroup-name
(car gnus-article-current
))))
9716 (error "No current article selected"))
9717 ;; Remove old bookmark, if one exists.
9718 (gnus-pull article gnus-newsgroup-bookmarks
)
9719 ;; Set the new bookmark, which is on the form
9720 ;; (article-number . line-number-in-body).
9724 (set-buffer gnus-article-buffer
)
9731 gnus-newsgroup-bookmarks
)
9732 (gnus-message 6 "A bookmark has been added to the current article."))
9734 (defun gnus-summary-remove-bookmark (article)
9735 "Remove the bookmark from the current article."
9736 (interactive (list (gnus-summary-article-number)))
9737 ;; Remove old bookmark, if one exists.
9738 (if (not (assq article gnus-newsgroup-bookmarks
))
9739 (gnus-message 6 "No bookmark in current article.")
9740 (gnus-pull article gnus-newsgroup-bookmarks
)
9741 (gnus-message 6 "Removed bookmark.")))
9743 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9744 (defun gnus-summary-mark-as-dormant (n)
9745 "Mark N articles forward as dormant.
9746 If N is negative, mark backward instead. The difference between N and
9747 the actual number of articles marked is returned."
9749 (gnus-summary-mark-forward n gnus-dormant-mark
))
9751 (defun gnus-summary-set-process-mark (article)
9752 "Set the process mark on ARTICLE and update the summary line."
9753 (setq gnus-newsgroup-processable
9755 (delq article gnus-newsgroup-processable
)))
9756 (when (gnus-summary-goto-subject article
)
9757 (gnus-summary-show-thread)
9758 (gnus-summary-goto-subject article
)
9759 (gnus-summary-update-secondary-mark article
)))
9761 (defun gnus-summary-remove-process-mark (article)
9762 "Remove the process mark from ARTICLE and update the summary line."
9763 (setq gnus-newsgroup-processable
(delq article gnus-newsgroup-processable
))
9764 (when (gnus-summary-goto-subject article
)
9765 (gnus-summary-show-thread)
9766 (gnus-summary-goto-subject article
)
9767 (gnus-summary-update-secondary-mark article
)))
9769 (defun gnus-summary-set-saved-mark (article)
9770 "Set the process mark on ARTICLE and update the summary line."
9771 (push article gnus-newsgroup-saved
)
9772 (when (gnus-summary-goto-subject article
)
9773 (gnus-summary-update-secondary-mark article
)))
9775 (defun gnus-summary-mark-forward (n &optional mark no-expire
)
9776 "Mark N articles as read forwards.
9777 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9778 The difference between N and the actual number of articles marked is
9780 If NO-EXPIRE, auto-expiry will be inhibited."
9782 (gnus-summary-show-thread)
9783 (let ((backward (< n
0))
9784 (gnus-summary-goto-unread
9785 (and gnus-summary-goto-unread
9786 (not (eq gnus-summary-goto-unread
'never
))
9787 (not (memq mark
(list gnus-unread-mark gnus-spam-mark
9788 gnus-ticked-mark gnus-dormant-mark
)))))
9790 (mark (or mark gnus-del-mark
)))
9792 (gnus-summary-mark-article nil mark no-expire
)
9793 (zerop (gnus-summary-next-subject
9795 (and gnus-summary-goto-unread
9796 (not (eq gnus-summary-goto-unread
'never
)))
9800 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
9801 (gnus-summary-recenter)
9802 (gnus-summary-position-point)
9803 (gnus-set-mode-line 'summary
)
9806 (defun gnus-summary-mark-article-as-read (mark)
9807 "Mark the current article quickly as read with MARK."
9808 (let ((article (gnus-summary-article-number)))
9809 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
9810 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9811 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
9812 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9813 (push (cons article mark
) gnus-newsgroup-reads
)
9814 ;; Possibly remove from cache, if that is used.
9815 (when gnus-use-cache
9816 (gnus-cache-enter-remove-article article
))
9817 ;; Allow the backend to change the mark.
9818 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
9819 ;; Check for auto-expiry.
9820 (when (and gnus-newsgroup-auto-expire
9821 (memq mark gnus-auto-expirable-marks
))
9822 (setq mark gnus-expirable-mark
)
9823 ;; Let the backend know about the mark change.
9824 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
9825 (push article gnus-newsgroup-expirable
))
9826 ;; Set the mark in the buffer.
9827 (gnus-summary-update-mark mark
'unread
)
9830 (defun gnus-summary-mark-article-as-unread (mark)
9831 "Mark the current article quickly as unread with MARK."
9832 (let* ((article (gnus-summary-article-number))
9833 (old-mark (gnus-summary-article-mark article
)))
9834 ;; Allow the backend to change the mark.
9835 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
9836 (if (eq mark old-mark
)
9840 (gnus-error 1 "Can't mark negative article numbers")
9842 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9843 (setq gnus-newsgroup-spam-marked
9844 (delq article gnus-newsgroup-spam-marked
))
9845 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9846 (setq gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
))
9847 (setq gnus-newsgroup-reads
(delq article gnus-newsgroup-reads
))
9848 (cond ((= mark gnus-ticked-mark
)
9849 (setq gnus-newsgroup-marked
9850 (gnus-add-to-sorted-list gnus-newsgroup-marked
9852 ((= mark gnus-spam-mark
)
9853 (setq gnus-newsgroup-spam-marked
9854 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9856 ((= mark gnus-dormant-mark
)
9857 (setq gnus-newsgroup-dormant
9858 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9861 (setq gnus-newsgroup-unreads
9862 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9864 (gnus-pull article gnus-newsgroup-reads
)
9866 ;; See whether the article is to be put in the cache.
9868 (vectorp (gnus-summary-article-header article
))
9870 (gnus-cache-possibly-enter-article
9871 gnus-newsgroup-name article
9872 (= mark gnus-ticked-mark
)
9873 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
9876 (gnus-summary-update-mark mark
'unread
)
9879 (defun gnus-summary-mark-article (&optional article mark no-expire
)
9880 "Mark ARTICLE with MARK. MARK can be any character.
9881 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9882 `??' (dormant) and `?E' (expirable).
9883 If MARK is nil, then the default character `?r' is used.
9884 If ARTICLE is nil, then the article on the current line will be
9886 If NO-EXPIRE, auto-expiry will be inhibited."
9887 ;; The mark might be a string.
9888 (when (stringp mark
)
9889 (setq mark
(aref mark
0)))
9890 ;; If no mark is given, then we check auto-expiring.
9892 (setq mark gnus-del-mark
))
9893 (when (and (not no-expire
)
9894 gnus-newsgroup-auto-expire
9895 (memq mark gnus-auto-expirable-marks
))
9896 (setq mark gnus-expirable-mark
))
9897 (let ((article (or article
(gnus-summary-article-number)))
9898 (old-mark (gnus-summary-article-mark article
)))
9899 ;; Allow the backend to change the mark.
9900 (setq mark
(gnus-request-update-mark gnus-newsgroup-name article mark
))
9901 (if (eq mark old-mark
)
9904 (error "No article on current line"))
9905 (if (not (if (or (= mark gnus-unread-mark
)
9906 (= mark gnus-ticked-mark
)
9907 (= mark gnus-spam-mark
)
9908 (= mark gnus-dormant-mark
))
9909 (gnus-mark-article-as-unread article mark
)
9910 (gnus-mark-article-as-read article mark
)))
9912 ;; See whether the article is to be put in the cache.
9914 (not (= mark gnus-canceled-mark
))
9915 (vectorp (gnus-summary-article-header article
))
9917 (gnus-cache-possibly-enter-article
9918 gnus-newsgroup-name article
9919 (= mark gnus-ticked-mark
)
9920 (= mark gnus-dormant-mark
) (= mark gnus-unread-mark
))))
9922 (when (gnus-summary-goto-subject article nil t
)
9923 (let ((buffer-read-only nil
))
9924 (gnus-summary-show-thread)
9926 (gnus-summary-update-mark mark
'unread
)
9929 (defun gnus-summary-update-secondary-mark (article)
9930 "Update the secondary (read, process, cache) mark."
9931 (gnus-summary-update-mark
9932 (cond ((memq article gnus-newsgroup-processable
)
9934 ((memq article gnus-newsgroup-cached
)
9936 ((memq article gnus-newsgroup-replied
)
9938 ((memq article gnus-newsgroup-forwarded
)
9939 gnus-forwarded-mark
)
9940 ((memq article gnus-newsgroup-saved
)
9942 ((memq article gnus-newsgroup-recent
)
9944 ((memq article gnus-newsgroup-unseen
)
9948 (when (gnus-visual-p 'summary-highlight
'highlight
)
9949 (gnus-run-hooks 'gnus-summary-update-hook
))
9952 (defun gnus-summary-update-download-mark (article)
9953 "Update the download mark."
9954 (gnus-summary-update-mark
9955 (cond ((memq article gnus-newsgroup-undownloaded
)
9956 gnus-undownloaded-mark
)
9957 (gnus-newsgroup-agentized
9958 gnus-downloaded-mark
)
9962 (gnus-summary-update-line t
)
9965 (defun gnus-summary-update-mark (mark type
)
9966 (let ((forward (cdr (assq type gnus-summary-mark-positions
)))
9967 (buffer-read-only nil
))
9968 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit
)
9970 (when (looking-at "\r")
9972 (when (<= (+ forward
(point)) (point-max))
9973 ;; Go to the right position on the line.
9974 (goto-char (+ forward
(point)))
9975 ;; Replace the old mark with the new mark.
9976 (subst-char-in-region (point) (1+ (point)) (char-after) mark
)
9977 ;; Optionally update the marks by some user rule.
9978 (when (eq type
'unread
)
9980 (gnus-data-find (gnus-summary-article-number)) mark
)
9981 (gnus-summary-update-line (eq mark gnus-unread-mark
)))))))
9983 (defun gnus-mark-article-as-read (article &optional mark
)
9984 "Enter ARTICLE in the pertinent lists and remove it from others."
9985 ;; Make the article expirable.
9986 (let ((mark (or mark gnus-del-mark
)))
9987 (setq gnus-newsgroup-expirable
9988 (if (= mark gnus-expirable-mark
)
9989 (gnus-add-to-sorted-list gnus-newsgroup-expirable article
)
9990 (delq article gnus-newsgroup-expirable
)))
9991 ;; Remove from unread and marked lists.
9992 (setq gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
9993 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
))
9994 (setq gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
))
9995 (setq gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
))
9996 (push (cons article mark
) gnus-newsgroup-reads
)
9997 ;; Possibly remove from cache, if that is used.
9998 (when gnus-use-cache
9999 (gnus-cache-enter-remove-article article
))
10002 (defun gnus-mark-article-as-unread (article &optional mark
)
10003 "Enter ARTICLE in the pertinent lists and remove it from others."
10004 (let ((mark (or mark gnus-ticked-mark
)))
10007 (gnus-error 1 "Can't mark negative article numbers")
10009 (setq gnus-newsgroup-marked
(delq article gnus-newsgroup-marked
)
10010 gnus-newsgroup-spam-marked
(delq article gnus-newsgroup-spam-marked
)
10011 gnus-newsgroup-dormant
(delq article gnus-newsgroup-dormant
)
10012 gnus-newsgroup-expirable
(delq article gnus-newsgroup-expirable
)
10013 gnus-newsgroup-unreads
(delq article gnus-newsgroup-unreads
))
10015 ;; Unsuppress duplicates?
10016 (when gnus-suppress-duplicates
10017 (gnus-dup-unsuppress-article article
))
10019 (cond ((= mark gnus-ticked-mark
)
10020 (setq gnus-newsgroup-marked
10021 (gnus-add-to-sorted-list gnus-newsgroup-marked article
)))
10022 ((= mark gnus-spam-mark
)
10023 (setq gnus-newsgroup-spam-marked
10024 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10026 ((= mark gnus-dormant-mark
)
10027 (setq gnus-newsgroup-dormant
10028 (gnus-add-to-sorted-list gnus-newsgroup-dormant article
)))
10030 (setq gnus-newsgroup-unreads
10031 (gnus-add-to-sorted-list gnus-newsgroup-unreads article
))))
10032 (gnus-pull article gnus-newsgroup-reads
)
10035 (defalias 'gnus-summary-mark-as-unread-forward
10036 'gnus-summary-tick-article-forward
)
10037 (make-obsolete 'gnus-summary-mark-as-unread-forward
10038 'gnus-summary-tick-article-forward
)
10039 (defun gnus-summary-tick-article-forward (n)
10040 "Tick N articles forwards.
10041 If N is negative, tick backwards instead.
10042 The difference between N and the number of articles ticked is returned."
10044 (gnus-summary-mark-forward n gnus-ticked-mark
))
10046 (defalias 'gnus-summary-mark-as-unread-backward
10047 'gnus-summary-tick-article-backward
)
10048 (make-obsolete 'gnus-summary-mark-as-unread-backward
10049 'gnus-summary-tick-article-backward
)
10050 (defun gnus-summary-tick-article-backward (n)
10051 "Tick N articles backwards.
10052 The difference between N and the number of articles ticked is returned."
10054 (gnus-summary-mark-forward (- n
) gnus-ticked-mark
))
10056 (defalias 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10057 (make-obsolete 'gnus-summary-mark-as-unread
'gnus-summary-tick-article
)
10058 (defun gnus-summary-tick-article (&optional article clear-mark
)
10059 "Mark current article as unread.
10060 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10061 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10063 (gnus-summary-mark-article article
(if clear-mark gnus-unread-mark
10064 gnus-ticked-mark
)))
10066 (defun gnus-summary-mark-as-read-forward (n)
10067 "Mark N articles as read forwards.
10068 If N is negative, mark backwards instead.
10069 The difference between N and the actual number of articles marked is
10072 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire
))
10074 (defun gnus-summary-mark-as-read-backward (n)
10075 "Mark the N articles as read backwards.
10076 The difference between N and the actual number of articles marked is
10079 (gnus-summary-mark-forward
10080 (- n
) gnus-del-mark gnus-inhibit-user-auto-expire
))
10082 (defun gnus-summary-mark-as-read (&optional article mark
)
10083 "Mark current article as read.
10084 ARTICLE specifies the article to be marked as read.
10085 MARK specifies a string to be inserted at the beginning of the line."
10086 (gnus-summary-mark-article article mark
))
10088 (defun gnus-summary-clear-mark-forward (n)
10089 "Clear marks from N articles forward.
10090 If N is negative, clear backward instead.
10091 The difference between N and the number of marks cleared is returned."
10093 (gnus-summary-mark-forward n gnus-unread-mark
))
10095 (defun gnus-summary-clear-mark-backward (n)
10096 "Clear marks from N articles backward.
10097 The difference between N and the number of marks cleared is returned."
10099 (gnus-summary-mark-forward (- n
) gnus-unread-mark
))
10101 (defun gnus-summary-mark-unread-as-read ()
10102 "Intended to be used by `gnus-summary-mark-article-hook'."
10103 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10104 (gnus-summary-mark-article gnus-current-article gnus-read-mark
)))
10106 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark
)
10107 "Intended to be used by `gnus-summary-mark-article-hook'."
10108 (let ((mark (gnus-summary-article-mark)))
10109 (when (or (gnus-unread-mark-p mark
)
10110 (gnus-read-mark-p mark
))
10111 (gnus-summary-mark-article gnus-current-article
10112 (or new-mark gnus-read-mark
)))))
10114 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark
)
10115 "Intended to be used by `gnus-summary-mark-article-hook'."
10116 (let ((mark (gnus-summary-article-mark)))
10117 (when (or (gnus-unread-mark-p mark
)
10118 (gnus-read-mark-p mark
))
10119 (gnus-summary-mark-article (gnus-summary-article-number)
10120 (or new-mark gnus-read-mark
)))))
10122 (defun gnus-summary-mark-unread-as-ticked ()
10123 "Intended to be used by `gnus-summary-mark-article-hook'."
10124 (when (memq gnus-current-article gnus-newsgroup-unreads
)
10125 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark
)))
10127 (defun gnus-summary-mark-region-as-read (point mark all
)
10128 "Mark all unread articles between point and mark as read.
10129 If given a prefix, mark all articles between point and mark as read,
10130 even ticked and dormant ones."
10131 (interactive "r\nP")
10135 (beginning-of-line)
10140 (memq (setq article
(gnus-summary-article-number))
10141 gnus-newsgroup-unreads
))
10142 (gnus-summary-mark-article article gnus-del-mark
))
10144 (gnus-summary-find-next))))))
10146 (defun gnus-summary-mark-below (score mark
)
10147 "Mark articles with score less than SCORE with MARK."
10148 (interactive "P\ncMark: ")
10149 (setq score
(if score
10150 (prefix-numeric-value score
)
10151 (or gnus-summary-default-score
0)))
10153 (set-buffer gnus-summary-buffer
)
10154 (goto-char (point-min))
10157 (and (< (gnus-summary-article-score) score
)
10158 (gnus-summary-mark-article nil mark
))
10159 (gnus-summary-find-next)))))
10161 (defun gnus-summary-kill-below (&optional score
)
10162 "Mark articles with score below SCORE as read."
10164 (gnus-summary-mark-below score gnus-killed-mark
))
10166 (defun gnus-summary-clear-above (&optional score
)
10167 "Clear all marks from articles with score above SCORE."
10169 (gnus-summary-mark-above score gnus-unread-mark
))
10171 (defun gnus-summary-tick-above (&optional score
)
10172 "Tick all articles with score above SCORE."
10174 (gnus-summary-mark-above score gnus-ticked-mark
))
10176 (defun gnus-summary-mark-above (score mark
)
10177 "Mark articles with score over SCORE with MARK."
10178 (interactive "P\ncMark: ")
10179 (setq score
(if score
10180 (prefix-numeric-value score
)
10181 (or gnus-summary-default-score
0)))
10183 (set-buffer gnus-summary-buffer
)
10184 (goto-char (point-min))
10186 (when (> (gnus-summary-article-score) score
)
10187 (gnus-summary-mark-article nil mark
))
10189 (gnus-summary-find-next)))))
10191 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10192 (defalias 'gnus-summary-show-all-expunged
'gnus-summary-limit-include-expunged
)
10193 (defun gnus-summary-limit-include-expunged (&optional no-error
)
10194 "Display all the hidden articles that were expunged for low scores."
10196 (let ((buffer-read-only nil
))
10197 (let ((scored gnus-newsgroup-scored
)
10200 (unless (gnus-summary-article-header (caar scored
))
10201 (and (setq h
(gnus-number-to-header (caar scored
)))
10202 (< (cdar scored
) gnus-summary-expunge-below
)
10204 (setq scored
(cdr scored
)))
10206 (when (not no-error
)
10207 (error "No expunged articles hidden"))
10208 (goto-char (point-min))
10209 (push gnus-newsgroup-limit gnus-newsgroup-limits
)
10210 (setq gnus-newsgroup-limit
(copy-sequence gnus-newsgroup-limit
))
10211 (mapcar (lambda (x) (push (mail-header-number x
)
10212 gnus-newsgroup-limit
))
10214 (gnus-summary-prepare-unthreaded (nreverse headers
))
10215 (goto-char (point-min))
10216 (gnus-summary-position-point)
10219 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse
)
10220 "Mark all unread articles in this newsgroup as read.
10221 If prefix argument ALL is non-nil, ticked and dormant articles will
10222 also be marked as read.
10223 If QUIETLY is non-nil, no questions will be asked.
10225 If TO-HERE is non-nil, it should be a point in the buffer. All
10226 articles before (after, if REVERSE is set) this point will be marked
10229 Note that this function will only catch up the unread article
10230 in the current summary buffer limitation.
10232 The number of articles marked as read is returned."
10237 (not gnus-interactive-catchup
) ;Without confirmation?
10241 "Mark absolutely all articles as read? "
10242 "Mark all unread articles as read? ")))
10244 (not gnus-newsgroup-adaptive
)
10245 (not gnus-newsgroup-auto-expire
)
10246 (not gnus-suppress-duplicates
)
10247 (or (not gnus-use-cache
)
10248 (eq gnus-use-cache
'passive
)))
10251 (setq gnus-newsgroup-marked nil
10252 gnus-newsgroup-spam-marked nil
10253 gnus-newsgroup-dormant nil
))
10254 (setq gnus-newsgroup-unreads
10255 (gnus-sorted-nunion
10256 (gnus-intersection gnus-newsgroup-unreads
10257 gnus-newsgroup-downloadable
)
10258 gnus-newsgroup-unfetched
)))
10259 ;; We actually mark all articles as canceled, which we
10260 ;; have to do when using auto-expiry or adaptive scoring.
10261 (gnus-summary-show-all-threads)
10262 (if (and to-here reverse
)
10264 (goto-char to-here
)
10265 (gnus-summary-mark-current-read-and-unread-as-read
10267 (while (gnus-summary-find-next (not all
))
10268 (gnus-summary-mark-article-as-read gnus-catchup-mark
)))
10269 (when (gnus-summary-first-subject (not all
))
10271 (if to-here
(< (point) to-here
) t
)
10272 (gnus-summary-mark-article-as-read gnus-catchup-mark
)
10273 (gnus-summary-find-next (not all
))))))
10274 (gnus-set-mode-line 'summary
))
10276 (gnus-summary-position-point)))
10278 (defun gnus-summary-catchup-to-here (&optional all
)
10279 "Mark all unticked articles before the current one as read.
10280 If ALL is non-nil, also mark ticked and dormant articles as read."
10283 (gnus-save-hidden-threads
10284 (let ((beg (point)))
10285 ;; We check that there are unread articles.
10286 (when (or all
(gnus-summary-find-prev))
10287 (gnus-summary-catchup all t beg
)))))
10288 (gnus-summary-position-point))
10290 (defun gnus-summary-catchup-from-here (&optional all
)
10291 "Mark all unticked articles after (and including) the current one as read.
10292 If ALL is non-nil, also mark ticked and dormant articles as read."
10295 (gnus-save-hidden-threads
10296 (let ((beg (point)))
10297 ;; We check that there are unread articles.
10298 (when (or all
(gnus-summary-find-next))
10299 (gnus-summary-catchup all t beg nil t
)))))
10300 (gnus-summary-position-point))
10302 (defun gnus-summary-catchup-all (&optional quietly
)
10303 "Mark all articles in this newsgroup as read.
10304 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10305 instead, which marks only unread articles as read."
10307 (gnus-summary-catchup t quietly
))
10309 (defun gnus-summary-catchup-and-exit (&optional all quietly
)
10310 "Mark all unread articles in this group as read, then exit.
10311 If prefix argument ALL is non-nil, all articles are marked as read.
10312 If QUIETLY is non-nil, no questions will be asked."
10314 (when (gnus-summary-catchup all quietly nil
'fast
)
10315 ;; Select next newsgroup or exit.
10316 (if (and (not (gnus-group-quit-config gnus-newsgroup-name
))
10317 (eq gnus-auto-select-next
'quietly
))
10318 (gnus-summary-next-group nil
)
10319 (gnus-summary-exit))))
10321 (defun gnus-summary-catchup-all-and-exit (&optional quietly
)
10322 "Mark all articles in this newsgroup as read, and then exit.
10323 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10324 instead, which marks only unread articles as read."
10326 (gnus-summary-catchup-and-exit t quietly
))
10328 (defun gnus-summary-catchup-and-goto-next-group (&optional all
)
10329 "Mark all articles in this group as read and select the next group.
10330 If given a prefix, mark all articles, unread as well as ticked, as
10334 (gnus-summary-catchup all
))
10335 (gnus-summary-next-group))
10341 (defmacro gnus-with-article
(article &rest forms
)
10342 "Select ARTICLE and perform FORMS in the original article buffer.
10343 Then replace the article with the result."
10345 ;; We don't want the article to be marked as read.
10346 (let (gnus-mark-article-hook)
10347 (gnus-summary-select-article t t nil
,article
))
10348 (set-buffer gnus-original-article-buffer
)
10350 (if (not (gnus-check-backend-function
10351 'request-replace-article
(car gnus-article-current
)))
10352 (gnus-message 5 "Read-only group; not replacing")
10353 (unless (gnus-request-replace-article
10354 ,article
(car gnus-article-current
)
10355 (current-buffer) t
)
10356 (error "Couldn't replace article")))
10357 ;; The cache and backlog have to be flushed somewhat.
10358 (when gnus-keep-backlog
10359 (gnus-backlog-remove-article
10360 (car gnus-article-current
) (cdr gnus-article-current
)))
10361 (when gnus-use-cache
10362 (gnus-cache-update-article
10363 (car gnus-article-current
) (cdr gnus-article-current
)))))
10365 (put 'gnus-with-article
'lisp-indent-function
1)
10366 (put 'gnus-with-article
'edebug-form-spec
'(form body
))
10368 ;; Thread-based commands.
10370 (defun gnus-summary-articles-in-thread (&optional article
)
10371 "Return a list of all articles in the current thread.
10372 If ARTICLE is non-nil, return all articles in the thread that starts
10373 with that article."
10374 (let* ((article (or article
(gnus-summary-article-number)))
10375 (data (gnus-data-find-list article
))
10376 (top-level (gnus-data-level (car data
)))
10378 (cond ((null gnus-thread-operation-ignore-subject
)
10379 (gnus-simplify-subject-re
10380 (mail-header-subject (gnus-data-header (car data
)))))
10381 ((eq gnus-thread-operation-ignore-subject
'fuzzy
)
10382 (gnus-simplify-subject-fuzzy
10383 (mail-header-subject (gnus-data-header (car data
)))))
10385 (end-point (save-excursion
10386 (if (gnus-summary-go-to-next-thread)
10387 (point) (point-max))))
10390 (< (gnus-data-pos (car data
)) end-point
))
10391 (when (or (not top-subject
)
10392 (string= top-subject
10393 (if (eq gnus-thread-operation-ignore-subject
'fuzzy
)
10394 (gnus-simplify-subject-fuzzy
10395 (mail-header-subject
10396 (gnus-data-header (car data
))))
10397 (gnus-simplify-subject-re
10398 (mail-header-subject
10399 (gnus-data-header (car data
)))))))
10400 (push (gnus-data-number (car data
)) articles
))
10401 (unless (and (setq data
(cdr data
))
10402 (> (gnus-data-level (car data
)) top-level
))
10404 ;; Return the list of articles.
10405 (nreverse articles
)))
10407 (defun gnus-summary-rethread-current ()
10408 "Rethread the thread the current article is part of."
10410 (let* ((gnus-show-threads t
)
10411 (article (gnus-summary-article-number))
10412 (id (mail-header-id (gnus-summary-article-header)))
10413 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id
)))))
10415 (error "No article on the current line"))
10416 (gnus-rebuild-thread id
)
10417 (gnus-summary-goto-subject article
)))
10419 (defun gnus-summary-reparent-thread ()
10420 "Make the current article child of the marked (or previous) article.
10422 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10423 is non-nil or the Subject: of both articles are the same."
10425 (unless (not (gnus-group-read-only-p))
10426 (error "The current newsgroup does not support article editing"))
10427 (unless (<= (length gnus-newsgroup-processable
) 1)
10428 (error "No more than one article may be marked"))
10429 (save-window-excursion
10430 (let ((gnus-article-buffer " *reparent*")
10431 (current-article (gnus-summary-article-number))
10432 ;; First grab the marked article, otherwise one line up.
10433 (parent-article (if (not (null gnus-newsgroup-processable
))
10434 (car gnus-newsgroup-processable
)
10436 (if (eq (forward-line -
1) 0)
10437 (gnus-summary-article-number)
10438 (error "Beginning of summary buffer"))))))
10439 (unless (not (eq current-article parent-article
))
10440 (error "An article may not be self-referential"))
10441 (let ((message-id (mail-header-id
10442 (gnus-summary-article-header parent-article
))))
10443 (unless (and message-id
(not (equal message-id
"")))
10444 (error "No message-id in desired parent"))
10445 (gnus-with-article current-article
10447 (goto-char (point-min))
10448 (message-narrow-to-head)
10449 (if (re-search-forward "^References: " nil t
)
10451 (re-search-forward "^[^ \t]" nil t
)
10454 (insert " " message-id
))
10455 (insert "References: " message-id
"\n"))))
10456 (set-buffer gnus-summary-buffer
)
10457 (gnus-summary-unmark-all-processable)
10458 (gnus-summary-update-article current-article
)
10459 (if (gnus-summary-goto-subject (cdr gnus-article-current
) nil t
)
10460 (gnus-summary-update-secondary-mark (cdr gnus-article-current
)))
10461 (gnus-summary-rethread-current)
10462 (gnus-message 3 "Article %d is now the child of article %d"
10463 current-article parent-article
)))))
10465 (defun gnus-summary-toggle-threads (&optional arg
)
10466 "Toggle showing conversation threads.
10467 If ARG is positive number, turn showing conversation threads on."
10469 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end
)))
10470 (setq gnus-show-threads
10471 (if (null arg
) (not gnus-show-threads
)
10472 (> (prefix-numeric-value arg
) 0)))
10473 (gnus-summary-prepare)
10474 (gnus-summary-goto-subject current
)
10475 (gnus-message 6 "Threading is now %s" (if gnus-show-threads
"on" "off"))
10476 (gnus-summary-position-point)))
10478 (defun gnus-summary-show-all-threads ()
10479 "Show all threads."
10482 (let ((buffer-read-only nil
))
10483 (subst-char-in-region (point-min) (point-max) ?\^M ?
\n t
)))
10484 (gnus-summary-position-point))
10486 (defun gnus-summary-show-thread ()
10487 "Show thread subtrees.
10488 Returns nil if no thread was there to be shown."
10490 (let ((buffer-read-only nil
)
10492 (end (gnus-point-at-eol))
10493 ;; Leave point at bol
10494 (beg (progn (beginning-of-line) (point))))
10496 ;; Any hidden lines here?
10497 (search-forward "\r" end t
)
10498 (subst-char-in-region beg end ?\^M ?
\n t
)
10500 (gnus-summary-position-point))))
10502 (defun gnus-summary-maybe-hide-threads ()
10503 "If requested, hide the threads that should be hidden."
10504 (when (and gnus-show-threads
10505 gnus-thread-hide-subtree
)
10506 (gnus-summary-hide-all-threads
10507 (if (or (consp gnus-thread-hide-subtree
)
10508 (functionp gnus-thread-hide-subtree
))
10509 (gnus-make-predicate gnus-thread-hide-subtree
)
10512 ;;; Hiding predicates.
10514 (defun gnus-article-unread-p (header)
10515 (memq (mail-header-number header
) gnus-newsgroup-unreads
))
10517 (defun gnus-article-unseen-p (header)
10518 (memq (mail-header-number header
) gnus-newsgroup-unseen
))
10520 (defun gnus-map-articles (predicate articles
)
10521 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10522 (apply 'gnus-or
(mapcar predicate
10523 (mapcar 'gnus-summary-article-header articles
))))
10525 (defun gnus-summary-hide-all-threads (&optional predicate
)
10526 "Hide all thread subtrees.
10527 If PREDICATE is supplied, threads that satisfy this predicate
10528 will not be hidden."
10531 (goto-char (point-min))
10534 (when (or (not predicate
)
10536 predicate
(gnus-summary-article-children)))
10537 (gnus-summary-hide-thread))
10538 (setq end
(not (zerop (gnus-summary-next-thread 1 t
)))))))
10539 (gnus-summary-position-point))
10541 (defun gnus-summary-hide-thread ()
10542 "Hide thread subtrees.
10543 If PREDICATE is supplied, threads that satisfy this predicate
10544 will not be hidden.
10545 Returns nil if no threads were there to be hidden."
10547 (let ((buffer-read-only nil
)
10549 (article (gnus-summary-article-number)))
10551 ;; Go forward until either the buffer ends or the subthread
10553 (when (and (not (eobp))
10554 (or (zerop (gnus-summary-next-thread 1 t
))
10555 (goto-char (point-max))))
10557 (if (and (> (point) start
)
10558 (search-backward "\n" start t
))
10560 (subst-char-in-region start
(point) ?
\n ?\^M
)
10561 (gnus-summary-goto-subject article
))
10565 (defun gnus-summary-go-to-next-thread (&optional previous
)
10566 "Go to the same level (or less) next thread.
10567 If PREVIOUS is non-nil, go to previous thread instead.
10568 Return the article number moved to, or nil if moving was impossible."
10569 (let ((level (gnus-summary-thread-level))
10570 (way (if previous -
1 1))
10573 (while (and (not (eobp))
10574 (< level
(gnus-summary-thread-level)))
10575 (forward-line way
))
10582 (gnus-summary-article-number)
10583 (goto-char beg
)))))
10585 (defun gnus-summary-next-thread (n &optional silent
)
10586 "Go to the same level next N'th thread.
10587 If N is negative, search backward instead.
10588 Returns the difference between N and the number of skips actually
10591 If SILENT, don't output messages."
10593 (let ((backward (< n
0))
10595 (while (and (> n
0)
10596 (gnus-summary-go-to-next-thread backward
))
10599 (gnus-summary-position-point))
10600 (when (and (not silent
) (/= 0 n
))
10601 (gnus-message 7 "No more threads"))
10604 (defun gnus-summary-prev-thread (n)
10605 "Go to the same level previous N'th thread.
10606 Returns the difference between N and the number of skips actually
10609 (gnus-summary-next-thread (- n
)))
10611 (defun gnus-summary-go-down-thread ()
10612 "Go down one level in the current thread."
10613 (let ((children (gnus-summary-article-children)))
10615 (gnus-summary-goto-subject (car children
)))))
10617 (defun gnus-summary-go-up-thread ()
10618 "Go up one level in the current thread."
10619 (let ((parent (gnus-summary-article-parent)))
10621 (gnus-summary-goto-subject parent
))))
10623 (defun gnus-summary-down-thread (n)
10624 "Go down thread N steps.
10625 If N is negative, go up instead.
10626 Returns the difference between N and how many steps down that were
10631 (while (and (> n
0)
10632 (if up
(gnus-summary-go-up-thread)
10633 (gnus-summary-go-down-thread)))
10635 (gnus-summary-position-point)
10637 (gnus-message 7 "Can't go further"))
10640 (defun gnus-summary-up-thread (n)
10641 "Go up thread N steps.
10642 If N is negative, go down instead.
10643 Returns the difference between N and how many steps down that were
10646 (gnus-summary-down-thread (- n
)))
10648 (defun gnus-summary-top-thread ()
10649 "Go to the top of the thread."
10651 (while (gnus-summary-go-up-thread))
10652 (gnus-summary-article-number))
10654 (defun gnus-summary-kill-thread (&optional unmark
)
10655 "Mark articles under current thread as read.
10656 If the prefix argument is positive, remove any kinds of marks.
10657 If the prefix argument is negative, tick articles instead."
10660 (setq unmark
(prefix-numeric-value unmark
)))
10661 (let ((articles (gnus-summary-articles-in-thread)))
10663 ;; Expand the thread.
10664 (gnus-summary-show-thread)
10665 ;; Mark all the articles.
10667 (gnus-summary-goto-subject (car articles
))
10668 (cond ((null unmark
)
10669 (gnus-summary-mark-article-as-read gnus-killed-mark
))
10671 (gnus-summary-mark-article-as-unread gnus-unread-mark
))
10673 (gnus-summary-mark-article-as-unread gnus-ticked-mark
)))
10674 (setq articles
(cdr articles
))))
10675 ;; Hide killed subtrees.
10677 gnus-thread-hide-killed
10678 (gnus-summary-hide-thread))
10679 ;; If marked as read, go to next unread subject.
10680 (when (null unmark
)
10681 ;; Go to next unread subject.
10682 (gnus-summary-next-subject 1 t
)))
10683 (gnus-set-mode-line 'summary
))
10685 ;; Summary sorting commands
10687 (defun gnus-summary-sort-by-number (&optional reverse
)
10688 "Sort the summary buffer by article number.
10689 Argument REVERSE means reverse order."
10691 (gnus-summary-sort 'number reverse
))
10693 (defun gnus-summary-sort-by-random (&optional reverse
)
10694 "Randomize the order in the summary buffer.
10695 Argument REVERSE means to randomize in reverse order."
10697 (gnus-summary-sort 'random reverse
))
10699 (defun gnus-summary-sort-by-author (&optional reverse
)
10700 "Sort the summary buffer by author name alphabetically.
10701 If `case-fold-search' is non-nil, case of letters is ignored.
10702 Argument REVERSE means reverse order."
10704 (gnus-summary-sort 'author reverse
))
10706 (defun gnus-summary-sort-by-subject (&optional reverse
)
10707 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10708 If `case-fold-search' is non-nil, case of letters is ignored.
10709 Argument REVERSE means reverse order."
10711 (gnus-summary-sort 'subject reverse
))
10713 (defun gnus-summary-sort-by-date (&optional reverse
)
10714 "Sort the summary buffer by date.
10715 Argument REVERSE means reverse order."
10717 (gnus-summary-sort 'date reverse
))
10719 (defun gnus-summary-sort-by-score (&optional reverse
)
10720 "Sort the summary buffer by score.
10721 Argument REVERSE means reverse order."
10723 (gnus-summary-sort 'score reverse
))
10725 (defun gnus-summary-sort-by-lines (&optional reverse
)
10726 "Sort the summary buffer by the number of lines.
10727 Argument REVERSE means reverse order."
10729 (gnus-summary-sort 'lines reverse
))
10731 (defun gnus-summary-sort-by-chars (&optional reverse
)
10732 "Sort the summary buffer by article length.
10733 Argument REVERSE means reverse order."
10735 (gnus-summary-sort 'chars reverse
))
10737 (defun gnus-summary-sort-by-original (&optional reverse
)
10738 "Sort the summary buffer using the default sorting method.
10739 Argument REVERSE means reverse order."
10741 (let* ((buffer-read-only)
10742 (gnus-summary-prepare-hook nil
))
10743 ;; We do the sorting by regenerating the threads.
10744 (gnus-summary-prepare)
10745 ;; Hide subthreads if needed.
10746 (gnus-summary-maybe-hide-threads)))
10748 (defun gnus-summary-sort (predicate reverse
)
10749 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10750 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate
)))
10751 (article (intern (format "gnus-article-sort-by-%s" predicate
)))
10752 (gnus-thread-sort-functions
10757 (gnus-sort-gathered-threads-function
10758 gnus-thread-sort-functions
)
10759 (gnus-article-sort-functions
10763 (,article t2 t1
))))
10765 (gnus-summary-prepare-hook nil
))
10766 ;; We do the sorting by regenerating the threads.
10767 (gnus-summary-prepare)
10768 ;; Hide subthreads if needed.
10769 (gnus-summary-maybe-hide-threads)))
10771 ;; Summary saving commands.
10773 (defun gnus-summary-save-article (&optional n not-saved
)
10774 "Save the current article using the default saver function.
10775 If N is a positive number, save the N next articles.
10776 If N is a negative number, save the N previous articles.
10777 If N is nil and any articles have been marked with the process mark,
10778 save those articles instead.
10779 The variable `gnus-default-article-saver' specifies the saver function."
10781 (let* ((articles (gnus-summary-work-articles n
))
10782 (save-buffer (save-excursion
10783 (nnheader-set-temp-buffer " *Gnus Save*")))
10784 (num (length articles
))
10786 (dolist (article articles
)
10787 (setq header
(gnus-summary-article-header article
))
10788 (if (not (vectorp header
))
10789 ;; This is a pseudo-article.
10790 (if (assq 'name header
)
10791 (gnus-copy-file (cdr (assq 'name header
)))
10792 (gnus-message 1 "Article %d is unsaveable" article
))
10793 ;; This is a real article.
10794 (save-window-excursion
10795 (let ((gnus-display-mime-function nil
)
10796 (gnus-article-prepare-hook nil
))
10797 (gnus-summary-select-article t nil nil article
)))
10799 (set-buffer save-buffer
)
10801 (insert-buffer-substring gnus-original-article-buffer
))
10802 (setq file
(gnus-article-save save-buffer file num
))
10803 (gnus-summary-remove-process-mark article
)
10805 (gnus-summary-set-saved-mark article
))))
10806 (gnus-kill-buffer save-buffer
)
10807 (gnus-summary-position-point)
10808 (gnus-set-mode-line 'summary
)
10811 (defun gnus-summary-pipe-output (&optional arg headers
)
10812 "Pipe the current article to a subprocess.
10813 If N is a positive number, pipe the N next articles.
10814 If N is a negative number, pipe the N previous articles.
10815 If N is nil and any articles have been marked with the process mark,
10816 pipe those articles instead.
10817 If HEADERS (the symbolic prefix), include the headers, too."
10818 (interactive (gnus-interactive "P\ny"))
10819 (require 'gnus-art
)
10820 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe
)
10821 (gnus-save-all-headers (or headers gnus-save-all-headers
)))
10822 (gnus-summary-save-article arg t
))
10823 (let ((buffer (get-buffer "*Shell Command Output*")))
10825 (not (zerop (buffer-size buffer
))))
10826 (gnus-configure-windows 'pipe
))))
10828 (defun gnus-summary-save-article-mail (&optional arg
)
10829 "Append the current article to an mail file.
10830 If N is a positive number, save the N next articles.
10831 If N is a negative number, save the N previous articles.
10832 If N is nil and any articles have been marked with the process mark,
10833 save those articles instead."
10835 (require 'gnus-art
)
10836 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail
))
10837 (gnus-summary-save-article arg
)))
10839 (defun gnus-summary-save-article-rmail (&optional arg
)
10840 "Append the current article to an rmail file.
10841 If N is a positive number, save the N next articles.
10842 If N is a negative number, save the N previous articles.
10843 If N is nil and any articles have been marked with the process mark,
10844 save those articles instead."
10846 (require 'gnus-art
)
10847 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail
))
10848 (gnus-summary-save-article arg
)))
10850 (defun gnus-summary-save-article-file (&optional arg
)
10851 "Append the current article to a file.
10852 If N is a positive number, save the N next articles.
10853 If N is a negative number, save the N previous articles.
10854 If N is nil and any articles have been marked with the process mark,
10855 save those articles instead."
10857 (require 'gnus-art
)
10858 (let ((gnus-default-article-saver 'gnus-summary-save-in-file
))
10859 (gnus-summary-save-article arg
)))
10861 (defun gnus-summary-write-article-file (&optional arg
)
10862 "Write the current article to a file, deleting the previous file.
10863 If N is a positive number, save the N next articles.
10864 If N is a negative number, save the N previous articles.
10865 If N is nil and any articles have been marked with the process mark,
10866 save those articles instead."
10868 (require 'gnus-art
)
10869 (let ((gnus-default-article-saver 'gnus-summary-write-to-file
))
10870 (gnus-summary-save-article arg
)))
10872 (defun gnus-summary-save-article-body-file (&optional arg
)
10873 "Append the current article body to a file.
10874 If N is a positive number, save the N next articles.
10875 If N is a negative number, save the N previous articles.
10876 If N is nil and any articles have been marked with the process mark,
10877 save those articles instead."
10879 (require 'gnus-art
)
10880 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file
))
10881 (gnus-summary-save-article arg
)))
10883 (defun gnus-summary-muttprint (&optional arg
)
10884 "Print the current article using Muttprint.
10885 If N is a positive number, save the N next articles.
10886 If N is a negative number, save the N previous articles.
10887 If N is nil and any articles have been marked with the process mark,
10888 save those articles instead."
10890 (require 'gnus-art
)
10891 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint
))
10892 (gnus-summary-save-article arg t
)))
10894 (defun gnus-summary-pipe-message (program)
10895 "Pipe the current article through PROGRAM."
10896 (interactive "sProgram: ")
10897 (gnus-summary-select-article)
10898 (let ((mail-header-separator ""))
10899 (gnus-eval-in-buffer-window gnus-article-buffer
10902 (let ((start (window-start))
10904 (message-pipe-buffer-body program
)
10905 (set-window-start (get-buffer-window (current-buffer)) start
))))))
10907 (defun gnus-get-split-value (methods)
10908 "Return a value based on the split METHODS."
10909 (let (split-name method result match
)
10912 (set-buffer gnus-original-article-buffer
)
10914 (nnheader-narrow-to-headers)
10915 (while (and methods
(not split-name
))
10916 (goto-char (point-min))
10917 (setq method
(pop methods
))
10918 (setq match
(car method
))
10921 ;; Regular expression.
10923 (re-search-forward match nil t
)))
10928 (setq result
(funcall match gnus-newsgroup-name
))))
10933 (setq result
(eval match
)))))
10934 (setq split-name
(cdr method
))
10935 (cond ((stringp result
)
10936 (push (expand-file-name
10937 result gnus-article-save-directory
)
10940 (setq split-name
(append result split-name
)))))))))
10941 (nreverse split-name
)))
10943 (defun gnus-valid-move-group-p (group)
10944 (and (boundp group
)
10945 (symbol-name group
)
10946 (symbol-value group
)
10947 (gnus-get-function (gnus-find-method-for-group
10948 (symbol-name group
)) 'request-accept-article t
)))
10950 (defun gnus-read-move-group-name (prompt default articles prefix
)
10951 "Read a group name."
10952 (let* ((split-name (gnus-get-split-value gnus-move-split-methods
))
10953 (minibuffer-confirm-incomplete nil
) ; XEmacs
10955 (format "%s %s to:"
10957 (if (> (length articles
) 1)
10958 (format "these %d articles" (length articles
))
10963 (gnus-completing-read-with-default
10966 'gnus-valid-move-group-p
10968 'gnus-group-history
))
10969 ((= 1 (length split-name
))
10970 (gnus-completing-read-with-default
10971 (car split-name
) prom
10973 'gnus-valid-move-group-p
10975 'gnus-group-history
))
10977 (gnus-completing-read-with-default
10979 (mapcar (lambda (el) (list el
))
10980 (nreverse split-name
))
10982 'gnus-group-history
))))
10983 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup
))))
10985 (if (or (string= to-newsgroup
"")
10986 (string= to-newsgroup prefix
))
10987 (setq to-newsgroup default
))
10988 (unless to-newsgroup
10989 (error "No group name entered"))
10990 (or (gnus-active to-newsgroup
)
10991 (gnus-activate-group to-newsgroup nil nil to-method
)
10992 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10994 (or (and (gnus-request-create-group to-newsgroup to-method
)
10995 (gnus-activate-group
10996 to-newsgroup nil nil to-method
)
10997 (gnus-subscribe-group to-newsgroup
))
10998 (error "Couldn't create group %s" to-newsgroup
)))
10999 (error "No such group: %s" to-newsgroup
)))
11002 (defun gnus-summary-save-parts (type dir n
&optional reverse
)
11003 "Save parts matching TYPE to DIR.
11004 If REVERSE, save parts that do not match TYPE."
11006 (list (read-string "Save parts of type: "
11007 (or (car gnus-summary-save-parts-type-history
)
11008 gnus-summary-save-parts-default-mime
)
11009 'gnus-summary-save-parts-type-history
)
11010 (setq gnus-summary-save-parts-last-directory
11011 (read-file-name "Save to directory: "
11012 gnus-summary-save-parts-last-directory
11014 current-prefix-arg
))
11015 (gnus-summary-iterate n
11016 (let ((gnus-display-mime-function nil
)
11017 (gnus-inhibit-treatment t
))
11018 (gnus-summary-select-article))
11020 (set-buffer gnus-article-buffer
)
11021 (let ((handles (or gnus-article-mime-handles
11022 (mm-dissect-buffer nil gnus-article-loose-mime
)
11023 (and gnus-article-emulate-mime
11024 (mm-uu-dissect)))))
11026 (gnus-summary-save-parts-1 type dir handles reverse
)
11027 (unless gnus-article-mime-handles
;; Don't destroy this case.
11028 (mm-destroy-parts handles
)))))))
11030 (defun gnus-summary-save-parts-1 (type dir handle reverse
)
11031 (if (stringp (car handle
))
11032 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse
))
11035 (not (string-match type
(mm-handle-media-type handle
)))
11036 (string-match type
(mm-handle-media-type handle
)))
11037 (let ((file (expand-file-name
11039 mm-file-name-rewrite-functions
11040 (file-name-nondirectory
11042 (mail-content-type-get
11043 (mm-handle-disposition handle
) 'filename
)
11044 (mail-content-type-get
11045 (mm-handle-type handle
) 'name
)
11046 (concat gnus-newsgroup-name
11047 "." (number-to-string
11048 (cdr gnus-article-current
))))))
11050 (unless (file-exists-p file
)
11051 (mm-save-part-to-file handle file
))))))
11053 ;; Summary extract commands
11055 (defun gnus-summary-insert-pseudos (pslist &optional not-view
)
11056 (let ((buffer-read-only nil
)
11057 (article (gnus-summary-article-number))
11059 (unless (gnus-summary-goto-subject article
)
11060 (error "No such article: %d" article
))
11061 (gnus-summary-position-point)
11062 ;; If all commands are to be bunched up on one line, we collect
11064 (unless gnus-view-pseudos-separately
11065 (let ((ps (setq pslist
(sort pslist
'gnus-pseudos
<)))
11068 (setq action
(cdr (assq 'action
(car ps
))))
11069 (setq files
(list (cdr (assq 'name
(car ps
)))))
11070 (while (and ps
(cdr ps
)
11071 (string= (or action
"1")
11072 (or (cdr (assq 'action
(cadr ps
))) "2")))
11073 (push (cdr (assq 'name
(cadr ps
))) files
)
11074 (setcdr ps
(cddr ps
)))
11076 (when (not (string-match "%s" action
))
11079 (when (assq 'execute
(car ps
))
11080 (setcdr (assq 'execute
(car ps
))
11081 (funcall (if (string-match "%s" action
)
11090 (setq ps
(cdr ps
)))))
11091 (if (and gnus-view-pseudos
(not not-view
))
11093 (when (assq 'execute
(car pslist
))
11094 (gnus-execute-command (cdr (assq 'execute
(car pslist
)))
11095 (eq gnus-view-pseudos
'not-confirm
)))
11096 (setq pslist
(cdr pslist
)))
11099 (setq after-article
(or (cdr (assq 'article
(car pslist
)))
11100 (gnus-summary-article-number)))
11101 (gnus-summary-goto-subject after-article
)
11104 (insert " " (file-name-nondirectory
11105 (cdr (assq 'name
(car pslist
))))
11106 ": " (or (cdr (assq 'execute
(car pslist
))) "") "\n")
11108 (forward-line -
1) ; back to `b'
11109 (gnus-add-text-properties
11110 b
(1- e
) (list 'gnus-number gnus-reffed-article-number
11111 gnus-mouse-face-prop gnus-mouse-face
))
11113 after-article gnus-reffed-article-number
11114 gnus-unread-mark b
(car pslist
) 0 (- e b
))
11115 (setq gnus-newsgroup-unreads
11116 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11117 gnus-reffed-article-number
))
11118 (setq gnus-reffed-article-number
(1- gnus-reffed-article-number
))
11119 (setq pslist
(cdr pslist
)))))))
11121 (defun gnus-pseudos< (p1 p2
)
11122 (let ((c1 (cdr (assq 'action p1
)))
11123 (c2 (cdr (assq 'action p2
))))
11124 (and c1 c2
(string< c1 c2
))))
11126 (defun gnus-request-pseudo-article (props)
11127 (cond ((assq 'execute props
)
11128 (gnus-execute-command (cdr (assq 'execute props
)))))
11129 (let ((gnus-current-article (gnus-summary-article-number)))
11130 (gnus-run-hooks 'gnus-mark-article-hook
)))
11132 (defun gnus-execute-command (command &optional automatic
)
11134 (gnus-article-setup-buffer)
11135 (set-buffer gnus-article-buffer
)
11136 (setq buffer-read-only nil
)
11137 (let ((command (if automatic command
11138 (read-string "Command: " (cons command
0)))))
11140 (insert "$ " command
"\n\n")
11141 (if gnus-view-pseudo-asynchronously
11142 (start-process "gnus-execute" (current-buffer) shell-file-name
11143 shell-command-switch command
)
11144 (call-process shell-file-name nil t nil
11145 shell-command-switch command
)))))
11147 ;; Summary kill commands.
11149 (defun gnus-summary-edit-global-kill (article)
11150 "Edit the \"global\" kill file."
11151 (interactive (list (gnus-summary-article-number)))
11152 (gnus-group-edit-global-kill article
))
11154 (defun gnus-summary-edit-local-kill ()
11155 "Edit a local kill file applied to the current newsgroup."
11157 (setq gnus-current-headers
(gnus-summary-article-header))
11158 (gnus-group-edit-local-kill
11159 (gnus-summary-article-number) gnus-newsgroup-name
))
11161 ;;; Header reading.
11163 (defun gnus-read-header (id &optional header
)
11164 "Read the headers of article ID and enter them into the Gnus system."
11165 (let ((group gnus-newsgroup-name
)
11166 (gnus-override-method
11168 gnus-override-method
11169 (and (gnus-news-group-p gnus-newsgroup-name
)
11170 (car (gnus-refer-article-methods)))))
11172 ;; First we check to see whether the header in question is already
11175 ;; This is a Message-ID.
11176 (setq header
(or header
(gnus-id-to-header id
)))
11177 ;; This is an article number.
11178 (setq header
(or header
(gnus-summary-article-header id
))))
11180 (not (gnus-summary-article-sparse-p (mail-header-number header
))))
11181 ;; We have found the header.
11183 ;; We have to really fetch the header to this article.
11185 (set-buffer nntp-server-buffer
)
11186 (when (setq where
(gnus-request-head id group
))
11187 (nnheader-fold-continuation-lines)
11188 (goto-char (point-max))
11190 (goto-char (point-min))
11194 ((cdr where
) (cdr where
))
11195 (header (mail-header-number header
))
11196 (t gnus-reffed-article-number
))
11198 (insert " Article retrieved.\n"))
11199 (if (or (not where
)
11200 (not (setq header
(car (gnus-get-newsgroup-headers nil t
)))))
11201 () ; Malformed head.
11202 (unless (gnus-summary-article-sparse-p (mail-header-number header
))
11203 (when (and (stringp id
)
11204 (not (string= (gnus-group-real-name group
)
11206 ;; If we fetched by Message-ID and the article came
11207 ;; from a different group, we fudge some bogus article
11208 ;; numbers for this article.
11209 (mail-header-set-number header gnus-reffed-article-number
))
11211 (set-buffer gnus-summary-buffer
)
11212 (decf gnus-reffed-article-number
)
11213 (gnus-remove-header (mail-header-number header
))
11214 (push header gnus-newsgroup-headers
)
11215 (setq gnus-current-headers header
)
11216 (push (mail-header-number header
) gnus-newsgroup-limit
)))
11219 (defun gnus-remove-header (number)
11220 "Remove header NUMBER from `gnus-newsgroup-headers'."
11221 (if (and gnus-newsgroup-headers
11222 (= number
(mail-header-number (car gnus-newsgroup-headers
))))
11223 (pop gnus-newsgroup-headers
)
11224 (let ((headers gnus-newsgroup-headers
))
11225 (while (and (cdr headers
)
11226 (not (= number
(mail-header-number (cadr headers
)))))
11228 (when (cdr headers
)
11229 (setcdr headers
(cddr headers
))))))
11232 ;;; summary highlights
11235 (defun gnus-highlight-selected-summary ()
11236 "Highlight selected article in summary buffer."
11237 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11238 (when gnus-summary-selected-face
11240 (let* ((beg (gnus-point-at-bol))
11241 (end (gnus-point-at-eol))
11242 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11243 (from (if (get-text-property beg gnus-mouse-face-prop
)
11245 (or (next-single-property-change
11246 beg gnus-mouse-face-prop nil end
)
11251 (or (next-single-property-change
11252 from gnus-mouse-face-prop nil end
)
11254 ;; If no mouse-face prop on line we will have to = from = end,
11255 ;; so we highlight the entire line instead.
11256 (when (= (+ to
2) from
)
11259 (if gnus-newsgroup-selected-overlay
11260 ;; Move old overlay.
11262 gnus-newsgroup-selected-overlay from to
(current-buffer))
11263 ;; Create new overlay.
11265 (setq gnus-newsgroup-selected-overlay
(gnus-make-overlay from to
))
11266 'face gnus-summary-selected-face
))))))
11268 (defvar gnus-summary-highlight-line-cached nil
)
11269 (defvar gnus-summary-highlight-line-trigger nil
)
11271 (defun gnus-summary-highlight-line-0 ()
11272 (if (and (eq gnus-summary-highlight-line-trigger
11273 gnus-summary-highlight
)
11274 gnus-summary-highlight-line-cached
)
11275 gnus-summary-highlight-line-cached
11276 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11277 gnus-summary-highlight-line-cached
11278 (let* ((cond (list 'cond
))
11280 (list gnus-summary-highlight
))
11282 (setcdr c
(cons (list (caar list
) (list 'quote
(cdar list
)))
11286 (gnus-byte-compile (list 'lambda nil cond
))))))
11288 (defun gnus-summary-highlight-line ()
11289 "Highlight current line according to `gnus-summary-highlight'."
11290 (let* ((beg (gnus-point-at-bol))
11291 (article (or (gnus-summary-article-number) gnus-current-article
))
11292 (score (or (cdr (assq article
11293 gnus-newsgroup-scored
))
11294 gnus-summary-default-score
0))
11295 (mark (or (gnus-summary-article-mark) gnus-unread-mark
))
11296 (inhibit-read-only t
)
11297 (default gnus-summary-default-score
)
11298 (default-high gnus-summary-default-high-score
)
11299 (default-low gnus-summary-default-low-score
)
11300 (uncached (and gnus-summary-use-undownloaded-faces
11301 (memq article gnus-newsgroup-undownloaded
))))
11302 (let ((face (funcall (gnus-summary-highlight-line-0))))
11303 (unless (eq face
(get-text-property beg
'face
))
11304 (gnus-put-text-property-excluding-characters-with-faces
11305 beg
(gnus-point-at-eol) 'face
11306 (setq face
(if (boundp face
) (symbol-value face
) face
)))
11307 (when gnus-summary-highlight-line-function
11308 (funcall gnus-summary-highlight-line-function article face
))))))
11310 (defun gnus-update-read-articles (group unread
&optional compute
)
11311 "Update the list of read articles in GROUP.
11312 UNREAD is a sorted list."
11313 (let* ((active (or gnus-newsgroup-active
(gnus-active group
)))
11314 (entry (gnus-gethash group gnus-newsrc-hashtb
))
11315 (info (nth 2 entry
))
11318 (if (or (not info
) (not active
))
11319 ;; There is no info on this group if it was, in fact,
11320 ;; killed. Gnus stores no information on killed groups, so
11321 ;; there's nothing to be done.
11322 ;; One could store the information somewhere temporarily,
11323 ;; perhaps... Hmmm...
11325 ;; Remove any negative articles numbers.
11326 (while (and unread
(< (car unread
) 0))
11327 (setq unread
(cdr unread
)))
11328 ;; Remove any expired article numbers
11329 (while (and unread
(< (car unread
) (car active
)))
11330 (setq unread
(cdr unread
)))
11331 ;; Compute the ranges of read articles by looking at the list of
11332 ;; unread articles.
11334 (when (/= (car unread
) prev
)
11335 (push (if (= prev
(1- (car unread
))) prev
11336 (cons prev
(1- (car unread
))))
11338 (setq prev
(1+ (car unread
)))
11339 (setq unread
(cdr unread
)))
11340 (when (<= prev
(cdr active
))
11341 (push (cons prev
(cdr active
)) read
))
11342 (setq read
(if (> (length read
) 1) (nreverse read
) read
))
11347 ;; Propagate the read marks to the backend.
11348 (when (gnus-check-backend-function 'request-set-mark group
)
11349 (let ((del (gnus-remove-from-range (gnus-info-read info
) read
))
11350 (add (gnus-remove-from-range read
(gnus-info-read info
))))
11352 (unless (gnus-check-group group
)
11353 (error "Can't open server for %s" group
))
11354 (gnus-request-set-mark
11355 group
(delq nil
(list (if add
(list add
'add
'(read)))
11356 (if del
(list del
'del
'(read))))))
11358 `(gnus-request-set-mark
11361 (if del
(list del
'add
'(read)))
11362 (if add
(list add
'del
'(read))))))))))
11363 (set-buffer gnus-group-buffer
)
11364 (gnus-undo-register
11366 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
11367 (gnus-info-set-read ',info
',(gnus-info-read info
))
11368 (gnus-get-unread-articles-in-group ',info
11369 (gnus-active ,group
))
11370 (gnus-group-update-group ,group t
)
11372 ;; Enter this list into the group info.
11373 (gnus-info-set-read info read
)
11374 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11375 (gnus-get-unread-articles-in-group info
(gnus-active group
))
11378 (defun gnus-offer-save-summaries ()
11379 "Offer to save all active summary buffers."
11381 ;; Go through all buffers and find all summaries.
11382 (dolist (buffer (buffer-list))
11383 (when (and (setq buffer
(buffer-name buffer
))
11384 (string-match "Summary" buffer
)
11386 (set-buffer buffer
)
11387 ;; We check that this is, indeed, a summary buffer.
11388 (and (eq major-mode
'gnus-summary-mode
)
11389 ;; Also make sure this isn't bogus.
11390 gnus-newsgroup-prepared
11391 ;; Also make sure that this isn't a
11392 ;; dead summary buffer.
11393 (not gnus-dead-summary-mode
))))
11394 (push buffer buffers
)))
11395 ;; Go through all these summary buffers and offer to save them.
11399 "Update summary buffer %s? "
11401 (switch-to-buffer buf
)
11402 (gnus-summary-exit))
11405 (defun gnus-summary-setup-default-charset ()
11406 "Setup newsgroup default charset."
11407 (if (member gnus-newsgroup-name
'("nndraft:delayed" "nndraft:drafts"))
11408 (setq gnus-newsgroup-charset nil
)
11409 (let* ((ignored-charsets
11410 (or gnus-newsgroup-ephemeral-ignored-charsets
11412 (and gnus-newsgroup-name
11413 (gnus-parameter-ignored-charsets gnus-newsgroup-name
))
11414 gnus-newsgroup-ignored-charsets
))))
11415 (setq gnus-newsgroup-charset
11416 (or gnus-newsgroup-ephemeral-charset
11417 (and gnus-newsgroup-name
11418 (gnus-parameter-charset gnus-newsgroup-name
))
11419 gnus-default-charset
))
11420 (set (make-local-variable 'gnus-newsgroup-ignored-charsets
)
11421 ignored-charsets
))))
11427 (defun gnus-summary-display-buttonized (&optional show-all-parts
)
11428 "Display the current article buffer fully MIME-buttonized.
11429 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11430 treated as multipart/mixed."
11432 (require 'gnus-art
)
11433 (let ((gnus-unbuttonized-mime-types nil
)
11434 (gnus-mime-display-multipart-as-mixed show-all-parts
))
11435 (gnus-summary-show-article)))
11437 (defun gnus-summary-repair-multipart (article)
11438 "Add a Content-Type header to a multipart article without one."
11439 (interactive (list (gnus-summary-article-number)))
11440 (gnus-with-article article
11441 (message-narrow-to-head)
11442 (message-remove-header "Mime-Version")
11443 (goto-char (point-max))
11444 (insert "Mime-Version: 1.0\n")
11446 (when (search-forward "\n--" nil t
)
11447 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11448 (message-narrow-to-head)
11449 (message-remove-header "Content-Type")
11450 (goto-char (point-max))
11451 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11454 (let (gnus-mark-article-hook)
11455 (gnus-summary-select-article t t nil article
)))
11457 (defun gnus-summary-toggle-display-buttonized ()
11458 "Toggle the buttonizing of the article buffer."
11460 (require 'gnus-art
)
11461 (if (setq gnus-inhibit-mime-unbuttonizing
11462 (not gnus-inhibit-mime-unbuttonizing
))
11463 (let ((gnus-unbuttonized-mime-types nil
))
11464 (gnus-summary-show-article))
11465 (gnus-summary-show-article)))
11468 ;;; Generic summary marking commands
11471 (defvar gnus-summary-marking-alist
11472 '((read gnus-del-mark
"d")
11473 (unread gnus-unread-mark
"u")
11474 (ticked gnus-ticked-mark
"!")
11475 (dormant gnus-dormant-mark
"?")
11476 (expirable gnus-expirable-mark
"e"))
11477 "An alist of names/marks/keystrokes.")
11479 (defvar gnus-summary-generic-mark-map
(make-sparse-keymap))
11480 (defvar gnus-summary-mark-map
)
11482 (defun gnus-summary-make-all-marking-commands ()
11483 (define-key gnus-summary-mark-map
"M" gnus-summary-generic-mark-map
)
11484 (dolist (elem gnus-summary-marking-alist
)
11485 (apply 'gnus-summary-make-marking-command elem
)))
11487 (defun gnus-summary-make-marking-command (name mark keystroke
)
11488 (let ((map (make-sparse-keymap)))
11489 (define-key gnus-summary-generic-mark-map keystroke map
)
11490 (dolist (lway `((next "next" next nil
"n")
11491 (next-unread "next unread" next t
"N")
11492 (prev "previous" prev nil
"p")
11493 (prev-unread "previous unread" prev t
"P")
11494 (nomove "" nil nil
,keystroke
)))
11495 (let ((func (gnus-summary-make-marking-command-1
11496 mark
(car lway
) lway name
)))
11497 (setq func
(eval func
))
11498 (define-key map
(nth 4 lway
) func
)))))
11500 (defun gnus-summary-make-marking-command-1 (mark way lway name
)
11502 (format "gnus-summary-put-mark-as-%s%s"
11503 name
(if (eq way
'nomove
)
11505 (concat "-" (symbol-name way
)))))
11508 "Mark the current article as %s%s.
11509 If N, the prefix, then repeat N times.
11510 If N is negative, move in reverse order.
11511 The difference between N and the actual number of articles marked is
11515 (gnus-summary-generic-mark n
,mark
',(nth 2 lway
) ,(nth 3 lway
))))
11517 (defun gnus-summary-generic-mark (n mark move unread
)
11518 "Mark N articles with MARK."
11519 (unless (eq major-mode
'gnus-summary-mode
)
11520 (error "This command can only be used in the summary buffer"))
11521 (gnus-summary-show-thread)
11524 ((eq move
'next
) 1)
11525 ((eq move
'prev
) -
1)
11527 (if (zerop nummove
)
11531 nummove
(* -
1 nummove
))))
11532 (while (and (> n
0)
11533 (gnus-summary-mark-article nil mark
)
11534 (zerop (gnus-summary-next-subject nummove unread t
)))
11537 (gnus-message 7 "No more %sarticles" (if mark
"" "unread ")))
11538 (gnus-summary-recenter)
11539 (gnus-summary-position-point)
11540 (gnus-set-mode-line 'summary
)
11543 (defun gnus-summary-insert-articles (articles)
11544 (when (setq articles
11545 (gnus-sorted-difference articles
11546 (mapcar (lambda (h)
11547 (mail-header-number h
))
11548 gnus-newsgroup-headers
)))
11549 (setq gnus-newsgroup-headers
11551 gnus-newsgroup-headers
11552 (gnus-fetch-headers articles
)
11553 'gnus-article-sort-by-number
))
11554 ;; Suppress duplicates?
11555 (when gnus-suppress-duplicates
11556 (gnus-dup-suppress-articles))
11558 ;; We might want to build some more threads first.
11559 (when (and gnus-fetch-old-headers
11560 (eq gnus-headers-retrieved-by
'nov
))
11561 (if (eq gnus-fetch-old-headers
'invisible
)
11562 (gnus-build-all-threads)
11563 (gnus-build-old-threads)))
11564 ;; Let the Gnus agent mark articles as read.
11566 (gnus-agent-get-undownloaded-list))
11567 ;; Remove list identifiers from subject
11568 (when gnus-list-identifiers
11569 (gnus-summary-remove-list-identifiers))
11570 ;; First and last article in this newsgroup.
11571 (when gnus-newsgroup-headers
11572 (setq gnus-newsgroup-begin
11573 (mail-header-number (car gnus-newsgroup-headers
))
11575 (mail-header-number
11576 (gnus-last-element gnus-newsgroup-headers
))))
11577 (when gnus-use-scoring
11578 (gnus-possibly-score-headers))))
11580 (defun gnus-summary-insert-old-articles (&optional all
)
11581 "Insert all old articles in this group.
11582 If ALL is non-nil, already read articles become readable.
11583 If ALL is a number, fetch this number of articles."
11586 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11589 ;; Some nntp servers lie about their active range. When
11590 ;; this happens, the active range can be in the millions.
11591 ;; Use a compressed range to avoid creating a huge list.
11592 (gnus-range-difference (list gnus-newsgroup-active
) old
))
11593 (setq len
(gnus-range-length older
))
11598 (let ((older-range (nreverse older
)))
11602 (let* ((r (pop older-range
))
11603 (min (if (numberp r
) r
(car r
)))
11604 (max (if (numberp r
) r
(cdr r
))))
11605 (while (and (<= min max
)
11610 (setq older
(gnus-uncompress-range older
))))
11612 (setq older
(gnus-uncompress-range older
)))
11614 (when (and (numberp gnus-large-newsgroup
)
11615 (> len gnus-large-newsgroup
))
11616 (let* ((cursor-in-echo-area nil
)
11617 (initial (gnus-parameter-large-newsgroup-initial
11618 gnus-newsgroup-name
))
11622 "How many articles from %s (%s %d): "
11624 (gnus-group-decoded-name gnus-newsgroup-name
) 35)
11625 (if initial
"max" "default")
11628 (cons (number-to-string initial
)
11630 (unless (string-match "^[ \t]*$" input
)
11631 (setq all
(string-to-number input
))
11633 (let ((older-range (nreverse older
)))
11637 (let* ((r (pop older-range
))
11638 (min (if (numberp r
) r
(car r
)))
11639 (max (if (numberp r
) r
(cdr r
))))
11640 (while (and (<= min max
)
11644 max
(1- max
))))))))))
11645 (setq older
(gnus-uncompress-range older
))))
11647 (message "No old news.")
11648 (gnus-summary-insert-articles older
)
11649 (gnus-summary-limit (gnus-sorted-nunion old older
))))
11650 (gnus-summary-position-point)))
11652 (defun gnus-summary-insert-new-articles ()
11653 "Insert all new articles in this group."
11656 (let ((old (sort (mapcar 'car gnus-newsgroup-data
) '<))
11657 (old-active gnus-newsgroup-active
)
11658 (nnmail-fetched-sources (list t
))
11660 (setq gnus-newsgroup-active
11661 (gnus-activate-group gnus-newsgroup-name
'scan
))
11662 (setq i
(cdr gnus-newsgroup-active
))
11663 (while (> i
(cdr old-active
))
11667 (message "No gnus is bad news.")
11668 (gnus-summary-insert-articles new
)
11669 (setq gnus-newsgroup-unreads
11670 (gnus-sorted-nunion gnus-newsgroup-unreads new
))
11671 (gnus-summary-limit (gnus-sorted-nunion old new
))))
11672 (gnus-summary-position-point)))
11674 (gnus-summary-make-all-marking-commands)
11676 (gnus-ems-redefine)
11678 (provide 'gnus-sum
)
11680 (run-hooks 'gnus-sum-load-hook
)
11682 ;; Local Variables:
11683 ;; coding: iso-8859-1
11686 ;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11687 ;;; gnus-sum.el ends here