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 non-nil, 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)
79 (sexp :menu-tag "other" t)))
81 (defcustom gnus-refer-thread-limit 200
82 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
83 If t, fetch all the available old headers."
86 (sexp :menu-tag "other" t)))
88 (defcustom gnus-summary-make-false-root 'adopt
89 "*nil means that Gnus won't gather loose threads.
90 If the root of a thread has expired or been read in a previous
91 session, the information necessary to build a complete thread has been
92 lost. Instead of having many small sub-threads from this original thread
93 scattered all over the summary buffer, Gnus can gather them.
95 If non-nil, Gnus will try to gather all loose sub-threads from an
96 original thread into one large thread.
98 If this variable is non-nil, it should be one of `none', `adopt',
101 If this variable is `none', Gnus will not make a false root, but just
102 present the sub-threads after another.
103 If this variable is `dummy', Gnus will create a dummy root that will
104 have all the sub-threads as children.
105 If this variable is `adopt', Gnus will make one of the \"children\"
106 the parent and mark all the step-children as such.
107 If this variable is `empty', the \"children\" are printed with empty
108 subject fields. (Or rather, they will be printed with a string
109 given by the `gnus-summary-same-subject' variable.)"
111 :type '(choice (const :tag "off" nil)
117 (defcustom gnus-summary-make-false-root-always nil
118 "Always make a false dummy root."
122 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
123 "*A regexp to match subjects to be excluded from loose thread gathering.
124 As loose thread gathering is done on subjects only, that means that
125 there can be many false gatherings performed. By rooting out certain
126 common subjects, gathering might become saner."
130 (defcustom gnus-summary-gather-subject-limit nil
131 "*Maximum length of subject comparisons when gathering loose threads.
132 Use nil to compare full subjects. Setting this variable to a low
133 number will help gather threads that have been corrupted by
134 newsreaders chopping off subject lines, but it might also mean that
135 unrelated articles that have subject that happen to begin with the
136 same few characters will be incorrectly gathered.
138 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
141 :type '(choice (const :tag "off" nil)
143 (sexp :menu-tag "on" t)))
145 (defcustom gnus-simplify-subject-functions nil
146 "List of functions taking a string argument that simplify subjects.
147 The functions are applied recursively.
149 Useful functions to put in this list include:
150 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
151 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
153 :type '(repeat function))
155 (defcustom gnus-simplify-ignored-prefixes nil
156 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
158 :type '(choice (const :tag "off" nil)
161 (defcustom gnus-build-sparse-threads nil
162 "*If non-nil, fill in the gaps in threads.
163 If `some', only fill in the gaps that are needed to tie loose threads
164 together. If `more', fill in all leaf nodes that Gnus can find. If
165 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
167 :type '(choice (const :tag "off" nil)
170 (sexp :menu-tag "all" t)))
172 (defcustom gnus-summary-thread-gathering-function
173 'gnus-gather-threads-by-subject
174 "*Function used for gathering loose threads.
175 There are two pre-defined functions: `gnus-gather-threads-by-subject',
176 which only takes Subjects into consideration; and
177 `gnus-gather-threads-by-references', which compared the References
178 headers of the articles to find matches."
180 :type '(radio (function-item gnus-gather-threads-by-subject)
181 (function-item gnus-gather-threads-by-references)
182 (function :tag "other")))
184 (defcustom gnus-summary-same-subject ""
185 "*String indicating that the current article has the same subject as the previous.
186 This variable will only be used if the value of
187 `gnus-summary-make-false-root' is `empty'."
188 :group 'gnus-summary-format
191 (defcustom gnus-summary-goto-unread t
192 "*If t, many commands will go to the next unread article.
193 This applies to marking commands as well as other commands that
194 \"naturally\" select the next article, like, for instance, `SPC' at
195 the end of an article.
197 If nil, the marking commands do NOT go to the next unread article
198 \(they go to the next article instead). If `never', commands that
199 usually go to the next unread article, will go to the next article,
200 whether it is read or not."
201 :group 'gnus-summary-marks
202 :link '(custom-manual "(gnus)Setting Marks")
203 :type '(choice (const :tag "off" nil)
205 (sexp :menu-tag "on" t)))
207 (defcustom gnus-summary-default-score 0
208 "*Default article score level.
209 All scores generated by the score files will be added to this score.
210 If this variable is nil, scoring will be disabled."
211 :group 'gnus-score-default
212 :type '(choice (const :tag "disable")
215 (defcustom gnus-summary-default-high-score 0
216 "*Default threshold for a high scored article.
217 An article will be highlighted as high scored if its score is greater
219 :group 'gnus-score-default
222 (defcustom gnus-summary-default-low-score 0
223 "*Default threshold for a low scored article.
224 An article will be highlighted as low scored if its score is smaller
226 :group 'gnus-score-default
229 (defcustom gnus-summary-zcore-fuzz 0
230 "*Fuzziness factor for the zcore in the summary buffer.
231 Articles with scores closer than this to `gnus-summary-default-score'
233 :group 'gnus-summary-format
236 (defcustom gnus-simplify-subject-fuzzy-regexp nil
237 "*Strings to be removed when doing fuzzy matches.
238 This can either be a regular expression or list of regular expressions
239 that will be removed from subject strings if fuzzy subject
240 simplification is selected."
242 :type '(repeat regexp))
244 (defcustom gnus-show-threads t
245 "*If non-nil, display threads in summary mode."
249 (defcustom gnus-thread-hide-subtree nil
250 "*If non-nil, hide all threads initially.
251 This can be a predicate specifier which says which threads to hide.
252 If threads are hidden, you have to run the command
253 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
254 to expose hidden threads."
256 :type '(radio (sexp :format "Non-nil\n"
257 :match (lambda (widget value)
258 (not (or (consp value) (functionp value))))
261 (sexp :tag "Predicate specifier" :size 0)))
263 (defcustom gnus-thread-hide-killed t
264 "*If non-nil, hide killed threads automatically."
268 (defcustom gnus-thread-ignore-subject t
269 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
270 If nil, articles that have different subjects from their parents will
271 start separate threads."
275 (defcustom gnus-thread-operation-ignore-subject t
276 "*If non-nil, subjects will be ignored when doing thread commands.
277 This affects commands like `gnus-summary-kill-thread' and
278 `gnus-summary-lower-thread'.
280 If this variable is nil, articles in the same thread with different
281 subjects will not be included in the operation in question. If this
282 variable is `fuzzy', only articles that have subjects that are fuzzily
283 equal will be included."
285 :type '(choice (const :tag "off" nil)
289 (defcustom gnus-thread-indent-level 4
290 "*Number that says how much each sub-thread should be indented."
294 (defcustom gnus-auto-extend-newsgroup t
295 "*If non-nil, extend newsgroup forward and backward when requested."
296 :group 'gnus-summary-choose
299 (defcustom gnus-auto-select-first t
300 "*If non-nil, select the article under point.
301 Which article this is is controlled by the `gnus-auto-select-subject'
304 If you want to prevent automatic selection of articles in some
305 newsgroups, set the variable to nil in `gnus-select-group-hook'."
306 :group 'gnus-group-select
307 :type '(choice (const :tag "none" nil)
308 (sexp :menu-tag "first" t)))
310 (defcustom gnus-auto-select-subject 'unread
311 "*Says what subject to place under point when entering a group.
313 This variable can either be the symbols `first' (place point on the
314 first subject), `unread' (place point on the subject line of the first
315 unread article), `best' (place point on the subject line of the
316 higest-scored article), `unseen' (place point on the subject line of
317 the first unseen article), 'unseen-or-unread' (place point on the subject
318 line of the first unseen article or, if all article have been seen, on the
319 subject line of the first unread article), or a function to be called to
320 place point on some subject line."
321 :group 'gnus-group-select
322 :type '(choice (const best)
326 (const unseen-or-unread)))
328 (defcustom gnus-auto-select-next t
329 "*If non-nil, offer to go to the next group from the end of the previous.
330 If the value is t and the next newsgroup is empty, Gnus will exit
331 summary mode and go back to group mode. If the value is neither nil
332 nor t, Gnus will select the following unread newsgroup. In
333 particular, if the value is the symbol `quietly', the next unread
334 newsgroup will be selected without any confirmation, and if it is
335 `almost-quietly', the next group will be selected without any
336 confirmation if you are located on the last article in the group.
337 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
338 will go to the next group without confirmation."
339 :group 'gnus-summary-maneuvering
340 :type '(choice (const :tag "off" nil)
342 (const almost-quietly)
343 (const slightly-quietly)
344 (sexp :menu-tag "on" t)))
346 (defcustom gnus-auto-select-same nil
347 "*If non-nil, select the next article with the same subject.
348 If there are no more articles with the same subject, go to
349 the first unread article."
350 :group 'gnus-summary-maneuvering
353 (defcustom gnus-auto-goto-ignores 'unfetched
354 "*Says how to handle unfetched articles when maneuvering.
356 This variable can either be the symbols nil (maneuver to any
357 article), `undownloaded' (maneuvering while unplugged ignores articles
358 that have not been fetched), `always-undownloaded' (maneuvering always
359 ignores articles that have not been fetched), `unfetched' (maneuvering
360 ignores articles whose headers have not been fetched).
362 NOTE: The list of unfetched articles will always be nil when plugged
363 and, when unplugged, a subset of the undownloaded article list."
364 :group 'gnus-summary-maneuvering
365 :type '(choice (const :tag "None" nil)
366 (const :tag "Undownloaded when unplugged" undownloaded)
367 (const :tag "Undownloaded" always-undownloaded)
368 (const :tag "Unfetched" unfetched)))
370 (defcustom gnus-summary-check-current nil
371 "*If non-nil, consider the current article when moving.
372 The \"unread\" movement commands will stay on the same line if the
373 current article is unread."
374 :group 'gnus-summary-maneuvering
377 (defcustom gnus-auto-center-summary t
378 "*If non-nil, always center the current summary buffer.
379 In particular, if `vertical' do only vertical recentering. If non-nil
380 and non-`vertical', do both horizontal and vertical recentering."
381 :group 'gnus-summary-maneuvering
382 :type '(choice (const :tag "none" nil)
384 (integer :tag "height")
385 (sexp :menu-tag "both" t)))
387 (defvar gnus-auto-center-group t
388 "*If non-nil, always center the group buffer.")
390 (defcustom gnus-show-all-headers nil
391 "*If non-nil, don't hide any headers."
392 :group 'gnus-article-hiding
393 :group 'gnus-article-headers
396 (defcustom gnus-summary-ignore-duplicates nil
397 "*If non-nil, ignore articles with identical Message-ID headers."
401 (defcustom gnus-single-article-buffer t
402 "*If non-nil, display all articles in the same buffer.
403 If nil, each group will get its own article buffer."
404 :group 'gnus-article-various
407 (defcustom gnus-break-pages t
408 "*If non-nil, do page breaking on articles.
409 The page delimiter is specified by the `gnus-page-delimiter'
411 :group 'gnus-article-various
414 (defcustom gnus-move-split-methods nil
415 "*Variable used to suggest where articles are to be moved to.
416 It uses the same syntax as the `gnus-split-methods' variable.
417 However, whereas `gnus-split-methods' specifies file names as targets,
418 this variable specifies group names."
419 :group 'gnus-summary-mail
420 :type '(repeat (choice (list :value (fun) function)
421 (cons :value ("" "") regexp (repeat string))
424 (defcustom gnus-unread-mark ? ;Whitespace
425 "*Mark used for unread articles."
426 :group 'gnus-summary-marks
429 (defcustom gnus-ticked-mark ?!
430 "*Mark used for ticked articles."
431 :group 'gnus-summary-marks
434 (defcustom gnus-dormant-mark ??
435 "*Mark used for dormant articles."
436 :group 'gnus-summary-marks
439 (defcustom gnus-del-mark ?r
440 "*Mark used for del'd articles."
441 :group 'gnus-summary-marks
444 (defcustom gnus-read-mark ?R
445 "*Mark used for read articles."
446 :group 'gnus-summary-marks
449 (defcustom gnus-expirable-mark ?E
450 "*Mark used for expirable articles."
451 :group 'gnus-summary-marks
454 (defcustom gnus-killed-mark ?K
455 "*Mark used for killed articles."
456 :group 'gnus-summary-marks
459 (defcustom gnus-spam-mark ?$
460 "*Mark used for spam articles."
461 :group 'gnus-summary-marks
464 (defcustom gnus-souped-mark ?F
465 "*Mark used for souped articles."
466 :group 'gnus-summary-marks
469 (defcustom gnus-kill-file-mark ?X
470 "*Mark used for articles killed by kill files."
471 :group 'gnus-summary-marks
474 (defcustom gnus-low-score-mark ?Y
475 "*Mark used for articles with a low score."
476 :group 'gnus-summary-marks
479 (defcustom gnus-catchup-mark ?C
480 "*Mark used for articles that are caught up."
481 :group 'gnus-summary-marks
484 (defcustom gnus-replied-mark ?A
485 "*Mark used for articles that have been replied to."
486 :group 'gnus-summary-marks
489 (defcustom gnus-forwarded-mark ?F
490 "*Mark used for articles that have been forwarded."
491 :group 'gnus-summary-marks
494 (defcustom gnus-recent-mark ?N
495 "*Mark used for articles that are recent."
496 :group 'gnus-summary-marks
499 (defcustom gnus-cached-mark ?*
500 "*Mark used for articles that are in the cache."
501 :group 'gnus-summary-marks
504 (defcustom gnus-saved-mark ?S
505 "*Mark used for articles that have been saved."
506 :group 'gnus-summary-marks
509 (defcustom gnus-unseen-mark ?.
510 "*Mark used for articles that haven't been seen."
511 :group 'gnus-summary-marks
514 (defcustom gnus-no-mark ? ;Whitespace
515 "*Mark used for articles that have no other secondary mark."
516 :group 'gnus-summary-marks
519 (defcustom gnus-ancient-mark ?O
520 "*Mark used for ancient articles."
521 :group 'gnus-summary-marks
524 (defcustom gnus-sparse-mark ?Q
525 "*Mark used for sparsely reffed articles."
526 :group 'gnus-summary-marks
529 (defcustom gnus-canceled-mark ?G
530 "*Mark used for canceled articles."
531 :group 'gnus-summary-marks
534 (defcustom gnus-duplicate-mark ?M
535 "*Mark used for duplicate articles."
536 :group 'gnus-summary-marks
539 (defcustom gnus-undownloaded-mark ?-
540 "*Mark used for articles that weren't downloaded."
541 :group 'gnus-summary-marks
544 (defcustom gnus-downloaded-mark ?+
545 "*Mark used for articles that were downloaded."
546 :group 'gnus-summary-marks
549 (defcustom gnus-downloadable-mark ?%
550 "*Mark used for articles that are to be downloaded."
551 :group 'gnus-summary-marks
554 (defcustom gnus-unsendable-mark ?=
555 "*Mark used for articles that won't be sent."
556 :group 'gnus-summary-marks
559 (defcustom gnus-score-over-mark ?+
560 "*Score mark used for articles with high scores."
561 :group 'gnus-summary-marks
564 (defcustom gnus-score-below-mark ?-
565 "*Score mark used for articles with low scores."
566 :group 'gnus-summary-marks
569 (defcustom gnus-empty-thread-mark ? ;Whitespace
570 "*There is no thread under the article."
571 :group 'gnus-summary-marks
574 (defcustom gnus-not-empty-thread-mark ?=
575 "*There is a thread under the article."
576 :group 'gnus-summary-marks
579 (defcustom gnus-view-pseudo-asynchronously nil
580 "*If non-nil, Gnus will view pseudo-articles asynchronously."
581 :group 'gnus-extract-view
584 (defcustom gnus-auto-expirable-marks
585 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
586 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
587 gnus-souped-mark gnus-duplicate-mark)
588 "*The list of marks converted into expiration if a group is auto-expirable."
591 :type '(repeat character))
593 (defcustom gnus-inhibit-user-auto-expire t
594 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
599 (defcustom gnus-view-pseudos nil
600 "*If `automatic', pseudo-articles will be viewed automatically.
601 If `not-confirm', pseudos will be viewed automatically, and the user
602 will not be asked to confirm the command."
603 :group 'gnus-extract-view
604 :type '(choice (const :tag "off" nil)
606 (const not-confirm)))
608 (defcustom gnus-view-pseudos-separately t
609 "*If non-nil, one pseudo-article will be created for each file to be viewed.
610 If nil, all files that use the same viewing command will be given as a
611 list of parameters to that command."
612 :group 'gnus-extract-view
615 (defcustom gnus-insert-pseudo-articles t
616 "*If non-nil, insert pseudo-articles when decoding articles."
617 :group 'gnus-extract-view
620 (defcustom gnus-summary-dummy-line-format
622 "*The format specification for the dummy roots in the summary buffer.
623 It works along the same lines as a normal formatting string,
624 with some simple extensions.
628 General format specifiers can also be used.
629 See `(gnus)Formatting Variables'."
630 :link '(custom-manual "(gnus)Formatting Variables")
631 :group 'gnus-threading
634 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
635 "*The format specification for the summary mode line.
636 It works along the same lines as a normal formatting string,
637 with some simple extensions:
640 %p Unprefixed group name
641 %A Current article number
642 %z Current article score
644 %U Number of unread articles in the group
645 %e Number of unselected articles in the group
646 %Z A string with unread/unselected article counts
647 %g Shortish group name
648 %S Subject of the current article
650 %s Current score file name
651 %d Number of dormant articles
652 %r Number of articles that have been marked as read in this session
653 %E Number of articles expunged by the score files"
654 :group 'gnus-summary-format
657 (defcustom gnus-list-identifiers nil
658 "Regexp that matches list identifiers to be removed from subject.
659 This can also be a list of regexps."
661 :group 'gnus-summary-format
662 :group 'gnus-article-hiding
663 :type '(choice (const :tag "none" nil)
665 (repeat :value (".*") regexp)))
667 (defcustom gnus-summary-mark-below 0
668 "*Mark all articles with a score below this variable as read.
669 This variable is local to each summary buffer and usually set by the
671 :group 'gnus-score-default
674 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
675 "*List of functions used for sorting articles in the summary buffer.
677 Each function takes two articles and returns non-nil if the first
678 article should be sorted before the other. If you use more than one
679 function, the primary sort function should be the last. You should
680 probably always include `gnus-article-sort-by-number' in the list of
681 sorting functions -- preferably first. Also note that sorting by date
682 is often much slower than sorting by number, and the sorting order is
683 very similar. (Sorting by date means sorting by the time the message
684 was sent, sorting by number means sorting by arrival time.)
686 Ready-made functions include `gnus-article-sort-by-number',
687 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
688 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
689 and `gnus-article-sort-by-score'.
691 When threading is turned on, the variable `gnus-thread-sort-functions'
692 controls how articles are sorted."
693 :group 'gnus-summary-sort
694 :type '(repeat (choice (function-item gnus-article-sort-by-number)
695 (function-item gnus-article-sort-by-author)
696 (function-item gnus-article-sort-by-subject)
697 (function-item gnus-article-sort-by-date)
698 (function-item gnus-article-sort-by-score)
699 (function-item gnus-article-sort-by-random)
700 (function :tag "other"))))
702 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
703 "*List of functions used for sorting threads in the summary buffer.
704 By default, threads are sorted by article number.
706 Each function takes two threads and returns non-nil if the first
707 thread should be sorted before the other. If you use more than one
708 function, the primary sort function should be the last. You should
709 probably always include `gnus-thread-sort-by-number' in the list of
710 sorting functions -- preferably first. Also note that sorting by date
711 is often much slower than sorting by number, and the sorting order is
712 very similar. (Sorting by date means sorting by the time the message
713 was sent, sorting by number means sorting by arrival time.)
715 Ready-made functions include `gnus-thread-sort-by-number',
716 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
717 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
718 `gnus-thread-sort-by-most-recent-number',
719 `gnus-thread-sort-by-most-recent-date',
720 `gnus-thread-sort-by-random', and
721 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
723 When threading is turned off, the variable
724 `gnus-article-sort-functions' controls how articles are sorted."
725 :group 'gnus-summary-sort
726 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
727 (function-item gnus-thread-sort-by-author)
728 (function-item gnus-thread-sort-by-subject)
729 (function-item gnus-thread-sort-by-date)
730 (function-item gnus-thread-sort-by-score)
731 (function-item gnus-thread-sort-by-total-score)
732 (function-item gnus-thread-sort-by-random)
733 (function :tag "other"))))
735 (defcustom gnus-thread-score-function '+
736 "*Function used for calculating the total score of a thread.
738 The function is called with the scores of the article and each
739 subthread and should then return the score of the thread.
741 Some functions you can use are `+', `max', or `min'."
742 :group 'gnus-summary-sort
745 (defcustom gnus-summary-expunge-below nil
746 "All articles that have a score less than this variable will be expunged.
747 This variable is local to the summary buffers."
748 :group 'gnus-score-default
749 :type '(choice (const :tag "off" nil)
752 (defcustom gnus-thread-expunge-below nil
753 "All threads that have a total score less than this variable will be expunged.
754 See `gnus-thread-score-function' for en explanation of what a
757 This variable is local to the summary buffers."
758 :group 'gnus-threading
759 :group 'gnus-score-default
760 :type '(choice (const :tag "off" nil)
763 (defcustom gnus-summary-mode-hook nil
764 "*A hook for Gnus summary mode.
765 This hook is run before any variables are set in the summary buffer."
766 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
767 :group 'gnus-summary-various
770 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
771 (when (featurep 'xemacs)
772 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
773 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
774 (add-hook 'gnus-summary-mode-hook
775 'gnus-xmas-switch-horizontal-scrollbar-off))
777 (defcustom gnus-summary-menu-hook nil
778 "*Hook run after the creation of the summary mode menu."
779 :group 'gnus-summary-visual
782 (defcustom gnus-summary-exit-hook nil
783 "*A hook called on exit from the summary buffer.
784 It will be called with point in the group buffer."
785 :group 'gnus-summary-exit
788 (defcustom gnus-summary-prepare-hook nil
789 "*A hook called after the summary buffer has been generated.
790 If you want to modify the summary buffer, you can use this hook."
791 :group 'gnus-summary-various
794 (defcustom gnus-summary-prepared-hook nil
795 "*A hook called as the last thing after the summary buffer has been generated."
796 :group 'gnus-summary-various
799 (defcustom gnus-summary-generate-hook nil
800 "*A hook run just before generating the summary buffer.
801 This hook is commonly used to customize threading variables and the
803 :group 'gnus-summary-various
806 (defcustom gnus-select-group-hook nil
807 "*A hook called when a newsgroup is selected.
809 If you'd like to simplify subjects like the
810 `gnus-summary-next-same-subject' command does, you can use the
813 (add-hook gnus-select-group-hook
815 (mapcar (lambda (header)
816 (mail-header-set-subject
818 (gnus-simplify-subject
819 (mail-header-subject header) 're-only)))
820 gnus-newsgroup-headers)))"
821 :group 'gnus-group-select
824 (defcustom gnus-select-article-hook nil
825 "*A hook called when an article is selected."
826 :group 'gnus-summary-choose
827 :options '(gnus-agent-fetch-selected-article)
830 (defcustom gnus-visual-mark-article-hook
831 (list 'gnus-highlight-selected-summary)
832 "*Hook run after selecting an article in the summary buffer.
833 It is meant to be used for highlighting the article in some way. It
834 is not run if `gnus-visual' is nil."
835 :group 'gnus-summary-visual
838 (defcustom gnus-parse-headers-hook nil
839 "*A hook called before parsing the headers."
843 (defcustom gnus-exit-group-hook nil
844 "*A hook called when exiting summary mode.
845 This hook is not called from the non-updating exit commands like `Q'."
849 (defcustom gnus-summary-update-hook
850 (list 'gnus-summary-highlight-line)
851 "*A hook called when a summary line is changed.
852 The hook will not be called if `gnus-visual' is nil.
854 The default function `gnus-summary-highlight-line' will
855 highlight the line according to the `gnus-summary-highlight'
857 :group 'gnus-summary-visual
860 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
861 "*A hook called when an article is selected for the first time.
862 The hook is intended to mark an article as read (or unread)
863 automatically when it is selected."
864 :group 'gnus-summary-choose
867 (defcustom gnus-group-no-more-groups-hook nil
868 "*A hook run when returning to group mode having no more (unread) groups."
869 :group 'gnus-group-select
872 (defcustom gnus-ps-print-hook nil
873 "*A hook run before ps-printing something from Gnus."
877 (defcustom gnus-summary-article-move-hook nil
878 "*A hook called after an article is moved, copied, respooled, or crossposted."
882 (defcustom gnus-summary-article-delete-hook nil
883 "*A hook called after an article is deleted."
887 (defcustom gnus-summary-article-expire-hook nil
888 "*A hook called after an article is expired."
892 (defcustom gnus-summary-display-arrow
893 (and (fboundp 'display-graphic-p)
895 "*If non-nil, display an arrow highlighting the current article."
900 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
901 "Face used for highlighting the current article in the summary buffer."
902 :group 'gnus-summary-visual
905 (defvar gnus-tmp-downloaded nil)
907 (defcustom gnus-summary-highlight
908 '(((eq mark gnus-canceled-mark)
909 . gnus-summary-cancelled-face)
910 ((and uncached (> score default-high))
911 . gnus-summary-high-undownloaded-face)
912 ((and uncached (< score default-low))
913 . gnus-summary-low-undownloaded-face)
915 . gnus-summary-normal-undownloaded-face)
916 ((and (> score default-high)
917 (or (eq mark gnus-dormant-mark)
918 (eq mark gnus-ticked-mark)))
919 . gnus-summary-high-ticked-face)
920 ((and (< score default-low)
921 (or (eq mark gnus-dormant-mark)
922 (eq mark gnus-ticked-mark)))
923 . gnus-summary-low-ticked-face)
924 ((or (eq mark gnus-dormant-mark)
925 (eq mark gnus-ticked-mark))
926 . gnus-summary-normal-ticked-face)
927 ((and (> score default-high) (eq mark gnus-ancient-mark))
928 . gnus-summary-high-ancient-face)
929 ((and (< score default-low) (eq mark gnus-ancient-mark))
930 . gnus-summary-low-ancient-face)
931 ((eq mark gnus-ancient-mark)
932 . gnus-summary-normal-ancient-face)
933 ((and (> score default-high) (eq mark gnus-unread-mark))
934 . gnus-summary-high-unread-face)
935 ((and (< score default-low) (eq mark gnus-unread-mark))
936 . gnus-summary-low-unread-face)
937 ((eq mark gnus-unread-mark)
938 . gnus-summary-normal-unread-face)
939 ((> score default-high)
940 . gnus-summary-high-read-face)
941 ((< score default-low)
942 . gnus-summary-low-read-face)
944 . gnus-summary-normal-read-face))
945 "*Controls the highlighting of summary buffer lines.
947 A list of (FORM . FACE) pairs. When deciding how a a particular
948 summary line should be displayed, each form is evaluated. The content
949 of the face field after the first true form is used. You can change
950 how those summary lines are displayed, by editing the face field.
952 You can use the following variables in the FORM field.
954 score: The article's score
955 default: The default article score.
956 default-high: The default score for high scored articles.
957 default-low: The default score for low scored articles.
958 below: The score below which articles are automatically marked as read.
959 mark: The article's mark.
960 uncached: Non-nil if the article is uncached."
961 :group 'gnus-summary-visual
962 :type '(repeat (cons (sexp :tag "Form" nil)
965 (defcustom gnus-alter-header-function nil
966 "Function called to allow alteration of article header structures.
967 The function is called with one parameter, the article header vector,
968 which it may alter in any way."
969 :type '(choice (const :tag "None" nil)
971 :group 'gnus-summary)
973 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
974 "Variable that says which function should be used to decode a string with encoded words.")
976 (defcustom gnus-extra-headers '(To Newsgroups)
977 "*Extra headers to parse."
980 :type '(repeat symbol))
982 (defcustom gnus-ignored-from-addresses
983 (and user-mail-address (regexp-quote user-mail-address))
984 "*Regexp of From headers that may be suppressed in favor of To headers."
989 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
990 "List of charsets that should be ignored.
991 When these charsets are used in the \"charset\" parameter, the
992 default charset will be used instead."
994 :type '(repeat symbol)
995 :group 'gnus-charset)
997 (gnus-define-group-parameter
1001 "Return the ignored charsets of GROUP."
1002 :variable gnus-group-ignored-charsets-alist
1004 '(("alt\\.chinese\\.text" iso-8859-1))
1006 "Alist of regexps (to match group names) and charsets that should be ignored.
1007 When these charsets are used in the \"charset\" parameter, the
1008 default charset will be used instead."
1009 :variable-group gnus-charset
1010 :variable-type '(repeat (cons (regexp :tag "Group")
1012 :parameter-type '(choice :tag "Ignored charsets"
1015 :parameter-document "\
1016 List of charsets that should be ignored.
1018 When these charsets are used in the \"charset\" parameter, the
1019 default charset will be used instead.")
1021 (defcustom gnus-group-highlight-words-alist nil
1022 "Alist of group regexps and highlight regexps.
1023 This variable uses the same syntax as `gnus-emphasis-alist'."
1025 :type '(repeat (cons (regexp :tag "Group")
1026 (repeat (list (regexp :tag "Highlight regexp")
1027 (number :tag "Group for entire word" 0)
1028 (number :tag "Group for displayed part" 0)
1030 gnus-emphasis-highlight-words)))))
1031 :group 'gnus-summary-visual)
1033 (defcustom gnus-summary-show-article-charset-alist
1035 "Alist of number and charset.
1036 The article will be shown with the charset corresponding to the
1038 For example: ((1 . cn-gb-2312) (2 . big5))."
1040 :type '(repeat (cons (number :tag "Argument" 1)
1041 (symbol :tag "Charset")))
1042 :group 'gnus-charset)
1044 (defcustom gnus-preserve-marks t
1045 "Whether marks are preserved when moving, copying and respooling messages."
1048 :group 'gnus-summary-marks)
1050 (defcustom gnus-alter-articles-to-read-function nil
1051 "Function to be called to alter the list of articles to be selected."
1052 :type '(choice (const nil) function)
1053 :group 'gnus-summary)
1055 (defcustom gnus-orphan-score nil
1056 "*All orphans get this score added. Set in the score file."
1057 :group 'gnus-score-default
1058 :type '(choice (const nil)
1061 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1062 "*A regexp to match MIME parts when saving multiple parts of a
1063 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1064 This regexp will be used by default when prompting the user for which
1065 type of files to save."
1066 :group 'gnus-summary
1069 (defcustom gnus-read-all-available-headers nil
1070 "Whether Gnus should parse all headers made available to it.
1071 This is mostly relevant for slow back ends where the user may
1072 wish to widen the summary buffer to include all headers
1073 that were fetched. Say, for nnultimate groups."
1074 :group 'gnus-summary
1075 :type '(choice boolean regexp))
1077 (defcustom gnus-summary-muttprint-program "muttprint"
1078 "Command (and optional arguments) used to run Muttprint."
1080 :group 'gnus-summary
1083 (defcustom gnus-article-loose-mime nil
1084 "If non-nil, don't require MIME-Version header.
1085 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1086 supply the MIME-Version header or deliberately strip it From the mail.
1087 Set it to non-nil, Gnus will treat some articles as MIME even if
1088 the MIME-Version header is missed."
1091 :group 'gnus-article-mime)
1093 (defcustom gnus-article-emulate-mime t
1094 "If non-nil, use MIME emulation for uuencode and the like.
1095 This means that Gnus will search message bodies for text that look
1096 like uuencoded bits, yEncoded bits, and so on, and present that using
1097 the normal Gnus MIME machinery."
1099 :group 'gnus-article-mime)
1101 ;;; Internal variables
1103 (defvar gnus-summary-display-cache nil)
1104 (defvar gnus-article-mime-handles nil)
1105 (defvar gnus-article-decoded-p nil)
1106 (defvar gnus-article-charset nil)
1107 (defvar gnus-article-ignored-charsets nil)
1108 (defvar gnus-scores-exclude-files nil)
1109 (defvar gnus-page-broken nil)
1111 (defvar gnus-original-article nil)
1112 (defvar gnus-article-internal-prepare-hook nil)
1113 (defvar gnus-newsgroup-process-stack nil)
1115 (defvar gnus-thread-indent-array nil)
1116 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1117 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1118 "Function called to sort the articles within a thread after it has been gathered together.")
1120 (defvar gnus-summary-save-parts-type-history nil)
1121 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1123 ;; Avoid highlighting in kill files.
1124 (defvar gnus-summary-inhibit-highlight nil)
1125 (defvar gnus-newsgroup-selected-overlay nil)
1126 (defvar gnus-inhibit-limiting nil)
1127 (defvar gnus-newsgroup-adaptive-score-file nil)
1128 (defvar gnus-current-score-file nil)
1129 (defvar gnus-current-move-group nil)
1130 (defvar gnus-current-copy-group nil)
1131 (defvar gnus-current-crosspost-group nil)
1132 (defvar gnus-newsgroup-display nil)
1134 (defvar gnus-newsgroup-dependencies nil)
1135 (defvar gnus-newsgroup-adaptive nil)
1136 (defvar gnus-summary-display-article-function nil)
1137 (defvar gnus-summary-highlight-line-function nil
1138 "Function called after highlighting a summary line.")
1140 (defvar gnus-summary-line-format-alist
1141 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1142 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1143 (?s gnus-tmp-subject-or-nil ?s)
1144 (?n gnus-tmp-name ?s)
1145 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1147 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1149 (?F gnus-tmp-from ?s)
1150 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1151 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1152 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1153 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1154 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1155 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1156 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1157 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1158 (?L gnus-tmp-lines ?s)
1159 (?O gnus-tmp-downloaded ?c)
1160 (?I gnus-tmp-indentation ?s)
1161 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1162 (?R gnus-tmp-replied ?c)
1163 (?\[ gnus-tmp-opening-bracket ?c)
1164 (?\] gnus-tmp-closing-bracket ?c)
1165 (?\> (make-string gnus-tmp-level ? ) ?s)
1166 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1167 (?i gnus-tmp-score ?d)
1168 (?z gnus-tmp-score-char ?c)
1169 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1170 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1171 (?U gnus-tmp-unread ?c)
1172 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1174 (?t (gnus-summary-number-of-articles-in-thread
1175 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1177 (?e (gnus-summary-number-of-articles-in-thread
1178 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1180 (?u gnus-tmp-user-defined ?s)
1181 (?P (gnus-pick-line-number) ?d)
1182 (?B gnus-tmp-thread-tree-header-string ?s)
1183 (user-date (gnus-user-date
1184 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1185 "An alist of format specifications that can appear in summary lines.
1186 These are paired with what variables they correspond with, along with
1187 the type of the variable (string, integer, character, etc).")
1189 (defvar gnus-summary-dummy-line-format-alist
1190 `((?S gnus-tmp-subject ?s)
1191 (?N gnus-tmp-number ?d)
1192 (?u gnus-tmp-user-defined ?s)))
1194 (defvar gnus-summary-mode-line-format-alist
1195 `((?G gnus-tmp-group-name ?s)
1196 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1197 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1198 (?A gnus-tmp-article-number ?d)
1199 (?Z gnus-tmp-unread-and-unselected ?s)
1200 (?V gnus-version ?s)
1201 (?U gnus-tmp-unread-and-unticked ?d)
1202 (?S gnus-tmp-subject ?s)
1203 (?e gnus-tmp-unselected ?d)
1204 (?u gnus-tmp-user-defined ?s)
1205 (?d (length gnus-newsgroup-dormant) ?d)
1206 (?t (length gnus-newsgroup-marked) ?d)
1207 (?h (length gnus-newsgroup-spam-marked) ?d)
1208 (?r (length gnus-newsgroup-reads) ?d)
1209 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1210 (?E gnus-newsgroup-expunged-tally ?d)
1211 (?s (gnus-current-score-file-nondirectory) ?s)))
1213 (defvar gnus-last-search-regexp nil
1214 "Default regexp for article search command.")
1216 (defvar gnus-last-shell-command nil
1217 "Default shell command on article.")
1219 (defvar gnus-newsgroup-agentized nil
1220 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1221 (defvar gnus-newsgroup-begin nil)
1222 (defvar gnus-newsgroup-end nil)
1223 (defvar gnus-newsgroup-last-rmail nil)
1224 (defvar gnus-newsgroup-last-mail nil)
1225 (defvar gnus-newsgroup-last-folder nil)
1226 (defvar gnus-newsgroup-last-file nil)
1227 (defvar gnus-newsgroup-auto-expire nil)
1228 (defvar gnus-newsgroup-active nil)
1230 (defvar gnus-newsgroup-data nil)
1231 (defvar gnus-newsgroup-data-reverse nil)
1232 (defvar gnus-newsgroup-limit nil)
1233 (defvar gnus-newsgroup-limits nil)
1234 (defvar gnus-summary-use-undownloaded-faces nil)
1236 (defvar gnus-newsgroup-unreads nil
1237 "Sorted list of unread articles in the current newsgroup.")
1239 (defvar gnus-newsgroup-unselected nil
1240 "Sorted list of unselected unread articles in the current newsgroup.")
1242 (defvar gnus-newsgroup-reads nil
1243 "Alist of read articles and article marks in the current newsgroup.")
1245 (defvar gnus-newsgroup-expunged-tally nil)
1247 (defvar gnus-newsgroup-marked nil
1248 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1250 (defvar gnus-newsgroup-spam-marked nil
1251 "List of ranges of articles that have been marked as spam.")
1253 (defvar gnus-newsgroup-killed nil
1254 "List of ranges of articles that have been through the scoring process.")
1256 (defvar gnus-newsgroup-cached nil
1257 "Sorted list of articles that come from the article cache.")
1259 (defvar gnus-newsgroup-saved nil
1260 "List of articles that have been saved.")
1262 (defvar gnus-newsgroup-kill-headers nil)
1264 (defvar gnus-newsgroup-replied nil
1265 "List of articles that have been replied to in the current newsgroup.")
1267 (defvar gnus-newsgroup-forwarded nil
1268 "List of articles that have been forwarded in the current newsgroup.")
1270 (defvar gnus-newsgroup-recent nil
1271 "List of articles that have are recent in the current newsgroup.")
1273 (defvar gnus-newsgroup-expirable nil
1274 "Sorted list of articles in the current newsgroup that can be expired.")
1276 (defvar gnus-newsgroup-processable nil
1277 "List of articles in the current newsgroup that can be processed.")
1279 (defvar gnus-newsgroup-downloadable nil
1280 "Sorted list of articles in the current newsgroup that can be processed.")
1282 (defvar gnus-newsgroup-unfetched nil
1283 "Sorted list of articles in the current newsgroup whose headers have
1284 not been fetched into the agent.
1286 This list will always be a subset of gnus-newsgroup-undownloaded.")
1288 (defvar gnus-newsgroup-undownloaded nil
1289 "List of articles in the current newsgroup that haven't been downloaded.")
1291 (defvar gnus-newsgroup-unsendable nil
1292 "List of articles in the current newsgroup that won't be sent.")
1294 (defvar gnus-newsgroup-bookmarks nil
1295 "List of articles in the current newsgroup that have bookmarks.")
1297 (defvar gnus-newsgroup-dormant nil
1298 "Sorted list of dormant articles in the current newsgroup.")
1300 (defvar gnus-newsgroup-unseen nil
1301 "List of unseen articles in the current newsgroup.")
1303 (defvar gnus-newsgroup-seen nil
1304 "Range of seen articles in the current newsgroup.")
1306 (defvar gnus-newsgroup-articles nil
1307 "List of articles in the current newsgroup.")
1309 (defvar gnus-newsgroup-scored nil
1310 "List of scored articles in the current newsgroup.")
1312 (defvar gnus-newsgroup-headers nil
1313 "List of article headers in the current newsgroup.")
1315 (defvar gnus-newsgroup-threads nil)
1317 (defvar gnus-newsgroup-prepared nil
1318 "Whether the current group has been prepared properly.")
1320 (defvar gnus-newsgroup-ancient nil
1321 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1323 (defvar gnus-newsgroup-sparse nil)
1325 (defvar gnus-current-article nil)
1326 (defvar gnus-article-current nil)
1327 (defvar gnus-current-headers nil)
1328 (defvar gnus-have-all-headers nil)
1329 (defvar gnus-last-article nil)
1330 (defvar gnus-newsgroup-history nil)
1331 (defvar gnus-newsgroup-charset nil)
1332 (defvar gnus-newsgroup-ephemeral-charset nil)
1333 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1335 (defvar gnus-article-before-search nil)
1337 (defvar gnus-summary-local-variables
1338 '(gnus-newsgroup-name
1339 gnus-newsgroup-begin gnus-newsgroup-end
1340 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1341 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1342 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1343 gnus-newsgroup-unselected gnus-newsgroup-marked
1344 gnus-newsgroup-spam-marked
1345 gnus-newsgroup-reads gnus-newsgroup-saved
1346 gnus-newsgroup-replied gnus-newsgroup-forwarded
1347 gnus-newsgroup-recent
1348 gnus-newsgroup-expirable
1349 gnus-newsgroup-processable gnus-newsgroup-killed
1350 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1351 gnus-newsgroup-unfetched
1352 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1353 gnus-newsgroup-seen gnus-newsgroup-articles
1354 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1355 gnus-newsgroup-headers gnus-newsgroup-threads
1356 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1357 gnus-current-article gnus-current-headers gnus-have-all-headers
1358 gnus-last-article gnus-article-internal-prepare-hook
1359 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1360 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1361 gnus-thread-expunge-below
1362 gnus-score-alist gnus-current-score-file
1363 (gnus-summary-expunge-below . global)
1364 (gnus-summary-mark-below . global)
1365 (gnus-orphan-score . global)
1366 gnus-newsgroup-active gnus-scores-exclude-files
1367 gnus-newsgroup-history gnus-newsgroup-ancient
1368 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1369 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1370 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1371 (gnus-newsgroup-expunged-tally . 0)
1372 gnus-cache-removable-articles gnus-newsgroup-cached
1373 gnus-newsgroup-data gnus-newsgroup-data-reverse
1374 gnus-newsgroup-limit gnus-newsgroup-limits
1375 gnus-newsgroup-charset gnus-newsgroup-display
1376 gnus-summary-use-undownloaded-faces)
1377 "Variables that are buffer-local to the summary buffers.")
1379 (defvar gnus-newsgroup-variables nil
1380 "A list of variables that have separate values in different newsgroups.
1381 A list of newsgroup (summary buffer) local variables, or cons of
1382 variables and their default values (when the default values are not
1383 nil), that should be made global while the summary buffer is active.
1384 These variables can be used to set variables in the group parameters
1385 while still allowing them to affect operations done in other
1386 buffers. For example:
1388 \(setq gnus-newsgroup-variables
1389 '(message-use-followup-to
1390 (gnus-visible-headers .
1391 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1394 ;; Byte-compiler warning.
1396 ;; Bind features so that require will believe that gnus-sum has
1397 ;; already been loaded (avoids infinite recursion)
1398 (let ((features (cons 'gnus-sum features)))
1399 ;; Several of the declarations in gnus-sum are needed to load the
1400 ;; following files. Right now, these definitions have been
1401 ;; compiled but not defined (evaluated). We could either do a
1402 ;; eval-and-compile about all of the declarations or evaluate the
1404 (if (boundp 'gnus-newsgroup-variables)
1406 (load "gnus-sum.el" t t t))
1408 (require 'gnus-agent)
1409 (require 'gnus-art)))
1413 (defvar gnus-decode-encoded-word-methods
1414 '(mail-decode-encoded-word-string)
1415 "List of methods used to decode encoded words.
1417 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1418 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1419 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1420 whose names match REGEXP.
1423 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1424 mail-decode-encoded-word-string
1425 (\"chinese\" . rfc1843-decode-string))")
1427 (defvar gnus-decode-encoded-word-methods-cache nil)
1429 (defun gnus-multi-decode-encoded-word-string (string)
1430 "Apply the functions from `gnus-encoded-word-methods' that match."
1431 (unless (and gnus-decode-encoded-word-methods-cache
1432 (eq gnus-newsgroup-name
1433 (car gnus-decode-encoded-word-methods-cache)))
1434 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1437 (nconc gnus-decode-encoded-word-methods-cache (list x))
1438 (if (and gnus-newsgroup-name
1439 (string-match (car x) gnus-newsgroup-name))
1440 (nconc gnus-decode-encoded-word-methods-cache
1442 gnus-decode-encoded-word-methods))
1443 (let ((xlist gnus-decode-encoded-word-methods-cache))
1446 (setq string (funcall (pop xlist) string))))
1449 ;; Subject simplification.
1451 (defun gnus-simplify-whitespace (str)
1452 "Remove excessive whitespace from STR."
1454 (while (string-match "[ \t][ \t]+" str)
1455 (setq str (concat (substring str 0 (match-beginning 0))
1457 (substring str (match-end 0)))))
1459 (when (string-match "^[ \t]+" str)
1460 (setq str (substring str (match-end 0))))
1462 (when (string-match "[ \t]+$" str)
1463 (setq str (substring str 0 (match-beginning 0))))
1466 (defun gnus-simplify-all-whitespace (str)
1467 "Remove all whitespace from STR."
1468 (while (string-match "[ \t\n]+" str)
1469 (setq str (replace-match "" nil nil str)))
1472 (defsubst gnus-simplify-subject-re (subject)
1473 "Remove \"Re:\" from subject lines."
1474 (if (string-match message-subject-re-regexp subject)
1475 (substring subject (match-end 0))
1478 (defun gnus-simplify-subject (subject &optional re-only)
1479 "Remove `Re:' and words in parentheses.
1480 If RE-ONLY is non-nil, strip leading `Re:'s only."
1481 (let ((case-fold-search t)) ;Ignore case.
1482 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1483 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1484 (setq subject (substring subject (match-end 0))))
1485 ;; Remove uninteresting prefixes.
1486 (when (and (not re-only)
1487 gnus-simplify-ignored-prefixes
1488 (string-match gnus-simplify-ignored-prefixes subject))
1489 (setq subject (substring subject (match-end 0))))
1490 ;; Remove words in parentheses from end.
1492 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1493 (setq subject (substring subject 0 (match-beginning 0)))))
1494 ;; Return subject string.
1497 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1499 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1500 (goto-char (point-min))
1501 (while (re-search-forward regexp nil t)
1502 (replace-match (or newtext ""))))
1504 (defun gnus-simplify-buffer-fuzzy ()
1505 "Simplify string in the buffer fuzzily.
1506 The string in the accessible portion of the current buffer is simplified.
1507 It is assumed to be a single-line subject.
1508 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1509 matter is removed. Additional things can be deleted by setting
1510 `gnus-simplify-subject-fuzzy-regexp'."
1511 (let ((case-fold-search t)
1513 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1515 (while (not (eq modified-tick (buffer-modified-tick)))
1516 (setq modified-tick (buffer-modified-tick))
1518 ((listp gnus-simplify-subject-fuzzy-regexp)
1519 (mapcar 'gnus-simplify-buffer-fuzzy-step
1520 gnus-simplify-subject-fuzzy-regexp))
1521 (gnus-simplify-subject-fuzzy-regexp
1522 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1523 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1524 (gnus-simplify-buffer-fuzzy-step
1525 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1526 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1528 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1529 (gnus-simplify-buffer-fuzzy-step " +" " ")
1530 (gnus-simplify-buffer-fuzzy-step " $")
1531 (gnus-simplify-buffer-fuzzy-step "^ +")))
1533 (defun gnus-simplify-subject-fuzzy (subject)
1534 "Simplify a subject string fuzzily.
1535 See `gnus-simplify-buffer-fuzzy' for details."
1537 (gnus-set-work-buffer)
1538 (let ((case-fold-search t))
1539 ;; Remove uninteresting prefixes.
1540 (when (and gnus-simplify-ignored-prefixes
1541 (string-match gnus-simplify-ignored-prefixes subject))
1542 (setq subject (substring subject (match-end 0))))
1544 (inline (gnus-simplify-buffer-fuzzy))
1547 (defsubst gnus-simplify-subject-fully (subject)
1548 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1550 (gnus-simplify-subject-functions
1551 (gnus-map-function gnus-simplify-subject-functions subject))
1552 ((null gnus-summary-gather-subject-limit)
1553 (gnus-simplify-subject-re subject))
1554 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1555 (gnus-simplify-subject-fuzzy subject))
1556 ((numberp gnus-summary-gather-subject-limit)
1557 (gnus-limit-string (gnus-simplify-subject-re subject)
1558 gnus-summary-gather-subject-limit))
1562 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1563 "Check whether two subjects are equal.
1564 If optional argument SIMPLE-FIRST is t, first argument is already
1567 ((null simple-first)
1568 (equal (gnus-simplify-subject-fully s1)
1569 (gnus-simplify-subject-fully s2)))
1572 (gnus-simplify-subject-fully s2)))))
1574 (defun gnus-summary-bubble-group ()
1575 "Increase the score of the current group.
1576 This is a handy function to add to `gnus-summary-exit-hook' to
1577 increase the score of each group you read."
1578 (gnus-group-add-score gnus-newsgroup-name))
1582 ;;; Gnus summary mode
1585 (put 'gnus-summary-mode 'mode-class 'special)
1587 (defvar gnus-article-commands-menu)
1589 ;; Non-orthogonal keys
1591 (gnus-define-keys gnus-summary-mode-map
1592 " " gnus-summary-next-page
1593 "\177" gnus-summary-prev-page
1594 [delete] gnus-summary-prev-page
1595 [backspace] gnus-summary-prev-page
1596 "\r" gnus-summary-scroll-up
1597 "\M-\r" gnus-summary-scroll-down
1598 "n" gnus-summary-next-unread-article
1599 "p" gnus-summary-prev-unread-article
1600 "N" gnus-summary-next-article
1601 "P" gnus-summary-prev-article
1602 "\M-\C-n" gnus-summary-next-same-subject
1603 "\M-\C-p" gnus-summary-prev-same-subject
1604 "\M-n" gnus-summary-next-unread-subject
1605 "\M-p" gnus-summary-prev-unread-subject
1606 "." gnus-summary-first-unread-article
1607 "," gnus-summary-best-unread-article
1608 "\M-s" gnus-summary-search-article-forward
1609 "\M-r" gnus-summary-search-article-backward
1610 "<" gnus-summary-beginning-of-article
1611 ">" gnus-summary-end-of-article
1612 "j" gnus-summary-goto-article
1613 "^" gnus-summary-refer-parent-article
1614 "\M-^" gnus-summary-refer-article
1615 "u" gnus-summary-tick-article-forward
1616 "!" gnus-summary-tick-article-forward
1617 "U" gnus-summary-tick-article-backward
1618 "d" gnus-summary-mark-as-read-forward
1619 "D" gnus-summary-mark-as-read-backward
1620 "E" gnus-summary-mark-as-expirable
1621 "\M-u" gnus-summary-clear-mark-forward
1622 "\M-U" gnus-summary-clear-mark-backward
1623 "k" gnus-summary-kill-same-subject-and-select
1624 "\C-k" gnus-summary-kill-same-subject
1625 "\M-\C-k" gnus-summary-kill-thread
1626 "\M-\C-l" gnus-summary-lower-thread
1627 "e" gnus-summary-edit-article
1628 "#" gnus-summary-mark-as-processable
1629 "\M-#" gnus-summary-unmark-as-processable
1630 "\M-\C-t" gnus-summary-toggle-threads
1631 "\M-\C-s" gnus-summary-show-thread
1632 "\M-\C-h" gnus-summary-hide-thread
1633 "\M-\C-f" gnus-summary-next-thread
1634 "\M-\C-b" gnus-summary-prev-thread
1635 [(meta down)] gnus-summary-next-thread
1636 [(meta up)] gnus-summary-prev-thread
1637 "\M-\C-u" gnus-summary-up-thread
1638 "\M-\C-d" gnus-summary-down-thread
1639 "&" gnus-summary-execute-command
1640 "c" gnus-summary-catchup-and-exit
1641 "\C-w" gnus-summary-mark-region-as-read
1642 "\C-t" gnus-summary-toggle-truncation
1643 "?" gnus-summary-mark-as-dormant
1644 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1645 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1646 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1647 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1648 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1649 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1650 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1651 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1652 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1653 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1654 "=" gnus-summary-expand-window
1655 "\C-x\C-s" gnus-summary-reselect-current-group
1656 "\M-g" gnus-summary-rescan-group
1657 "w" gnus-summary-stop-page-breaking
1658 "\C-c\C-r" gnus-summary-caesar-message
1659 "f" gnus-summary-followup
1660 "F" gnus-summary-followup-with-original
1661 "C" gnus-summary-cancel-article
1662 "r" gnus-summary-reply
1663 "R" gnus-summary-reply-with-original
1664 "\C-c\C-f" gnus-summary-mail-forward
1665 "o" gnus-summary-save-article
1666 "\C-o" gnus-summary-save-article-mail
1667 "|" gnus-summary-pipe-output
1668 "\M-k" gnus-summary-edit-local-kill
1669 "\M-K" gnus-summary-edit-global-kill
1671 "\C-c\C-d" gnus-summary-describe-group
1672 "q" gnus-summary-exit
1673 "Q" gnus-summary-exit-no-update
1674 "\C-c\C-i" gnus-info-find-node
1675 gnus-mouse-2 gnus-mouse-pick-article
1676 "m" gnus-summary-mail-other-window
1677 "a" gnus-summary-post-news
1678 "i" gnus-summary-news-other-window
1679 "x" gnus-summary-limit-to-unread
1680 "s" gnus-summary-isearch-article
1681 "t" gnus-summary-toggle-header
1682 "g" gnus-summary-show-article
1683 "l" gnus-summary-goto-last-article
1684 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1685 "\C-d" gnus-summary-enter-digest-group
1686 "\M-\C-d" gnus-summary-read-document
1687 "\M-\C-e" gnus-summary-edit-parameters
1688 "\M-\C-a" gnus-summary-customize-parameters
1690 "*" gnus-cache-enter-article
1691 "\M-*" gnus-cache-remove-article
1692 "\M-&" gnus-summary-universal-argument
1693 "\C-l" gnus-recenter
1694 "I" gnus-summary-increase-score
1695 "L" gnus-summary-lower-score
1696 "\M-i" gnus-symbolic-argument
1697 "h" gnus-summary-select-article-buffer
1699 "b" gnus-article-view-part
1700 "\M-t" gnus-summary-toggle-display-buttonized
1702 "V" gnus-summary-score-map
1703 "X" gnus-uu-extract-map
1704 "S" gnus-summary-send-map)
1706 ;; Sort of orthogonal keymap
1707 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1708 "t" gnus-summary-tick-article-forward
1709 "!" gnus-summary-tick-article-forward
1710 "d" gnus-summary-mark-as-read-forward
1711 "r" gnus-summary-mark-as-read-forward
1712 "c" gnus-summary-clear-mark-forward
1713 " " gnus-summary-clear-mark-forward
1714 "e" gnus-summary-mark-as-expirable
1715 "x" gnus-summary-mark-as-expirable
1716 "?" gnus-summary-mark-as-dormant
1717 "b" gnus-summary-set-bookmark
1718 "B" gnus-summary-remove-bookmark
1719 "#" gnus-summary-mark-as-processable
1720 "\M-#" gnus-summary-unmark-as-processable
1721 "S" gnus-summary-limit-include-expunged
1722 "C" gnus-summary-catchup
1723 "H" gnus-summary-catchup-to-here
1724 "h" gnus-summary-catchup-from-here
1725 "\C-c" gnus-summary-catchup-all
1726 "k" gnus-summary-kill-same-subject-and-select
1727 "K" gnus-summary-kill-same-subject
1728 "P" gnus-uu-mark-map)
1730 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1731 "c" gnus-summary-clear-above
1732 "u" gnus-summary-tick-above
1733 "m" gnus-summary-mark-above
1734 "k" gnus-summary-kill-below)
1736 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1737 "/" gnus-summary-limit-to-subject
1738 "n" gnus-summary-limit-to-articles
1739 "w" gnus-summary-pop-limit
1740 "s" gnus-summary-limit-to-subject
1741 "a" gnus-summary-limit-to-author
1742 "u" gnus-summary-limit-to-unread
1743 "m" gnus-summary-limit-to-marks
1744 "M" gnus-summary-limit-exclude-marks
1745 "v" gnus-summary-limit-to-score
1746 "*" gnus-summary-limit-include-cached
1747 "D" gnus-summary-limit-include-dormant
1748 "T" gnus-summary-limit-include-thread
1749 "d" gnus-summary-limit-exclude-dormant
1750 "t" gnus-summary-limit-to-age
1751 "." gnus-summary-limit-to-unseen
1752 "x" gnus-summary-limit-to-extra
1753 "p" gnus-summary-limit-to-display-predicate
1754 "E" gnus-summary-limit-include-expunged
1755 "c" gnus-summary-limit-exclude-childless-dormant
1756 "C" gnus-summary-limit-mark-excluded-as-read
1757 "o" gnus-summary-insert-old-articles
1758 "N" gnus-summary-insert-new-articles
1759 "r" gnus-summary-limit-to-replied)
1761 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1762 "n" gnus-summary-next-unread-article
1763 "p" gnus-summary-prev-unread-article
1764 "N" gnus-summary-next-article
1765 "P" gnus-summary-prev-article
1766 "\C-n" gnus-summary-next-same-subject
1767 "\C-p" gnus-summary-prev-same-subject
1768 "\M-n" gnus-summary-next-unread-subject
1769 "\M-p" gnus-summary-prev-unread-subject
1770 "f" gnus-summary-first-unread-article
1771 "b" gnus-summary-best-unread-article
1772 "j" gnus-summary-goto-article
1773 "g" gnus-summary-goto-subject
1774 "l" gnus-summary-goto-last-article
1775 "o" gnus-summary-pop-article)
1777 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1778 "k" gnus-summary-kill-thread
1779 "l" gnus-summary-lower-thread
1780 "i" gnus-summary-raise-thread
1781 "T" gnus-summary-toggle-threads
1782 "t" gnus-summary-rethread-current
1783 "^" gnus-summary-reparent-thread
1784 "s" gnus-summary-show-thread
1785 "S" gnus-summary-show-all-threads
1786 "h" gnus-summary-hide-thread
1787 "H" gnus-summary-hide-all-threads
1788 "n" gnus-summary-next-thread
1789 "p" gnus-summary-prev-thread
1790 "u" gnus-summary-up-thread
1791 "o" gnus-summary-top-thread
1792 "d" gnus-summary-down-thread
1793 "#" gnus-uu-mark-thread
1794 "\M-#" gnus-uu-unmark-thread)
1796 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1797 "g" gnus-summary-prepare
1798 "c" gnus-summary-insert-cached-articles
1799 "d" gnus-summary-insert-dormant-articles)
1801 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1802 "c" gnus-summary-catchup-and-exit
1803 "C" gnus-summary-catchup-all-and-exit
1804 "E" gnus-summary-exit-no-update
1805 "Q" gnus-summary-exit
1806 "Z" gnus-summary-exit
1807 "n" gnus-summary-catchup-and-goto-next-group
1808 "R" gnus-summary-reselect-current-group
1809 "G" gnus-summary-rescan-group
1810 "N" gnus-summary-next-group
1811 "s" gnus-summary-save-newsrc
1812 "P" gnus-summary-prev-group)
1814 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1815 " " gnus-summary-next-page
1816 "n" gnus-summary-next-page
1817 "\177" gnus-summary-prev-page
1818 [delete] gnus-summary-prev-page
1819 "p" gnus-summary-prev-page
1820 "\r" gnus-summary-scroll-up
1821 "\M-\r" gnus-summary-scroll-down
1822 "<" gnus-summary-beginning-of-article
1823 ">" gnus-summary-end-of-article
1824 "b" gnus-summary-beginning-of-article
1825 "e" gnus-summary-end-of-article
1826 "^" gnus-summary-refer-parent-article
1827 "r" gnus-summary-refer-parent-article
1828 "D" gnus-summary-enter-digest-group
1829 "R" gnus-summary-refer-references
1830 "T" gnus-summary-refer-thread
1831 "g" gnus-summary-show-article
1832 "s" gnus-summary-isearch-article
1833 "P" gnus-summary-print-article
1834 "M" gnus-mailing-list-insinuate
1835 "t" gnus-article-babel)
1837 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1838 "b" gnus-article-add-buttons
1839 "B" gnus-article-add-buttons-to-head
1840 "o" gnus-article-treat-overstrike
1841 "e" gnus-article-emphasize
1842 "w" gnus-article-fill-cited-article
1843 "Q" gnus-article-fill-long-lines
1844 "C" gnus-article-capitalize-sentences
1845 "c" gnus-article-remove-cr
1846 "q" gnus-article-de-quoted-unreadable
1847 "6" gnus-article-de-base64-unreadable
1848 "Z" gnus-article-decode-HZ
1849 "A" gnus-article-treat-ansi-sequences
1850 "h" gnus-article-wash-html
1851 "u" gnus-article-unsplit-urls
1852 "s" gnus-summary-force-verify-and-decrypt
1853 "f" gnus-article-display-x-face
1854 "l" gnus-summary-stop-page-breaking
1855 "r" gnus-summary-caesar-message
1856 "m" gnus-summary-morse-message
1857 "t" gnus-summary-toggle-header
1858 "g" gnus-treat-smiley
1859 "v" gnus-summary-verbose-headers
1860 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1861 "p" gnus-article-verify-x-pgp-sig
1862 "d" gnus-article-treat-dumbquotes)
1864 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1865 ;; mnemonic: deuglif*Y*
1866 "u" gnus-article-outlook-unwrap-lines
1867 "a" gnus-article-outlook-repair-attribution
1868 "c" gnus-article-outlook-rearrange-citation
1869 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1871 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1872 "a" gnus-article-hide
1873 "h" gnus-article-hide-headers
1874 "b" gnus-article-hide-boring-headers
1875 "s" gnus-article-hide-signature
1876 "c" gnus-article-hide-citation
1877 "C" gnus-article-hide-citation-in-followups
1878 "l" gnus-article-hide-list-identifiers
1879 "B" gnus-article-strip-banner
1880 "P" gnus-article-hide-pem
1881 "\C-c" gnus-article-hide-citation-maybe)
1883 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1884 "a" gnus-article-highlight
1885 "h" gnus-article-highlight-headers
1886 "c" gnus-article-highlight-citation
1887 "s" gnus-article-highlight-signature)
1889 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1890 "f" gnus-article-treat-fold-headers
1891 "u" gnus-article-treat-unfold-headers
1892 "n" gnus-article-treat-fold-newsgroups)
1894 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1895 "x" gnus-article-display-x-face
1896 "d" gnus-article-display-face
1897 "s" gnus-treat-smiley
1898 "D" gnus-article-remove-images
1899 "f" gnus-treat-from-picon
1900 "m" gnus-treat-mail-picon
1901 "n" gnus-treat-newsgroups-picon)
1903 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1904 "w" gnus-article-decode-mime-words
1905 "c" gnus-article-decode-charset
1906 "v" gnus-mime-view-all-parts
1907 "b" gnus-article-view-part)
1909 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1910 "z" gnus-article-date-ut
1911 "u" gnus-article-date-ut
1912 "l" gnus-article-date-local
1913 "p" gnus-article-date-english
1914 "e" gnus-article-date-lapsed
1915 "o" gnus-article-date-original
1916 "i" gnus-article-date-iso8601
1917 "s" gnus-article-date-user)
1919 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1920 "t" gnus-article-remove-trailing-blank-lines
1921 "l" gnus-article-strip-leading-blank-lines
1922 "m" gnus-article-strip-multiple-blank-lines
1923 "a" gnus-article-strip-blank-lines
1924 "A" gnus-article-strip-all-blank-lines
1925 "s" gnus-article-strip-leading-space
1926 "e" gnus-article-strip-trailing-space
1927 "w" gnus-article-remove-leading-whitespace)
1929 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1931 "f" gnus-summary-fetch-faq
1932 "d" gnus-summary-describe-group
1933 "h" gnus-summary-describe-briefly
1934 "i" gnus-info-find-node
1935 "c" gnus-group-fetch-charter
1936 "C" gnus-group-fetch-control)
1938 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1939 "e" gnus-summary-expire-articles
1940 "\M-\C-e" gnus-summary-expire-articles-now
1941 "\177" gnus-summary-delete-article
1942 [delete] gnus-summary-delete-article
1943 [backspace] gnus-summary-delete-article
1944 "m" gnus-summary-move-article
1945 "r" gnus-summary-respool-article
1946 "w" gnus-summary-edit-article
1947 "c" gnus-summary-copy-article
1948 "B" gnus-summary-crosspost-article
1949 "q" gnus-summary-respool-query
1950 "t" gnus-summary-respool-trace
1951 "i" gnus-summary-import-article
1952 "I" gnus-summary-create-article
1953 "p" gnus-summary-article-posted-p)
1955 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1956 "o" gnus-summary-save-article
1957 "m" gnus-summary-save-article-mail
1958 "F" gnus-summary-write-article-file
1959 "r" gnus-summary-save-article-rmail
1960 "f" gnus-summary-save-article-file
1961 "b" gnus-summary-save-article-body-file
1962 "h" gnus-summary-save-article-folder
1963 "v" gnus-summary-save-article-vm
1964 "p" gnus-summary-pipe-output
1965 "P" gnus-summary-muttprint
1966 "s" gnus-soup-add-article)
1968 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1969 "b" gnus-summary-display-buttonized
1970 "m" gnus-summary-repair-multipart
1971 "v" gnus-article-view-part
1972 "o" gnus-article-save-part
1973 "c" gnus-article-copy-part
1974 "C" gnus-article-view-part-as-charset
1975 "e" gnus-article-view-part-externally
1976 "E" gnus-article-encrypt-body
1977 "i" gnus-article-inline-part
1978 "|" gnus-article-pipe-part)
1980 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1981 "p" gnus-summary-mark-as-processable
1982 "u" gnus-summary-unmark-as-processable
1983 "U" gnus-summary-unmark-all-processable
1984 "v" gnus-uu-mark-over
1985 "s" gnus-uu-mark-series
1986 "r" gnus-uu-mark-region
1987 "g" gnus-uu-unmark-region
1988 "R" gnus-uu-mark-by-regexp
1989 "G" gnus-uu-unmark-by-regexp
1990 "t" gnus-uu-mark-thread
1991 "T" gnus-uu-unmark-thread
1992 "a" gnus-uu-mark-all
1993 "b" gnus-uu-mark-buffer
1994 "S" gnus-uu-mark-sparse
1995 "k" gnus-summary-kill-process-mark
1996 "y" gnus-summary-yank-process-mark
1997 "w" gnus-summary-save-process-mark
1998 "i" gnus-uu-invert-processable)
2000 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2001 ;;"x" gnus-uu-extract-any
2002 "m" gnus-summary-save-parts
2003 "u" gnus-uu-decode-uu
2004 "U" gnus-uu-decode-uu-and-save
2005 "s" gnus-uu-decode-unshar
2006 "S" gnus-uu-decode-unshar-and-save
2007 "o" gnus-uu-decode-save
2008 "O" gnus-uu-decode-save
2009 "b" gnus-uu-decode-binhex
2010 "B" gnus-uu-decode-binhex
2011 "p" gnus-uu-decode-postscript
2012 "P" gnus-uu-decode-postscript-and-save)
2015 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2016 "u" gnus-uu-decode-uu-view
2017 "U" gnus-uu-decode-uu-and-save-view
2018 "s" gnus-uu-decode-unshar-view
2019 "S" gnus-uu-decode-unshar-and-save-view
2020 "o" gnus-uu-decode-save-view
2021 "O" gnus-uu-decode-save-view
2022 "b" gnus-uu-decode-binhex-view
2023 "B" gnus-uu-decode-binhex-view
2024 "p" gnus-uu-decode-postscript-view
2025 "P" gnus-uu-decode-postscript-and-save-view)
2027 (defvar gnus-article-post-menu nil)
2029 (defconst gnus-summary-menu-maxlen 20)
2031 (defun gnus-summary-menu-split (menu)
2032 ;; If we have lots of elements, divide them into groups of 20
2033 ;; and make a pane (or submenu) for each one.
2034 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2035 (let ((menu menu) sublists next
2038 ;; Pull off the next gnus-summary-menu-maxlen elements
2039 ;; and make them the next element of sublist.
2040 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2042 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2044 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2045 (aref (car (last menu)) 0)) menu)
2049 (nreverse sublists))
2050 ;; Few elements--put them all in one pane.
2053 (defun gnus-summary-make-menu-bar ()
2054 (gnus-turn-off-edit-menu 'summary)
2056 (unless (boundp 'gnus-summary-misc-menu)
2059 gnus-summary-kill-menu gnus-summary-mode-map ""
2064 ["Customize" gnus-score-customize t])
2065 (gnus-make-score-map 'increase)
2066 (gnus-make-score-map 'lower)
2068 ["Kill below" gnus-summary-kill-below t]
2069 ["Mark above" gnus-summary-mark-above t]
2070 ["Tick above" gnus-summary-tick-above t]
2071 ["Clear above" gnus-summary-clear-above t])
2072 ["Current score" gnus-summary-current-score t]
2073 ["Set score" gnus-summary-set-score t]
2074 ["Switch current score file..." gnus-score-change-score-file t]
2075 ["Set mark below..." gnus-score-set-mark-below t]
2076 ["Set expunge below..." gnus-score-set-expunge-below t]
2077 ["Edit current score file" gnus-score-edit-current-scores t]
2078 ["Edit score file" gnus-score-edit-file t]
2079 ["Trace score" gnus-score-find-trace t]
2080 ["Find words" gnus-score-find-favourite-words t]
2081 ["Rescore buffer" gnus-summary-rescore t]
2082 ["Increase score..." gnus-summary-increase-score t]
2083 ["Lower score..." gnus-summary-lower-score t]))))
2085 ;; Define both the Article menu in the summary buffer and the
2086 ;; equivalent Commands menu in the article buffer here for
2090 ["All" gnus-article-hide t]
2091 ["Headers" gnus-article-hide-headers t]
2092 ["Signature" gnus-article-hide-signature t]
2093 ["Citation" gnus-article-hide-citation t]
2094 ["List identifiers" gnus-article-hide-list-identifiers t]
2095 ["Banner" gnus-article-strip-banner t]
2096 ["Boring headers" gnus-article-hide-boring-headers t])
2098 ["All" gnus-article-highlight t]
2099 ["Headers" gnus-article-highlight-headers t]
2100 ["Signature" gnus-article-highlight-signature t]
2101 ["Citation" gnus-article-highlight-citation t])
2103 ["Words" gnus-article-decode-mime-words t]
2104 ["Charset" gnus-article-decode-charset t]
2105 ["QP" gnus-article-de-quoted-unreadable t]
2106 ["Base64" gnus-article-de-base64-unreadable t]
2107 ["View MIME buttons" gnus-summary-display-buttonized t]
2108 ["View all" gnus-mime-view-all-parts t]
2109 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2110 ["Encrypt body" gnus-article-encrypt-body
2111 :active (not (gnus-group-read-only-p))
2112 ,@(if (featurep 'xemacs) nil
2113 '(:help "Encrypt the message body on disk"))]
2114 ["Extract all parts..." gnus-summary-save-parts t]
2116 ["Repair multipart" gnus-summary-repair-multipart t]
2117 ["Pipe part..." gnus-article-pipe-part t]
2118 ["Inline part" gnus-article-inline-part t]
2119 ["Encrypt body" gnus-article-encrypt-body
2120 :active (not (gnus-group-read-only-p))
2121 ,@(if (featurep 'xemacs) nil
2122 '(:help "Encrypt the message body on disk"))]
2123 ["View part externally" gnus-article-view-part-externally t]
2124 ["View part with charset..." gnus-article-view-part-as-charset t]
2125 ["Copy part" gnus-article-copy-part t]
2126 ["Save part..." gnus-article-save-part t]
2127 ["View part" gnus-article-view-part t]))
2129 ["Local" gnus-article-date-local t]
2130 ["ISO8601" gnus-article-date-iso8601 t]
2131 ["UT" gnus-article-date-ut t]
2132 ["Original" gnus-article-date-original t]
2133 ["Lapsed" gnus-article-date-lapsed t]
2134 ["User-defined" gnus-article-date-user t])
2136 ["Remove images" gnus-article-remove-images t]
2137 ["Toggle smiley" gnus-treat-smiley t]
2138 ["Show X-Face" gnus-article-display-x-face t]
2139 ["Show picons in From" gnus-treat-from-picon t]
2140 ["Show picons in mail headers" gnus-treat-mail-picon t]
2141 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2142 ("View as different encoding"
2143 ,@(gnus-summary-menu-split
2146 ;; Since easymenu under Emacs doesn't allow
2147 ;; lambda forms for menu commands, we should
2148 ;; provide intern'ed function symbols.
2149 (let ((command (intern (format "\
2150 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2154 (let ((gnus-summary-show-article-charset-alist
2156 (gnus-summary-show-article 1))))
2157 `[,(symbol-name cs) ,command t]))
2158 (sort (if (fboundp 'coding-system-list)
2159 (coding-system-list)
2160 (mapcar 'car mm-mime-mule-charset-alist))
2164 ["Leading" gnus-article-strip-leading-blank-lines t]
2165 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2166 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2167 ["All of the above" gnus-article-strip-blank-lines t]
2168 ["All" gnus-article-strip-all-blank-lines t]
2169 ["Leading space" gnus-article-strip-leading-space t]
2170 ["Trailing space" gnus-article-strip-trailing-space t]
2171 ["Leading space in headers"
2172 gnus-article-remove-leading-whitespace t])
2173 ["Overstrike" gnus-article-treat-overstrike t]
2174 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2175 ["Emphasis" gnus-article-emphasize t]
2176 ["Word wrap" gnus-article-fill-cited-article t]
2177 ["Fill long lines" gnus-article-fill-long-lines t]
2178 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2179 ["Remove CR" gnus-article-remove-cr t]
2180 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2181 ["Base64" gnus-article-de-base64-unreadable t]
2182 ["Rot 13" gnus-summary-caesar-message
2183 ,@(if (featurep 'xemacs) '(t)
2184 '(:help "\"Caesar rotate\" article by 13"))]
2185 ["Morse decode" gnus-summary-morse-message t]
2186 ["Unix pipe..." gnus-summary-pipe-message t]
2187 ["Add buttons" gnus-article-add-buttons t]
2188 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2189 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2190 ["Verbose header" gnus-summary-verbose-headers t]
2191 ["Toggle header" gnus-summary-toggle-header t]
2192 ["Unfold headers" gnus-article-treat-unfold-headers t]
2193 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2194 ["Html" gnus-article-wash-html t]
2195 ["Unsplit URLs" gnus-article-unsplit-urls t]
2196 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2197 ["Decode HZ" gnus-article-decode-HZ t]
2198 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2199 ("(Outlook) Deuglify"
2200 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2201 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2202 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2203 ["Full (Outlook) deuglify"
2204 gnus-article-outlook-deuglify-article t])
2207 ["Save in default format..." gnus-summary-save-article
2208 ,@(if (featurep 'xemacs) '(t)
2209 '(:help "Save article using default method"))]
2210 ["Save in file..." gnus-summary-save-article-file
2211 ,@(if (featurep 'xemacs) '(t)
2212 '(:help "Save article in file"))]
2213 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2214 ["Save in MH folder..." gnus-summary-save-article-folder t]
2215 ["Save in VM folder..." gnus-summary-save-article-vm t]
2216 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2217 ["Save body in file..." gnus-summary-save-article-body-file t]
2218 ["Pipe through a filter..." gnus-summary-pipe-output t]
2219 ["Add to SOUP packet" gnus-soup-add-article t]
2220 ["Print with Muttprint..." gnus-summary-muttprint t]
2221 ["Print" gnus-summary-print-article t])
2223 ["Respool article..." gnus-summary-respool-article t]
2224 ["Move article..." gnus-summary-move-article
2225 (gnus-check-backend-function
2226 'request-move-article gnus-newsgroup-name)]
2227 ["Copy article..." gnus-summary-copy-article t]
2228 ["Crosspost article..." gnus-summary-crosspost-article
2229 (gnus-check-backend-function
2230 'request-replace-article gnus-newsgroup-name)]
2231 ["Import file..." gnus-summary-import-article
2232 (gnus-check-backend-function
2233 'request-accept-article gnus-newsgroup-name)]
2234 ["Create article..." gnus-summary-create-article
2235 (gnus-check-backend-function
2236 'request-accept-article gnus-newsgroup-name)]
2237 ["Check if posted" gnus-summary-article-posted-p t]
2238 ["Edit article" gnus-summary-edit-article
2239 (not (gnus-group-read-only-p))]
2240 ["Delete article" gnus-summary-delete-article
2241 (gnus-check-backend-function
2242 'request-expire-articles gnus-newsgroup-name)]
2243 ["Query respool" gnus-summary-respool-query t]
2244 ["Trace respool" gnus-summary-respool-trace t]
2245 ["Delete expirable articles" gnus-summary-expire-articles-now
2246 (gnus-check-backend-function
2247 'request-expire-articles gnus-newsgroup-name)])
2249 ["Uudecode" gnus-uu-decode-uu
2250 ,@(if (featurep 'xemacs) '(t)
2251 '(:help "Decode uuencoded article(s)"))]
2252 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2253 ["Unshar" gnus-uu-decode-unshar t]
2254 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2255 ["Save" gnus-uu-decode-save t]
2256 ["Binhex" gnus-uu-decode-binhex t]
2257 ["Postscript" gnus-uu-decode-postscript t]
2258 ["All MIME parts" gnus-summary-save-parts t])
2260 ["Enter article" gnus-cache-enter-article t]
2261 ["Remove article" gnus-cache-remove-article t])
2262 ["Translate" gnus-article-babel t]
2263 ["Select article buffer" gnus-summary-select-article-buffer t]
2264 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2265 ["Isearch article..." gnus-summary-isearch-article t]
2266 ["Beginning of the article" gnus-summary-beginning-of-article t]
2267 ["End of the article" gnus-summary-end-of-article t]
2268 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2269 ["Fetch referenced articles" gnus-summary-refer-references t]
2270 ["Fetch current thread" gnus-summary-refer-thread t]
2271 ["Fetch article with id..." gnus-summary-refer-article t]
2272 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2273 ["Redisplay" gnus-summary-show-article t]
2274 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2276 gnus-summary-article-menu gnus-summary-mode-map ""
2277 (cons "Article" innards))
2279 (if (not (keymapp gnus-summary-article-menu))
2281 gnus-article-commands-menu gnus-article-mode-map ""
2282 (cons "Commands" innards))
2283 ;; in Emacs, don't share menu.
2284 (setq gnus-article-commands-menu
2285 (copy-keymap gnus-summary-article-menu))
2286 (define-key gnus-article-mode-map [menu-bar commands]
2287 (cons "Commands" gnus-article-commands-menu))))
2290 gnus-summary-thread-menu gnus-summary-mode-map ""
2292 ["Find all messages in thread" gnus-summary-refer-thread t]
2293 ["Toggle threading" gnus-summary-toggle-threads t]
2294 ["Hide threads" gnus-summary-hide-all-threads t]
2295 ["Show threads" gnus-summary-show-all-threads t]
2296 ["Hide thread" gnus-summary-hide-thread t]
2297 ["Show thread" gnus-summary-show-thread t]
2298 ["Go to next thread" gnus-summary-next-thread t]
2299 ["Go to previous thread" gnus-summary-prev-thread t]
2300 ["Go down thread" gnus-summary-down-thread t]
2301 ["Go up thread" gnus-summary-up-thread t]
2302 ["Top of thread" gnus-summary-top-thread t]
2303 ["Mark thread as read" gnus-summary-kill-thread t]
2304 ["Lower thread score" gnus-summary-lower-thread t]
2305 ["Raise thread score" gnus-summary-raise-thread t]
2306 ["Rethread current" gnus-summary-rethread-current t]))
2309 gnus-summary-post-menu gnus-summary-mode-map ""
2311 ["Send a message (mail or news)" gnus-summary-post-news
2312 ,@(if (featurep 'xemacs) '(t)
2313 '(:help "Post an article"))]
2314 ["Followup" gnus-summary-followup
2315 ,@(if (featurep 'xemacs) '(t)
2316 '(:help "Post followup to this article"))]
2317 ["Followup and yank" gnus-summary-followup-with-original
2318 ,@(if (featurep 'xemacs) '(t)
2319 '(:help "Post followup to this article, quoting its contents"))]
2320 ["Supersede article" gnus-summary-supersede-article t]
2321 ["Cancel article" gnus-summary-cancel-article
2322 ,@(if (featurep 'xemacs) '(t)
2323 '(:help "Cancel an article you posted"))]
2324 ["Reply" gnus-summary-reply t]
2325 ["Reply and yank" gnus-summary-reply-with-original t]
2326 ["Wide reply" gnus-summary-wide-reply t]
2327 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2328 ,@(if (featurep 'xemacs) '(t)
2329 '(:help "Mail a reply, quoting this article"))]
2330 ["Very wide reply" gnus-summary-very-wide-reply t]
2331 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2332 ,@(if (featurep 'xemacs) '(t)
2333 '(:help "Mail a very wide reply, quoting this article"))]
2334 ["Mail forward" gnus-summary-mail-forward t]
2335 ["Post forward" gnus-summary-post-forward t]
2336 ["Digest and mail" gnus-uu-digest-mail-forward t]
2337 ["Digest and post" gnus-uu-digest-post-forward t]
2338 ["Resend message" gnus-summary-resend-message t]
2339 ["Resend message edit" gnus-summary-resend-message-edit t]
2340 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2341 ["Send a mail" gnus-summary-mail-other-window t]
2342 ["Create a local message" gnus-summary-news-other-window t]
2343 ["Uuencode and post" gnus-uu-post-news
2344 ,@(if (featurep 'xemacs) '(t)
2345 '(:help "Post a uuencoded article"))]
2346 ["Followup via news" gnus-summary-followup-to-mail t]
2347 ["Followup via news and yank"
2348 gnus-summary-followup-to-mail-with-original t]
2350 ;;["Send" gnus-summary-send-draft t]
2351 ;;["Send bounced" gnus-resend-bounced-mail t])
2355 ((not (keymapp gnus-summary-post-menu))
2356 (setq gnus-article-post-menu gnus-summary-post-menu))
2357 ((not gnus-article-post-menu)
2358 ;; Don't share post menu.
2359 (setq gnus-article-post-menu
2360 (copy-keymap gnus-summary-post-menu))))
2361 (define-key gnus-article-mode-map [menu-bar post]
2362 (cons "Post" gnus-article-post-menu))
2365 gnus-summary-misc-menu gnus-summary-mode-map ""
2368 ["Mark as read" gnus-summary-mark-as-read-forward t]
2369 ["Mark same subject and select"
2370 gnus-summary-kill-same-subject-and-select t]
2371 ["Mark same subject" gnus-summary-kill-same-subject t]
2372 ["Catchup" gnus-summary-catchup
2373 ,@(if (featurep 'xemacs) '(t)
2374 '(:help "Mark unread articles in this group as read"))]
2375 ["Catchup all" gnus-summary-catchup-all t]
2376 ["Catchup to here" gnus-summary-catchup-to-here t]
2377 ["Catchup from here" gnus-summary-catchup-from-here t]
2378 ["Catchup region" gnus-summary-mark-region-as-read
2379 (gnus-mark-active-p)]
2380 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2382 ["Tick" gnus-summary-tick-article-forward t]
2383 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2384 ["Remove marks" gnus-summary-clear-mark-forward t]
2385 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2386 ["Set bookmark" gnus-summary-set-bookmark t]
2387 ["Remove bookmark" gnus-summary-remove-bookmark t])
2389 ["Marks..." gnus-summary-limit-to-marks t]
2390 ["Subject..." gnus-summary-limit-to-subject t]
2391 ["Author..." gnus-summary-limit-to-author t]
2392 ["Age..." gnus-summary-limit-to-age t]
2393 ["Extra..." gnus-summary-limit-to-extra t]
2394 ["Score..." gnus-summary-limit-to-score t]
2395 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2396 ["Unread" gnus-summary-limit-to-unread t]
2397 ["Unseen" gnus-summary-limit-to-unseen t]
2398 ["Replied" gnus-summary-limit-to-replied t]
2399 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2400 ["Next articles" gnus-summary-limit-to-articles t]
2401 ["Pop limit" gnus-summary-pop-limit t]
2402 ["Show dormant" gnus-summary-limit-include-dormant t]
2403 ["Hide childless dormant"
2404 gnus-summary-limit-exclude-childless-dormant t]
2405 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2406 ["Hide marked" gnus-summary-limit-exclude-marks t]
2407 ["Show expunged" gnus-summary-limit-include-expunged t])
2409 ["Set mark" gnus-summary-mark-as-processable t]
2410 ["Remove mark" gnus-summary-unmark-as-processable t]
2411 ["Remove all marks" gnus-summary-unmark-all-processable t]
2412 ["Mark above" gnus-uu-mark-over t]
2413 ["Mark series" gnus-uu-mark-series t]
2414 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2415 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2416 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2417 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2418 ["Mark all" gnus-uu-mark-all t]
2419 ["Mark buffer" gnus-uu-mark-buffer t]
2420 ["Mark sparse" gnus-uu-mark-sparse t]
2421 ["Mark thread" gnus-uu-mark-thread t]
2422 ["Unmark thread" gnus-uu-unmark-thread t]
2423 ("Process Mark Sets"
2424 ["Kill" gnus-summary-kill-process-mark t]
2425 ["Yank" gnus-summary-yank-process-mark
2426 gnus-newsgroup-process-stack]
2427 ["Save" gnus-summary-save-process-mark t]
2428 ["Run command on marked..." gnus-summary-universal-argument t]))
2430 ["Page forward" gnus-summary-next-page
2431 ,@(if (featurep 'xemacs) '(t)
2432 '(:help "Show next page of article"))]
2433 ["Page backward" gnus-summary-prev-page
2434 ,@(if (featurep 'xemacs) '(t)
2435 '(:help "Show previous page of article"))]
2436 ["Line forward" gnus-summary-scroll-up t])
2438 ["Next unread article" gnus-summary-next-unread-article t]
2439 ["Previous unread article" gnus-summary-prev-unread-article t]
2440 ["Next article" gnus-summary-next-article t]
2441 ["Previous article" gnus-summary-prev-article t]
2442 ["Next unread subject" gnus-summary-next-unread-subject t]
2443 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2444 ["Next article same subject" gnus-summary-next-same-subject t]
2445 ["Previous article same subject" gnus-summary-prev-same-subject t]
2446 ["First unread article" gnus-summary-first-unread-article t]
2447 ["Best unread article" gnus-summary-best-unread-article t]
2448 ["Go to subject number..." gnus-summary-goto-subject t]
2449 ["Go to article number..." gnus-summary-goto-article t]
2450 ["Go to the last article" gnus-summary-goto-last-article t]
2451 ["Pop article off history" gnus-summary-pop-article t])
2453 ["Sort by number" gnus-summary-sort-by-number t]
2454 ["Sort by author" gnus-summary-sort-by-author t]
2455 ["Sort by subject" gnus-summary-sort-by-subject t]
2456 ["Sort by date" gnus-summary-sort-by-date t]
2457 ["Sort by score" gnus-summary-sort-by-score t]
2458 ["Sort by lines" gnus-summary-sort-by-lines t]
2459 ["Sort by characters" gnus-summary-sort-by-chars t]
2460 ["Randomize" gnus-summary-sort-by-random t]
2461 ["Original sort" gnus-summary-sort-by-original t])
2463 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2464 ["Describe group" gnus-summary-describe-group t]
2465 ["Fetch charter" gnus-group-fetch-charter
2466 ,@(if (featurep 'xemacs) nil
2467 '(:help "Display the charter of the current group"))]
2468 ["Fetch control message" gnus-group-fetch-control
2469 ,@(if (featurep 'xemacs) nil
2470 '(:help "Display the archived control message for the current group"))]
2471 ["Read manual" gnus-info-find-node t])
2473 ["Pick and read" gnus-pick-mode t]
2474 ["Binary" gnus-binary-mode t])
2476 ["Regenerate" gnus-summary-prepare t]
2477 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2478 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2479 ["Toggle threading" gnus-summary-toggle-threads t])
2480 ["See old articles" gnus-summary-insert-old-articles t]
2481 ["See new articles" gnus-summary-insert-new-articles t]
2482 ["Filter articles..." gnus-summary-execute-command t]
2483 ["Run command on articles..." gnus-summary-universal-argument t]
2484 ["Search articles forward..." gnus-summary-search-article-forward t]
2485 ["Search articles backward..." gnus-summary-search-article-backward t]
2486 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2487 ["Expand window" gnus-summary-expand-window t]
2488 ["Expire expirable articles" gnus-summary-expire-articles
2489 (gnus-check-backend-function
2490 'request-expire-articles gnus-newsgroup-name)]
2491 ["Edit local kill file" gnus-summary-edit-local-kill t]
2492 ["Edit main kill file" gnus-summary-edit-global-kill t]
2493 ["Edit group parameters" gnus-summary-edit-parameters t]
2494 ["Customize group parameters" gnus-summary-customize-parameters t]
2495 ["Send a bug report" gnus-bug t]
2497 ["Catchup and exit" gnus-summary-catchup-and-exit
2498 ,@(if (featurep 'xemacs) '(t)
2499 '(:help "Mark unread articles in this group as read, then exit"))]
2500 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2501 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2502 ["Exit group" gnus-summary-exit
2503 ,@(if (featurep 'xemacs) '(t)
2504 '(:help "Exit current group, return to group selection mode"))]
2505 ["Exit group without updating" gnus-summary-exit-no-update t]
2506 ["Exit and goto next group" gnus-summary-next-group t]
2507 ["Exit and goto prev group" gnus-summary-prev-group t]
2508 ["Reselect group" gnus-summary-reselect-current-group t]
2509 ["Rescan group" gnus-summary-rescan-group t]
2510 ["Update dribble" gnus-summary-save-newsrc t])))
2512 (gnus-run-hooks 'gnus-summary-menu-hook)))
2514 (defvar gnus-summary-tool-bar-map nil)
2516 ;; Emacs 21 tool bar. Should be no-op otherwise.
2517 (defun gnus-summary-make-tool-bar ()
2518 (if (and (fboundp 'tool-bar-add-item-from-menu)
2519 (default-value 'tool-bar-mode)
2520 (not gnus-summary-tool-bar-map))
2521 (setq gnus-summary-tool-bar-map
2522 (let ((tool-bar-map (make-sparse-keymap))
2523 (load-path (mm-image-load-path)))
2524 (tool-bar-add-item-from-menu
2525 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2526 (tool-bar-add-item-from-menu
2527 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2528 (tool-bar-add-item-from-menu
2529 'gnus-summary-post-news "post" gnus-summary-mode-map)
2530 (tool-bar-add-item-from-menu
2531 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2532 (tool-bar-add-item-from-menu
2533 'gnus-summary-followup "followup" gnus-summary-mode-map)
2534 (tool-bar-add-item-from-menu
2535 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2536 (tool-bar-add-item-from-menu
2537 'gnus-summary-reply "reply" gnus-summary-mode-map)
2538 (tool-bar-add-item-from-menu
2539 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2540 (tool-bar-add-item-from-menu
2541 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2542 (tool-bar-add-item-from-menu
2543 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2544 (tool-bar-add-item-from-menu
2545 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2546 (tool-bar-add-item-from-menu
2547 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2548 (tool-bar-add-item-from-menu
2549 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2550 (tool-bar-add-item-from-menu
2551 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2552 (tool-bar-add-item-from-menu
2553 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2555 (if gnus-summary-tool-bar-map
2556 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2558 (defun gnus-score-set-default (var value)
2559 "A version of set that updates the GNU Emacs menu-bar."
2561 ;; It is the message that forces the active status to be updated.
2564 (defun gnus-make-score-map (type)
2565 "Make a summary score map of type TYPE."
2568 (let ((headers '(("author" "from" string)
2569 ("subject" "subject" string)
2570 ("article body" "body" string)
2571 ("article head" "head" string)
2572 ("xref" "xref" string)
2573 ("extra header" "extra" string)
2574 ("lines" "lines" number)
2575 ("followups to author" "followup" string)))
2576 (types '((number ("less than" <)
2579 (string ("substring" s)
2583 (perms '(("temporary" (current-time-string))
2591 (if (eq type 'lower)
2596 (setq header (car headers))
2602 (let ((ts (cdr (assoc (nth 2 header) types)))
2618 'gnus-summary-score-entry
2620 (if (or (string= (nth 1 header)
2622 (string= (nth 1 header)
2625 (list 'gnus-summary-header
2627 (list 'quote (nth 1 (car ts)))
2628 (list 'gnus-score-delta-default
2635 (list (nreverse outp))))
2638 (list (nreverse outt))))
2640 (setq headers (cdr headers)))
2641 (list (nreverse outh))))))))
2645 (defun gnus-summary-mode (&optional group)
2646 "Major mode for reading articles.
2648 All normal editing commands are switched off.
2649 \\<gnus-summary-mode-map>
2650 Each line in this buffer represents one article. To read an
2651 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2652 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2655 You can also post articles and send mail from this buffer. To
2656 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2657 of an article, type `\\[gnus-summary-reply]'.
2659 There are approx. one gazillion commands you can execute in this
2660 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2662 The following commands are available:
2664 \\{gnus-summary-mode-map}"
2666 (kill-all-local-variables)
2667 (when (gnus-visual-p 'summary-menu 'menu)
2668 (gnus-summary-make-menu-bar)
2669 (gnus-summary-make-tool-bar))
2670 (gnus-summary-make-local-variables)
2671 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2672 (gnus-summary-make-local-variables))
2673 (gnus-make-thread-indent-array)
2674 (gnus-simplify-mode-line)
2675 (setq major-mode 'gnus-summary-mode)
2676 (setq mode-name "Summary")
2677 (make-local-variable 'minor-mode-alist)
2678 (use-local-map gnus-summary-mode-map)
2679 (buffer-disable-undo)
2680 (setq buffer-read-only t) ;Disable modification
2681 (setq truncate-lines t)
2682 (setq selective-display t)
2683 (setq selective-display-ellipses t) ;Display `...'
2684 (gnus-summary-set-display-table)
2685 (gnus-set-default-directory)
2686 (setq gnus-newsgroup-name group)
2687 (make-local-variable 'gnus-summary-line-format)
2688 (make-local-variable 'gnus-summary-line-format-spec)
2689 (make-local-variable 'gnus-summary-dummy-line-format)
2690 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2691 (make-local-variable 'gnus-summary-mark-positions)
2692 (gnus-make-local-hook 'pre-command-hook)
2693 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2694 (gnus-run-hooks 'gnus-summary-mode-hook)
2695 (turn-on-gnus-mailing-list-mode)
2696 (mm-enable-multibyte)
2697 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2698 (gnus-update-summary-mark-positions))
2700 (defun gnus-summary-make-local-variables ()
2701 "Make all the local summary buffer variables."
2703 (dolist (local gnus-summary-local-variables)
2706 (if (eq (cdr local) 'global)
2707 ;; Copy the global value of the variable.
2708 (setq global (symbol-value (car local)))
2709 ;; Use the value from the list.
2710 (setq global (eval (cdr local))))
2711 (set (make-local-variable (car local)) global))
2712 ;; Simple nil-valued local variable.
2713 (set (make-local-variable local) nil)))))
2715 (defun gnus-summary-clear-local-variables ()
2716 (let ((locals gnus-summary-local-variables))
2718 (if (consp (car locals))
2719 (and (vectorp (caar locals))
2720 (set (caar locals) nil))
2721 (and (vectorp (car locals))
2722 (set (car locals) nil)))
2723 (setq locals (cdr locals)))))
2725 ;; Summary data functions.
2727 (defmacro gnus-data-number (data)
2730 (defmacro gnus-data-set-number (data number)
2731 `(setcar ,data ,number))
2733 (defmacro gnus-data-mark (data)
2736 (defmacro gnus-data-set-mark (data mark)
2737 `(setcar (nthcdr 1 ,data) ,mark))
2739 (defmacro gnus-data-pos (data)
2742 (defmacro gnus-data-set-pos (data pos)
2743 `(setcar (nthcdr 2 ,data) ,pos))
2745 (defmacro gnus-data-header (data)
2748 (defmacro gnus-data-set-header (data header)
2749 `(setf (nth 3 ,data) ,header))
2751 (defmacro gnus-data-level (data)
2754 (defmacro gnus-data-unread-p (data)
2755 `(= (nth 1 ,data) gnus-unread-mark))
2757 (defmacro gnus-data-read-p (data)
2758 `(/= (nth 1 ,data) gnus-unread-mark))
2760 (defmacro gnus-data-pseudo-p (data)
2761 `(consp (nth 3 ,data)))
2763 (defmacro gnus-data-find (number)
2764 `(assq ,number gnus-newsgroup-data))
2766 (defmacro gnus-data-find-list (number &optional data)
2767 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2768 (memq (assq ,number bdata)
2771 (defmacro gnus-data-make (number mark pos header level)
2772 `(list ,number ,mark ,pos ,header ,level))
2774 (defun gnus-data-enter (after-article number mark pos header level offset)
2775 (let ((data (gnus-data-find-list after-article)))
2777 (error "No such article: %d" after-article))
2778 (setcdr data (cons (gnus-data-make number mark pos header level)
2780 (setq gnus-newsgroup-data-reverse nil)
2781 (gnus-data-update-list (cddr data) offset)))
2783 (defun gnus-data-enter-list (after-article list &optional offset)
2785 (let ((data (and after-article (gnus-data-find-list after-article)))
2789 (let ((odata gnus-newsgroup-data))
2790 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2792 (gnus-data-update-list odata offset)))
2793 ;; Find the last element in the list to be spliced into the main
2796 (setq list (cdr list)))
2799 (setcdr list gnus-newsgroup-data)
2800 (setq gnus-newsgroup-data ilist)
2802 (gnus-data-update-list (cdr list) offset)))
2803 (setcdr list (cdr data))
2806 (gnus-data-update-list (cdr list) offset))))
2807 (setq gnus-newsgroup-data-reverse nil))))
2809 (defun gnus-data-remove (article &optional offset)
2810 (let ((data gnus-newsgroup-data))
2811 (if (= (gnus-data-number (car data)) article)
2813 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2814 gnus-newsgroup-data-reverse nil)
2816 (gnus-data-update-list gnus-newsgroup-data offset)))
2818 (when (= (gnus-data-number (cadr data)) article)
2819 (setcdr data (cddr data))
2821 (gnus-data-update-list (cdr data) offset))
2823 gnus-newsgroup-data-reverse nil))
2824 (setq data (cdr data))))))
2826 (defmacro gnus-data-list (backward)
2828 (or gnus-newsgroup-data-reverse
2829 (setq gnus-newsgroup-data-reverse
2830 (reverse gnus-newsgroup-data)))
2831 gnus-newsgroup-data))
2833 (defun gnus-data-update-list (data offset)
2834 "Add OFFSET to the POS of all data entries in DATA."
2835 (setq gnus-newsgroup-data-reverse nil)
2837 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2838 (setq data (cdr data))))
2840 (defun gnus-summary-article-pseudo-p (article)
2841 "Say whether this article is a pseudo article or not."
2842 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2844 (defmacro gnus-summary-article-sparse-p (article)
2845 "Say whether this article is a sparse article or not."
2846 `(memq ,article gnus-newsgroup-sparse))
2848 (defmacro gnus-summary-article-ancient-p (article)
2849 "Say whether this article is a sparse article or not."
2850 `(memq ,article gnus-newsgroup-ancient))
2852 (defun gnus-article-parent-p (number)
2853 "Say whether this article is a parent or not."
2854 (let ((data (gnus-data-find-list number)))
2855 (and (cdr data) ; There has to be an article after...
2856 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2857 (gnus-data-level (nth 1 data))))))
2859 (defun gnus-article-children (number)
2860 "Return a list of all children to NUMBER."
2861 (let* ((data (gnus-data-find-list number))
2862 (level (gnus-data-level (car data)))
2864 (setq data (cdr data))
2866 (= (gnus-data-level (car data)) (1+ level)))
2867 (push (gnus-data-number (car data)) children)
2868 (setq data (cdr data)))
2871 (defmacro gnus-summary-skip-intangible ()
2872 "If the current article is intangible, then jump to a different article."
2873 '(let ((to (get-text-property (point) 'gnus-intangible)))
2874 (and to (gnus-summary-goto-subject to))))
2876 (defmacro gnus-summary-article-intangible-p ()
2877 "Say whether this article is intangible or not."
2878 '(get-text-property (point) 'gnus-intangible))
2880 (defun gnus-article-read-p (article)
2881 "Say whether ARTICLE is read or not."
2882 (not (or (memq article gnus-newsgroup-marked)
2883 (memq article gnus-newsgroup-spam-marked)
2884 (memq article gnus-newsgroup-unreads)
2885 (memq article gnus-newsgroup-unselected)
2886 (memq article gnus-newsgroup-dormant))))
2888 ;; Some summary mode macros.
2890 (defmacro gnus-summary-article-number ()
2891 "The article number of the article on the current line.
2892 If there isn't an article number here, then we return the current
2895 (gnus-summary-skip-intangible)
2896 (or (get-text-property (point) 'gnus-number)
2897 (gnus-summary-last-subject))))
2899 (defmacro gnus-summary-article-header (&optional number)
2900 "Return the header of article NUMBER."
2901 `(gnus-data-header (gnus-data-find
2902 ,(or number '(gnus-summary-article-number)))))
2904 (defmacro gnus-summary-thread-level (&optional number)
2905 "Return the level of thread that starts with article NUMBER."
2906 `(if (and (eq gnus-summary-make-false-root 'dummy)
2907 (get-text-property (point) 'gnus-intangible))
2909 (gnus-data-level (gnus-data-find
2910 ,(or number '(gnus-summary-article-number))))))
2912 (defmacro gnus-summary-article-mark (&optional number)
2913 "Return the mark of article NUMBER."
2914 `(gnus-data-mark (gnus-data-find
2915 ,(or number '(gnus-summary-article-number)))))
2917 (defmacro gnus-summary-article-pos (&optional number)
2918 "Return the position of the line of article NUMBER."
2919 `(gnus-data-pos (gnus-data-find
2920 ,(or number '(gnus-summary-article-number)))))
2922 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2923 (defmacro gnus-summary-article-subject (&optional number)
2924 "Return current subject string or nil if nothing."
2927 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2928 '(gnus-data-header (assq (gnus-summary-article-number)
2929 gnus-newsgroup-data)))))
2932 (mail-header-subject headers))))
2934 (defmacro gnus-summary-article-score (&optional number)
2935 "Return current article score."
2936 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2937 gnus-newsgroup-scored))
2938 gnus-summary-default-score 0))
2940 (defun gnus-summary-article-children (&optional number)
2941 "Return a list of article numbers that are children of article NUMBER."
2942 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2943 (level (gnus-data-level (car data)))
2945 (while (and (setq data (cdr data))
2946 (> (setq l (gnus-data-level (car data))) level))
2947 (and (= (1+ level) l)
2948 (push (gnus-data-number (car data))
2950 (nreverse children)))
2952 (defun gnus-summary-article-parent (&optional number)
2953 "Return the article number of the parent of article NUMBER."
2954 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2955 (gnus-data-list t)))
2956 (level (gnus-data-level (car data))))
2958 () ; This is a root.
2959 ;; We search until we find an article with a level less than
2960 ;; this one. That function has to be the parent.
2961 (while (and (setq data (cdr data))
2962 (not (< (gnus-data-level (car data)) level))))
2963 (and data (gnus-data-number (car data))))))
2965 (defun gnus-unread-mark-p (mark)
2966 "Say whether MARK is the unread mark."
2967 (= mark gnus-unread-mark))
2969 (defun gnus-read-mark-p (mark)
2970 "Say whether MARK is one of the marks that mark as read.
2971 This is all marks except unread, ticked, dormant, and expirable."
2972 (not (or (= mark gnus-unread-mark)
2973 (= mark gnus-ticked-mark)
2974 (= mark gnus-spam-mark)
2975 (= mark gnus-dormant-mark)
2976 (= mark gnus-expirable-mark))))
2978 (defmacro gnus-article-mark (number)
2979 "Return the MARK of article NUMBER.
2980 This macro should only be used when computing the mark the \"first\"
2981 time; i.e., when generating the summary lines. After that,
2982 `gnus-summary-article-mark' should be used to examine the
2985 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2986 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2987 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2988 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2989 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
2990 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2991 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2992 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2993 gnus-ancient-mark))))
2995 ;; Saving hidden threads.
2997 (defmacro gnus-save-hidden-threads (&rest forms)
2998 "Save hidden threads, eval FORMS, and restore the hidden threads."
2999 (let ((config (make-symbol "config")))
3000 `(let ((,config (gnus-hidden-threads-configuration)))
3004 (gnus-restore-hidden-threads-configuration ,config)))))
3005 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3006 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3008 (defun gnus-data-compute-positions ()
3009 "Compute the positions of all articles."
3010 (setq gnus-newsgroup-data-reverse nil)
3011 (let ((data gnus-newsgroup-data))
3013 (gnus-save-hidden-threads
3014 (gnus-summary-show-all-threads)
3015 (goto-char (point-min))
3017 (while (get-text-property (point) 'gnus-intangible)
3019 (gnus-data-set-pos (car data) (+ (point) 3))
3020 (setq data (cdr data))
3021 (forward-line 1))))))
3023 (defun gnus-hidden-threads-configuration ()
3024 "Return the current hidden threads configuration."
3027 (goto-char (point-min))
3028 (while (search-forward "\r" nil t)
3029 (push (1- (point)) config))
3032 (defun gnus-restore-hidden-threads-configuration (config)
3033 "Restore hidden threads configuration from CONFIG."
3035 (let (point buffer-read-only)
3036 (while (setq point (pop config))
3037 (when (and (< point (point-max))
3039 (eq (char-after) ?\n))
3040 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3042 ;; Various summary mode internalish functions.
3044 (defun gnus-mouse-pick-article (e)
3047 (gnus-summary-next-page nil t))
3049 (defun gnus-summary-set-display-table ()
3050 "Change the display table.
3051 Odd characters have a tendency to mess
3052 up nicely formatted displays - we make all possible glyphs
3053 display only a single character."
3055 ;; We start from the standard display table, if any.
3056 (let ((table (or (copy-sequence standard-display-table)
3057 (make-display-table)))
3059 ;; Nix out all the control chars...
3060 (while (>= (setq i (1- i)) 0)
3061 (aset table i [??]))
3062 ;; ... but not newline and cr, of course. (cr is necessary for the
3063 ;; selective display).
3064 (aset table ?\n nil)
3065 (aset table ?\r nil)
3066 ;; We keep TAB as well.
3067 (aset table ?\t nil)
3068 ;; We nix out any glyphs over 126 that are not set already.
3070 (while (>= (setq i (1- i)) 127)
3071 ;; Only modify if the entry is nil.
3072 (unless (aref table i)
3073 (aset table i [??]))))
3074 (setq buffer-display-table table)))
3076 (defun gnus-summary-set-article-display-arrow (pos)
3077 "Update the overlay arrow to point to line at position POS."
3078 (when (and gnus-summary-display-arrow
3079 (boundp 'overlay-arrow-position)
3080 (boundp 'overlay-arrow-string))
3084 (unless overlay-arrow-position
3085 (setq overlay-arrow-position (make-marker)))
3086 (setq overlay-arrow-string "=>"
3087 overlay-arrow-position (set-marker overlay-arrow-position
3089 (current-buffer))))))
3091 (defun gnus-summary-setup-buffer (group)
3092 "Initialize summary buffer."
3093 (let ((buffer (gnus-summary-buffer-name group))
3094 (dead-name (concat "*Dead Summary "
3095 (gnus-group-decoded-name group) "*")))
3096 ;; If a dead summary buffer exists, we kill it.
3097 (when (gnus-buffer-live-p dead-name)
3098 (gnus-kill-buffer dead-name))
3099 (if (get-buffer buffer)
3102 (setq gnus-summary-buffer (current-buffer))
3103 (not gnus-newsgroup-prepared))
3104 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3105 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3106 (gnus-summary-mode group)
3108 (gnus-carpal-setup-buffer 'summary))
3109 (unless gnus-single-article-buffer
3110 (make-local-variable 'gnus-article-buffer)
3111 (make-local-variable 'gnus-article-current)
3112 (make-local-variable 'gnus-original-article-buffer))
3113 (setq gnus-newsgroup-name group)
3114 ;; Set any local variables in the group parameters.
3115 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3118 (defun gnus-set-global-variables ()
3119 "Set the global equivalents of the buffer-local variables.
3120 They are set to the latest values they had. These reflect the summary
3121 buffer that was in action when the last article was fetched."
3122 (when (eq major-mode 'gnus-summary-mode)
3123 (setq gnus-summary-buffer (current-buffer))
3124 (let ((name gnus-newsgroup-name)
3125 (marked gnus-newsgroup-marked)
3126 (spam gnus-newsgroup-spam-marked)
3127 (unread gnus-newsgroup-unreads)
3128 (headers gnus-current-headers)
3129 (data gnus-newsgroup-data)
3130 (summary gnus-summary-buffer)
3131 (article-buffer gnus-article-buffer)
3132 (original gnus-original-article-buffer)
3133 (gac gnus-article-current)
3134 (reffed gnus-reffed-article-number)
3135 (score-file gnus-current-score-file)
3136 (default-charset gnus-newsgroup-charset)
3138 (let ((locals gnus-newsgroup-variables))
3140 (if (consp (car locals))
3141 (push (eval (caar locals)) vlist)
3142 (push (eval (car locals)) vlist))
3143 (setq locals (cdr locals)))
3144 (setq vlist (nreverse vlist)))
3146 (set-buffer gnus-group-buffer)
3147 (setq gnus-newsgroup-name name
3148 gnus-newsgroup-marked marked
3149 gnus-newsgroup-spam-marked spam
3150 gnus-newsgroup-unreads unread
3151 gnus-current-headers headers
3152 gnus-newsgroup-data data
3153 gnus-article-current gac
3154 gnus-summary-buffer summary
3155 gnus-article-buffer article-buffer
3156 gnus-original-article-buffer original
3157 gnus-reffed-article-number reffed
3158 gnus-current-score-file score-file
3159 gnus-newsgroup-charset default-charset)
3160 (let ((locals gnus-newsgroup-variables))
3162 (if (consp (car locals))
3163 (set (caar locals) (pop vlist))
3164 (set (car locals) (pop vlist)))
3165 (setq locals (cdr locals))))
3166 ;; The article buffer also has local variables.
3167 (when (gnus-buffer-live-p gnus-article-buffer)
3168 (set-buffer gnus-article-buffer)
3169 (setq gnus-summary-buffer summary))))))
3171 (defun gnus-summary-article-unread-p (article)
3172 "Say whether ARTICLE is unread or not."
3173 (memq article gnus-newsgroup-unreads))
3175 (defun gnus-summary-first-article-p (&optional article)
3176 "Return whether ARTICLE is the first article in the buffer."
3177 (if (not (setq article (or article (gnus-summary-article-number))))
3179 (eq article (caar gnus-newsgroup-data))))
3181 (defun gnus-summary-last-article-p (&optional article)
3182 "Return whether ARTICLE is the last article in the buffer."
3183 (if (not (setq article (or article (gnus-summary-article-number))))
3184 ;; All non-existent numbers are the last article. :-)
3186 (not (cdr (gnus-data-find-list article)))))
3188 (defun gnus-make-thread-indent-array ()
3190 (unless (and gnus-thread-indent-array
3191 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3192 (setq gnus-thread-indent-array (make-vector 201 "")
3193 gnus-thread-indent-array-level gnus-thread-indent-level)
3195 (aset gnus-thread-indent-array n
3196 (make-string (* n gnus-thread-indent-level) ? ))
3199 (defun gnus-update-summary-mark-positions ()
3200 "Compute where the summary marks are to go."
3202 (when (gnus-buffer-exists-p gnus-summary-buffer)
3203 (set-buffer gnus-summary-buffer))
3204 (let ((gnus-replied-mark 129)
3205 (gnus-score-below-mark 130)
3206 (gnus-score-over-mark 130)
3207 (gnus-undownloaded-mark 131)
3208 (spec gnus-summary-line-format-spec)
3211 (gnus-set-work-buffer)
3212 (let ((gnus-summary-line-format-spec spec)
3213 (gnus-newsgroup-downloadable '(0)))
3214 (gnus-summary-insert-line
3215 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3216 0 nil t 128 t nil "" nil 1)
3217 (goto-char (point-min))
3218 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3219 (- (point) (point-min) 1)))))
3220 (goto-char (point-min))
3221 (push (cons 'replied (and (search-forward "\201" nil t)
3222 (- (point) (point-min) 1)))
3224 (goto-char (point-min))
3225 (push (cons 'score (and (search-forward "\202" nil t)
3226 (- (point) (point-min) 1)))
3228 (goto-char (point-min))
3229 (push (cons 'download
3230 (and (search-forward "\203" nil t)
3231 (- (point) (point-min) 1)))
3233 (setq gnus-summary-mark-positions pos))))
3235 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3236 "Insert a dummy root in the summary buffer."
3238 (gnus-add-text-properties
3239 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3240 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3242 (defun gnus-summary-extract-address-component (from)
3243 (or (car (funcall gnus-extract-address-components from))
3246 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3247 (let ((mail-parse-charset gnus-newsgroup-charset)
3248 ; Is it really necessary to do this next part for each summary line?
3249 ; Luckily, doesn't seem to slow things down much.
3250 (mail-parse-ignored-charsets
3251 (with-current-buffer gnus-summary-buffer
3252 gnus-newsgroup-ignored-charsets)))
3254 (and gnus-ignored-from-addresses
3255 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3256 (let ((extra-headers (mail-header-extra header))
3260 ((setq to (cdr (assq 'To extra-headers)))
3263 (gnus-summary-extract-address-component
3264 (funcall gnus-decode-encoded-word-function to)))))
3265 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3266 (concat "=> " newsgroups)))))
3267 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3269 (defun gnus-summary-insert-line (gnus-tmp-header
3270 gnus-tmp-level gnus-tmp-current
3271 undownloaded gnus-tmp-unread gnus-tmp-replied
3272 gnus-tmp-expirable gnus-tmp-subject-or-nil
3273 &optional gnus-tmp-dummy gnus-tmp-score
3275 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3276 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3277 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3278 (gnus-tmp-score-char
3279 (if (or (null gnus-summary-default-score)
3280 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3281 gnus-summary-zcore-fuzz))
3283 (if (< gnus-tmp-score gnus-summary-default-score)
3284 gnus-score-below-mark gnus-score-over-mark)))
3285 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3287 (cond (gnus-tmp-process gnus-process-mark)
3288 ((memq gnus-tmp-current gnus-newsgroup-cached)
3290 (gnus-tmp-replied gnus-replied-mark)
3291 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3292 gnus-forwarded-mark)
3293 ((memq gnus-tmp-current gnus-newsgroup-saved)
3295 ((memq gnus-tmp-number gnus-newsgroup-recent)
3297 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3300 (gnus-tmp-downloaded
3302 gnus-undownloaded-mark)
3303 (gnus-newsgroup-agentized
3304 gnus-downloaded-mark)
3307 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3310 ((string-match "<[^>]+> *$" gnus-tmp-from)
3311 (let ((beg (match-beginning 0)))
3312 (or (and (string-match "^\".+\"" gnus-tmp-from)
3313 (substring gnus-tmp-from 1 (1- (match-end 0))))
3314 (substring gnus-tmp-from 0 beg))))
3315 ((string-match "(.+)" gnus-tmp-from)
3316 (substring gnus-tmp-from
3317 (1+ (match-beginning 0)) (1- (match-end 0))))
3319 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3320 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3321 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3322 (buffer-read-only nil))
3323 (when (string= gnus-tmp-name "")
3324 (setq gnus-tmp-name gnus-tmp-from))
3325 (unless (numberp gnus-tmp-lines)
3326 (setq gnus-tmp-lines -1))
3327 (if (= gnus-tmp-lines -1)
3328 (setq gnus-tmp-lines "?")
3329 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3330 (gnus-put-text-property
3332 (progn (eval gnus-summary-line-format-spec) (point))
3333 'gnus-number gnus-tmp-number)
3334 (when (gnus-visual-p 'summary-highlight 'highlight)
3336 (gnus-run-hooks 'gnus-summary-update-hook)
3339 (defun gnus-summary-update-line (&optional dont-update)
3340 "Update summary line after change."
3341 (when (and gnus-summary-default-score
3342 (not gnus-summary-inhibit-highlight))
3343 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3344 (article (gnus-summary-article-number))
3345 (score (gnus-summary-article-score article)))
3347 (if (and gnus-summary-mark-below
3348 (< (gnus-summary-article-score)
3349 gnus-summary-mark-below))
3350 ;; This article has a low score, so we mark it as read.
3351 (when (memq article gnus-newsgroup-unreads)
3352 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3353 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3354 ;; This article was previously marked as read on account
3355 ;; of a low score, but now it has risen, so we mark it as
3357 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3358 (gnus-summary-update-mark
3359 (if (or (null gnus-summary-default-score)
3360 (<= (abs (- score gnus-summary-default-score))
3361 gnus-summary-zcore-fuzz))
3363 (if (< score gnus-summary-default-score)
3364 gnus-score-below-mark gnus-score-over-mark))
3366 ;; Do visual highlighting.
3367 (when (gnus-visual-p 'summary-highlight 'highlight)
3368 (gnus-run-hooks 'gnus-summary-update-hook)))))
3370 (defvar gnus-tmp-new-adopts nil)
3372 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3373 "Return the number of articles in THREAD.
3374 This may be 0 in some cases -- if none of the articles in
3375 the thread are to be displayed."
3377 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3379 ((not (listp thread))
3381 ((and (consp thread) (cdr thread))
3384 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3387 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3390 (when (and level (zerop level) gnus-tmp-new-adopts)
3393 'gnus-summary-number-of-articles-in-thread
3394 gnus-tmp-new-adopts))))
3396 (if (> number 1) gnus-not-empty-thread-mark
3397 gnus-empty-thread-mark)
3400 (defsubst gnus-summary-line-message-size (head)
3401 "Return pretty-printed version of message size.
3402 This function is intended to be used in
3403 `gnus-summary-line-format-alist'."
3404 (let ((c (or (mail-header-chars head) -1)))
3405 (cond ((< c 0) "n/a") ; chars not available
3406 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3407 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3408 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3409 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3412 (defun gnus-summary-set-local-parameters (group)
3413 "Go through the local params of GROUP and set all variable specs in that list."
3414 (let ((params (gnus-group-find-parameter group))
3415 (vars '(quit-config)) ; Ignore quit-config.
3418 (setq elem (car params)
3419 params (cdr params))
3420 (and (consp elem) ; Has to be a cons.
3421 (consp (cdr elem)) ; The cdr has to be a list.
3422 (symbolp (car elem)) ; Has to be a symbol in there.
3423 (not (memq (car elem) vars))
3424 (ignore-errors ; So we set it.
3425 (push (car elem) vars)
3426 (make-local-variable (car elem))
3427 (set (car elem) (eval (nth 1 elem))))))))
3429 (defun gnus-summary-read-group (group &optional show-all no-article
3430 kill-buffer no-display backward
3432 "Start reading news in newsgroup GROUP.
3433 If SHOW-ALL is non-nil, already read articles are also listed.
3434 If NO-ARTICLE is non-nil, no article is selected initially.
3435 If NO-DISPLAY, don't generate a summary buffer."
3439 (let ((gnus-auto-select-next nil))
3440 (or (gnus-summary-read-group-1
3441 group show-all no-article
3442 kill-buffer no-display
3445 select-articles nil)))))
3446 (eq gnus-auto-select-next 'quietly))
3447 (set-buffer gnus-group-buffer)
3448 ;; The entry function called above goes to the next
3449 ;; group automatically, so we go two groups back
3450 ;; if we are searching for the previous group.
3452 (gnus-group-prev-unread-group 2))
3453 (if (not (equal group (gnus-group-group-name)))
3454 (setq group (gnus-group-group-name))
3458 (defun gnus-summary-read-group-1 (group show-all no-article
3459 kill-buffer no-display
3460 &optional select-articles)
3461 ;; Killed foreign groups can't be entered.
3462 ;; (when (and (not (gnus-group-native-p group))
3463 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3464 ;; (error "Dead non-native groups can't be entered"))
3465 (gnus-message 5 "Retrieving newsgroup: %s..."
3466 (gnus-group-decoded-name group))
3467 (let* ((new-group (gnus-summary-setup-buffer group))
3468 (quit-config (gnus-group-quit-config group))
3469 (did-select (and new-group (gnus-select-newsgroup
3470 group show-all select-articles))))
3472 ;; This summary buffer exists already, so we just select it.
3474 (gnus-set-global-variables)
3476 (gnus-kill-or-deaden-summary kill-buffer))
3477 (gnus-configure-windows 'summary 'force)
3478 (gnus-set-mode-line 'summary)
3479 (gnus-summary-position-point)
3482 ;; We couldn't select this group.
3484 (when (and (eq major-mode 'gnus-summary-mode)
3485 (not (equal (current-buffer) kill-buffer)))
3486 (kill-buffer (current-buffer))
3487 (if (not quit-config)
3489 ;; Update the info -- marks might need to be removed,
3491 (gnus-summary-update-info)
3492 (set-buffer gnus-group-buffer)
3493 (gnus-group-jump-to-group group)
3494 (gnus-group-next-unread-group 1))
3495 (gnus-handle-ephemeral-exit quit-config)))
3496 (let ((grpinfo (gnus-get-info group)))
3497 (if (null (gnus-info-read grpinfo))
3498 (gnus-message 3 "Group %s contains no messages"
3499 (gnus-group-decoded-name group))
3500 (gnus-message 3 "Can't select group")))
3502 ;; The user did a `C-g' while prompting for number of articles,
3503 ;; so we exit this group.
3504 ((eq did-select 'quit)
3505 (and (eq major-mode 'gnus-summary-mode)
3506 (not (equal (current-buffer) kill-buffer))
3507 (kill-buffer (current-buffer)))
3509 (gnus-kill-or-deaden-summary kill-buffer))
3510 (if (not quit-config)
3512 (set-buffer gnus-group-buffer)
3513 (gnus-group-jump-to-group group)
3514 (gnus-group-next-unread-group 1)
3515 (gnus-configure-windows 'group 'force))
3516 (gnus-handle-ephemeral-exit quit-config))
3517 ;; Finally signal the quit.
3519 ;; The group was successfully selected.
3521 (gnus-set-global-variables)
3522 ;; Save the active value in effect when the group was entered.
3523 (setq gnus-newsgroup-active
3525 (gnus-active gnus-newsgroup-name)))
3526 ;; You can change the summary buffer in some way with this hook.
3527 (gnus-run-hooks 'gnus-select-group-hook)
3528 (gnus-update-format-specifications
3529 nil 'summary 'summary-mode 'summary-dummy)
3530 (gnus-update-summary-mark-positions)
3531 ;; Do score processing.
3532 (when gnus-use-scoring
3533 (gnus-possibly-score-headers))
3534 ;; Check whether to fill in the gaps in the threads.
3535 (when gnus-build-sparse-threads
3536 (gnus-build-sparse-threads))
3537 ;; Find the initial limit.
3538 (if gnus-show-threads
3540 (let ((gnus-newsgroup-dormant nil))
3541 (gnus-summary-initial-limit show-all))
3542 (gnus-summary-initial-limit show-all))
3543 ;; When unthreaded, all articles are always shown.
3544 (setq gnus-newsgroup-limit
3546 (lambda (header) (mail-header-number header))
3547 gnus-newsgroup-headers)))
3548 ;; Generate the summary buffer.
3550 (gnus-summary-prepare))
3551 (when gnus-use-trees
3552 (gnus-tree-open group)
3553 (setq gnus-summary-highlight-line-function
3554 'gnus-tree-highlight-article))
3555 ;; If the summary buffer is empty, but there are some low-scored
3556 ;; articles or some excluded dormants, we include these in the
3558 (when (and (zerop (buffer-size))
3560 (cond (gnus-newsgroup-dormant
3561 (gnus-summary-limit-include-dormant))
3562 ((and gnus-newsgroup-scored show-all)
3563 (gnus-summary-limit-include-expunged t))))
3564 ;; Function `gnus-apply-kill-file' must be called in this hook.
3565 (gnus-run-hooks 'gnus-apply-kill-hook)
3566 (if (and (zerop (buffer-size))
3569 ;; This newsgroup is empty.
3570 (gnus-summary-catchup-and-exit nil t)
3571 (gnus-message 6 "No unread news")
3573 (gnus-kill-or-deaden-summary kill-buffer))
3574 ;; Return nil from this function.
3576 ;; Hide conversation thread subtrees. We cannot do this in
3577 ;; gnus-summary-prepare-hook since kill processing may not
3578 ;; work with hidden articles.
3579 (gnus-summary-maybe-hide-threads)
3581 (gnus-kill-or-deaden-summary kill-buffer))
3582 (gnus-summary-auto-select-subject)
3583 ;; Show first unread article if requested.
3584 (if (and (not no-article)
3586 gnus-newsgroup-unreads
3587 gnus-auto-select-first)
3589 (gnus-configure-windows 'summary)
3590 (let ((art (gnus-summary-article-number)))
3591 (unless (and (not gnus-plugged)
3592 (or (memq art gnus-newsgroup-undownloaded)
3593 (memq art gnus-newsgroup-downloadable)))
3594 (gnus-summary-goto-article art))))
3595 ;; Don't select any articles.
3596 (gnus-summary-position-point)
3597 (gnus-configure-windows 'summary 'force)
3598 (gnus-set-mode-line 'summary))
3599 (when (and gnus-auto-center-group
3600 (get-buffer-window gnus-group-buffer t))
3601 ;; Gotta use windows, because recenter does weird stuff if
3602 ;; the current buffer ain't the displayed window.
3603 (let ((owin (selected-window)))
3604 (select-window (get-buffer-window gnus-group-buffer t))
3605 (when (gnus-group-goto-group group)
3607 (select-window owin)))
3608 ;; Mark this buffer as "prepared".
3609 (setq gnus-newsgroup-prepared t)
3610 (gnus-run-hooks 'gnus-summary-prepared-hook)
3611 (unless (gnus-ephemeral-group-p group)
3612 (gnus-group-update-group group))
3615 (defun gnus-summary-auto-select-subject ()
3616 "Select the subject line on initial group entry."
3617 (goto-char (point-min))
3619 ((eq gnus-auto-select-subject 'best)
3620 (gnus-summary-best-unread-subject))
3621 ((eq gnus-auto-select-subject 'unread)
3622 (gnus-summary-first-unread-subject))
3623 ((eq gnus-auto-select-subject 'unseen)
3624 (gnus-summary-first-unseen-subject))
3625 ((eq gnus-auto-select-subject 'unseen-or-unread)
3626 (gnus-summary-first-unseen-or-unread-subject))
3627 ((eq gnus-auto-select-subject 'first)
3630 ((functionp gnus-auto-select-subject)
3631 (funcall gnus-auto-select-subject))))
3633 (defun gnus-summary-prepare ()
3634 "Generate the summary buffer."
3636 (let ((buffer-read-only nil))
3638 (setq gnus-newsgroup-data nil
3639 gnus-newsgroup-data-reverse nil)
3640 (gnus-run-hooks 'gnus-summary-generate-hook)
3641 ;; Generate the buffer, either with threads or without.
3642 (when gnus-newsgroup-headers
3643 (gnus-summary-prepare-threads
3644 (if gnus-show-threads
3645 (gnus-sort-gathered-threads
3646 (funcall gnus-summary-thread-gathering-function
3648 (gnus-cut-threads (gnus-make-threads)))))
3649 ;; Unthreaded display.
3650 (gnus-sort-articles gnus-newsgroup-headers))))
3651 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3652 ;; Call hooks for modifying summary buffer.
3653 (goto-char (point-min))
3654 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3656 (defsubst gnus-general-simplify-subject (subject)
3657 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3660 ;; Truncate the subject.
3661 (gnus-simplify-subject-functions
3662 (gnus-map-function gnus-simplify-subject-functions subject))
3663 ((numberp gnus-summary-gather-subject-limit)
3664 (setq subject (gnus-simplify-subject-re subject))
3665 (if (> (length subject) gnus-summary-gather-subject-limit)
3666 (substring subject 0 gnus-summary-gather-subject-limit)
3668 ;; Fuzzily simplify it.
3669 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3670 (gnus-simplify-subject-fuzzy subject))
3671 ;; Just remove the leading "Re:".
3673 (gnus-simplify-subject-re subject))))
3675 (if (and gnus-summary-gather-exclude-subject
3676 (string-match gnus-summary-gather-exclude-subject subject))
3677 nil ; This article shouldn't be gathered
3680 (defun gnus-summary-simplify-subject-query ()
3681 "Query where the respool algorithm would put this article."
3683 (gnus-summary-select-article)
3684 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3686 (defun gnus-gather-threads-by-subject (threads)
3687 "Gather threads by looking at Subject headers."
3688 (if (not gnus-summary-make-false-root)
3690 (let ((hashtb (gnus-make-hashtable 1024))
3693 subject hthread whole-subject)
3695 (setq subject (gnus-general-simplify-subject
3696 (setq whole-subject (mail-header-subject
3699 (if (setq hthread (gnus-gethash subject hashtb))
3701 ;; We enter a dummy root into the thread, if we
3702 ;; haven't done that already.
3703 (unless (stringp (caar hthread))
3704 (setcar hthread (list whole-subject (car hthread))))
3705 ;; We add this new gathered thread to this gathered
3707 (setcdr (car hthread)
3708 (nconc (cdar hthread) (list (car threads))))
3709 ;; Remove it from the list of threads.
3710 (setcdr prev (cdr threads))
3711 (setq threads prev))
3712 ;; Enter this thread into the hash table.
3713 (gnus-sethash subject
3714 (if gnus-summary-make-false-root-always
3716 ;; If you want a dummy root above all
3718 (setcar threads (list whole-subject
3724 (setq threads (cdr threads)))
3727 (defun gnus-gather-threads-by-references (threads)
3728 "Gather threads by looking at References headers."
3729 (let ((idhashtb (gnus-make-hashtable 1024))
3730 (thhashtb (gnus-make-hashtable 1024))
3733 ids references id gthread gid entered ref)
3735 (when (setq references (mail-header-references (caar threads)))
3736 (setq id (mail-header-id (caar threads))
3737 ids (inline (gnus-split-references references))
3739 (while (setq ref (pop ids))
3740 (setq ids (delete ref ids))
3741 (if (not (setq gid (gnus-gethash ref idhashtb)))
3743 (gnus-sethash ref id idhashtb)
3744 (gnus-sethash id threads thhashtb))
3745 (setq gthread (gnus-gethash gid thhashtb))
3747 ;; We enter a dummy root into the thread, if we
3748 ;; haven't done that already.
3749 (unless (stringp (caar gthread))
3750 (setcar gthread (list (mail-header-subject (caar gthread))
3752 ;; We add this new gathered thread to this gathered
3754 (setcdr (car gthread)
3755 (nconc (cdar gthread) (list (car threads)))))
3756 ;; Add it into the thread hash table.
3757 (gnus-sethash id gthread thhashtb)
3759 ;; Remove it from the list of threads.
3760 (setcdr prev (cdr threads))
3761 (setq threads prev))))
3763 (setq threads (cdr threads)))
3766 (defun gnus-sort-gathered-threads (threads)
3767 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3768 (let ((result threads))
3770 (when (stringp (caar threads))
3771 (setcdr (car threads)
3772 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3773 (setq threads (cdr threads)))
3776 (defun gnus-thread-loop-p (root thread)
3777 "Say whether ROOT is in THREAD."
3778 (let ((stack (list thread))
3781 (while (setq thread (pop stack))
3782 (setq th (cdr thread))
3784 (not (eq (caar th) root)))
3787 ;; We have found a loop.
3789 (setcdr thread (delq (car th) (cdr thread)))
3790 (if (boundp (setq ref-dep (intern "none"
3791 gnus-newsgroup-dependencies)))
3792 (setcdr (symbol-value ref-dep)
3793 (nconc (cdr (symbol-value ref-dep))
3795 (set ref-dep (list nil (car th))))
3798 ;; Push all the subthreads onto the stack.
3799 (push (cdr thread) stack)))
3802 (defun gnus-make-threads ()
3803 "Go through the dependency hashtb and find the roots. Return all threads."
3805 (while (catch 'infloop
3808 ;; Deal with self-referencing References loops.
3809 (when (and (car (symbol-value refs))
3816 (car (symbol-value refs)) thread))
3817 (cdr (symbol-value refs)))))))
3820 (unless (car (symbol-value refs))
3821 ;; These threads do not refer back to any other
3822 ;; articles, so they're roots.
3823 (setq threads (append (cdr (symbol-value refs)) threads))))
3824 gnus-newsgroup-dependencies)))
3827 ;; Build the thread tree.
3828 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3829 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3831 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3832 if it was already present.
3834 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3835 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3836 Message-IDs will be renamed to a unique Message-ID before being
3839 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3840 (let* ((id (mail-header-id header))
3841 (id-dep (and id (intern id dependencies)))
3842 parent-id ref ref-dep ref-header replaced)
3843 ;; Enter this `header' in the `dependencies' table.
3847 ;; The first two cases do the normal part: enter a new `header'
3848 ;; in the `dependencies' table.
3849 ((not (boundp id-dep))
3850 (set id-dep (list header)))
3851 ((null (car (symbol-value id-dep)))
3852 (setcar (symbol-value id-dep) header))
3854 ;; From here the `header' was already present in the
3855 ;; `dependencies' table.
3857 ;; Overrides an existing entry;
3858 ;; just set the header part of the entry.
3859 (setcar (symbol-value id-dep) header)
3862 ;; Renames the existing `header' to a unique Message-ID.
3863 ((not gnus-summary-ignore-duplicates)
3864 ;; An article with this Message-ID has already been seen.
3865 ;; We rename the Message-ID.
3866 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3868 (mail-header-set-id header id))
3870 ;; The last case ignores an existing entry, except it adds any
3871 ;; additional Xrefs (in case the two articles came from different
3873 ;; Also sets `header' to `nil' meaning that the `dependencies'
3874 ;; table was *not* modified.
3876 (mail-header-set-xref
3877 (car (symbol-value id-dep))
3878 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3880 (or (mail-header-xref header) "")))
3883 (when (and header (not replaced))
3884 ;; First check that we are not creating a References loop.
3885 (setq parent-id (gnus-parent-id (mail-header-references header)))
3886 (setq ref parent-id)
3888 (setq ref-dep (intern-soft ref dependencies))
3890 (setq ref-header (car (symbol-value ref-dep))))
3891 (if (string= id ref)
3892 ;; Yuk! This is a reference loop. Make the article be a
3895 (mail-header-set-references (car (symbol-value id-dep)) "none")
3897 (setq parent-id nil))
3898 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3899 (setq ref-dep (intern (or parent-id "none") dependencies))
3900 (if (boundp ref-dep)
3901 (setcdr (symbol-value ref-dep)
3902 (nconc (cdr (symbol-value ref-dep))
3903 (list (symbol-value id-dep))))
3904 (set ref-dep (list nil (symbol-value id-dep)))))
3907 (defun gnus-extract-message-id-from-in-reply-to (string)
3908 (if (string-match "<[^>]+>" string)
3909 (substring string (match-beginning 0) (match-end 0))
3912 (defun gnus-build-sparse-threads ()
3913 (let ((headers gnus-newsgroup-headers)
3914 (mail-parse-charset gnus-newsgroup-charset)
3915 (gnus-summary-ignore-duplicates t)
3916 header references generation relations
3917 subject child end new-child date)
3918 ;; First we create an alist of generations/relations, where
3919 ;; generations is how much we trust the relation, and the relation
3921 (gnus-message 7 "Making sparse threads...")
3923 (nnheader-set-temp-buffer " *gnus sparse threads*")
3924 (while (setq header (pop headers))
3925 (when (and (setq references (mail-header-references header))
3926 (not (string= references "")))
3928 (setq child (mail-header-id header)
3929 subject (mail-header-subject header)
3930 date (mail-header-date header)
3932 (while (search-backward ">" nil t)
3933 (setq end (1+ (point)))
3934 (when (search-backward "<" nil t)
3935 (setq new-child (buffer-substring (point) end))
3936 (push (list (incf generation)
3937 child (setq child new-child)
3941 (push (list (1+ generation) child nil subject) relations))
3943 (kill-buffer (current-buffer)))
3944 ;; Sort over trustworthiness.
3947 (when (gnus-dependencies-add-header
3948 (make-full-mail-header
3949 gnus-reffed-article-number
3950 (nth 3 relation) "" (or (nth 4 relation) "")
3952 (or (nth 2 relation) "") 0 0 "")
3953 gnus-newsgroup-dependencies nil)
3954 (push gnus-reffed-article-number gnus-newsgroup-limit)
3955 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3956 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3957 gnus-newsgroup-reads)
3958 (decf gnus-reffed-article-number)))
3959 (sort relations 'car-less-than-car))
3960 (gnus-message 7 "Making sparse threads...done")))
3962 (defun gnus-build-old-threads ()
3963 ;; Look at all the articles that refer back to old articles, and
3964 ;; fetch the headers for the articles that aren't there. This will
3965 ;; build complete threads - if the roots haven't been expired by the
3967 (let ((mail-parse-charset gnus-newsgroup-charset)
3971 (when (not (car (symbol-value refs)))
3972 (setq heads (cdr (symbol-value refs)))
3974 (if (memq (mail-header-number (caar heads))
3975 gnus-newsgroup-dormant)
3976 (setq heads (cdr heads))
3977 (setq id (symbol-name refs))
3978 (while (and (setq id (gnus-build-get-header id))
3979 (not (car (gnus-id-to-thread id)))))
3980 (setq heads nil)))))
3981 gnus-newsgroup-dependencies)))
3983 (defsubst gnus-remove-odd-characters (string)
3984 "Translate STRING into something that doesn't contain weird characters."
3985 (mm-subst-char-in-string
3987 (mm-subst-char-in-string
3990 ;; This function has to be called with point after the article number
3991 ;; on the beginning of the line.
3992 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3993 (let ((eol (point-at-eol))
3994 (buffer (current-buffer))
3995 header references in-reply-to)
3997 ;; overview: [num subject from date id refs chars lines misc]
4000 (narrow-to-region (point) eol)
4005 (make-full-mail-header
4007 (condition-case () ; subject
4008 (gnus-remove-odd-characters
4009 (funcall gnus-decode-encoded-word-function
4010 (setq x (nnheader-nov-field))))
4012 (condition-case () ; from
4013 (gnus-remove-odd-characters
4014 (funcall gnus-decode-encoded-word-function
4015 (setq x (nnheader-nov-field))))
4017 (nnheader-nov-field) ; date
4018 (nnheader-nov-read-message-id) ; id
4019 (setq references (nnheader-nov-field)) ; refs
4020 (nnheader-nov-read-integer) ; chars
4021 (nnheader-nov-read-integer) ; lines
4023 (if (looking-at "Xref: ")
4024 (goto-char (match-end 0)))
4025 (nnheader-nov-field)) ; Xref
4026 (nnheader-nov-parse-extra)))) ; extra
4030 (when (and (string= references "")
4031 (setq in-reply-to (mail-header-extra header))
4032 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4033 (mail-header-set-references
4034 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4036 (when gnus-alter-header-function
4037 (funcall gnus-alter-header-function header))
4038 (gnus-dependencies-add-header header dependencies force-new)))
4040 (defun gnus-build-get-header (id)
4041 "Look through the buffer of NOV lines and find the header to ID.
4042 Enter this line into the dependencies hash table, and return
4043 the id of the parent article (if any)."
4044 (let ((deps gnus-newsgroup-dependencies)
4048 (set-buffer nntp-server-buffer)
4049 (let ((case-fold-search nil))
4050 (goto-char (point-min))
4051 (while (and (not found)
4052 (search-forward id nil t))
4054 (setq found (looking-at
4055 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4056 (regexp-quote id))))
4057 (or found (beginning-of-line 2)))
4061 (setq header (gnus-nov-parse-line
4062 (read (current-buffer)) deps))
4063 (gnus-parent-id (mail-header-references header))))))
4065 (let ((number (mail-header-number header)))
4066 (push number gnus-newsgroup-limit)
4067 (push header gnus-newsgroup-headers)
4068 (if (memq number gnus-newsgroup-unselected)
4070 (setq gnus-newsgroup-unreads
4071 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4073 (setq gnus-newsgroup-unselected
4074 (delq number gnus-newsgroup-unselected)))
4075 (push number gnus-newsgroup-ancient)))))))
4077 (defun gnus-build-all-threads ()
4078 "Read all the headers."
4079 (let ((gnus-summary-ignore-duplicates t)
4080 (mail-parse-charset gnus-newsgroup-charset)
4081 (dependencies gnus-newsgroup-dependencies)
4084 (set-buffer nntp-server-buffer)
4085 (let ((case-fold-search nil))
4086 (goto-char (point-min))
4089 (setq article (read (current-buffer))
4090 header (gnus-nov-parse-line article dependencies)))
4093 (set-buffer gnus-summary-buffer)
4094 (push header gnus-newsgroup-headers)
4095 (if (memq (setq article (mail-header-number header))
4096 gnus-newsgroup-unselected)
4098 (setq gnus-newsgroup-unreads
4099 (gnus-add-to-sorted-list
4100 gnus-newsgroup-unreads article))
4101 (setq gnus-newsgroup-unselected
4102 (delq article gnus-newsgroup-unselected)))
4103 (push article gnus-newsgroup-ancient)))
4104 (forward-line 1)))))))
4106 (defun gnus-summary-update-article-line (article header)
4107 "Update the line for ARTICLE using HEADER."
4108 (let* ((id (mail-header-id header))
4109 (thread (gnus-id-to-thread id)))
4111 (error "Article in no thread"))
4112 ;; Update the thread.
4113 (setcar thread header)
4114 (gnus-summary-goto-subject article)
4115 (let* ((datal (gnus-data-find-list article))
4117 (buffer-read-only nil)
4118 (level (gnus-summary-thread-level)))
4120 (let ((inserted (- (point)
4122 (gnus-summary-insert-line
4124 (memq article gnus-newsgroup-undownloaded)
4125 (gnus-article-mark article)
4126 (memq article gnus-newsgroup-replied)
4127 (memq article gnus-newsgroup-expirable)
4128 ;; Only insert the Subject string when it's different
4129 ;; from the previous Subject string.
4134 (mail-header-subject
4137 (gnus-data-find-list
4139 (gnus-data-list t)))))
4140 ;; Error on the side of excessive subjects.
4142 (mail-header-subject header)))
4144 (mail-header-subject header))
4145 nil (cdr (assq article gnus-newsgroup-scored))
4146 (memq article gnus-newsgroup-processable))
4149 (gnus-data-update-list
4151 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4153 (defun gnus-summary-update-article (article &optional iheader)
4154 "Update ARTICLE in the summary buffer."
4155 (set-buffer gnus-summary-buffer)
4156 (let* ((header (gnus-summary-article-header article))
4157 (id (mail-header-id header))
4158 (data (gnus-data-find article))
4159 (thread (gnus-id-to-thread id))
4160 (references (mail-header-references header))
4164 (when (and references
4165 (not (equal "" references)))
4168 (buffer-read-only nil)
4174 (delq thread parent)))
4175 (if (gnus-summary-insert-subject id header)
4176 ;; Set the (possibly) new article number in the data structure.
4177 (gnus-data-set-number data (gnus-id-to-article id))
4181 (defun gnus-rebuild-thread (id &optional line)
4182 "Rebuild the thread containing ID.
4183 If LINE, insert the rebuilt thread starting on line LINE."
4184 (let ((buffer-read-only nil)
4185 old-pos current thread data)
4186 (if (not gnus-show-threads)
4187 (setq thread (list (car (gnus-id-to-thread id))))
4188 ;; Get the thread this article is part of.
4189 (setq thread (gnus-remove-thread id)))
4190 (setq old-pos (point-at-bol))
4191 (setq current (save-excursion
4192 (and (re-search-backward "[\r\n]" nil t)
4193 (gnus-summary-article-number))))
4194 ;; If this is a gathered thread, we have to go some re-gathering.
4195 (when (stringp (car thread))
4196 (let ((subject (car thread))
4198 (setq thread (cdr thread))
4200 (unless (memq (setq thr (gnus-id-to-thread
4202 (mail-header-id (caar thread)))))
4205 (setq thread (cdr thread)))
4206 ;; We now have all (unique) roots.
4207 (if (= (length roots) 1)
4208 ;; All the loose roots are now one solid root.
4209 (setq thread (car roots))
4210 (setq thread (cons subject (gnus-sort-threads roots))))))
4212 ;; We then insert this thread into the summary buffer.
4214 (goto-char (point-min))
4215 (forward-line (1- line)))
4216 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4217 (if gnus-show-threads
4218 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4219 (gnus-summary-prepare-unthreaded thread))
4220 (setq data (nreverse gnus-newsgroup-data))
4221 (setq threads gnus-newsgroup-threads))
4222 ;; We splice the new data into the data structure.
4223 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4224 ;;!!! then we want to insert at the beginning of the buffer.
4225 ;;!!! That happens to be true with Gnus now, but that may
4226 ;;!!! change in the future. Perhaps.
4227 (gnus-data-enter-list
4228 (if line nil current) data (- (point) old-pos))
4229 (setq gnus-newsgroup-threads
4230 (nconc threads gnus-newsgroup-threads))
4231 (gnus-data-compute-positions))))
4233 (defun gnus-number-to-header (number)
4234 "Return the header for article NUMBER."
4235 (let ((headers gnus-newsgroup-headers))
4237 (not (= number (mail-header-number (car headers)))))
4242 (defun gnus-parent-headers (in-headers &optional generation)
4243 "Return the headers of the GENERATIONeth parent of HEADERS."
4245 (setq generation 1))
4247 (headers in-headers)
4250 (not (zerop generation))
4251 (setq references (mail-header-references headers)))
4252 (setq headers (if (and references
4253 (setq parent (gnus-parent-id references)))
4254 (car (gnus-id-to-thread parent))
4257 (and (not (eq headers in-headers))
4260 (defun gnus-id-to-thread (id)
4261 "Return the (sub-)thread where ID appears."
4262 (gnus-gethash id gnus-newsgroup-dependencies))
4264 (defun gnus-id-to-article (id)
4265 "Return the article number of ID."
4266 (let ((thread (gnus-id-to-thread id)))
4269 (mail-header-number (car thread)))))
4271 (defun gnus-id-to-header (id)
4272 "Return the article headers of ID."
4273 (car (gnus-id-to-thread id)))
4275 (defun gnus-article-displayed-root-p (article)
4276 "Say whether ARTICLE is a root(ish) article."
4277 (let ((level (gnus-summary-thread-level article))
4278 (refs (mail-header-references (gnus-summary-article-header article)))
4284 ((null (gnus-parent-id refs)) t)
4286 (null (setq particle (gnus-id-to-article
4287 (gnus-parent-id refs))))
4288 (null (gnus-summary-thread-level particle)))))))
4290 (defun gnus-root-id (id)
4291 "Return the id of the root of the thread where ID appears."
4293 (while (and id (setq prev (car (gnus-id-to-thread id))))
4295 id (gnus-parent-id (mail-header-references prev))))
4298 (defun gnus-articles-in-thread (thread)
4299 "Return the list of articles in THREAD."
4300 (cons (mail-header-number (car thread))
4301 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4303 (defun gnus-remove-thread (id &optional dont-remove)
4304 "Remove the thread that has ID in it."
4305 (let (headers thread last-id)
4306 ;; First go up in this thread until we find the root.
4307 (setq last-id (gnus-root-id id)
4308 headers (message-flatten-list (gnus-id-to-thread last-id)))
4309 ;; We have now found the real root of this thread. It might have
4310 ;; been gathered into some loose thread, so we have to search
4311 ;; through the threads to find the thread we wanted.
4312 (let ((threads gnus-newsgroup-threads)
4315 (setq sub (car threads))
4316 (if (stringp (car sub))
4317 ;; This is a gathered thread, so we look at the roots
4318 ;; below it to find whether this article is in this
4321 (setq sub (cdr sub))
4323 (when (member (caar sub) headers)
4324 (setq thread (car threads)
4327 (setq sub (cdr sub))))
4328 ;; It's an ordinary thread, so we check it.
4329 (when (eq (car sub) (car headers))
4332 (setq threads (cdr threads)))
4333 ;; If this article is in no thread, then it's a root.
4336 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4337 (setq thread (gnus-id-to-thread last-id)))
4340 thread ; We return this thread.
4342 (if (stringp (car thread))
4344 ;; If we use dummy roots, then we have to remove the
4345 ;; dummy root as well.
4346 (when (eq gnus-summary-make-false-root 'dummy)
4347 ;; We go to the dummy root by going to
4348 ;; the first sub-"thread", and then one line up.
4349 (gnus-summary-goto-article
4350 (mail-header-number (caadr thread)))
4353 (gnus-data-compute-positions))
4354 (setq thread (cdr thread))
4356 (gnus-remove-thread-1 (car thread))
4357 (setq thread (cdr thread))))
4358 (gnus-remove-thread-1 thread))))))))
4360 (defun gnus-remove-thread-1 (thread)
4361 "Remove the thread THREAD recursively."
4362 (let ((number (mail-header-number (pop thread)))
4364 (setq thread (reverse thread))
4366 (gnus-remove-thread-1 (pop thread)))
4367 (when (setq d (gnus-data-find number))
4368 (goto-char (gnus-data-pos d))
4369 (gnus-summary-show-thread)
4375 (gnus-delete-line)))))))
4377 (defun gnus-sort-threads-1 (threads func)
4378 (sort (mapcar (lambda (thread)
4381 (gnus-sort-threads-1 (cdr thread) func))))
4384 (defun gnus-sort-threads (threads)
4386 (if (not gnus-thread-sort-functions)
4388 (gnus-message 8 "Sorting threads...")
4389 (let ((max-lisp-eval-depth 5000))
4390 (prog1 (gnus-sort-threads-1
4392 (gnus-make-sort-function gnus-thread-sort-functions))
4393 (gnus-message 8 "Sorting threads...done")))))
4395 (defun gnus-sort-articles (articles)
4397 (when gnus-article-sort-functions
4398 (gnus-message 7 "Sorting articles...")
4400 (setq gnus-newsgroup-headers
4401 (sort articles (gnus-make-sort-function
4402 gnus-article-sort-functions)))
4403 (gnus-message 7 "Sorting articles...done"))))
4405 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4406 (defmacro gnus-thread-header (thread)
4407 "Return header of first article in THREAD.
4408 Note that THREAD must never, ever be anything else than a variable -
4409 using some other form will lead to serious barfage."
4410 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4411 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4412 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4415 (defsubst gnus-article-sort-by-number (h1 h2)
4416 "Sort articles by article number."
4417 (< (mail-header-number h1)
4418 (mail-header-number h2)))
4420 (defun gnus-thread-sort-by-number (h1 h2)
4421 "Sort threads by root article number."
4422 (gnus-article-sort-by-number
4423 (gnus-thread-header h1) (gnus-thread-header h2)))
4425 (defsubst gnus-article-sort-by-random (h1 h2)
4426 "Sort articles by article number."
4429 (defun gnus-thread-sort-by-random (h1 h2)
4430 "Sort threads by root article number."
4431 (gnus-article-sort-by-random
4432 (gnus-thread-header h1) (gnus-thread-header h2)))
4434 (defsubst gnus-article-sort-by-lines (h1 h2)
4435 "Sort articles by article Lines header."
4436 (< (mail-header-lines h1)
4437 (mail-header-lines h2)))
4439 (defun gnus-thread-sort-by-lines (h1 h2)
4440 "Sort threads by root article Lines header."
4441 (gnus-article-sort-by-lines
4442 (gnus-thread-header h1) (gnus-thread-header h2)))
4444 (defsubst gnus-article-sort-by-chars (h1 h2)
4445 "Sort articles by octet length."
4446 (< (mail-header-chars h1)
4447 (mail-header-chars h2)))
4449 (defun gnus-thread-sort-by-chars (h1 h2)
4450 "Sort threads by root article octet length."
4451 (gnus-article-sort-by-chars
4452 (gnus-thread-header h1) (gnus-thread-header h2)))
4454 (defsubst gnus-article-sort-by-author (h1 h2)
4455 "Sort articles by root author."
4457 (let ((extract (funcall
4458 gnus-extract-address-components
4459 (mail-header-from h1))))
4460 (or (car extract) (cadr extract) ""))
4461 (let ((extract (funcall
4462 gnus-extract-address-components
4463 (mail-header-from h2))))
4464 (or (car extract) (cadr extract) ""))))
4466 (defun gnus-thread-sort-by-author (h1 h2)
4467 "Sort threads by root author."
4468 (gnus-article-sort-by-author
4469 (gnus-thread-header h1) (gnus-thread-header h2)))
4471 (defsubst gnus-article-sort-by-subject (h1 h2)
4472 "Sort articles by root subject."
4474 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4475 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4477 (defun gnus-thread-sort-by-subject (h1 h2)
4478 "Sort threads by root subject."
4479 (gnus-article-sort-by-subject
4480 (gnus-thread-header h1) (gnus-thread-header h2)))
4482 (defsubst gnus-article-sort-by-date (h1 h2)
4483 "Sort articles by root article date."
4485 (gnus-date-get-time (mail-header-date h1))
4486 (gnus-date-get-time (mail-header-date h2))))
4488 (defun gnus-thread-sort-by-date (h1 h2)
4489 "Sort threads by root article date."
4490 (gnus-article-sort-by-date
4491 (gnus-thread-header h1) (gnus-thread-header h2)))
4493 (defsubst gnus-article-sort-by-score (h1 h2)
4494 "Sort articles by root article score.
4495 Unscored articles will be counted as having a score of zero."
4496 (> (or (cdr (assq (mail-header-number h1)
4497 gnus-newsgroup-scored))
4498 gnus-summary-default-score 0)
4499 (or (cdr (assq (mail-header-number h2)
4500 gnus-newsgroup-scored))
4501 gnus-summary-default-score 0)))
4503 (defun gnus-thread-sort-by-score (h1 h2)
4504 "Sort threads by root article score."
4505 (gnus-article-sort-by-score
4506 (gnus-thread-header h1) (gnus-thread-header h2)))
4508 (defun gnus-thread-sort-by-total-score (h1 h2)
4509 "Sort threads by the sum of all scores in the thread.
4510 Unscored articles will be counted as having a score of zero."
4511 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4513 (defun gnus-thread-total-score (thread)
4514 ;; This function find the total score of THREAD.
4519 (if (stringp (car thread))
4520 (apply gnus-thread-score-function 0
4521 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4522 (gnus-thread-total-score-1 thread)))
4524 (gnus-thread-total-score-1 (list thread)))))
4526 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4527 "Sort threads such that the thread with the most recently arrived article comes first."
4528 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4530 (defun gnus-thread-highest-number (thread)
4531 "Return the highest article number in THREAD."
4532 (apply 'max (mapcar (lambda (header)
4533 (mail-header-number header))
4534 (message-flatten-list thread))))
4536 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4537 "Sort threads such that the thread with the most recently dated article comes first."
4538 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4540 (defun gnus-thread-latest-date (thread)
4541 "Return the highest article date in THREAD."
4542 (let ((previous-time 0))
4548 (time-to-seconds (mail-header-parse-date
4549 (mail-header-date header)))
4550 (error previous-time))))
4552 (message-flatten-list thread)
4554 (< (mail-header-number h1)
4555 (mail-header-number h2))))))))
4557 (defun gnus-thread-total-score-1 (root)
4558 ;; This function find the total score of the thread below ROOT.
4559 (setq root (car root))
4560 (apply gnus-thread-score-function
4562 (mapcar 'gnus-thread-total-score
4563 (cdr (gnus-id-to-thread (mail-header-id root))))
4564 (when (> (mail-header-number root) 0)
4565 (list (or (cdr (assq (mail-header-number root)
4566 gnus-newsgroup-scored))
4567 gnus-summary-default-score 0))))
4568 (list gnus-summary-default-score)
4571 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4572 (defvar gnus-tmp-prev-subject nil)
4573 (defvar gnus-tmp-false-parent nil)
4574 (defvar gnus-tmp-root-expunged nil)
4575 (defvar gnus-tmp-dummy-line nil)
4577 (eval-when-compile (defvar gnus-tmp-header))
4578 (defun gnus-extra-header (type &optional header)
4579 "Return the extra header of TYPE."
4580 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4583 (defvar gnus-tmp-thread-tree-header-string "")
4585 (defcustom gnus-sum-thread-tree-root "> "
4586 "With %B spec, used for the root of a thread.
4587 If nil, use subject instead."
4588 :type '(radio (const :format "%v " nil) (string :size 0))
4589 :group 'gnus-thread)
4590 (defcustom gnus-sum-thread-tree-false-root "> "
4591 "With %B spec, used for a false root of a thread.
4592 If nil, use subject instead."
4593 :type '(radio (const :format "%v " nil) (string :size 0))
4594 :group 'gnus-thread)
4595 (defcustom gnus-sum-thread-tree-single-indent ""
4596 "With %B spec, used for a thread with just one message.
4597 If nil, use subject instead."
4598 :type '(radio (const :format "%v " nil) (string :size 0))
4599 :group 'gnus-thread)
4600 (defcustom gnus-sum-thread-tree-vertical "| "
4601 "With %B spec, used for drawing a vertical line."
4603 :group 'gnus-thread)
4604 (defcustom gnus-sum-thread-tree-indent " "
4605 "With %B spec, used for indenting."
4607 :group 'gnus-thread)
4608 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4609 "With %B spec, used for a leaf with brothers."
4611 :group 'gnus-thread)
4612 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4613 "With %B spec, used for a leaf without brothers."
4615 :group 'gnus-thread)
4617 (defun gnus-summary-prepare-threads (threads)
4618 "Prepare summary buffer from THREADS and indentation LEVEL.
4619 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4620 or a straight list of headers."
4621 (gnus-message 7 "Generating summary...")
4623 (setq gnus-newsgroup-threads threads)
4626 (let ((gnus-tmp-level 0)
4627 (default-score (or gnus-summary-default-score 0))
4628 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4629 (building-line-count gnus-summary-display-while-building)
4630 (building-count (integerp gnus-summary-display-while-building))
4631 thread number subject stack state gnus-tmp-gathered beg-match
4632 new-roots gnus-tmp-new-adopts thread-end simp-subject
4633 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4634 gnus-tmp-replied gnus-tmp-subject-or-nil
4635 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4636 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4637 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4640 (setq gnus-tmp-prev-subject nil
4641 gnus-tmp-thread-tree-header-string "")
4643 (if (vectorp (car threads))
4644 ;; If this is a straight (sic) list of headers, then a
4645 ;; threaded summary display isn't required, so we just create
4646 ;; an unthreaded one.
4647 (gnus-summary-prepare-unthreaded threads)
4649 ;; Do the threaded display.
4651 (if gnus-summary-display-while-building
4652 (switch-to-buffer (buffer-name)))
4653 (while (or threads stack gnus-tmp-new-adopts new-roots)
4655 (if (and (= gnus-tmp-level 0)
4658 (not gnus-tmp-false-parent)
4659 (or gnus-tmp-new-adopts new-roots))
4660 (if gnus-tmp-new-adopts
4661 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4662 thread (list (car gnus-tmp-new-adopts))
4663 gnus-tmp-header (caar thread)
4664 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4666 (setq thread (list (car new-roots))
4667 gnus-tmp-header (caar thread)
4668 new-roots (cdr new-roots))))
4671 ;; If there are some threads, we do them before the
4672 ;; threads on the stack.
4673 (setq thread threads
4674 gnus-tmp-header (caar thread))
4675 ;; There were no current threads, so we pop something off
4677 (setq state (car stack)
4678 gnus-tmp-level (car state)
4679 tree-stack (cadr state)
4680 thread (caddr state)
4682 gnus-tmp-header (caar thread))))
4684 (setq gnus-tmp-false-parent nil)
4685 (setq gnus-tmp-root-expunged nil)
4686 (setq thread-end nil)
4688 (if (stringp gnus-tmp-header)
4689 ;; The header is a dummy root.
4691 ((eq gnus-summary-make-false-root 'adopt)
4692 ;; We let the first article adopt the rest.
4693 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4695 (setq gnus-tmp-gathered
4697 (lambda (h) (mail-header-number (car h)))
4700 (setq thread (cons (list (caar thread)
4703 (setq gnus-tmp-level -1
4704 gnus-tmp-false-parent t))
4705 ((eq gnus-summary-make-false-root 'empty)
4706 ;; We print adopted articles with empty subject fields.
4707 (setq gnus-tmp-gathered
4709 (lambda (h) (mail-header-number (car h)))
4712 (setq gnus-tmp-level -1))
4713 ((eq gnus-summary-make-false-root 'dummy)
4714 ;; We remember that we probably want to output a dummy
4716 (setq gnus-tmp-dummy-line gnus-tmp-header)
4717 (setq gnus-tmp-prev-subject gnus-tmp-header))
4719 ;; We do not make a root for the gathered
4720 ;; sub-threads at all.
4721 (setq gnus-tmp-level -1)))
4723 (setq number (mail-header-number gnus-tmp-header)
4724 subject (mail-header-subject gnus-tmp-header)
4725 simp-subject (gnus-simplify-subject-fully subject))
4728 ;; If the thread has changed subject, we might want to make
4729 ;; this subthread into a root.
4730 ((and (null gnus-thread-ignore-subject)
4731 (not (zerop gnus-tmp-level))
4732 gnus-tmp-prev-subject
4733 (not (string= gnus-tmp-prev-subject simp-subject)))
4734 (setq new-roots (nconc new-roots (list (car thread)))
4736 gnus-tmp-header nil))
4737 ;; If the article lies outside the current limit,
4738 ;; then we do not display it.
4739 ((not (memq number gnus-newsgroup-limit))
4740 (setq gnus-tmp-gathered
4742 (lambda (h) (mail-header-number (car h)))
4745 (setq gnus-tmp-new-adopts (if (cdar thread)
4746 (append gnus-tmp-new-adopts
4748 gnus-tmp-new-adopts)
4750 gnus-tmp-header nil)
4751 (when (zerop gnus-tmp-level)
4752 (setq gnus-tmp-root-expunged t)))
4753 ;; Perhaps this article is to be marked as read?
4754 ((and gnus-summary-mark-below
4755 (< (or (cdr (assq number gnus-newsgroup-scored))
4757 gnus-summary-mark-below)
4758 ;; Don't touch sparse articles.
4759 (not (gnus-summary-article-sparse-p number))
4760 (not (gnus-summary-article-ancient-p number)))
4761 (setq gnus-newsgroup-unreads
4762 (delq number gnus-newsgroup-unreads))
4763 (if gnus-newsgroup-auto-expire
4764 (setq gnus-newsgroup-expirable
4765 (gnus-add-to-sorted-list
4766 gnus-newsgroup-expirable number))
4767 (push (cons number gnus-low-score-mark)
4768 gnus-newsgroup-reads))))
4770 (when gnus-tmp-header
4771 ;; We may have an old dummy line to output before this
4773 (when (and gnus-tmp-dummy-line
4776 (mail-header-subject gnus-tmp-header)))
4777 (gnus-summary-insert-dummy-line
4778 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4779 (setq gnus-tmp-dummy-line nil))
4781 ;; Compute the mark.
4782 (setq gnus-tmp-unread (gnus-article-mark number))
4784 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4785 gnus-tmp-header gnus-tmp-level)
4786 gnus-newsgroup-data)
4788 ;; Actually insert the line.
4790 gnus-tmp-subject-or-nil
4792 ((and gnus-thread-ignore-subject
4793 gnus-tmp-prev-subject
4794 (not (string= gnus-tmp-prev-subject simp-subject)))
4796 ((zerop gnus-tmp-level)
4797 (if (and (eq gnus-summary-make-false-root 'empty)
4798 (memq number gnus-tmp-gathered)
4799 gnus-tmp-prev-subject
4800 (string= gnus-tmp-prev-subject simp-subject))
4801 gnus-summary-same-subject
4803 (t gnus-summary-same-subject)))
4804 (if (and (eq gnus-summary-make-false-root 'adopt)
4805 (= gnus-tmp-level 1)
4806 (memq number gnus-tmp-gathered))
4807 (setq gnus-tmp-opening-bracket ?\<
4808 gnus-tmp-closing-bracket ?\>)
4809 (setq gnus-tmp-opening-bracket ?\[
4810 gnus-tmp-closing-bracket ?\]))
4812 gnus-tmp-indentation
4813 (aref gnus-thread-indent-array gnus-tmp-level)
4814 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4815 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4816 gnus-summary-default-score 0)
4818 (if (or (null gnus-summary-default-score)
4819 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4820 gnus-summary-zcore-fuzz))
4822 (if (< gnus-tmp-score gnus-summary-default-score)
4823 gnus-score-below-mark gnus-score-over-mark))
4825 (cond ((memq number gnus-newsgroup-processable)
4827 ((memq number gnus-newsgroup-cached)
4829 ((memq number gnus-newsgroup-replied)
4831 ((memq number gnus-newsgroup-forwarded)
4832 gnus-forwarded-mark)
4833 ((memq number gnus-newsgroup-saved)
4835 ((memq number gnus-newsgroup-recent)
4837 ((memq number gnus-newsgroup-unseen)
4841 (cond ((memq number gnus-newsgroup-undownloaded)
4842 gnus-undownloaded-mark)
4843 (gnus-newsgroup-agentized
4844 gnus-downloaded-mark)
4847 gnus-tmp-from (mail-header-from gnus-tmp-header)
4850 ((string-match "<[^>]+> *$" gnus-tmp-from)
4851 (setq beg-match (match-beginning 0))
4852 (or (and (string-match "^\".+\"" gnus-tmp-from)
4853 (substring gnus-tmp-from 1 (1- (match-end 0))))
4854 (substring gnus-tmp-from 0 beg-match)))
4855 ((string-match "(.+)" gnus-tmp-from)
4856 (substring gnus-tmp-from
4857 (1+ (match-beginning 0)) (1- (match-end 0))))
4861 gnus-tmp-thread-tree-header-string
4863 ((not gnus-show-threads) "")
4864 ((zerop gnus-tmp-level)
4865 (cond ((cdar thread)
4866 (or gnus-sum-thread-tree-root subject))
4867 (gnus-tmp-new-adopts
4868 (or gnus-sum-thread-tree-false-root subject))
4870 (or gnus-sum-thread-tree-single-indent subject))))
4872 (concat (apply 'concat
4873 (mapcar (lambda (item)
4875 gnus-sum-thread-tree-vertical
4876 gnus-sum-thread-tree-indent))
4877 (cdr (reverse tree-stack))))
4879 gnus-sum-thread-tree-leaf-with-other
4880 gnus-sum-thread-tree-single-leaf)))))
4881 (when (string= gnus-tmp-name "")
4882 (setq gnus-tmp-name gnus-tmp-from))
4883 (unless (numberp gnus-tmp-lines)
4884 (setq gnus-tmp-lines -1))
4885 (if (= gnus-tmp-lines -1)
4886 (setq gnus-tmp-lines "?")
4887 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4888 (gnus-put-text-property
4890 (progn (eval gnus-summary-line-format-spec) (point))
4891 'gnus-number number)
4894 (gnus-run-hooks 'gnus-summary-update-hook)
4897 (setq gnus-tmp-prev-subject simp-subject)))
4899 (when (nth 1 thread)
4900 (push (list (max 0 gnus-tmp-level)
4901 (copy-sequence tree-stack)
4904 (push (if (nth 1 thread) 1 0) tree-stack)
4905 (incf gnus-tmp-level)
4906 (setq threads (if thread-end nil (cdar thread)))
4907 (if gnus-summary-display-while-building
4910 ;; use a set frequency
4911 (setq building-line-count (1- building-line-count))
4912 (when (= building-line-count 0)
4914 (setq building-line-count
4915 gnus-summary-display-while-building)))
4919 (setq gnus-tmp-level 0)))))
4920 (gnus-message 7 "Generating summary...done"))
4922 (defun gnus-summary-prepare-unthreaded (headers)
4923 "Generate an unthreaded summary buffer based on HEADERS."
4924 (let (header number mark)
4929 ;; We may have to root out some bad articles...
4930 (when (memq (setq number (mail-header-number
4931 (setq header (pop headers))))
4932 gnus-newsgroup-limit)
4933 ;; Mark article as read when it has a low score.
4934 (when (and gnus-summary-mark-below
4935 (< (or (cdr (assq number gnus-newsgroup-scored))
4936 gnus-summary-default-score 0)
4937 gnus-summary-mark-below)
4938 (not (gnus-summary-article-ancient-p number)))
4939 (setq gnus-newsgroup-unreads
4940 (delq number gnus-newsgroup-unreads))
4941 (if gnus-newsgroup-auto-expire
4942 (push number gnus-newsgroup-expirable)
4943 (push (cons number gnus-low-score-mark)
4944 gnus-newsgroup-reads)))
4946 (setq mark (gnus-article-mark number))
4947 (push (gnus-data-make number mark (1+ (point)) header 0)
4948 gnus-newsgroup-data)
4949 (gnus-summary-insert-line
4951 (memq number gnus-newsgroup-undownloaded)
4952 mark (memq number gnus-newsgroup-replied)
4953 (memq number gnus-newsgroup-expirable)
4954 (mail-header-subject header) nil
4955 (cdr (assq number gnus-newsgroup-scored))
4956 (memq number gnus-newsgroup-processable))))))
4958 (defun gnus-summary-remove-list-identifiers ()
4959 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4960 (let ((regexp (if (consp gnus-list-identifiers)
4961 (mapconcat 'identity gnus-list-identifiers " *\\|")
4962 gnus-list-identifiers))
4965 (dolist (header gnus-newsgroup-headers)
4966 (setq subject (mail-header-subject header)
4968 (while (string-match
4969 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4972 (concat (substring subject 0 (match-beginning 2))
4973 (substring subject (match-end 0)))
4977 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4979 (concat (substring subject 0 (match-beginning 1))
4980 (substring subject (match-end 1)))))
4982 (mail-header-set-subject header subject))))))
4984 (defun gnus-fetch-headers (articles)
4985 "Fetch headers of ARTICLES."
4986 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4987 (gnus-message 5 "Fetching headers for %s..." name)
4990 (setq gnus-headers-retrieved-by
4991 (gnus-retrieve-headers
4992 articles gnus-newsgroup-name
4993 ;; We might want to fetch old headers, but
4994 ;; not if there is only 1 article.
4996 (not (eq gnus-fetch-old-headers 'some))
4997 (not (numberp gnus-fetch-old-headers)))
4998 (> (length articles) 1))
4999 gnus-fetch-old-headers))))
5000 (gnus-get-newsgroup-headers-xover
5001 articles nil nil gnus-newsgroup-name t)
5002 (gnus-get-newsgroup-headers))
5003 (gnus-message 5 "Fetching headers for %s...done" name))))
5005 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5006 "Select newsgroup GROUP.
5007 If READ-ALL is non-nil, all articles in the group are selected.
5008 If SELECT-ARTICLES, only select those articles from GROUP."
5009 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5010 ;;!!! Dirty hack; should be removed.
5011 (gnus-summary-ignore-duplicates
5012 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5014 gnus-summary-ignore-duplicates))
5015 (info (nth 2 entry))
5016 articles fetched-articles cached)
5018 (unless (gnus-check-server
5019 (set (make-local-variable 'gnus-current-select-method)
5020 (gnus-find-method-for-group group)))
5021 (error "Couldn't open server"))
5023 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5024 (gnus-activate-group group) ; Or we can activate it...
5025 (progn ; Or we bug out.
5026 (when (equal major-mode 'gnus-summary-mode)
5027 (gnus-kill-buffer (current-buffer)))
5028 (error "Couldn't activate group %s: %s"
5029 group (gnus-status-message group))))
5031 (unless (gnus-request-group group t)
5032 (when (equal major-mode 'gnus-summary-mode)
5033 (gnus-kill-buffer (current-buffer)))
5034 (error "Couldn't request group %s: %s"
5035 group (gnus-status-message group)))
5038 ;; The agent may be storing articles that are no longer in the
5039 ;; server's active range. If that is the case, the active range
5040 ;; needs to be expanded such that the agent's articles can be
5041 ;; included in the summary.
5042 (let* ((gnus-command-method (gnus-find-method-for-group group))
5043 (alist (gnus-agent-load-alist group))
5044 (active (gnus-active group)))
5045 (if (and (car alist)
5046 (< (caar alist) (car active)))
5047 (gnus-set-active group (cons (caar alist) (cdr active)))))
5049 (setq gnus-summary-use-undownloaded-faces
5050 (gnus-agent-find-parameter
5052 'agent-enable-undownloaded-faces)))
5054 (setq gnus-newsgroup-name group
5055 gnus-newsgroup-unselected nil
5056 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5058 (let ((display (gnus-group-find-parameter group 'display)))
5059 (setq gnus-newsgroup-display
5061 ((not (zerop (or (car-safe read-all) 0)))
5062 ;; The user entered the group with C-u SPC/RET, let's show
5068 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5070 ;; The following is probably the "correct" solution, but
5071 ;; it makes Gnus fetch all headers and then limit the
5072 ;; articles (which is slow), so instead we hack the
5073 ;; select-articles parameter instead. -- Simon Josefsson
5076 ;; (gnus-byte-compile
5077 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5079 (setq select-articles
5080 (gnus-uncompress-range
5081 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5085 (cdr (gnus-active group)))))
5090 (gnus-summary-setup-default-charset)
5092 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5093 (when (gnus-virtual-group-p group)
5094 (setq cached gnus-newsgroup-cached))
5096 (setq gnus-newsgroup-unreads
5097 (gnus-sorted-ndifference
5098 (gnus-sorted-ndifference gnus-newsgroup-unreads
5099 gnus-newsgroup-marked)
5100 gnus-newsgroup-dormant))
5102 (setq gnus-newsgroup-processable nil)
5104 (gnus-update-read-articles group gnus-newsgroup-unreads)
5106 ;; Adjust and set lists of article marks.
5108 (gnus-adjust-marked-articles info))
5109 (if (setq articles select-articles)
5110 (setq gnus-newsgroup-unselected
5111 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5112 (setq articles (gnus-articles-to-read group read-all)))
5116 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5118 ((eq articles 0) nil)
5120 ;; Init the dependencies hash table.
5121 (setq gnus-newsgroup-dependencies
5122 (gnus-make-hashtable (length articles)))
5123 (gnus-set-global-variables)
5124 ;; Retrieve the headers and read them in.
5126 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5128 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5130 (setq gnus-newsgroup-cached cached))
5132 ;; Suppress duplicates?
5133 (when gnus-suppress-duplicates
5134 (gnus-dup-suppress-articles))
5136 ;; Set the initial limit.
5137 (setq gnus-newsgroup-limit (copy-sequence articles))
5138 ;; Remove canceled articles from the list of unread articles.
5139 (setq fetched-articles
5140 (mapcar (lambda (headers) (mail-header-number headers))
5141 gnus-newsgroup-headers))
5142 (setq gnus-newsgroup-articles fetched-articles)
5143 (setq gnus-newsgroup-unreads
5144 (gnus-sorted-nintersection
5145 gnus-newsgroup-unreads fetched-articles))
5146 (gnus-compute-unseen-list)
5148 ;; Removed marked articles that do not exist.
5149 (gnus-update-missing-marks
5150 (gnus-sorted-difference articles fetched-articles))
5151 ;; We might want to build some more threads first.
5152 (when (and gnus-fetch-old-headers
5153 (eq gnus-headers-retrieved-by 'nov))
5154 (if (eq gnus-fetch-old-headers 'invisible)
5155 (gnus-build-all-threads)
5156 (gnus-build-old-threads)))
5157 ;; Let the Gnus agent mark articles as read.
5159 (gnus-agent-get-undownloaded-list))
5160 ;; Remove list identifiers from subject
5161 (when gnus-list-identifiers
5162 (gnus-summary-remove-list-identifiers))
5163 ;; Check whether auto-expire is to be done in this group.
5164 (setq gnus-newsgroup-auto-expire
5165 (gnus-group-auto-expirable-p group))
5166 ;; Set up the article buffer now, if necessary.
5167 (unless gnus-single-article-buffer
5168 (gnus-article-setup-buffer))
5169 ;; First and last article in this newsgroup.
5170 (when gnus-newsgroup-headers
5171 (setq gnus-newsgroup-begin
5172 (mail-header-number (car gnus-newsgroup-headers))
5175 (gnus-last-element gnus-newsgroup-headers))))
5176 ;; GROUP is successfully selected.
5177 (or gnus-newsgroup-headers t)))))
5179 (defun gnus-compute-unseen-list ()
5180 ;; The `seen' marks are treated specially.
5181 (if (not gnus-newsgroup-seen)
5182 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5183 (setq gnus-newsgroup-unseen
5184 (gnus-inverse-list-range-intersection
5185 gnus-newsgroup-articles gnus-newsgroup-seen))))
5187 (defun gnus-summary-display-make-predicate (display)
5188 (require 'gnus-agent)
5189 (when (= (length display) 1)
5190 (setq display (car display)))
5191 (unless gnus-summary-display-cache
5192 (dolist (elem (append '((unread . unread)
5195 gnus-article-mark-lists))
5196 (push (cons (cdr elem)
5198 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5199 gnus-summary-display-cache)))
5200 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5201 (gnus-category-predicate-cache gnus-summary-display-cache))
5202 (gnus-get-predicate display)))
5204 ;; Uses the dynamically bound `number' variable.
5207 (defun gnus-article-marked-p (type &optional article)
5208 (let ((article (or article number)))
5211 (memq article gnus-newsgroup-marked))
5213 (memq article gnus-newsgroup-spam-marked))
5215 (memq article gnus-newsgroup-unsendable))
5216 ((eq type 'undownload)
5217 (memq article gnus-newsgroup-undownloaded))
5218 ((eq type 'download)
5219 (memq article gnus-newsgroup-downloadable))
5221 (memq article gnus-newsgroup-unreads))
5223 (memq article gnus-newsgroup-reads))
5225 (memq article gnus-newsgroup-dormant) )
5227 (memq article gnus-newsgroup-expirable))
5229 (memq article gnus-newsgroup-replied))
5231 (memq article gnus-newsgroup-killed))
5232 ((eq type 'bookmark)
5233 (assq article gnus-newsgroup-bookmarks))
5235 (assq article gnus-newsgroup-scored))
5237 (memq article gnus-newsgroup-saved))
5239 (memq article gnus-newsgroup-cached))
5241 (memq article gnus-newsgroup-forwarded))
5243 (not (memq article gnus-newsgroup-unseen)))
5245 (memq article gnus-newsgroup-recent))
5248 (defun gnus-articles-to-read (group &optional read-all)
5249 "Find out what articles the user wants to read."
5250 (let* ((display (gnus-group-find-parameter group 'display))
5252 ;; Select all articles if `read-all' is non-nil, or if there
5253 ;; are no unread articles.
5255 (and (zerop (length gnus-newsgroup-marked))
5256 (zerop (length gnus-newsgroup-unreads)))
5257 ;; Fetch all if the predicate is non-nil.
5258 gnus-newsgroup-display)
5259 ;; We want to select the headers for all the articles in
5260 ;; the group, so we select either all the active
5261 ;; articles in the group, or (if that's nil), the
5262 ;; articles in the cache.
5264 (gnus-uncompress-range (gnus-active group))
5265 (gnus-cache-articles-in-group group))
5266 ;; Select only the "normal" subset of articles.
5268 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5269 gnus-newsgroup-unreads)))
5270 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5271 (scored (length scored-list))
5272 (number (length articles))
5273 (marked (+ (length gnus-newsgroup-marked)
5274 (length gnus-newsgroup-dormant)))
5279 ((numberp gnus-newsgroup-display)
5280 gnus-newsgroup-display)
5284 ((and (or (<= scored marked) (= scored number))
5285 (numberp gnus-large-newsgroup)
5286 (> number gnus-large-newsgroup))
5287 (let* ((cursor-in-echo-area nil)
5288 (initial (gnus-parameter-large-newsgroup-initial
5289 gnus-newsgroup-name))
5293 "How many articles from %s (%s %d): "
5295 (gnus-group-decoded-name gnus-newsgroup-name)
5297 (if initial "max" "default")
5300 (cons (number-to-string initial)
5302 (if (string-match "^[ \t]*$" input) number input)))
5303 ((and (> scored marked) (< scored number)
5304 (> (- scored number) 20))
5307 (format "%s %s (%d scored, %d total): "
5308 "How many articles from"
5309 (gnus-group-decoded-name group)
5311 (if (string-match "^[ \t]*$" input)
5315 (message "Quit getting the articles to read")
5317 (setq select (if (stringp select) (string-to-number select) select))
5318 (if (or (null select) (zerop select))
5320 (if (and (not (zerop scored)) (<= (abs select) scored))
5322 (setq articles (sort scored-list '<))
5323 (setq number (length articles)))
5324 (setq articles (copy-sequence articles)))
5326 (when (< (abs select) number)
5328 ;; Select the N oldest articles.
5329 (setcdr (nthcdr (1- (abs select)) articles) nil)
5330 ;; Select the N most recent articles.
5331 (setq articles (nthcdr (- number select) articles))))
5332 (setq gnus-newsgroup-unselected
5333 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5334 (when gnus-alter-articles-to-read-function
5337 (funcall gnus-alter-articles-to-read-function
5338 gnus-newsgroup-name articles)
5342 (defun gnus-killed-articles (killed articles)
5345 (when (inline (gnus-member-of-range (car articles) killed))
5346 (push (car articles) out))
5347 (setq articles (cdr articles)))
5350 (defun gnus-uncompress-marks (marks)
5351 "Uncompress the mark ranges in MARKS."
5352 (let ((uncompressed '(score bookmark))
5355 (if (memq (caar marks) uncompressed)
5356 (push (car marks) out)
5357 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5358 (setq marks (cdr marks)))
5361 (defun gnus-article-mark-to-type (mark)
5362 "Return the type of MARK."
5363 (or (cadr (assq mark gnus-article-special-mark-lists))
5366 (defun gnus-article-unpropagatable-p (mark)
5367 "Return whether MARK should be propagated to back end."
5368 (memq mark gnus-article-unpropagated-mark-lists))
5370 (defun gnus-adjust-marked-articles (info)
5371 "Set all article lists and remove all marks that are no longer valid."
5372 (let* ((marked-lists (gnus-info-marks info))
5373 (active (gnus-active (gnus-info-group info)))
5376 (types gnus-article-mark-lists)
5377 marks var articles article mark mark-type)
5379 (dolist (marks marked-lists)
5380 (setq mark (car marks)
5381 mark-type (gnus-article-mark-to-type mark)
5382 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5384 ;; We set the variable according to the type of the marks list,
5385 ;; and then adjust the marks to a subset of the active articles.
5387 ;; Adjust "simple" lists.
5388 ((eq mark-type 'list)
5389 (set var (setq articles (gnus-uncompress-range (cdr marks))))
5390 (when (memq mark '(tick dormant expire reply save))
5392 (when (or (< (setq article (pop articles)) min) (> article max))
5393 (set var (delq article (symbol-value var)))))))
5395 ((eq mark-type 'tuple)
5396 (set var (setq articles (cdr marks)))
5397 (when (not (listp (cdr (symbol-value var))))
5398 (set var (list (symbol-value var))))
5399 (when (not (listp (cdr articles)))
5400 (setq articles (list articles)))
5402 (when (or (not (consp (setq article (pop articles))))
5403 (< (car article) min)
5404 (> (car article) max))
5405 (set var (delq article (symbol-value var))))))
5406 ;; Adjust ranges (sloppily).
5407 ((eq mark-type 'range)
5410 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5411 ;; It should be (seen (NUM1 . NUM2)).
5412 (when (numberp (cddr marks))
5413 (setcdr marks (list (cdr marks))))
5414 (setq articles (cdr marks))
5415 (while (and articles
5416 (or (and (consp (car articles))
5417 (> min (cdar articles)))
5418 (and (numberp (car articles))
5419 (> min (car articles)))))
5421 (set var articles))))))))
5423 (defun gnus-update-missing-marks (missing)
5424 "Go through the list of MISSING articles and remove them from the mark lists."
5427 ;; Go through all types.
5428 (dolist (elem gnus-article-mark-lists)
5429 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5430 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5431 (when (symbol-value var)
5432 ;; This list has articles. So we delete all missing
5433 ;; articles from it.
5436 (set var (delq (pop m) (symbol-value var))))))))))
5438 (defun gnus-update-marks ()
5439 "Enter the various lists of marked articles into the newsgroup info list."
5440 (let ((types gnus-article-mark-lists)
5441 (info (gnus-get-info gnus-newsgroup-name))
5442 type list newmarked symbol delta-marks)
5444 ;; Add all marks lists to the list of marks lists.
5445 (while (setq type (pop types))
5446 (setq list (symbol-value
5448 (intern (format "gnus-newsgroup-%s" (car type))))))
5451 ;; Get rid of the entries of the articles that have the
5453 (when (and (eq (cdr type) 'score)
5457 (prev (cons nil list))
5460 (if (or (not (consp (car arts)))
5461 (= (cdar arts) gnus-summary-default-score))
5462 (setcdr prev (cdr arts))
5464 (setq arts (cdr arts)))
5465 (setq list (cdr all)))))
5467 (when (eq (cdr type) 'seen)
5468 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5470 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5471 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5473 (when (and (gnus-check-backend-function
5474 'request-set-mark gnus-newsgroup-name)
5475 (not (gnus-article-unpropagatable-p (cdr type))))
5476 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5477 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5478 (add (gnus-remove-from-range
5479 (gnus-copy-sequence list) old)))
5481 (push (list add 'add (list (cdr type))) delta-marks))
5483 (push (list del 'del (list (cdr type))) delta-marks))))
5486 (push (cons (cdr type) list) newmarked)))
5489 (unless (gnus-check-group gnus-newsgroup-name)
5490 (error "Can't open server for %s" gnus-newsgroup-name))
5491 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5493 ;; Enter these new marks into the info of the group.
5495 (setcar (nthcdr 3 info) newmarked)
5496 ;; Add the marks lists to the end of the info.
5498 (setcdr (nthcdr 2 info) (list newmarked))))
5500 ;; Cut off the end of the info if there's nothing else there.
5504 (when (nthcdr (decf i) info)
5505 (setcdr (nthcdr i info) nil)))))))
5507 (defun gnus-set-mode-line (where)
5508 "Set the mode line of the article or summary buffers.
5509 If WHERE is `summary', the summary mode line format will be used."
5510 ;; Is this mode line one we keep updated?
5511 (when (and (memq where gnus-updated-mode-lines)
5513 (intern (format "gnus-%s-mode-line-format-spec" where))))
5516 ;; We evaluate this in the summary buffer since these
5517 ;; variables are buffer-local to that buffer.
5518 (set-buffer gnus-summary-buffer)
5519 ;; We bind all these variables that are used in the `eval' form
5521 (let* ((mformat (symbol-value
5523 (format "gnus-%s-mode-line-format-spec" where))))
5524 (gnus-tmp-group-name (gnus-group-decoded-name
5525 gnus-newsgroup-name))
5526 (gnus-tmp-article-number (or gnus-current-article 0))
5527 (gnus-tmp-unread gnus-newsgroup-unreads)
5528 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5529 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5530 (gnus-tmp-unread-and-unselected
5531 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5532 (zerop gnus-tmp-unselected))
5534 ((zerop gnus-tmp-unselected)
5535 (format "{%d more}" gnus-tmp-unread-and-unticked))
5536 (t (format "{%d(+%d) more}"
5537 gnus-tmp-unread-and-unticked
5538 gnus-tmp-unselected))))
5540 (if (and gnus-current-headers
5541 (vectorp gnus-current-headers))
5542 (gnus-mode-string-quote
5543 (mail-header-subject gnus-current-headers))
5545 bufname-length max-len
5546 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5547 (setq mode-string (eval mformat))
5548 (setq bufname-length (if (string-match "%b" mode-string)
5551 (if (eq where 'summary)
5553 (get-buffer gnus-article-buffer))))
5556 (setq max-len (max 4 (if gnus-mode-non-string-length
5558 gnus-mode-non-string-length
5560 (length mode-string))))
5561 ;; We might have to chop a bit of the string off...
5562 (when (> (length mode-string) max-len)
5564 (concat (truncate-string-to-width mode-string (- max-len 3))
5566 ;; Pad the mode string a bit.
5567 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5568 ;; Update the mode line.
5569 (setq mode-line-buffer-identification
5570 (gnus-mode-line-buffer-identification (list mode-string)))
5571 (set-buffer-modified-p t))))
5573 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5574 "Go through the HEADERS list and add all Xrefs to a hash table.
5575 The resulting hash table is returned, or nil if no Xrefs were found."
5576 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5577 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5578 (xref-hashtb (gnus-make-hashtable))
5579 start group entry number xrefs header)
5581 (setq header (pop headers))
5582 (when (and (setq xrefs (mail-header-xref header))
5583 (not (memq (setq number (mail-header-number header))
5586 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5587 (setq start (match-end 0))
5588 (setq group (if prefix
5589 (concat prefix (substring xrefs (match-beginning 1)
5591 (substring xrefs (match-beginning 1) (match-end 1))))
5593 (string-to-int (substring xrefs (match-beginning 2)
5595 (if (setq entry (gnus-gethash group xref-hashtb))
5596 (setcdr entry (cons number (cdr entry)))
5597 (gnus-sethash group (cons number nil) xref-hashtb)))))
5598 (and start xref-hashtb)))
5600 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5601 "Look through all the headers and mark the Xrefs as read."
5602 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5603 name entry info xref-hashtb idlist method nth4)
5605 (set-buffer gnus-group-buffer)
5606 (when (setq xref-hashtb
5607 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5610 (unless (string= from-newsgroup (setq name (symbol-name group)))
5611 (setq idlist (symbol-value group))
5612 ;; Dead groups are not updated.
5614 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5616 (when (stringp (setq nth4 (gnus-info-method info)))
5617 (setq nth4 (gnus-server-to-method nth4))))
5618 ;; Only do the xrefs if the group has the same
5619 ;; select method as the group we have just read.
5620 (or (gnus-methods-equal-p
5621 nth4 (gnus-find-method-for-group from-newsgroup))
5623 (equal nth4 (setq method (gnus-find-method-for-group
5625 (and (equal (car nth4) (car method))
5626 (equal (nth 1 nth4) (nth 1 method))))
5627 gnus-use-cross-reference
5628 (or (not (eq gnus-use-cross-reference t))
5630 ;; Only do cross-references on subscribed
5631 ;; groups, if that is what is wanted.
5632 (<= (gnus-info-level info) gnus-level-subscribed))
5633 (gnus-group-make-articles-read name idlist))))
5636 (defun gnus-compute-read-articles (group articles)
5637 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5638 (info (nth 2 entry))
5639 (active (gnus-active group))
5642 ;; First peel off all invalid article numbers.
5644 (let ((ids articles)
5646 (while (setq id (pop ids))
5647 (when (and first (> id (cdr active)))
5648 ;; We'll end up in this situation in one particular
5649 ;; obscure situation. If you re-scan a group and get
5650 ;; a new article that is cross-posted to a different
5651 ;; group that has not been re-scanned, you might get
5652 ;; crossposted article that has a higher number than
5653 ;; Gnus believes possible. So we re-activate this
5654 ;; group as well. This might mean doing the
5655 ;; crossposting thingy will *increase* the number
5656 ;; of articles in some groups. Tsk, tsk.
5657 (setq active (or (gnus-activate-group group) active)))
5658 (when (or (> id (cdr active))
5659 (< id (car active)))
5660 (setq articles (delq id articles))))))
5661 ;; If the read list is nil, we init it.
5663 (null (gnus-info-read info))
5665 (setq ninfo (cons 1 (1- (car active))))
5666 (setq ninfo (gnus-info-read info)))
5667 ;; Then we add the read articles to the range.
5669 ninfo (setq articles (sort articles '<))))))
5671 (defun gnus-group-make-articles-read (group articles)
5672 "Update the info of GROUP to say that ARTICLES are read."
5674 (entry (gnus-gethash group gnus-newsrc-hashtb))
5675 (info (nth 2 entry))
5676 (active (gnus-active group))
5679 (setq range (gnus-compute-read-articles group articles))
5681 (set-buffer gnus-group-buffer)
5684 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5685 (gnus-info-set-read ',info ',(gnus-info-read info))
5686 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5687 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5688 (gnus-group-update-group ,group t))))
5689 ;; Add the read articles to the range.
5690 (gnus-info-set-read info range)
5691 (gnus-request-set-mark group (list (list range 'add '(read))))
5692 ;; Then we have to re-compute how many unread
5693 ;; articles there are in this group.
5697 (setq num (- (1+ (cdr active)) (car active))))
5698 ((not (listp (cdr range)))
5699 (setq num (- (cdr active) (- (1+ (cdr range))
5703 (if (numberp (car range))
5705 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5706 (setq range (cdr range)))
5707 (setq num (- (cdr active) num))))
5708 ;; Update the number of unread articles.
5710 ;; Update the group buffer.
5711 (unless (gnus-ephemeral-group-p group)
5712 (gnus-group-update-group group t))))))
5714 (defvar gnus-newsgroup-none-id 0)
5716 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5717 (let ((cur nntp-server-buffer)
5720 (save-excursion (set-buffer gnus-summary-buffer)
5721 gnus-newsgroup-dependencies)))
5723 (mail-parse-charset gnus-newsgroup-charset)
5724 (mail-parse-ignored-charsets
5725 (save-excursion (condition-case nil
5726 (set-buffer gnus-summary-buffer)
5728 gnus-newsgroup-ignored-charsets)))
5730 (set-buffer nntp-server-buffer)
5731 ;; Translate all TAB characters into SPACE characters.
5732 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5733 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5734 (ietf-drums-unfold-fws)
5735 (gnus-run-hooks 'gnus-parse-headers-hook)
5736 (let ((case-fold-search t)
5737 in-reply-to header p lines chars)
5738 (goto-char (point-min))
5739 ;; Search to the beginning of the next header. Error messages
5740 ;; do not begin with 2 or 3.
5741 (while (re-search-forward "^[23][0-9]+ " nil t)
5744 ;; This implementation of this function, with nine
5745 ;; search-forwards instead of the one re-search-forward and
5746 ;; a case (which basically was the old function) is actually
5747 ;; about twice as fast, even though it looks messier. You
5748 ;; can't have everything, I guess. Speed and elegance
5749 ;; doesn't always go hand in hand.
5758 (narrow-to-region (point)
5759 (or (and (search-forward "\n.\n" nil t)
5765 (if (search-forward "\nsubject:" nil t)
5766 (funcall gnus-decode-encoded-word-function
5767 (nnheader-header-value))
5772 (if (search-forward "\nfrom:" nil t)
5773 (funcall gnus-decode-encoded-word-function
5774 (nnheader-header-value))
5779 (if (search-forward "\ndate:" nil t)
5780 (nnheader-header-value) ""))
5784 (setq id (if (re-search-forward
5785 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5786 ;; We do it this way to make sure the Message-ID
5787 ;; is (somewhat) syntactically valid.
5788 (buffer-substring (match-beginning 1)
5790 ;; If there was no message-id, we just fake one
5791 ;; to make subsequent routines simpler.
5792 (nnheader-generate-fake-message-id))))
5796 (if (search-forward "\nreferences:" nil t)
5800 (nnheader-header-value)
5805 (search-backward ">" end t)
5808 (search-backward "<" end t)
5810 ;; Get the references from the in-reply-to header if there
5811 ;; were no references and the in-reply-to header looks
5813 (if (and (search-forward "\nin-reply-to:" nil t)
5814 (setq in-reply-to (nnheader-header-value))
5815 (string-match "<[^>]+>" in-reply-to))
5817 (setq ref (substring in-reply-to (match-beginning 0)
5819 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5820 (setq ref2 (substring in-reply-to (match-beginning 0)
5822 (when (> (length ref2) (length ref))
5829 (if (search-forward "\nchars: " nil t)
5830 (if (numberp (setq chars (ignore-errors (read cur))))
5836 (if (search-forward "\nlines: " nil t)
5837 (if (numberp (setq lines (ignore-errors (read cur))))
5843 (and (search-forward "\nxref:" nil t)
5844 (nnheader-header-value)))
5846 (when gnus-extra-headers
5847 (let ((extra gnus-extra-headers)
5851 (when (search-forward
5852 (concat "\n" (symbol-name (car extra)) ":") nil t)
5853 (push (cons (car extra) (nnheader-header-value))
5857 (when (equal id ref)
5860 (when gnus-alter-header-function
5861 (funcall gnus-alter-header-function header)
5862 (setq id (mail-header-id header)
5863 ref (gnus-parent-id (mail-header-references header))))
5866 (gnus-dependencies-add-header
5867 header dependencies force-new))
5868 (push header headers))
5869 (goto-char (point-max))
5871 (nreverse headers)))))
5873 ;; Goes through the xover lines and returns a list of vectors
5874 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5875 force-new dependencies
5876 group also-fetch-heads)
5877 "Parse the news overview data in the server buffer.
5878 Return a list of headers that match SEQUENCE (see
5879 `nntp-retrieve-headers')."
5880 ;; Get the Xref when the users reads the articles since most/some
5881 ;; NNTP servers do not include Xrefs when using XOVER.
5882 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5883 (let ((mail-parse-charset gnus-newsgroup-charset)
5884 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5885 (cur nntp-server-buffer)
5886 (dependencies (or dependencies gnus-newsgroup-dependencies))
5888 ((eq gnus-read-all-available-headers t)
5890 ((stringp gnus-read-all-available-headers)
5891 (string-match gnus-read-all-available-headers group))
5894 number headers header)
5896 (set-buffer nntp-server-buffer)
5897 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5898 ;; Allow the user to mangle the headers before parsing them.
5899 (gnus-run-hooks 'gnus-parse-headers-hook)
5900 (goto-char (point-min))
5901 (gnus-parse-without-error
5902 (while (and (or sequence allp)
5904 (setq number (read cur))
5906 (while (and sequence
5907 (< (car sequence) number))
5908 (setq sequence (cdr sequence))))
5911 (eq number (car sequence))))
5913 (setq sequence (cdr sequence))
5914 (setq header (inline
5915 (gnus-nov-parse-line
5916 number dependencies force-new)))))
5917 (push header headers))
5919 ;; A common bug in inn is that if you have posted an article and
5920 ;; then retrieves the active file, it will answer correctly --
5921 ;; the new article is included. However, a NOV entry for the
5922 ;; article may not have been generated yet, so this may fail.
5923 ;; We work around this problem by retrieving the last few
5924 ;; headers using HEAD.
5925 (if (or (not also-fetch-heads)
5927 ;; We (probably) got all the headers.
5929 (let ((gnus-nov-is-evil t))
5932 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5933 (gnus-get-newsgroup-headers))))))))
5935 (defun gnus-article-get-xrefs ()
5936 "Fill in the Xref value in `gnus-current-headers', if necessary.
5937 This is meant to be called in `gnus-article-internal-prepare-hook'."
5938 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5939 gnus-current-headers)))
5940 (or (not gnus-use-cross-reference)
5942 (and (mail-header-xref headers)
5943 (not (string= (mail-header-xref headers) "")))
5944 (let ((case-fold-search t)
5947 (nnheader-narrow-to-headers)
5948 (goto-char (point-min))
5949 (when (or (and (not (eobp))
5950 (eq (downcase (char-after)) ?x)
5951 (looking-at "Xref:"))
5952 (search-forward "\nXref:" nil t))
5953 (goto-char (1+ (match-end 0)))
5954 (setq xref (buffer-substring (point) (point-at-eol)))
5955 (mail-header-set-xref headers xref)))))))
5957 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5958 "Find article ID and insert the summary line for that article.
5959 OLD-HEADER can either be a header or a line number to insert
5960 the subject line on."
5961 (let* ((line (and (numberp old-header) old-header))
5962 (old-header (and (vectorp old-header) old-header))
5963 (header (cond ((and old-header use-old-header)
5966 (gnus-number-to-header id))
5967 (gnus-number-to-header id))
5969 (gnus-read-header id))))
5970 (number (and (numberp id) id))
5973 ;; Rebuild the thread that this article is part of and go to the
5974 ;; article we have fetched.
5975 (when (and (not gnus-show-threads)
5978 (setq d (gnus-data-find (mail-header-number old-header))))
5979 (goto-char (gnus-data-pos d))
5985 (gnus-delete-line))))))
5987 (mail-header-set-number header (mail-header-number old-header)))
5988 (setq gnus-newsgroup-sparse
5989 (delq (setq number (mail-header-number header))
5990 gnus-newsgroup-sparse))
5991 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5992 (push number gnus-newsgroup-limit)
5993 (gnus-rebuild-thread (mail-header-id header) line)
5994 (gnus-summary-goto-subject number nil t))
5995 (when (and (numberp number)
5997 ;; We have to update the boundaries even if we can't fetch the
5998 ;; article if ID is a number -- so that the next `P' or `N'
5999 ;; command will fetch the previous (or next) article even
6000 ;; if the one we tried to fetch this time has been canceled.
6001 (when (> number gnus-newsgroup-end)
6002 (setq gnus-newsgroup-end number))
6003 (when (< number gnus-newsgroup-begin)
6004 (setq gnus-newsgroup-begin number))
6005 (setq gnus-newsgroup-unselected
6006 (delq number gnus-newsgroup-unselected)))
6007 ;; Report back a success?
6008 (and header (mail-header-number header))))
6010 ;;; Process/prefix in the summary buffer
6012 (defun gnus-summary-work-articles (n)
6013 "Return a list of articles to be worked upon.
6014 The prefix argument, the list of process marked articles, and the
6015 current article will be taken into consideration."
6017 (set-buffer gnus-summary-buffer)
6020 ;; A numerical prefix has been given.
6021 (setq n (prefix-numeric-value n))
6022 (let ((backward (< n 0))
6023 (n (abs (prefix-numeric-value n)))
6028 (push (setq article (gnus-summary-article-number))
6031 (gnus-summary-find-prev nil article)
6032 (gnus-summary-find-next nil article)))
6034 (nreverse articles)))
6035 ((and (gnus-region-active-p) (mark))
6036 (message "region active")
6037 ;; Work on the region between point and mark.
6038 (let ((max (max (point) (mark)))
6041 (goto-char (min (min (point) (mark))))
6044 (push (setq article (gnus-summary-article-number)) articles)
6045 (gnus-summary-find-next nil article)
6047 (nreverse articles))))
6048 (gnus-newsgroup-processable
6049 ;; There are process-marked articles present.
6050 ;; Save current state.
6051 (gnus-summary-save-process-mark)
6053 (reverse gnus-newsgroup-processable))
6055 ;; Just return the current article.
6056 (list (gnus-summary-article-number))))))
6058 (defmacro gnus-summary-iterate (arg &rest forms)
6059 "Iterate over the process/prefixed articles and do FORMS.
6060 ARG is the interactive prefix given to the command. FORMS will be
6061 executed with point over the summary line of the articles."
6062 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6063 `(let ((,articles (gnus-summary-work-articles ,arg)))
6065 (gnus-summary-goto-subject (car ,articles))
6069 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6070 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6072 (defun gnus-summary-save-process-mark ()
6073 "Push the current set of process marked articles on the stack."
6075 (push (copy-sequence gnus-newsgroup-processable)
6076 gnus-newsgroup-process-stack))
6078 (defun gnus-summary-kill-process-mark ()
6079 "Push the current set of process marked articles on the stack and unmark."
6081 (gnus-summary-save-process-mark)
6082 (gnus-summary-unmark-all-processable))
6084 (defun gnus-summary-yank-process-mark ()
6085 "Pop the last process mark state off the stack and restore it."
6087 (unless gnus-newsgroup-process-stack
6088 (error "Empty mark stack"))
6089 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6091 (defun gnus-summary-process-mark-set (set)
6092 "Make SET into the current process marked articles."
6093 (gnus-summary-unmark-all-processable)
6095 (gnus-summary-set-process-mark (pop set))))
6097 ;;; Searching and stuff
6099 (defun gnus-summary-search-group (&optional backward use-level)
6100 "Search for next unread newsgroup.
6101 If optional argument BACKWARD is non-nil, search backward instead."
6103 (set-buffer gnus-group-buffer)
6104 (when (gnus-group-search-forward
6105 backward nil (if use-level (gnus-group-group-level) nil))
6106 (gnus-group-group-name))))
6108 (defun gnus-summary-best-group (&optional exclude-group)
6109 "Find the name of the best unread group.
6110 If EXCLUDE-GROUP, do not go to this group."
6112 (set-buffer gnus-group-buffer)
6114 (gnus-group-best-unread-group exclude-group))))
6116 (defun gnus-summary-find-next (&optional unread article backward)
6118 (gnus-summary-find-prev unread article)
6119 (let* ((dummy (gnus-summary-article-intangible-p))
6120 (article (or article (gnus-summary-article-number)))
6121 (data (gnus-data-find-list article))
6123 (when (and (not dummy)
6124 (or (not gnus-summary-check-current)
6126 (not (gnus-data-unread-p (car data)))))
6127 (setq data (cdr data)))
6132 (unless (memq (gnus-data-number (car data))
6134 ((eq gnus-auto-goto-ignores
6135 'always-undownloaded)
6136 gnus-newsgroup-undownloaded)
6139 ((eq gnus-auto-goto-ignores
6141 gnus-newsgroup-unfetched)
6142 ((eq gnus-auto-goto-ignores
6144 gnus-newsgroup-undownloaded)))
6145 (when (gnus-data-unread-p (car data))
6146 (setq result (car data)
6148 (setq data (cdr data)))
6151 (goto-char (gnus-data-pos result))
6152 (gnus-data-number result)))))
6154 (defun gnus-summary-find-prev (&optional unread article)
6155 (let* ((eobp (eobp))
6156 (article (or article (gnus-summary-article-number)))
6157 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6159 (when (and (not eobp)
6160 (or (not gnus-summary-check-current)
6162 (not (gnus-data-unread-p (car data)))))
6163 (setq data (cdr data)))
6168 (unless (memq (gnus-data-number (car data))
6170 ((eq gnus-auto-goto-ignores
6171 'always-undownloaded)
6172 gnus-newsgroup-undownloaded)
6175 ((eq gnus-auto-goto-ignores
6177 gnus-newsgroup-unfetched)
6178 ((eq gnus-auto-goto-ignores
6180 gnus-newsgroup-undownloaded)))
6181 (when (gnus-data-unread-p (car data))
6182 (setq result (car data)
6184 (setq data (cdr data)))
6187 (goto-char (gnus-data-pos result))
6188 (gnus-data-number result))))
6190 (defun gnus-summary-find-subject (subject &optional unread backward article)
6191 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6192 (article (or article (gnus-summary-article-number)))
6193 (articles (gnus-data-list backward))
6194 (arts (gnus-data-find-list article articles))
6196 (when (or (not gnus-summary-check-current)
6198 (not (gnus-data-unread-p (car arts))))
6199 (setq arts (cdr arts)))
6201 (and (or (not unread)
6202 (gnus-data-unread-p (car arts)))
6203 (vectorp (gnus-data-header (car arts)))
6205 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6206 (setq result (car arts)
6208 (setq arts (cdr arts)))
6210 (goto-char (gnus-data-pos result))
6211 (gnus-data-number result))))
6213 (defun gnus-summary-search-forward (&optional unread subject backward)
6214 "Search forward for an article.
6215 If UNREAD, look for unread articles. If SUBJECT, look for
6216 articles with that subject. If BACKWARD, search backward instead."
6217 (cond (subject (gnus-summary-find-subject subject unread backward))
6218 (backward (gnus-summary-find-prev unread))
6219 (t (gnus-summary-find-next unread))))
6221 (defun gnus-recenter (&optional n)
6222 "Center point in window and redisplay frame.
6223 Also do horizontal recentering."
6225 (when (and gnus-auto-center-summary
6226 (not (eq gnus-auto-center-summary 'vertical)))
6227 (gnus-horizontal-recenter))
6230 (defun gnus-summary-recenter ()
6231 "Center point in the summary window.
6232 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6233 displayed, no centering will be performed."
6234 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6235 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6237 ;; The user has to want it.
6238 (when gnus-auto-center-summary
6239 (let* ((top (cond ((< (window-height) 4) 0)
6240 ((< (window-height) 7) 1)
6241 (t (if (numberp gnus-auto-center-summary)
6242 gnus-auto-center-summary
6244 (height (1- (window-height)))
6245 (bottom (save-excursion (goto-char (point-max))
6246 (forward-line (- height))
6248 (window (get-buffer-window (current-buffer))))
6249 (when (get-buffer-window gnus-article-buffer)
6250 ;; Only do recentering when the article buffer is displayed,
6251 ;; Set the window start to either `bottom', which is the biggest
6252 ;; possible valid number, or the second line from the top,
6253 ;; whichever is the least.
6254 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6255 (if (> bottom top-pos)
6256 ;; Keep the second line from the top visible
6257 (set-window-start window top-pos t)
6258 ;; Try to keep the bottom line visible; if it's partially
6259 ;; obscured, either scroll one more line to make it fully
6260 ;; visible, or revert to using TOP-POS.
6262 (goto-char (point-max))
6264 (let ((last-line-start (point)))
6266 (set-window-start window (point) t)
6267 (when (not (pos-visible-in-window-p last-line-start window))
6269 (set-window-start window (min (point) top-pos) t)))))))
6270 ;; Do horizontal recentering while we're at it.
6271 (when (and (get-buffer-window (current-buffer) t)
6272 (not (eq gnus-auto-center-summary 'vertical)))
6273 (let ((selected (selected-window)))
6274 (select-window (get-buffer-window (current-buffer) t))
6275 (gnus-summary-position-point)
6276 (gnus-horizontal-recenter)
6277 (select-window selected))))))
6279 (defun gnus-summary-jump-to-group (newsgroup)
6280 "Move point to NEWSGROUP in group mode buffer."
6281 ;; Keep update point of group mode buffer if visible.
6282 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6283 (save-window-excursion
6284 ;; Take care of tree window mode.
6285 (when (get-buffer-window gnus-group-buffer)
6286 (pop-to-buffer gnus-group-buffer))
6287 (gnus-group-jump-to-group newsgroup))
6289 ;; Take care of tree window mode.
6290 (if (get-buffer-window gnus-group-buffer)
6291 (pop-to-buffer gnus-group-buffer)
6292 (set-buffer gnus-group-buffer))
6293 (gnus-group-jump-to-group newsgroup))))
6295 ;; This function returns a list of article numbers based on the
6296 ;; difference between the ranges of read articles in this group and
6297 ;; the range of active articles.
6298 (defun gnus-list-of-unread-articles (group)
6299 (let* ((read (gnus-info-read (gnus-get-info group)))
6300 (active (or (gnus-active group) (gnus-activate-group group)))
6303 ;; If none are read, then all are unread.
6305 (setq first (car active))
6306 ;; If the range of read articles is a single range, then the
6307 ;; first unread article is the article after the last read
6308 ;; article. Sounds logical, doesn't it?
6309 (if (and (not (listp (cdr read)))
6310 (or (< (car read) (car active))
6311 (progn (setq read (list read))
6313 (setq first (max (car active) (1+ (cdr read))))
6314 ;; `read' is a list of ranges.
6315 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6318 (setq first (car active)))
6321 (while (< first nlast)
6323 (setq first (1+ first))))
6324 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6325 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6326 (setq read (cdr read)))))
6327 ;; And add the last unread articles.
6328 (while (<= first last)
6330 (setq first (1+ first)))
6331 ;; Return the list of unread articles.
6332 (delq 0 (nreverse unread))))
6334 (defun gnus-list-of-read-articles (group)
6335 "Return a list of unread, unticked and non-dormant articles."
6336 (let* ((info (gnus-get-info group))
6337 (marked (gnus-info-marks info))
6338 (active (gnus-active group)))
6340 (gnus-list-range-difference
6341 (gnus-list-range-difference
6342 (gnus-sorted-complement
6343 (gnus-uncompress-range active)
6344 (gnus-list-of-unread-articles group))
6345 (cdr (assq 'dormant marked)))
6346 (cdr (assq 'tick marked))))))
6348 ;; Various summary commands
6350 (defun gnus-summary-select-article-buffer ()
6351 "Reconfigure windows to show article buffer."
6353 (if (not (gnus-buffer-live-p gnus-article-buffer))
6354 (error "There is no article buffer for this summary buffer")
6355 (gnus-configure-windows 'article)
6356 (select-window (get-buffer-window gnus-article-buffer))))
6358 (defun gnus-summary-universal-argument (arg)
6359 "Perform any operation on all articles that are process/prefixed."
6361 (let ((articles (gnus-summary-work-articles arg))
6368 (substitute-command-keys
6369 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6371 (gnus-error 1 "Undefined key")
6374 (gnus-summary-goto-subject (setq article (pop articles)))
6375 (let (gnus-newsgroup-processable)
6376 (command-execute func))
6377 (gnus-summary-remove-process-mark article)))))
6378 (gnus-summary-position-point))
6380 (defun gnus-summary-toggle-truncation (&optional arg)
6381 "Toggle truncation of summary lines.
6382 With ARG, turn line truncation on if ARG is positive."
6384 (setq truncate-lines
6385 (if (null arg) (not truncate-lines)
6386 (> (prefix-numeric-value arg) 0)))
6389 (defun gnus-summary-find-for-reselect ()
6390 "Return the number of an article to stay on across a reselect.
6391 The current article is considered, then following articles, then previous
6392 articles. An article is sought which is not cancelled and isn't a temporary
6393 insertion from another group. If there's no such then return a dummy 0."
6395 (dolist (rev '(nil t))
6396 (unless found ; don't demand the reverse list if we don't need it
6397 (let ((data (gnus-data-find-list
6398 (gnus-summary-article-number) (gnus-data-list rev))))
6399 (while (and data (not found))
6400 (if (and (< 0 (gnus-data-number (car data)))
6401 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6402 (setq found (gnus-data-number (car data))))
6403 (setq data (cdr data))))))
6406 (defun gnus-summary-reselect-current-group (&optional all rescan)
6407 "Exit and then reselect the current newsgroup.
6408 The prefix argument ALL means to select all articles."
6410 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6411 (error "Ephemeral groups can't be reselected"))
6412 (let ((current-subject (gnus-summary-find-for-reselect))
6413 (group gnus-newsgroup-name))
6414 (setq gnus-newsgroup-begin nil)
6415 (gnus-summary-exit nil 'leave-hidden)
6416 ;; We have to adjust the point of group mode buffer because
6417 ;; point was moved to the next unread newsgroup by exiting.
6418 (gnus-summary-jump-to-group group)
6421 (gnus-group-get-new-news-this-group 1)))
6422 (gnus-group-read-group all t)
6423 (gnus-summary-goto-subject current-subject nil t)))
6425 (defun gnus-summary-rescan-group (&optional all)
6426 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6428 (gnus-summary-reselect-current-group all t))
6430 (defun gnus-summary-update-info (&optional non-destructive)
6432 (let ((group gnus-newsgroup-name))
6434 (when gnus-newsgroup-kill-headers
6435 (setq gnus-newsgroup-killed
6436 (gnus-compress-sequence
6438 (gnus-list-range-intersection
6439 gnus-newsgroup-unselected gnus-newsgroup-killed)
6440 gnus-newsgroup-unreads)
6442 (unless (listp (cdr gnus-newsgroup-killed))
6443 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6444 (let ((headers gnus-newsgroup-headers))
6445 ;; Set the new ranges of read articles.
6447 (set-buffer gnus-group-buffer)
6448 (gnus-undo-force-boundary))
6449 (gnus-update-read-articles
6450 group (gnus-sorted-union
6451 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6452 ;; Set the current article marks.
6453 (let ((gnus-newsgroup-scored
6454 (if (and (not gnus-save-score)
6455 (not non-destructive))
6457 gnus-newsgroup-scored)))
6459 (gnus-update-marks)))
6460 ;; Do the cross-ref thing.
6461 (when gnus-use-cross-reference
6462 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6463 ;; Do not switch windows but change the buffer to work.
6464 (set-buffer gnus-group-buffer)
6465 (unless (gnus-ephemeral-group-p group)
6466 (gnus-group-update-group group)))))))
6468 (defun gnus-summary-save-newsrc (&optional force)
6469 "Save the current number of read/marked articles in the dribble buffer.
6470 The dribble buffer will then be saved.
6471 If FORCE (the prefix), also save the .newsrc file(s)."
6473 (gnus-summary-update-info t)
6475 (gnus-save-newsrc-file)
6476 (gnus-dribble-save)))
6478 (defun gnus-summary-exit (&optional temporary leave-hidden)
6479 "Exit reading current newsgroup, and then return to group selection mode.
6480 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6482 (gnus-set-global-variables)
6483 (when (gnus-buffer-live-p gnus-article-buffer)
6485 (set-buffer gnus-article-buffer)
6486 (mm-destroy-parts gnus-article-mime-handles)
6487 ;; Set it to nil for safety reason.
6488 (setq gnus-article-mime-handle-alist nil)
6489 (setq gnus-article-mime-handles nil)))
6490 (gnus-kill-save-kill-buffer)
6491 (gnus-async-halt-prefetch)
6492 (let* ((group gnus-newsgroup-name)
6493 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6494 (gnus-group-is-exiting-p t)
6497 (buf (current-buffer)))
6499 ;; Do adaptive scoring, and possibly save score files.
6500 (when gnus-newsgroup-adaptive
6501 (gnus-score-adaptive))
6502 (when gnus-use-scoring
6504 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6505 ;; If we have several article buffers, we kill them at exit.
6506 (unless gnus-single-article-buffer
6507 (gnus-kill-buffer gnus-original-article-buffer)
6508 (setq gnus-article-current nil))
6509 (when gnus-use-cache
6510 (gnus-cache-possibly-remove-articles)
6511 (gnus-cache-save-buffers))
6512 (gnus-async-prefetch-remove-group group)
6513 (when gnus-suppress-duplicates
6514 (gnus-dup-enter-articles))
6515 (when gnus-use-trees
6516 (gnus-tree-close group))
6517 (when gnus-use-cache
6518 (gnus-cache-write-active))
6519 ;; Remove entries for this group.
6520 (nnmail-purge-split-history (gnus-group-real-name group))
6521 ;; Make all changes in this group permanent.
6523 (gnus-run-hooks 'gnus-exit-group-hook)
6524 (gnus-summary-update-info))
6525 (gnus-close-group group)
6526 ;; Make sure where we were, and go to next newsgroup.
6527 (set-buffer gnus-group-buffer)
6529 (gnus-group-jump-to-group group))
6530 (gnus-run-hooks 'gnus-summary-exit-hook)
6531 (unless (or quit-config
6532 ;; If this group has disappeared from the summary
6533 ;; buffer, don't skip forwards.
6534 (not (string= group (gnus-group-group-name))))
6535 (gnus-group-next-unread-group 1))
6536 (setq group-point (point))
6539 ;; If we have several article buffers, we kill them at exit.
6540 (unless gnus-single-article-buffer
6541 (gnus-kill-buffer gnus-article-buffer)
6542 (gnus-kill-buffer gnus-original-article-buffer)
6543 (setq gnus-article-current nil))
6545 (if (not gnus-kill-summary-on-exit)
6547 (gnus-deaden-summary)
6549 ;; We set all buffer-local variables to nil. It is unclear why
6550 ;; this is needed, but if we don't, buffer-local variables are
6551 ;; not garbage-collected, it seems. This would the lead to en
6552 ;; ever-growing Emacs.
6553 (gnus-summary-clear-local-variables)
6554 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6555 (gnus-summary-clear-local-variables))
6556 (when (get-buffer gnus-article-buffer)
6557 (bury-buffer gnus-article-buffer))
6558 ;; We clear the global counterparts of the buffer-local
6559 ;; variables as well, just to be on the safe side.
6560 (set-buffer gnus-group-buffer)
6561 (gnus-summary-clear-local-variables)
6562 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6563 (gnus-summary-clear-local-variables))
6564 ;; Return to group mode buffer.
6565 (when (eq mode 'gnus-summary-mode)
6566 (gnus-kill-buffer buf)))
6567 (setq gnus-current-select-method gnus-select-method)
6569 (set-buffer gnus-group-buffer)
6570 (pop-to-buffer gnus-group-buffer))
6571 (if (not quit-config)
6573 (goto-char group-point)
6574 (unless leave-hidden
6575 (gnus-configure-windows 'group 'force)))
6576 (gnus-handle-ephemeral-exit quit-config))
6577 ;; Clear the current group name.
6579 (setq gnus-newsgroup-name nil)))))
6581 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6582 (defun gnus-summary-exit-no-update (&optional no-questions)
6583 "Quit reading current newsgroup without updating read article info."
6585 (let* ((group gnus-newsgroup-name)
6586 (gnus-group-is-exiting-p t)
6587 (gnus-group-is-exiting-without-update-p t)
6588 (quit-config (gnus-group-quit-config group)))
6589 (when (or no-questions
6591 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6592 (gnus-async-halt-prefetch)
6593 (run-hooks 'gnus-summary-prepare-exit-hook)
6594 (when (gnus-buffer-live-p gnus-article-buffer)
6596 (set-buffer gnus-article-buffer)
6597 (mm-destroy-parts gnus-article-mime-handles)
6598 ;; Set it to nil for safety reason.
6599 (setq gnus-article-mime-handle-alist nil)
6600 (setq gnus-article-mime-handles nil)))
6601 ;; If we have several article buffers, we kill them at exit.
6602 (unless gnus-single-article-buffer
6603 (gnus-kill-buffer gnus-article-buffer)
6604 (gnus-kill-buffer gnus-original-article-buffer)
6605 (setq gnus-article-current nil))
6606 (if (not gnus-kill-summary-on-exit)
6607 (gnus-deaden-summary)
6608 (gnus-close-group group)
6609 (gnus-summary-clear-local-variables)
6610 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6611 (gnus-summary-clear-local-variables))
6612 (set-buffer gnus-group-buffer)
6613 (gnus-summary-clear-local-variables)
6614 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6615 (gnus-summary-clear-local-variables))
6616 (gnus-kill-buffer gnus-summary-buffer))
6617 (unless gnus-single-article-buffer
6618 (setq gnus-article-current nil))
6619 (when gnus-use-trees
6620 (gnus-tree-close group))
6621 (gnus-async-prefetch-remove-group group)
6622 (when (get-buffer gnus-article-buffer)
6623 (bury-buffer gnus-article-buffer))
6624 ;; Return to the group buffer.
6625 (gnus-configure-windows 'group 'force)
6626 ;; Clear the current group name.
6627 (setq gnus-newsgroup-name nil)
6628 (unless (gnus-ephemeral-group-p group)
6629 (gnus-group-update-group group))
6630 (when (equal (gnus-group-group-name) group)
6631 (gnus-group-next-unread-group 1))
6633 (gnus-handle-ephemeral-exit quit-config)))))
6635 (defun gnus-handle-ephemeral-exit (quit-config)
6636 "Handle movement when leaving an ephemeral group.
6637 The state which existed when entering the ephemeral is reset."
6638 (if (not (buffer-name (car quit-config)))
6639 (gnus-configure-windows 'group 'force)
6640 (set-buffer (car quit-config))
6641 (cond ((eq major-mode 'gnus-summary-mode)
6642 (gnus-set-global-variables))
6643 ((eq major-mode 'gnus-article-mode)
6645 ;; The `gnus-summary-buffer' variable may point
6646 ;; to the old summary buffer when using a single
6648 (unless (gnus-buffer-live-p gnus-summary-buffer)
6649 (set-buffer gnus-group-buffer))
6650 (set-buffer gnus-summary-buffer)
6651 (gnus-set-global-variables))))
6652 (if (or (eq (cdr quit-config) 'article)
6653 (eq (cdr quit-config) 'pick))
6655 ;; The current article may be from the ephemeral group
6656 ;; thus it is best that we reload this article
6658 ;; If we're exiting from a large digest, this can be
6659 ;; extremely slow. So, it's better not to reload it. -- jh.
6660 ;;(gnus-summary-show-article)
6661 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6662 (gnus-configure-windows 'pick 'force)
6663 (gnus-configure-windows (cdr quit-config) 'force)))
6664 (gnus-configure-windows (cdr quit-config) 'force))
6665 (when (eq major-mode 'gnus-summary-mode)
6666 (gnus-summary-next-subject 1 nil t)
6667 (gnus-summary-recenter)
6668 (gnus-summary-position-point))))
6672 (defvar gnus-dead-summary-mode-map nil)
6674 (unless gnus-dead-summary-mode-map
6675 (setq gnus-dead-summary-mode-map (make-keymap))
6676 (suppress-keymap gnus-dead-summary-mode-map)
6677 (substitute-key-definition
6678 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6679 (dolist (key '("\C-d" "\r" "\177" [delete]))
6680 (define-key gnus-dead-summary-mode-map
6681 key 'gnus-summary-wake-up-the-dead))
6682 (dolist (key '("q" "Q"))
6683 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6685 (defvar gnus-dead-summary-mode nil
6686 "Minor mode for Gnus summary buffers.")
6688 (defun gnus-dead-summary-mode (&optional arg)
6689 "Minor mode for Gnus summary buffers."
6691 (when (eq major-mode 'gnus-summary-mode)
6692 (make-local-variable 'gnus-dead-summary-mode)
6693 (setq gnus-dead-summary-mode
6694 (if (null arg) (not gnus-dead-summary-mode)
6695 (> (prefix-numeric-value arg) 0)))
6696 (when gnus-dead-summary-mode
6698 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6700 (defun gnus-deaden-summary ()
6701 "Make the current summary buffer into a dead summary buffer."
6702 ;; Kill any previous dead summary buffer.
6703 (when (and gnus-dead-summary
6704 (buffer-name gnus-dead-summary))
6706 (set-buffer gnus-dead-summary)
6707 (when gnus-dead-summary-mode
6708 (kill-buffer (current-buffer)))))
6709 ;; Make this the current dead summary.
6710 (setq gnus-dead-summary (current-buffer))
6711 (gnus-dead-summary-mode 1)
6712 (let ((name (buffer-name)))
6713 (when (string-match "Summary" name)
6715 (concat (substring name 0 (match-beginning 0)) "Dead "
6716 (substring name (match-beginning 0)))
6720 (defun gnus-kill-or-deaden-summary (buffer)
6721 "Kill or deaden the summary BUFFER."
6723 (when (and (buffer-name buffer)
6724 (not gnus-single-article-buffer))
6727 (gnus-kill-buffer gnus-article-buffer)
6728 (gnus-kill-buffer gnus-original-article-buffer)))
6731 (gnus-kill-summary-on-exit
6732 (when (and gnus-use-trees
6733 (gnus-buffer-exists-p buffer))
6736 (gnus-tree-close gnus-newsgroup-name)))
6737 (gnus-kill-buffer buffer))
6738 ;; Deaden the buffer.
6739 ((gnus-buffer-exists-p buffer)
6742 (gnus-deaden-summary))))))
6744 (defun gnus-summary-wake-up-the-dead (&rest args)
6745 "Wake up the dead summary buffer."
6747 (gnus-dead-summary-mode -1)
6748 (let ((name (buffer-name)))
6749 (when (string-match "Dead " name)
6751 (concat (substring name 0 (match-beginning 0))
6752 (substring name (match-end 0)))
6754 (gnus-message 3 "This dead summary is now alive again"))
6756 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6757 (defun gnus-summary-fetch-faq (&optional faq-dir)
6758 "Fetch the FAQ for the current group.
6759 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6763 (when current-prefix-arg
6765 "FAQ dir: " (and (listp gnus-group-faq-directory)
6766 (mapcar (lambda (file) (list file))
6767 gnus-group-faq-directory))))))
6768 (let (gnus-faq-buffer)
6769 (when (setq gnus-faq-buffer
6770 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6771 (gnus-configure-windows 'summary-faq))))
6773 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6774 (defun gnus-summary-describe-group (&optional force)
6775 "Describe the current newsgroup."
6777 (gnus-group-describe-group force gnus-newsgroup-name))
6779 (defun gnus-summary-describe-briefly ()
6780 "Describe summary mode commands briefly."
6782 (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")))
6784 ;; Walking around group mode buffer from summary mode.
6786 (defun gnus-summary-next-group (&optional no-article target-group backward)
6787 "Exit current newsgroup and then select next unread newsgroup.
6788 If prefix argument NO-ARTICLE is non-nil, no article is selected
6789 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6790 previous group instead."
6792 ;; Stop pre-fetching.
6793 (gnus-async-halt-prefetch)
6794 (let ((current-group gnus-newsgroup-name)
6795 (current-buffer (current-buffer))
6797 ;; First we semi-exit this group to update Xrefs and all variables.
6798 ;; We can't do a real exit, because the window conf must remain
6799 ;; the same in case the user is prompted for info, and we don't
6800 ;; want the window conf to change before that...
6801 (gnus-summary-exit t)
6802 (while (not entered)
6803 ;; Then we find what group we are supposed to enter.
6804 (set-buffer gnus-group-buffer)
6805 (gnus-group-jump-to-group current-group)
6808 (if (eq gnus-keep-same-level 'best)
6809 (gnus-summary-best-group gnus-newsgroup-name)
6810 (gnus-summary-search-group backward gnus-keep-same-level))))
6811 (if (not target-group)
6812 ;; There are no further groups, so we return to the group
6815 (gnus-message 5 "Returning to the group buffer")
6817 (when (gnus-buffer-live-p current-buffer)
6818 (set-buffer current-buffer)
6819 (gnus-summary-exit))
6820 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6821 ;; We try to enter the target group.
6822 (gnus-group-jump-to-group target-group)
6823 (let ((unreads (gnus-group-group-unread)))
6824 (if (and (or (eq t unreads)
6825 (and unreads (not (zerop unreads))))
6826 (gnus-summary-read-group
6827 target-group nil no-article
6828 (and (buffer-name current-buffer) current-buffer)
6831 (setq current-group target-group
6832 target-group nil)))))))
6834 (defun gnus-summary-prev-group (&optional no-article)
6835 "Exit current newsgroup and then select previous unread newsgroup.
6836 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6838 (gnus-summary-next-group no-article nil t))
6840 ;; Walking around summary lines.
6842 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6843 "Go to the first subject satisfying any non-nil constraint.
6844 If UNREAD is non-nil, the article should be unread.
6845 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6846 If UNSEEN is non-nil, the article should be unseen.
6847 Returns the article selected or nil if there are no matching articles."
6851 ((null gnus-newsgroup-data)
6852 (gnus-message 3 "No articles in the group")
6854 ;; Pick the first article.
6855 ((not (or unread undownloaded unseen))
6856 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6857 (gnus-data-number (car gnus-newsgroup-data)))
6858 ;; Find the first unread article.
6860 (let ((data gnus-newsgroup-data))
6862 (let ((num (gnus-data-number (car data))))
6863 (or (memq num gnus-newsgroup-unfetched)
6864 (not (or (and unread
6865 (memq num gnus-newsgroup-unreads))
6867 (memq num gnus-newsgroup-undownloaded))
6869 (memq num gnus-newsgroup-unseen)))))))
6870 (setq data (cdr data)))
6874 (goto-char (gnus-data-pos (car data)))
6875 (gnus-data-number (car data)))
6876 (gnus-message 3 "No more%s articles"
6877 (let* ((r (when unread " unread"))
6878 (d (when undownloaded " undownloaded"))
6879 (s (when unseen " unseen"))
6880 (l (delq nil (list r d s))))
6881 (cond ((= 3 (length l))
6882 (concat r "," d ", or" s))
6884 (concat (car l) ", or" (cadr l)))
6891 (gnus-summary-position-point))))))
6893 (defun gnus-summary-next-subject (n &optional unread dont-display)
6894 "Go to next N'th summary line.
6895 If N is negative, go to the previous N'th subject line.
6896 If UNREAD is non-nil, only unread articles are selected.
6897 The difference between N and the actual number of steps taken is
6900 (let ((backward (< n 0))
6904 (gnus-summary-find-prev unread)
6905 (gnus-summary-find-next unread)))
6906 (unless (zerop (setq n (1- n)))
6907 (gnus-summary-show-thread)))
6909 (gnus-message 7 "No more%s articles"
6910 (if unread " unread" "")))
6911 (unless dont-display
6912 (gnus-summary-recenter)
6913 (gnus-summary-position-point))
6916 (defun gnus-summary-next-unread-subject (n)
6917 "Go to next N'th unread summary line."
6919 (gnus-summary-next-subject n t))
6921 (defun gnus-summary-prev-subject (n &optional unread)
6922 "Go to previous N'th summary line.
6923 If optional argument UNREAD is non-nil, only unread article is selected."
6925 (gnus-summary-next-subject (- n) unread))
6927 (defun gnus-summary-prev-unread-subject (n)
6928 "Go to previous N'th unread summary line."
6930 (gnus-summary-next-subject (- n) t))
6932 (defun gnus-summary-goto-subjects (articles)
6933 "Insert the subject header for ARTICLES in the current buffer."
6935 (dolist (article articles)
6936 (gnus-summary-goto-subject article t)))
6937 (gnus-summary-limit (append articles gnus-newsgroup-limit))
6938 (gnus-summary-position-point))
6940 (defun gnus-summary-goto-subject (article &optional force silent)
6941 "Go the subject line of ARTICLE.
6942 If FORCE, also allow jumping to articles not currently shown."
6943 (interactive "nArticle number: ")
6944 (unless (numberp article)
6945 (error "Article %s is not a number" article))
6947 (data (gnus-data-find article)))
6948 ;; We read in the article if we have to.
6951 (gnus-summary-insert-subject
6953 (if (or (numberp force) (vectorp force)) force)
6955 (setq data (gnus-data-find article)))
6960 (gnus-message 3 "Can't find article %d" article))
6962 (let ((pt (gnus-data-pos data)))
6964 (gnus-summary-set-article-display-arrow pt))
6965 (gnus-summary-position-point)
6968 ;; Walking around summary lines with displaying articles.
6970 (defun gnus-summary-expand-window (&optional arg)
6971 "Make the summary buffer take up the entire Emacs frame.
6972 Given a prefix, will force an `article' buffer configuration."
6975 (gnus-configure-windows 'article 'force)
6976 (gnus-configure-windows 'summary 'force)))
6978 (defun gnus-summary-display-article (article &optional all-header)
6979 "Display ARTICLE in article buffer."
6980 (when (gnus-buffer-live-p gnus-article-buffer)
6981 (with-current-buffer gnus-article-buffer
6982 (mm-enable-multibyte)))
6983 (gnus-set-global-variables)
6984 (when (gnus-buffer-live-p gnus-article-buffer)
6985 (with-current-buffer gnus-article-buffer
6986 (setq gnus-article-charset gnus-newsgroup-charset)
6987 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
6988 (mm-enable-multibyte)))
6992 (if gnus-summary-display-article-function
6993 (funcall gnus-summary-display-article-function article all-header)
6994 (gnus-article-prepare article all-header))
6995 (gnus-run-hooks 'gnus-select-article-hook)
6996 (when (and gnus-current-article
6997 (not (zerop gnus-current-article)))
6998 (gnus-summary-goto-subject gnus-current-article))
6999 (gnus-summary-recenter)
7000 (when (and gnus-use-trees gnus-show-threads)
7001 (gnus-possibly-generate-tree article)
7002 (gnus-highlight-selected-tree article))
7003 ;; Successfully display article.
7004 (gnus-article-set-window-start
7005 (cdr (assq article gnus-newsgroup-bookmarks))))))
7007 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7008 "Select the current article.
7009 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7010 non-nil, the article will be re-fetched even if it already present in
7011 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7013 ;; Make sure we are in the summary buffer to work around bbdb bug.
7014 (unless (eq major-mode 'gnus-summary-mode)
7015 (set-buffer gnus-summary-buffer))
7016 (let ((article (or article (gnus-summary-article-number)))
7017 (all-headers (not (not all-headers))) ;Must be t or nil.
7018 gnus-summary-display-article-function)
7020 (gnus-summary-article-pseudo-p article)
7021 (error "This is a pseudo-article"))
7023 (set-buffer gnus-summary-buffer)
7024 (if (or (and gnus-single-article-buffer
7025 (or (null gnus-current-article)
7026 (null gnus-article-current)
7027 (null (get-buffer gnus-article-buffer))
7028 (not (eq article (cdr gnus-article-current)))
7029 (not (equal (car gnus-article-current)
7030 gnus-newsgroup-name))))
7031 (and (not gnus-single-article-buffer)
7032 (or (null gnus-current-article)
7033 (not (eq gnus-current-article article))))
7035 ;; The requested article is different from the current article.
7037 (gnus-summary-display-article article all-headers)
7038 (when (gnus-buffer-live-p gnus-article-buffer)
7039 (with-current-buffer gnus-article-buffer
7040 (if (not gnus-article-decoded-p) ;; a local variable
7041 (mm-disable-multibyte))))
7042 (gnus-article-set-window-start
7043 (cdr (assq article gnus-newsgroup-bookmarks)))
7047 (defun gnus-summary-force-verify-and-decrypt ()
7048 "Display buttons for signed/encrypted parts and verify/decrypt them."
7050 (let ((mm-verify-option 'known)
7051 (mm-decrypt-option 'known)
7052 (gnus-article-emulate-mime t)
7053 (gnus-buttonized-mime-types (append (list "multipart/signed"
7054 "multipart/encrypted")
7055 gnus-buttonized-mime-types)))
7056 (gnus-summary-select-article nil 'force)))
7058 (defun gnus-summary-set-current-mark (&optional current-mark)
7059 "Obsolete function."
7062 (defun gnus-summary-next-article (&optional unread subject backward push)
7063 "Select the next article.
7064 If UNREAD, only unread articles are selected.
7065 If SUBJECT, only articles with SUBJECT are selected.
7066 If BACKWARD, the previous article is selected instead of the next."
7069 ;; Is there such an article?
7070 ((and (gnus-summary-search-forward unread subject backward)
7071 (or (gnus-summary-display-article (gnus-summary-article-number))
7072 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7073 (gnus-summary-position-point))
7074 ;; If not, we try the first unread, if that is wanted.
7076 gnus-auto-select-same
7077 (gnus-summary-first-unread-article))
7078 (gnus-summary-position-point)
7079 (gnus-message 6 "Wrapped"))
7080 ;; Try to get next/previous article not displayed in this group.
7081 ((and gnus-auto-extend-newsgroup
7082 (not unread) (not subject))
7083 (gnus-summary-goto-article
7084 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7085 nil (count-lines (point-min) (point))))
7086 ;; Go to next/previous group.
7088 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7089 (gnus-summary-jump-to-group gnus-newsgroup-name))
7090 (let ((cmd last-command-char)
7093 (set-buffer gnus-group-buffer)
7096 (if (eq gnus-keep-same-level 'best)
7097 (gnus-summary-best-group gnus-newsgroup-name)
7098 (gnus-summary-search-group backward gnus-keep-same-level))))
7099 ;; For some reason, the group window gets selected. We change
7101 (select-window (get-buffer-window (current-buffer)))
7102 ;; Select next unread newsgroup automagically.
7104 ((or (not gnus-auto-select-next)
7106 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7107 ((or (eq gnus-auto-select-next 'quietly)
7108 (and (eq gnus-auto-select-next 'slightly-quietly)
7110 (and (eq gnus-auto-select-next 'almost-quietly)
7111 (gnus-summary-last-article-p)))
7113 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7115 (gnus-message 7 "No more%s articles (%s)..."
7116 (if unread " unread" "")
7117 (if group (concat "selecting " group)
7119 (gnus-summary-next-group nil group backward)))
7121 (when (gnus-key-press-event-p last-input-event)
7122 (gnus-summary-walk-group-buffer
7123 gnus-newsgroup-name cmd unread backward point))))))))
7125 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7126 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7127 (?\C-p (gnus-group-prev-unread-group 1))))
7128 (cursor-in-echo-area t)
7129 keve key group ended prompt)
7131 (set-buffer gnus-group-buffer)
7134 (if (eq gnus-keep-same-level 'best)
7135 (gnus-summary-best-group gnus-newsgroup-name)
7136 (gnus-summary-search-group backward gnus-keep-same-level))))
7140 "No more%s articles%s " (if unread " unread" "")
7142 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7143 (format " (Type %s for %s [%s])"
7144 (single-key-description cmd) group
7145 (car (gnus-gethash group gnus-newsrc-hashtb)))
7146 (format " (Type %s to exit %s)"
7147 (single-key-description cmd)
7148 gnus-newsgroup-name))))
7149 ;; Confirm auto selection.
7150 (setq key (car (setq keve (gnus-read-event-char prompt)))
7153 ((assq key keystrokes)
7154 (let ((obuf (current-buffer)))
7155 (switch-to-buffer gnus-group-buffer)
7157 (gnus-group-jump-to-group group))
7158 (eval (cadr (assq key keystrokes)))
7159 (setq group (gnus-group-group-name))
7160 (switch-to-buffer obuf))
7164 (gnus-ephemeral-group-p gnus-newsgroup-name))
7166 (gnus-summary-next-group nil group backward)))
7168 (push (cdr keve) unread-command-events))))))
7170 (defun gnus-summary-next-unread-article ()
7171 "Select unread article after current one."
7173 (gnus-summary-next-article
7174 (or (not (eq gnus-summary-goto-unread 'never))
7175 (gnus-summary-last-article-p (gnus-summary-article-number)))
7176 (and gnus-auto-select-same
7177 (gnus-summary-article-subject))))
7179 (defun gnus-summary-prev-article (&optional unread subject)
7180 "Select the article after the current one.
7181 If UNREAD is non-nil, only unread articles are selected."
7183 (gnus-summary-next-article unread subject t))
7185 (defun gnus-summary-prev-unread-article ()
7186 "Select unread article before current one."
7188 (gnus-summary-prev-article
7189 (or (not (eq gnus-summary-goto-unread 'never))
7190 (gnus-summary-first-article-p (gnus-summary-article-number)))
7191 (and gnus-auto-select-same
7192 (gnus-summary-article-subject))))
7194 (defun gnus-summary-next-page (&optional lines circular stop)
7195 "Show next page of the selected article.
7196 If at the end of the current article, select the next article.
7197 LINES says how many lines should be scrolled up.
7199 If CIRCULAR is non-nil, go to the start of the article instead of
7200 selecting the next article when reaching the end of the current
7203 If STOP is non-nil, just stop when reaching the end of the message.
7205 Also see the variable `gnus-article-skip-boring'."
7207 (setq gnus-summary-buffer (current-buffer))
7208 (gnus-set-global-variables)
7209 (let ((article (gnus-summary-article-number))
7210 (article-window (get-buffer-window gnus-article-buffer t))
7212 ;; If the buffer is empty, we have no article.
7214 (error "No article to select"))
7215 (gnus-configure-windows 'article)
7216 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7217 (if (and (eq gnus-summary-goto-unread 'never)
7218 (not (gnus-summary-last-article-p article)))
7219 (gnus-summary-next-article)
7220 (gnus-summary-next-unread-article))
7221 (if (or (null gnus-current-article)
7222 (null gnus-article-current)
7223 (/= article (cdr gnus-article-current))
7224 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7225 ;; Selected subject is different from current article's.
7226 (gnus-summary-display-article article)
7227 (when article-window
7228 (gnus-eval-in-buffer-window gnus-article-buffer
7229 (setq endp (or (gnus-article-next-page lines)
7230 (gnus-article-only-boring-p))))
7233 (gnus-message 3 "End of message"))
7235 (gnus-summary-beginning-of-article))
7237 (gnus-message 3 "End of message"))
7239 (if (and (eq gnus-summary-goto-unread 'never)
7240 (not (gnus-summary-last-article-p article)))
7241 (gnus-summary-next-article)
7242 (gnus-summary-next-unread-article))))))))
7243 (gnus-summary-recenter)
7244 (gnus-summary-position-point)))
7246 (defun gnus-summary-prev-page (&optional lines move)
7247 "Show previous page of selected article.
7248 Argument LINES specifies lines to be scrolled down.
7249 If MOVE, move to the previous unread article if point is at
7250 the beginning of the buffer."
7252 (let ((article (gnus-summary-article-number))
7253 (article-window (get-buffer-window gnus-article-buffer t))
7255 (gnus-configure-windows 'article)
7256 (if (or (null gnus-current-article)
7257 (null gnus-article-current)
7258 (/= article (cdr gnus-article-current))
7259 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7260 ;; Selected subject is different from current article's.
7261 (gnus-summary-display-article article)
7262 (gnus-summary-recenter)
7263 (when article-window
7264 (gnus-eval-in-buffer-window gnus-article-buffer
7265 (setq endp (gnus-article-prev-page lines)))
7266 (when (and move endp)
7268 (gnus-message 3 "Beginning of message"))
7270 (if (and (eq gnus-summary-goto-unread 'never)
7271 (not (gnus-summary-first-article-p article)))
7272 (gnus-summary-prev-article)
7273 (gnus-summary-prev-unread-article))))))))
7274 (gnus-summary-position-point))
7276 (defun gnus-summary-prev-page-or-article (&optional lines)
7277 "Show previous page of selected article.
7278 Argument LINES specifies lines to be scrolled down.
7279 If at the beginning of the article, go to the next article."
7281 (gnus-summary-prev-page lines t))
7283 (defun gnus-summary-scroll-up (lines)
7284 "Scroll up (or down) one line current article.
7285 Argument LINES specifies lines to be scrolled up (or down if negative)."
7287 (gnus-configure-windows 'article)
7288 (gnus-summary-show-thread)
7289 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7290 (gnus-eval-in-buffer-window gnus-article-buffer
7292 (when (gnus-article-next-page lines)
7293 (gnus-message 3 "End of message")))
7295 (gnus-article-prev-page (- lines))))))
7296 (gnus-summary-recenter)
7297 (gnus-summary-position-point))
7299 (defun gnus-summary-scroll-down (lines)
7300 "Scroll down (or up) one line current article.
7301 Argument LINES specifies lines to be scrolled down (or up if negative)."
7303 (gnus-summary-scroll-up (- lines)))
7305 (defun gnus-summary-next-same-subject ()
7306 "Select next article which has the same subject as current one."
7308 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7310 (defun gnus-summary-prev-same-subject ()
7311 "Select previous article which has the same subject as current one."
7313 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7315 (defun gnus-summary-next-unread-same-subject ()
7316 "Select next unread article which has the same subject as current one."
7318 (gnus-summary-next-article t (gnus-summary-article-subject)))
7320 (defun gnus-summary-prev-unread-same-subject ()
7321 "Select previous unread article which has the same subject as current one."
7323 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7325 (defun gnus-summary-first-unread-article ()
7326 "Select the first unread article.
7327 Return nil if there are no unread articles."
7330 (when (gnus-summary-first-subject t)
7331 (gnus-summary-show-thread)
7332 (gnus-summary-first-subject t)
7333 (gnus-summary-display-article (gnus-summary-article-number)))
7334 (gnus-summary-position-point)))
7336 (defun gnus-summary-first-unread-subject ()
7337 "Place the point on the subject line of the first unread article.
7338 Return nil if there are no unread articles."
7341 (when (gnus-summary-first-subject t)
7342 (gnus-summary-show-thread)
7343 (gnus-summary-first-subject t))
7344 (gnus-summary-position-point)))
7346 (defun gnus-summary-first-unseen-subject ()
7347 "Place the point on the subject line of the first unseen article.
7348 Return nil if there are no unseen articles."
7351 (when (gnus-summary-first-subject nil nil t)
7352 (gnus-summary-show-thread)
7353 (gnus-summary-first-subject nil nil t))
7354 (gnus-summary-position-point)))
7356 (defun gnus-summary-first-unseen-or-unread-subject ()
7357 "Place the point on the subject line of the first unseen article or,
7358 if all article have been seen, on the subject line of the first unread
7362 (unless (when (gnus-summary-first-subject nil nil t)
7363 (gnus-summary-show-thread)
7364 (gnus-summary-first-subject nil nil t))
7365 (when (gnus-summary-first-subject t)
7366 (gnus-summary-show-thread)
7367 (gnus-summary-first-subject t)))
7368 (gnus-summary-position-point)))
7370 (defun gnus-summary-first-article ()
7371 "Select the first article.
7372 Return nil if there are no articles."
7375 (when (gnus-summary-first-subject)
7376 (gnus-summary-show-thread)
7377 (gnus-summary-first-subject)
7378 (gnus-summary-display-article (gnus-summary-article-number)))
7379 (gnus-summary-position-point)))
7381 (defun gnus-summary-best-unread-article (&optional arg)
7382 "Select the unread article with the highest score.
7383 If given a prefix argument, select the next unread article that has a
7384 score higher than the default score."
7386 (let ((article (if arg
7387 (gnus-summary-better-unread-subject)
7388 (gnus-summary-best-unread-subject))))
7390 (gnus-summary-goto-article article)
7391 (error "No unread articles"))))
7393 (defun gnus-summary-best-unread-subject ()
7394 "Select the unread subject with the highest score."
7396 (let ((best -1000000)
7397 (data gnus-newsgroup-data)
7400 (and (gnus-data-unread-p (car data))
7402 (gnus-summary-article-score (gnus-data-number (car data))))
7405 article (gnus-data-number (car data))))
7406 (setq data (cdr data)))
7408 (gnus-summary-goto-subject article))
7409 (gnus-summary-position-point)
7412 (defun gnus-summary-better-unread-subject ()
7413 "Select the first unread subject that has a score over the default score."
7415 (let ((data gnus-newsgroup-data)
7417 (while (and (setq article (gnus-data-number (car data)))
7418 (or (gnus-data-read-p (car data))
7419 (not (> (gnus-summary-article-score article)
7420 gnus-summary-default-score))))
7421 (setq data (cdr data)))
7423 (gnus-summary-goto-subject article))
7424 (gnus-summary-position-point)
7427 (defun gnus-summary-last-subject ()
7428 "Go to the last displayed subject line in the group."
7429 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7431 (gnus-summary-goto-subject article))))
7433 (defun gnus-summary-goto-article (article &optional all-headers force)
7434 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7435 If ALL-HEADERS is non-nil, no header lines are hidden.
7436 If FORCE, go to the article even if it isn't displayed. If FORCE
7437 is a number, it is the line the article is to be displayed on."
7441 "Article number or Message-ID: "
7442 (mapcar (lambda (number) (list (int-to-string number)))
7443 gnus-newsgroup-limit))
7447 (if (and (stringp article)
7448 (string-match "@\\|%40" article))
7449 (gnus-summary-refer-article article)
7450 (when (stringp article)
7451 (setq article (string-to-number article)))
7452 (if (gnus-summary-goto-subject article force)
7453 (gnus-summary-display-article article all-headers)
7454 (gnus-message 4 "Couldn't go to article %s" article) nil))
7455 (gnus-summary-position-point)))
7457 (defun gnus-summary-goto-last-article ()
7458 "Go to the previously read article."
7461 (when gnus-last-article
7462 (gnus-summary-goto-article gnus-last-article nil t))
7463 (gnus-summary-position-point)))
7465 (defun gnus-summary-pop-article (number)
7466 "Pop one article off the history and go to the previous.
7467 NUMBER articles will be popped off."
7470 (setq gnus-newsgroup-history
7471 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7473 (gnus-summary-goto-article (car to) nil t)
7474 (error "Article history empty")))
7475 (gnus-summary-position-point))
7477 ;; Summary commands and functions for limiting the summary buffer.
7479 (defun gnus-summary-limit-to-articles (n)
7480 "Limit the summary buffer to the next N articles.
7481 If not given a prefix, use the process marked articles instead."
7484 (let ((articles (gnus-summary-work-articles n)))
7485 (setq gnus-newsgroup-processable nil)
7486 (gnus-summary-limit articles))
7487 (gnus-summary-position-point)))
7489 (defun gnus-summary-pop-limit (&optional total)
7490 "Restore the previous limit.
7491 If given a prefix, remove all limits."
7494 (setq gnus-newsgroup-limits
7495 (list (mapcar (lambda (h) (mail-header-number h))
7496 gnus-newsgroup-headers))))
7497 (unless gnus-newsgroup-limits
7498 (error "No limit to pop"))
7500 (gnus-summary-limit nil 'pop)
7501 (gnus-summary-position-point)))
7503 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7504 "Limit the summary buffer to articles that have subjects that match a regexp.
7505 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7507 (list (read-string (if current-prefix-arg
7508 "Exclude subject (regexp): "
7509 "Limit to subject (regexp): "))
7510 nil current-prefix-arg))
7512 (setq header "subject"))
7513 (when (not (equal "" subject))
7515 (let ((articles (gnus-summary-find-matching
7516 (or header "subject") subject 'all nil nil
7519 (error "Found no matches for \"%s\"" subject))
7520 (gnus-summary-limit articles))
7521 (gnus-summary-position-point))))
7523 (defun gnus-summary-limit-to-author (from &optional not-matching)
7524 "Limit the summary buffer to articles that have authors that match a regexp.
7525 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7527 (list (read-string (if current-prefix-arg
7528 "Exclude author (regexp): "
7529 "Limit to author (regexp): "))
7530 current-prefix-arg))
7531 (gnus-summary-limit-to-subject from "from" not-matching))
7533 (defun gnus-summary-limit-to-age (age &optional younger-p)
7534 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7535 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7536 articles that are younger than AGE days."
7538 (let ((younger current-prefix-arg)
7541 (while (not days-got)
7542 (setq days (if younger
7543 (read-string "Limit to articles younger than (in days, older when negative): ")
7545 "Limit to articles older than (in days, younger when negative): ")))
7546 (when (> (length days) 0)
7547 (setq days (read days)))
7553 (setq younger (not younger))
7554 (setq days (* days -1)))))
7555 (message "Please enter a number.")
7557 (list days younger)))
7559 (let ((data gnus-newsgroup-data)
7560 (cutoff (days-to-time age))
7561 articles d date is-younger)
7562 (while (setq d (pop data))
7563 (when (and (vectorp (gnus-data-header d))
7564 (setq date (mail-header-date (gnus-data-header d))))
7565 (setq is-younger (time-less-p
7566 (time-since (condition-case ()
7573 (push (gnus-data-number d) articles))))
7574 (gnus-summary-limit (nreverse articles)))
7575 (gnus-summary-position-point)))
7577 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7578 "Limit the summary buffer to articles that match an 'extra' header."
7582 (gnus-completing-read-with-default
7583 (symbol-name (car gnus-extra-headers))
7584 (if current-prefix-arg
7585 "Exclude extra header:"
7586 "Limit extra header:")
7588 (cons (symbol-name x) x))
7593 (read-string (format "%s header %s (regexp): "
7594 (if current-prefix-arg "Exclude" "Limit to")
7596 current-prefix-arg)))
7597 (when (not (equal "" regexp))
7599 (let ((articles (gnus-summary-find-matching
7600 (cons 'extra header) regexp 'all nil nil
7603 (error "Found no matches for \"%s\"" regexp))
7604 (gnus-summary-limit articles))
7605 (gnus-summary-position-point))))
7607 (defun gnus-summary-limit-to-display-predicate ()
7608 "Limit the summary buffer to the predicated in the `display' group parameter."
7610 (unless gnus-newsgroup-display
7611 (error "There is no `display' group parameter"))
7613 (dolist (number gnus-newsgroup-articles)
7614 (when (funcall gnus-newsgroup-display)
7615 (push number articles)))
7616 (gnus-summary-limit articles))
7617 (gnus-summary-position-point))
7619 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7621 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7623 (defun gnus-summary-limit-to-unread (&optional all)
7624 "Limit the summary buffer to articles that are not marked as read.
7625 If ALL is non-nil, limit strictly to unread articles."
7628 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7629 (gnus-summary-limit-to-marks
7630 ;; Concat all the marks that say that an article is read and have
7632 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7633 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7634 gnus-low-score-mark gnus-expirable-mark
7635 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7636 gnus-duplicate-mark gnus-souped-mark)
7639 (defun gnus-summary-limit-to-replied (&optional unreplied)
7640 "Limit the summary buffer to replied articles.
7641 If UNREPLIED (the prefix), limit to unreplied articles."
7645 (gnus-set-difference gnus-newsgroup-articles
7646 gnus-newsgroup-replied))
7647 (gnus-summary-limit gnus-newsgroup-replied))
7648 (gnus-summary-position-point))
7650 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7651 (make-obsolete 'gnus-summary-delete-marked-with
7652 'gnus-summary-limit-exclude-marks)
7654 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7655 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7656 If REVERSE, limit the summary buffer to articles that are marked
7657 with MARKS. MARKS can either be a string of marks or a list of marks.
7658 Returns how many articles were removed."
7659 (interactive "sMarks: ")
7660 (gnus-summary-limit-to-marks marks t))
7662 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7663 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7664 If REVERSE (the prefix), limit the summary buffer to articles that are
7665 not marked with MARKS. MARKS can either be a string of marks or a
7667 Returns how many articles were removed."
7668 (interactive "sMarks: \nP")
7670 (let ((data gnus-newsgroup-data)
7671 (marks (if (listp marks) marks
7672 (append marks nil))) ; Transform to list.
7675 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7676 (memq (gnus-data-mark (car data)) marks))
7677 (push (gnus-data-number (car data)) articles))
7678 (setq data (cdr data)))
7679 (gnus-summary-limit articles))
7680 (gnus-summary-position-point)))
7682 (defun gnus-summary-limit-to-score (score)
7683 "Limit to articles with score at or above SCORE."
7684 (interactive "NLimit to articles with score of at least: ")
7685 (let ((data gnus-newsgroup-data)
7688 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7690 (push (gnus-data-number (car data)) articles))
7691 (setq data (cdr data)))
7693 (gnus-summary-limit articles)
7694 (gnus-summary-position-point))))
7696 (defun gnus-summary-limit-to-unseen ()
7697 "Limit to unseen articles."
7700 (gnus-summary-limit gnus-newsgroup-unseen)
7701 (gnus-summary-position-point)))
7703 (defun gnus-summary-limit-include-thread (id)
7704 "Display all the hidden articles that is in the thread with ID in it.
7705 When called interactively, ID is the Message-ID of the current
7707 (interactive (list (mail-header-id (gnus-summary-article-header))))
7708 (let ((articles (gnus-articles-in-thread
7709 (gnus-id-to-thread (gnus-root-id id)))))
7711 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7712 (gnus-summary-limit-include-matching-articles
7714 (regexp-quote (gnus-simplify-subject-re
7715 (mail-header-subject (gnus-id-to-header id)))))
7716 (gnus-summary-position-point))))
7718 (defun gnus-summary-limit-include-matching-articles (header regexp)
7719 "Display all the hidden articles that have HEADERs that match REGEXP."
7720 (interactive (list (read-string "Match on header: ")
7721 (read-string "Regexp: ")))
7722 (let ((articles (gnus-find-matching-articles header regexp)))
7724 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7725 (gnus-summary-position-point))))
7727 (defun gnus-summary-insert-dormant-articles ()
7728 "Insert all the dormant articles for this group into the current buffer."
7730 (let ((gnus-verbose (max 6 gnus-verbose)))
7731 (if (not gnus-newsgroup-dormant)
7732 (gnus-message 3 "No cached articles for this group")
7733 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7735 (defun gnus-summary-limit-include-dormant ()
7736 "Display all the hidden articles that are marked as dormant.
7737 Note that this command only works on a subset of the articles currently
7738 fetched for this group."
7740 (unless gnus-newsgroup-dormant
7741 (error "There are no dormant articles in this group"))
7743 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7744 (gnus-summary-position-point)))
7746 (defun gnus-summary-limit-exclude-dormant ()
7747 "Hide all dormant articles."
7750 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7751 (gnus-summary-position-point)))
7753 (defun gnus-summary-limit-exclude-childless-dormant ()
7754 "Hide all dormant articles that have no children."
7756 (let ((data (gnus-data-list t))
7757 articles d children)
7758 ;; Find all articles that are either not dormant or have
7760 (while (setq d (pop data))
7761 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7763 (gnus-article-children (gnus-data-number d)))
7766 (when (memq (car children) articles)
7771 (push (gnus-data-number d) articles)))
7774 (gnus-summary-limit articles)
7775 (gnus-summary-position-point))))
7777 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7778 "Mark all unread excluded articles as read.
7779 If ALL, mark even excluded ticked and dormants as read."
7781 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7782 (let ((articles (gnus-sorted-ndifference
7784 (mapcar (lambda (h) (mail-header-number h))
7785 gnus-newsgroup-headers)
7787 gnus-newsgroup-limit))
7789 (setq gnus-newsgroup-unreads
7790 (gnus-sorted-intersection gnus-newsgroup-unreads
7791 gnus-newsgroup-limit))
7793 (setq gnus-newsgroup-dormant nil
7794 gnus-newsgroup-marked nil
7795 gnus-newsgroup-reads
7797 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7798 gnus-newsgroup-reads))
7799 (while (setq article (pop articles))
7800 (unless (or (memq article gnus-newsgroup-dormant)
7801 (memq article gnus-newsgroup-marked))
7802 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7804 (defun gnus-summary-limit (articles &optional pop)
7806 ;; We pop the previous limit off the stack and use that.
7807 (setq articles (car gnus-newsgroup-limits)
7808 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7809 ;; We use the new limit, so we push the old limit on the stack.
7810 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7812 (setq gnus-newsgroup-limit articles)
7813 (let ((total (length gnus-newsgroup-data))
7814 (data (gnus-data-find-list (gnus-summary-article-number)))
7815 (gnus-summary-mark-below nil) ; Inhibit this.
7817 ;; This will do all the work of generating the new summary buffer
7818 ;; according to the new limit.
7819 (gnus-summary-prepare)
7820 ;; Hide any threads, possibly.
7821 (gnus-summary-maybe-hide-threads)
7822 ;; Try to return to the article you were at, or one in the
7825 ;; We try to find some article after the current one.
7827 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7830 (setq data (cdr data))))
7832 ;; If there is no data, that means that we were after the last
7833 ;; article. The same goes when we can't find any articles
7834 ;; after the current one.
7835 (goto-char (point-max))
7836 (gnus-summary-find-prev))
7837 (gnus-set-mode-line 'summary)
7838 ;; We return how many articles were removed from the summary
7839 ;; buffer as a result of the new limit.
7840 (- total (length gnus-newsgroup-data))))
7842 (defsubst gnus-invisible-cut-children (threads)
7845 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7850 (defsubst gnus-cut-thread (thread)
7851 "Go forwards in the thread until we find an article that we want to display."
7852 (when (or (eq gnus-fetch-old-headers 'some)
7853 (eq gnus-fetch-old-headers 'invisible)
7854 (numberp gnus-fetch-old-headers)
7855 (eq gnus-build-sparse-threads 'some)
7856 (eq gnus-build-sparse-threads 'more))
7857 ;; Deal with old-fetched headers and sparse threads.
7861 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7862 (gnus-summary-article-ancient-p
7863 (mail-header-number (car thread))))
7864 (if (or (<= (length (cdr thread)) 1)
7865 (eq gnus-fetch-old-headers 'invisible))
7866 (setq gnus-newsgroup-limit
7867 (delq (mail-header-number (car thread))
7868 gnus-newsgroup-limit)
7869 thread (cadr thread))
7870 (when (gnus-invisible-cut-children (cdr thread))
7871 (let ((th (cdr thread)))
7873 (if (memq (mail-header-number (caar th))
7874 gnus-newsgroup-limit)
7875 (setq thread (car th)
7877 (setq th (cdr th))))))))))
7880 (defun gnus-cut-threads (threads)
7881 "Cut off all uninteresting articles from the beginning of THREADS."
7882 (when (or (eq gnus-fetch-old-headers 'some)
7883 (eq gnus-fetch-old-headers 'invisible)
7884 (numberp gnus-fetch-old-headers)
7885 (eq gnus-build-sparse-threads 'some)
7886 (eq gnus-build-sparse-threads 'more))
7889 (setcar th (gnus-cut-thread (car th)))
7890 (setq th (cdr th)))))
7891 ;; Remove nixed out threads.
7894 (defun gnus-summary-initial-limit (&optional show-if-empty)
7895 "Figure out what the initial limit is supposed to be on group entry.
7896 This entails weeding out unwanted dormants, low-scored articles,
7897 fetch-old-headers verbiage, and so on."
7898 ;; Most groups have nothing to remove.
7899 (if (or gnus-inhibit-limiting
7900 (and (null gnus-newsgroup-dormant)
7901 (eq gnus-newsgroup-display 'gnus-not-ignore)
7902 (not (eq gnus-fetch-old-headers 'some))
7903 (not (numberp gnus-fetch-old-headers))
7904 (not (eq gnus-fetch-old-headers 'invisible))
7905 (null gnus-summary-expunge-below)
7906 (not (eq gnus-build-sparse-threads 'some))
7907 (not (eq gnus-build-sparse-threads 'more))
7908 (null gnus-thread-expunge-below)
7909 (not gnus-use-nocem)))
7911 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7912 (setq gnus-newsgroup-limit nil)
7915 (unless (car (symbol-value node))
7916 ;; These threads have no parents -- they are roots.
7917 (let ((nodes (cdr (symbol-value node)))
7920 (if (and gnus-thread-expunge-below
7921 (< (gnus-thread-total-score (car nodes))
7922 gnus-thread-expunge-below))
7923 (gnus-expunge-thread (pop nodes))
7924 (setq thread (pop nodes))
7925 (gnus-summary-limit-children thread))))))
7926 gnus-newsgroup-dependencies)
7927 ;; If this limitation resulted in an empty group, we might
7928 ;; pop the previous limit and use it instead.
7929 (when (and (not gnus-newsgroup-limit)
7931 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7932 gnus-newsgroup-limit))
7934 (defun gnus-summary-limit-children (thread)
7935 "Return 1 if this subthread is visible and 0 if it is not."
7936 ;; First we get the number of visible children to this thread. This
7937 ;; is done by recursing down the thread using this function, so this
7938 ;; will really go down to a leaf article first, before slowly
7939 ;; working its way up towards the root.
7941 (let* ((max-lisp-eval-depth 5000)
7944 (apply '+ (mapcar 'gnus-summary-limit-children
7947 (number (mail-header-number (car thread)))
7950 (not (memq number gnus-newsgroup-marked))
7952 ;; If this article is dormant and has absolutely no visible
7953 ;; children, then this article isn't visible.
7954 (and (memq number gnus-newsgroup-dormant)
7956 ;; If this is "fetch-old-headered" and there is no
7957 ;; visible children, then we don't want this article.
7958 (and (or (eq gnus-fetch-old-headers 'some)
7959 (numberp gnus-fetch-old-headers))
7960 (gnus-summary-article-ancient-p number)
7962 ;; If this is "fetch-old-headered" and `invisible', then
7963 ;; we don't want this article.
7964 (and (eq gnus-fetch-old-headers 'invisible)
7965 (gnus-summary-article-ancient-p number))
7966 ;; If this is a sparsely inserted article with no children,
7967 ;; we don't want it.
7968 (and (eq gnus-build-sparse-threads 'some)
7969 (gnus-summary-article-sparse-p number)
7971 ;; If we use expunging, and this article is really
7972 ;; low-scored, then we don't want this article.
7973 (when (and gnus-summary-expunge-below
7975 (or (cdr (assq number gnus-newsgroup-scored))
7976 gnus-summary-default-score))
7977 gnus-summary-expunge-below))
7978 ;; We increase the expunge-tally here, but that has
7979 ;; nothing to do with the limits, really.
7980 (incf gnus-newsgroup-expunged-tally)
7981 ;; We also mark as read here, if that's wanted.
7982 (when (and gnus-summary-mark-below
7983 (< score gnus-summary-mark-below))
7984 (setq gnus-newsgroup-unreads
7985 (delq number gnus-newsgroup-unreads))
7986 (if gnus-newsgroup-auto-expire
7987 (push number gnus-newsgroup-expirable)
7988 (push (cons number gnus-low-score-mark)
7989 gnus-newsgroup-reads)))
7991 ;; Do the `display' group parameter.
7992 (and gnus-newsgroup-display
7993 (not (funcall gnus-newsgroup-display)))
7994 ;; Check NoCeM things.
7995 (if (and gnus-use-nocem
7996 (gnus-nocem-unwanted-article-p
7997 (mail-header-id (car thread))))
7999 (setq gnus-newsgroup-unreads
8000 (delq number gnus-newsgroup-unreads))
8002 ;; Nope, invisible article.
8004 ;; Ok, this article is to be visible, so we add it to the limit
8006 (push number gnus-newsgroup-limit)
8009 (defun gnus-expunge-thread (thread)
8010 "Mark all articles in THREAD as read."
8011 (let* ((number (mail-header-number (car thread))))
8012 (incf gnus-newsgroup-expunged-tally)
8013 ;; We also mark as read here, if that's wanted.
8014 (setq gnus-newsgroup-unreads
8015 (delq number gnus-newsgroup-unreads))
8016 (if gnus-newsgroup-auto-expire
8017 (push number gnus-newsgroup-expirable)
8018 (push (cons number gnus-low-score-mark)
8019 gnus-newsgroup-reads)))
8020 ;; Go recursively through all subthreads.
8021 (mapcar 'gnus-expunge-thread (cdr thread)))
8023 ;; Summary article oriented commands
8025 (defun gnus-summary-refer-parent-article (n)
8026 "Refer parent article N times.
8027 If N is negative, go to ancestor -N instead.
8028 The difference between N and the number of articles fetched is returned."
8032 (when (not (natnump n))
8037 (setq header (gnus-summary-article-header))
8038 (if (and (eq (mail-header-number header)
8039 (cdr gnus-article-current))
8040 (equal gnus-newsgroup-name
8041 (car gnus-article-current)))
8042 ;; If we try to find the parent of the currently
8043 ;; displayed article, then we take a look at the actual
8044 ;; References header, since this is slightly more
8045 ;; reliable than the References field we got from the
8048 (set-buffer gnus-original-article-buffer)
8049 (nnheader-narrow-to-headers)
8050 (unless (setq ref (message-fetch-field "references"))
8051 (when (setq ref (message-fetch-field "in-reply-to"))
8052 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8055 ;; It's not the current article, so we take a bet on
8056 ;; the value we got from the server.
8057 (mail-header-references header)))
8059 (not (equal ref "")))
8060 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8061 (gnus-message 1 "Couldn't find parent"))
8062 (gnus-message 1 "No references in article %d"
8063 (gnus-summary-article-number))
8066 (gnus-summary-position-point)
8069 (defun gnus-summary-refer-references ()
8070 "Fetch all articles mentioned in the References header.
8071 Return the number of articles fetched."
8073 (let ((ref (mail-header-references (gnus-summary-article-header)))
8074 (current (gnus-summary-article-number))
8078 (error "No References in the current article")
8079 ;; For each Message-ID in the References header...
8080 (while (string-match "<[^>]*>" ref)
8082 ;; ... fetch that article.
8083 (gnus-summary-refer-article
8084 (prog1 (match-string 0 ref)
8085 (setq ref (substring ref (match-end 0))))))
8086 (gnus-summary-goto-subject current)
8087 (gnus-summary-position-point)
8090 (defun gnus-summary-refer-thread (&optional limit)
8091 "Fetch all articles in the current thread.
8092 If LIMIT (the numerical prefix), fetch that many old headers instead
8093 of what's specified by the `gnus-refer-thread-limit' variable."
8095 (let ((id (mail-header-id (gnus-summary-article-header)))
8096 (limit (if limit (prefix-numeric-value limit)
8097 gnus-refer-thread-limit)))
8098 (unless (eq gnus-fetch-old-headers 'invisible)
8099 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8100 ;; Retrieve the headers and read them in.
8101 (if (eq (if (numberp limit)
8102 (gnus-retrieve-headers
8104 (+ (mail-header-number
8105 (gnus-summary-article-header))
8107 gnus-newsgroup-end))
8108 gnus-newsgroup-name (* limit 2))
8109 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8111 (gnus-retrieve-headers (list gnus-newsgroup-end)
8112 gnus-newsgroup-name limit))
8114 (gnus-build-all-threads)
8115 (error "Can't fetch thread from back ends that don't support NOV"))
8116 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8117 (gnus-summary-limit-include-thread id)))
8119 (defun gnus-summary-refer-article (message-id)
8120 "Fetch an article specified by MESSAGE-ID."
8121 (interactive "sMessage-ID: ")
8122 (when (and (stringp message-id)
8123 (not (zerop (length message-id))))
8124 (setq message-id (gnus-replace-in-string message-id " " ""))
8125 ;; Construct the correct Message-ID if necessary.
8126 ;; Suggested by tale@pawl.rpi.edu.
8127 (unless (string-match "^<" message-id)
8128 (setq message-id (concat "<" message-id)))
8129 (unless (string-match ">$" message-id)
8130 (setq message-id (concat message-id ">")))
8131 ;; People often post MIDs from URLs, so unhex it:
8132 (unless (string-match "@" message-id)
8133 (setq message-id (gnus-url-unhex-string message-id)))
8134 (let* ((header (gnus-id-to-header message-id))
8136 (gnus-summary-article-sparse-p
8137 (mail-header-number header))
8138 (memq (mail-header-number header)
8139 gnus-newsgroup-limit)))
8142 ;; If the article is present in the buffer we just go to it.
8144 (or (not (gnus-summary-article-sparse-p
8145 (mail-header-number header)))
8148 (gnus-summary-goto-article
8149 (mail-header-number header) nil t)
8151 (gnus-summary-update-article (mail-header-number header)))))
8153 ;; We fetch the article.
8155 (dolist (gnus-override-method (gnus-refer-article-methods))
8156 (when (and (gnus-check-server gnus-override-method)
8157 ;; Fetch the header,
8158 (setq number (gnus-summary-insert-subject message-id)))
8159 ;; and display the article.
8160 (gnus-summary-select-article nil nil nil number)
8162 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8164 (defun gnus-refer-article-methods ()
8165 "Return a list of referable methods."
8167 ;; No method, so we default to current and native.
8168 ((null gnus-refer-article-method)
8169 (list gnus-current-select-method gnus-select-method))
8171 ((eq 'current gnus-refer-article-method)
8172 (list gnus-current-select-method))
8173 ;; List of select methods.
8174 ((not (and (symbolp (car gnus-refer-article-method))
8175 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8177 (dolist (method gnus-refer-article-method)
8178 (push (if (eq 'current method)
8179 gnus-current-select-method
8183 ;; One single select method.
8185 (list gnus-refer-article-method))))
8187 (defun gnus-summary-edit-parameters ()
8188 "Edit the group parameters of the current group."
8190 (gnus-group-edit-group gnus-newsgroup-name 'params))
8192 (defun gnus-summary-customize-parameters ()
8193 "Customize the group parameters of the current group."
8195 (gnus-group-customize gnus-newsgroup-name))
8197 (defun gnus-summary-enter-digest-group (&optional force)
8198 "Enter an nndoc group based on the current article.
8199 If FORCE, force a digest interpretation. If not, try
8200 to guess what the document format is."
8202 (let ((conf gnus-current-window-configuration))
8203 (save-window-excursion
8205 (let (gnus-article-prepare-hook
8206 gnus-display-mime-function
8208 (gnus-summary-select-article))))
8209 (setq gnus-current-window-configuration conf)
8210 (let* ((name (format "%s-%d"
8211 (gnus-group-prefixed-name
8212 gnus-newsgroup-name (list 'nndoc ""))
8214 (set-buffer gnus-summary-buffer)
8215 gnus-current-article)))
8216 (ogroup gnus-newsgroup-name)
8217 (params (append (gnus-info-params (gnus-get-info ogroup))
8218 (list (cons 'to-group ogroup))
8219 (list (cons 'parent-group ogroup))
8220 (list (cons 'save-article-group ogroup))))
8221 (case-fold-search t)
8222 (buf (current-buffer))
8225 (set-buffer gnus-original-article-buffer)
8226 ;; Have the digest group inherit the main mail address of
8227 ;; the parent article.
8228 (when (setq to-address (or (gnus-fetch-field "reply-to")
8229 (gnus-fetch-field "from")))
8230 (setq params (append
8231 (list (cons 'to-address
8232 (funcall gnus-decode-encoded-word-function
8234 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8235 (insert-buffer-substring gnus-original-article-buffer)
8236 ;; Remove lines that may lead nndoc to misinterpret the
8239 (goto-char (point-min))
8240 (or (search-forward "\n\n" nil t) (point)))
8241 (goto-char (point-min))
8242 (delete-matching-lines "^Path:\\|^From ")
8245 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8246 (gnus-newsgroup-ephemeral-ignored-charsets
8247 gnus-newsgroup-ignored-charsets))
8248 (gnus-group-read-ephemeral-group
8249 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8251 ,(if force 'mbox 'guess)))
8253 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8255 ;; Make all postings to this group go to the parent group.
8256 (nconc (gnus-info-params (gnus-get-info name))
8258 ;; Couldn't select this doc group.
8259 (switch-to-buffer buf)
8260 (gnus-set-global-variables)
8261 (gnus-configure-windows 'summary)
8262 (gnus-message 3 "Article couldn't be entered?"))
8263 (kill-buffer dig)))))
8265 (defun gnus-summary-read-document (n)
8266 "Open a new group based on the current article(s).
8267 This will allow you to read digests and other similar
8268 documents as newsgroups.
8269 Obeys the standard process/prefix convention."
8271 (let* ((articles (gnus-summary-work-articles n))
8272 (ogroup gnus-newsgroup-name)
8273 (params (append (gnus-info-params (gnus-get-info ogroup))
8274 (list (cons 'to-group ogroup))))
8275 article group egroup groups vgroup)
8276 (while (setq article (pop articles))
8277 (setq group (format "%s-%d" gnus-newsgroup-name article))
8278 (gnus-summary-remove-process-mark article)
8279 (when (gnus-summary-display-article article)
8282 (insert-buffer-substring gnus-original-article-buffer)
8283 ;; Remove some headers that may lead nndoc to make
8285 (message-narrow-to-head)
8286 (goto-char (point-min))
8287 (delete-matching-lines "^Path:\\|^From ")
8290 (gnus-group-read-ephemeral-group
8291 group `(nndoc ,group (nndoc-address ,(current-buffer))
8292 (nndoc-article-type guess))
8295 ;; Make all postings to this group go to the parent group.
8296 (nconc (gnus-info-params (gnus-get-info egroup))
8298 (push egroup groups))
8299 ;; Couldn't select this doc group.
8300 (gnus-error 3 "Article couldn't be entered"))))))
8301 ;; Now we have selected all the documents.
8304 (error "None of the articles could be interpreted as documents"))
8305 ((gnus-group-read-ephemeral-group
8306 (setq vgroup (format
8307 "nnvirtual:%s-%s" gnus-newsgroup-name
8308 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8309 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8311 (cons (current-buffer) 'summary)))
8313 (error "Couldn't select virtual nndoc group")))))
8315 (defun gnus-summary-isearch-article (&optional regexp-p)
8316 "Do incremental search forward on the current article.
8317 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8319 (gnus-summary-select-article)
8320 (gnus-configure-windows 'article)
8321 (gnus-eval-in-buffer-window gnus-article-buffer
8324 (isearch-forward regexp-p))))
8326 (defun gnus-summary-search-article-forward (regexp &optional backward)
8327 "Search for an article containing REGEXP forward.
8328 If BACKWARD, search backward instead."
8331 (format "Search article %s (regexp%s): "
8332 (if current-prefix-arg "backward" "forward")
8333 (if gnus-last-search-regexp
8334 (concat ", default " gnus-last-search-regexp)
8336 current-prefix-arg))
8337 (if (string-equal regexp "")
8338 (setq regexp (or gnus-last-search-regexp ""))
8339 (setq gnus-last-search-regexp regexp)
8340 (setq gnus-article-before-search gnus-current-article))
8341 ;; Intentionally set gnus-last-article.
8342 (setq gnus-last-article gnus-article-before-search)
8343 (let ((gnus-last-article gnus-last-article))
8344 (if (gnus-summary-search-article regexp backward)
8345 (gnus-summary-show-thread)
8346 (error "Search failed: \"%s\"" regexp))))
8348 (defun gnus-summary-search-article-backward (regexp)
8349 "Search for an article containing REGEXP backward."
8352 (format "Search article backward (regexp%s): "
8353 (if gnus-last-search-regexp
8354 (concat ", default " gnus-last-search-regexp)
8356 (gnus-summary-search-article-forward regexp 'backward))
8358 (defun gnus-summary-search-article (regexp &optional backward)
8359 "Search for an article containing REGEXP.
8360 Optional argument BACKWARD means do search for backward.
8361 `gnus-select-article-hook' is not called during the search."
8362 ;; We have to require this here to make sure that the following
8363 ;; dynamic binding isn't shadowed by autoloading.
8364 (require 'gnus-async)
8366 (let ((gnus-select-article-hook nil) ;Disable hook.
8367 (gnus-article-prepare-hook nil)
8368 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8369 (gnus-use-article-prefetch nil)
8370 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8371 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8373 (gnus-keep-backlog nil)
8374 (gnus-break-pages nil)
8375 (gnus-summary-display-arrow nil)
8376 (gnus-updated-mode-lines nil)
8377 (gnus-auto-center-summary nil)
8378 (sum (current-buffer))
8379 (gnus-display-mime-function nil)
8382 (gnus-save-hidden-threads
8383 (gnus-summary-select-article)
8384 (set-buffer gnus-article-buffer)
8385 (goto-char (window-point (get-buffer-window (current-buffer))))
8389 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8391 (re-search-backward regexp nil t)
8392 (re-search-forward regexp nil t))
8393 ;; We found the regexp.
8398 (get-buffer-window (current-buffer))
8402 (get-buffer-window (current-buffer))
8405 (setq point (point)))
8406 ;; We didn't find it, so we go to the next article.
8409 (while (eq found 'not)
8410 (if (not (if backward (gnus-summary-find-prev)
8411 (gnus-summary-find-next)))
8412 ;; No more articles.
8414 ;; Select the next article and adjust point.
8415 (unless (gnus-summary-article-sparse-p
8416 (gnus-summary-article-number))
8418 (gnus-summary-select-article)
8419 (set-buffer gnus-article-buffer)
8421 (goto-char (if backward (point-max) (point-min))))))))
8422 (gnus-message 7 ""))
8423 ;; Return whether we found the regexp.
8424 (when (eq found 'found)
8426 (gnus-summary-show-thread)
8427 (gnus-summary-goto-subject gnus-current-article)
8428 (gnus-summary-position-point)
8431 (defun gnus-find-matching-articles (header regexp)
8432 "Return a list of all articles that match REGEXP on HEADER.
8433 This search includes all articles in the current group that Gnus has
8434 fetched headers for, whether they are displayed or not."
8435 (let ((articles nil)
8436 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8437 (case-fold-search t))
8438 (dolist (header gnus-newsgroup-headers)
8439 (when (string-match regexp (funcall func header))
8440 (push (mail-header-number header) articles)))
8441 (nreverse articles)))
8443 (defun gnus-summary-find-matching (header regexp &optional backward unread
8444 not-case-fold not-matching)
8445 "Return a list of all articles that match REGEXP on HEADER.
8446 The search stars on the current article and goes forwards unless
8447 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8448 If UNREAD is non-nil, only unread articles will
8449 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8450 in the comparisons. If NOT-MATCHING, return a list of all articles that
8451 not match REGEXP on HEADER."
8452 (let ((case-fold-search (not not-case-fold))
8455 (if (eq (car header) 'extra)
8458 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8460 (error "%s is an invalid header" header))
8461 (unless (fboundp (intern (concat "mail-header-" header)))
8462 (error "%s is not a valid header" header))
8463 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8464 (dolist (d (if (eq backward 'all)
8466 (gnus-data-find-list
8467 (gnus-summary-article-number)
8468 (gnus-data-list backward))))
8469 (when (and (or (not unread) ; We want all articles...
8470 (gnus-data-unread-p d)) ; Or just unreads.
8471 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8475 (funcall func (gnus-data-header d))))
8476 (string-match regexp
8477 (funcall func (gnus-data-header d)))))
8478 (push (gnus-data-number d) articles))) ; Success!
8479 (nreverse articles)))
8481 (defun gnus-summary-execute-command (header regexp command &optional backward)
8482 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8483 If HEADER is an empty string (or nil), the match is done on the entire
8484 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8486 (list (let ((completion-ignore-case t))
8489 (mapcar (lambda (header) (list (format "%s" header)))
8491 '("Number" "Subject" "From" "Lines" "Date"
8492 "Message-ID" "Xref" "References" "Body")
8493 gnus-extra-headers))
8494 nil 'require-match))
8495 (read-string "Regexp: ")
8496 (read-key-sequence "Command: ")
8497 current-prefix-arg))
8498 (when (equal header "Body")
8500 ;; Hidden thread subtrees must be searched as well.
8501 (gnus-summary-show-all-threads)
8502 ;; We don't want to change current point nor window configuration.
8504 (save-window-excursion
8506 gnus-treat-strip-trailing-blank-lines
8507 gnus-treat-strip-leading-blank-lines
8508 gnus-treat-strip-multiple-blank-lines
8509 gnus-treat-hide-boring-headers
8510 gnus-treat-fold-newsgroups
8511 gnus-article-prepare-hook)
8512 (gnus-message 6 "Executing %s..." (key-description command))
8513 ;; We'd like to execute COMMAND interactively so as to give arguments.
8514 (gnus-execute header regexp
8515 `(call-interactively ',(key-binding command))
8517 (gnus-message 6 "Executing %s...done" (key-description command))))))
8519 (defun gnus-summary-beginning-of-article ()
8520 "Scroll the article back to the beginning."
8522 (gnus-summary-select-article)
8523 (gnus-configure-windows 'article)
8524 (gnus-eval-in-buffer-window gnus-article-buffer
8526 (goto-char (point-min))
8527 (when gnus-break-pages
8528 (gnus-narrow-to-page))))
8530 (defun gnus-summary-end-of-article ()
8531 "Scroll to the end of the article."
8533 (gnus-summary-select-article)
8534 (gnus-configure-windows 'article)
8535 (gnus-eval-in-buffer-window gnus-article-buffer
8537 (goto-char (point-max))
8539 (when gnus-break-pages
8540 (when (re-search-backward page-delimiter nil t)
8541 (narrow-to-region (match-end 0) (point-max)))
8542 (gnus-narrow-to-page))))
8544 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8545 "Truncate to LEN and quote all \"(\"'s in STRING."
8546 (gnus-replace-in-string (if (and len (> (length string) len))
8547 (substring string 0 len)
8551 (defun gnus-summary-print-article (&optional filename n)
8552 "Generate and print a PostScript image of the process-marked (mail) articles.
8554 If used interactively, print the current article if none are
8555 process-marked. With prefix arg, prompt the user for the name of the
8558 When used from Lisp, accept two optional args FILENAME and N. N means
8559 to print the next N articles. If N is negative, print the N previous
8560 articles. If N is nil and articles have been marked with the process
8561 mark, print these instead.
8563 If the optional first argument FILENAME is nil, send the image to the
8564 printer. If FILENAME is a string, save the PostScript image in a file with
8565 that name. If FILENAME is a number, prompt the user for the name of the file
8567 (interactive (list (ps-print-preprint current-prefix-arg)))
8568 (dolist (article (gnus-summary-work-articles n))
8569 (gnus-summary-select-article nil nil 'pseudo article)
8570 (gnus-eval-in-buffer-window gnus-article-buffer
8571 (gnus-print-buffer))
8572 (gnus-summary-remove-process-mark article))
8573 (ps-despool filename))
8575 (defun gnus-print-buffer ()
8576 (let ((buffer (generate-new-buffer " *print*")))
8579 (copy-to-buffer buffer (point-min) (point-max))
8581 (gnus-remove-text-with-property 'gnus-decoration)
8582 (when (gnus-visual-p 'article-highlight 'highlight)
8583 ;; Copy-to-buffer doesn't copy overlay. So redo
8585 (let ((gnus-article-buffer buffer))
8586 (gnus-article-highlight-citation t)
8587 (gnus-article-highlight-signature)
8588 (gnus-article-emphasize)
8589 (gnus-article-delete-invisible-text)))
8590 (let ((ps-left-header
8593 (gnus-summary-print-truncate-and-quote
8594 (mail-header-subject gnus-current-headers)
8597 (gnus-summary-print-truncate-and-quote
8598 (mail-header-from gnus-current-headers)
8602 "/pagenumberstring load"
8604 (mail-header-date gnus-current-headers) ")"))))
8605 (gnus-run-hooks 'gnus-ps-print-hook)
8608 (ps-spool-buffer-with-faces)
8609 (ps-spool-buffer)))))
8610 (kill-buffer buffer))))
8612 (defun gnus-summary-show-article (&optional arg)
8613 "Force redisplaying of the current article.
8614 If ARG (the prefix) is a number, show the article with the charset
8615 defined in `gnus-summary-show-article-charset-alist', or the charset
8617 If ARG (the prefix) is non-nil and not a number, show the raw article
8618 without any article massaging functions being run. Normally, the key
8619 strokes are `C-u g'."
8623 (gnus-summary-show-article t)
8624 (let ((gnus-newsgroup-charset
8625 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8626 (mm-read-coding-system
8627 "View as charset: " ;; actually it is coding system.
8629 (set-buffer gnus-article-buffer)
8630 (mm-detect-coding-region (point) (point-max))))))
8631 (gnus-newsgroup-ignored-charsets 'gnus-all))
8632 (gnus-summary-select-article nil 'force)
8633 (let ((deps gnus-newsgroup-dependencies)
8636 (set-buffer gnus-original-article-buffer)
8638 (message-narrow-to-head)
8639 (setq head (buffer-string))
8640 (goto-char (point-min))
8641 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8642 (goto-char (point-max))
8644 (setq lines (1- (count-lines (point) (point-max))))))
8646 (insert (format "211 %d Article retrieved.\n"
8647 (cdr gnus-article-current)))
8649 (if lines (insert (format "Lines: %d\n" lines)))
8651 (let ((nntp-server-buffer (current-buffer)))
8652 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8653 (gnus-data-set-header
8654 (gnus-data-find (cdr gnus-article-current))
8656 (gnus-summary-update-article-line
8657 (cdr gnus-article-current) header)
8658 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8659 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8661 ;; Select the article the normal way.
8662 (gnus-summary-select-article nil 'force))
8664 ;; We have to require this here to make sure that the following
8665 ;; dynamic binding isn't shadowed by autoloading.
8666 (require 'gnus-async)
8668 ;; Bind the article treatment functions to nil.
8669 (let ((gnus-have-all-headers t)
8670 gnus-article-prepare-hook
8671 gnus-article-decode-hook
8672 gnus-display-mime-function
8674 ;; Destroy any MIME parts.
8675 (when (gnus-buffer-live-p gnus-article-buffer)
8677 (set-buffer gnus-article-buffer)
8678 (mm-destroy-parts gnus-article-mime-handles)
8679 ;; Set it to nil for safety reason.
8680 (setq gnus-article-mime-handle-alist nil)
8681 (setq gnus-article-mime-handles nil)))
8682 (gnus-summary-select-article nil 'force))))
8683 (gnus-summary-goto-subject gnus-current-article)
8684 (gnus-summary-position-point))
8686 (defun gnus-summary-show-raw-article ()
8687 "Show the raw article without any article massaging functions being run."
8689 (gnus-summary-show-article t))
8691 (defun gnus-summary-verbose-headers (&optional arg)
8692 "Toggle permanent full header display.
8693 If ARG is a positive number, turn header display on.
8694 If ARG is a negative number, turn header display off."
8696 (setq gnus-show-all-headers
8697 (cond ((or (not (numberp arg))
8699 (not gnus-show-all-headers))
8702 (gnus-summary-show-article))
8704 (defun gnus-summary-toggle-header (&optional arg)
8705 "Show the headers if they are hidden, or hide them if they are shown.
8706 If ARG is a positive number, show the entire header.
8707 If ARG is a negative number, hide the unwanted header lines."
8709 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8710 (get-buffer-window gnus-article-buffer t))))
8711 (with-current-buffer gnus-article-buffer
8713 (article-narrow-to-head)
8714 (let* ((buffer-read-only nil)
8715 (inhibit-point-motion-hooks t)
8716 (hidden (if (numberp arg)
8718 (gnus-article-hidden-text-p 'headers)))
8720 (delete-region (point-min) (point-max))
8721 (with-current-buffer gnus-original-article-buffer
8722 (goto-char (setq s (point-min)))
8723 (setq e (if (search-forward "\n\n" nil t)
8726 (insert-buffer-substring gnus-original-article-buffer s e)
8727 (run-hooks 'gnus-article-decode-hook)
8729 (let ((gnus-treat-hide-headers nil)
8730 (gnus-treat-hide-boring-headers nil))
8731 (gnus-delete-wash-type 'headers)
8732 (gnus-treat-article 'head))
8733 (gnus-treat-article 'head))
8736 (set-window-start window (goto-char (point-min))))
8737 (if gnus-break-pages
8738 (gnus-narrow-to-page)
8739 (when (gnus-visual-p 'page-marker)
8740 (let ((buffer-read-only nil))
8741 (gnus-remove-text-with-property 'gnus-prev)
8742 (gnus-remove-text-with-property 'gnus-next))))
8743 (gnus-set-mode-line 'article)))))
8745 (defun gnus-summary-show-all-headers ()
8746 "Make all header lines visible."
8748 (gnus-summary-toggle-header 1))
8750 (defun gnus-summary-caesar-message (&optional arg)
8751 "Caesar rotate the current article by 13.
8752 The numerical prefix specifies how many places to rotate each letter
8755 (gnus-summary-select-article)
8756 (let ((mail-header-separator ""))
8757 (gnus-eval-in-buffer-window gnus-article-buffer
8760 (let ((start (window-start))
8762 (message-caesar-buffer-body arg)
8763 (set-window-start (get-buffer-window (current-buffer)) start))))))
8765 (autoload 'unmorse-region "morse"
8766 "Convert morse coded text in region to ordinary ASCII text."
8769 (defun gnus-summary-morse-message (&optional arg)
8770 "Morse decode the current article."
8772 (gnus-summary-select-article)
8773 (let ((mail-header-separator ""))
8774 (gnus-eval-in-buffer-window gnus-article-buffer
8778 (let ((pos (window-start))
8780 (goto-char (point-min))
8781 (when (message-goto-body)
8782 (gnus-narrow-to-body))
8783 (goto-char (point-min))
8784 (while (re-search-forward "·" (point-max) t)
8785 (replace-match "."))
8786 (unmorse-region (point-min) (point-max))
8788 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8790 (defun gnus-summary-stop-page-breaking ()
8791 "Stop page breaking in the current article."
8793 (gnus-summary-select-article)
8794 (gnus-eval-in-buffer-window gnus-article-buffer
8796 (when (gnus-visual-p 'page-marker)
8797 (let ((buffer-read-only nil))
8798 (gnus-remove-text-with-property 'gnus-prev)
8799 (gnus-remove-text-with-property 'gnus-next))
8800 (setq gnus-page-broken nil))))
8802 (defun gnus-summary-move-article (&optional n to-newsgroup
8803 select-method action)
8804 "Move the current article to a different newsgroup.
8805 If N is a positive number, move the N next articles.
8806 If N is a negative number, move the N previous articles.
8807 If N is nil and any articles have been marked with the process mark,
8808 move those articles instead.
8809 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8810 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8811 re-spool using this method.
8813 When called interactively with TO-NEWSGROUP being nil, the value of
8814 the variable `gnus-move-split-methods' is used for finding a default
8815 for the target newsgroup.
8817 For this function to work, both the current newsgroup and the
8818 newsgroup that you want to move to have to support the `request-move'
8819 and `request-accept' functions.
8821 ACTION can be either `move' (the default), `crosspost' or `copy'."
8824 (setq action 'move))
8825 ;; Check whether the source group supports the required functions.
8826 (cond ((and (eq action 'move)
8827 (not (gnus-check-backend-function
8828 'request-move-article gnus-newsgroup-name)))
8829 (error "The current group does not support article moving"))
8830 ((and (eq action 'crosspost)
8831 (not (gnus-check-backend-function
8832 'request-replace-article gnus-newsgroup-name)))
8833 (error "The current group does not support article editing")))
8834 (let ((articles (gnus-summary-work-articles n))
8835 (prefix (if (gnus-check-backend-function
8836 'request-move-article gnus-newsgroup-name)
8837 (gnus-group-real-prefix gnus-newsgroup-name)
8839 (names '((move "Move" "Moving")
8840 (copy "Copy" "Copying")
8841 (crosspost "Crosspost" "Crossposting")))
8842 (copy-buf (save-excursion
8843 (nnheader-set-temp-buffer " *copy article*")))
8844 art-group to-method new-xref article to-groups)
8845 (unless (assq action names)
8846 (error "Unknown action %s" action))
8847 ;; Read the newsgroup name.
8848 (when (and (not to-newsgroup)
8849 (not select-method))
8850 (if (and gnus-move-split-methods
8852 (and (memq gnus-current-article articles)
8853 (gnus-buffer-live-p gnus-original-article-buffer))))
8854 ;; When `gnus-move-split-methods' is non-nil, we have to
8855 ;; select an article to give `gnus-read-move-group-name' an
8856 ;; opportunity to suggest an appropriate default. However,
8857 ;; we needn't render or mark the article.
8858 (let ((gnus-display-mime-function nil)
8859 (gnus-article-prepare-hook nil)
8860 (gnus-mark-article-hook nil))
8861 (gnus-summary-select-article nil nil nil (car articles))))
8863 (gnus-read-move-group-name
8864 (cadr (assq action names))
8865 (symbol-value (intern (format "gnus-current-%s-group" action)))
8867 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8868 (setq to-method (or select-method
8869 (gnus-server-to-method
8870 (gnus-group-method to-newsgroup))))
8871 ;; Check the method we are to move this article to...
8872 (unless (gnus-check-backend-function
8873 'request-accept-article (car to-method))
8874 (error "%s does not support article copying" (car to-method)))
8875 (unless (gnus-check-server to-method)
8876 (error "Can't open server %s" (car to-method)))
8877 (gnus-message 6 "%s to %s: %s..."
8878 (caddr (assq action names))
8879 (or (car select-method) to-newsgroup) articles)
8881 (setq article (pop articles))
8885 ;; Move the article.
8887 ;; Remove this article from future suppression.
8888 (gnus-dup-unsuppress-article article)
8889 (gnus-request-move-article
8890 article ; Article to move
8891 gnus-newsgroup-name ; From newsgroup
8892 (nth 1 (gnus-find-method-for-group
8893 gnus-newsgroup-name)) ; Server
8894 (list 'gnus-request-accept-article
8895 to-newsgroup (list 'quote select-method)
8896 (not articles) t) ; Accept form
8897 (not articles))) ; Only save nov last time
8898 ;; Copy the article.
8901 (set-buffer copy-buf)
8902 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8903 (gnus-request-accept-article
8904 to-newsgroup select-method (not articles) t))))
8905 ;; Crosspost the article.
8906 ((eq action 'crosspost)
8907 (let ((xref (message-tokenize-header
8908 (mail-header-xref (gnus-summary-article-header article))
8910 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8911 ":" (number-to-string article)))
8913 (setq xref (list (system-name))))
8916 (mapconcat 'identity
8917 (delete "Xref:" (delete new-xref xref))
8921 (set-buffer copy-buf)
8922 ;; First put the article in the destination group.
8923 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8924 (when (consp (setq art-group
8925 (gnus-request-accept-article
8926 to-newsgroup select-method (not articles))))
8927 (setq new-xref (concat new-xref " " (car art-group)
8929 (number-to-string (cdr art-group))))
8930 ;; Now we have the new Xrefs header, so we insert
8931 ;; it and replace the new article.
8932 (nnheader-replace-header "Xref" new-xref)
8933 (gnus-request-replace-article
8934 (cdr art-group) to-newsgroup (current-buffer))
8938 (gnus-message 1 "Couldn't %s article %s: %s"
8939 (cadr (assq action names)) article
8940 (nnheader-get-report (car to-method))))
8941 ((eq art-group 'junk)
8942 (when (eq action 'move)
8943 (gnus-summary-mark-article article gnus-canceled-mark)
8944 (gnus-message 4 "Deleted article %s" article)
8945 ;; run the delete hook
8946 (run-hook-with-args 'gnus-summary-article-delete-hook
8949 (assoc article (gnus-data-list nil)))
8950 gnus-newsgroup-name nil
8953 (let* ((pto-group (gnus-group-prefixed-name
8954 (car art-group) to-method))
8956 (gnus-gethash pto-group gnus-newsrc-hashtb))
8957 (info (nth 2 entry))
8958 (to-group (gnus-info-group info))
8960 ;; Update the group that has been moved to.
8962 (memq action '(move copy)))
8963 (unless (member to-group to-groups)
8964 (push to-group to-groups))
8966 (unless (memq article gnus-newsgroup-unreads)
8967 (push 'read to-marks)
8969 info (gnus-add-to-range (gnus-info-read info)
8970 (list (cdr art-group)))))
8972 ;; See whether the article is to be put in the cache.
8973 (let ((marks (if (gnus-group-auto-expirable-p to-group)
8974 gnus-article-mark-lists
8975 (delete '(expirable . expire)
8976 (copy-sequence gnus-article-mark-lists))))
8977 (to-article (cdr art-group)))
8979 ;; Enter the article into the cache in the new group,
8980 ;; if that is required.
8981 (when gnus-use-cache
8982 (gnus-cache-possibly-enter-article
8984 (memq article gnus-newsgroup-marked)
8985 (memq article gnus-newsgroup-dormant)
8986 (memq article gnus-newsgroup-unreads)))
8988 (when gnus-preserve-marks
8989 ;; Copy any marks over to the new group.
8990 (when (and (equal to-group gnus-newsgroup-name)
8991 (not (memq article gnus-newsgroup-unreads)))
8992 ;; Mark this article as read in this group.
8993 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
8994 (setcdr (gnus-active to-group) to-article)
8995 (setcdr gnus-newsgroup-active to-article))
8998 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8999 (when (memq article (symbol-value
9000 (intern (format "gnus-newsgroup-%s"
9002 (push (cdar marks) to-marks)
9003 ;; If the other group is the same as this group,
9004 ;; then we have to add the mark to the list.
9005 (when (equal to-group gnus-newsgroup-name)
9006 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9009 (intern (format "gnus-newsgroup-%s"
9011 ;; Copy the marks to other group.
9012 (gnus-add-marked-articles
9013 to-group (cdar marks) (list to-article) info)))
9014 (setq marks (cdr marks)))
9016 (gnus-request-set-mark
9017 to-group (list (list (list to-article) 'add to-marks))))
9020 (concat "(gnus-group-set-info '"
9021 (gnus-prin1-to-string (gnus-get-info to-group))
9024 ;; Update the Xref header in this article to point to
9025 ;; the new crossposted article we have just created.
9026 (when (eq action 'crosspost)
9028 (set-buffer copy-buf)
9029 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9030 (nnheader-replace-header "Xref" new-xref)
9031 (gnus-request-replace-article
9032 article gnus-newsgroup-name (current-buffer))))
9034 ;; run the move/copy/crosspost/respool hook
9035 (run-hook-with-args 'gnus-summary-article-move-hook
9038 (assoc article (gnus-data-list nil)))
9043 ;;;!!!Why is this necessary?
9044 (set-buffer gnus-summary-buffer)
9046 (gnus-summary-goto-subject article)
9047 (when (eq action 'move)
9048 (gnus-summary-mark-article article gnus-canceled-mark))))
9049 (gnus-summary-remove-process-mark article))
9050 ;; Re-activate all groups that have been moved to.
9052 (set-buffer gnus-group-buffer)
9053 (let ((gnus-group-marked to-groups))
9054 (gnus-group-get-new-news-this-group nil t)))
9056 (gnus-kill-buffer copy-buf)
9057 (gnus-summary-position-point)
9058 (gnus-set-mode-line 'summary)))
9060 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9061 "Move the current article to a different newsgroup.
9062 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9063 When called interactively, if TO-NEWSGROUP is nil, use the value of
9064 the variable `gnus-move-split-methods' for finding a default target
9066 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9067 re-spool using this method."
9069 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9071 (defun gnus-summary-crosspost-article (&optional n)
9072 "Crosspost the current article to some other group."
9074 (gnus-summary-move-article n nil nil 'crosspost))
9076 (defcustom gnus-summary-respool-default-method nil
9077 "Default method type for respooling an article.
9078 If nil, use to the current newsgroup method."
9080 :group 'gnus-summary-mail)
9082 (defcustom gnus-summary-display-while-building nil
9083 "If non-nil, show and update the summary buffer as it's being built.
9084 If the value is t, update the buffer after every line is inserted. If
9085 the value is an integer (N), update the display every N lines."
9087 :type '(choice (const :tag "off" nil)
9089 (const :tag "frequently" t)))
9091 (defun gnus-summary-respool-article (&optional n method)
9092 "Respool the current article.
9093 The article will be squeezed through the mail spooling process again,
9094 which means that it will be put in some mail newsgroup or other
9095 depending on `nnmail-split-methods'.
9096 If N is a positive number, respool the N next articles.
9097 If N is a negative number, respool the N previous articles.
9098 If N is nil and any articles have been marked with the process mark,
9099 respool those articles instead.
9101 Respooling can be done both from mail groups and \"real\" newsgroups.
9102 In the former case, the articles in question will be moved from the
9103 current group into whatever groups they are destined to. In the
9104 latter case, they will be copied into the relevant groups."
9106 (list current-prefix-arg
9107 (let* ((methods (gnus-methods-using 'respool))
9109 (symbol-name (or gnus-summary-respool-default-method
9110 (car (gnus-find-method-for-group
9111 gnus-newsgroup-name)))))
9113 (gnus-completing-read-with-default
9114 methname "What backend do you want to use when respooling?"
9115 methods nil t nil 'gnus-mail-method-history))
9118 ((zerop (length (setq ms (gnus-servers-using-backend
9120 (list (intern method) ""))
9124 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9125 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9128 (error "No method given for respooling"))
9129 (if (assoc (symbol-name
9130 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9131 (gnus-methods-using 'respool))
9132 (gnus-summary-move-article n nil method)
9133 (gnus-summary-copy-article n nil method)))
9135 (defun gnus-summary-import-article (file &optional edit)
9136 "Import an arbitrary file into a mail newsgroup."
9137 (interactive "fImport file: \nP")
9138 (let ((group gnus-newsgroup-name)
9139 (now (current-time))
9140 atts lines group-art)
9141 (unless (gnus-check-backend-function 'request-accept-article group)
9142 (error "%s does not support article importing" group))
9143 (or (file-readable-p file)
9144 (not (file-regular-p file))
9145 (error "Can't read %s" file))
9147 (set-buffer (gnus-get-buffer-create " *import file*"))
9149 (nnheader-insert-file-contents file)
9150 (goto-char (point-min))
9151 (if (nnheader-article-p)
9153 (goto-char (point-min))
9154 (search-forward "\n\n" nil t)
9155 (narrow-to-region (point-min) (1- (point)))
9156 (goto-char (point-min))
9157 (unless (re-search-forward "^date:" nil t)
9158 (goto-char (point-max))
9159 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9160 ;; This doesn't look like an article, so we fudge some headers.
9161 (setq atts (file-attributes file)
9162 lines (count-lines (point-min) (point-max)))
9163 (insert "From: " (read-string "From: ") "\n"
9164 "Subject: " (read-string "Subject: ") "\n"
9165 "Date: " (message-make-date (nth 5 atts)) "\n"
9166 "Message-ID: " (message-make-message-id) "\n"
9167 "Lines: " (int-to-string lines) "\n"
9168 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9169 (setq group-art (gnus-request-accept-article group nil t))
9170 (kill-buffer (current-buffer)))
9171 (setq gnus-newsgroup-active (gnus-activate-group group))
9173 (gnus-summary-goto-article (cdr group-art) nil t)
9175 (gnus-summary-edit-article))))
9177 (defun gnus-summary-create-article ()
9178 "Create an article in a mail newsgroup."
9180 (let ((group gnus-newsgroup-name)
9181 (now (current-time))
9183 (unless (gnus-check-backend-function 'request-accept-article group)
9184 (error "%s does not support article importing" group))
9186 (set-buffer (gnus-get-buffer-create " *import file*"))
9188 (goto-char (point-min))
9189 ;; This doesn't look like an article, so we fudge some headers.
9190 (insert "From: " (read-string "From: ") "\n"
9191 "Subject: " (read-string "Subject: ") "\n"
9192 "Date: " (message-make-date now) "\n"
9193 "Message-ID: " (message-make-message-id) "\n")
9194 (setq group-art (gnus-request-accept-article group nil t))
9195 (kill-buffer (current-buffer)))
9196 (setq gnus-newsgroup-active (gnus-activate-group group))
9198 (gnus-summary-goto-article (cdr group-art) nil t)
9199 (gnus-summary-edit-article)))
9201 (defun gnus-summary-article-posted-p ()
9202 "Say whether the current (mail) article is available from news as well.
9203 This will be the case if the article has both been mailed and posted."
9205 (let ((id (mail-header-references (gnus-summary-article-header)))
9206 (gnus-override-method (car (gnus-refer-article-methods))))
9207 (if (gnus-request-head id "")
9208 (gnus-message 2 "The current message was found on %s"
9209 gnus-override-method)
9210 (gnus-message 2 "The current message couldn't be found on %s"
9211 gnus-override-method)
9214 (defun gnus-summary-expire-articles (&optional now)
9215 "Expire all articles that are marked as expirable in the current group."
9217 (when (and (not gnus-group-is-exiting-without-update-p)
9218 (gnus-check-backend-function
9219 'request-expire-articles gnus-newsgroup-name))
9220 ;; This backend supports expiry.
9221 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9222 (expirable (if total
9224 ;; We need to update the info for
9225 ;; this group for `gnus-list-of-read-articles'
9226 ;; to give us the right answer.
9227 (gnus-run-hooks 'gnus-exit-group-hook)
9228 (gnus-summary-update-info)
9229 (gnus-list-of-read-articles gnus-newsgroup-name))
9230 (setq gnus-newsgroup-expirable
9231 (sort gnus-newsgroup-expirable '<))))
9232 (expiry-wait (if now 'immediate
9233 (gnus-group-find-parameter
9234 gnus-newsgroup-name 'expiry-wait)))
9235 (nnmail-expiry-target
9236 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9237 nnmail-expiry-target))
9240 ;; There are expirable articles in this group, so we run them
9241 ;; through the expiry process.
9242 (gnus-message 6 "Expiring articles...")
9243 (unless (gnus-check-group gnus-newsgroup-name)
9244 (error "Can't open server for %s" gnus-newsgroup-name))
9245 ;; The list of articles that weren't expired is returned.
9248 (let ((nnmail-expiry-wait-function nil)
9249 (nnmail-expiry-wait expiry-wait))
9250 (setq es (gnus-request-expire-articles
9251 expirable gnus-newsgroup-name)))
9252 (setq es (gnus-request-expire-articles
9253 expirable gnus-newsgroup-name)))
9255 (setq gnus-newsgroup-expirable es))
9256 ;; We go through the old list of expirable, and mark all
9257 ;; really expired articles as nonexistent.
9258 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9259 (let ((gnus-use-cache nil))
9260 (dolist (article expirable)
9261 (when (and (not (memq article es))
9262 (gnus-data-find article))
9263 (gnus-summary-mark-article article gnus-canceled-mark)
9264 (run-hook-with-args 'gnus-summary-article-expire-hook
9267 (assoc article (gnus-data-list nil)))
9271 (gnus-message 6 "Expiring articles...done")))))
9273 (defun gnus-summary-expire-articles-now ()
9274 "Expunge all expirable articles in the current group.
9275 This means that *all* articles that are marked as expirable will be
9276 deleted forever, right now."
9278 (or gnus-expert-user
9280 "Are you really, really, really sure you want to delete all these messages? ")
9282 (gnus-summary-expire-articles t))
9284 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9285 (defun gnus-summary-delete-article (&optional n)
9286 "Delete the N next (mail) articles.
9287 This command actually deletes articles. This is not a marking
9288 command. The article will disappear forever from your life, never to
9291 If N is negative, delete backwards.
9292 If N is nil and articles have been marked with the process mark,
9293 delete these instead.
9295 If `gnus-novice-user' is non-nil you will be asked for
9296 confirmation before the articles are deleted."
9298 (unless (gnus-check-backend-function 'request-expire-articles
9299 gnus-newsgroup-name)
9300 (error "The current newsgroup does not support article deletion"))
9301 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9302 (error "Couldn't open server"))
9303 ;; Compute the list of articles to delete.
9304 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9305 (nnmail-expiry-target 'delete)
9307 (if (and gnus-novice-user
9308 (not (gnus-yes-or-no-p
9309 (format "Do you really want to delete %s forever? "
9310 (if (> (length articles) 1)
9311 (format "these %s articles" (length articles))
9314 ;; Delete the articles.
9315 (setq not-deleted (gnus-request-expire-articles
9316 articles gnus-newsgroup-name 'force))
9318 (gnus-summary-remove-process-mark (car articles))
9319 ;; The backend might not have been able to delete the article
9321 (unless (memq (car articles) not-deleted)
9322 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9323 (let* ((article (car articles))
9324 (id (mail-header-id (gnus-data-header
9325 (assoc article (gnus-data-list nil))))))
9326 (run-hook-with-args 'gnus-summary-article-delete-hook
9327 'delete id gnus-newsgroup-name nil
9329 (setq articles (cdr articles)))
9331 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9332 (gnus-summary-position-point)
9333 (gnus-set-mode-line 'summary)
9336 (defun gnus-summary-edit-article (&optional arg)
9337 "Edit the current article.
9338 This will have permanent effect only in mail groups.
9339 If ARG is nil, edit the decoded articles.
9340 If ARG is 1, edit the raw articles.
9341 If ARG is 2, edit the raw articles even in read-only groups.
9342 If ARG is 3, edit the articles with the current handles.
9343 Otherwise, allow editing of articles even in read-only
9346 (let (force raw current-handles)
9355 (setq current-handles
9356 (and (gnus-buffer-live-p gnus-article-buffer)
9357 (with-current-buffer gnus-article-buffer
9359 gnus-article-mime-handles
9360 (setq gnus-article-mime-handles nil))))))
9363 (when (and raw (not force)
9364 (member gnus-newsgroup-name '("nndraft:delayed"
9367 (error "Can't edit the raw article in group %s"
9368 gnus-newsgroup-name))
9370 (set-buffer gnus-summary-buffer)
9371 (let ((mail-parse-charset gnus-newsgroup-charset)
9372 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9373 (gnus-set-global-variables)
9374 (when (and (not force)
9375 (gnus-group-read-only-p))
9376 (error "The current newsgroup does not support article editing"))
9377 (gnus-summary-show-article t)
9378 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9379 (with-current-buffer gnus-article-buffer
9380 (mm-enable-multibyte)))
9381 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9383 (gnus-article-edit-article
9386 (let ((mbl mml-buffer-list))
9387 (setq mml-buffer-list nil)
9388 (mime-to-mml ,'current-handles)
9389 (let ((mbl1 mml-buffer-list))
9390 (setq mml-buffer-list mbl)
9391 (set (make-local-variable 'mml-buffer-list) mbl1))
9392 (gnus-make-local-hook 'kill-buffer-hook)
9393 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9394 `(lambda (no-highlight)
9395 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9396 (message-options message-options)
9397 (message-options-set-recipient)
9398 (mail-parse-ignored-charsets
9399 ',gnus-newsgroup-ignored-charsets))
9400 ,(if (not raw) '(progn
9402 (mml-destroy-buffers)
9403 (remove-hook 'kill-buffer-hook
9404 'mml-destroy-buffers t)
9405 (kill-local-variable 'mml-buffer-list)))
9406 (gnus-summary-edit-article-done
9407 ,(or (mail-header-references gnus-current-headers) "")
9408 ,(gnus-group-read-only-p)
9409 ,gnus-summary-buffer no-highlight))))))))
9411 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9413 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9415 "Make edits to the current article permanent."
9418 ;; The buffer restriction contains the entire article if it exists.
9419 (when (article-goto-body)
9420 (let ((lines (count-lines (point) (point-max)))
9421 (length (- (point-max) (point)))
9422 (case-fold-search t)
9423 (body (copy-marker (point))))
9424 (goto-char (point-min))
9425 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9426 (delete-region (match-beginning 1) (match-end 1))
9427 (insert (number-to-string length)))
9428 (goto-char (point-min))
9429 (when (re-search-forward
9430 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9431 (delete-region (match-beginning 1) (match-end 1))
9432 (insert (number-to-string length)))
9433 (goto-char (point-min))
9434 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9435 (delete-region (match-beginning 1) (match-end 1))
9436 (insert (number-to-string lines))))))
9437 ;; Replace the article.
9438 (let ((buf (current-buffer)))
9440 (insert-buffer-substring buf)
9442 (if (and (not read-only)
9443 (not (gnus-request-replace-article
9444 (cdr gnus-article-current) (car gnus-article-current)
9445 (current-buffer) t)))
9446 (error "Couldn't replace article")
9447 ;; Update the summary buffer.
9449 (equal (message-tokenize-header references " ")
9450 (message-tokenize-header
9451 (or (message-fetch-field "references") "") " ")))
9452 ;; We only have to update this line.
9455 (message-narrow-to-head)
9456 (let ((head (buffer-string))
9459 (insert (format "211 %d Article retrieved.\n"
9460 (cdr gnus-article-current)))
9463 (let ((nntp-server-buffer (current-buffer)))
9464 (setq header (car (gnus-get-newsgroup-headers
9467 (set-buffer gnus-summary-buffer)
9468 (gnus-data-set-header
9469 (gnus-data-find (cdr gnus-article-current))
9471 (gnus-summary-update-article-line
9472 (cdr gnus-article-current) header)
9473 (if (gnus-summary-goto-subject
9474 (cdr gnus-article-current) nil t)
9475 (gnus-summary-update-secondary-mark
9476 (cdr gnus-article-current))))))))
9478 (set-buffer (or buffer gnus-summary-buffer))
9479 (gnus-summary-update-article (cdr gnus-article-current))
9480 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9481 (gnus-summary-update-secondary-mark
9482 (cdr gnus-article-current))))
9483 ;; Prettify the article buffer again.
9484 (unless no-highlight
9486 (set-buffer gnus-article-buffer)
9487 ;;;!!! Fix this -- article should be rehighlighted.
9488 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9489 (set-buffer gnus-original-article-buffer)
9490 (gnus-request-article
9491 (cdr gnus-article-current)
9492 (car gnus-article-current) (current-buffer))))
9493 ;; Prettify the summary buffer line.
9494 (when (gnus-visual-p 'summary-highlight 'highlight)
9495 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9497 (defun gnus-summary-edit-wash (key)
9498 "Perform editing command KEY in the article buffer."
9502 (message "%s" (concat (this-command-keys) "- "))
9505 (gnus-summary-edit-article)
9506 (execute-kbd-macro (concat (this-command-keys) key))
9507 (gnus-article-edit-done))
9511 (defun gnus-summary-respool-query (&optional silent trace)
9512 "Query where the respool algorithm would put this article."
9514 (let (gnus-mark-article-hook)
9515 (gnus-summary-select-article)
9517 (set-buffer gnus-original-article-buffer)
9518 (let ((groups (nnmail-article-group 'identity trace)))
9521 (message "This message would go to %s"
9522 (mapconcat 'car groups ", "))
9523 (message "This message would go to no groups"))
9526 (defun gnus-summary-respool-trace ()
9527 "Trace where the respool algorithm would put this article.
9528 Display a buffer showing all fancy splitting patterns which matched."
9530 (gnus-summary-respool-query nil t))
9532 ;; Summary marking commands.
9534 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9535 "Mark articles which has the same subject as read, and then select the next.
9536 If UNMARK is positive, remove any kind of mark.
9537 If UNMARK is negative, tick articles."
9540 (setq unmark (prefix-numeric-value unmark)))
9542 (gnus-summary-mark-same-subject
9543 (gnus-summary-article-subject) unmark)))
9544 ;; Select next unread article. If auto-select-same mode, should
9545 ;; select the first unread article.
9546 (gnus-summary-next-article t (and gnus-auto-select-same
9547 (gnus-summary-article-subject)))
9548 (gnus-message 7 "%d article%s marked as %s"
9549 count (if (= count 1) " is" "s are")
9550 (if unmark "unread" "read"))))
9552 (defun gnus-summary-kill-same-subject (&optional unmark)
9553 "Mark articles which has the same subject as read.
9554 If UNMARK is positive, remove any kind of mark.
9555 If UNMARK is negative, tick articles."
9558 (setq unmark (prefix-numeric-value unmark)))
9560 (gnus-summary-mark-same-subject
9561 (gnus-summary-article-subject) unmark)))
9562 ;; If marked as read, go to next unread subject.
9564 ;; Go to next unread subject.
9565 (gnus-summary-next-subject 1 t))
9566 (gnus-message 7 "%d articles are marked as %s"
9567 count (if unmark "unread" "read"))))
9569 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9570 "Mark articles with same SUBJECT as read, and return marked number.
9571 If optional argument UNMARK is positive, remove any kinds of marks.
9572 If optional argument UNMARK is negative, mark articles as unread instead."
9576 ((null unmark) ; Mark as read.
9579 (gnus-summary-mark-article-as-read gnus-killed-mark)
9580 (gnus-summary-show-thread) t)
9581 (gnus-summary-find-subject subject))
9582 (setq count (1+ count))))
9583 ((> unmark 0) ; Tick.
9586 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9587 (gnus-summary-show-thread) t)
9588 (gnus-summary-find-subject subject))
9589 (setq count (1+ count))))
9590 (t ; Mark as unread.
9593 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9594 (gnus-summary-show-thread) t)
9595 (gnus-summary-find-subject subject))
9596 (setq count (1+ count)))))
9597 (gnus-set-mode-line 'summary)
9598 ;; Return the number of marked articles.
9601 (defun gnus-summary-mark-as-processable (n &optional unmark)
9602 "Set the process mark on the next N articles.
9603 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9604 the process mark instead. The difference between N and the actual
9605 number of articles marked is returned."
9607 (if (and (null n) (gnus-region-active-p))
9608 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9609 (setq n (prefix-numeric-value n))
9610 (let ((backward (< n 0))
9615 (gnus-summary-remove-process-mark
9616 (gnus-summary-article-number))
9617 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9618 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9621 (gnus-message 7 "No more articles"))
9622 (gnus-summary-recenter)
9623 (gnus-summary-position-point)
9626 (defun gnus-summary-unmark-as-processable (n)
9627 "Remove the process mark from the next N articles.
9628 If N is negative, unmark backward instead. The difference between N and
9629 the actual number of articles unmarked is returned."
9631 (gnus-summary-mark-as-processable n t))
9633 (defun gnus-summary-unmark-all-processable ()
9634 "Remove the process mark from all articles."
9637 (while gnus-newsgroup-processable
9638 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9639 (gnus-summary-position-point))
9641 (defun gnus-summary-add-mark (article type)
9642 "Mark ARTICLE with a mark of TYPE."
9643 (let ((vtype (car (assq type gnus-article-mark-lists)))
9646 (error "No such mark type: %s" type)
9647 (setq var (intern (format "gnus-newsgroup-%s" type)))
9648 (set var (cons article (symbol-value var)))
9649 (if (memq type '(processable cached replied forwarded recent saved))
9650 (gnus-summary-update-secondary-mark article)
9651 ;;; !!! This is bogus. We should find out what primary
9652 ;;; !!! mark we want to set.
9653 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9655 (defun gnus-summary-mark-as-expirable (n)
9656 "Mark N articles forward as expirable.
9657 If N is negative, mark backward instead. The difference between N and
9658 the actual number of articles marked is returned."
9660 (gnus-summary-mark-forward n gnus-expirable-mark))
9662 (defun gnus-summary-mark-as-spam (n)
9663 "Mark N articles forward as spam.
9664 If N is negative, mark backward instead. The difference between N and
9665 the actual number of articles marked is returned."
9667 (gnus-summary-mark-forward n gnus-spam-mark))
9669 (defun gnus-summary-mark-article-as-replied (article)
9670 "Mark ARTICLE as replied to and update the summary line.
9671 ARTICLE can also be a list of articles."
9672 (interactive (list (gnus-summary-article-number)))
9673 (let ((articles (if (listp article) article (list article))))
9674 (dolist (article articles)
9675 (unless (numberp article)
9676 (error "%s is not a number" article))
9677 (push article gnus-newsgroup-replied)
9678 (let ((buffer-read-only nil))
9679 (when (gnus-summary-goto-subject article nil t)
9680 (gnus-summary-update-secondary-mark article))))))
9682 (defun gnus-summary-mark-article-as-forwarded (article)
9683 "Mark ARTICLE as forwarded and update the summary line.
9684 ARTICLE can also be a list of articles."
9685 (let ((articles (if (listp article) article (list article))))
9686 (dolist (article articles)
9687 (push article gnus-newsgroup-forwarded)
9688 (let ((buffer-read-only nil))
9689 (when (gnus-summary-goto-subject article nil t)
9690 (gnus-summary-update-secondary-mark article))))))
9692 (defun gnus-summary-set-bookmark (article)
9693 "Set a bookmark in current article."
9694 (interactive (list (gnus-summary-article-number)))
9695 (when (or (not (get-buffer gnus-article-buffer))
9696 (not gnus-current-article)
9697 (not gnus-article-current)
9698 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9699 (error "No current article selected"))
9700 ;; Remove old bookmark, if one exists.
9701 (gnus-pull article gnus-newsgroup-bookmarks)
9702 ;; Set the new bookmark, which is on the form
9703 ;; (article-number . line-number-in-body).
9707 (set-buffer gnus-article-buffer)
9714 gnus-newsgroup-bookmarks)
9715 (gnus-message 6 "A bookmark has been added to the current article."))
9717 (defun gnus-summary-remove-bookmark (article)
9718 "Remove the bookmark from the current article."
9719 (interactive (list (gnus-summary-article-number)))
9720 ;; Remove old bookmark, if one exists.
9721 (if (not (assq article gnus-newsgroup-bookmarks))
9722 (gnus-message 6 "No bookmark in current article.")
9723 (gnus-pull article gnus-newsgroup-bookmarks)
9724 (gnus-message 6 "Removed bookmark.")))
9726 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9727 (defun gnus-summary-mark-as-dormant (n)
9728 "Mark N articles forward as dormant.
9729 If N is negative, mark backward instead. The difference between N and
9730 the actual number of articles marked is returned."
9732 (gnus-summary-mark-forward n gnus-dormant-mark))
9734 (defun gnus-summary-set-process-mark (article)
9735 "Set the process mark on ARTICLE and update the summary line."
9736 (setq gnus-newsgroup-processable
9738 (delq article gnus-newsgroup-processable)))
9739 (when (gnus-summary-goto-subject article)
9740 (gnus-summary-show-thread)
9741 (gnus-summary-goto-subject article)
9742 (gnus-summary-update-secondary-mark article)))
9744 (defun gnus-summary-remove-process-mark (article)
9745 "Remove the process mark from ARTICLE and update the summary line."
9746 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9747 (when (gnus-summary-goto-subject article)
9748 (gnus-summary-show-thread)
9749 (gnus-summary-goto-subject article)
9750 (gnus-summary-update-secondary-mark article)))
9752 (defun gnus-summary-set-saved-mark (article)
9753 "Set the process mark on ARTICLE and update the summary line."
9754 (push article gnus-newsgroup-saved)
9755 (when (gnus-summary-goto-subject article)
9756 (gnus-summary-update-secondary-mark article)))
9758 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9759 "Mark N articles as read forwards.
9760 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9761 The difference between N and the actual number of articles marked is
9763 If NO-EXPIRE, auto-expiry will be inhibited."
9765 (gnus-summary-show-thread)
9766 (let ((backward (< n 0))
9767 (gnus-summary-goto-unread
9768 (and gnus-summary-goto-unread
9769 (not (eq gnus-summary-goto-unread 'never))
9770 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9771 gnus-ticked-mark gnus-dormant-mark)))))
9773 (mark (or mark gnus-del-mark)))
9775 (gnus-summary-mark-article nil mark no-expire)
9776 (zerop (gnus-summary-next-subject
9778 (and gnus-summary-goto-unread
9779 (not (eq gnus-summary-goto-unread 'never)))
9783 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9784 (gnus-summary-recenter)
9785 (gnus-summary-position-point)
9786 (gnus-set-mode-line 'summary)
9789 (defun gnus-summary-mark-article-as-read (mark)
9790 "Mark the current article quickly as read with MARK."
9791 (let ((article (gnus-summary-article-number)))
9792 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9793 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9794 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9795 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9796 (push (cons article mark) gnus-newsgroup-reads)
9797 ;; Possibly remove from cache, if that is used.
9798 (when gnus-use-cache
9799 (gnus-cache-enter-remove-article article))
9800 ;; Allow the backend to change the mark.
9801 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9802 ;; Check for auto-expiry.
9803 (when (and gnus-newsgroup-auto-expire
9804 (memq mark gnus-auto-expirable-marks))
9805 (setq mark gnus-expirable-mark)
9806 ;; Let the backend know about the mark change.
9807 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9808 (push article gnus-newsgroup-expirable))
9809 ;; Set the mark in the buffer.
9810 (gnus-summary-update-mark mark 'unread)
9813 (defun gnus-summary-mark-article-as-unread (mark)
9814 "Mark the current article quickly as unread with MARK."
9815 (let* ((article (gnus-summary-article-number))
9816 (old-mark (gnus-summary-article-mark article)))
9817 ;; Allow the backend to change the mark.
9818 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9819 (if (eq mark old-mark)
9823 (gnus-error 1 "Can't mark negative article numbers")
9825 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9826 (setq gnus-newsgroup-spam-marked
9827 (delq article gnus-newsgroup-spam-marked))
9828 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9829 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9830 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9831 (cond ((= mark gnus-ticked-mark)
9832 (setq gnus-newsgroup-marked
9833 (gnus-add-to-sorted-list gnus-newsgroup-marked
9835 ((= mark gnus-spam-mark)
9836 (setq gnus-newsgroup-spam-marked
9837 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9839 ((= mark gnus-dormant-mark)
9840 (setq gnus-newsgroup-dormant
9841 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9844 (setq gnus-newsgroup-unreads
9845 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9847 (gnus-pull article gnus-newsgroup-reads)
9849 ;; See whether the article is to be put in the cache.
9851 (vectorp (gnus-summary-article-header article))
9853 (gnus-cache-possibly-enter-article
9854 gnus-newsgroup-name article
9855 (= mark gnus-ticked-mark)
9856 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9859 (gnus-summary-update-mark mark 'unread)
9862 (defun gnus-summary-mark-article (&optional article mark no-expire)
9863 "Mark ARTICLE with MARK. MARK can be any character.
9864 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9865 `??' (dormant) and `?E' (expirable).
9866 If MARK is nil, then the default character `?r' is used.
9867 If ARTICLE is nil, then the article on the current line will be
9869 If NO-EXPIRE, auto-expiry will be inhibited."
9870 ;; The mark might be a string.
9871 (when (stringp mark)
9872 (setq mark (aref mark 0)))
9873 ;; If no mark is given, then we check auto-expiring.
9875 (setq mark gnus-del-mark))
9876 (when (and (not no-expire)
9877 gnus-newsgroup-auto-expire
9878 (memq mark gnus-auto-expirable-marks))
9879 (setq mark gnus-expirable-mark))
9880 (let ((article (or article (gnus-summary-article-number)))
9881 (old-mark (gnus-summary-article-mark article)))
9882 ;; Allow the backend to change the mark.
9883 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9884 (if (eq mark old-mark)
9887 (error "No article on current line"))
9888 (if (not (if (or (= mark gnus-unread-mark)
9889 (= mark gnus-ticked-mark)
9890 (= mark gnus-spam-mark)
9891 (= mark gnus-dormant-mark))
9892 (gnus-mark-article-as-unread article mark)
9893 (gnus-mark-article-as-read article mark)))
9895 ;; See whether the article is to be put in the cache.
9897 (not (= mark gnus-canceled-mark))
9898 (vectorp (gnus-summary-article-header article))
9900 (gnus-cache-possibly-enter-article
9901 gnus-newsgroup-name article
9902 (= mark gnus-ticked-mark)
9903 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9905 (when (gnus-summary-goto-subject article nil t)
9906 (let ((buffer-read-only nil))
9907 (gnus-summary-show-thread)
9909 (gnus-summary-update-mark mark 'unread)
9912 (defun gnus-summary-update-secondary-mark (article)
9913 "Update the secondary (read, process, cache) mark."
9914 (gnus-summary-update-mark
9915 (cond ((memq article gnus-newsgroup-processable)
9917 ((memq article gnus-newsgroup-cached)
9919 ((memq article gnus-newsgroup-replied)
9921 ((memq article gnus-newsgroup-forwarded)
9922 gnus-forwarded-mark)
9923 ((memq article gnus-newsgroup-saved)
9925 ((memq article gnus-newsgroup-recent)
9927 ((memq article gnus-newsgroup-unseen)
9931 (when (gnus-visual-p 'summary-highlight 'highlight)
9932 (gnus-run-hooks 'gnus-summary-update-hook))
9935 (defun gnus-summary-update-download-mark (article)
9936 "Update the download mark."
9937 (gnus-summary-update-mark
9938 (cond ((memq article gnus-newsgroup-undownloaded)
9939 gnus-undownloaded-mark)
9940 (gnus-newsgroup-agentized
9941 gnus-downloaded-mark)
9945 (gnus-summary-update-line t)
9948 (defun gnus-summary-update-mark (mark type)
9949 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9950 (buffer-read-only nil))
9951 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
9953 (when (looking-at "\r")
9955 (when (<= (+ forward (point)) (point-max))
9956 ;; Go to the right position on the line.
9957 (goto-char (+ forward (point)))
9958 ;; Replace the old mark with the new mark.
9959 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9960 ;; Optionally update the marks by some user rule.
9961 (when (eq type 'unread)
9963 (gnus-data-find (gnus-summary-article-number)) mark)
9964 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
9966 (defun gnus-mark-article-as-read (article &optional mark)
9967 "Enter ARTICLE in the pertinent lists and remove it from others."
9968 ;; Make the article expirable.
9969 (let ((mark (or mark gnus-del-mark)))
9970 (setq gnus-newsgroup-expirable
9971 (if (= mark gnus-expirable-mark)
9972 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
9973 (delq article gnus-newsgroup-expirable)))
9974 ;; Remove from unread and marked lists.
9975 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9976 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9977 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9978 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9979 (push (cons article mark) gnus-newsgroup-reads)
9980 ;; Possibly remove from cache, if that is used.
9981 (when gnus-use-cache
9982 (gnus-cache-enter-remove-article article))
9985 (defun gnus-mark-article-as-unread (article &optional mark)
9986 "Enter ARTICLE in the pertinent lists and remove it from others."
9987 (let ((mark (or mark gnus-ticked-mark)))
9990 (gnus-error 1 "Can't mark negative article numbers")
9992 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9993 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
9994 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9995 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9996 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9998 ;; Unsuppress duplicates?
9999 (when gnus-suppress-duplicates
10000 (gnus-dup-unsuppress-article article))
10002 (cond ((= mark gnus-ticked-mark)
10003 (setq gnus-newsgroup-marked
10004 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10005 ((= mark gnus-spam-mark)
10006 (setq gnus-newsgroup-spam-marked
10007 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10009 ((= mark gnus-dormant-mark)
10010 (setq gnus-newsgroup-dormant
10011 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10013 (setq gnus-newsgroup-unreads
10014 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10015 (gnus-pull article gnus-newsgroup-reads)
10018 (defalias 'gnus-summary-mark-as-unread-forward
10019 'gnus-summary-tick-article-forward)
10020 (make-obsolete 'gnus-summary-mark-as-unread-forward
10021 'gnus-summary-tick-article-forward)
10022 (defun gnus-summary-tick-article-forward (n)
10023 "Tick N articles forwards.
10024 If N is negative, tick backwards instead.
10025 The difference between N and the number of articles ticked is returned."
10027 (gnus-summary-mark-forward n gnus-ticked-mark))
10029 (defalias 'gnus-summary-mark-as-unread-backward
10030 'gnus-summary-tick-article-backward)
10031 (make-obsolete 'gnus-summary-mark-as-unread-backward
10032 'gnus-summary-tick-article-backward)
10033 (defun gnus-summary-tick-article-backward (n)
10034 "Tick N articles backwards.
10035 The difference between N and the number of articles ticked is returned."
10037 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10039 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10040 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10041 (defun gnus-summary-tick-article (&optional article clear-mark)
10042 "Mark current article as unread.
10043 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10044 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10046 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10047 gnus-ticked-mark)))
10049 (defun gnus-summary-mark-as-read-forward (n)
10050 "Mark N articles as read forwards.
10051 If N is negative, mark backwards instead.
10052 The difference between N and the actual number of articles marked is
10055 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10057 (defun gnus-summary-mark-as-read-backward (n)
10058 "Mark the N articles as read backwards.
10059 The difference between N and the actual number of articles marked is
10062 (gnus-summary-mark-forward
10063 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10065 (defun gnus-summary-mark-as-read (&optional article mark)
10066 "Mark current article as read.
10067 ARTICLE specifies the article to be marked as read.
10068 MARK specifies a string to be inserted at the beginning of the line."
10069 (gnus-summary-mark-article article mark))
10071 (defun gnus-summary-clear-mark-forward (n)
10072 "Clear marks from N articles forward.
10073 If N is negative, clear backward instead.
10074 The difference between N and the number of marks cleared is returned."
10076 (gnus-summary-mark-forward n gnus-unread-mark))
10078 (defun gnus-summary-clear-mark-backward (n)
10079 "Clear marks from N articles backward.
10080 The difference between N and the number of marks cleared is returned."
10082 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10084 (defun gnus-summary-mark-unread-as-read ()
10085 "Intended to be used by `gnus-summary-mark-article-hook'."
10086 (when (memq gnus-current-article gnus-newsgroup-unreads)
10087 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10089 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10090 "Intended to be used by `gnus-summary-mark-article-hook'."
10091 (let ((mark (gnus-summary-article-mark)))
10092 (when (or (gnus-unread-mark-p mark)
10093 (gnus-read-mark-p mark))
10094 (gnus-summary-mark-article gnus-current-article
10095 (or new-mark gnus-read-mark)))))
10097 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10098 "Intended to be used by `gnus-summary-mark-article-hook'."
10099 (let ((mark (gnus-summary-article-mark)))
10100 (when (or (gnus-unread-mark-p mark)
10101 (gnus-read-mark-p mark))
10102 (gnus-summary-mark-article (gnus-summary-article-number)
10103 (or new-mark gnus-read-mark)))))
10105 (defun gnus-summary-mark-unread-as-ticked ()
10106 "Intended to be used by `gnus-summary-mark-article-hook'."
10107 (when (memq gnus-current-article gnus-newsgroup-unreads)
10108 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10110 (defun gnus-summary-mark-region-as-read (point mark all)
10111 "Mark all unread articles between point and mark as read.
10112 If given a prefix, mark all articles between point and mark as read,
10113 even ticked and dormant ones."
10114 (interactive "r\nP")
10118 (beginning-of-line)
10123 (memq (setq article (gnus-summary-article-number))
10124 gnus-newsgroup-unreads))
10125 (gnus-summary-mark-article article gnus-del-mark))
10127 (gnus-summary-find-next))))))
10129 (defun gnus-summary-mark-below (score mark)
10130 "Mark articles with score less than SCORE with MARK."
10131 (interactive "P\ncMark: ")
10132 (setq score (if score
10133 (prefix-numeric-value score)
10134 (or gnus-summary-default-score 0)))
10136 (set-buffer gnus-summary-buffer)
10137 (goto-char (point-min))
10140 (and (< (gnus-summary-article-score) score)
10141 (gnus-summary-mark-article nil mark))
10142 (gnus-summary-find-next)))))
10144 (defun gnus-summary-kill-below (&optional score)
10145 "Mark articles with score below SCORE as read."
10147 (gnus-summary-mark-below score gnus-killed-mark))
10149 (defun gnus-summary-clear-above (&optional score)
10150 "Clear all marks from articles with score above SCORE."
10152 (gnus-summary-mark-above score gnus-unread-mark))
10154 (defun gnus-summary-tick-above (&optional score)
10155 "Tick all articles with score above SCORE."
10157 (gnus-summary-mark-above score gnus-ticked-mark))
10159 (defun gnus-summary-mark-above (score mark)
10160 "Mark articles with score over SCORE with MARK."
10161 (interactive "P\ncMark: ")
10162 (setq score (if score
10163 (prefix-numeric-value score)
10164 (or gnus-summary-default-score 0)))
10166 (set-buffer gnus-summary-buffer)
10167 (goto-char (point-min))
10169 (when (> (gnus-summary-article-score) score)
10170 (gnus-summary-mark-article nil mark))
10172 (gnus-summary-find-next)))))
10174 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10175 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10176 (defun gnus-summary-limit-include-expunged (&optional no-error)
10177 "Display all the hidden articles that were expunged for low scores."
10179 (let ((buffer-read-only nil))
10180 (let ((scored gnus-newsgroup-scored)
10183 (unless (gnus-summary-article-header (caar scored))
10184 (and (setq h (gnus-number-to-header (caar scored)))
10185 (< (cdar scored) gnus-summary-expunge-below)
10187 (setq scored (cdr scored)))
10189 (when (not no-error)
10190 (error "No expunged articles hidden"))
10191 (goto-char (point-min))
10192 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10193 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10194 (mapcar (lambda (x) (push (mail-header-number x)
10195 gnus-newsgroup-limit))
10197 (gnus-summary-prepare-unthreaded (nreverse headers))
10198 (goto-char (point-min))
10199 (gnus-summary-position-point)
10202 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10203 "Mark all unread articles in this newsgroup as read.
10204 If prefix argument ALL is non-nil, ticked and dormant articles will
10205 also be marked as read.
10206 If QUIETLY is non-nil, no questions will be asked.
10208 If TO-HERE is non-nil, it should be a point in the buffer. All
10209 articles before (after, if REVERSE is set) this point will be marked
10212 Note that this function will only catch up the unread article
10213 in the current summary buffer limitation.
10215 The number of articles marked as read is returned."
10220 (not gnus-interactive-catchup) ;Without confirmation?
10224 "Mark absolutely all articles as read? "
10225 "Mark all unread articles as read? ")))
10227 (not gnus-newsgroup-adaptive)
10228 (not gnus-newsgroup-auto-expire)
10229 (not gnus-suppress-duplicates)
10230 (or (not gnus-use-cache)
10231 (eq gnus-use-cache 'passive)))
10234 (setq gnus-newsgroup-marked nil
10235 gnus-newsgroup-spam-marked nil
10236 gnus-newsgroup-dormant nil))
10237 (setq gnus-newsgroup-unreads
10238 (gnus-sorted-nunion
10239 (gnus-intersection gnus-newsgroup-unreads
10240 gnus-newsgroup-downloadable)
10241 gnus-newsgroup-unfetched)))
10242 ;; We actually mark all articles as canceled, which we
10243 ;; have to do when using auto-expiry or adaptive scoring.
10244 (gnus-summary-show-all-threads)
10245 (if (and to-here reverse)
10247 (goto-char to-here)
10248 (gnus-summary-mark-current-read-and-unread-as-read
10250 (while (gnus-summary-find-next (not all))
10251 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10252 (when (gnus-summary-first-subject (not all))
10254 (if to-here (< (point) to-here) t)
10255 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10256 (gnus-summary-find-next (not all))))))
10257 (gnus-set-mode-line 'summary))
10259 (gnus-summary-position-point)))
10261 (defun gnus-summary-catchup-to-here (&optional all)
10262 "Mark all unticked articles before the current one as read.
10263 If ALL is non-nil, also mark ticked and dormant articles as read."
10266 (gnus-save-hidden-threads
10267 (let ((beg (point)))
10268 ;; We check that there are unread articles.
10269 (when (or all (gnus-summary-find-prev))
10270 (gnus-summary-catchup all t beg)))))
10271 (gnus-summary-position-point))
10273 (defun gnus-summary-catchup-from-here (&optional all)
10274 "Mark all unticked articles after (and including) the current one as read.
10275 If ALL is non-nil, also mark ticked and dormant articles as read."
10278 (gnus-save-hidden-threads
10279 (let ((beg (point)))
10280 ;; We check that there are unread articles.
10281 (when (or all (gnus-summary-find-next))
10282 (gnus-summary-catchup all t beg nil t)))))
10283 (gnus-summary-position-point))
10285 (defun gnus-summary-catchup-all (&optional quietly)
10286 "Mark all articles in this newsgroup as read.
10287 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10288 instead, which marks only unread articles as read."
10290 (gnus-summary-catchup t quietly))
10292 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10293 "Mark all unread articles in this group as read, then exit.
10294 If prefix argument ALL is non-nil, all articles are marked as read.
10295 If QUIETLY is non-nil, no questions will be asked."
10297 (when (gnus-summary-catchup all quietly nil 'fast)
10298 ;; Select next newsgroup or exit.
10299 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10300 (eq gnus-auto-select-next 'quietly))
10301 (gnus-summary-next-group nil)
10302 (gnus-summary-exit))))
10304 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10305 "Mark all articles in this newsgroup as read, and then exit.
10306 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10307 instead, which marks only unread articles as read."
10309 (gnus-summary-catchup-and-exit t quietly))
10311 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10312 "Mark all articles in this group as read and select the next group.
10313 If given a prefix, mark all articles, unread as well as ticked, as
10317 (gnus-summary-catchup all))
10318 (gnus-summary-next-group))
10324 (defmacro gnus-with-article (article &rest forms)
10325 "Select ARTICLE and perform FORMS in the original article buffer.
10326 Then replace the article with the result."
10328 ;; We don't want the article to be marked as read.
10329 (let (gnus-mark-article-hook)
10330 (gnus-summary-select-article t t nil ,article))
10331 (set-buffer gnus-original-article-buffer)
10333 (if (not (gnus-check-backend-function
10334 'request-replace-article (car gnus-article-current)))
10335 (gnus-message 5 "Read-only group; not replacing")
10336 (unless (gnus-request-replace-article
10337 ,article (car gnus-article-current)
10338 (current-buffer) t)
10339 (error "Couldn't replace article")))
10340 ;; The cache and backlog have to be flushed somewhat.
10341 (when gnus-keep-backlog
10342 (gnus-backlog-remove-article
10343 (car gnus-article-current) (cdr gnus-article-current)))
10344 (when gnus-use-cache
10345 (gnus-cache-update-article
10346 (car gnus-article-current) (cdr gnus-article-current)))))
10348 (put 'gnus-with-article 'lisp-indent-function 1)
10349 (put 'gnus-with-article 'edebug-form-spec '(form body))
10351 ;; Thread-based commands.
10353 (defun gnus-summary-articles-in-thread (&optional article)
10354 "Return a list of all articles in the current thread.
10355 If ARTICLE is non-nil, return all articles in the thread that starts
10356 with that article."
10357 (let* ((article (or article (gnus-summary-article-number)))
10358 (data (gnus-data-find-list article))
10359 (top-level (gnus-data-level (car data)))
10361 (cond ((null gnus-thread-operation-ignore-subject)
10362 (gnus-simplify-subject-re
10363 (mail-header-subject (gnus-data-header (car data)))))
10364 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10365 (gnus-simplify-subject-fuzzy
10366 (mail-header-subject (gnus-data-header (car data)))))
10368 (end-point (save-excursion
10369 (if (gnus-summary-go-to-next-thread)
10370 (point) (point-max))))
10373 (< (gnus-data-pos (car data)) end-point))
10374 (when (or (not top-subject)
10375 (string= top-subject
10376 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10377 (gnus-simplify-subject-fuzzy
10378 (mail-header-subject
10379 (gnus-data-header (car data))))
10380 (gnus-simplify-subject-re
10381 (mail-header-subject
10382 (gnus-data-header (car data)))))))
10383 (push (gnus-data-number (car data)) articles))
10384 (unless (and (setq data (cdr data))
10385 (> (gnus-data-level (car data)) top-level))
10387 ;; Return the list of articles.
10388 (nreverse articles)))
10390 (defun gnus-summary-rethread-current ()
10391 "Rethread the thread the current article is part of."
10393 (let* ((gnus-show-threads t)
10394 (article (gnus-summary-article-number))
10395 (id (mail-header-id (gnus-summary-article-header)))
10396 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10398 (error "No article on the current line"))
10399 (gnus-rebuild-thread id)
10400 (gnus-summary-goto-subject article)))
10402 (defun gnus-summary-reparent-thread ()
10403 "Make the current article child of the marked (or previous) article.
10405 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10406 is non-nil or the Subject: of both articles are the same."
10408 (unless (not (gnus-group-read-only-p))
10409 (error "The current newsgroup does not support article editing"))
10410 (unless (<= (length gnus-newsgroup-processable) 1)
10411 (error "No more than one article may be marked"))
10412 (save-window-excursion
10413 (let ((gnus-article-buffer " *reparent*")
10414 (current-article (gnus-summary-article-number))
10415 ;; First grab the marked article, otherwise one line up.
10416 (parent-article (if (not (null gnus-newsgroup-processable))
10417 (car gnus-newsgroup-processable)
10419 (if (eq (forward-line -1) 0)
10420 (gnus-summary-article-number)
10421 (error "Beginning of summary buffer"))))))
10422 (unless (not (eq current-article parent-article))
10423 (error "An article may not be self-referential"))
10424 (let ((message-id (mail-header-id
10425 (gnus-summary-article-header parent-article))))
10426 (unless (and message-id (not (equal message-id "")))
10427 (error "No message-id in desired parent"))
10428 (gnus-with-article current-article
10430 (goto-char (point-min))
10431 (message-narrow-to-head)
10432 (if (re-search-forward "^References: " nil t)
10434 (re-search-forward "^[^ \t]" nil t)
10437 (insert " " message-id))
10438 (insert "References: " message-id "\n"))))
10439 (set-buffer gnus-summary-buffer)
10440 (gnus-summary-unmark-all-processable)
10441 (gnus-summary-update-article current-article)
10442 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10443 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10444 (gnus-summary-rethread-current)
10445 (gnus-message 3 "Article %d is now the child of article %d"
10446 current-article parent-article)))))
10448 (defun gnus-summary-toggle-threads (&optional arg)
10449 "Toggle showing conversation threads.
10450 If ARG is positive number, turn showing conversation threads on."
10452 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10453 (setq gnus-show-threads
10454 (if (null arg) (not gnus-show-threads)
10455 (> (prefix-numeric-value arg) 0)))
10456 (gnus-summary-prepare)
10457 (gnus-summary-goto-subject current)
10458 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10459 (gnus-summary-position-point)))
10461 (defun gnus-summary-show-all-threads ()
10462 "Show all threads."
10465 (let ((buffer-read-only nil))
10466 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10467 (gnus-summary-position-point))
10469 (defun gnus-summary-show-thread ()
10470 "Show thread subtrees.
10471 Returns nil if no thread was there to be shown."
10473 (let ((buffer-read-only nil)
10475 (end (point-at-eol))
10476 ;; Leave point at bol
10477 (beg (progn (beginning-of-line) (point))))
10479 ;; Any hidden lines here?
10480 (search-forward "\r" end t)
10481 (subst-char-in-region beg end ?\^M ?\n t)
10483 (gnus-summary-position-point))))
10485 (defun gnus-summary-maybe-hide-threads ()
10486 "If requested, hide the threads that should be hidden."
10487 (when (and gnus-show-threads
10488 gnus-thread-hide-subtree)
10489 (gnus-summary-hide-all-threads
10490 (if (or (consp gnus-thread-hide-subtree)
10491 (functionp gnus-thread-hide-subtree))
10492 (gnus-make-predicate gnus-thread-hide-subtree)
10495 ;;; Hiding predicates.
10497 (defun gnus-article-unread-p (header)
10498 (memq (mail-header-number header) gnus-newsgroup-unreads))
10500 (defun gnus-article-unseen-p (header)
10501 (memq (mail-header-number header) gnus-newsgroup-unseen))
10503 (defun gnus-map-articles (predicate articles)
10504 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10505 (apply 'gnus-or (mapcar predicate
10506 (mapcar 'gnus-summary-article-header articles))))
10508 (defun gnus-summary-hide-all-threads (&optional predicate)
10509 "Hide all thread subtrees.
10510 If PREDICATE is supplied, threads that satisfy this predicate
10511 will not be hidden."
10514 (goto-char (point-min))
10517 (when (or (not predicate)
10519 predicate (gnus-summary-article-children)))
10520 (gnus-summary-hide-thread))
10521 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10522 (gnus-summary-position-point))
10524 (defun gnus-summary-hide-thread ()
10525 "Hide thread subtrees.
10526 If PREDICATE is supplied, threads that satisfy this predicate
10527 will not be hidden.
10528 Returns nil if no threads were there to be hidden."
10530 (let ((buffer-read-only nil)
10532 (article (gnus-summary-article-number)))
10534 ;; Go forward until either the buffer ends or the subthread
10536 (when (and (not (eobp))
10537 (or (zerop (gnus-summary-next-thread 1 t))
10538 (goto-char (point-max))))
10540 (if (and (> (point) start)
10541 (search-backward "\n" start t))
10543 (subst-char-in-region start (point) ?\n ?\^M)
10544 (gnus-summary-goto-subject article))
10548 (defun gnus-summary-go-to-next-thread (&optional previous)
10549 "Go to the same level (or less) next thread.
10550 If PREVIOUS is non-nil, go to previous thread instead.
10551 Return the article number moved to, or nil if moving was impossible."
10552 (let ((level (gnus-summary-thread-level))
10553 (way (if previous -1 1))
10556 (while (and (not (eobp))
10557 (< level (gnus-summary-thread-level)))
10558 (forward-line way))
10565 (gnus-summary-article-number)
10566 (goto-char beg)))))
10568 (defun gnus-summary-next-thread (n &optional silent)
10569 "Go to the same level next N'th thread.
10570 If N is negative, search backward instead.
10571 Returns the difference between N and the number of skips actually
10574 If SILENT, don't output messages."
10576 (let ((backward (< n 0))
10578 (while (and (> n 0)
10579 (gnus-summary-go-to-next-thread backward))
10582 (gnus-summary-position-point))
10583 (when (and (not silent) (/= 0 n))
10584 (gnus-message 7 "No more threads"))
10587 (defun gnus-summary-prev-thread (n)
10588 "Go to the same level previous N'th thread.
10589 Returns the difference between N and the number of skips actually
10592 (gnus-summary-next-thread (- n)))
10594 (defun gnus-summary-go-down-thread ()
10595 "Go down one level in the current thread."
10596 (let ((children (gnus-summary-article-children)))
10598 (gnus-summary-goto-subject (car children)))))
10600 (defun gnus-summary-go-up-thread ()
10601 "Go up one level in the current thread."
10602 (let ((parent (gnus-summary-article-parent)))
10604 (gnus-summary-goto-subject parent))))
10606 (defun gnus-summary-down-thread (n)
10607 "Go down thread N steps.
10608 If N is negative, go up instead.
10609 Returns the difference between N and how many steps down that were
10614 (while (and (> n 0)
10615 (if up (gnus-summary-go-up-thread)
10616 (gnus-summary-go-down-thread)))
10618 (gnus-summary-position-point)
10620 (gnus-message 7 "Can't go further"))
10623 (defun gnus-summary-up-thread (n)
10624 "Go up thread N steps.
10625 If N is negative, go down instead.
10626 Returns the difference between N and how many steps down that were
10629 (gnus-summary-down-thread (- n)))
10631 (defun gnus-summary-top-thread ()
10632 "Go to the top of the thread."
10634 (while (gnus-summary-go-up-thread))
10635 (gnus-summary-article-number))
10637 (defun gnus-summary-kill-thread (&optional unmark)
10638 "Mark articles under current thread as read.
10639 If the prefix argument is positive, remove any kinds of marks.
10640 If the prefix argument is negative, tick articles instead."
10643 (setq unmark (prefix-numeric-value unmark)))
10644 (let ((articles (gnus-summary-articles-in-thread)))
10646 ;; Expand the thread.
10647 (gnus-summary-show-thread)
10648 ;; Mark all the articles.
10650 (gnus-summary-goto-subject (car articles))
10651 (cond ((null unmark)
10652 (gnus-summary-mark-article-as-read gnus-killed-mark))
10654 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10656 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10657 (setq articles (cdr articles))))
10658 ;; Hide killed subtrees.
10660 gnus-thread-hide-killed
10661 (gnus-summary-hide-thread))
10662 ;; If marked as read, go to next unread subject.
10663 (when (null unmark)
10664 ;; Go to next unread subject.
10665 (gnus-summary-next-subject 1 t)))
10666 (gnus-set-mode-line 'summary))
10668 ;; Summary sorting commands
10670 (defun gnus-summary-sort-by-number (&optional reverse)
10671 "Sort the summary buffer by article number.
10672 Argument REVERSE means reverse order."
10674 (gnus-summary-sort 'number reverse))
10676 (defun gnus-summary-sort-by-random (&optional reverse)
10677 "Randomize the order in the summary buffer.
10678 Argument REVERSE means to randomize in reverse order."
10680 (gnus-summary-sort 'random reverse))
10682 (defun gnus-summary-sort-by-author (&optional reverse)
10683 "Sort the summary buffer by author name alphabetically.
10684 If `case-fold-search' is non-nil, case of letters is ignored.
10685 Argument REVERSE means reverse order."
10687 (gnus-summary-sort 'author reverse))
10689 (defun gnus-summary-sort-by-subject (&optional reverse)
10690 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10691 If `case-fold-search' is non-nil, case of letters is ignored.
10692 Argument REVERSE means reverse order."
10694 (gnus-summary-sort 'subject reverse))
10696 (defun gnus-summary-sort-by-date (&optional reverse)
10697 "Sort the summary buffer by date.
10698 Argument REVERSE means reverse order."
10700 (gnus-summary-sort 'date reverse))
10702 (defun gnus-summary-sort-by-score (&optional reverse)
10703 "Sort the summary buffer by score.
10704 Argument REVERSE means reverse order."
10706 (gnus-summary-sort 'score reverse))
10708 (defun gnus-summary-sort-by-lines (&optional reverse)
10709 "Sort the summary buffer by the number of lines.
10710 Argument REVERSE means reverse order."
10712 (gnus-summary-sort 'lines reverse))
10714 (defun gnus-summary-sort-by-chars (&optional reverse)
10715 "Sort the summary buffer by article length.
10716 Argument REVERSE means reverse order."
10718 (gnus-summary-sort 'chars reverse))
10720 (defun gnus-summary-sort-by-original (&optional reverse)
10721 "Sort the summary buffer using the default sorting method.
10722 Argument REVERSE means reverse order."
10724 (let* ((buffer-read-only)
10725 (gnus-summary-prepare-hook nil))
10726 ;; We do the sorting by regenerating the threads.
10727 (gnus-summary-prepare)
10728 ;; Hide subthreads if needed.
10729 (gnus-summary-maybe-hide-threads)))
10731 (defun gnus-summary-sort (predicate reverse)
10732 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10733 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10734 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10735 (gnus-thread-sort-functions
10740 (gnus-sort-gathered-threads-function
10741 gnus-thread-sort-functions)
10742 (gnus-article-sort-functions
10746 (,article t2 t1))))
10748 (gnus-summary-prepare-hook nil))
10749 ;; We do the sorting by regenerating the threads.
10750 (gnus-summary-prepare)
10751 ;; Hide subthreads if needed.
10752 (gnus-summary-maybe-hide-threads)))
10754 ;; Summary saving commands.
10756 (defun gnus-summary-save-article (&optional n not-saved)
10757 "Save the current article using the default saver function.
10758 If N is a positive number, save the N next articles.
10759 If N is a negative number, save the N previous articles.
10760 If N is nil and any articles have been marked with the process mark,
10761 save those articles instead.
10762 The variable `gnus-default-article-saver' specifies the saver function."
10764 (let* ((articles (gnus-summary-work-articles n))
10765 (save-buffer (save-excursion
10766 (nnheader-set-temp-buffer " *Gnus Save*")))
10767 (num (length articles))
10769 (dolist (article articles)
10770 (setq header (gnus-summary-article-header article))
10771 (if (not (vectorp header))
10772 ;; This is a pseudo-article.
10773 (if (assq 'name header)
10774 (gnus-copy-file (cdr (assq 'name header)))
10775 (gnus-message 1 "Article %d is unsaveable" article))
10776 ;; This is a real article.
10777 (save-window-excursion
10778 (let ((gnus-display-mime-function nil)
10779 (gnus-article-prepare-hook nil))
10780 (gnus-summary-select-article t nil nil article)))
10782 (set-buffer save-buffer)
10784 (insert-buffer-substring gnus-original-article-buffer))
10785 (setq file (gnus-article-save save-buffer file num))
10786 (gnus-summary-remove-process-mark article)
10788 (gnus-summary-set-saved-mark article))))
10789 (gnus-kill-buffer save-buffer)
10790 (gnus-summary-position-point)
10791 (gnus-set-mode-line 'summary)
10794 (defun gnus-summary-pipe-output (&optional arg headers)
10795 "Pipe the current article to a subprocess.
10796 If N is a positive number, pipe the N next articles.
10797 If N is a negative number, pipe the N previous articles.
10798 If N is nil and any articles have been marked with the process mark,
10799 pipe those articles instead.
10800 If HEADERS (the symbolic prefix), include the headers, too."
10801 (interactive (gnus-interactive "P\ny"))
10802 (require 'gnus-art)
10803 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10804 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10805 (gnus-summary-save-article arg t))
10806 (let ((buffer (get-buffer "*Shell Command Output*")))
10808 (not (zerop (buffer-size buffer))))
10809 (gnus-configure-windows 'pipe))))
10811 (defun gnus-summary-save-article-mail (&optional arg)
10812 "Append the current article to an mail file.
10813 If N is a positive number, save the N next articles.
10814 If N is a negative number, save the N previous articles.
10815 If N is nil and any articles have been marked with the process mark,
10816 save those articles instead."
10818 (require 'gnus-art)
10819 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10820 (gnus-summary-save-article arg)))
10822 (defun gnus-summary-save-article-rmail (&optional arg)
10823 "Append the current article to an rmail file.
10824 If N is a positive number, save the N next articles.
10825 If N is a negative number, save the N previous articles.
10826 If N is nil and any articles have been marked with the process mark,
10827 save those articles instead."
10829 (require 'gnus-art)
10830 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10831 (gnus-summary-save-article arg)))
10833 (defun gnus-summary-save-article-file (&optional arg)
10834 "Append the current article to a file.
10835 If N is a positive number, save the N next articles.
10836 If N is a negative number, save the N previous articles.
10837 If N is nil and any articles have been marked with the process mark,
10838 save those articles instead."
10840 (require 'gnus-art)
10841 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10842 (gnus-summary-save-article arg)))
10844 (defun gnus-summary-write-article-file (&optional arg)
10845 "Write the current article to a file, deleting the previous file.
10846 If N is a positive number, save the N next articles.
10847 If N is a negative number, save the N previous articles.
10848 If N is nil and any articles have been marked with the process mark,
10849 save those articles instead."
10851 (require 'gnus-art)
10852 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10853 (gnus-summary-save-article arg)))
10855 (defun gnus-summary-save-article-body-file (&optional arg)
10856 "Append the current article body to a file.
10857 If N is a positive number, save the N next articles.
10858 If N is a negative number, save the N previous articles.
10859 If N is nil and any articles have been marked with the process mark,
10860 save those articles instead."
10862 (require 'gnus-art)
10863 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10864 (gnus-summary-save-article arg)))
10866 (defun gnus-summary-muttprint (&optional arg)
10867 "Print the current article using Muttprint.
10868 If N is a positive number, save the N next articles.
10869 If N is a negative number, save the N previous articles.
10870 If N is nil and any articles have been marked with the process mark,
10871 save those articles instead."
10873 (require 'gnus-art)
10874 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10875 (gnus-summary-save-article arg t)))
10877 (defun gnus-summary-pipe-message (program)
10878 "Pipe the current article through PROGRAM."
10879 (interactive "sProgram: ")
10880 (gnus-summary-select-article)
10881 (let ((mail-header-separator ""))
10882 (gnus-eval-in-buffer-window gnus-article-buffer
10885 (let ((start (window-start))
10887 (message-pipe-buffer-body program)
10888 (set-window-start (get-buffer-window (current-buffer)) start))))))
10890 (defun gnus-get-split-value (methods)
10891 "Return a value based on the split METHODS."
10892 (let (split-name method result match)
10895 (set-buffer gnus-original-article-buffer)
10897 (nnheader-narrow-to-headers)
10898 (while (and methods (not split-name))
10899 (goto-char (point-min))
10900 (setq method (pop methods))
10901 (setq match (car method))
10904 ;; Regular expression.
10906 (re-search-forward match nil t)))
10911 (setq result (funcall match gnus-newsgroup-name))))
10916 (setq result (eval match)))))
10917 (setq split-name (cdr method))
10918 (cond ((stringp result)
10919 (push (expand-file-name
10920 result gnus-article-save-directory)
10923 (setq split-name (append result split-name)))))))))
10924 (nreverse split-name)))
10926 (defun gnus-valid-move-group-p (group)
10927 (and (boundp group)
10928 (symbol-name group)
10929 (symbol-value group)
10930 (gnus-get-function (gnus-find-method-for-group
10931 (symbol-name group)) 'request-accept-article t)))
10933 (defun gnus-read-move-group-name (prompt default articles prefix)
10934 "Read a group name."
10935 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10936 (minibuffer-confirm-incomplete nil) ; XEmacs
10938 (format "%s %s to:"
10940 (if (> (length articles) 1)
10941 (format "these %d articles" (length articles))
10946 (gnus-completing-read-with-default
10949 'gnus-valid-move-group-p
10951 'gnus-group-history))
10952 ((= 1 (length split-name))
10953 (gnus-completing-read-with-default
10954 (car split-name) prom
10956 'gnus-valid-move-group-p
10958 'gnus-group-history))
10960 (gnus-completing-read-with-default
10962 (mapcar (lambda (el) (list el))
10963 (nreverse split-name))
10965 'gnus-group-history))))
10966 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10968 (if (or (string= to-newsgroup "")
10969 (string= to-newsgroup prefix))
10970 (setq to-newsgroup default))
10971 (unless to-newsgroup
10972 (error "No group name entered"))
10973 (or (gnus-active to-newsgroup)
10974 (gnus-activate-group to-newsgroup nil nil to-method)
10975 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10977 (or (and (gnus-request-create-group to-newsgroup to-method)
10978 (gnus-activate-group
10979 to-newsgroup nil nil to-method)
10980 (gnus-subscribe-group to-newsgroup))
10981 (error "Couldn't create group %s" to-newsgroup)))
10982 (error "No such group: %s" to-newsgroup)))
10985 (defun gnus-summary-save-parts (type dir n &optional reverse)
10986 "Save parts matching TYPE to DIR.
10987 If REVERSE, save parts that do not match TYPE."
10989 (list (read-string "Save parts of type: "
10990 (or (car gnus-summary-save-parts-type-history)
10991 gnus-summary-save-parts-default-mime)
10992 'gnus-summary-save-parts-type-history)
10993 (setq gnus-summary-save-parts-last-directory
10994 (read-file-name "Save to directory: "
10995 gnus-summary-save-parts-last-directory
10997 current-prefix-arg))
10998 (gnus-summary-iterate n
10999 (let ((gnus-display-mime-function nil)
11000 (gnus-inhibit-treatment t))
11001 (gnus-summary-select-article))
11003 (set-buffer gnus-article-buffer)
11004 (let ((handles (or gnus-article-mime-handles
11005 (mm-dissect-buffer nil gnus-article-loose-mime)
11006 (and gnus-article-emulate-mime
11007 (mm-uu-dissect)))))
11009 (gnus-summary-save-parts-1 type dir handles reverse)
11010 (unless gnus-article-mime-handles ;; Don't destroy this case.
11011 (mm-destroy-parts handles)))))))
11013 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11014 (if (stringp (car handle))
11015 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11018 (not (string-match type (mm-handle-media-type handle)))
11019 (string-match type (mm-handle-media-type handle)))
11020 (let ((file (expand-file-name
11022 mm-file-name-rewrite-functions
11023 (file-name-nondirectory
11025 (mail-content-type-get
11026 (mm-handle-disposition handle) 'filename)
11027 (mail-content-type-get
11028 (mm-handle-type handle) 'name)
11029 (concat gnus-newsgroup-name
11030 "." (number-to-string
11031 (cdr gnus-article-current))))))
11033 (unless (file-exists-p file)
11034 (mm-save-part-to-file handle file))))))
11036 ;; Summary extract commands
11038 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11039 (let ((buffer-read-only nil)
11040 (article (gnus-summary-article-number))
11042 (unless (gnus-summary-goto-subject article)
11043 (error "No such article: %d" article))
11044 (gnus-summary-position-point)
11045 ;; If all commands are to be bunched up on one line, we collect
11047 (unless gnus-view-pseudos-separately
11048 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11051 (setq action (cdr (assq 'action (car ps))))
11052 (setq files (list (cdr (assq 'name (car ps)))))
11053 (while (and ps (cdr ps)
11054 (string= (or action "1")
11055 (or (cdr (assq 'action (cadr ps))) "2")))
11056 (push (cdr (assq 'name (cadr ps))) files)
11057 (setcdr ps (cddr ps)))
11059 (when (not (string-match "%s" action))
11062 (when (assq 'execute (car ps))
11063 (setcdr (assq 'execute (car ps))
11064 (funcall (if (string-match "%s" action)
11071 (shell-quote-argument f)))
11073 (setq ps (cdr ps)))))
11074 (if (and gnus-view-pseudos (not not-view))
11076 (when (assq 'execute (car pslist))
11077 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11078 (eq gnus-view-pseudos 'not-confirm)))
11079 (setq pslist (cdr pslist)))
11082 (setq after-article (or (cdr (assq 'article (car pslist)))
11083 (gnus-summary-article-number)))
11084 (gnus-summary-goto-subject after-article)
11087 (insert " " (file-name-nondirectory
11088 (cdr (assq 'name (car pslist))))
11089 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11091 (forward-line -1) ; back to `b'
11092 (gnus-add-text-properties
11093 b (1- e) (list 'gnus-number gnus-reffed-article-number
11094 gnus-mouse-face-prop gnus-mouse-face))
11096 after-article gnus-reffed-article-number
11097 gnus-unread-mark b (car pslist) 0 (- e b))
11098 (setq gnus-newsgroup-unreads
11099 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11100 gnus-reffed-article-number))
11101 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11102 (setq pslist (cdr pslist)))))))
11104 (defun gnus-pseudos< (p1 p2)
11105 (let ((c1 (cdr (assq 'action p1)))
11106 (c2 (cdr (assq 'action p2))))
11107 (and c1 c2 (string< c1 c2))))
11109 (defun gnus-request-pseudo-article (props)
11110 (cond ((assq 'execute props)
11111 (gnus-execute-command (cdr (assq 'execute props)))))
11112 (let ((gnus-current-article (gnus-summary-article-number)))
11113 (gnus-run-hooks 'gnus-mark-article-hook)))
11115 (defun gnus-execute-command (command &optional automatic)
11117 (gnus-article-setup-buffer)
11118 (set-buffer gnus-article-buffer)
11119 (setq buffer-read-only nil)
11120 (let ((command (if automatic command
11121 (read-string "Command: " (cons command 0)))))
11123 (insert "$ " command "\n\n")
11124 (if gnus-view-pseudo-asynchronously
11125 (start-process "gnus-execute" (current-buffer) shell-file-name
11126 shell-command-switch command)
11127 (call-process shell-file-name nil t nil
11128 shell-command-switch command)))))
11130 ;; Summary kill commands.
11132 (defun gnus-summary-edit-global-kill (article)
11133 "Edit the \"global\" kill file."
11134 (interactive (list (gnus-summary-article-number)))
11135 (gnus-group-edit-global-kill article))
11137 (defun gnus-summary-edit-local-kill ()
11138 "Edit a local kill file applied to the current newsgroup."
11140 (setq gnus-current-headers (gnus-summary-article-header))
11141 (gnus-group-edit-local-kill
11142 (gnus-summary-article-number) gnus-newsgroup-name))
11144 ;;; Header reading.
11146 (defun gnus-read-header (id &optional header)
11147 "Read the headers of article ID and enter them into the Gnus system."
11148 (let ((group gnus-newsgroup-name)
11149 (gnus-override-method
11151 gnus-override-method
11152 (and (gnus-news-group-p gnus-newsgroup-name)
11153 (car (gnus-refer-article-methods)))))
11155 ;; First we check to see whether the header in question is already
11158 ;; This is a Message-ID.
11159 (setq header (or header (gnus-id-to-header id)))
11160 ;; This is an article number.
11161 (setq header (or header (gnus-summary-article-header id))))
11163 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11164 ;; We have found the header.
11166 ;; If this is a sparse article, we have to nix out its
11167 ;; previous entry in the thread hashtb.
11169 (gnus-summary-article-sparse-p (mail-header-number header)))
11170 (let* ((parent (gnus-parent-id (mail-header-references header)))
11171 (thread (and parent (gnus-id-to-thread parent))))
11173 (delq (assq header thread) thread))))
11174 ;; We have to really fetch the header to this article.
11176 (set-buffer nntp-server-buffer)
11177 (when (setq where (gnus-request-head id group))
11178 (nnheader-fold-continuation-lines)
11179 (goto-char (point-max))
11181 (goto-char (point-min))
11185 ((cdr where) (cdr where))
11186 (header (mail-header-number header))
11187 (t gnus-reffed-article-number))
11189 (insert " Article retrieved.\n"))
11190 (if (or (not where)
11191 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11192 () ; Malformed head.
11193 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11194 (when (and (stringp id)
11195 (not (string= (gnus-group-real-name group)
11197 ;; If we fetched by Message-ID and the article came
11198 ;; from a different group, we fudge some bogus article
11199 ;; numbers for this article.
11200 (mail-header-set-number header gnus-reffed-article-number))
11202 (set-buffer gnus-summary-buffer)
11203 (decf gnus-reffed-article-number)
11204 (gnus-remove-header (mail-header-number header))
11205 (push header gnus-newsgroup-headers)
11206 (setq gnus-current-headers header)
11207 (push (mail-header-number header) gnus-newsgroup-limit)))
11210 (defun gnus-remove-header (number)
11211 "Remove header NUMBER from `gnus-newsgroup-headers'."
11212 (if (and gnus-newsgroup-headers
11213 (= number (mail-header-number (car gnus-newsgroup-headers))))
11214 (pop gnus-newsgroup-headers)
11215 (let ((headers gnus-newsgroup-headers))
11216 (while (and (cdr headers)
11217 (not (= number (mail-header-number (cadr headers)))))
11219 (when (cdr headers)
11220 (setcdr headers (cddr headers))))))
11223 ;;; summary highlights
11226 (defun gnus-highlight-selected-summary ()
11227 "Highlight selected article in summary buffer."
11228 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11229 (when gnus-summary-selected-face
11231 (let* ((beg (point-at-bol))
11232 (end (point-at-eol))
11233 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11234 (from (if (get-text-property beg gnus-mouse-face-prop)
11236 (or (next-single-property-change
11237 beg gnus-mouse-face-prop nil end)
11242 (or (next-single-property-change
11243 from gnus-mouse-face-prop nil end)
11245 ;; If no mouse-face prop on line we will have to = from = end,
11246 ;; so we highlight the entire line instead.
11247 (when (= (+ to 2) from)
11250 (if gnus-newsgroup-selected-overlay
11251 ;; Move old overlay.
11253 gnus-newsgroup-selected-overlay from to (current-buffer))
11254 ;; Create new overlay.
11256 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11257 'face gnus-summary-selected-face))))))
11259 (defvar gnus-summary-highlight-line-cached nil)
11260 (defvar gnus-summary-highlight-line-trigger nil)
11262 (defun gnus-summary-highlight-line-0 ()
11263 (if (and (eq gnus-summary-highlight-line-trigger
11264 gnus-summary-highlight)
11265 gnus-summary-highlight-line-cached)
11266 gnus-summary-highlight-line-cached
11267 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11268 gnus-summary-highlight-line-cached
11269 (let* ((cond (list 'cond))
11271 (list gnus-summary-highlight))
11273 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11277 (gnus-byte-compile (list 'lambda nil cond))))))
11279 (defun gnus-summary-highlight-line ()
11280 "Highlight current line according to `gnus-summary-highlight'."
11281 (let* ((beg (point-at-bol))
11282 (article (or (gnus-summary-article-number) gnus-current-article))
11283 (score (or (cdr (assq article
11284 gnus-newsgroup-scored))
11285 gnus-summary-default-score 0))
11286 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11287 (inhibit-read-only t)
11288 (default gnus-summary-default-score)
11289 (default-high gnus-summary-default-high-score)
11290 (default-low gnus-summary-default-low-score)
11291 (uncached (and gnus-summary-use-undownloaded-faces
11292 (memq article gnus-newsgroup-undownloaded))))
11293 (let ((face (funcall (gnus-summary-highlight-line-0))))
11294 (unless (eq face (get-text-property beg 'face))
11295 (gnus-put-text-property-excluding-characters-with-faces
11296 beg (point-at-eol) 'face
11297 (setq face (if (boundp face) (symbol-value face) face)))
11298 (when gnus-summary-highlight-line-function
11299 (funcall gnus-summary-highlight-line-function article face))))))
11301 (defun gnus-update-read-articles (group unread &optional compute)
11302 "Update the list of read articles in GROUP.
11303 UNREAD is a sorted list."
11304 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
11305 (entry (gnus-gethash group gnus-newsrc-hashtb))
11306 (info (nth 2 entry))
11309 (if (or (not info) (not active))
11310 ;; There is no info on this group if it was, in fact,
11311 ;; killed. Gnus stores no information on killed groups, so
11312 ;; there's nothing to be done.
11313 ;; One could store the information somewhere temporarily,
11314 ;; perhaps... Hmmm...
11316 ;; Remove any negative articles numbers.
11317 (while (and unread (< (car unread) 0))
11318 (setq unread (cdr unread)))
11319 ;; Remove any expired article numbers
11320 (while (and unread (< (car unread) (car active)))
11321 (setq unread (cdr unread)))
11322 ;; Compute the ranges of read articles by looking at the list of
11323 ;; unread articles.
11325 (when (/= (car unread) prev)
11326 (push (if (= prev (1- (car unread))) prev
11327 (cons prev (1- (car unread))))
11329 (setq prev (1+ (car unread)))
11330 (setq unread (cdr unread)))
11331 (when (<= prev (cdr active))
11332 (push (cons prev (cdr active)) read))
11333 (setq read (if (> (length read) 1) (nreverse read) read))
11338 ;; Propagate the read marks to the backend.
11339 (when (gnus-check-backend-function 'request-set-mark group)
11340 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11341 (add (gnus-remove-from-range read (gnus-info-read info))))
11343 (unless (gnus-check-group group)
11344 (error "Can't open server for %s" group))
11345 (gnus-request-set-mark
11346 group (delq nil (list (if add (list add 'add '(read)))
11347 (if del (list del 'del '(read))))))
11349 `(gnus-request-set-mark
11352 (if del (list del 'add '(read)))
11353 (if add (list add 'del '(read))))))))))
11354 (set-buffer gnus-group-buffer)
11355 (gnus-undo-register
11357 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11358 (gnus-info-set-read ',info ',(gnus-info-read info))
11359 (gnus-get-unread-articles-in-group ',info
11360 (gnus-active ,group))
11361 (gnus-group-update-group ,group t)
11363 ;; Enter this list into the group info.
11364 (gnus-info-set-read info read)
11365 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11366 (gnus-get-unread-articles-in-group info (gnus-active group))
11369 (defun gnus-offer-save-summaries ()
11370 "Offer to save all active summary buffers."
11372 ;; Go through all buffers and find all summaries.
11373 (dolist (buffer (buffer-list))
11374 (when (and (setq buffer (buffer-name buffer))
11375 (string-match "Summary" buffer)
11377 (set-buffer buffer)
11378 ;; We check that this is, indeed, a summary buffer.
11379 (and (eq major-mode 'gnus-summary-mode)
11380 ;; Also make sure this isn't bogus.
11381 gnus-newsgroup-prepared
11382 ;; Also make sure that this isn't a
11383 ;; dead summary buffer.
11384 (not gnus-dead-summary-mode))))
11385 (push buffer buffers)))
11386 ;; Go through all these summary buffers and offer to save them.
11390 "Update summary buffer %s? "
11392 (switch-to-buffer buf)
11393 (gnus-summary-exit))
11396 (defun gnus-summary-setup-default-charset ()
11397 "Setup newsgroup default charset."
11398 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11399 (setq gnus-newsgroup-charset nil)
11400 (let* ((ignored-charsets
11401 (or gnus-newsgroup-ephemeral-ignored-charsets
11403 (and gnus-newsgroup-name
11404 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11405 gnus-newsgroup-ignored-charsets))))
11406 (setq gnus-newsgroup-charset
11407 (or gnus-newsgroup-ephemeral-charset
11408 (and gnus-newsgroup-name
11409 (gnus-parameter-charset gnus-newsgroup-name))
11410 gnus-default-charset))
11411 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11412 ignored-charsets))))
11418 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11419 "Display the current article buffer fully MIME-buttonized.
11420 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11421 treated as multipart/mixed."
11423 (require 'gnus-art)
11424 (let ((gnus-unbuttonized-mime-types nil)
11425 (gnus-mime-display-multipart-as-mixed show-all-parts))
11426 (gnus-summary-show-article)))
11428 (defun gnus-summary-repair-multipart (article)
11429 "Add a Content-Type header to a multipart article without one."
11430 (interactive (list (gnus-summary-article-number)))
11431 (gnus-with-article article
11432 (message-narrow-to-head)
11433 (message-remove-header "Mime-Version")
11434 (goto-char (point-max))
11435 (insert "Mime-Version: 1.0\n")
11437 (when (search-forward "\n--" nil t)
11438 (let ((separator (buffer-substring (point) (point-at-eol))))
11439 (message-narrow-to-head)
11440 (message-remove-header "Content-Type")
11441 (goto-char (point-max))
11442 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11445 (let (gnus-mark-article-hook)
11446 (gnus-summary-select-article t t nil article)))
11448 (defun gnus-summary-toggle-display-buttonized ()
11449 "Toggle the buttonizing of the article buffer."
11451 (require 'gnus-art)
11452 (if (setq gnus-inhibit-mime-unbuttonizing
11453 (not gnus-inhibit-mime-unbuttonizing))
11454 (let ((gnus-unbuttonized-mime-types nil))
11455 (gnus-summary-show-article))
11456 (gnus-summary-show-article)))
11459 ;;; Generic summary marking commands
11462 (defvar gnus-summary-marking-alist
11463 '((read gnus-del-mark "d")
11464 (unread gnus-unread-mark "u")
11465 (ticked gnus-ticked-mark "!")
11466 (dormant gnus-dormant-mark "?")
11467 (expirable gnus-expirable-mark "e"))
11468 "An alist of names/marks/keystrokes.")
11470 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11471 (defvar gnus-summary-mark-map)
11473 (defun gnus-summary-make-all-marking-commands ()
11474 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11475 (dolist (elem gnus-summary-marking-alist)
11476 (apply 'gnus-summary-make-marking-command elem)))
11478 (defun gnus-summary-make-marking-command (name mark keystroke)
11479 (let ((map (make-sparse-keymap)))
11480 (define-key gnus-summary-generic-mark-map keystroke map)
11481 (dolist (lway `((next "next" next nil "n")
11482 (next-unread "next unread" next t "N")
11483 (prev "previous" prev nil "p")
11484 (prev-unread "previous unread" prev t "P")
11485 (nomove "" nil nil ,keystroke)))
11486 (let ((func (gnus-summary-make-marking-command-1
11487 mark (car lway) lway name)))
11488 (setq func (eval func))
11489 (define-key map (nth 4 lway) func)))))
11491 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11493 (format "gnus-summary-put-mark-as-%s%s"
11494 name (if (eq way 'nomove)
11496 (concat "-" (symbol-name way)))))
11499 "Mark the current article as %s%s.
11500 If N, the prefix, then repeat N times.
11501 If N is negative, move in reverse order.
11502 The difference between N and the actual number of articles marked is
11506 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11508 (defun gnus-summary-generic-mark (n mark move unread)
11509 "Mark N articles with MARK."
11510 (unless (eq major-mode 'gnus-summary-mode)
11511 (error "This command can only be used in the summary buffer"))
11512 (gnus-summary-show-thread)
11515 ((eq move 'next) 1)
11516 ((eq move 'prev) -1)
11518 (if (zerop nummove)
11522 nummove (* -1 nummove))))
11523 (while (and (> n 0)
11524 (gnus-summary-mark-article nil mark)
11525 (zerop (gnus-summary-next-subject nummove unread t)))
11528 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11529 (gnus-summary-recenter)
11530 (gnus-summary-position-point)
11531 (gnus-set-mode-line 'summary)
11534 (defun gnus-summary-insert-articles (articles)
11535 (when (setq articles
11536 (gnus-sorted-difference articles
11537 (mapcar (lambda (h)
11538 (mail-header-number h))
11539 gnus-newsgroup-headers)))
11540 (setq gnus-newsgroup-headers
11542 gnus-newsgroup-headers
11543 (gnus-fetch-headers articles)
11544 'gnus-article-sort-by-number))
11545 ;; Suppress duplicates?
11546 (when gnus-suppress-duplicates
11547 (gnus-dup-suppress-articles))
11549 ;; We might want to build some more threads first.
11550 (when (and gnus-fetch-old-headers
11551 (eq gnus-headers-retrieved-by 'nov))
11552 (if (eq gnus-fetch-old-headers 'invisible)
11553 (gnus-build-all-threads)
11554 (gnus-build-old-threads)))
11555 ;; Let the Gnus agent mark articles as read.
11557 (gnus-agent-get-undownloaded-list))
11558 ;; Remove list identifiers from subject
11559 (when gnus-list-identifiers
11560 (gnus-summary-remove-list-identifiers))
11561 ;; First and last article in this newsgroup.
11562 (when gnus-newsgroup-headers
11563 (setq gnus-newsgroup-begin
11564 (mail-header-number (car gnus-newsgroup-headers))
11566 (mail-header-number
11567 (gnus-last-element gnus-newsgroup-headers))))
11568 (when gnus-use-scoring
11569 (gnus-possibly-score-headers))))
11571 (defun gnus-summary-insert-old-articles (&optional all)
11572 "Insert all old articles in this group.
11573 If ALL is non-nil, already read articles become readable.
11574 If ALL is a number, fetch this number of articles."
11577 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11580 ;; Some nntp servers lie about their active range. When
11581 ;; this happens, the active range can be in the millions.
11582 ;; Use a compressed range to avoid creating a huge list.
11583 (gnus-range-difference (list gnus-newsgroup-active) old))
11584 (setq len (gnus-range-length older))
11589 (let ((older-range (nreverse older)))
11593 (let* ((r (pop older-range))
11594 (min (if (numberp r) r (car r)))
11595 (max (if (numberp r) r (cdr r))))
11596 (while (and (<= min max)
11601 (setq older (gnus-uncompress-range older))))
11603 (setq older (gnus-uncompress-range older)))
11605 (when (and (numberp gnus-large-newsgroup)
11606 (> len gnus-large-newsgroup))
11607 (let* ((cursor-in-echo-area nil)
11608 (initial (gnus-parameter-large-newsgroup-initial
11609 gnus-newsgroup-name))
11613 "How many articles from %s (%s %d): "
11615 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11616 (if initial "max" "default")
11619 (cons (number-to-string initial)
11621 (unless (string-match "^[ \t]*$" input)
11622 (setq all (string-to-number input))
11624 (let ((older-range (nreverse older)))
11628 (let* ((r (pop older-range))
11629 (min (if (numberp r) r (car r)))
11630 (max (if (numberp r) r (cdr r))))
11631 (while (and (<= min max)
11635 max (1- max))))))))))
11636 (setq older (gnus-uncompress-range older))))
11638 (message "No old news.")
11639 (gnus-summary-insert-articles older)
11640 (gnus-summary-limit (gnus-sorted-nunion old older))))
11641 (gnus-summary-position-point)))
11643 (defun gnus-summary-insert-new-articles ()
11644 "Insert all new articles in this group."
11647 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11648 (old-active gnus-newsgroup-active)
11649 (nnmail-fetched-sources (list t))
11651 (setq gnus-newsgroup-active
11652 (gnus-activate-group gnus-newsgroup-name 'scan))
11653 (setq i (cdr gnus-newsgroup-active))
11654 (while (> i (cdr old-active))
11658 (message "No gnus is bad news")
11659 (gnus-summary-insert-articles new)
11660 (setq gnus-newsgroup-unreads
11661 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11662 (gnus-summary-limit (gnus-sorted-nunion old new))))
11663 (gnus-summary-position-point)))
11665 (gnus-summary-make-all-marking-commands)
11667 (gnus-ems-redefine)
11669 (provide 'gnus-sum)
11671 (run-hooks 'gnus-sum-load-hook)
11673 ;; Local Variables:
11674 ;; coding: iso-8859-1
11677 ;;; gnus-sum.el ends here