1 ;;; gnus-sum.el --- summary mode commands for Semi-gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Katsumi Yamaoka <yamaoka@jpl.org>
8 ;; Keywords: mail, news, MIME
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
31 (eval-when-compile (require 'cl))
32 (eval-when-compile (require 'gnus-clfns))
49 (autoload 'pgg-decrypt-region "pgg" nil t)
50 (autoload 'pgg-verify-region "pgg" nil t))
52 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
53 (autoload 'gnus-cache-write-active "gnus-cache")
54 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
55 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
56 (autoload 'mm-uu-dissect "mm-uu")
57 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
58 "Deuglify broken Outlook (Express) articles and redisplay."
61 (defcustom gnus-kill-summary-on-exit t
62 "*If non-nil, kill the summary buffer when you exit from it.
63 If nil, the summary will become a \"*Dead Summary*\" buffer, and
64 it will be killed sometime later."
65 :group 'gnus-summary-exit
68 (defcustom gnus-fetch-old-headers nil
69 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
70 If an unread article in the group refers to an older, already read (or
71 just marked as read) article, the old article will not normally be
72 displayed in the Summary buffer. If this variable is non-nil, Gnus
73 will attempt to grab the headers to the old articles, and thereby
74 build complete threads. If it has the value `some', only enough
75 headers to connect otherwise loose threads will be displayed. This
76 variable can also be a number. In that case, no more than that number
77 of old headers will be fetched. If it has the value `invisible', all
78 old headers will be fetched, but none will be displayed.
80 The server has to support NOV for any of this to work."
82 :type '(choice (const :tag "off" nil)
85 (sexp :menu-tag "other" t)))
87 (defcustom gnus-refer-thread-limit 200
88 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
89 If t, fetch all the available old headers."
92 (sexp :menu-tag "other" t)))
94 (defcustom gnus-summary-make-false-root 'adopt
95 "*nil means that Gnus won't gather loose threads.
96 If the root of a thread has expired or been read in a previous
97 session, the information necessary to build a complete thread has been
98 lost. Instead of having many small sub-threads from this original thread
99 scattered all over the summary buffer, Gnus can gather them.
101 If non-nil, Gnus will try to gather all loose sub-threads from an
102 original thread into one large thread.
104 If this variable is non-nil, it should be one of `none', `adopt',
107 If this variable is `none', Gnus will not make a false root, but just
108 present the sub-threads after another.
109 If this variable is `dummy', Gnus will create a dummy root that will
110 have all the sub-threads as children.
111 If this variable is `adopt', Gnus will make one of the \"children\"
112 the parent and mark all the step-children as such.
113 If this variable is `empty', the \"children\" are printed with empty
114 subject fields. (Or rather, they will be printed with a string
115 given by the `gnus-summary-same-subject' variable.)"
117 :type '(choice (const :tag "off" nil)
123 (defcustom gnus-summary-make-false-root-always t
124 "Always make a false dummy root."
128 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
129 "*A regexp to match subjects to be excluded from loose thread gathering.
130 As loose thread gathering is done on subjects only, that means that
131 there can be many false gatherings performed. By rooting out certain
132 common subjects, gathering might become saner."
136 (defcustom gnus-summary-gather-subject-limit nil
137 "*Maximum length of subject comparisons when gathering loose threads.
138 Use nil to compare full subjects. Setting this variable to a low
139 number will help gather threads that have been corrupted by
140 newsreaders chopping off subject lines, but it might also mean that
141 unrelated articles that have subject that happen to begin with the
142 same few characters will be incorrectly gathered.
144 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
147 :type '(choice (const :tag "off" nil)
149 (sexp :menu-tag "on" t)))
151 (defcustom gnus-simplify-subject-functions nil
152 "List of functions taking a string argument that simplify subjects.
153 The functions are applied recursively.
155 Useful functions to put in this list include:
156 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
157 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
159 :type '(repeat function))
161 (defcustom gnus-simplify-ignored-prefixes nil
162 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
164 :type '(choice (const :tag "off" nil)
167 (defcustom gnus-build-sparse-threads nil
168 "*If non-nil, fill in the gaps in threads.
169 If `some', only fill in the gaps that are needed to tie loose threads
170 together. If `more', fill in all leaf nodes that Gnus can find. If
171 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
173 :type '(choice (const :tag "off" nil)
176 (sexp :menu-tag "all" t)))
178 (defcustom gnus-summary-thread-gathering-function
179 'gnus-gather-threads-by-subject
180 "*Function used for gathering loose threads.
181 There are two pre-defined functions: `gnus-gather-threads-by-subject',
182 which only takes Subjects into consideration; and
183 `gnus-gather-threads-by-references', which compared the References
184 headers of the articles to find matches."
186 :type '(radio (function-item gnus-gather-threads-by-subject)
187 (function-item gnus-gather-threads-by-references)
188 (function :tag "other")))
190 (defcustom gnus-summary-same-subject ""
191 "*String indicating that the current article has the same subject as the previous.
192 This variable will only be used if the value of
193 `gnus-summary-make-false-root' is `empty'."
194 :group 'gnus-summary-format
197 (defcustom gnus-summary-goto-unread t
198 "*If t, many commands will go to the next unread article.
199 This applies to marking commands as well as other commands that
200 \"naturally\" select the next article, like, for instance, `SPC' at
201 the end of an article.
203 If nil, the marking commands do NOT go to the next unread article
204 \(they go to the next article instead). If `never', commands that
205 usually go to the next unread article, will go to the next article,
206 whether it is read or not."
207 :group 'gnus-summary-marks
208 :link '(custom-manual "(gnus)Setting Marks")
209 :type '(choice (const :tag "off" nil)
211 (sexp :menu-tag "on" t)))
213 (defcustom gnus-summary-default-score 0
214 "*Default article score level.
215 All scores generated by the score files will be added to this score.
216 If this variable is nil, scoring will be disabled."
217 :group 'gnus-score-default
218 :type '(choice (const :tag "disable")
221 (defcustom gnus-summary-default-high-score 0
222 "*Default threshold for a high scored article.
223 An article will be highlighted as high scored if its score is greater
225 :group 'gnus-score-default
228 (defcustom gnus-summary-default-low-score 0
229 "*Default threshold for a low scored article.
230 An article will be highlighted as low scored if its score is smaller
232 :group 'gnus-score-default
235 (defcustom gnus-summary-zcore-fuzz 0
236 "*Fuzziness factor for the zcore in the summary buffer.
237 Articles with scores closer than this to `gnus-summary-default-score'
239 :group 'gnus-summary-format
242 (defcustom gnus-simplify-subject-fuzzy-regexp nil
243 "*Strings to be removed when doing fuzzy matches.
244 This can either be a regular expression or list of regular expressions
245 that will be removed from subject strings if fuzzy subject
246 simplification is selected."
248 :type '(repeat regexp))
250 (defcustom gnus-show-threads t
251 "*If non-nil, display threads in summary mode."
255 (defcustom gnus-thread-hide-subtree nil
256 "*If non-nil, hide all threads initially.
257 This can be a predicate specifier which says which threads to hide.
258 If threads are hidden, you have to run the command
259 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
260 to expose hidden threads."
264 (defcustom gnus-thread-hide-killed t
265 "*If non-nil, hide killed threads automatically."
269 (defcustom gnus-thread-ignore-subject t
270 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
271 If nil, articles that have different subjects from their parents will
272 start separate threads."
276 (defcustom gnus-thread-operation-ignore-subject t
277 "*If non-nil, subjects will be ignored when doing thread commands.
278 This affects commands like `gnus-summary-kill-thread' and
279 `gnus-summary-lower-thread'.
281 If this variable is nil, articles in the same thread with different
282 subjects will not be included in the operation in question. If this
283 variable is `fuzzy', only articles that have subjects that are fuzzily
284 equal will be included."
286 :type '(choice (const :tag "off" nil)
290 (defcustom gnus-thread-indent-level 4
291 "*Number that says how much each sub-thread should be indented."
295 (defcustom gnus-auto-extend-newsgroup t
296 "*If non-nil, extend newsgroup forward and backward when requested."
297 :group 'gnus-summary-choose
300 (defcustom gnus-auto-select-first t
301 "*If non-nil, select the article under point.
302 Which article this is is controlled by the `gnus-auto-select-subject'
305 If you want to prevent automatic selection of articles in some
306 newsgroups, set the variable to nil in `gnus-select-group-hook'."
307 :group 'gnus-group-select
308 :type '(choice (const :tag "none" nil)
309 (sexp :menu-tag "first" t)))
311 (defcustom gnus-auto-select-subject 'unread
312 "*Says what subject to place under point when entering a group.
314 This variable can either be the symbols `first' (place point on the
315 first subject), `unread' (place point on the subject line of the first
316 unread article), `best' (place point on the subject line of the
317 higest-scored article), `unseen' (place point on the subject line of
318 the first unseen article), 'unseen-or-unread' (place point on the subject
319 line of the first unseen article or, if all article have been seen, on the
320 subject line of the first unread article), or a function to be called to
321 place point on some subject line."
322 :group 'gnus-group-select
323 :type '(choice (const best)
327 (const unseen-or-unread)))
329 (defcustom gnus-dont-select-after-jump-to-other-group nil
330 "If non-nil, don't select the first unread article after entering the
331 other group by the command `gnus-summary-jump-to-other-group'. If nil,
332 it is depend on the value of `gnus-auto-select-first' whether to select
334 :group 'gnus-group-select
337 (defcustom gnus-auto-select-next t
338 "*If non-nil, offer to go to the next group from the end of the previous.
339 If the value is t and the next newsgroup is empty, Gnus will exit
340 summary mode and go back to group mode. If the value is neither nil
341 nor t, Gnus will select the following unread newsgroup. In
342 particular, if the value is the symbol `quietly', the next unread
343 newsgroup will be selected without any confirmation, and if it is
344 `almost-quietly', the next group will be selected without any
345 confirmation if you are located on the last article in the group.
346 Finally, if this variable is `slightly-quietly', the `Z n' command
347 will go to the next group without confirmation."
348 :group 'gnus-summary-maneuvering
349 :type '(choice (const :tag "off" nil)
351 (const almost-quietly)
352 (const slightly-quietly)
353 (sexp :menu-tag "on" t)))
355 (defcustom gnus-auto-select-same nil
356 "*If non-nil, select the next article with the same subject.
357 If there are no more articles with the same subject, go to
358 the first unread article."
359 :group 'gnus-summary-maneuvering
362 (defcustom gnus-summary-check-current nil
363 "*If non-nil, consider the current article when moving.
364 The \"unread\" movement commands will stay on the same line if the
365 current article is unread."
366 :group 'gnus-summary-maneuvering
369 (defcustom gnus-auto-center-summary t
370 "*If non-nil, always center the current summary buffer.
371 In particular, if `vertical' do only vertical recentering. If non-nil
372 and non-`vertical', do both horizontal and vertical recentering."
373 :group 'gnus-summary-maneuvering
374 :type '(choice (const :tag "none" nil)
376 (integer :tag "height")
377 (sexp :menu-tag "both" t)))
379 (defcustom gnus-show-all-headers nil
380 "*If non-nil, don't hide any headers."
381 :group 'gnus-article-hiding
382 :group 'gnus-article-headers
385 (defcustom gnus-summary-ignore-duplicates nil
386 "*If non-nil, ignore articles with identical Message-ID headers."
390 (defcustom gnus-single-article-buffer t
391 "*If non-nil, display all articles in the same buffer.
392 If nil, each group will get its own article buffer."
393 :group 'gnus-article-various
396 (defcustom gnus-break-pages t
397 "*If non-nil, do page breaking on articles.
398 The page delimiter is specified by the `gnus-page-delimiter'
400 :group 'gnus-article-various
403 (defcustom gnus-show-mime t
404 "*If non-nil, do mime processing of articles.
405 The articles will simply be fed to the function given by
406 `gnus-article-display-method-for-mime'."
407 :group 'gnus-article-mime
410 (defcustom gnus-move-split-methods nil
411 "*Variable used to suggest where articles are to be moved to.
412 It uses the same syntax as the `gnus-split-methods' variable.
413 However, whereas `gnus-split-methods' specifies file names as targets,
414 this variable specifies group names."
415 :group 'gnus-summary-mail
416 :type '(repeat (choice (list :value (fun) function)
417 (cons :value ("" "") regexp (repeat string))
420 (defcustom gnus-unread-mark ?\ ;;;Whitespace
421 "*Mark used for unread articles."
422 :group 'gnus-summary-marks
425 (defcustom gnus-ticked-mark ?!
426 "*Mark used for ticked articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-dormant-mark ??
431 "*Mark used for dormant articles."
432 :group 'gnus-summary-marks
435 (defcustom gnus-del-mark ?r
436 "*Mark used for del'd articles."
437 :group 'gnus-summary-marks
440 (defcustom gnus-read-mark ?R
441 "*Mark used for read articles."
442 :group 'gnus-summary-marks
445 (defcustom gnus-expirable-mark ?E
446 "*Mark used for expirable articles."
447 :group 'gnus-summary-marks
450 (defcustom gnus-killed-mark ?K
451 "*Mark used for killed articles."
452 :group 'gnus-summary-marks
455 (defcustom gnus-spam-mark ?H
456 "*Mark used for spam articles."
457 :group 'gnus-summary-marks
460 (defcustom gnus-souped-mark ?F
461 "*Mark used for souped articles."
462 :group 'gnus-summary-marks
465 (defcustom gnus-kill-file-mark ?X
466 "*Mark used for articles killed by kill files."
467 :group 'gnus-summary-marks
470 (defcustom gnus-low-score-mark ?Y
471 "*Mark used for articles with a low score."
472 :group 'gnus-summary-marks
475 (defcustom gnus-catchup-mark ?C
476 "*Mark used for articles that are caught up."
477 :group 'gnus-summary-marks
480 (defcustom gnus-replied-mark ?A
481 "*Mark used for articles that have been replied to."
482 :group 'gnus-summary-marks
485 (defcustom gnus-forwarded-mark ?F
486 "*Mark used for articles that have been forwarded."
487 :group 'gnus-summary-marks
490 (defcustom gnus-recent-mark ?N
491 "*Mark used for articles that are recent."
492 :group 'gnus-summary-marks
495 (defcustom gnus-cached-mark ?*
496 "*Mark used for articles that are in the cache."
497 :group 'gnus-summary-marks
500 (defcustom gnus-saved-mark ?S
501 "*Mark used for articles that have been saved."
502 :group 'gnus-summary-marks
505 (defcustom gnus-unseen-mark ?.
506 "*Mark used for articles that haven't been seen."
507 :group 'gnus-summary-marks
510 (defcustom gnus-no-mark ?\ ;;;Whitespace
511 "*Mark used for articles that have no other secondary mark."
512 :group 'gnus-summary-marks
515 (defcustom gnus-ancient-mark ?O
516 "*Mark used for ancient articles."
517 :group 'gnus-summary-marks
520 (defcustom gnus-sparse-mark ?Q
521 "*Mark used for sparsely reffed articles."
522 :group 'gnus-summary-marks
525 (defcustom gnus-canceled-mark ?G
526 "*Mark used for canceled articles."
527 :group 'gnus-summary-marks
530 (defcustom gnus-duplicate-mark ?M
531 "*Mark used for duplicate articles."
532 :group 'gnus-summary-marks
535 (defcustom gnus-undownloaded-mark ?-
536 "*Mark used for articles that weren't downloaded."
537 :group 'gnus-summary-marks
540 (defcustom gnus-downloaded-mark ?+
541 "*Mark used for articles that were downloaded."
542 :group 'gnus-summary-marks
545 (defcustom gnus-downloadable-mark ?%
546 "*Mark used for articles that are to be downloaded."
547 :group 'gnus-summary-marks
550 (defcustom gnus-unsendable-mark ?=
551 "*Mark used for articles that won't be sent."
552 :group 'gnus-summary-marks
555 (defcustom gnus-score-over-mark ?+
556 "*Score mark used for articles with high scores."
557 :group 'gnus-summary-marks
560 (defcustom gnus-score-below-mark ?-
561 "*Score mark used for articles with low scores."
562 :group 'gnus-summary-marks
565 (defcustom gnus-empty-thread-mark ?\ ;;;Whitespace
566 "*There is no thread under the article."
567 :group 'gnus-summary-marks
570 (defcustom gnus-not-empty-thread-mark ?=
571 "*There is a thread under the article."
572 :group 'gnus-summary-marks
575 (defcustom gnus-view-pseudo-asynchronously nil
576 "*If non-nil, Gnus will view pseudo-articles asynchronously."
577 :group 'gnus-extract-view
580 (defcustom gnus-auto-expirable-marks
581 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
582 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
583 gnus-souped-mark gnus-duplicate-mark)
584 "*The list of marks converted into expiration if a group is auto-expirable."
587 :type '(repeat character))
589 (defcustom gnus-inhibit-user-auto-expire t
590 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
595 (defcustom gnus-view-pseudos nil
596 "*If `automatic', pseudo-articles will be viewed automatically.
597 If `not-confirm', pseudos will be viewed automatically, and the user
598 will not be asked to confirm the command."
599 :group 'gnus-extract-view
600 :type '(choice (const :tag "off" nil)
602 (const not-confirm)))
604 (defcustom gnus-view-pseudos-separately t
605 "*If non-nil, one pseudo-article will be created for each file to be viewed.
606 If nil, all files that use the same viewing command will be given as a
607 list of parameters to that command."
608 :group 'gnus-extract-view
611 (defcustom gnus-insert-pseudo-articles t
612 "*If non-nil, insert pseudo-articles when decoding articles."
613 :group 'gnus-extract-view
616 (defcustom gnus-summary-dummy-line-format
618 "*The format specification for the dummy roots in the summary buffer.
619 It works along the same lines as a normal formatting string,
620 with some simple extensions.
624 General format specifiers can also be used.
625 See `(gnus)Formatting Variables'."
626 :link '(custom-manual "(gnus)Formatting Variables")
627 :group 'gnus-threading
630 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
631 "*The format specification for the summary mode line.
632 It works along the same lines as a normal formatting string,
633 with some simple extensions:
636 %p Unprefixed group name
637 %A Current article number
638 %z Current article score
640 %U Number of unread articles in the group
641 %e Number of unselected articles in the group
642 %Z A string with unread/unselected article counts
643 %g Shortish group name
644 %S Subject of the current article
646 %s Current score file name
647 %d Number of dormant articles
648 %r Number of articles that have been marked as read in this session
649 %E Number of articles expunged by the score files"
650 :group 'gnus-summary-format
653 (defcustom gnus-list-identifiers nil
654 "Regexp that matches list identifiers to be removed from subject.
655 This can also be a list of regexps."
657 :group 'gnus-summary-format
658 :group 'gnus-article-hiding
659 :type '(choice (const :tag "none" nil)
661 (repeat :value (".*") regexp)))
663 (defcustom gnus-summary-mark-below 0
664 "*Mark all articles with a score below this variable as read.
665 This variable is local to each summary buffer and usually set by the
667 :group 'gnus-score-default
670 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
671 "*List of functions used for sorting articles in the summary buffer.
673 Each function takes two articles and returns non-nil if the first
674 article should be sorted before the other. If you use more than one
675 function, the primary sort function should be the last. You should
676 probably always include `gnus-article-sort-by-number' in the list of
677 sorting functions -- preferably first. Also note that sorting by date
678 is often much slower than sorting by number, and the sorting order is
679 very similar. (Sorting by date means sorting by the time the message
680 was sent, sorting by number means sorting by arrival time.)
682 Ready-made functions include `gnus-article-sort-by-number',
683 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
684 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
685 and `gnus-article-sort-by-score'.
687 When threading is turned on, the variable `gnus-thread-sort-functions'
688 controls how articles are sorted."
689 :group 'gnus-summary-sort
690 :type '(repeat (choice (function-item gnus-article-sort-by-number)
691 (function-item gnus-article-sort-by-author)
692 (function-item gnus-article-sort-by-subject)
693 (function-item gnus-article-sort-by-date)
694 (function-item gnus-article-sort-by-score)
695 (function-item gnus-article-sort-by-random)
696 (function :tag "other"))))
698 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
699 "*List of functions used for sorting threads in the summary buffer.
700 By default, threads are sorted by article number.
702 Each function takes two threads and returns non-nil if the first
703 thread should be sorted before the other. If you use more than one
704 function, the primary sort function should be the last. You should
705 probably always include `gnus-thread-sort-by-number' in the list of
706 sorting functions -- preferably first. Also note that sorting by date
707 is often much slower than sorting by number, and the sorting order is
708 very similar. (Sorting by date means sorting by the time the message
709 was sent, sorting by number means sorting by arrival time.)
711 Ready-made functions include `gnus-thread-sort-by-number',
712 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
713 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
714 `gnus-thread-sort-by-most-recent-number',
715 `gnus-thread-sort-by-most-recent-date',
716 `gnus-thread-sort-by-random', and
717 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
719 When threading is turned off, the variable
720 `gnus-article-sort-functions' controls how articles are sorted."
721 :group 'gnus-summary-sort
722 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
723 (function-item gnus-thread-sort-by-author)
724 (function-item gnus-thread-sort-by-subject)
725 (function-item gnus-thread-sort-by-date)
726 (function-item gnus-thread-sort-by-score)
727 (function-item gnus-thread-sort-by-total-score)
728 (function-item gnus-thread-sort-by-random)
729 (function :tag "other"))))
731 (defcustom gnus-thread-score-function '+
732 "*Function used for calculating the total score of a thread.
734 The function is called with the scores of the article and each
735 subthread and should then return the score of the thread.
737 Some functions you can use are `+', `max', or `min'."
738 :group 'gnus-summary-sort
741 (defcustom gnus-summary-expunge-below nil
742 "All articles that have a score less than this variable will be expunged.
743 This variable is local to the summary buffers."
744 :group 'gnus-score-default
745 :type '(choice (const :tag "off" nil)
748 (defcustom gnus-thread-expunge-below nil
749 "All threads that have a total score less than this variable will be expunged.
750 See `gnus-thread-score-function' for en explanation of what a
753 This variable is local to the summary buffers."
754 :group 'gnus-threading
755 :group 'gnus-score-default
756 :type '(choice (const :tag "off" nil)
759 (defcustom gnus-summary-mode-hook nil
760 "*A hook for Gnus summary mode.
761 This hook is run before any variables are set in the summary buffer."
762 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
763 :group 'gnus-summary-various
766 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
767 (when (featurep 'xemacs)
768 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
769 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
770 (add-hook 'gnus-summary-mode-hook
771 'gnus-xmas-switch-horizontal-scrollbar-off))
773 (defcustom gnus-summary-menu-hook nil
774 "*Hook run after the creation of the summary mode menu."
775 :group 'gnus-summary-visual
778 (defcustom gnus-summary-exit-hook nil
779 "*A hook called on exit from the summary buffer.
780 It will be called with point in the group buffer."
781 :group 'gnus-summary-exit
784 (defcustom gnus-summary-prepare-hook nil
785 "*A hook called after the summary buffer has been generated.
786 If you want to modify the summary buffer, you can use this hook."
787 :group 'gnus-summary-various
790 (defcustom gnus-summary-prepared-hook nil
791 "*A hook called as the last thing after the summary buffer has been generated."
792 :group 'gnus-summary-various
795 (defcustom gnus-summary-generate-hook nil
796 "*A hook run just before generating the summary buffer.
797 This hook is commonly used to customize threading variables and the
799 :group 'gnus-summary-various
802 (defcustom gnus-select-group-hook nil
803 "*A hook called when a newsgroup is selected.
805 If you'd like to simplify subjects like the
806 `gnus-summary-next-same-subject' command does, you can use the
809 (add-hook gnus-select-group-hook
811 (mapcar (lambda (header)
812 (mail-header-set-subject
814 (gnus-simplify-subject
815 (mail-header-subject header) 're-only)))
816 gnus-newsgroup-headers)))"
817 :group 'gnus-group-select
820 (defcustom gnus-select-article-hook nil
821 "*A hook called when an article is selected."
822 :group 'gnus-summary-choose
825 (defcustom gnus-visual-mark-article-hook
826 (list 'gnus-highlight-selected-summary)
827 "*Hook run after selecting an article in the summary buffer.
828 It is meant to be used for highlighting the article in some way. It
829 is not run if `gnus-visual' is nil."
830 :group 'gnus-summary-visual
833 (defcustom gnus-parse-headers-hook '(gnus-summary-inherit-default-charset)
834 "*A hook called before parsing the headers."
838 (defcustom gnus-exit-group-hook nil
839 "*A hook called when exiting summary mode.
840 This hook is not called from the non-updating exit commands like `Q'."
844 (defcustom gnus-summary-update-hook
845 (list 'gnus-summary-highlight-line)
846 "*A hook called when a summary line is changed.
847 The hook will not be called if `gnus-visual' is nil.
849 The default function `gnus-summary-highlight-line' will
850 highlight the line according to the `gnus-summary-highlight'
852 :group 'gnus-summary-visual
855 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
856 "*A hook called when an article is selected for the first time.
857 The hook is intended to mark an article as read (or unread)
858 automatically when it is selected."
859 :group 'gnus-summary-choose
862 (defcustom gnus-group-no-more-groups-hook nil
863 "*A hook run when returning to group mode having no more (unread) groups."
864 :group 'gnus-group-select
867 (defcustom gnus-ps-print-hook nil
868 "*A hook run before ps-printing something from Gnus."
872 (defcustom gnus-summary-display-arrow
873 (and (fboundp 'display-graphic-p)
875 "*If non-nil, display an arrow highlighting the current article."
880 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
881 "Face used for highlighting the current article in the summary buffer."
882 :group 'gnus-summary-visual
885 (defvar gnus-tmp-downloaded nil)
887 (defcustom gnus-summary-highlight
888 '(((eq mark gnus-canceled-mark)
889 . gnus-summary-cancelled-face)
890 ((and uncached (> score default-high))
891 . gnus-summary-high-uncached-face)
892 ((and uncached (< score default-low))
893 . gnus-summary-low-uncached-face)
895 . gnus-summary-normal-uncached-face)
896 ((and (> score default-high)
897 (or (eq mark gnus-dormant-mark)
898 (eq mark gnus-ticked-mark)))
899 . gnus-summary-high-ticked-face)
900 ((and (< score default-low)
901 (or (eq mark gnus-dormant-mark)
902 (eq mark gnus-ticked-mark)))
903 . gnus-summary-low-ticked-face)
904 ((or (eq mark gnus-dormant-mark)
905 (eq mark gnus-ticked-mark))
906 . gnus-summary-normal-ticked-face)
907 ((and (> score default-high) (eq mark gnus-ancient-mark))
908 . gnus-summary-high-ancient-face)
909 ((and (< score default-low) (eq mark gnus-ancient-mark))
910 . gnus-summary-low-ancient-face)
911 ((eq mark gnus-ancient-mark)
912 . gnus-summary-normal-ancient-face)
913 ((and (> score default-high) (eq mark gnus-unread-mark))
914 . gnus-summary-high-unread-face)
915 ((and (< score default-low) (eq mark gnus-unread-mark))
916 . gnus-summary-low-unread-face)
917 ((eq mark gnus-unread-mark)
918 . gnus-summary-normal-unread-face)
919 ((> score default-high)
920 . gnus-summary-high-read-face)
921 ((< score default-low)
922 . gnus-summary-low-read-face)
924 . gnus-summary-normal-read-face))
925 "*Controls the highlighting of summary buffer lines.
927 A list of (FORM . FACE) pairs. When deciding how a a particular
928 summary line should be displayed, each form is evaluated. The content
929 of the face field after the first true form is used. You can change
930 how those summary lines are displayed, by editing the face field.
932 You can use the following variables in the FORM field.
934 score: The article's score
935 default: The default article score.
936 default-high: The default score for high scored articles.
937 default-low: The default score for low scored articles.
938 below: The score below which articles are automatically marked as read.
939 mark: The articles mark."
940 :group 'gnus-summary-visual
941 :type '(repeat (cons (sexp :tag "Form" nil)
944 (defcustom gnus-alter-header-function nil
945 "Function called to allow alteration of article header structures.
946 The function is called with one parameter, the article header vector,
947 which it may alter in any way.")
949 (defvar gnus-decode-encoded-word-function
950 (mime-find-field-decoder 'From 'nov)
951 "Variable that says which function should be used to decode a string with encoded words.")
953 (defcustom gnus-extra-headers '(To Newsgroups)
954 "*Extra headers to parse."
957 :type '(repeat symbol))
959 (defcustom gnus-ignored-from-addresses
960 (and user-mail-address (regexp-quote user-mail-address))
961 "*Regexp of From headers that may be suppressed in favor of To headers."
966 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
967 "List of charsets that should be ignored.
968 When these charsets are used in the \"charset\" parameter, the
969 default charset will be used instead."
971 :type '(repeat symbol)
972 :group 'gnus-charset)
974 (gnus-define-group-parameter
978 "Return the ignored charsets of GROUP."
979 :variable gnus-group-ignored-charsets-alist
981 '(("alt\\.chinese\\.text" iso-8859-1))
983 "Alist of regexps (to match group names) and charsets that should be ignored.
984 When these charsets are used in the \"charset\" parameter, the
985 default charset will be used instead."
986 :variable-group gnus-charset
987 :variable-type '(repeat (cons (regexp :tag "Group")
989 :parameter-type '(choice :tag "Ignored charsets"
992 :parameter-document "\
993 List of charsets that should be ignored.
995 When these charsets are used in the \"charset\" parameter, the
996 default charset will be used instead.")
998 (defcustom gnus-group-highlight-words-alist nil
999 "Alist of group regexps and highlight regexps.
1000 This variable uses the same syntax as `gnus-emphasis-alist'."
1002 :type '(repeat (cons (regexp :tag "Group")
1003 (repeat (list (regexp :tag "Highlight regexp")
1004 (number :tag "Group for entire word" 0)
1005 (number :tag "Group for displayed part" 0)
1007 gnus-emphasis-highlight-words)))))
1008 :group 'gnus-summary-visual)
1010 (defcustom gnus-use-wheel nil
1011 "Use Intelli-mouse on summary movement"
1013 :group 'gnus-summary-maneuvering)
1015 (defcustom gnus-wheel-scroll-amount '(5 . 1)
1016 "Amount to scroll messages by spinning the mouse wheel.
1017 This is actually a cons cell, where the first item is the amount to scroll
1018 on a normal wheel event, and the second is the amount to scroll when the
1019 wheel is moved with the shift key depressed."
1020 :type '(cons (integer :tag "Shift") integer)
1021 :group 'gnus-summary-maneuvering)
1023 (defcustom gnus-wheel-edge-resistance 2
1024 "How hard it should be to change the current article
1025 by moving the mouse over the edge of the article window."
1027 :group 'gnus-summary-maneuvering)
1029 (defcustom gnus-summary-show-article-charset-alist
1031 "Alist of number and charset.
1032 The article will be shown with the charset corresponding to the
1034 For example: ((1 . cn-gb-2312) (2 . big5))."
1036 :type '(repeat (cons (number :tag "Argument" 1)
1037 (symbol :tag "Charset")))
1038 :group 'gnus-charset)
1040 (defcustom gnus-preserve-marks t
1041 "Whether marks are preserved when moving, copying and respooling messages."
1044 :group 'gnus-summary-marks)
1046 (defcustom gnus-alter-articles-to-read-function nil
1047 "Function to be called to alter the list of articles to be selected."
1048 :type '(choice (const nil) function)
1049 :group 'gnus-summary)
1051 (defcustom gnus-orphan-score nil
1052 "*All orphans get this score added. Set in the score file."
1053 :group 'gnus-score-default
1054 :type '(choice (const nil)
1057 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1058 "*A regexp to match MIME parts when saving multiple parts of a message
1059 with gnus-summary-save-parts (X m). This regexp will be used by default
1060 when prompting the user for which type of files to save."
1061 :group 'gnus-summary
1064 (defcustom gnus-read-all-available-headers nil
1065 "Whether Gnus should parse all headers made available to it.
1066 This is mostly relevant for slow backends where the user may
1067 wish to widen the summary buffer to include all headers
1068 that were fetched. Say, for nnultimate groups."
1069 :group 'gnus-summary
1070 :type '(choice boolean regexp))
1072 (defcustom gnus-summary-muttprint-program "muttprint"
1073 "Command (and optional arguments) used to run Muttprint."
1075 :group 'gnus-summary
1078 (defcustom gnus-article-loose-mime nil
1079 "If non-nil, don't require MIME-Version header.
1080 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1081 supply the MIME-Version header or deliberately strip it From the mail.
1082 Set it to non-nil, Gnus will treat some articles as MIME even if
1083 the MIME-Version header is missed."
1086 :group 'gnus-article)
1088 ;;; Internal variables
1090 (defvar gnus-summary-display-cache nil)
1091 (defvar gnus-article-mime-handles nil)
1092 (defvar gnus-article-decoded-p nil)
1093 (defvar gnus-article-charset nil)
1094 (defvar gnus-article-ignored-charsets nil)
1095 (defvar gnus-scores-exclude-files nil)
1096 (defvar gnus-page-broken nil)
1098 (defvar gnus-original-article nil)
1099 (defvar gnus-article-internal-prepare-hook nil)
1100 (defvar gnus-newsgroup-process-stack nil)
1102 (defvar gnus-thread-indent-array nil)
1103 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1104 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1105 "Function called to sort the articles within a thread after it has been gathered together.")
1107 (defvar gnus-summary-save-parts-type-history nil)
1108 (defvar gnus-summary-save-parts-last-directory nil)
1110 ;; Avoid highlighting in kill files.
1111 (defvar gnus-summary-inhibit-highlight nil)
1112 (defvar gnus-newsgroup-selected-overlay nil)
1113 (defvar gnus-inhibit-limiting nil)
1114 (defvar gnus-newsgroup-adaptive-score-file nil)
1115 (defvar gnus-current-score-file nil)
1116 (defvar gnus-current-move-group nil)
1117 (defvar gnus-current-copy-group nil)
1118 (defvar gnus-current-crosspost-group nil)
1119 (defvar gnus-newsgroup-display nil)
1121 (defvar gnus-newsgroup-dependencies nil)
1122 (defvar gnus-newsgroup-adaptive nil)
1123 (defvar gnus-summary-display-article-function nil)
1124 (defvar gnus-summary-highlight-line-function nil
1125 "Function called after highlighting a summary line.")
1127 (defvar gnus-summary-line-format-alist
1128 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1129 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1130 (?s gnus-tmp-subject-or-nil ?s)
1131 (?n gnus-tmp-name ?s)
1132 (?A (std11-address-string
1133 (car (mime-entity-read-field gnus-tmp-header 'From))) ?s)
1134 (?a (or (std11-full-name-string
1135 (car (mime-entity-read-field gnus-tmp-header 'From)))
1137 (?F gnus-tmp-from ?s)
1138 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1139 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1140 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1141 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1142 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1143 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1144 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1145 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1146 (?L gnus-tmp-lines ?s)
1147 (?O gnus-tmp-downloaded ?c)
1148 (?I gnus-tmp-indentation ?s)
1149 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1150 (?R gnus-tmp-replied ?c)
1151 (?\[ gnus-tmp-opening-bracket ?c)
1152 (?\] gnus-tmp-closing-bracket ?c)
1153 (?\> (make-string gnus-tmp-level ? ) ?s)
1154 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1155 (?i gnus-tmp-score ?d)
1156 (?z gnus-tmp-score-char ?c)
1157 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1158 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1159 (?U gnus-tmp-unread ?c)
1160 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1162 (?t (gnus-summary-number-of-articles-in-thread
1163 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1165 (?e (gnus-summary-number-of-articles-in-thread
1166 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1168 (?u gnus-tmp-user-defined ?s)
1169 (?P (gnus-pick-line-number) ?d)
1170 (?B gnus-tmp-thread-tree-header-string ?s)
1171 (user-date (gnus-user-date
1172 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1173 "An alist of format specifications that can appear in summary lines.
1174 These are paired with what variables they correspond with, along with
1175 the type of the variable (string, integer, character, etc).")
1177 (defvar gnus-summary-dummy-line-format-alist
1178 `((?S gnus-tmp-subject ?s)
1179 (?N gnus-tmp-number ?d)
1180 (?u gnus-tmp-user-defined ?s)))
1182 (defvar gnus-summary-mode-line-format-alist
1183 `((?G gnus-tmp-group-name ?s)
1184 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1185 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1186 (?A gnus-tmp-article-number ?d)
1187 (?Z gnus-tmp-unread-and-unselected ?s)
1188 (?V gnus-version ?s)
1189 (?U gnus-tmp-unread-and-unticked ?d)
1190 (?S gnus-tmp-subject ?s)
1191 (?e gnus-tmp-unselected ?d)
1192 (?u gnus-tmp-user-defined ?s)
1193 (?d (length gnus-newsgroup-dormant) ?d)
1194 (?t (length gnus-newsgroup-marked) ?d)
1195 (?h (length gnus-newsgroup-spam-marked) ?d)
1196 (?r (length gnus-newsgroup-reads) ?d)
1197 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1198 (?E gnus-newsgroup-expunged-tally ?d)
1199 (?s (gnus-current-score-file-nondirectory) ?s)))
1201 (defvar gnus-last-search-regexp nil
1202 "Default regexp for article search command.")
1204 (defvar gnus-summary-search-article-matched-data nil
1205 "Last matched data of article search command. It is the local variable
1206 in `gnus-article-buffer' which consists of the list of start position,
1207 end position and text.")
1209 (defvar gnus-last-shell-command nil
1210 "Default shell command on article.")
1212 (defvar gnus-newsgroup-agentized nil
1213 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1214 (defvar gnus-newsgroup-begin nil)
1215 (defvar gnus-newsgroup-end nil)
1216 (defvar gnus-newsgroup-last-rmail nil)
1217 (defvar gnus-newsgroup-last-mail nil)
1218 (defvar gnus-newsgroup-last-folder nil)
1219 (defvar gnus-newsgroup-last-file nil)
1220 (defvar gnus-newsgroup-auto-expire nil)
1221 (defvar gnus-newsgroup-active nil)
1223 (defvar gnus-newsgroup-data nil)
1224 (defvar gnus-newsgroup-data-reverse nil)
1225 (defvar gnus-newsgroup-limit nil)
1226 (defvar gnus-newsgroup-limits nil)
1228 (defvar gnus-newsgroup-unreads nil
1229 "Sorted list of unread articles in the current newsgroup.")
1231 (defvar gnus-newsgroup-unselected nil
1232 "Sorted list of unselected unread articles in the current newsgroup.")
1234 (defvar gnus-newsgroup-reads nil
1235 "Alist of read articles and article marks in the current newsgroup.")
1237 (defvar gnus-newsgroup-expunged-tally nil)
1239 (defvar gnus-newsgroup-marked nil
1240 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1242 (defvar gnus-newsgroup-spam-marked nil
1243 "List of ranges of articles that have been marked as spam.")
1245 (defvar gnus-newsgroup-killed nil
1246 "List of ranges of articles that have been through the scoring process.")
1248 (defvar gnus-newsgroup-cached nil
1249 "Sorted list of articles that come from the article cache.")
1251 (defvar gnus-newsgroup-saved nil
1252 "List of articles that have been saved.")
1254 (defvar gnus-newsgroup-kill-headers nil)
1256 (defvar gnus-newsgroup-replied nil
1257 "List of articles that have been replied to in the current newsgroup.")
1259 (defvar gnus-newsgroup-forwarded nil
1260 "List of articles that have been forwarded in the current newsgroup.")
1262 (defvar gnus-newsgroup-recent nil
1263 "List of articles that have are recent in the current newsgroup.")
1265 (defvar gnus-newsgroup-expirable nil
1266 "Sorted list of articles in the current newsgroup that can be expired.")
1268 (defvar gnus-newsgroup-processable nil
1269 "List of articles in the current newsgroup that can be processed.")
1271 (defvar gnus-newsgroup-downloadable nil
1272 "Sorted list of articles in the current newsgroup that can be processed.")
1274 (defvar gnus-newsgroup-undownloaded nil
1275 "List of articles in the current newsgroup that haven't been downloaded..")
1277 (defvar gnus-newsgroup-unsendable nil
1278 "List of articles in the current newsgroup that won't be sent.")
1280 (defvar gnus-newsgroup-bookmarks nil
1281 "List of articles in the current newsgroup that have bookmarks.")
1283 (defvar gnus-newsgroup-dormant nil
1284 "Sorted list of dormant articles in the current newsgroup.")
1286 (defvar gnus-newsgroup-unseen nil
1287 "List of unseen articles in the current newsgroup.")
1289 (defvar gnus-newsgroup-seen nil
1290 "Range of seen articles in the current newsgroup.")
1292 (defvar gnus-newsgroup-articles nil
1293 "List of articles in the current newsgroup.")
1295 (defvar gnus-newsgroup-scored nil
1296 "List of scored articles in the current newsgroup.")
1298 (defvar gnus-newsgroup-incorporated nil
1299 "List of incorporated articles in the current newsgroup.")
1301 (defvar gnus-newsgroup-headers nil
1302 "List of article headers in the current newsgroup.")
1304 (defvar gnus-newsgroup-threads nil)
1306 (defvar gnus-newsgroup-prepared nil
1307 "Whether the current group has been prepared properly.")
1309 (defvar gnus-newsgroup-ancient nil
1310 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1312 (defvar gnus-newsgroup-sparse nil)
1314 (defvar gnus-current-article nil)
1315 (defvar gnus-article-current nil)
1316 (defvar gnus-current-headers nil)
1317 (defvar gnus-have-all-headers nil)
1318 (defvar gnus-last-article nil)
1319 (defvar gnus-newsgroup-history nil)
1320 (defvar gnus-newsgroup-charset nil)
1321 (defvar gnus-newsgroup-ephemeral-charset nil)
1322 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1324 (defvar gnus-article-before-search nil)
1326 (defconst gnus-summary-local-variables
1327 '(gnus-newsgroup-name
1328 gnus-newsgroup-begin gnus-newsgroup-end
1329 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1330 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1331 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1332 gnus-newsgroup-unselected gnus-newsgroup-marked
1333 gnus-newsgroup-spam-marked
1334 gnus-newsgroup-reads gnus-newsgroup-saved
1335 gnus-newsgroup-replied gnus-newsgroup-forwarded
1336 gnus-newsgroup-recent
1337 gnus-newsgroup-expirable
1338 gnus-newsgroup-processable gnus-newsgroup-killed
1339 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1340 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1341 gnus-newsgroup-seen gnus-newsgroup-articles
1342 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1343 gnus-newsgroup-headers gnus-newsgroup-threads
1344 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1345 gnus-current-article gnus-current-headers gnus-have-all-headers
1346 gnus-last-article gnus-article-internal-prepare-hook
1347 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1348 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1349 gnus-thread-expunge-below
1350 gnus-score-alist gnus-current-score-file
1351 (gnus-summary-expunge-below . global)
1352 (gnus-summary-mark-below . global)
1353 (gnus-orphan-score . global)
1354 gnus-newsgroup-active gnus-scores-exclude-files
1355 gnus-newsgroup-history gnus-newsgroup-ancient
1356 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1357 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1358 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1359 (gnus-newsgroup-expunged-tally . 0)
1360 gnus-cache-removable-articles gnus-newsgroup-cached
1361 gnus-newsgroup-data gnus-newsgroup-data-reverse
1362 gnus-newsgroup-limit gnus-newsgroup-limits
1363 gnus-newsgroup-charset gnus-newsgroup-display
1364 gnus-newsgroup-incorporated)
1365 "Variables that are buffer-local to the summary buffers.")
1367 (defvar gnus-newsgroup-variables nil
1368 "A list of variables that have separate values in different newsgroups.
1369 A list of newsgroup (summary buffer) local variables, or cons of
1370 variables and their default values (when the default values are not
1371 nil), that should be made global while the summary buffer is active.
1372 These variables can be used to set variables in the group parameters
1373 while still allowing them to affect operations done in other
1374 buffers. For example:
1376 \(setq gnus-newsgroup-variables
1377 '(message-use-followup-to
1378 (gnus-visible-headers .
1379 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1382 ;; Byte-compiler warning.
1383 (eval-when-compile (defvar gnus-article-mode-map))
1385 ;; Subject simplification.
1387 (defun gnus-simplify-whitespace (str)
1388 "Remove excessive whitespace from STR."
1391 (while (string-match "[ \t][ \t]+" mystr)
1392 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1394 (substring mystr (match-end 0)))))
1396 (when (string-match "^[ \t]+" mystr)
1397 (setq mystr (substring mystr (match-end 0))))
1399 (when (string-match "[ \t]+$" mystr)
1400 (setq mystr (substring mystr 0 (match-beginning 0))))
1403 (defun gnus-simplify-all-whitespace (str)
1404 "Remove all whitespace from STR."
1406 (while (string-match "[ \t\n]+" mystr)
1407 (setq mystr (replace-match "" nil nil mystr)))
1410 (defsubst gnus-simplify-subject-re (subject)
1411 "Remove \"Re:\" from subject lines."
1412 (if (string-match message-subject-re-regexp subject)
1413 (substring subject (match-end 0))
1416 (defun gnus-simplify-subject (subject &optional re-only)
1417 "Remove `Re:' and words in parentheses.
1418 If RE-ONLY is non-nil, strip leading `Re:'s only."
1419 (let ((case-fold-search t)) ;Ignore case.
1420 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1421 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1422 (setq subject (substring subject (match-end 0))))
1423 ;; Remove uninteresting prefixes.
1424 (when (and (not re-only)
1425 gnus-simplify-ignored-prefixes
1426 (string-match gnus-simplify-ignored-prefixes subject))
1427 (setq subject (substring subject (match-end 0))))
1428 ;; Remove words in parentheses from end.
1430 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1431 (setq subject (substring subject 0 (match-beginning 0)))))
1432 ;; Return subject string.
1435 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1437 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1438 (goto-char (point-min))
1439 (while (re-search-forward regexp nil t)
1440 (replace-match (or newtext ""))))
1442 (defun gnus-simplify-buffer-fuzzy ()
1443 "Simplify string in the buffer fuzzily.
1444 The string in the accessible portion of the current buffer is simplified.
1445 It is assumed to be a single-line subject.
1446 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1447 matter is removed. Additional things can be deleted by setting
1448 `gnus-simplify-subject-fuzzy-regexp'."
1449 (let ((case-fold-search t)
1451 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1453 (while (not (eq modified-tick (buffer-modified-tick)))
1454 (setq modified-tick (buffer-modified-tick))
1456 ((listp gnus-simplify-subject-fuzzy-regexp)
1457 (mapcar 'gnus-simplify-buffer-fuzzy-step
1458 gnus-simplify-subject-fuzzy-regexp))
1459 (gnus-simplify-subject-fuzzy-regexp
1460 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1461 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1462 (gnus-simplify-buffer-fuzzy-step
1463 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1464 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1466 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1467 (gnus-simplify-buffer-fuzzy-step " +" " ")
1468 (gnus-simplify-buffer-fuzzy-step " $")
1469 (gnus-simplify-buffer-fuzzy-step "^ +")))
1471 (defun gnus-simplify-subject-fuzzy (subject)
1472 "Simplify a subject string fuzzily.
1473 See `gnus-simplify-buffer-fuzzy' for details."
1475 (gnus-set-work-buffer)
1476 (let ((case-fold-search t))
1477 ;; Remove uninteresting prefixes.
1478 (when (and gnus-simplify-ignored-prefixes
1479 (string-match gnus-simplify-ignored-prefixes subject))
1480 (setq subject (substring subject (match-end 0))))
1482 (inline (gnus-simplify-buffer-fuzzy))
1485 (defsubst gnus-simplify-subject-fully (subject)
1486 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1488 (gnus-simplify-subject-functions
1489 (gnus-map-function gnus-simplify-subject-functions subject))
1490 ((null gnus-summary-gather-subject-limit)
1491 (gnus-simplify-subject-re subject))
1492 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1493 (gnus-simplify-subject-fuzzy subject))
1494 ((numberp gnus-summary-gather-subject-limit)
1495 (gnus-limit-string (gnus-simplify-subject-re subject)
1496 gnus-summary-gather-subject-limit))
1500 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1501 "Check whether two subjects are equal.
1502 If optional argument simple-first is t, first argument is already
1505 ((null simple-first)
1506 (equal (gnus-simplify-subject-fully s1)
1507 (gnus-simplify-subject-fully s2)))
1510 (gnus-simplify-subject-fully s2)))))
1512 (defun gnus-summary-bubble-group ()
1513 "Increase the score of the current group.
1514 This is a handy function to add to `gnus-summary-exit-hook' to
1515 increase the score of each group you read."
1516 (gnus-group-add-score gnus-newsgroup-name))
1520 ;;; Gnus summary mode
1523 (put 'gnus-summary-mode 'mode-class 'special)
1525 (defvar gnus-article-commands-menu)
1528 ;; Non-orthogonal keys
1530 (gnus-define-keys gnus-summary-mode-map
1531 " " gnus-summary-next-page
1532 "\177" gnus-summary-prev-page
1533 [delete] gnus-summary-prev-page
1534 [backspace] gnus-summary-prev-page
1535 "\r" gnus-summary-scroll-up
1536 "\M-\r" gnus-summary-scroll-down
1537 "n" gnus-summary-next-unread-article
1538 "p" gnus-summary-prev-unread-article
1539 "N" gnus-summary-next-article
1540 "P" gnus-summary-prev-article
1541 "\M-\C-n" gnus-summary-next-same-subject
1542 "\M-\C-p" gnus-summary-prev-same-subject
1543 "\M-n" gnus-summary-next-unread-subject
1544 "\M-p" gnus-summary-prev-unread-subject
1545 "." gnus-summary-first-unread-article
1546 "," gnus-summary-best-unread-article
1547 "\M-s" gnus-summary-search-article-forward
1548 "\M-r" gnus-summary-search-article-backward
1549 "<" gnus-summary-beginning-of-article
1550 ">" gnus-summary-end-of-article
1551 "j" gnus-summary-goto-article
1552 "^" gnus-summary-refer-parent-article
1553 "\M-^" gnus-summary-refer-article
1554 "u" gnus-summary-tick-article-forward
1555 "!" gnus-summary-tick-article-forward
1556 "U" gnus-summary-tick-article-backward
1557 "d" gnus-summary-mark-as-read-forward
1558 "D" gnus-summary-mark-as-read-backward
1559 "E" gnus-summary-mark-as-expirable
1560 "\M-u" gnus-summary-clear-mark-forward
1561 "\M-U" gnus-summary-clear-mark-backward
1562 "k" gnus-summary-kill-same-subject-and-select
1563 "\C-k" gnus-summary-kill-same-subject
1564 "\M-\C-k" gnus-summary-kill-thread
1565 "\M-\C-l" gnus-summary-lower-thread
1566 "e" gnus-summary-edit-article
1567 "#" gnus-summary-mark-as-processable
1568 "\M-#" gnus-summary-unmark-as-processable
1569 "\M-\C-t" gnus-summary-toggle-threads
1570 "\M-\C-s" gnus-summary-show-thread
1571 "\M-\C-h" gnus-summary-hide-thread
1572 "\M-\C-f" gnus-summary-next-thread
1573 "\M-\C-b" gnus-summary-prev-thread
1574 [(meta down)] gnus-summary-next-thread
1575 [(meta up)] gnus-summary-prev-thread
1576 "\M-\C-u" gnus-summary-up-thread
1577 "\M-\C-d" gnus-summary-down-thread
1578 "&" gnus-summary-execute-command
1579 "c" gnus-summary-catchup-and-exit
1580 "\C-w" gnus-summary-mark-region-as-read
1581 "\C-t" gnus-summary-toggle-truncation
1582 "?" gnus-summary-mark-as-dormant
1583 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1584 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1585 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1586 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1587 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1588 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1589 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1590 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1591 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1592 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1593 "=" gnus-summary-expand-window
1594 "\C-x\C-s" gnus-summary-reselect-current-group
1595 "\M-g" gnus-summary-rescan-group
1596 "w" gnus-summary-stop-page-breaking
1597 "\C-c\C-r" gnus-summary-caesar-message
1598 "\M-t" gnus-summary-toggle-mime
1599 "f" gnus-summary-followup
1600 "F" gnus-summary-followup-with-original
1601 "C" gnus-summary-cancel-article
1602 "r" gnus-summary-reply
1603 "R" gnus-summary-reply-with-original
1604 "\C-c\C-f" gnus-summary-mail-forward
1605 "o" gnus-summary-save-article
1606 "\C-o" gnus-summary-save-article-mail
1607 "|" gnus-summary-pipe-output
1608 "\M-k" gnus-summary-edit-local-kill
1609 "\M-K" gnus-summary-edit-global-kill
1611 "\C-c\C-d" gnus-summary-describe-group
1612 "q" gnus-summary-exit
1613 "Q" gnus-summary-exit-no-update
1614 "\C-c\C-i" gnus-info-find-node
1615 gnus-mouse-2 gnus-mouse-pick-article
1616 "m" gnus-summary-mail-other-window
1617 "a" gnus-summary-post-news
1618 "i" gnus-summary-news-other-window
1619 "x" gnus-summary-limit-to-unread
1620 "s" gnus-summary-isearch-article
1621 "t" gnus-summary-toggle-header
1622 "g" gnus-summary-show-article
1623 "l" gnus-summary-goto-last-article
1624 "v" gnus-summary-preview-mime-message
1625 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1626 "\C-d" gnus-summary-enter-digest-group
1627 "\M-\C-d" gnus-summary-read-document
1628 "\M-\C-e" gnus-summary-edit-parameters
1629 "\M-\C-a" gnus-summary-customize-parameters
1631 "\C-c\C-n" gnus-namazu-search
1632 "*" gnus-cache-enter-article
1633 "\M-*" gnus-cache-remove-article
1634 "\M-&" gnus-summary-universal-argument
1635 "\C-l" gnus-recenter
1636 "I" gnus-summary-increase-score
1637 "L" gnus-summary-lower-score
1638 "\M-i" gnus-symbolic-argument
1639 "h" gnus-summary-select-article-buffer
1641 "V" gnus-summary-score-map
1642 "X" gnus-uu-extract-map
1643 "S" gnus-summary-send-map)
1645 ;; Sort of orthogonal keymap
1646 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1647 "t" gnus-summary-tick-article-forward
1648 "!" gnus-summary-tick-article-forward
1649 "d" gnus-summary-mark-as-read-forward
1650 "r" gnus-summary-mark-as-read-forward
1651 "c" gnus-summary-clear-mark-forward
1652 " " gnus-summary-clear-mark-forward
1653 "e" gnus-summary-mark-as-expirable
1654 "x" gnus-summary-mark-as-expirable
1655 "?" gnus-summary-mark-as-dormant
1656 "b" gnus-summary-set-bookmark
1657 "B" gnus-summary-remove-bookmark
1658 "#" gnus-summary-mark-as-processable
1659 "\M-#" gnus-summary-unmark-as-processable
1660 "S" gnus-summary-limit-include-expunged
1661 "C" gnus-summary-catchup
1662 "H" gnus-summary-catchup-to-here
1663 "h" gnus-summary-catchup-from-here
1664 "\C-c" gnus-summary-catchup-all
1665 "k" gnus-summary-kill-same-subject-and-select
1666 "K" gnus-summary-kill-same-subject
1667 "P" gnus-uu-mark-map)
1669 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1670 "c" gnus-summary-clear-above
1671 "u" gnus-summary-tick-above
1672 "m" gnus-summary-mark-above
1673 "k" gnus-summary-kill-below)
1675 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1676 "/" gnus-summary-limit-to-subject
1677 "n" gnus-summary-limit-to-articles
1678 "w" gnus-summary-pop-limit
1679 "s" gnus-summary-limit-to-subject
1680 "a" gnus-summary-limit-to-author
1681 "u" gnus-summary-limit-to-unread
1682 "m" gnus-summary-limit-to-marks
1683 "M" gnus-summary-limit-exclude-marks
1684 "v" gnus-summary-limit-to-score
1685 "*" gnus-summary-limit-include-cached
1686 "D" gnus-summary-limit-include-dormant
1687 "T" gnus-summary-limit-include-thread
1688 "d" gnus-summary-limit-exclude-dormant
1689 "t" gnus-summary-limit-to-age
1690 "." gnus-summary-limit-to-unseen
1691 "x" gnus-summary-limit-to-extra
1692 "p" gnus-summary-limit-to-display-predicate
1693 "E" gnus-summary-limit-include-expunged
1694 "c" gnus-summary-limit-exclude-childless-dormant
1695 "C" gnus-summary-limit-mark-excluded-as-read
1696 "o" gnus-summary-insert-old-articles
1697 "N" gnus-summary-insert-new-articles)
1699 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1700 "n" gnus-summary-next-unread-article
1701 "p" gnus-summary-prev-unread-article
1702 "N" gnus-summary-next-article
1703 "P" gnus-summary-prev-article
1704 "\C-n" gnus-summary-next-same-subject
1705 "\C-p" gnus-summary-prev-same-subject
1706 "\M-n" gnus-summary-next-unread-subject
1707 "\M-p" gnus-summary-prev-unread-subject
1708 "f" gnus-summary-first-unread-article
1709 "b" gnus-summary-best-unread-article
1710 "j" gnus-summary-goto-article
1711 "g" gnus-summary-goto-subject
1712 "l" gnus-summary-goto-last-article
1713 "o" gnus-summary-pop-article)
1715 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1716 "k" gnus-summary-kill-thread
1717 "l" gnus-summary-lower-thread
1718 "i" gnus-summary-raise-thread
1719 "T" gnus-summary-toggle-threads
1720 "t" gnus-summary-rethread-current
1721 "^" gnus-summary-reparent-thread
1722 "s" gnus-summary-show-thread
1723 "S" gnus-summary-show-all-threads
1724 "h" gnus-summary-hide-thread
1725 "H" gnus-summary-hide-all-threads
1726 "n" gnus-summary-next-thread
1727 "p" gnus-summary-prev-thread
1728 "u" gnus-summary-up-thread
1729 "o" gnus-summary-top-thread
1730 "d" gnus-summary-down-thread
1731 "#" gnus-uu-mark-thread
1732 "\M-#" gnus-uu-unmark-thread)
1734 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1735 "g" gnus-summary-prepare
1736 "c" gnus-summary-insert-cached-articles)
1738 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1739 "c" gnus-summary-catchup-and-exit
1740 "C" gnus-summary-catchup-all-and-exit
1741 "E" gnus-summary-exit-no-update
1742 "J" gnus-summary-jump-to-other-group
1743 "Q" gnus-summary-exit
1744 "Z" gnus-summary-exit
1745 "n" gnus-summary-catchup-and-goto-next-group
1746 "R" gnus-summary-reselect-current-group
1747 "G" gnus-summary-rescan-group
1748 "N" gnus-summary-next-group
1749 "s" gnus-summary-save-newsrc
1750 "P" gnus-summary-prev-group)
1752 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1753 " " gnus-summary-next-page
1754 "n" gnus-summary-next-page
1755 "\177" gnus-summary-prev-page
1756 [delete] gnus-summary-prev-page
1757 "p" gnus-summary-prev-page
1758 "\r" gnus-summary-scroll-up
1759 "\M-\r" gnus-summary-scroll-down
1760 "<" gnus-summary-beginning-of-article
1761 ">" gnus-summary-end-of-article
1762 "b" gnus-summary-beginning-of-article
1763 "e" gnus-summary-end-of-article
1764 "^" gnus-summary-refer-parent-article
1765 "r" gnus-summary-refer-parent-article
1766 "D" gnus-summary-enter-digest-group
1767 "R" gnus-summary-refer-references
1768 "T" gnus-summary-refer-thread
1769 "g" gnus-summary-show-article
1770 "s" gnus-summary-isearch-article
1771 "P" gnus-summary-print-article
1772 "M" gnus-mailing-list-insinuate
1773 "t" gnus-article-babel)
1775 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1776 "b" gnus-article-add-buttons
1777 "B" gnus-article-add-buttons-to-head
1778 "o" gnus-article-treat-overstrike
1779 "e" gnus-article-emphasize
1780 "w" gnus-article-fill-cited-article
1781 "Q" gnus-article-fill-long-lines
1782 "C" gnus-article-capitalize-sentences
1783 "c" gnus-article-remove-cr
1784 "Z" gnus-article-decode-HZ
1785 "h" gnus-article-wash-html
1786 "u" gnus-article-unsplit-urls
1787 "f" gnus-article-display-x-face
1788 "l" gnus-summary-stop-page-breaking
1789 "r" gnus-summary-caesar-message
1790 "m" gnus-summary-morse-message
1791 "t" gnus-summary-toggle-header
1792 "g" gnus-treat-smiley
1793 "v" gnus-summary-verbose-headers
1794 "m" gnus-summary-toggle-mime
1795 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1796 "p" gnus-article-verify-x-pgp-sig
1797 "d" gnus-article-treat-dumbquotes
1798 "k" gnus-article-outlook-deuglify-article)
1800 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1801 "a" gnus-article-hide
1802 "h" gnus-article-hide-headers
1803 "b" gnus-article-hide-boring-headers
1804 "s" gnus-article-hide-signature
1805 "c" gnus-article-hide-citation
1806 "C" gnus-article-hide-citation-in-followups
1807 "l" gnus-article-hide-list-identifiers
1808 "p" gnus-article-hide-pgp
1809 "B" gnus-article-strip-banner
1810 "P" gnus-article-hide-pem
1811 "\C-c" gnus-article-hide-citation-maybe)
1813 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1814 "a" gnus-article-highlight
1815 "h" gnus-article-highlight-headers
1816 "c" gnus-article-highlight-citation
1817 "s" gnus-article-highlight-signature)
1819 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1820 "f" gnus-article-treat-fold-headers
1821 "u" gnus-article-treat-unfold-headers
1822 "n" gnus-article-treat-fold-newsgroups)
1824 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1825 "x" gnus-article-display-x-face
1826 "s" gnus-treat-smiley
1827 "D" gnus-article-remove-images
1828 "f" gnus-treat-from-picon
1829 "m" gnus-treat-mail-picon
1830 "n" gnus-treat-newsgroups-picon)
1832 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1833 "z" gnus-article-date-ut
1834 "u" gnus-article-date-ut
1835 "l" gnus-article-date-local
1836 "p" gnus-article-date-english
1837 "e" gnus-article-date-lapsed
1838 "o" gnus-article-date-original
1839 "i" gnus-article-date-iso8601
1840 "s" gnus-article-date-user)
1842 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1843 "t" gnus-article-remove-trailing-blank-lines
1844 "l" gnus-article-strip-leading-blank-lines
1845 "m" gnus-article-strip-multiple-blank-lines
1846 "a" gnus-article-strip-blank-lines
1847 "A" gnus-article-strip-all-blank-lines
1848 "s" gnus-article-strip-leading-space
1849 "e" gnus-article-strip-trailing-space
1850 "w" gnus-article-remove-leading-whitespace)
1852 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1854 "f" gnus-summary-fetch-faq
1855 "d" gnus-summary-describe-group
1856 "h" gnus-summary-describe-briefly
1857 "i" gnus-info-find-node
1858 "c" gnus-group-fetch-charter
1859 "C" gnus-group-fetch-control)
1861 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1862 "e" gnus-summary-expire-articles
1863 "\M-\C-e" gnus-summary-expire-articles-now
1864 "\177" gnus-summary-delete-article
1865 [delete] gnus-summary-delete-article
1866 [backspace] gnus-summary-delete-article
1867 "m" gnus-summary-move-article
1868 "r" gnus-summary-respool-article
1869 "w" gnus-summary-edit-article
1870 "c" gnus-summary-copy-article
1871 "B" gnus-summary-crosspost-article
1872 "q" gnus-summary-respool-query
1873 "t" gnus-summary-respool-trace
1874 "i" gnus-summary-import-article
1875 "I" gnus-summary-create-article
1876 "p" gnus-summary-article-posted-p)
1878 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1879 "o" gnus-summary-save-article
1880 "m" gnus-summary-save-article-mail
1881 "F" gnus-summary-write-article-file
1882 "r" gnus-summary-save-article-rmail
1883 "f" gnus-summary-save-article-file
1884 "b" gnus-summary-save-article-body-file
1885 "h" gnus-summary-save-article-folder
1886 "v" gnus-summary-save-article-vm
1887 "p" gnus-summary-pipe-output
1888 "P" gnus-summary-muttprint
1889 "s" gnus-soup-add-article)
1891 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1892 "b" gnus-summary-display-buttonized
1893 "m" gnus-summary-repair-multipart
1894 "v" gnus-article-view-part
1895 "o" gnus-article-save-part
1896 "c" gnus-article-copy-part
1897 "C" gnus-article-view-part-as-charset
1898 "e" gnus-article-view-part-externally
1899 "E" gnus-article-encrypt-body
1900 "i" gnus-article-inline-part
1901 "|" gnus-article-pipe-part)
1903 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1904 "p" gnus-summary-mark-as-processable
1905 "u" gnus-summary-unmark-as-processable
1906 "U" gnus-summary-unmark-all-processable
1907 "v" gnus-uu-mark-over
1908 "s" gnus-uu-mark-series
1909 "r" gnus-uu-mark-region
1910 "g" gnus-uu-unmark-region
1911 "R" gnus-uu-mark-by-regexp
1912 "G" gnus-uu-unmark-by-regexp
1913 "t" gnus-uu-mark-thread
1914 "T" gnus-uu-unmark-thread
1915 "a" gnus-uu-mark-all
1916 "b" gnus-uu-mark-buffer
1917 "S" gnus-uu-mark-sparse
1918 "k" gnus-summary-kill-process-mark
1919 "y" gnus-summary-yank-process-mark
1920 "w" gnus-summary-save-process-mark
1921 "i" gnus-uu-invert-processable)
1923 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
1924 ;;"x" gnus-uu-extract-any
1925 "m" gnus-summary-save-parts
1926 "u" gnus-uu-decode-uu
1927 "U" gnus-uu-decode-uu-and-save
1928 "s" gnus-uu-decode-unshar
1929 "S" gnus-uu-decode-unshar-and-save
1930 "o" gnus-uu-decode-save
1931 "O" gnus-uu-decode-save
1932 "b" gnus-uu-decode-binhex
1933 "B" gnus-uu-decode-binhex
1934 "p" gnus-uu-decode-postscript
1935 "P" gnus-uu-decode-postscript-and-save)
1938 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
1939 "u" gnus-uu-decode-uu-view
1940 "U" gnus-uu-decode-uu-and-save-view
1941 "s" gnus-uu-decode-unshar-view
1942 "S" gnus-uu-decode-unshar-and-save-view
1943 "o" gnus-uu-decode-save-view
1944 "O" gnus-uu-decode-save-view
1945 "b" gnus-uu-decode-binhex-view
1946 "B" gnus-uu-decode-binhex-view
1947 "p" gnus-uu-decode-postscript-view
1948 "P" gnus-uu-decode-postscript-and-save-view))
1950 (defvar gnus-article-post-menu nil)
1952 (defconst gnus-summary-menu-maxlen 20)
1954 (defun gnus-summary-menu-split (menu)
1955 ;; If we have lots of elements, divide them into groups of 20
1956 ;; and make a pane (or submenu) for each one.
1957 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
1958 (let ((menu menu) sublists next
1961 ;; Pull off the next gnus-summary-menu-maxlen elements
1962 ;; and make them the next element of sublist.
1963 (setq next (nthcdr gnus-summary-menu-maxlen menu))
1965 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
1967 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
1968 (aref (car (last menu)) 0)) menu)
1972 (nreverse sublists))
1973 ;; Few elements--put them all in one pane.
1976 (defun gnus-summary-make-menu-bar ()
1977 (gnus-turn-off-edit-menu 'summary)
1979 (unless (boundp 'gnus-summary-misc-menu)
1982 gnus-summary-kill-menu gnus-summary-mode-map ""
1987 ["Customize" gnus-score-customize t])
1988 (gnus-make-score-map 'increase)
1989 (gnus-make-score-map 'lower)
1991 ["Kill below" gnus-summary-kill-below t]
1992 ["Mark above" gnus-summary-mark-above t]
1993 ["Tick above" gnus-summary-tick-above t]
1994 ["Clear above" gnus-summary-clear-above t])
1995 ["Current score" gnus-summary-current-score t]
1996 ["Set score" gnus-summary-set-score t]
1997 ["Switch current score file..." gnus-score-change-score-file t]
1998 ["Set mark below..." gnus-score-set-mark-below t]
1999 ["Set expunge below..." gnus-score-set-expunge-below t]
2000 ["Edit current score file" gnus-score-edit-current-scores t]
2001 ["Edit score file" gnus-score-edit-file t]
2002 ["Trace score" gnus-score-find-trace t]
2003 ["Find words" gnus-score-find-favourite-words t]
2004 ["Rescore buffer" gnus-summary-rescore t]
2005 ["Increase score..." gnus-summary-increase-score t]
2006 ["Lower score..." gnus-summary-lower-score t]))))
2008 ;; Define both the Article menu in the summary buffer and the
2009 ;; equivalent Commands menu in the article buffer here for
2013 ["All" gnus-article-hide t]
2014 ["Headers" gnus-article-hide-headers t]
2015 ["Signature" gnus-article-hide-signature t]
2016 ["Citation" gnus-article-hide-citation t]
2017 ["List identifiers" gnus-article-hide-list-identifiers t]
2018 ["PGP" gnus-article-hide-pgp t]
2019 ["Banner" gnus-article-strip-banner t]
2020 ["Boring headers" gnus-article-hide-boring-headers t])
2022 ["All" gnus-article-highlight t]
2023 ["Headers" gnus-article-highlight-headers t]
2024 ["Signature" gnus-article-highlight-signature t]
2025 ["Citation" gnus-article-highlight-citation t])
2027 ["Local" gnus-article-date-local t]
2028 ["ISO8601" gnus-article-date-iso8601 t]
2029 ["UT" gnus-article-date-ut t]
2030 ["Original" gnus-article-date-original t]
2031 ["Lapsed" gnus-article-date-lapsed t]
2032 ["User-defined" gnus-article-date-user t])
2034 ["Remove images" gnus-article-remove-images t]
2035 ["Toggle smiley" gnus-treat-smiley t]
2036 ["Show X-Face" gnus-article-display-x-face t]
2037 ["Show picons in From" gnus-treat-from-picon t]
2038 ["Show picons in mail headers" gnus-treat-mail-picon t]
2039 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2040 ("View as different encoding"
2041 ,@(gnus-summary-menu-split
2044 ;; Since easymenu under FSF Emacs doesn't allow lambda
2045 ;; forms for menu commands, we should provide intern'ed
2046 ;; function symbols.
2047 (let ((command (intern (format "\
2048 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2052 (let ((gnus-summary-show-article-charset-alist
2054 (gnus-summary-show-article 1))))
2055 `[,(symbol-name cs) ,command t]))
2056 (sort (if (fboundp 'coding-system-list)
2057 (coding-system-list)
2058 ;;(mapcar 'car mm-mime-mule-charset-alist)
2063 ["Leading" gnus-article-strip-leading-blank-lines t]
2064 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2065 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2066 ["All of the above" gnus-article-strip-blank-lines t]
2067 ["All" gnus-article-strip-all-blank-lines t]
2068 ["Leading space" gnus-article-strip-leading-space t]
2069 ["Trailing space" gnus-article-strip-trailing-space t]
2070 ["Leading space in headers"
2071 gnus-article-remove-leading-whitespace t])
2072 ["Overstrike" gnus-article-treat-overstrike t]
2073 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2074 ["Emphasis" gnus-article-emphasize t]
2075 ["Word wrap" gnus-article-fill-cited-article t]
2076 ["Fill long lines" gnus-article-fill-long-lines t]
2077 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2078 ["CR" gnus-article-remove-cr t]
2079 ["Rot 13" gnus-summary-caesar-message
2080 ,@(if (featurep 'xemacs) '(t)
2081 '(:help "\"Caesar rotate\" article by 13"))]
2082 ["Morse decode" gnus-summary-morse-message t]
2083 ["Unix pipe..." gnus-summary-pipe-message t]
2084 ["Add buttons" gnus-article-add-buttons t]
2085 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2086 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2087 ["Toggle MIME" gnus-summary-toggle-mime t]
2088 ["Verbose header" gnus-summary-verbose-headers t]
2089 ["Toggle header" gnus-summary-toggle-header t]
2090 ["Unfold headers" gnus-article-treat-unfold-headers t]
2091 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2092 ["Html" gnus-article-wash-html t]
2093 ["URLs" gnus-article-unsplit-urls t]
2094 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2095 ["HZ" gnus-article-decode-HZ t]
2096 ["OutlooK deuglify" gnus-article-outlook-deuglify-article t]
2099 ["Save in default format" gnus-summary-save-article
2100 ,@(if (featurep 'xemacs) '(t)
2101 '(:help "Save article using default method"))]
2102 ["Save in file" gnus-summary-save-article-file
2103 ,@(if (featurep 'xemacs) '(t)
2104 '(:help "Save article in file"))]
2105 ["Save in Unix mail format" gnus-summary-save-article-mail t]
2106 ["Save in MH folder" gnus-summary-save-article-folder t]
2107 ["Save in VM folder" gnus-summary-save-article-vm t]
2108 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
2109 ["Save body in file" gnus-summary-save-article-body-file t]
2110 ["Pipe through a filter" gnus-summary-pipe-output t]
2111 ["Add to SOUP packet" gnus-soup-add-article t]
2112 ["Print with Muttprint" gnus-summary-muttprint t]
2113 ["Print" gnus-summary-print-article t])
2115 ["Respool article..." gnus-summary-respool-article t]
2116 ["Move article..." gnus-summary-move-article
2117 (gnus-check-backend-function
2118 'request-move-article gnus-newsgroup-name)]
2119 ["Copy article..." gnus-summary-copy-article t]
2120 ["Crosspost article..." gnus-summary-crosspost-article
2121 (gnus-check-backend-function
2122 'request-replace-article gnus-newsgroup-name)]
2123 ["Import file..." gnus-summary-import-article t]
2124 ["Create article..." gnus-summary-create-article t]
2125 ["Check if posted" gnus-summary-article-posted-p t]
2126 ["Edit article" gnus-summary-edit-article
2127 (not (gnus-group-read-only-p))]
2128 ["Delete article" gnus-summary-delete-article
2129 (gnus-check-backend-function
2130 'request-expire-articles gnus-newsgroup-name)]
2131 ["Query respool" gnus-summary-respool-query t]
2132 ["Trace respool" gnus-summary-respool-trace t]
2133 ["Delete expirable articles" gnus-summary-expire-articles-now
2134 (gnus-check-backend-function
2135 'request-expire-articles gnus-newsgroup-name)])
2137 ["Uudecode" gnus-uu-decode-uu
2138 ,@(if (featurep 'xemacs) '(t)
2139 '(:help "Decode uuencoded article(s)"))]
2140 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2141 ["Unshar" gnus-uu-decode-unshar t]
2142 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2143 ["Save" gnus-uu-decode-save t]
2144 ["Binhex" gnus-uu-decode-binhex t]
2145 ["Postscript" gnus-uu-decode-postscript t])
2147 ["Enter article" gnus-cache-enter-article t]
2148 ["Remove article" gnus-cache-remove-article t])
2149 ["Translate" gnus-article-babel t]
2150 ["Select article buffer" gnus-summary-select-article-buffer t]
2151 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2152 ["Isearch article..." gnus-summary-isearch-article t]
2153 ["Beginning of the article" gnus-summary-beginning-of-article t]
2154 ["End of the article" gnus-summary-end-of-article t]
2155 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2156 ["Fetch referenced articles" gnus-summary-refer-references t]
2157 ["Fetch current thread" gnus-summary-refer-thread t]
2158 ["Fetch article with id..." gnus-summary-refer-article t]
2159 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2160 ["Redisplay" gnus-summary-show-article t]
2161 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2163 gnus-summary-article-menu gnus-summary-mode-map ""
2164 (cons "Article" innards))
2166 (if (not (keymapp gnus-summary-article-menu))
2168 gnus-article-commands-menu gnus-article-mode-map ""
2169 (cons "Commands" innards))
2170 ;; in Emacs, don't share menu.
2171 (setq gnus-article-commands-menu
2172 (copy-keymap gnus-summary-article-menu))
2173 (define-key gnus-article-mode-map [menu-bar commands]
2174 (cons "Commands" gnus-article-commands-menu))))
2177 gnus-summary-thread-menu gnus-summary-mode-map ""
2179 ["Toggle threading" gnus-summary-toggle-threads t]
2180 ["Hide threads" gnus-summary-hide-all-threads t]
2181 ["Show threads" gnus-summary-show-all-threads t]
2182 ["Hide thread" gnus-summary-hide-thread t]
2183 ["Show thread" gnus-summary-show-thread t]
2184 ["Go to next thread" gnus-summary-next-thread t]
2185 ["Go to previous thread" gnus-summary-prev-thread t]
2186 ["Go down thread" gnus-summary-down-thread t]
2187 ["Go up thread" gnus-summary-up-thread t]
2188 ["Top of thread" gnus-summary-top-thread t]
2189 ["Mark thread as read" gnus-summary-kill-thread t]
2190 ["Lower thread score" gnus-summary-lower-thread t]
2191 ["Raise thread score" gnus-summary-raise-thread t]
2192 ["Rethread current" gnus-summary-rethread-current t]))
2195 gnus-summary-post-menu gnus-summary-mode-map ""
2197 ["Send a message (mail or news)" gnus-summary-post-news
2198 ,@(if (featurep 'xemacs) '(t)
2199 '(:help "Post an article"))]
2200 ["Followup" gnus-summary-followup
2201 ,@(if (featurep 'xemacs) '(t)
2202 '(:help "Post followup to this article"))]
2203 ["Followup and yank" gnus-summary-followup-with-original
2204 ,@(if (featurep 'xemacs) '(t)
2205 '(:help "Post followup to this article, quoting its contents"))]
2206 ["Supersede article" gnus-summary-supersede-article t]
2207 ["Cancel article" gnus-summary-cancel-article
2208 ,@(if (featurep 'xemacs) '(t)
2209 '(:help "Cancel an article you posted"))]
2210 ["Reply" gnus-summary-reply t]
2211 ["Reply and yank" gnus-summary-reply-with-original t]
2212 ["Wide reply" gnus-summary-wide-reply t]
2213 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2214 ,@(if (featurep 'xemacs) '(t)
2215 '(:help "Mail a reply, quoting this article"))]
2216 ["Very wide reply" gnus-summary-very-wide-reply t]
2217 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2218 ,@(if (featurep 'xemacs) '(t)
2219 '(:help "Mail a very wide reply, quoting this article"))]
2220 ["Mail forward" gnus-summary-mail-forward t]
2221 ["Post forward" gnus-summary-post-forward t]
2222 ["Digest and mail" gnus-summary-digest-mail-forward t]
2223 ["Digest and post" gnus-summary-digest-post-forward t]
2224 ["Resend message" gnus-summary-resend-message t]
2225 ["Resend message edit" gnus-summary-resend-message-edit t]
2226 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2227 ["Send a mail" gnus-summary-mail-other-window t]
2228 ["Create a local message" gnus-summary-news-other-window t]
2229 ["Uuencode and post" gnus-uu-post-news
2230 ,@(if (featurep 'xemacs) '(t)
2231 '(:help "Post a uuencoded article"))]
2232 ["Followup via news" gnus-summary-followup-to-mail t]
2233 ["Followup via news and yank"
2234 gnus-summary-followup-to-mail-with-original t]
2236 ;;["Send" gnus-summary-send-draft t]
2237 ;;["Send bounced" gnus-resend-bounced-mail t])
2241 ((not (keymapp gnus-summary-post-menu))
2242 (setq gnus-article-post-menu gnus-summary-post-menu))
2243 ((not gnus-article-post-menu)
2244 ;; Don't share post menu.
2245 (setq gnus-article-post-menu
2246 (copy-keymap gnus-summary-post-menu))))
2247 (define-key gnus-article-mode-map [menu-bar post]
2248 (cons "Post" gnus-article-post-menu))
2251 gnus-summary-misc-menu gnus-summary-mode-map ""
2254 ["Mark as read" gnus-summary-mark-as-read-forward t]
2255 ["Mark same subject and select"
2256 gnus-summary-kill-same-subject-and-select t]
2257 ["Mark same subject" gnus-summary-kill-same-subject t]
2258 ["Catchup" gnus-summary-catchup
2259 ,@(if (featurep 'xemacs) '(t)
2260 '(:help "Mark unread articles in this group as read"))]
2261 ["Catchup all" gnus-summary-catchup-all t]
2262 ["Catchup to here" gnus-summary-catchup-to-here t]
2263 ["Catchup from here" gnus-summary-catchup-from-here t]
2264 ["Catchup region" gnus-summary-mark-region-as-read t]
2265 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2267 ["Tick" gnus-summary-tick-article-forward t]
2268 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2269 ["Remove marks" gnus-summary-clear-mark-forward t]
2270 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2271 ["Set bookmark" gnus-summary-set-bookmark t]
2272 ["Remove bookmark" gnus-summary-remove-bookmark t])
2274 ["Marks..." gnus-summary-limit-to-marks t]
2275 ["Subject..." gnus-summary-limit-to-subject t]
2276 ["Author..." gnus-summary-limit-to-author t]
2277 ["Age..." gnus-summary-limit-to-age t]
2278 ["Extra..." gnus-summary-limit-to-extra t]
2279 ["Score..." gnus-summary-limit-to-score t]
2280 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2281 ["Unread" gnus-summary-limit-to-unread t]
2282 ["Unseen" gnus-summary-limit-to-unseen t]
2283 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2284 ["Next articles" gnus-summary-limit-to-articles t]
2285 ["Pop limit" gnus-summary-pop-limit t]
2286 ["Show dormant" gnus-summary-limit-include-dormant t]
2287 ["Hide childless dormant"
2288 gnus-summary-limit-exclude-childless-dormant t]
2289 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2290 ["Hide marked" gnus-summary-limit-exclude-marks t]
2291 ["Show expunged" gnus-summary-limit-include-expunged t])
2293 ["Set mark" gnus-summary-mark-as-processable t]
2294 ["Remove mark" gnus-summary-unmark-as-processable t]
2295 ["Remove all marks" gnus-summary-unmark-all-processable t]
2296 ["Mark above" gnus-uu-mark-over t]
2297 ["Mark series" gnus-uu-mark-series t]
2298 ["Mark region" gnus-uu-mark-region t]
2299 ["Unmark region" gnus-uu-unmark-region t]
2300 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2301 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2302 ["Mark all" gnus-uu-mark-all t]
2303 ["Mark buffer" gnus-uu-mark-buffer t]
2304 ["Mark sparse" gnus-uu-mark-sparse t]
2305 ["Mark thread" gnus-uu-mark-thread t]
2306 ["Unmark thread" gnus-uu-unmark-thread t]
2307 ("Process Mark Sets"
2308 ["Kill" gnus-summary-kill-process-mark t]
2309 ["Yank" gnus-summary-yank-process-mark
2310 gnus-newsgroup-process-stack]
2311 ["Save" gnus-summary-save-process-mark t]))
2313 ["Page forward" gnus-summary-next-page
2314 ,@(if (featurep 'xemacs) '(t)
2315 '(:help "Show next page of article"))]
2316 ["Page backward" gnus-summary-prev-page
2317 ,@(if (featurep 'xemacs) '(t)
2318 '(:help "Show previous page of article"))]
2319 ["Line forward" gnus-summary-scroll-up t])
2321 ["Next unread article" gnus-summary-next-unread-article t]
2322 ["Previous unread article" gnus-summary-prev-unread-article t]
2323 ["Next article" gnus-summary-next-article t]
2324 ["Previous article" gnus-summary-prev-article t]
2325 ["Next unread subject" gnus-summary-next-unread-subject t]
2326 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2327 ["Next article same subject" gnus-summary-next-same-subject t]
2328 ["Previous article same subject" gnus-summary-prev-same-subject t]
2329 ["First unread article" gnus-summary-first-unread-article t]
2330 ["Best unread article" gnus-summary-best-unread-article t]
2331 ["Go to subject number..." gnus-summary-goto-subject t]
2332 ["Go to article number..." gnus-summary-goto-article t]
2333 ["Go to the last article" gnus-summary-goto-last-article t]
2334 ["Pop article off history" gnus-summary-pop-article t])
2336 ["Sort by number" gnus-summary-sort-by-number t]
2337 ["Sort by author" gnus-summary-sort-by-author t]
2338 ["Sort by subject" gnus-summary-sort-by-subject t]
2339 ["Sort by date" gnus-summary-sort-by-date t]
2340 ["Sort by score" gnus-summary-sort-by-score t]
2341 ["Sort by lines" gnus-summary-sort-by-lines t]
2342 ["Sort by characters" gnus-summary-sort-by-chars t]
2343 ["Randomize" gnus-summary-sort-by-random t]
2344 ["Original sort" gnus-summary-sort-by-original t])
2346 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2347 ["Describe group" gnus-summary-describe-group t]
2348 ["Fetch charter" gnus-group-fetch-charter
2349 ,@(if (featurep 'xemacs) nil
2350 '(:help "Display the charter of the current group"))]
2351 ["Fetch control message" gnus-group-fetch-control
2352 ,@(if (featurep 'xemacs) nil
2353 '(:help "Display the archived control message for the current group"))]
2354 ["Read manual" gnus-info-find-node t])
2356 ["Pick and read" gnus-pick-mode t]
2357 ["Binary" gnus-binary-mode t])
2359 ["Regenerate" gnus-summary-prepare t]
2360 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2361 ["Toggle threading" gnus-summary-toggle-threads t])
2362 ["See old articles" gnus-summary-insert-old-articles t]
2363 ["See new articles" gnus-summary-insert-new-articles t]
2364 ["Filter articles..." gnus-summary-execute-command t]
2365 ["Run command on subjects..." gnus-summary-universal-argument t]
2366 ["Search articles forward..." gnus-summary-search-article-forward t]
2367 ["Search articles backward..." gnus-summary-search-article-backward t]
2368 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2369 ["Expand window" gnus-summary-expand-window t]
2370 ["Expire expirable articles" gnus-summary-expire-articles
2371 (gnus-check-backend-function
2372 'request-expire-articles gnus-newsgroup-name)]
2373 ["Edit local kill file" gnus-summary-edit-local-kill t]
2374 ["Edit main kill file" gnus-summary-edit-global-kill t]
2375 ["Edit group parameters" gnus-summary-edit-parameters t]
2376 ["Customize group parameters" gnus-summary-customize-parameters t]
2377 ["Send a bug report" gnus-bug t]
2379 ["Catchup and exit" gnus-summary-catchup-and-exit
2380 ,@(if (featurep 'xemacs) '(t)
2381 '(:help "Mark unread articles in this group as read, then exit"))]
2382 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2383 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2384 ["Exit group" gnus-summary-exit
2385 ,@(if (featurep 'xemacs) '(t)
2386 '(:help "Exit current group, return to group selection mode"))]
2387 ["Exit group without updating" gnus-summary-exit-no-update t]
2388 ["Exit and goto next group" gnus-summary-next-group t]
2389 ["Exit and goto prev group" gnus-summary-prev-group t]
2390 ["Reselect group" gnus-summary-reselect-current-group t]
2391 ["Rescan group" gnus-summary-rescan-group t]
2392 ["Update dribble" gnus-summary-save-newsrc t])))
2394 (gnus-run-hooks 'gnus-summary-menu-hook)))
2396 (defvar gnus-summary-tool-bar-map nil)
2398 ;; Emacs 21 tool bar. Should be no-op otherwise.
2399 (defun gnus-summary-make-tool-bar ()
2400 (if (and (fboundp 'tool-bar-add-item-from-menu)
2401 (default-value 'tool-bar-mode)
2402 (not gnus-summary-tool-bar-map))
2403 (setq gnus-summary-tool-bar-map
2404 (let ((tool-bar-map (make-sparse-keymap))
2405 (load-path (mm-image-load-path)))
2406 (tool-bar-add-item-from-menu
2407 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2408 (tool-bar-add-item-from-menu
2409 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2410 (tool-bar-add-item-from-menu
2411 'gnus-summary-post-news "post" gnus-summary-mode-map)
2412 (tool-bar-add-item-from-menu
2413 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2414 (tool-bar-add-item-from-menu
2415 'gnus-summary-followup "followup" gnus-summary-mode-map)
2416 (tool-bar-add-item-from-menu
2417 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2418 (tool-bar-add-item-from-menu
2419 'gnus-summary-reply "reply" gnus-summary-mode-map)
2420 (tool-bar-add-item-from-menu
2421 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2422 (tool-bar-add-item-from-menu
2423 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2424 (tool-bar-add-item-from-menu
2425 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2426 (tool-bar-add-item-from-menu
2427 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2428 (tool-bar-add-item-from-menu
2429 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2430 (tool-bar-add-item-from-menu
2431 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2432 (tool-bar-add-item-from-menu
2433 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2434 (tool-bar-add-item-from-menu
2435 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2437 (if gnus-summary-tool-bar-map
2438 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2440 (defun gnus-score-set-default (var value)
2441 "A version of set that updates the GNU Emacs menu-bar."
2443 ;; It is the message that forces the active status to be updated.
2446 (defun gnus-make-score-map (type)
2447 "Make a summary score map of type TYPE."
2450 (let ((headers '(("author" "from" string)
2451 ("subject" "subject" string)
2452 ("article body" "body" string)
2453 ("article head" "head" string)
2454 ("xref" "xref" string)
2455 ("extra header" "extra" string)
2456 ("lines" "lines" number)
2457 ("followups to author" "followup" string)))
2458 (types '((number ("less than" <)
2461 (string ("substring" s)
2465 (perms '(("temporary" (current-time-string))
2473 (if (eq type 'lower)
2478 (setq header (car headers))
2484 (let ((ts (cdr (assoc (nth 2 header) types)))
2500 'gnus-summary-score-entry
2502 (if (or (string= (nth 1 header)
2504 (string= (nth 1 header)
2507 (list 'gnus-summary-header
2509 (list 'quote (nth 1 (car ts)))
2510 (list 'gnus-score-delta-default
2517 (list (nreverse outp))))
2520 (list (nreverse outt))))
2522 (setq headers (cdr headers)))
2523 (list (nreverse outh))))))))
2527 (defun gnus-summary-mode (&optional group)
2528 "Major mode for reading articles.
2530 All normal editing commands are switched off.
2531 \\<gnus-summary-mode-map>
2532 Each line in this buffer represents one article. To read an
2533 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2534 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2537 You can also post articles and send mail from this buffer. To
2538 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2539 of an article, type `\\[gnus-summary-reply]'.
2541 There are approx. one gazillion commands you can execute in this
2542 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2544 The following commands are available:
2546 \\{gnus-summary-mode-map}"
2548 (kill-all-local-variables)
2549 (when (gnus-visual-p 'summary-menu 'menu)
2550 (gnus-summary-make-menu-bar)
2551 (gnus-summary-make-tool-bar))
2552 (gnus-summary-make-local-variables)
2553 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2554 (gnus-summary-make-local-variables))
2555 (gnus-make-thread-indent-array)
2556 (gnus-simplify-mode-line)
2557 (setq major-mode 'gnus-summary-mode)
2558 (setq mode-name "Summary")
2559 (make-local-variable 'minor-mode-alist)
2560 (use-local-map gnus-summary-mode-map)
2561 (buffer-disable-undo)
2562 (setq buffer-read-only t) ;Disable modification
2563 (setq truncate-lines t)
2564 (setq selective-display t)
2565 (setq selective-display-ellipses t) ;Display `...'
2566 (gnus-summary-set-display-table)
2567 (gnus-set-default-directory)
2568 (setq gnus-newsgroup-name group)
2569 (unless (gnus-news-group-p group)
2570 (setq gnus-newsgroup-incorporated
2571 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2572 (make-local-variable 'gnus-summary-line-format)
2573 (make-local-variable 'gnus-summary-line-format-spec)
2574 (make-local-variable 'gnus-summary-dummy-line-format)
2575 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2576 (make-local-variable 'gnus-summary-mark-positions)
2577 (make-local-hook 'pre-command-hook)
2578 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2579 (gnus-run-hooks 'gnus-summary-mode-hook)
2580 (turn-on-gnus-mailing-list-mode)
2581 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2582 (gnus-update-summary-mark-positions))
2584 (defun gnus-summary-make-local-variables ()
2585 "Make all the local summary buffer variables."
2587 (dolist (local gnus-summary-local-variables)
2590 (if (eq (cdr local) 'global)
2591 ;; Copy the global value of the variable.
2592 (setq global (symbol-value (car local)))
2593 ;; Use the value from the list.
2594 (setq global (eval (cdr local))))
2595 (set (make-local-variable (car local)) global))
2596 ;; Simple nil-valued local variable.
2597 (set (make-local-variable local) nil)))))
2599 (defun gnus-summary-clear-local-variables ()
2600 (let ((locals gnus-summary-local-variables))
2602 (if (consp (car locals))
2603 (and (vectorp (caar locals))
2604 (set (caar locals) nil))
2605 (and (vectorp (car locals))
2606 (set (car locals) nil)))
2607 (setq locals (cdr locals)))))
2609 ;; Summary data functions.
2611 (defmacro gnus-data-number (data)
2614 (defmacro gnus-data-set-number (data number)
2615 `(setcar ,data ,number))
2617 (defmacro gnus-data-mark (data)
2620 (defmacro gnus-data-set-mark (data mark)
2621 `(setcar (nthcdr 1 ,data) ,mark))
2623 (defmacro gnus-data-pos (data)
2626 (defmacro gnus-data-set-pos (data pos)
2627 `(setcar (nthcdr 2 ,data) ,pos))
2629 (defmacro gnus-data-header (data)
2632 (defmacro gnus-data-set-header (data header)
2633 `(setcar (nthcdr 3 ,data) ,header))
2635 (defmacro gnus-data-level (data)
2638 (defmacro gnus-data-unread-p (data)
2639 `(= (nth 1 ,data) gnus-unread-mark))
2641 (defmacro gnus-data-read-p (data)
2642 `(/= (nth 1 ,data) gnus-unread-mark))
2644 (defmacro gnus-data-pseudo-p (data)
2645 `(consp (nth 3 ,data)))
2647 (defmacro gnus-data-find (number)
2648 `(assq ,number gnus-newsgroup-data))
2650 (defmacro gnus-data-find-list (number &optional data)
2651 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2652 (memq (assq ,number bdata)
2655 (defmacro gnus-data-make (number mark pos header level)
2656 `(list ,number ,mark ,pos ,header ,level))
2658 (defun gnus-data-enter (after-article number mark pos header level offset)
2659 (let ((data (gnus-data-find-list after-article)))
2661 (error "No such article: %d" after-article))
2662 (setcdr data (cons (gnus-data-make number mark pos header level)
2664 (setq gnus-newsgroup-data-reverse nil)
2665 (gnus-data-update-list (cddr data) offset)))
2667 (defun gnus-data-enter-list (after-article list &optional offset)
2669 (let ((data (and after-article (gnus-data-find-list after-article)))
2673 (let ((odata gnus-newsgroup-data))
2674 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2676 (gnus-data-update-list odata offset)))
2677 ;; Find the last element in the list to be spliced into the main
2680 (setq list (cdr list)))
2683 (setcdr list gnus-newsgroup-data)
2684 (setq gnus-newsgroup-data ilist)
2686 (gnus-data-update-list (cdr list) offset)))
2687 (setcdr list (cdr data))
2690 (gnus-data-update-list (cdr list) offset))))
2691 (setq gnus-newsgroup-data-reverse nil))))
2693 (defun gnus-data-remove (article &optional offset)
2694 (let ((data gnus-newsgroup-data))
2695 (if (= (gnus-data-number (car data)) article)
2697 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2698 gnus-newsgroup-data-reverse nil)
2700 (gnus-data-update-list gnus-newsgroup-data offset)))
2702 (when (= (gnus-data-number (cadr data)) article)
2703 (setcdr data (cddr data))
2705 (gnus-data-update-list (cdr data) offset))
2707 gnus-newsgroup-data-reverse nil))
2708 (setq data (cdr data))))))
2710 (defmacro gnus-data-list (backward)
2712 (or gnus-newsgroup-data-reverse
2713 (setq gnus-newsgroup-data-reverse
2714 (reverse gnus-newsgroup-data)))
2715 gnus-newsgroup-data))
2717 (defun gnus-data-update-list (data offset)
2718 "Add OFFSET to the POS of all data entries in DATA."
2719 (setq gnus-newsgroup-data-reverse nil)
2721 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2722 (setq data (cdr data))))
2724 (defun gnus-summary-article-pseudo-p (article)
2725 "Say whether this article is a pseudo article or not."
2726 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2728 (defmacro gnus-summary-article-sparse-p (article)
2729 "Say whether this article is a sparse article or not."
2730 `(memq ,article gnus-newsgroup-sparse))
2732 (defmacro gnus-summary-article-ancient-p (article)
2733 "Say whether this article is a sparse article or not."
2734 `(memq ,article gnus-newsgroup-ancient))
2736 (defun gnus-article-parent-p (number)
2737 "Say whether this article is a parent or not."
2738 (let ((data (gnus-data-find-list number)))
2739 (and (cdr data) ; There has to be an article after...
2740 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2741 (gnus-data-level (nth 1 data))))))
2743 (defun gnus-article-children (number)
2744 "Return a list of all children to NUMBER."
2745 (let* ((data (gnus-data-find-list number))
2746 (level (gnus-data-level (car data)))
2748 (setq data (cdr data))
2750 (= (gnus-data-level (car data)) (1+ level)))
2751 (push (gnus-data-number (car data)) children)
2752 (setq data (cdr data)))
2755 (defmacro gnus-summary-skip-intangible ()
2756 "If the current article is intangible, then jump to a different article."
2757 '(let ((to (get-text-property (point) 'gnus-intangible)))
2758 (and to (gnus-summary-goto-subject to))))
2760 (defmacro gnus-summary-article-intangible-p ()
2761 "Say whether this article is intangible or not."
2762 '(get-text-property (point) 'gnus-intangible))
2764 (defun gnus-article-read-p (article)
2765 "Say whether ARTICLE is read or not."
2766 (not (or (memq article gnus-newsgroup-marked)
2767 (memq article gnus-newsgroup-spam-marked)
2768 (memq article gnus-newsgroup-unreads)
2769 (memq article gnus-newsgroup-unselected)
2770 (memq article gnus-newsgroup-dormant))))
2772 ;; Some summary mode macros.
2774 (defmacro gnus-summary-article-number ()
2775 "The article number of the article on the current line.
2776 If there isn't an article number here, then we return the current
2779 (gnus-summary-skip-intangible)
2780 (or (get-text-property (point) 'gnus-number)
2781 (gnus-summary-last-subject))))
2783 (defmacro gnus-summary-article-header (&optional number)
2784 "Return the header of article NUMBER."
2785 `(gnus-data-header (gnus-data-find
2786 ,(or number '(gnus-summary-article-number)))))
2788 (defmacro gnus-summary-thread-level (&optional number)
2789 "Return the level of thread that starts with article NUMBER."
2790 `(if (and (eq gnus-summary-make-false-root 'dummy)
2791 (get-text-property (point) 'gnus-intangible))
2793 (gnus-data-level (gnus-data-find
2794 ,(or number '(gnus-summary-article-number))))))
2796 (defmacro gnus-summary-article-mark (&optional number)
2797 "Return the mark of article NUMBER."
2798 `(gnus-data-mark (gnus-data-find
2799 ,(or number '(gnus-summary-article-number)))))
2801 (defmacro gnus-summary-article-pos (&optional number)
2802 "Return the position of the line of article NUMBER."
2803 `(gnus-data-pos (gnus-data-find
2804 ,(or number '(gnus-summary-article-number)))))
2806 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2807 (defmacro gnus-summary-article-subject (&optional number)
2808 "Return current subject string or nil if nothing."
2811 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2812 '(gnus-data-header (assq (gnus-summary-article-number)
2813 gnus-newsgroup-data)))))
2816 (mail-header-subject headers))))
2818 (defmacro gnus-summary-article-score (&optional number)
2819 "Return current article score."
2820 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2821 gnus-newsgroup-scored))
2822 gnus-summary-default-score 0))
2824 (defun gnus-summary-article-children (&optional number)
2825 "Return a list of article numbers that are children of article NUMBER."
2826 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2827 (level (gnus-data-level (car data)))
2829 (while (and (setq data (cdr data))
2830 (> (setq l (gnus-data-level (car data))) level))
2831 (and (= (1+ level) l)
2832 (push (gnus-data-number (car data))
2834 (nreverse children)))
2836 (defun gnus-summary-article-parent (&optional number)
2837 "Return the article number of the parent of article NUMBER."
2838 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2839 (gnus-data-list t)))
2840 (level (gnus-data-level (car data))))
2842 () ; This is a root.
2843 ;; We search until we find an article with a level less than
2844 ;; this one. That function has to be the parent.
2845 (while (and (setq data (cdr data))
2846 (not (< (gnus-data-level (car data)) level))))
2847 (and data (gnus-data-number (car data))))))
2849 (defun gnus-unread-mark-p (mark)
2850 "Say whether MARK is the unread mark."
2851 (= mark gnus-unread-mark))
2853 (defun gnus-read-mark-p (mark)
2854 "Say whether MARK is one of the marks that mark as read.
2855 This is all marks except unread, ticked, dormant, and expirable."
2856 (not (or (= mark gnus-unread-mark)
2857 (= mark gnus-ticked-mark)
2858 (= mark gnus-dormant-mark)
2859 (= mark gnus-expirable-mark))))
2861 (defmacro gnus-article-mark (number)
2862 "Return the MARK of article NUMBER.
2863 This macro should only be used when computing the mark the \"first\"
2864 time; i.e., when generating the summary lines. After that,
2865 `gnus-summary-article-mark' should be used to examine the
2868 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2869 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2870 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2871 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2872 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
2873 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2874 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2875 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2876 gnus-ancient-mark))))
2878 ;; Saving hidden threads.
2880 (defmacro gnus-save-hidden-threads (&rest forms)
2881 "Save hidden threads, eval FORMS, and restore the hidden threads."
2882 (let ((config (make-symbol "config")))
2883 `(let ((,config (gnus-hidden-threads-configuration)))
2887 (gnus-restore-hidden-threads-configuration ,config)))))
2888 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2889 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2891 (defun gnus-data-compute-positions ()
2892 "Compute the positions of all articles."
2893 (setq gnus-newsgroup-data-reverse nil)
2894 (let ((data gnus-newsgroup-data))
2896 (gnus-save-hidden-threads
2897 (gnus-summary-show-all-threads)
2898 (goto-char (point-min))
2900 (while (get-text-property (point) 'gnus-intangible)
2902 (gnus-data-set-pos (car data) (+ (point) 3))
2903 (setq data (cdr data))
2904 (forward-line 1))))))
2906 (defun gnus-hidden-threads-configuration ()
2907 "Return the current hidden threads configuration."
2910 (goto-char (point-min))
2911 (while (search-forward "\r" nil t)
2912 (push (1- (point)) config))
2915 (defun gnus-restore-hidden-threads-configuration (config)
2916 "Restore hidden threads configuration from CONFIG."
2918 (let (point buffer-read-only)
2919 (while (setq point (pop config))
2920 (when (and (< point (point-max))
2922 (eq (char-after) ?\n))
2923 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2925 ;; Various summary mode internalish functions.
2927 (defun gnus-mouse-pick-article (e)
2930 (gnus-summary-next-page nil t))
2932 (defun gnus-summary-set-display-table ()
2933 "Change the display table.
2934 Odd characters have a tendency to mess
2935 up nicely formatted displays - we make all possible glyphs
2936 display only a single character."
2938 ;; We start from the standard display table, if any.
2939 (let ((table (or (copy-sequence standard-display-table)
2940 (make-display-table)))
2942 ;; Nix out all the control chars...
2943 (while (>= (setq i (1- i)) 0)
2944 (aset table i [??]))
2945 ;; ... but not newline and cr, of course. (cr is necessary for the
2946 ;; selective display).
2947 (aset table ?\n nil)
2948 (aset table ?\r nil)
2949 ;; We keep TAB as well.
2950 (aset table ?\t nil)
2951 ;; We nix out any glyphs over 126 that are not set already.
2953 (while (>= (setq i (1- i)) 127)
2954 ;; Only modify if the entry is nil.
2955 (unless (aref table i)
2956 (aset table i [??]))))
2957 (setq buffer-display-table table)))
2959 (defun gnus-summary-set-article-display-arrow (pos)
2960 "Update the overlay arrow to point to line at position POS."
2961 (when (and gnus-summary-display-arrow
2962 (boundp 'overlay-arrow-position)
2963 (boundp 'overlay-arrow-string))
2967 (unless overlay-arrow-position
2968 (setq overlay-arrow-position (make-marker)))
2969 (setq overlay-arrow-string "=>"
2970 overlay-arrow-position (set-marker overlay-arrow-position
2972 (current-buffer))))))
2974 (defun gnus-summary-buffer-name (group)
2975 "Return the summary buffer name of GROUP."
2976 (concat "*Summary " (gnus-group-decoded-name group) "*"))
2978 (defun gnus-summary-setup-buffer (group)
2979 "Initialize summary buffer."
2980 (let ((buffer (gnus-summary-buffer-name group))
2981 (dead-name (concat "*Dead Summary "
2982 (gnus-group-decoded-name group) "*")))
2983 ;; If a dead summary buffer exists, we kill it.
2984 (when (gnus-buffer-live-p dead-name)
2985 (gnus-kill-buffer dead-name))
2986 (if (get-buffer buffer)
2989 (setq gnus-summary-buffer (current-buffer))
2990 (not gnus-newsgroup-prepared))
2991 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2992 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2993 (gnus-summary-mode group)
2995 (gnus-carpal-setup-buffer 'summary))
2996 (unless gnus-single-article-buffer
2997 (make-local-variable 'gnus-article-buffer)
2998 (make-local-variable 'gnus-article-current)
2999 (make-local-variable 'gnus-original-article-buffer))
3000 (setq gnus-newsgroup-name group)
3001 ;; Set any local variables in the group parameters.
3002 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3005 (defun gnus-set-global-variables ()
3006 "Set the global equivalents of the buffer-local variables.
3007 They are set to the latest values they had. These reflect the summary
3008 buffer that was in action when the last article was fetched."
3009 (when (eq major-mode 'gnus-summary-mode)
3010 (setq gnus-summary-buffer (current-buffer))
3011 (let ((name gnus-newsgroup-name)
3012 (marked gnus-newsgroup-marked)
3013 (spam gnus-newsgroup-spam-marked)
3014 (unread gnus-newsgroup-unreads)
3015 (headers gnus-current-headers)
3016 (data gnus-newsgroup-data)
3017 (summary gnus-summary-buffer)
3018 (article-buffer gnus-article-buffer)
3019 (original gnus-original-article-buffer)
3020 (gac gnus-article-current)
3021 (reffed gnus-reffed-article-number)
3022 (score-file gnus-current-score-file)
3023 (default-charset gnus-newsgroup-charset)
3025 (let ((locals gnus-newsgroup-variables))
3027 (if (consp (car locals))
3028 (push (eval (caar locals)) vlist)
3029 (push (eval (car locals)) vlist))
3030 (setq locals (cdr locals)))
3031 (setq vlist (nreverse vlist)))
3033 (set-buffer gnus-group-buffer)
3034 (setq gnus-newsgroup-name name
3035 gnus-newsgroup-marked marked
3036 gnus-newsgroup-spam-marked spam
3037 gnus-newsgroup-unreads unread
3038 gnus-current-headers headers
3039 gnus-newsgroup-data data
3040 gnus-article-current gac
3041 gnus-summary-buffer summary
3042 gnus-article-buffer article-buffer
3043 gnus-original-article-buffer original
3044 gnus-reffed-article-number reffed
3045 gnus-current-score-file score-file
3046 gnus-newsgroup-charset default-charset)
3047 (let ((locals gnus-newsgroup-variables))
3049 (if (consp (car locals))
3050 (set (caar locals) (pop vlist))
3051 (set (car locals) (pop vlist)))
3052 (setq locals (cdr locals))))
3053 ;; The article buffer also has local variables.
3054 (when (gnus-buffer-live-p gnus-article-buffer)
3055 (set-buffer gnus-article-buffer)
3056 (setq gnus-summary-buffer summary))))))
3058 (defun gnus-summary-article-unread-p (article)
3059 "Say whether ARTICLE is unread or not."
3060 (memq article gnus-newsgroup-unreads))
3062 (defun gnus-summary-first-article-p (&optional article)
3063 "Return whether ARTICLE is the first article in the buffer."
3064 (if (not (setq article (or article (gnus-summary-article-number))))
3066 (eq article (caar gnus-newsgroup-data))))
3068 (defun gnus-summary-last-article-p (&optional article)
3069 "Return whether ARTICLE is the last article in the buffer."
3070 (if (not (setq article (or article (gnus-summary-article-number))))
3071 ;; All non-existent numbers are the last article. :-)
3073 (not (cdr (gnus-data-find-list article)))))
3075 (defun gnus-make-thread-indent-array ()
3077 (unless (and gnus-thread-indent-array
3078 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3079 (setq gnus-thread-indent-array (make-vector 201 "")
3080 gnus-thread-indent-array-level gnus-thread-indent-level)
3082 (aset gnus-thread-indent-array n
3083 (make-string (* n gnus-thread-indent-level) ? ))
3086 (defun gnus-update-summary-mark-positions ()
3087 "Compute where the summary marks are to go."
3089 (when (gnus-buffer-exists-p gnus-summary-buffer)
3090 (set-buffer gnus-summary-buffer))
3091 (let ((gnus-replied-mark 129)
3092 (gnus-score-below-mark 130)
3093 (gnus-score-over-mark 130)
3094 (gnus-downloaded-mark 131)
3095 (spec gnus-summary-line-format-spec)
3098 (gnus-set-work-buffer)
3099 (let ((gnus-summary-line-format-spec spec)
3100 (gnus-newsgroup-downloadable '(0)))
3101 (gnus-summary-insert-line
3102 (make-full-mail-header 0 "" "nobody"
3103 "05 Apr 2001 23:33:09 +0400"
3105 0 nil nil 128 t nil "" nil 1)
3106 (goto-char (point-min))
3107 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3108 (- (point) (point-min) 1)))))
3109 (goto-char (point-min))
3110 (push (cons 'replied (and (search-forward "\201" nil t)
3111 (- (point) (point-min) 1)))
3113 (goto-char (point-min))
3114 (push (cons 'score (and (search-forward "\202" nil t)
3115 (- (point) (point-min) 1)))
3117 (goto-char (point-min))
3118 (push (cons 'download
3119 (and (search-forward "\203" nil t)
3120 (- (point) (point-min) 1)))
3122 (setq gnus-summary-mark-positions pos))))
3124 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3125 "Insert a dummy root in the summary buffer."
3127 (gnus-add-text-properties
3128 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3129 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3131 (defun gnus-summary-extract-address-component (from)
3132 (or (car (funcall gnus-extract-address-components from))
3135 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3136 (let ((default-mime-charset (with-current-buffer gnus-summary-buffer
3137 default-mime-charset)))
3138 ;; Is it really necessary to do this next part for each summary line?
3139 ;; Luckily, doesn't seem to slow things down much.
3141 (and gnus-ignored-from-addresses
3142 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3143 (let ((extra-headers (mail-header-extra header))
3147 ((setq to (cdr (assq 'To extra-headers)))
3150 (gnus-summary-extract-address-component
3151 (funcall gnus-decode-encoded-word-function to)))))
3152 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3153 (concat "=> " newsgroups)))))
3154 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3156 (defun gnus-summary-insert-line (gnus-tmp-header
3157 gnus-tmp-level gnus-tmp-current
3158 undownloaded gnus-tmp-unread gnus-tmp-replied
3159 gnus-tmp-expirable gnus-tmp-subject-or-nil
3160 &optional gnus-tmp-dummy gnus-tmp-score
3162 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3163 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3164 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3165 (gnus-tmp-score-char
3166 (if (or (null gnus-summary-default-score)
3167 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3168 gnus-summary-zcore-fuzz))
3170 (if (< gnus-tmp-score gnus-summary-default-score)
3171 gnus-score-below-mark gnus-score-over-mark)))
3172 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3174 (cond (gnus-tmp-process gnus-process-mark)
3175 ((memq gnus-tmp-current gnus-newsgroup-cached)
3177 (gnus-tmp-replied gnus-replied-mark)
3178 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3179 gnus-forwarded-mark)
3180 ((memq gnus-tmp-current gnus-newsgroup-saved)
3182 ((memq gnus-tmp-number gnus-newsgroup-recent)
3184 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3187 (gnus-tmp-downloaded
3189 gnus-undownloaded-mark)
3190 (gnus-newsgroup-agentized
3191 gnus-downloaded-mark)
3194 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3197 ((string-match "<[^>]+> *$" gnus-tmp-from)
3198 (let ((beg (match-beginning 0)))
3199 (or (and (string-match "^\".+\"" gnus-tmp-from)
3200 (substring gnus-tmp-from 1 (1- (match-end 0))))
3201 (substring gnus-tmp-from 0 beg))))
3202 ((string-match "(.+)" gnus-tmp-from)
3203 (substring gnus-tmp-from
3204 (1+ (match-beginning 0)) (1- (match-end 0))))
3206 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3207 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3208 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3209 (buffer-read-only nil))
3210 (when (string= gnus-tmp-name "")
3211 (setq gnus-tmp-name gnus-tmp-from))
3212 (unless (numberp gnus-tmp-lines)
3213 (setq gnus-tmp-lines -1))
3214 (if (= gnus-tmp-lines -1)
3215 (setq gnus-tmp-lines "?")
3216 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3217 (gnus-put-text-property-excluding-characters-with-faces
3219 (progn (eval gnus-summary-line-format-spec) (point))
3220 'gnus-number gnus-tmp-number)
3221 (when (gnus-visual-p 'summary-highlight 'highlight)
3223 (gnus-run-hooks 'gnus-summary-update-hook)
3226 (defun gnus-summary-update-line (&optional dont-update)
3227 "Update summary line after change."
3228 (when (and gnus-summary-default-score
3229 (not gnus-summary-inhibit-highlight))
3230 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3231 (article (gnus-summary-article-number))
3232 (score (gnus-summary-article-score article)))
3234 (if (and gnus-summary-mark-below
3235 (< (gnus-summary-article-score)
3236 gnus-summary-mark-below))
3237 ;; This article has a low score, so we mark it as read.
3238 (when (memq article gnus-newsgroup-unreads)
3239 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3240 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3241 ;; This article was previously marked as read on account
3242 ;; of a low score, but now it has risen, so we mark it as
3244 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3245 (gnus-summary-update-mark
3246 (if (or (null gnus-summary-default-score)
3247 (<= (abs (- score gnus-summary-default-score))
3248 gnus-summary-zcore-fuzz))
3250 (if (< score gnus-summary-default-score)
3251 gnus-score-below-mark gnus-score-over-mark))
3253 ;; Do visual highlighting.
3254 (when (gnus-visual-p 'summary-highlight 'highlight)
3255 (gnus-run-hooks 'gnus-summary-update-hook)))))
3257 (defvar gnus-tmp-new-adopts nil)
3259 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3260 "Return the number of articles in THREAD.
3261 This may be 0 in some cases -- if none of the articles in
3262 the thread are to be displayed."
3264 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3266 ((not (listp thread))
3268 ((and (consp thread) (cdr thread))
3271 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3274 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3277 (when (and level (zerop level) gnus-tmp-new-adopts)
3280 'gnus-summary-number-of-articles-in-thread
3281 gnus-tmp-new-adopts))))
3283 (if (> number 1) gnus-not-empty-thread-mark
3284 gnus-empty-thread-mark)
3287 (defsubst gnus-summary-line-message-size (head)
3288 "Return pretty-printed version of message size.
3289 This function is intended to be used in
3290 `gnus-summary-line-format-alist', which see."
3291 (let ((c (or (mail-header-chars head) -1)))
3292 (cond ((< c 0) "n/a") ; chars not available
3293 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3294 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3295 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3296 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3299 (defun gnus-summary-set-local-parameters (group)
3300 "Go through the local params of GROUP and set all variable specs in that list."
3301 (let ((params (gnus-group-find-parameter group))
3302 (vars '(quit-config)) ; Ignore quit-config.
3305 (setq elem (car params)
3306 params (cdr params))
3307 (and (consp elem) ; Has to be a cons.
3308 (consp (cdr elem)) ; The cdr has to be a list.
3309 (symbolp (car elem)) ; Has to be a symbol in there.
3310 (not (memq (car elem) vars))
3311 (ignore-errors ; So we set it.
3312 (push (car elem) vars)
3313 (make-local-variable (car elem))
3314 (set (car elem) (eval (nth 1 elem))))))))
3316 (defun gnus-summary-read-group (group &optional show-all no-article
3317 kill-buffer no-display backward
3319 "Start reading news in newsgroup GROUP.
3320 If SHOW-ALL is non-nil, already read articles are also listed.
3321 If NO-ARTICLE is non-nil, no article is selected initially.
3322 If NO-DISPLAY, don't generate a summary buffer."
3326 (let ((gnus-auto-select-next nil))
3327 (or (gnus-summary-read-group-1
3328 group show-all no-article
3329 kill-buffer no-display
3332 select-articles nil)))))
3333 (eq gnus-auto-select-next 'quietly))
3334 (set-buffer gnus-group-buffer)
3335 ;; The entry function called above goes to the next
3336 ;; group automatically, so we go two groups back
3337 ;; if we are searching for the previous group.
3339 (gnus-group-prev-unread-group 2))
3340 (if (not (equal group (gnus-group-group-name)))
3341 (setq group (gnus-group-group-name))
3345 (defun gnus-summary-jump-to-other-group (group &optional show-all)
3346 "Directly jump to the other GROUP from summary buffer.
3347 If SHOW-ALL is non-nil, already read articles are also listed."
3349 (if (eq gnus-summary-buffer (current-buffer))
3350 (list (completing-read
3351 "Group: " gnus-active-hashtb nil t
3352 (when (and gnus-newsgroup-name
3353 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
3354 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
3355 'gnus-group-history)
3357 (error "%s must be invoked from a gnus summary buffer." this-command)))
3358 (unless (or (zerop (length group))
3359 (and gnus-newsgroup-name
3360 (string-equal gnus-newsgroup-name group)))
3362 (gnus-summary-read-group group show-all
3363 gnus-dont-select-after-jump-to-other-group)))
3365 (defun gnus-summary-read-group-1 (group show-all no-article
3366 kill-buffer no-display
3367 &optional select-articles)
3368 ;; Killed foreign groups can't be entered.
3369 ;; (when (and (not (gnus-group-native-p group))
3370 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3371 ;; (error "Dead non-native groups can't be entered"))
3372 (gnus-message 5 "Retrieving newsgroup: %s..."
3373 (gnus-group-decoded-name group))
3374 (let* ((new-group (gnus-summary-setup-buffer group))
3375 (quit-config (gnus-group-quit-config group))
3376 (did-select (and new-group (gnus-select-newsgroup
3377 group show-all select-articles))))
3379 ;; This summary buffer exists already, so we just select it.
3381 (gnus-set-global-variables)
3383 (gnus-kill-or-deaden-summary kill-buffer))
3384 (gnus-configure-windows 'summary 'force)
3385 (gnus-set-mode-line 'summary)
3386 (gnus-summary-position-point)
3389 ;; We couldn't select this group.
3391 (when (and (eq major-mode 'gnus-summary-mode)
3392 (not (equal (current-buffer) kill-buffer)))
3393 (kill-buffer (current-buffer))
3394 (if (not quit-config)
3396 ;; Update the info -- marks might need to be removed,
3398 (gnus-summary-update-info)
3399 (set-buffer gnus-group-buffer)
3400 (gnus-group-jump-to-group group)
3401 (gnus-group-next-unread-group 1))
3402 (gnus-handle-ephemeral-exit quit-config)))
3403 (let ((grpinfo (gnus-get-info group)))
3404 (if (null (gnus-info-read grpinfo))
3405 (gnus-message 3 "Group %s contains no messages"
3406 (gnus-group-decoded-name group))
3407 (gnus-message 3 "Can't select group")))
3409 ;; The user did a `C-g' while prompting for number of articles,
3410 ;; so we exit this group.
3411 ((eq did-select 'quit)
3412 (and (eq major-mode 'gnus-summary-mode)
3413 (not (equal (current-buffer) kill-buffer))
3414 (kill-buffer (current-buffer)))
3416 (gnus-kill-or-deaden-summary kill-buffer))
3417 (if (not quit-config)
3419 (set-buffer gnus-group-buffer)
3420 (gnus-group-jump-to-group group)
3421 (gnus-group-next-unread-group 1)
3422 (gnus-configure-windows 'group 'force))
3423 (gnus-handle-ephemeral-exit quit-config))
3424 ;; Finally signal the quit.
3426 ;; The group was successfully selected.
3428 (gnus-set-global-variables)
3429 ;; Save the active value in effect when the group was entered.
3430 (setq gnus-newsgroup-active
3432 (gnus-active gnus-newsgroup-name)))
3433 ;; You can change the summary buffer in some way with this hook.
3434 (gnus-run-hooks 'gnus-select-group-hook)
3435 (gnus-update-format-specifications
3436 nil 'summary 'summary-mode 'summary-dummy)
3437 (gnus-update-summary-mark-positions)
3438 ;; Do score processing.
3439 (when gnus-use-scoring
3440 (gnus-possibly-score-headers))
3441 ;; Check whether to fill in the gaps in the threads.
3442 (when gnus-build-sparse-threads
3443 (gnus-build-sparse-threads))
3444 ;; Find the initial limit.
3445 (if gnus-show-threads
3447 (let ((gnus-newsgroup-dormant nil))
3448 (gnus-summary-initial-limit show-all))
3449 (gnus-summary-initial-limit show-all))
3450 ;; When unthreaded, all articles are always shown.
3451 (setq gnus-newsgroup-limit
3453 (lambda (header) (mail-header-number header))
3454 gnus-newsgroup-headers)))
3455 ;; Generate the summary buffer.
3457 (gnus-summary-prepare))
3458 (when gnus-use-trees
3459 (gnus-tree-open group)
3460 (setq gnus-summary-highlight-line-function
3461 'gnus-tree-highlight-article))
3462 ;; If the summary buffer is empty, but there are some low-scored
3463 ;; articles or some excluded dormants, we include these in the
3465 (when (and (zerop (buffer-size))
3467 (cond (gnus-newsgroup-dormant
3468 (gnus-summary-limit-include-dormant))
3469 ((and gnus-newsgroup-scored show-all)
3470 (gnus-summary-limit-include-expunged t))))
3471 ;; Function `gnus-apply-kill-file' must be called in this hook.
3472 (gnus-run-hooks 'gnus-apply-kill-hook)
3473 (if (and (zerop (buffer-size))
3476 ;; This newsgroup is empty.
3477 (gnus-summary-catchup-and-exit nil t)
3478 (gnus-message 6 "No unread news")
3480 (gnus-kill-or-deaden-summary kill-buffer))
3481 ;; Return nil from this function.
3483 ;; Hide conversation thread subtrees. We cannot do this in
3484 ;; gnus-summary-prepare-hook since kill processing may not
3485 ;; work with hidden articles.
3486 (gnus-summary-maybe-hide-threads)
3488 (gnus-kill-or-deaden-summary kill-buffer))
3489 (gnus-summary-auto-select-subject)
3490 ;; Show first unread article if requested.
3491 (if (and (not no-article)
3493 gnus-newsgroup-unreads
3494 gnus-auto-select-first)
3496 (gnus-configure-windows 'summary)
3497 (let ((art (gnus-summary-article-number)))
3498 (unless (or (memq art gnus-newsgroup-undownloaded)
3499 (memq art gnus-newsgroup-downloadable))
3500 (gnus-summary-goto-article art))))
3501 ;; Don't select any articles.
3502 (gnus-summary-position-point)
3503 (gnus-configure-windows 'summary 'force)
3504 (gnus-set-mode-line 'summary))
3505 (when (get-buffer-window gnus-group-buffer t)
3506 ;; Gotta use windows, because recenter does weird stuff if
3507 ;; the current buffer ain't the displayed window.
3508 (let ((owin (selected-window)))
3509 (select-window (get-buffer-window gnus-group-buffer t))
3510 (when (gnus-group-goto-group group)
3512 (select-window owin)))
3513 ;; Mark this buffer as "prepared".
3514 (setq gnus-newsgroup-prepared t)
3515 (gnus-run-hooks 'gnus-summary-prepared-hook)
3518 (defun gnus-summary-auto-select-subject ()
3519 "Select the subject line on initial group entry."
3520 (goto-char (point-min))
3522 ((eq gnus-auto-select-subject 'best)
3523 (gnus-summary-best-unread-subject))
3524 ((eq gnus-auto-select-subject 'unread)
3525 (gnus-summary-first-unread-subject))
3526 ((eq gnus-auto-select-subject 'unseen)
3527 (gnus-summary-first-unseen-subject))
3528 ((eq gnus-auto-select-subject 'unseen-or-unread)
3529 (gnus-summary-first-unseen-or-unread-subject))
3530 ((eq gnus-auto-select-subject 'first)
3533 ((gnus-functionp gnus-auto-select-subject)
3534 (funcall gnus-auto-select-subject))))
3536 (defun gnus-summary-prepare ()
3537 "Generate the summary buffer."
3539 (let ((buffer-read-only nil))
3541 (setq gnus-newsgroup-data nil
3542 gnus-newsgroup-data-reverse nil)
3543 (gnus-run-hooks 'gnus-summary-generate-hook)
3544 ;; Generate the buffer, either with threads or without.
3545 (when gnus-newsgroup-headers
3546 (gnus-summary-prepare-threads
3547 (if gnus-show-threads
3548 (gnus-sort-gathered-threads
3549 (funcall gnus-summary-thread-gathering-function
3551 (gnus-cut-threads (gnus-make-threads)))))
3552 ;; Unthreaded display.
3553 (gnus-sort-articles gnus-newsgroup-headers))))
3554 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3555 ;; Call hooks for modifying summary buffer.
3556 (goto-char (point-min))
3557 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3559 (defsubst gnus-general-simplify-subject (subject)
3560 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3563 ;; Truncate the subject.
3564 (gnus-simplify-subject-functions
3565 (gnus-map-function gnus-simplify-subject-functions subject))
3566 ((numberp gnus-summary-gather-subject-limit)
3567 (setq subject (gnus-simplify-subject-re subject))
3568 (if (> (length subject) gnus-summary-gather-subject-limit)
3569 (substring subject 0 gnus-summary-gather-subject-limit)
3571 ;; Fuzzily simplify it.
3572 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3573 (gnus-simplify-subject-fuzzy subject))
3574 ;; Just remove the leading "Re:".
3576 (gnus-simplify-subject-re subject))))
3578 (if (and gnus-summary-gather-exclude-subject
3579 (string-match gnus-summary-gather-exclude-subject subject))
3580 nil ; This article shouldn't be gathered
3583 (defun gnus-summary-simplify-subject-query ()
3584 "Query where the respool algorithm would put this article."
3586 (gnus-summary-select-article)
3588 (gnus-general-simplify-subject (gnus-summary-article-subject))))
3590 (defun gnus-gather-threads-by-subject (threads)
3591 "Gather threads by looking at Subject headers."
3592 (if (not gnus-summary-make-false-root)
3594 (let ((hashtb (gnus-make-hashtable 1024))
3597 subject hthread whole-subject)
3599 (setq subject (gnus-general-simplify-subject
3600 (setq whole-subject (mail-header-subject
3603 (if (setq hthread (gnus-gethash subject hashtb))
3605 ;; We enter a dummy root into the thread, if we
3606 ;; haven't done that already.
3607 (unless (stringp (caar hthread))
3608 (setcar hthread (list whole-subject (car hthread))))
3609 ;; We add this new gathered thread to this gathered
3611 (setcdr (car hthread)
3612 (nconc (cdar hthread) (list (car threads))))
3613 ;; Remove it from the list of threads.
3614 (setcdr prev (cdr threads))
3615 (setq threads prev))
3616 ;; Enter this thread into the hash table.
3617 (gnus-sethash subject
3618 (if gnus-summary-make-false-root-always
3620 ;; If you want a dummy root above all
3622 (setcar threads (list whole-subject
3628 (setq threads (cdr threads)))
3631 (defun gnus-gather-threads-by-references (threads)
3632 "Gather threads by looking at References headers."
3633 (let ((idhashtb (gnus-make-hashtable 1024))
3634 (thhashtb (gnus-make-hashtable 1024))
3637 ids references id gthread gid entered ref)
3639 (when (setq references (mail-header-references (caar threads)))
3640 (setq id (mail-header-id (caar threads))
3641 ids (inline (gnus-split-references references))
3643 (while (setq ref (pop ids))
3644 (setq ids (delete ref ids))
3645 (if (not (setq gid (gnus-gethash ref idhashtb)))
3647 (gnus-sethash ref id idhashtb)
3648 (gnus-sethash id threads thhashtb))
3649 (setq gthread (gnus-gethash gid thhashtb))
3651 ;; We enter a dummy root into the thread, if we
3652 ;; haven't done that already.
3653 (unless (stringp (caar gthread))
3654 (setcar gthread (list (mail-header-subject (caar gthread))
3656 ;; We add this new gathered thread to this gathered
3658 (setcdr (car gthread)
3659 (nconc (cdar gthread) (list (car threads)))))
3660 ;; Add it into the thread hash table.
3661 (gnus-sethash id gthread thhashtb)
3663 ;; Remove it from the list of threads.
3664 (setcdr prev (cdr threads))
3665 (setq threads prev))))
3667 (setq threads (cdr threads)))
3670 (defun gnus-sort-gathered-threads (threads)
3671 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3672 (let ((result threads))
3674 (when (stringp (caar threads))
3675 (setcdr (car threads)
3676 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3677 (setq threads (cdr threads)))
3680 (defun gnus-thread-loop-p (root thread)
3681 "Say whether ROOT is in THREAD."
3682 (let ((stack (list thread))
3685 (while (setq thread (pop stack))
3686 (setq th (cdr thread))
3688 (not (eq (caar th) root)))
3691 ;; We have found a loop.
3693 (setcdr thread (delq (car th) (cdr thread)))
3694 (if (boundp (setq ref-dep (intern "none"
3695 gnus-newsgroup-dependencies)))
3696 (setcdr (symbol-value ref-dep)
3697 (nconc (cdr (symbol-value ref-dep))
3699 (set ref-dep (list nil (car th))))
3702 ;; Push all the subthreads onto the stack.
3703 (push (cdr thread) stack)))
3706 (defun gnus-make-threads ()
3707 "Go through the dependency hashtb and find the roots. Return all threads."
3709 (while (catch 'infloop
3712 ;; Deal with self-referencing References loops.
3713 (when (and (car (symbol-value refs))
3720 (car (symbol-value refs)) thread))
3721 (cdr (symbol-value refs)))))))
3724 (unless (car (symbol-value refs))
3725 ;; These threads do not refer back to any other articles,
3726 ;; so they're roots.
3727 (setq threads (append (cdr (symbol-value refs)) threads))))
3728 gnus-newsgroup-dependencies)))
3731 ;; Build the thread tree.
3732 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3733 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3735 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3736 if it was already present.
3738 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3739 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3740 Message-IDs will be renamed to a unique Message-ID before being
3743 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3744 (let* ((id (mail-header-id header))
3745 (id-dep (and id (intern id dependencies)))
3746 parent-id ref ref-dep ref-header replaced)
3747 ;; Enter this `header' in the `dependencies' table.
3751 ;; The first two cases do the normal part: enter a new `header'
3752 ;; in the `dependencies' table.
3753 ((not (boundp id-dep))
3754 (set id-dep (list header)))
3755 ((null (car (symbol-value id-dep)))
3756 (setcar (symbol-value id-dep) header))
3758 ;; From here the `header' was already present in the
3759 ;; `dependencies' table.
3761 ;; Overrides an existing entry;
3762 ;; just set the header part of the entry.
3763 (setcar (symbol-value id-dep) header)
3766 ;; Renames the existing `header' to a unique Message-ID.
3767 ((not gnus-summary-ignore-duplicates)
3768 ;; An article with this Message-ID has already been seen.
3769 ;; We rename the Message-ID.
3770 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3772 (mail-header-set-id header id))
3774 ;; The last case ignores an existing entry, except it adds any
3775 ;; additional Xrefs (in case the two articles came from different
3777 ;; Also sets `header' to `nil' meaning that the `dependencies'
3778 ;; table was *not* modified.
3780 (mail-header-set-xref
3781 (car (symbol-value id-dep))
3782 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3784 (or (mail-header-xref header) "")))
3787 (when (and header (not replaced))
3788 ;; First check that we are not creating a References loop.
3789 (setq parent-id (gnus-parent-id (mail-header-references header)))
3790 (setq ref parent-id)
3792 (setq ref-dep (intern-soft ref dependencies))
3794 (setq ref-header (car (symbol-value ref-dep))))
3795 (if (string= id ref)
3796 ;; Yuk! This is a reference loop. Make the article be a
3799 (mail-header-set-references (car (symbol-value id-dep)) "none")
3801 (setq parent-id nil))
3802 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3803 (setq ref-dep (intern (or parent-id "none") dependencies))
3804 (if (boundp ref-dep)
3805 (setcdr (symbol-value ref-dep)
3806 (nconc (cdr (symbol-value ref-dep))
3807 (list (symbol-value id-dep))))
3808 (set ref-dep (list nil (symbol-value id-dep)))))
3811 (defun gnus-extract-message-id-from-in-reply-to (string)
3812 (if (string-match "<[^>]+>" string)
3813 (substring string (match-beginning 0) (match-end 0))
3816 (defun gnus-build-sparse-threads ()
3817 (let ((headers gnus-newsgroup-headers)
3818 (mail-parse-charset gnus-newsgroup-charset)
3819 (gnus-summary-ignore-duplicates t)
3820 header references generation relations
3821 subject child end new-child date)
3822 ;; First we create an alist of generations/relations, where
3823 ;; generations is how much we trust the relation, and the relation
3825 (gnus-message 7 "Making sparse threads...")
3827 (nnheader-set-temp-buffer " *gnus sparse threads*")
3828 (while (setq header (pop headers))
3829 (when (and (setq references (mail-header-references header))
3830 (not (string= references "")))
3832 (setq child (mail-header-id header)
3833 subject (mail-header-subject header)
3834 date (mail-header-date header)
3836 (while (search-backward ">" nil t)
3837 (setq end (1+ (point)))
3838 (when (search-backward "<" nil t)
3839 (setq new-child (buffer-substring (point) end))
3840 (push (list (incf generation)
3841 child (setq child new-child)
3845 (push (list (1+ generation) child nil subject) relations))
3847 (kill-buffer (current-buffer)))
3848 ;; Sort over trustworthiness.
3851 (when (gnus-dependencies-add-header
3852 (make-full-mail-header-from-decoded-header
3853 gnus-reffed-article-number
3854 (nth 3 relation) "" (or (nth 4 relation) "")
3856 (or (nth 2 relation) "") 0 0 "")
3857 gnus-newsgroup-dependencies nil)
3858 (push gnus-reffed-article-number gnus-newsgroup-limit)
3859 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3860 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3861 gnus-newsgroup-reads)
3862 (decf gnus-reffed-article-number)))
3863 (sort relations 'car-less-than-car))
3864 (gnus-message 7 "Making sparse threads...done")))
3866 (defun gnus-build-old-threads ()
3867 ;; Look at all the articles that refer back to old articles, and
3868 ;; fetch the headers for the articles that aren't there. This will
3869 ;; build complete threads - if the roots haven't been expired by the
3871 (let ((mail-parse-charset gnus-newsgroup-charset)
3875 (when (not (car (symbol-value refs)))
3876 (setq heads (cdr (symbol-value refs)))
3878 (if (memq (mail-header-number (caar heads))
3879 gnus-newsgroup-dormant)
3880 (setq heads (cdr heads))
3881 (setq id (symbol-name refs))
3882 (while (and (setq id (gnus-build-get-header id))
3883 (not (car (gnus-id-to-thread id)))))
3884 (setq heads nil)))))
3885 gnus-newsgroup-dependencies)))
3887 ;; This function has to be called with point after the article number
3888 ;; on the beginning of the line.
3889 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3890 (let ((eol (gnus-point-at-eol))
3891 (buffer (current-buffer))
3892 header references in-reply-to)
3894 ;; overview: [num subject from date id refs chars lines misc]
3897 (narrow-to-region (point) eol)
3902 (make-full-mail-header
3904 (nnheader-nov-field) ; subject
3905 (nnheader-nov-field) ; from
3906 (nnheader-nov-field) ; date
3907 (nnheader-nov-read-message-id) ; id
3908 (nnheader-nov-field) ; refs
3909 (nnheader-nov-read-integer) ; chars
3910 (nnheader-nov-read-integer) ; lines
3912 (if (looking-at "Xref: ")
3913 (goto-char (match-end 0)))
3914 (nnheader-nov-field)) ; Xref
3915 (nnheader-nov-parse-extra)))) ; extra
3919 (when (and (string= references "")
3920 (setq in-reply-to (mail-header-extra header))
3921 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
3922 (mail-header-set-references
3923 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
3925 (when gnus-alter-header-function
3926 (funcall gnus-alter-header-function header))
3927 (gnus-dependencies-add-header header dependencies force-new)))
3929 (defun gnus-build-get-header (id)
3930 "Look through the buffer of NOV lines and find the header to ID.
3931 Enter this line into the dependencies hash table, and return
3932 the id of the parent article (if any)."
3933 (let ((deps gnus-newsgroup-dependencies)
3937 (set-buffer nntp-server-buffer)
3938 (let ((case-fold-search nil))
3939 (goto-char (point-min))
3940 (while (and (not found)
3941 (search-forward id nil t))
3943 (setq found (looking-at
3944 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3945 (regexp-quote id))))
3946 (or found (beginning-of-line 2)))
3950 (setq header (gnus-nov-parse-line
3951 (read (current-buffer)) deps))
3952 (gnus-parent-id (mail-header-references header))))))
3954 (let ((number (mail-header-number header)))
3955 (push number gnus-newsgroup-limit)
3956 (push header gnus-newsgroup-headers)
3957 (if (memq number gnus-newsgroup-unselected)
3959 (setq gnus-newsgroup-unreads
3960 (gnus-add-to-sorted-list gnus-newsgroup-unreads
3962 (setq gnus-newsgroup-unselected
3963 (delq number gnus-newsgroup-unselected)))
3964 (push number gnus-newsgroup-ancient)))))))
3966 (defun gnus-build-all-threads ()
3967 "Read all the headers."
3968 (let ((gnus-summary-ignore-duplicates t)
3969 (mail-parse-charset gnus-newsgroup-charset)
3970 (dependencies gnus-newsgroup-dependencies)
3973 (set-buffer nntp-server-buffer)
3974 (let ((case-fold-search nil))
3975 (goto-char (point-min))
3978 (setq article (read (current-buffer))
3979 header (gnus-nov-parse-line article dependencies)))
3982 (set-buffer gnus-summary-buffer)
3983 (push header gnus-newsgroup-headers)
3984 (if (memq (setq article (mail-header-number header))
3985 gnus-newsgroup-unselected)
3987 (setq gnus-newsgroup-unreads
3988 (gnus-add-to-sorted-list
3989 gnus-newsgroup-unreads article))
3990 (setq gnus-newsgroup-unselected
3991 (delq article gnus-newsgroup-unselected)))
3992 (push article gnus-newsgroup-ancient)))
3993 (forward-line 1)))))))
3995 (defun gnus-summary-update-article-line (article header)
3996 "Update the line for ARTICLE using HEADERS."
3997 (let* ((id (mail-header-id header))
3998 (thread (gnus-id-to-thread id)))
4000 (error "Article in no thread"))
4001 ;; Update the thread.
4002 (setcar thread header)
4003 (gnus-summary-goto-subject article)
4004 (let* ((datal (gnus-data-find-list article))
4006 (length (when (cdr datal)
4007 (- (gnus-data-pos data)
4008 (gnus-data-pos (cadr datal)))))
4009 (buffer-read-only nil)
4010 (level (gnus-summary-thread-level)))
4012 (gnus-summary-insert-line
4014 (memq article gnus-newsgroup-undownloaded)
4015 (gnus-article-mark article)
4016 (memq article gnus-newsgroup-replied)
4017 (memq article gnus-newsgroup-expirable)
4018 ;; Only insert the Subject string when it's different
4019 ;; from the previous Subject string.
4024 (mail-header-subject
4027 (gnus-data-find-list
4029 (gnus-data-list t)))))
4030 ;; Error on the side of excessive subjects.
4032 (mail-header-subject header)))
4034 (mail-header-subject header))
4035 nil (cdr (assq article gnus-newsgroup-scored))
4036 (memq article gnus-newsgroup-processable))
4038 (gnus-data-update-list
4039 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
4041 (defun gnus-summary-update-article (article &optional iheader)
4042 "Update ARTICLE in the summary buffer."
4043 (set-buffer gnus-summary-buffer)
4044 (let* ((header (gnus-summary-article-header article))
4045 (id (mail-header-id header))
4046 (data (gnus-data-find article))
4047 (thread (gnus-id-to-thread id))
4048 (references (mail-header-references header))
4052 (when (and references
4053 (not (equal "" references)))
4056 (buffer-read-only nil)
4062 (delq thread parent)))
4063 (if (gnus-summary-insert-subject id header)
4064 ;; Set the (possibly) new article number in the data structure.
4065 (gnus-data-set-number data (gnus-id-to-article id))
4069 (defun gnus-rebuild-thread (id &optional line)
4070 "Rebuild the thread containing ID.
4071 If LINE, insert the rebuilt thread starting on line LINE."
4072 (let ((buffer-read-only nil)
4073 old-pos current thread data)
4074 (if (not gnus-show-threads)
4075 (setq thread (list (car (gnus-id-to-thread id))))
4076 ;; Get the thread this article is part of.
4077 (setq thread (gnus-remove-thread id)))
4078 (setq old-pos (gnus-point-at-bol))
4079 (setq current (save-excursion
4080 (and (re-search-backward "[\r\n]" nil t)
4081 (gnus-summary-article-number))))
4082 ;; If this is a gathered thread, we have to go some re-gathering.
4083 (when (stringp (car thread))
4084 (let ((subject (car thread))
4086 (setq thread (cdr thread))
4088 (unless (memq (setq thr (gnus-id-to-thread
4090 (mail-header-id (caar thread)))))
4093 (setq thread (cdr thread)))
4094 ;; We now have all (unique) roots.
4095 (if (= (length roots) 1)
4096 ;; All the loose roots are now one solid root.
4097 (setq thread (car roots))
4098 (setq thread (cons subject (gnus-sort-threads roots))))))
4100 ;; We then insert this thread into the summary buffer.
4102 (goto-char (point-min))
4103 (forward-line (1- line)))
4104 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4105 (if gnus-show-threads
4106 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4107 (gnus-summary-prepare-unthreaded thread))
4108 (setq data (nreverse gnus-newsgroup-data))
4109 (setq threads gnus-newsgroup-threads))
4110 ;; We splice the new data into the data structure.
4111 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4112 ;;!!! then we want to insert at the beginning of the buffer.
4113 ;;!!! That happens to be true with Gnus now, but that may
4114 ;;!!! change in the future. Perhaps.
4115 (gnus-data-enter-list
4116 (if line nil current) data (- (point) old-pos))
4117 (setq gnus-newsgroup-threads
4118 (nconc threads gnus-newsgroup-threads))
4119 (gnus-data-compute-positions))))
4121 (defun gnus-number-to-header (number)
4122 "Return the header for article NUMBER."
4123 (let ((headers gnus-newsgroup-headers))
4125 (not (= number (mail-header-number (car headers)))))
4130 (defun gnus-parent-headers (in-headers &optional generation)
4131 "Return the headers of the GENERATIONeth parent of HEADERS."
4133 (setq generation 1))
4135 (headers in-headers)
4138 (not (zerop generation))
4139 (setq references (mail-header-references headers)))
4140 (setq headers (if (and references
4141 (setq parent (gnus-parent-id references)))
4142 (car (gnus-id-to-thread parent))
4145 (and (not (eq headers in-headers))
4148 (defun gnus-id-to-thread (id)
4149 "Return the (sub-)thread where ID appears."
4150 (gnus-gethash id gnus-newsgroup-dependencies))
4152 (defun gnus-id-to-article (id)
4153 "Return the article number of ID."
4154 (let ((thread (gnus-id-to-thread id)))
4157 (mail-header-number (car thread)))))
4159 (defun gnus-id-to-header (id)
4160 "Return the article headers of ID."
4161 (car (gnus-id-to-thread id)))
4163 (defun gnus-article-displayed-root-p (article)
4164 "Say whether ARTICLE is a root(ish) article."
4165 (let ((level (gnus-summary-thread-level article))
4166 (refs (mail-header-references (gnus-summary-article-header article)))
4172 ((null (gnus-parent-id refs)) t)
4174 (null (setq particle (gnus-id-to-article
4175 (gnus-parent-id refs))))
4176 (null (gnus-summary-thread-level particle)))))))
4178 (defun gnus-root-id (id)
4179 "Return the id of the root of the thread where ID appears."
4181 (while (and id (setq prev (car (gnus-id-to-thread id))))
4183 id (gnus-parent-id (mail-header-references prev))))
4186 (defun gnus-articles-in-thread (thread)
4187 "Return the list of articles in THREAD."
4188 (cons (mail-header-number (car thread))
4189 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4191 (defun gnus-remove-thread (id &optional dont-remove)
4192 "Remove the thread that has ID in it."
4193 (let (headers thread last-id)
4194 ;; First go up in this thread until we find the root.
4195 (setq last-id (gnus-root-id id)
4196 headers (message-flatten-list (gnus-id-to-thread last-id)))
4197 ;; We have now found the real root of this thread. It might have
4198 ;; been gathered into some loose thread, so we have to search
4199 ;; through the threads to find the thread we wanted.
4200 (let ((threads gnus-newsgroup-threads)
4203 (setq sub (car threads))
4204 (if (stringp (car sub))
4205 ;; This is a gathered thread, so we look at the roots
4206 ;; below it to find whether this article is in this
4209 (setq sub (cdr sub))
4211 (when (member (caar sub) headers)
4212 (setq thread (car threads)
4215 (setq sub (cdr sub))))
4216 ;; It's an ordinary thread, so we check it.
4217 (when (eq (car sub) (car headers))
4220 (setq threads (cdr threads)))
4221 ;; If this article is in no thread, then it's a root.
4224 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4225 (setq thread (gnus-id-to-thread last-id)))
4228 thread ; We return this thread.
4230 (if (stringp (car thread))
4232 ;; If we use dummy roots, then we have to remove the
4233 ;; dummy root as well.
4234 (when (eq gnus-summary-make-false-root 'dummy)
4235 ;; We go to the dummy root by going to
4236 ;; the first sub-"thread", and then one line up.
4237 (gnus-summary-goto-article
4238 (mail-header-number (caadr thread)))
4241 (gnus-data-compute-positions))
4242 (setq thread (cdr thread))
4244 (gnus-remove-thread-1 (car thread))
4245 (setq thread (cdr thread))))
4246 (gnus-remove-thread-1 thread))))))))
4248 (defun gnus-remove-thread-1 (thread)
4249 "Remove the thread THREAD recursively."
4250 (let ((number (mail-header-number (pop thread)))
4252 (setq thread (reverse thread))
4254 (gnus-remove-thread-1 (pop thread)))
4255 (when (setq d (gnus-data-find number))
4256 (goto-char (gnus-data-pos d))
4257 (gnus-summary-show-thread)
4260 (- (gnus-point-at-bol)
4262 (1+ (gnus-point-at-eol))
4263 (gnus-delete-line)))))))
4265 (defun gnus-sort-threads-1 (threads func)
4266 (sort (mapcar (lambda (thread)
4269 (gnus-sort-threads-1 (cdr thread) func))))
4272 (defun gnus-sort-threads (threads)
4274 (if (not gnus-thread-sort-functions)
4276 (gnus-message 8 "Sorting threads...")
4277 (let ((max-lisp-eval-depth 5000))
4278 (prog1 (gnus-sort-threads-1
4280 (gnus-make-sort-function gnus-thread-sort-functions))
4281 (gnus-message 8 "Sorting threads...done")))))
4283 (defun gnus-sort-articles (articles)
4285 (when gnus-article-sort-functions
4286 (gnus-message 7 "Sorting articles...")
4288 (setq gnus-newsgroup-headers
4289 (sort articles (gnus-make-sort-function
4290 gnus-article-sort-functions)))
4291 (gnus-message 7 "Sorting articles...done"))))
4293 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4294 (defmacro gnus-thread-header (thread)
4295 "Return header of first article in THREAD.
4296 Note that THREAD must never, ever be anything else than a variable -
4297 using some other form will lead to serious barfage."
4298 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4299 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4300 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4303 (defsubst gnus-article-sort-by-number (h1 h2)
4304 "Sort articles by article number."
4305 (< (mail-header-number h1)
4306 (mail-header-number h2)))
4308 (defun gnus-thread-sort-by-number (h1 h2)
4309 "Sort threads by root article number."
4310 (gnus-article-sort-by-number
4311 (gnus-thread-header h1) (gnus-thread-header h2)))
4313 (defsubst gnus-article-sort-by-random (h1 h2)
4314 "Sort articles by article number."
4317 (defun gnus-thread-sort-by-random (h1 h2)
4318 "Sort threads by root article number."
4319 (gnus-article-sort-by-random
4320 (gnus-thread-header h1) (gnus-thread-header h2)))
4322 (defsubst gnus-article-sort-by-lines (h1 h2)
4323 "Sort articles by article Lines header."
4324 (< (mail-header-lines h1)
4325 (mail-header-lines h2)))
4327 (defun gnus-thread-sort-by-lines (h1 h2)
4328 "Sort threads by root article Lines header."
4329 (gnus-article-sort-by-lines
4330 (gnus-thread-header h1) (gnus-thread-header h2)))
4332 (defsubst gnus-article-sort-by-chars (h1 h2)
4333 "Sort articles by octet length."
4334 (< (mail-header-chars h1)
4335 (mail-header-chars h2)))
4337 (defun gnus-thread-sort-by-chars (h1 h2)
4338 "Sort threads by root article octet length."
4339 (gnus-article-sort-by-chars
4340 (gnus-thread-header h1) (gnus-thread-header h2)))
4342 (defsubst gnus-article-sort-by-author (h1 h2)
4343 "Sort articles by root author."
4345 (let ((addr (car (mime-entity-read-field h1 'From))))
4346 (or (std11-full-name-string addr)
4347 (std11-address-string addr)
4349 (let ((addr (car (mime-entity-read-field h2 'From))))
4350 (or (std11-full-name-string addr)
4351 (std11-address-string addr)
4355 (defun gnus-thread-sort-by-author (h1 h2)
4356 "Sort threads by root author."
4357 (gnus-article-sort-by-author
4358 (gnus-thread-header h1) (gnus-thread-header h2)))
4360 (defsubst gnus-article-sort-by-subject (h1 h2)
4361 "Sort articles by root subject."
4363 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4364 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4366 (defun gnus-thread-sort-by-subject (h1 h2)
4367 "Sort threads by root subject."
4368 (gnus-article-sort-by-subject
4369 (gnus-thread-header h1) (gnus-thread-header h2)))
4371 (defsubst gnus-article-sort-by-date (h1 h2)
4372 "Sort articles by root article date."
4374 (gnus-date-get-time (mail-header-date h1))
4375 (gnus-date-get-time (mail-header-date h2))))
4377 (defun gnus-thread-sort-by-date (h1 h2)
4378 "Sort threads by root article date."
4379 (gnus-article-sort-by-date
4380 (gnus-thread-header h1) (gnus-thread-header h2)))
4382 (defsubst gnus-article-sort-by-score (h1 h2)
4383 "Sort articles by root article score.
4384 Unscored articles will be counted as having a score of zero."
4385 (> (or (cdr (assq (mail-header-number h1)
4386 gnus-newsgroup-scored))
4387 gnus-summary-default-score 0)
4388 (or (cdr (assq (mail-header-number h2)
4389 gnus-newsgroup-scored))
4390 gnus-summary-default-score 0)))
4392 (defun gnus-thread-sort-by-score (h1 h2)
4393 "Sort threads by root article score."
4394 (gnus-article-sort-by-score
4395 (gnus-thread-header h1) (gnus-thread-header h2)))
4397 (defun gnus-thread-sort-by-total-score (h1 h2)
4398 "Sort threads by the sum of all scores in the thread.
4399 Unscored articles will be counted as having a score of zero."
4400 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4402 (defun gnus-thread-total-score (thread)
4403 ;; This function find the total score of THREAD.
4408 (if (stringp (car thread))
4409 (apply gnus-thread-score-function 0
4410 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4411 (gnus-thread-total-score-1 thread)))
4413 (gnus-thread-total-score-1 (list thread)))))
4415 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4416 "Sort threads such that the thread with the most recently arrived article comes first."
4417 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4419 (defun gnus-thread-highest-number (thread)
4420 "Return the highest article number in THREAD."
4421 (apply 'max (mapcar (lambda (header)
4422 (mail-header-number header))
4423 (message-flatten-list thread))))
4425 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4426 "Sort threads such that the thread with the most recently dated article comes first."
4427 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4429 (defun gnus-thread-latest-date (thread)
4430 "Return the highest article date in THREAD."
4431 (let ((previous-time 0))
4438 (mail-header-parse-date (mail-header-date header))
4439 (error previous-time)))))
4441 (message-flatten-list thread)
4443 (< (mail-header-number h1)
4444 (mail-header-number h2))))))))
4446 (defun gnus-thread-total-score-1 (root)
4447 ;; This function find the total score of the thread below ROOT.
4448 (setq root (car root))
4449 (apply gnus-thread-score-function
4451 (mapcar 'gnus-thread-total-score
4452 (cdr (gnus-id-to-thread (mail-header-id root))))
4453 (when (> (mail-header-number root) 0)
4454 (list (or (cdr (assq (mail-header-number root)
4455 gnus-newsgroup-scored))
4456 gnus-summary-default-score 0))))
4457 (list gnus-summary-default-score)
4460 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4461 (defvar gnus-tmp-prev-subject nil)
4462 (defvar gnus-tmp-false-parent nil)
4463 (defvar gnus-tmp-root-expunged nil)
4464 (defvar gnus-tmp-dummy-line nil)
4466 (eval-when-compile (defvar gnus-tmp-header))
4467 (defun gnus-extra-header (type &optional header)
4468 "Return the extra header of TYPE."
4469 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4472 (defvar gnus-tmp-thread-tree-header-string "")
4474 (defcustom gnus-sum-thread-tree-root "> "
4475 "With %B spec, used for the root of a thread.
4476 If nil, use subject instead."
4478 :group 'gnus-thread)
4479 (defcustom gnus-sum-thread-tree-single-indent ""
4480 "With %B spec, used for a thread with just one message.
4481 If nil, use subject instead."
4483 :group 'gnus-thread)
4484 (defcustom gnus-sum-thread-tree-vertical "| "
4485 "With %B spec, used for drawing a vertical line."
4487 :group 'gnus-thread)
4488 (defcustom gnus-sum-thread-tree-indent " "
4489 "With %B spec, used for indenting."
4491 :group 'gnus-thread)
4492 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4493 "With %B spec, used for a leaf with brothers."
4495 :group 'gnus-thread)
4496 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4497 "With %B spec, used for a leaf without brothers."
4499 :group 'gnus-thread)
4501 (defun gnus-summary-prepare-threads (threads)
4502 "Prepare summary buffer from THREADS and indentation LEVEL.
4503 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4504 or a straight list of headers."
4505 (gnus-message 7 "Generating summary...")
4507 (setq gnus-newsgroup-threads threads)
4510 (let ((gnus-tmp-level 0)
4511 (default-score (or gnus-summary-default-score 0))
4512 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4513 (building-line-count gnus-summary-display-while-building)
4514 (building-count (integerp gnus-summary-display-while-building))
4515 thread number subject stack state gnus-tmp-gathered beg-match
4516 new-roots gnus-tmp-new-adopts thread-end simp-subject
4517 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4518 gnus-tmp-replied gnus-tmp-subject-or-nil
4519 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4520 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4521 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4524 (setq gnus-tmp-prev-subject nil)
4526 (if (vectorp (car threads))
4527 ;; If this is a straight (sic) list of headers, then a
4528 ;; threaded summary display isn't required, so we just create
4529 ;; an unthreaded one.
4530 (gnus-summary-prepare-unthreaded threads)
4532 ;; Do the threaded display.
4534 (if gnus-summary-display-while-building
4535 (switch-to-buffer (buffer-name)))
4536 (while (or threads stack gnus-tmp-new-adopts new-roots)
4538 (if (and (= gnus-tmp-level 0)
4541 (not gnus-tmp-false-parent)
4542 (or gnus-tmp-new-adopts new-roots))
4543 (if gnus-tmp-new-adopts
4544 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4545 thread (list (car gnus-tmp-new-adopts))
4546 gnus-tmp-header (caar thread)
4547 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4549 (setq thread (list (car new-roots))
4550 gnus-tmp-header (caar thread)
4551 new-roots (cdr new-roots))))
4554 ;; If there are some threads, we do them before the
4555 ;; threads on the stack.
4556 (setq thread threads
4557 gnus-tmp-header (caar thread))
4558 ;; There were no current threads, so we pop something off
4560 (setq state (car stack)
4561 gnus-tmp-level (car state)
4562 tree-stack (cadr state)
4563 thread (caddr state)
4565 gnus-tmp-header (caar thread))))
4567 (setq gnus-tmp-false-parent nil)
4568 (setq gnus-tmp-root-expunged nil)
4569 (setq thread-end nil)
4571 (if (stringp gnus-tmp-header)
4572 ;; The header is a dummy root.
4574 ((eq gnus-summary-make-false-root 'adopt)
4575 ;; We let the first article adopt the rest.
4576 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4578 (setq gnus-tmp-gathered
4580 (lambda (h) (mail-header-number (car h)))
4583 (setq thread (cons (list (caar thread)
4586 (setq gnus-tmp-level -1
4587 gnus-tmp-false-parent t))
4588 ((eq gnus-summary-make-false-root 'empty)
4589 ;; We print adopted articles with empty subject fields.
4590 (setq gnus-tmp-gathered
4592 (lambda (h) (mail-header-number (car h)))
4595 (setq gnus-tmp-level -1))
4596 ((eq gnus-summary-make-false-root 'dummy)
4597 ;; We remember that we probably want to output a dummy
4599 (setq gnus-tmp-dummy-line gnus-tmp-header)
4600 (setq gnus-tmp-prev-subject gnus-tmp-header))
4602 ;; We do not make a root for the gathered
4603 ;; sub-threads at all.
4604 (setq gnus-tmp-level -1)))
4606 (setq number (mail-header-number gnus-tmp-header)
4607 subject (mail-header-subject gnus-tmp-header)
4608 simp-subject (gnus-simplify-subject-fully subject))
4611 ;; If the thread has changed subject, we might want to make
4612 ;; this subthread into a root.
4613 ((and (null gnus-thread-ignore-subject)
4614 (not (zerop gnus-tmp-level))
4615 gnus-tmp-prev-subject
4616 (not (string= gnus-tmp-prev-subject simp-subject)))
4617 (setq new-roots (nconc new-roots (list (car thread)))
4619 gnus-tmp-header nil))
4620 ;; If the article lies outside the current limit,
4621 ;; then we do not display it.
4622 ((not (memq number gnus-newsgroup-limit))
4623 (setq gnus-tmp-gathered
4625 (lambda (h) (mail-header-number (car h)))
4628 (setq gnus-tmp-new-adopts (if (cdar thread)
4629 (append gnus-tmp-new-adopts
4631 gnus-tmp-new-adopts)
4633 gnus-tmp-header nil)
4634 (when (zerop gnus-tmp-level)
4635 (setq gnus-tmp-root-expunged t)))
4636 ;; Perhaps this article is to be marked as read?
4637 ((and gnus-summary-mark-below
4638 (< (or (cdr (assq number gnus-newsgroup-scored))
4640 gnus-summary-mark-below)
4641 ;; Don't touch sparse articles.
4642 (not (gnus-summary-article-sparse-p number))
4643 (not (gnus-summary-article-ancient-p number)))
4644 (setq gnus-newsgroup-unreads
4645 (delq number gnus-newsgroup-unreads))
4646 (if gnus-newsgroup-auto-expire
4647 (setq gnus-newsgroup-expirable
4648 (gnus-add-to-sorted-list
4649 gnus-newsgroup-expirable number))
4650 (push (cons number gnus-low-score-mark)
4651 gnus-newsgroup-reads))))
4653 (when gnus-tmp-header
4654 ;; We may have an old dummy line to output before this
4656 (when (and gnus-tmp-dummy-line
4659 (mail-header-subject gnus-tmp-header)))
4660 (gnus-summary-insert-dummy-line
4661 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4662 (setq gnus-tmp-dummy-line nil))
4664 ;; Compute the mark.
4665 (setq gnus-tmp-unread (gnus-article-mark number))
4667 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4668 gnus-tmp-header gnus-tmp-level)
4669 gnus-newsgroup-data)
4671 ;; Actually insert the line.
4673 gnus-tmp-subject-or-nil
4675 ((and gnus-thread-ignore-subject
4676 gnus-tmp-prev-subject
4677 (not (string= gnus-tmp-prev-subject simp-subject)))
4679 ((zerop gnus-tmp-level)
4680 (if (and (eq gnus-summary-make-false-root 'empty)
4681 (memq number gnus-tmp-gathered)
4682 gnus-tmp-prev-subject
4683 (string= gnus-tmp-prev-subject simp-subject))
4684 gnus-summary-same-subject
4686 (t gnus-summary-same-subject)))
4687 (if (and (eq gnus-summary-make-false-root 'adopt)
4688 (= gnus-tmp-level 1)
4689 (memq number gnus-tmp-gathered))
4690 (setq gnus-tmp-opening-bracket ?\<
4691 gnus-tmp-closing-bracket ?\>)
4692 (setq gnus-tmp-opening-bracket ?\[
4693 gnus-tmp-closing-bracket ?\]))
4695 gnus-tmp-indentation
4696 (aref gnus-thread-indent-array gnus-tmp-level)
4697 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4698 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4699 gnus-summary-default-score 0)
4701 (if (or (null gnus-summary-default-score)
4702 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4703 gnus-summary-zcore-fuzz))
4705 (if (< gnus-tmp-score gnus-summary-default-score)
4706 gnus-score-below-mark gnus-score-over-mark))
4708 (cond ((memq number gnus-newsgroup-processable)
4710 ((memq number gnus-newsgroup-cached)
4712 ((memq number gnus-newsgroup-replied)
4714 ((memq number gnus-newsgroup-forwarded)
4715 gnus-forwarded-mark)
4716 ((memq number gnus-newsgroup-saved)
4718 ((memq number gnus-newsgroup-recent)
4720 ((memq number gnus-newsgroup-unseen)
4724 (cond ((memq number gnus-newsgroup-undownloaded)
4725 gnus-undownloaded-mark)
4726 (gnus-newsgroup-agentized
4727 gnus-downloaded-mark)
4730 gnus-tmp-from (mail-header-from gnus-tmp-header)
4733 ((string-match "<[^>]+> *$" gnus-tmp-from)
4734 (setq beg-match (match-beginning 0))
4735 (or (and (string-match "^\".+\"" gnus-tmp-from)
4736 (substring gnus-tmp-from 1 (1- (match-end 0))))
4737 (substring gnus-tmp-from 0 beg-match)))
4738 ((string-match "(.+)" gnus-tmp-from)
4739 (substring gnus-tmp-from
4740 (1+ (match-beginning 0)) (1- (match-end 0))))
4742 gnus-tmp-thread-tree-header-string
4744 ((not gnus-show-threads) "")
4745 ((zerop gnus-tmp-level)
4747 (or gnus-sum-thread-tree-root subject)
4748 (or gnus-sum-thread-tree-single-indent subject)))
4750 (concat (apply 'concat
4751 (mapcar (lambda (item)
4753 gnus-sum-thread-tree-vertical
4754 gnus-sum-thread-tree-indent))
4755 (cdr (reverse tree-stack))))
4757 gnus-sum-thread-tree-leaf-with-other
4758 gnus-sum-thread-tree-single-leaf)))))
4759 (when (string= gnus-tmp-name "")
4760 (setq gnus-tmp-name gnus-tmp-from))
4761 (unless (numberp gnus-tmp-lines)
4762 (setq gnus-tmp-lines -1))
4763 (if (= gnus-tmp-lines -1)
4764 (setq gnus-tmp-lines "?")
4765 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4766 (gnus-put-text-property
4768 (progn (eval gnus-summary-line-format-spec) (point))
4769 'gnus-number number)
4772 (gnus-run-hooks 'gnus-summary-update-hook)
4775 (setq gnus-tmp-prev-subject simp-subject)))
4777 (when (nth 1 thread)
4778 (push (list (max 0 gnus-tmp-level)
4779 (copy-list tree-stack)
4782 (push (if (nth 1 thread) 1 0) tree-stack)
4783 (incf gnus-tmp-level)
4784 (setq threads (if thread-end nil (cdar thread)))
4785 (if gnus-summary-display-while-building
4788 ;; use a set frequency
4789 (setq building-line-count (1- building-line-count))
4790 (when (= building-line-count 0)
4792 (setq building-line-count
4793 gnus-summary-display-while-building)))
4797 (setq gnus-tmp-level 0)))))
4798 (gnus-message 7 "Generating summary...done"))
4800 (defun gnus-summary-prepare-unthreaded (headers)
4801 "Generate an unthreaded summary buffer based on HEADERS."
4802 (let (header number mark)
4807 ;; We may have to root out some bad articles...
4808 (when (memq (setq number (mail-header-number
4809 (setq header (pop headers))))
4810 gnus-newsgroup-limit)
4811 ;; Mark article as read when it has a low score.
4812 (when (and gnus-summary-mark-below
4813 (< (or (cdr (assq number gnus-newsgroup-scored))
4814 gnus-summary-default-score 0)
4815 gnus-summary-mark-below)
4816 (not (gnus-summary-article-ancient-p number)))
4817 (setq gnus-newsgroup-unreads
4818 (delq number gnus-newsgroup-unreads))
4819 (if gnus-newsgroup-auto-expire
4820 (push number gnus-newsgroup-expirable)
4821 (push (cons number gnus-low-score-mark)
4822 gnus-newsgroup-reads)))
4824 (setq mark (gnus-article-mark number))
4825 (push (gnus-data-make number mark (1+ (point)) header 0)
4826 gnus-newsgroup-data)
4827 (gnus-summary-insert-line
4829 (memq number gnus-newsgroup-undownloaded)
4830 mark (memq number gnus-newsgroup-replied)
4831 (memq number gnus-newsgroup-expirable)
4832 (mail-header-subject header) nil
4833 (cdr (assq number gnus-newsgroup-scored))
4834 (memq number gnus-newsgroup-processable))))))
4836 (defun gnus-summary-remove-list-identifiers ()
4837 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4838 (let ((regexp (if (consp gnus-list-identifiers)
4839 (mapconcat 'identity gnus-list-identifiers " *\\|")
4840 gnus-list-identifiers))
4843 (dolist (header gnus-newsgroup-headers)
4844 (setq subject (mail-header-subject header)
4846 (while (string-match
4847 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4850 (concat (substring subject 0 (match-beginning 2))
4851 (substring subject (match-end 0)))
4855 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4857 (concat (substring subject 0 (match-beginning 1))
4858 (substring subject (match-end 1)))))
4860 (mail-header-set-subject header subject))))))
4862 (defun gnus-fetch-headers (articles)
4863 "Fetch headers of ARTICLES."
4864 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4865 (gnus-message 5 "Fetching headers for %s..." name)
4868 (setq gnus-headers-retrieved-by
4869 (gnus-retrieve-headers
4870 articles gnus-newsgroup-name
4871 ;; We might want to fetch old headers, but
4872 ;; not if there is only 1 article.
4874 (not (eq gnus-fetch-old-headers 'some))
4875 (not (numberp gnus-fetch-old-headers)))
4876 (> (length articles) 1))
4877 gnus-fetch-old-headers))))
4878 (gnus-get-newsgroup-headers-xover
4879 articles nil nil gnus-newsgroup-name t)
4880 (gnus-get-newsgroup-headers))
4881 (gnus-message 5 "Fetching headers for %s...done" name))))
4883 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4884 "Select newsgroup GROUP.
4885 If READ-ALL is non-nil, all articles in the group are selected.
4886 If SELECT-ARTICLES, only select those articles from GROUP."
4887 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4888 ;;!!! Dirty hack; should be removed.
4889 (gnus-summary-ignore-duplicates
4890 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4892 gnus-summary-ignore-duplicates))
4893 (info (nth 2 entry))
4894 articles fetched-articles cached)
4896 (unless (gnus-check-server
4897 (set (make-local-variable 'gnus-current-select-method)
4898 (gnus-find-method-for-group group)))
4899 (error "Couldn't open server"))
4901 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4902 (gnus-activate-group group) ; Or we can activate it...
4903 (progn ; Or we bug out.
4904 (when (equal major-mode 'gnus-summary-mode)
4905 (kill-buffer (current-buffer)))
4906 (error "Couldn't activate group %s: %s"
4907 group (gnus-status-message group))))
4909 (unless (gnus-request-group group t)
4910 (when (equal major-mode 'gnus-summary-mode)
4911 (kill-buffer (current-buffer)))
4912 (error "Couldn't request group %s: %s"
4913 group (gnus-status-message group)))
4915 (setq gnus-newsgroup-name group
4916 gnus-newsgroup-unselected nil
4917 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4919 (let ((display (gnus-group-find-parameter group 'display)))
4920 (setq gnus-newsgroup-display
4922 ((not (zerop (or (car-safe read-all) 0)))
4923 ;; The user entered the group with C-u SPC/RET, let's show
4929 (gnus-summary-display-make-predicate (mapcar 'identity display)))
4931 ;; The following is probably the "correct" solution, but
4932 ;; it makes Gnus fetch all headers and then limit the
4933 ;; articles (which is slow), so instead we hack the
4934 ;; select-articles parameter instead. -- Simon Josefsson
4937 ;; (gnus-byte-compile
4938 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
4940 (setq select-articles
4941 (gnus-uncompress-range
4942 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
4946 (cdr (gnus-active group)))))
4951 (gnus-summary-setup-default-charset)
4953 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4954 (when (gnus-virtual-group-p group)
4955 (setq cached gnus-newsgroup-cached))
4957 (setq gnus-newsgroup-unreads
4958 (gnus-sorted-ndifference
4959 (gnus-sorted-ndifference gnus-newsgroup-unreads
4960 gnus-newsgroup-marked)
4961 gnus-newsgroup-dormant))
4963 (setq gnus-newsgroup-processable nil)
4965 (gnus-update-read-articles group gnus-newsgroup-unreads)
4967 ;; Adjust and set lists of article marks.
4969 (gnus-adjust-marked-articles info))
4970 (if (setq articles select-articles)
4971 (setq gnus-newsgroup-unselected
4972 (gnus-sorted-difference gnus-newsgroup-unreads articles))
4973 (setq articles (gnus-articles-to-read group read-all)))
4977 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4979 ((eq articles 0) nil)
4981 ;; Init the dependencies hash table.
4982 (setq gnus-newsgroup-dependencies
4983 (gnus-make-hashtable (length articles)))
4984 (gnus-set-global-variables)
4985 ;; Retrieve the headers and read them in.
4987 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
4989 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4991 (setq gnus-newsgroup-cached cached))
4993 ;; Suppress duplicates?
4994 (when gnus-suppress-duplicates
4995 (gnus-dup-suppress-articles))
4997 ;; Set the initial limit.
4998 (setq gnus-newsgroup-limit (copy-sequence articles))
4999 ;; Remove canceled articles from the list of unread articles.
5000 (setq fetched-articles
5001 (mapcar (lambda (headers) (mail-header-number headers))
5002 gnus-newsgroup-headers))
5003 (setq gnus-newsgroup-articles fetched-articles)
5004 (setq gnus-newsgroup-unreads
5005 (gnus-sorted-nintersection
5006 gnus-newsgroup-unreads fetched-articles))
5007 (gnus-compute-unseen-list)
5009 ;; Removed marked articles that do not exist.
5010 (gnus-update-missing-marks
5011 (gnus-sorted-difference articles fetched-articles))
5012 ;; We might want to build some more threads first.
5013 (when (and gnus-fetch-old-headers
5014 (eq gnus-headers-retrieved-by 'nov))
5015 (if (eq gnus-fetch-old-headers 'invisible)
5016 (gnus-build-all-threads)
5017 (gnus-build-old-threads)))
5018 ;; Let the Gnus agent mark articles as read.
5020 (gnus-agent-get-undownloaded-list))
5021 ;; Remove list identifiers from subject
5022 (when gnus-list-identifiers
5023 (gnus-summary-remove-list-identifiers))
5024 ;; Check whether auto-expire is to be done in this group.
5025 (setq gnus-newsgroup-auto-expire
5026 (gnus-group-auto-expirable-p group))
5027 ;; Set up the article buffer now, if necessary.
5028 (unless gnus-single-article-buffer
5029 (gnus-article-setup-buffer))
5030 ;; First and last article in this newsgroup.
5031 (when gnus-newsgroup-headers
5032 (setq gnus-newsgroup-begin
5033 (mail-header-number (car gnus-newsgroup-headers))
5036 (gnus-last-element gnus-newsgroup-headers))))
5037 ;; GROUP is successfully selected.
5038 (or gnus-newsgroup-headers t)))))
5040 (defun gnus-compute-unseen-list ()
5041 ;; The `seen' marks are treated specially.
5042 (if (not gnus-newsgroup-seen)
5043 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5044 (setq gnus-newsgroup-unseen
5045 (gnus-inverse-list-range-intersection
5046 gnus-newsgroup-articles gnus-newsgroup-seen))))
5048 (defun gnus-summary-display-make-predicate (display)
5049 (require 'gnus-agent)
5050 (when (= (length display) 1)
5051 (setq display (car display)))
5052 (unless gnus-summary-display-cache
5053 (dolist (elem (append '((unread . unread)
5056 gnus-article-mark-lists))
5057 (push (cons (cdr elem)
5059 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5060 gnus-summary-display-cache)))
5061 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5062 (gnus-category-predicate-cache gnus-summary-display-cache))
5063 (gnus-get-predicate display)))
5065 ;; Uses the dynamically bound `number' variable.
5068 (defun gnus-article-marked-p (type &optional article)
5069 (let ((article (or article number)))
5072 (memq article gnus-newsgroup-marked))
5074 (memq article gnus-newsgroup-spam-marked))
5076 (memq article gnus-newsgroup-unsendable))
5077 ((eq type 'undownload)
5078 (memq article gnus-newsgroup-undownloaded))
5079 ((eq type 'download)
5080 (memq article gnus-newsgroup-downloadable))
5082 (memq article gnus-newsgroup-unreads))
5084 (memq article gnus-newsgroup-reads))
5086 (memq article gnus-newsgroup-dormant) )
5088 (memq article gnus-newsgroup-expirable))
5090 (memq article gnus-newsgroup-replied))
5092 (memq article gnus-newsgroup-killed))
5093 ((eq type 'bookmark)
5094 (assq article gnus-newsgroup-bookmarks))
5096 (assq article gnus-newsgroup-scored))
5098 (memq article gnus-newsgroup-saved))
5100 (memq article gnus-newsgroup-cached))
5102 (memq article gnus-newsgroup-forwarded))
5104 (not (memq article gnus-newsgroup-unseen)))
5106 (memq article gnus-newsgroup-recent))
5109 (defun gnus-articles-to-read (group &optional read-all)
5110 "Find out what articles the user wants to read."
5111 (let* ((display (gnus-group-find-parameter group 'display))
5113 ;; Select all articles if `read-all' is non-nil, or if there
5114 ;; are no unread articles.
5116 (and (zerop (length gnus-newsgroup-marked))
5117 (zerop (length gnus-newsgroup-unreads)))
5118 ;; Fetch all if the predicate is non-nil.
5119 gnus-newsgroup-display)
5120 ;; We want to select the headers for all the articles in
5121 ;; the group, so we select either all the active
5122 ;; articles in the group, or (if that's nil), the
5123 ;; articles in the cache.
5125 (gnus-uncompress-range (gnus-active group))
5126 (gnus-cache-articles-in-group group))
5127 ;; Select only the "normal" subset of articles.
5129 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5130 gnus-newsgroup-unreads)))
5131 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5132 (scored (length scored-list))
5133 (number (length articles))
5134 (marked (+ (length gnus-newsgroup-marked)
5135 (length gnus-newsgroup-dormant)))
5140 ((numberp gnus-newsgroup-display)
5141 gnus-newsgroup-display)
5145 ((and (or (<= scored marked) (= scored number))
5146 (numberp gnus-large-newsgroup)
5147 (> number gnus-large-newsgroup))
5148 (let* ((cursor-in-echo-area nil)
5149 (initial (gnus-parameter-large-newsgroup-initial
5150 gnus-newsgroup-name))
5154 "How many articles from %s (%s %d): "
5156 (gnus-group-decoded-name gnus-newsgroup-name)
5158 (if initial "max" "default")
5161 (cons (number-to-string initial)
5163 (if (string-match "^[ \t]*$" input) number input)))
5164 ((and (> scored marked) (< scored number)
5165 (> (- scored number) 20))
5168 (format "%s %s (%d scored, %d total): "
5169 "How many articles from"
5170 (gnus-group-decoded-name group)
5172 (if (string-match "^[ \t]*$" input)
5176 (message "Quit getting the articles to read")
5178 (setq select (if (stringp select) (string-to-number select) select))
5179 (if (or (null select) (zerop select))
5181 (if (and (not (zerop scored)) (<= (abs select) scored))
5183 (setq articles (sort scored-list '<))
5184 (setq number (length articles)))
5185 (setq articles (copy-sequence articles)))
5187 (when (< (abs select) number)
5189 ;; Select the N oldest articles.
5190 (setcdr (nthcdr (1- (abs select)) articles) nil)
5191 ;; Select the N most recent articles.
5192 (setq articles (nthcdr (- number select) articles))))
5193 (setq gnus-newsgroup-unselected
5194 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5195 (when gnus-alter-articles-to-read-function
5196 (setq gnus-newsgroup-unreads
5198 (funcall gnus-alter-articles-to-read-function
5199 gnus-newsgroup-name gnus-newsgroup-unreads)
5203 (defun gnus-killed-articles (killed articles)
5206 (when (inline (gnus-member-of-range (car articles) killed))
5207 (push (car articles) out))
5208 (setq articles (cdr articles)))
5211 (defun gnus-uncompress-marks (marks)
5212 "Uncompress the mark ranges in MARKS."
5213 (let ((uncompressed '(score bookmark))
5216 (if (memq (caar marks) uncompressed)
5217 (push (car marks) out)
5218 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5219 (setq marks (cdr marks)))
5222 (defun gnus-article-mark-to-type (mark)
5223 "Return the type of MARK."
5224 (or (cadr (assq mark gnus-article-special-mark-lists))
5227 (defun gnus-article-unpropagatable-p (mark)
5228 "Return whether MARK should be propagated to backend."
5229 (memq mark gnus-article-unpropagated-mark-lists))
5231 (defun gnus-adjust-marked-articles (info)
5232 "Set all article lists and remove all marks that are no longer valid."
5233 (let* ((marked-lists (gnus-info-marks info))
5234 (active (gnus-active (gnus-info-group info)))
5237 (types gnus-article-mark-lists)
5238 marks var articles article mark mark-type)
5240 (dolist (marks marked-lists)
5241 (setq mark (car marks)
5242 mark-type (gnus-article-mark-to-type mark)
5243 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5245 ;; We set the variable according to the type of the marks list,
5246 ;; and then adjust the marks to a subset of the active articles.
5248 ;; Adjust "simple" lists.
5249 ((eq mark-type 'list)
5250 (set var (setq articles (gnus-uncompress-range (cdr marks))))
5251 (when (memq mark '(tick dormant expire reply save))
5253 (when (or (< (setq article (pop articles)) min) (> article max))
5254 (set var (delq article (symbol-value var)))))))
5256 ((eq mark-type 'tuple)
5257 (set var (setq articles (cdr marks)))
5258 (when (not (listp (cdr (symbol-value var))))
5259 (set var (list (symbol-value var))))
5260 (when (not (listp (cdr articles)))
5261 (setq articles (list articles)))
5263 (when (or (not (consp (setq article (pop articles))))
5264 (< (car article) min)
5265 (> (car article) max))
5266 (set var (delq article (symbol-value var))))))
5267 ;; Adjust ranges (sloppily).
5268 ((eq mark-type 'range)
5271 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5272 ;; It should be (seen (NUM1 . NUM2)).
5273 (when (numberp (cddr marks))
5274 (setcdr marks (list (cdr marks))))
5275 (setq articles (cdr marks))
5276 (while (and articles
5277 (or (and (consp (car articles))
5278 (> min (cdar articles)))
5279 (and (numberp (car articles))
5280 (> min (car articles)))))
5282 (set var articles))))))))
5284 (defun gnus-update-missing-marks (missing)
5285 "Go through the list of MISSING articles and remove them from the mark lists."
5288 ;; Go through all types.
5289 (dolist (elem gnus-article-mark-lists)
5290 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5291 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5292 (when (symbol-value var)
5293 ;; This list has articles. So we delete all missing
5294 ;; articles from it.
5297 (set var (delq (pop m) (symbol-value var))))))))))
5299 (defun gnus-update-marks ()
5300 "Enter the various lists of marked articles into the newsgroup info list."
5301 (let ((types gnus-article-mark-lists)
5302 (info (gnus-get-info gnus-newsgroup-name))
5303 type list newmarked symbol delta-marks)
5305 ;; Add all marks lists to the list of marks lists.
5306 (while (setq type (pop types))
5307 (setq list (symbol-value
5309 (intern (format "gnus-newsgroup-%s" (car type))))))
5312 ;; Get rid of the entries of the articles that have the
5314 (when (and (eq (cdr type) 'score)
5318 (prev (cons nil list))
5321 (if (or (not (consp (car arts)))
5322 (= (cdar arts) gnus-summary-default-score))
5323 (setcdr prev (cdr arts))
5325 (setq arts (cdr arts)))
5326 (setq list (cdr all)))))
5328 (when (eq (cdr type) 'seen)
5329 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5331 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5332 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5334 (when (and (gnus-check-backend-function
5335 'request-set-mark gnus-newsgroup-name)
5336 (not (gnus-article-unpropagatable-p (cdr type))))
5337 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5338 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5339 (add (gnus-remove-from-range
5340 (gnus-copy-sequence list) old)))
5342 (push (list add 'add (list (cdr type))) delta-marks))
5344 (push (list del 'del (list (cdr type))) delta-marks))))
5347 (push (cons (cdr type) list) newmarked)))
5350 (unless (gnus-check-group gnus-newsgroup-name)
5351 (error "Can't open server for %s" gnus-newsgroup-name))
5352 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5354 ;; Enter these new marks into the info of the group.
5356 (setcar (nthcdr 3 info) newmarked)
5357 ;; Add the marks lists to the end of the info.
5359 (setcdr (nthcdr 2 info) (list newmarked))))
5361 ;; Cut off the end of the info if there's nothing else there.
5365 (when (nthcdr (decf i) info)
5366 (setcdr (nthcdr i info) nil)))))))
5368 (defun gnus-set-mode-line (where)
5369 "Set the mode line of the article or summary buffers.
5370 If WHERE is `summary', the summary mode line format will be used."
5371 ;; Is this mode line one we keep updated?
5372 (when (and (memq where gnus-updated-mode-lines)
5374 (intern (format "gnus-%s-mode-line-format-spec" where))))
5377 ;; We evaluate this in the summary buffer since these
5378 ;; variables are buffer-local to that buffer.
5379 (set-buffer gnus-summary-buffer)
5380 ;; We bind all these variables that are used in the `eval' form
5382 (let* ((mformat (symbol-value
5384 (format "gnus-%s-mode-line-format-spec" where))))
5385 (gnus-tmp-group-name (gnus-group-decoded-name
5386 gnus-newsgroup-name))
5387 (gnus-tmp-article-number (or gnus-current-article 0))
5388 (gnus-tmp-unread gnus-newsgroup-unreads)
5389 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5390 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5391 (gnus-tmp-unread-and-unselected
5392 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5393 (zerop gnus-tmp-unselected))
5395 ((zerop gnus-tmp-unselected)
5396 (format "{%d more}" gnus-tmp-unread-and-unticked))
5397 (t (format "{%d(+%d) more}"
5398 gnus-tmp-unread-and-unticked
5399 gnus-tmp-unselected))))
5401 (if (and gnus-current-headers
5402 (vectorp gnus-current-headers))
5403 (gnus-mode-string-quote
5404 (mail-header-subject gnus-current-headers))
5406 bufname-length max-len
5407 gnus-tmp-header);; passed as argument to any user-format-funcs
5408 (setq mode-string (eval mformat))
5409 (setq bufname-length (if (string-match "%b" mode-string)
5412 (if (eq where 'summary)
5414 (get-buffer gnus-article-buffer))))
5417 (setq max-len (max 4 (if gnus-mode-non-string-length
5419 gnus-mode-non-string-length
5421 (length mode-string))))
5422 ;; We might have to chop a bit of the string off...
5423 (when (> (length mode-string) max-len)
5425 (concat (gnus-truncate-string mode-string (- max-len 3))
5427 ;; Pad the mode string a bit.
5428 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5429 ;; Update the mode line.
5430 (setq mode-line-buffer-identification
5431 (gnus-mode-line-buffer-identification (list mode-string)))
5432 (set-buffer-modified-p t))))
5434 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5435 "Go through the HEADERS list and add all Xrefs to a hash table.
5436 The resulting hash table is returned, or nil if no Xrefs were found."
5437 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5438 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5439 (xref-hashtb (gnus-make-hashtable))
5440 start group entry number xrefs header)
5442 (setq header (pop headers))
5443 (when (and (setq xrefs (mail-header-xref header))
5444 (not (memq (setq number (mail-header-number header))
5447 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5448 (setq start (match-end 0))
5449 (setq group (if prefix
5450 (concat prefix (substring xrefs (match-beginning 1)
5452 (substring xrefs (match-beginning 1) (match-end 1))))
5454 (string-to-int (substring xrefs (match-beginning 2)
5456 (if (setq entry (gnus-gethash group xref-hashtb))
5457 (setcdr entry (cons number (cdr entry)))
5458 (gnus-sethash group (cons number nil) xref-hashtb)))))
5459 (and start xref-hashtb)))
5461 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5462 "Look through all the headers and mark the Xrefs as read."
5463 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5464 name entry info xref-hashtb idlist method nth4)
5466 (set-buffer gnus-group-buffer)
5467 (when (setq xref-hashtb
5468 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5471 (unless (string= from-newsgroup (setq name (symbol-name group)))
5472 (setq idlist (symbol-value group))
5473 ;; Dead groups are not updated.
5475 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5477 (when (stringp (setq nth4 (gnus-info-method info)))
5478 (setq nth4 (gnus-server-to-method nth4))))
5479 ;; Only do the xrefs if the group has the same
5480 ;; select method as the group we have just read.
5481 (or (gnus-methods-equal-p
5482 nth4 (gnus-find-method-for-group from-newsgroup))
5484 (equal nth4 (setq method (gnus-find-method-for-group
5486 (and (equal (car nth4) (car method))
5487 (equal (nth 1 nth4) (nth 1 method))))
5488 gnus-use-cross-reference
5489 (or (not (eq gnus-use-cross-reference t))
5491 ;; Only do cross-references on subscribed
5492 ;; groups, if that is what is wanted.
5493 (<= (gnus-info-level info) gnus-level-subscribed))
5494 (gnus-group-make-articles-read name idlist))))
5497 (defun gnus-compute-read-articles (group articles)
5498 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5499 (info (nth 2 entry))
5500 (active (gnus-active group))
5503 ;; First peel off all invalid article numbers.
5505 (let ((ids articles)
5507 (while (setq id (pop ids))
5508 (when (and first (> id (cdr active)))
5509 ;; We'll end up in this situation in one particular
5510 ;; obscure situation. If you re-scan a group and get
5511 ;; a new article that is cross-posted to a different
5512 ;; group that has not been re-scanned, you might get
5513 ;; crossposted article that has a higher number than
5514 ;; Gnus believes possible. So we re-activate this
5515 ;; group as well. This might mean doing the
5516 ;; crossposting thingy will *increase* the number
5517 ;; of articles in some groups. Tsk, tsk.
5518 (setq active (or (gnus-activate-group group) active)))
5519 (when (or (> id (cdr active))
5520 (< id (car active)))
5521 (setq articles (delq id articles))))))
5522 ;; If the read list is nil, we init it.
5524 (null (gnus-info-read info))
5526 (setq ninfo (cons 1 (1- (car active))))
5527 (setq ninfo (gnus-info-read info)))
5528 ;; Then we add the read articles to the range.
5530 ninfo (setq articles (sort articles '<))))))
5532 (defun gnus-group-make-articles-read (group articles)
5533 "Update the info of GROUP to say that ARTICLES are read."
5535 (entry (gnus-gethash group gnus-newsrc-hashtb))
5536 (info (nth 2 entry))
5537 (active (gnus-active group))
5540 (setq range (gnus-compute-read-articles group articles))
5542 (set-buffer gnus-group-buffer)
5545 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5546 (gnus-info-set-read ',info ',(gnus-info-read info))
5547 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5548 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5549 (gnus-group-update-group ,group t))))
5550 ;; Add the read articles to the range.
5551 (gnus-info-set-read info range)
5552 (gnus-request-set-mark group (list (list range 'add '(read))))
5553 ;; Then we have to re-compute how many unread
5554 ;; articles there are in this group.
5558 (setq num (- (1+ (cdr active)) (car active))))
5559 ((not (listp (cdr range)))
5560 (setq num (- (cdr active) (- (1+ (cdr range))
5564 (if (numberp (car range))
5566 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5567 (setq range (cdr range)))
5568 (setq num (- (cdr active) num))))
5569 ;; Update the number of unread articles.
5571 ;; Update the group buffer.
5572 (gnus-group-update-group group t)))))
5574 (defvar gnus-newsgroup-none-id 0)
5576 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5577 (let ((cur nntp-server-buffer)
5580 (save-excursion (set-buffer gnus-summary-buffer)
5581 gnus-newsgroup-dependencies)))
5583 (mail-parse-charset gnus-newsgroup-charset)
5584 (mail-parse-ignored-charsets
5585 (save-excursion (condition-case nil
5586 (set-buffer gnus-summary-buffer)
5588 gnus-newsgroup-ignored-charsets)))
5590 (set-buffer nntp-server-buffer)
5591 ;; Translate all TAB characters into SPACE characters.
5592 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5593 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5594 (gnus-run-hooks 'gnus-parse-headers-hook)
5595 (let ((case-fold-search t)
5596 in-reply-to header p lines chars ctype)
5597 (goto-char (point-min))
5598 ;; Search to the beginning of the next header. Error messages
5599 ;; do not begin with 2 or 3.
5600 (while (re-search-forward "^[23][0-9]+ " nil t)
5603 ;; This implementation of this function, with nine
5604 ;; search-forwards instead of the one re-search-forward and
5605 ;; a case (which basically was the old function) is actually
5606 ;; about twice as fast, even though it looks messier. You
5607 ;; can't have everything, I guess. Speed and elegance
5608 ;; doesn't always go hand in hand.
5611 (make-full-mail-header
5617 (narrow-to-region (point)
5618 (or (and (search-forward "\n.\n" nil t)
5624 (if (search-forward "\nsubject:" nil t)
5625 (nnheader-header-value)
5630 (if (search-forward "\nfrom:" nil t)
5631 (nnheader-header-value)
5636 (if (search-forward "\ndate:" nil t)
5637 (nnheader-header-value) ""))
5641 (setq id (if (re-search-forward
5642 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5643 ;; We do it this way to make sure the Message-ID
5644 ;; is (somewhat) syntactically valid.
5645 (buffer-substring (match-beginning 1)
5647 ;; If there was no message-id, we just fake one
5648 ;; to make subsequent routines simpler.
5649 (nnheader-generate-fake-message-id))))
5653 (if (search-forward "\nreferences:" nil t)
5657 (nnheader-header-value)
5662 (search-backward ">" end t)
5665 (search-backward "<" end t)
5667 ;; Get the references from the in-reply-to header if there
5668 ;; were no references and the in-reply-to header looks
5670 (if (and (search-forward "\nin-reply-to:" nil t)
5671 (setq in-reply-to (nnheader-header-value))
5672 (string-match "<[^>]+>" in-reply-to))
5674 (setq ref (substring in-reply-to (match-beginning 0)
5676 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5677 (setq ref2 (substring in-reply-to (match-beginning 0)
5679 (when (> (length ref2) (length ref))
5686 (if (search-forward "\nchars: " nil t)
5687 (if (numberp (setq chars (ignore-errors (read cur))))
5693 (if (search-forward "\nlines: " nil t)
5694 (if (numberp (setq lines (ignore-errors (read cur))))
5700 (and (search-forward "\nxref:" nil t)
5701 (nnheader-header-value)))
5703 (when gnus-extra-headers
5704 (let ((extra gnus-extra-headers)
5708 (when (search-forward
5709 (concat "\n" (symbol-name (car extra)) ":") nil t)
5710 (push (cons (car extra) (nnheader-header-value)) out))
5714 (if (and (search-forward "\ncontent-type: " nil t)
5715 (setq ctype (nnheader-header-value)))
5716 (mime-entity-set-content-type-internal
5717 header (mime-parse-Content-Type ctype)))
5718 (when (equal id ref)
5721 (when gnus-alter-header-function
5722 (funcall gnus-alter-header-function header)
5723 (setq id (mail-header-id header)
5724 ref (gnus-parent-id (mail-header-references header))))
5727 (gnus-dependencies-add-header
5728 header dependencies force-new))
5729 (push header headers))
5730 (goto-char (point-max))
5732 (nreverse headers)))))
5734 ;; Goes through the xover lines and returns a list of vectors
5735 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5736 force-new dependencies
5737 group also-fetch-heads)
5738 "Parse the news overview data in the server buffer.
5739 Return a list of headers that match SEQUENCE (see
5740 `nntp-retrieve-headers')."
5741 ;; Get the Xref when the users reads the articles since most/some
5742 ;; NNTP servers do not include Xrefs when using XOVER.
5743 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5744 (let ((mail-parse-charset gnus-newsgroup-charset)
5745 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5746 (cur nntp-server-buffer)
5747 (dependencies (or dependencies gnus-newsgroup-dependencies))
5749 ((eq gnus-read-all-available-headers t)
5751 ((stringp gnus-read-all-available-headers)
5752 (string-match gnus-read-all-available-headers group))
5755 number headers header)
5757 (set-buffer nntp-server-buffer)
5758 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5759 ;; Allow the user to mangle the headers before parsing them.
5760 (gnus-run-hooks 'gnus-parse-headers-hook)
5761 (goto-char (point-min))
5762 (gnus-parse-without-error
5763 (while (and (or sequence allp)
5765 (setq number (read cur))
5767 (while (and sequence
5768 (< (car sequence) number))
5769 (setq sequence (cdr sequence))))
5772 (eq number (car sequence))))
5774 (setq sequence (cdr sequence))
5775 (setq header (inline
5776 (gnus-nov-parse-line
5777 number dependencies force-new)))))
5778 (push header headers))
5780 ;; A common bug in inn is that if you have posted an article and
5781 ;; then retrieves the active file, it will answer correctly --
5782 ;; the new article is included. However, a NOV entry for the
5783 ;; article may not have been generated yet, so this may fail.
5784 ;; We work around this problem by retrieving the last few
5785 ;; headers using HEAD.
5786 (if (or (not also-fetch-heads)
5788 ;; We (probably) got all the headers.
5790 (let ((gnus-nov-is-evil t))
5793 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5794 (gnus-get-newsgroup-headers))))))))
5796 (defun gnus-article-get-xrefs ()
5797 "Fill in the Xref value in `gnus-current-headers', if necessary.
5798 This is meant to be called in `gnus-article-internal-prepare-hook'."
5799 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5800 gnus-current-headers)))
5801 (or (not gnus-use-cross-reference)
5803 (and (mail-header-xref headers)
5804 (not (string= (mail-header-xref headers) "")))
5805 (let ((case-fold-search t)
5808 (nnheader-narrow-to-headers)
5809 (goto-char (point-min))
5810 (when (or (and (not (eobp))
5811 (eq (downcase (char-after)) ?x)
5812 (looking-at "Xref:"))
5813 (search-forward "\nXref:" nil t))
5814 (goto-char (1+ (match-end 0)))
5815 (setq xref (buffer-substring (point)
5816 (progn (end-of-line) (point))))
5817 (mail-header-set-xref headers xref)))))))
5819 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5820 "Find article ID and insert the summary line for that article.
5821 OLD-HEADER can either be a header or a line number to insert
5822 the subject line on."
5823 (let* ((line (and (numberp old-header) old-header))
5824 (old-header (and (vectorp old-header) old-header))
5825 (header (cond ((and old-header use-old-header)
5828 (gnus-number-to-header id))
5829 (gnus-number-to-header id))
5831 (gnus-read-header id))))
5832 (number (and (numberp id) id))
5835 ;; Rebuild the thread that this article is part of and go to the
5836 ;; article we have fetched.
5837 (when (and (not gnus-show-threads)
5840 (setq d (gnus-data-find (mail-header-number old-header))))
5841 (goto-char (gnus-data-pos d))
5844 (- (gnus-point-at-bol)
5846 (1+ (gnus-point-at-eol))
5847 (gnus-delete-line))))))
5849 (mail-header-set-number header (mail-header-number old-header)))
5850 (setq gnus-newsgroup-sparse
5851 (delq (setq number (mail-header-number header))
5852 gnus-newsgroup-sparse))
5853 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5854 (push number gnus-newsgroup-limit)
5855 (gnus-rebuild-thread (mail-header-id header) line)
5856 (gnus-summary-goto-subject number nil t))
5857 (when (and (numberp number)
5859 ;; We have to update the boundaries even if we can't fetch the
5860 ;; article if ID is a number -- so that the next `P' or `N'
5861 ;; command will fetch the previous (or next) article even
5862 ;; if the one we tried to fetch this time has been canceled.
5863 (when (> number gnus-newsgroup-end)
5864 (setq gnus-newsgroup-end number))
5865 (when (< number gnus-newsgroup-begin)
5866 (setq gnus-newsgroup-begin number))
5867 (setq gnus-newsgroup-unselected
5868 (delq number gnus-newsgroup-unselected)))
5869 ;; Report back a success?
5870 (and header (mail-header-number header))))
5872 ;;; Process/prefix in the summary buffer
5874 (defun gnus-summary-work-articles (n)
5875 "Return a list of articles to be worked upon.
5876 The prefix argument, the list of process marked articles, and the
5877 current article will be taken into consideration."
5879 (set-buffer gnus-summary-buffer)
5882 ;; A numerical prefix has been given.
5883 (setq n (prefix-numeric-value n))
5884 (let ((backward (< n 0))
5885 (n (abs (prefix-numeric-value n)))
5890 (push (setq article (gnus-summary-article-number))
5893 (gnus-summary-find-prev nil article)
5894 (gnus-summary-find-next nil article)))
5896 (nreverse articles)))
5897 ((and (gnus-region-active-p) (mark))
5898 (message "region active")
5899 ;; Work on the region between point and mark.
5900 (let ((max (max (point) (mark)))
5903 (goto-char (min (point) (mark)))
5906 (push (setq article (gnus-summary-article-number)) articles)
5907 (gnus-summary-find-next nil article)
5909 (nreverse articles))))
5910 (gnus-newsgroup-processable
5911 ;; There are process-marked articles present.
5912 ;; Save current state.
5913 (gnus-summary-save-process-mark)
5915 (reverse gnus-newsgroup-processable))
5917 ;; Just return the current article.
5918 (list (gnus-summary-article-number))))))
5920 (defmacro gnus-summary-iterate (arg &rest forms)
5921 "Iterate over the process/prefixed articles and do FORMS.
5922 ARG is the interactive prefix given to the command. FORMS will be
5923 executed with point over the summary line of the articles."
5924 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5925 `(let ((,articles (gnus-summary-work-articles ,arg)))
5927 (gnus-summary-goto-subject (car ,articles))
5931 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5932 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5934 (defun gnus-summary-save-process-mark ()
5935 "Push the current set of process marked articles on the stack."
5937 (push (copy-sequence gnus-newsgroup-processable)
5938 gnus-newsgroup-process-stack))
5940 (defun gnus-summary-kill-process-mark ()
5941 "Push the current set of process marked articles on the stack and unmark."
5943 (gnus-summary-save-process-mark)
5944 (gnus-summary-unmark-all-processable))
5946 (defun gnus-summary-yank-process-mark ()
5947 "Pop the last process mark state off the stack and restore it."
5949 (unless gnus-newsgroup-process-stack
5950 (error "Empty mark stack"))
5951 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5953 (defun gnus-summary-process-mark-set (set)
5954 "Make SET into the current process marked articles."
5955 (gnus-summary-unmark-all-processable)
5957 (gnus-summary-set-process-mark (pop set))))
5959 ;;; Searching and stuff
5961 (defun gnus-summary-search-group (&optional backward use-level)
5962 "Search for next unread newsgroup.
5963 If optional argument BACKWARD is non-nil, search backward instead."
5965 (set-buffer gnus-group-buffer)
5966 (when (gnus-group-search-forward
5967 backward nil (if use-level (gnus-group-group-level) nil))
5968 (gnus-group-group-name))))
5970 (defun gnus-summary-best-group (&optional exclude-group)
5971 "Find the name of the best unread group.
5972 If EXCLUDE-GROUP, do not go to this group."
5974 (set-buffer gnus-group-buffer)
5976 (gnus-group-best-unread-group exclude-group))))
5978 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5979 (if backward (gnus-summary-find-prev)
5980 (let* ((dummy (gnus-summary-article-intangible-p))
5981 (article (or article (gnus-summary-article-number)))
5982 (arts (gnus-data-find-list article))
5984 (when (and (not dummy)
5985 (or (not gnus-summary-check-current)
5987 (not (gnus-data-unread-p (car arts)))))
5988 (setq arts (cdr arts)))
5993 (when (or (and undownloaded
5994 (memq (car arts) gnus-newsgroup-undownloaded))
5995 (gnus-data-unread-p (car arts)))
5996 (setq result (car arts)
5998 (setq arts (cdr arts)))
6001 (goto-char (gnus-data-pos result))
6002 (gnus-data-number result)))))
6004 (defun gnus-summary-find-prev (&optional unread article)
6005 (let* ((eobp (eobp))
6006 (article (or article (gnus-summary-article-number)))
6007 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
6009 (when (and (not eobp)
6010 (or (not gnus-summary-check-current)
6012 (not (gnus-data-unread-p (car arts)))))
6013 (setq arts (cdr arts)))
6018 (when (gnus-data-unread-p (car arts))
6019 (setq result (car arts)
6021 (setq arts (cdr arts)))
6024 (goto-char (gnus-data-pos result))
6025 (gnus-data-number result))))
6027 (defun gnus-summary-find-subject (subject &optional unread backward article)
6028 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6029 (article (or article (gnus-summary-article-number)))
6030 (articles (gnus-data-list backward))
6031 (arts (gnus-data-find-list article articles))
6033 (when (or (not gnus-summary-check-current)
6035 (not (gnus-data-unread-p (car arts))))
6036 (setq arts (cdr arts)))
6038 (and (or (not unread)
6039 (gnus-data-unread-p (car arts)))
6040 (vectorp (gnus-data-header (car arts)))
6042 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6043 (setq result (car arts)
6045 (setq arts (cdr arts)))
6047 (goto-char (gnus-data-pos result))
6048 (gnus-data-number result))))
6050 (defun gnus-summary-search-forward (&optional unread subject backward)
6051 "Search forward for an article.
6052 If UNREAD, look for unread articles. If SUBJECT, look for
6053 articles with that subject. If BACKWARD, search backward instead."
6054 (cond (subject (gnus-summary-find-subject subject unread backward))
6055 (backward (gnus-summary-find-prev unread))
6056 (t (gnus-summary-find-next unread))))
6058 (defun gnus-recenter (&optional n)
6059 "Center point in window and redisplay frame.
6060 Also do horizontal recentering."
6062 (when (and gnus-auto-center-summary
6063 (not (eq gnus-auto-center-summary 'vertical)))
6064 (gnus-horizontal-recenter))
6067 (defun gnus-summary-recenter ()
6068 "Center point in the summary window.
6069 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6070 displayed, no centering will be performed."
6071 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6072 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6074 (let* ((top (cond ((< (window-height) 4) 0)
6075 ((< (window-height) 7) 1)
6076 (t (if (numberp gnus-auto-center-summary)
6077 gnus-auto-center-summary
6079 (height (1- (window-height)))
6080 (bottom (save-excursion (goto-char (point-max))
6081 (forward-line (- height))
6083 (window (get-buffer-window (current-buffer))))
6084 ;; The user has to want it.
6085 (when gnus-auto-center-summary
6086 (when (get-buffer-window gnus-article-buffer)
6087 ;; Only do recentering when the article buffer is displayed,
6088 ;; Set the window start to either `bottom', which is the biggest
6089 ;; possible valid number, or the second line from the top,
6090 ;; whichever is the least.
6091 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6092 (if (> bottom top-pos)
6093 ;; Keep the second line from the top visible
6094 (set-window-start window top-pos t)
6095 ;; Try to keep the bottom line visible; if it's partially
6096 ;; obscured, either scroll one more line to make it fully
6097 ;; visible, or revert to using TOP-POS.
6099 (goto-char (point-max))
6101 (let ((last-line-start (point)))
6103 (set-window-start window (point) t)
6104 (when (not (pos-visible-in-window-p last-line-start window))
6106 (set-window-start window (min (point) top-pos) t)))))))
6107 ;; Do horizontal recentering while we're at it.
6108 (when (and (get-buffer-window (current-buffer) t)
6109 (not (eq gnus-auto-center-summary 'vertical)))
6110 (let ((selected (selected-window)))
6111 (select-window (get-buffer-window (current-buffer) t))
6112 (gnus-summary-position-point)
6113 (gnus-horizontal-recenter)
6114 (select-window selected))))))
6116 (defun gnus-summary-jump-to-group (newsgroup)
6117 "Move point to NEWSGROUP in group mode buffer."
6118 ;; Keep update point of group mode buffer if visible.
6119 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6120 (save-window-excursion
6121 ;; Take care of tree window mode.
6122 (when (get-buffer-window gnus-group-buffer)
6123 (pop-to-buffer gnus-group-buffer))
6124 (gnus-group-jump-to-group newsgroup))
6126 ;; Take care of tree window mode.
6127 (if (get-buffer-window gnus-group-buffer)
6128 (pop-to-buffer gnus-group-buffer)
6129 (set-buffer gnus-group-buffer))
6130 (gnus-group-jump-to-group newsgroup))))
6132 ;; This function returns a list of article numbers based on the
6133 ;; difference between the ranges of read articles in this group and
6134 ;; the range of active articles.
6135 (defun gnus-list-of-unread-articles (group)
6136 (let* ((read (gnus-info-read (gnus-get-info group)))
6137 (active (or (gnus-active group) (gnus-activate-group group)))
6140 ;; If none are read, then all are unread.
6142 (setq first (car active))
6143 ;; If the range of read articles is a single range, then the
6144 ;; first unread article is the article after the last read
6145 ;; article. Sounds logical, doesn't it?
6146 (if (and (not (listp (cdr read)))
6147 (or (< (car read) (car active))
6148 (progn (setq read (list read))
6150 (setq first (max (car active) (1+ (cdr read))))
6151 ;; `read' is a list of ranges.
6152 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6155 (setq first (car active)))
6158 (while (< first nlast)
6160 (setq first (1+ first))))
6161 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6162 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6163 (setq read (cdr read)))))
6164 ;; And add the last unread articles.
6165 (while (<= first last)
6167 (setq first (1+ first)))
6168 ;; Return the list of unread articles.
6169 (delq 0 (nreverse unread))))
6171 (defun gnus-list-of-read-articles (group)
6172 "Return a list of unread, unticked and non-dormant articles."
6173 (let* ((info (gnus-get-info group))
6174 (marked (gnus-info-marks info))
6175 (active (gnus-active group)))
6177 (gnus-list-range-difference
6178 (gnus-list-range-difference
6179 (gnus-sorted-complement
6180 (gnus-uncompress-range active)
6181 (gnus-list-of-unread-articles group))
6182 (cdr (assq 'dormant marked)))
6183 (cdr (assq 'tick marked))))))
6185 ;; Various summary commands
6187 (defun gnus-summary-select-article-buffer ()
6188 "Reconfigure windows to show article buffer."
6190 (if (not (gnus-buffer-live-p gnus-article-buffer))
6191 (error "There is no article buffer for this summary buffer")
6192 (gnus-configure-windows 'article)
6193 (select-window (get-buffer-window gnus-article-buffer))))
6195 (defun gnus-summary-universal-argument (arg)
6196 "Perform any operation on all articles that are process/prefixed."
6198 (let ((articles (gnus-summary-work-articles arg))
6205 (substitute-command-keys
6206 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6208 (gnus-error 1 "Undefined key")
6211 (gnus-summary-goto-subject (setq article (pop articles)))
6212 (let (gnus-newsgroup-processable)
6213 (command-execute func))
6214 (gnus-summary-remove-process-mark article)))))
6215 (gnus-summary-position-point))
6217 (defun gnus-summary-toggle-truncation (&optional arg)
6218 "Toggle truncation of summary lines.
6219 With arg, turn line truncation on if arg is positive."
6221 (setq truncate-lines
6222 (if (null arg) (not truncate-lines)
6223 (> (prefix-numeric-value arg) 0)))
6226 (defun gnus-summary-find-uncancelled ()
6227 "Return the number of an uncancelled article.
6228 The current article is considered, then following articles, then previous
6229 articles. If all articles are cancelled then return a dummy 0."
6231 (dolist (rev '(nil t))
6232 (unless found ; don't demand the reverse list if we don't need it
6233 (let ((data (gnus-data-find-list
6234 (gnus-summary-article-number) (gnus-data-list rev))))
6235 (while (and data (not found))
6236 (if (not (eq gnus-canceled-mark (gnus-data-mark (car data))))
6237 (setq found (gnus-data-number (car data))))
6238 (setq data (cdr data))))))
6241 (defun gnus-summary-reselect-current-group (&optional all rescan)
6242 "Exit and then reselect the current newsgroup.
6243 The prefix argument ALL means to select all articles."
6245 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6246 (error "Ephemeral groups can't be reselected"))
6247 (let ((current-subject (gnus-summary-find-uncancelled))
6248 (group gnus-newsgroup-name))
6249 (setq gnus-newsgroup-begin nil)
6251 ;; We have to adjust the point of group mode buffer because
6252 ;; point was moved to the next unread newsgroup by exiting.
6253 (gnus-summary-jump-to-group group)
6256 (save-window-excursion
6257 ;; Don't show group contents.
6258 (set-window-start (selected-window) (point-max))
6259 (gnus-group-get-new-news-this-group 1))))
6260 (gnus-group-read-group all t)
6261 (gnus-summary-goto-subject current-subject nil t)))
6263 (defun gnus-summary-rescan-group (&optional all)
6264 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6266 (gnus-summary-reselect-current-group all t))
6268 (defun gnus-summary-update-info (&optional non-destructive)
6270 (let ((group gnus-newsgroup-name))
6272 (when gnus-newsgroup-kill-headers
6273 (setq gnus-newsgroup-killed
6274 (gnus-compress-sequence
6276 (gnus-list-range-intersection
6277 gnus-newsgroup-unselected gnus-newsgroup-killed)
6278 gnus-newsgroup-unreads)
6280 (unless (listp (cdr gnus-newsgroup-killed))
6281 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6282 (let ((headers gnus-newsgroup-headers))
6283 ;; Set the new ranges of read articles.
6285 (set-buffer gnus-group-buffer)
6286 (gnus-undo-force-boundary))
6287 (gnus-update-read-articles
6288 group (gnus-sorted-union
6289 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6290 ;; Set the current article marks.
6291 (let ((gnus-newsgroup-scored
6292 (if (and (not gnus-save-score)
6293 (not non-destructive))
6295 gnus-newsgroup-scored)))
6297 (gnus-update-marks)))
6298 ;; Do the cross-ref thing.
6299 (when gnus-use-cross-reference
6300 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6301 ;; Do not switch windows but change the buffer to work.
6302 (set-buffer gnus-group-buffer)
6303 (unless (gnus-ephemeral-group-p group)
6304 (gnus-group-update-group group)))))))
6306 (defun gnus-summary-save-newsrc (&optional force)
6307 "Save the current number of read/marked articles in the dribble buffer.
6308 The dribble buffer will then be saved.
6309 If FORCE (the prefix), also save the .newsrc file(s)."
6311 (gnus-summary-update-info t)
6313 (gnus-save-newsrc-file)
6314 (gnus-dribble-save)))
6316 (defun gnus-summary-exit (&optional temporary)
6317 "Exit reading current newsgroup, and then return to group selection mode.
6318 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6320 (gnus-set-global-variables)
6321 (gnus-kill-save-kill-buffer)
6322 (gnus-async-halt-prefetch)
6323 (let* ((group gnus-newsgroup-name)
6324 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6327 (buf (current-buffer)))
6329 ;; Do adaptive scoring, and possibly save score files.
6330 (when gnus-newsgroup-adaptive
6331 (gnus-score-adaptive))
6332 (when gnus-use-scoring
6334 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6335 ;; If we have several article buffers, we kill them at exit.
6336 (unless gnus-single-article-buffer
6337 (gnus-kill-buffer gnus-original-article-buffer)
6338 (setq gnus-article-current nil))
6339 (when gnus-use-cache
6340 (gnus-cache-possibly-remove-articles)
6341 (gnus-cache-save-buffers))
6342 (gnus-async-prefetch-remove-group group)
6343 (when gnus-suppress-duplicates
6344 (gnus-dup-enter-articles))
6345 (when gnus-use-trees
6346 (gnus-tree-close group))
6347 (when gnus-use-cache
6348 (gnus-cache-write-active))
6349 ;; Remove entries for this group.
6350 (nnmail-purge-split-history (gnus-group-real-name group))
6351 ;; Make all changes in this group permanent.
6353 (gnus-run-hooks 'gnus-exit-group-hook)
6354 (gnus-summary-update-info))
6355 (gnus-close-group group)
6356 ;; Make sure where we were, and go to next newsgroup.
6357 (set-buffer gnus-group-buffer)
6359 (gnus-group-jump-to-group group))
6360 (gnus-run-hooks 'gnus-summary-exit-hook)
6361 (unless (or quit-config
6362 ;; If this group has disappeared from the summary
6363 ;; buffer, don't skip forwards.
6364 (not (string= group (gnus-group-group-name))))
6365 (gnus-group-next-unread-group 1))
6366 (setq group-point (point))
6369 ;; If we have several article buffers, we kill them at exit.
6370 (unless gnus-single-article-buffer
6371 (gnus-kill-buffer gnus-article-buffer)
6372 (gnus-kill-buffer gnus-original-article-buffer)
6373 (setq gnus-article-current nil))
6375 (if (not gnus-kill-summary-on-exit)
6377 (gnus-deaden-summary)
6379 ;; We set all buffer-local variables to nil. It is unclear why
6380 ;; this is needed, but if we don't, buffer-local variables are
6381 ;; not garbage-collected, it seems. This would the lead to en
6382 ;; ever-growing Emacs.
6383 (gnus-summary-clear-local-variables)
6384 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6385 (gnus-summary-clear-local-variables))
6386 (when (get-buffer gnus-article-buffer)
6387 (bury-buffer gnus-article-buffer))
6388 ;; We clear the global counterparts of the buffer-local
6389 ;; variables as well, just to be on the safe side.
6390 (set-buffer gnus-group-buffer)
6391 (gnus-summary-clear-local-variables)
6392 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6393 (gnus-summary-clear-local-variables)))
6394 (setq gnus-current-select-method gnus-select-method)
6395 (pop-to-buffer gnus-group-buffer)
6396 (if (not quit-config)
6398 (goto-char group-point)
6399 (gnus-configure-windows 'group 'force)
6400 (unless (pos-visible-in-window-p)
6401 (forward-line (/ (static-if (featurep 'xemacs)
6402 (window-displayed-height)
6403 (1- (window-height)))
6405 (set-window-start (selected-window) (point))
6406 (goto-char group-point)))
6407 (gnus-handle-ephemeral-exit quit-config))
6408 ;; Return to group mode buffer.
6409 (when (eq mode 'gnus-summary-mode)
6410 (gnus-kill-buffer buf))
6411 ;; Clear the current group name.
6413 (setq gnus-newsgroup-name nil)))))
6415 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6416 (defun gnus-summary-exit-no-update (&optional no-questions)
6417 "Quit reading current newsgroup without updating read article info."
6419 (let* ((group gnus-newsgroup-name)
6420 (quit-config (gnus-group-quit-config group)))
6421 (when (or no-questions
6423 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6424 (gnus-async-halt-prefetch)
6426 (delq 'gnus-summary-expire-articles
6427 (copy-sequence gnus-summary-prepare-exit-hook)))
6428 ;; If we have several article buffers, we kill them at exit.
6429 (unless gnus-single-article-buffer
6430 (gnus-kill-buffer gnus-article-buffer)
6431 (gnus-kill-buffer gnus-original-article-buffer)
6432 (setq gnus-article-current nil))
6433 (if (not gnus-kill-summary-on-exit)
6434 (gnus-deaden-summary)
6435 (gnus-close-group group)
6436 (gnus-summary-clear-local-variables)
6437 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6438 (gnus-summary-clear-local-variables))
6439 (set-buffer gnus-group-buffer)
6440 (gnus-summary-clear-local-variables)
6441 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6442 (gnus-summary-clear-local-variables))
6443 (when (get-buffer gnus-summary-buffer)
6444 (kill-buffer gnus-summary-buffer)))
6445 (unless gnus-single-article-buffer
6446 (setq gnus-article-current nil))
6447 (when gnus-use-trees
6448 (gnus-tree-close group))
6449 (gnus-async-prefetch-remove-group group)
6450 (when (get-buffer gnus-article-buffer)
6451 (bury-buffer gnus-article-buffer))
6452 ;; Return to the group buffer.
6453 (gnus-configure-windows 'group 'force)
6454 ;; Clear the current group name.
6455 (setq gnus-newsgroup-name nil)
6456 (when (equal (gnus-group-group-name) group)
6457 (gnus-group-next-unread-group 1))
6459 (gnus-handle-ephemeral-exit quit-config)))))
6461 (defun gnus-handle-ephemeral-exit (quit-config)
6462 "Handle movement when leaving an ephemeral group.
6463 The state which existed when entering the ephemeral is reset."
6464 (if (not (buffer-name (car quit-config)))
6465 (gnus-configure-windows 'group 'force)
6466 (set-buffer (car quit-config))
6467 (cond ((eq major-mode 'gnus-summary-mode)
6468 (gnus-set-global-variables))
6469 ((eq major-mode 'gnus-article-mode)
6471 ;; The `gnus-summary-buffer' variable may point
6472 ;; to the old summary buffer when using a single
6474 (unless (gnus-buffer-live-p gnus-summary-buffer)
6475 (set-buffer gnus-group-buffer))
6476 (set-buffer gnus-summary-buffer)
6477 (gnus-set-global-variables))))
6478 (if (or (eq (cdr quit-config) 'article)
6479 (eq (cdr quit-config) 'pick))
6481 ;; The current article may be from the ephemeral group
6482 ;; thus it is best that we reload this article
6483 (gnus-summary-show-article)
6484 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6485 (gnus-configure-windows 'pick 'force)
6486 (gnus-configure-windows (cdr quit-config) 'force)))
6487 (gnus-configure-windows (cdr quit-config) 'force))
6488 (when (eq major-mode 'gnus-summary-mode)
6489 (gnus-summary-next-subject 1 nil t)
6490 (gnus-summary-recenter)
6491 (gnus-summary-position-point))))
6493 (defun gnus-summary-preview-mime-message ()
6494 "MIME decode and play this message."
6496 (let ((gnus-break-pages nil)
6498 (gnus-summary-select-article gnus-show-all-headers t))
6499 (let ((w (get-buffer-window gnus-article-buffer)))
6501 (select-window (get-buffer-window gnus-article-buffer)))))
6505 (defvar gnus-dead-summary-mode-map nil)
6507 (unless gnus-dead-summary-mode-map
6508 (setq gnus-dead-summary-mode-map (make-keymap))
6509 (suppress-keymap gnus-dead-summary-mode-map)
6510 (substitute-key-definition
6511 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6512 (dolist (key '("\C-d" "\r" "\177" [delete]))
6513 (define-key gnus-dead-summary-mode-map
6514 key 'gnus-summary-wake-up-the-dead))
6515 (dolist (key '("q" "Q"))
6516 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6518 (defvar gnus-dead-summary-mode nil
6519 "Minor mode for Gnus summary buffers.")
6521 (defun gnus-dead-summary-mode (&optional arg)
6522 "Minor mode for Gnus summary buffers."
6524 (when (eq major-mode 'gnus-summary-mode)
6525 (make-local-variable 'gnus-dead-summary-mode)
6526 (setq gnus-dead-summary-mode
6527 (if (null arg) (not gnus-dead-summary-mode)
6528 (> (prefix-numeric-value arg) 0)))
6529 (when gnus-dead-summary-mode
6530 (gnus-add-minor-mode
6531 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6533 (defun gnus-deaden-summary ()
6534 "Make the current summary buffer into a dead summary buffer."
6535 ;; Kill any previous dead summary buffer.
6536 (when (and gnus-dead-summary
6537 (buffer-name gnus-dead-summary))
6539 (set-buffer gnus-dead-summary)
6540 (when gnus-dead-summary-mode
6541 (kill-buffer (current-buffer)))))
6542 ;; Make this the current dead summary.
6543 (setq gnus-dead-summary (current-buffer))
6544 (gnus-dead-summary-mode 1)
6545 (let ((name (buffer-name)))
6546 (when (string-match "Summary" name)
6548 (concat (substring name 0 (match-beginning 0)) "Dead "
6549 (substring name (match-beginning 0)))
6553 (defun gnus-kill-or-deaden-summary (buffer)
6554 "Kill or deaden the summary BUFFER."
6556 (when (and (buffer-name buffer)
6557 (not gnus-single-article-buffer))
6560 (gnus-kill-buffer gnus-article-buffer)
6561 (gnus-kill-buffer gnus-original-article-buffer)))
6564 (gnus-kill-summary-on-exit
6565 (when (and gnus-use-trees
6566 (gnus-buffer-exists-p buffer))
6569 (gnus-tree-close gnus-newsgroup-name)))
6570 (gnus-kill-buffer buffer))
6571 ;; Deaden the buffer.
6572 ((gnus-buffer-exists-p buffer)
6575 (gnus-deaden-summary))))))
6577 (defun gnus-summary-wake-up-the-dead (&rest args)
6578 "Wake up the dead summary buffer."
6580 (gnus-dead-summary-mode -1)
6581 (let ((name (buffer-name)))
6582 (when (string-match "Dead " name)
6584 (concat (substring name 0 (match-beginning 0))
6585 (substring name (match-end 0)))
6587 (gnus-message 3 "This dead summary is now alive again"))
6589 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6590 (defun gnus-summary-fetch-faq (&optional faq-dir)
6591 "Fetch the FAQ for the current group.
6592 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6596 (when current-prefix-arg
6598 "FAQ dir: " (and (listp gnus-group-faq-directory)
6599 (mapcar (lambda (file) (list file))
6600 gnus-group-faq-directory))))))
6601 (let (gnus-faq-buffer)
6602 (when (setq gnus-faq-buffer
6603 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6604 (gnus-configure-windows 'summary-faq))))
6606 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6607 (defun gnus-summary-describe-group (&optional force)
6608 "Describe the current newsgroup."
6610 (gnus-group-describe-group force gnus-newsgroup-name))
6612 (defun gnus-summary-describe-briefly ()
6613 "Describe summary mode commands briefly."
6615 (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")))
6617 ;; Walking around group mode buffer from summary mode.
6619 (defun gnus-summary-next-group (&optional no-article target-group backward)
6620 "Exit current newsgroup and then select next unread newsgroup.
6621 If prefix argument NO-ARTICLE is non-nil, no article is selected
6622 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
6623 previous group instead."
6625 ;; Stop pre-fetching.
6626 (gnus-async-halt-prefetch)
6627 (let ((current-group gnus-newsgroup-name)
6628 (current-buffer (current-buffer))
6630 (gnus-summary-exit t)
6631 (while (not entered)
6632 ;; Then we find what group we are supposed to enter.
6633 (set-buffer gnus-group-buffer)
6634 (gnus-group-jump-to-group current-group)
6637 (if (eq gnus-keep-same-level 'best)
6638 (gnus-summary-best-group gnus-newsgroup-name)
6639 (gnus-summary-search-group backward gnus-keep-same-level))))
6640 (if (not target-group)
6641 ;; There are no further groups, so we return to the group
6644 (gnus-message 5 "Returning to the group buffer")
6646 (when (gnus-buffer-live-p current-buffer)
6647 (set-buffer current-buffer)
6648 (gnus-summary-exit))
6649 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6650 ;; We try to enter the target group.
6651 (gnus-group-jump-to-group target-group)
6652 (let ((unreads (gnus-group-group-unread)))
6653 (if (and (or (eq t unreads)
6654 (and unreads (not (zerop unreads))))
6656 ;; Now we semi-exit this group to update Xrefs
6657 ;; and all variables. We can't do a real exit,
6658 ;; because the window conf must remain the same
6659 ;; in case the user is prompted for info, and we
6660 ;; don't want the window conf to change before
6662 (when (gnus-buffer-live-p current-buffer)
6663 (set-buffer current-buffer)
6664 (gnus-summary-exit t))
6665 (gnus-summary-read-group
6666 target-group nil no-article
6667 (and (buffer-name current-buffer) current-buffer)
6670 (setq current-group target-group
6671 target-group nil)))))))
6673 (defun gnus-summary-prev-group (&optional no-article)
6674 "Exit current newsgroup and then select previous unread newsgroup.
6675 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6677 (gnus-summary-next-group no-article nil t))
6679 ;; Walking around summary lines.
6681 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6682 "Go to the first unread subject.
6683 If UNREAD is non-nil, go to the first unread article.
6684 Returns the article selected or nil if there are no unread articles."
6689 ((null gnus-newsgroup-data)
6690 (gnus-message 3 "No articles in the group")
6692 ;; Pick the first article.
6694 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6695 (gnus-data-number (car gnus-newsgroup-data)))
6696 ;; No unread articles.
6697 ((null gnus-newsgroup-unreads)
6698 (gnus-message 3 "No more unread articles")
6700 ;; Find the first unread article.
6702 (let ((data gnus-newsgroup-data))
6704 (and (not (and undownloaded
6705 (memq (car data) gnus-newsgroup-undownloaded)))
6708 (gnus-data-number (car data))
6709 gnus-newsgroup-unseen))
6710 (not (gnus-data-unread-p (car data))))
6711 (not (gnus-data-unread-p (car data))))))
6712 (setq data (cdr data)))
6714 (goto-char (gnus-data-pos (car data)))
6715 (gnus-data-number (car data))))))
6716 (gnus-summary-position-point)))
6718 (defun gnus-summary-next-subject (n &optional unread dont-display)
6719 "Go to next N'th summary line.
6720 If N is negative, go to the previous N'th subject line.
6721 If UNREAD is non-nil, only unread articles are selected.
6722 The difference between N and the actual number of steps taken is
6725 (let ((backward (< n 0))
6729 (gnus-summary-find-prev unread)
6730 (gnus-summary-find-next unread)))
6731 (unless (zerop (setq n (1- n)))
6732 (gnus-summary-show-thread)))
6734 (gnus-message 7 "No more%s articles"
6735 (if unread " unread" "")))
6736 (unless dont-display
6737 (gnus-summary-recenter)
6738 (gnus-summary-position-point))
6741 (defun gnus-summary-next-unread-subject (n)
6742 "Go to next N'th unread summary line."
6744 (gnus-summary-next-subject n t))
6746 (defun gnus-summary-prev-subject (n &optional unread)
6747 "Go to previous N'th summary line.
6748 If optional argument UNREAD is non-nil, only unread article is selected."
6750 (gnus-summary-next-subject (- n) unread))
6752 (defun gnus-summary-prev-unread-subject (n)
6753 "Go to previous N'th unread summary line."
6755 (gnus-summary-next-subject (- n) t))
6757 (defun gnus-summary-goto-subject (article &optional force silent)
6758 "Go the subject line of ARTICLE.
6759 If FORCE, also allow jumping to articles not currently shown."
6760 (interactive "nArticle number: ")
6761 (unless (numberp article)
6762 (error "Article %s is not a number" article))
6764 (data (gnus-data-find article)))
6765 ;; We read in the article if we have to.
6768 (gnus-summary-insert-subject
6770 (if (or (numberp force) (vectorp force)) force)
6772 (setq data (gnus-data-find article)))
6777 (gnus-message 3 "Can't find article %d" article))
6779 (let ((pt (gnus-data-pos data)))
6781 (gnus-summary-set-article-display-arrow pt))
6782 (gnus-summary-position-point)
6785 ;; Walking around summary lines with displaying articles.
6787 (defun gnus-summary-expand-window (&optional arg)
6788 "Make the summary buffer take up the entire Emacs frame.
6789 Given a prefix, will force an `article' buffer configuration."
6792 (gnus-configure-windows 'article 'force)
6793 (gnus-configure-windows 'summary 'force)))
6795 (defun gnus-summary-display-article (article &optional all-header)
6796 "Display ARTICLE in article buffer."
6797 (when (gnus-buffer-live-p gnus-article-buffer)
6798 (with-current-buffer gnus-article-buffer
6799 (set-buffer-multibyte t)))
6800 (gnus-set-global-variables)
6801 (when (gnus-buffer-live-p gnus-article-buffer)
6802 (with-current-buffer gnus-article-buffer
6803 (setq gnus-article-charset gnus-newsgroup-charset)
6804 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
6805 (set-buffer-multibyte t)))
6809 (if gnus-summary-display-article-function
6810 (funcall gnus-summary-display-article-function article all-header)
6811 (gnus-article-prepare article all-header))
6812 (with-current-buffer gnus-article-buffer
6813 (set (make-local-variable 'gnus-summary-search-article-matched-data)
6815 (gnus-run-hooks 'gnus-select-article-hook)
6816 (when (and gnus-current-article
6817 (not (zerop gnus-current-article)))
6818 (gnus-summary-goto-subject gnus-current-article))
6819 (gnus-summary-recenter)
6820 (when (and gnus-use-trees gnus-show-threads)
6821 (gnus-possibly-generate-tree article)
6822 (gnus-highlight-selected-tree article))
6823 ;; Successfully display article.
6824 (gnus-article-set-window-start
6825 (cdr (assq article gnus-newsgroup-bookmarks))))))
6827 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
6828 "Select the current article.
6829 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
6830 non-nil, the article will be re-fetched even if it already present in
6831 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
6833 ;; Make sure we are in the summary buffer to work around bbdb bug.
6834 (unless (eq major-mode 'gnus-summary-mode)
6835 (set-buffer gnus-summary-buffer))
6836 (let ((article (or article (gnus-summary-article-number)))
6837 (all-headers (not (not all-headers))) ;Must be T or NIL.
6838 gnus-summary-display-article-function)
6840 (gnus-summary-article-pseudo-p article)
6841 (error "This is a pseudo-article"))
6843 (set-buffer gnus-summary-buffer)
6844 (if (or (and gnus-single-article-buffer
6845 (or (null gnus-current-article)
6846 (null gnus-article-current)
6847 (null (get-buffer gnus-article-buffer))
6848 (not (eq article (cdr gnus-article-current)))
6849 (not (equal (car gnus-article-current)
6850 gnus-newsgroup-name))))
6851 (and (not gnus-single-article-buffer)
6852 (or (null gnus-current-article)
6853 (not (eq gnus-current-article article))))
6855 ;; The requested article is different from the current article.
6857 (gnus-summary-display-article article all-headers)
6858 (gnus-article-set-window-start
6859 (cdr (assq article gnus-newsgroup-bookmarks)))
6863 (defun gnus-summary-force-verify-and-decrypt ()
6865 (let ((mm-verify-option 'known)
6866 (mm-decrypt-option 'known)
6867 (gnus-buttonized-mime-types (append (list "multipart/signed"
6868 "multipart/encrypted")
6869 gnus-buttonized-mime-types)))
6870 (gnus-summary-select-article nil 'force)))
6872 (defun gnus-summary-set-current-mark (&optional current-mark)
6873 "Obsolete function."
6876 (defun gnus-summary-next-article (&optional unread subject backward push)
6877 "Select the next article.
6878 If UNREAD, only unread articles are selected.
6879 If SUBJECT, only articles with SUBJECT are selected.
6880 If BACKWARD, the previous article is selected instead of the next."
6883 ;; Is there such an article?
6884 ((and (gnus-summary-search-forward unread subject backward)
6885 (or (gnus-summary-display-article (gnus-summary-article-number))
6886 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
6887 (gnus-summary-position-point))
6888 ;; If not, we try the first unread, if that is wanted.
6890 gnus-auto-select-same
6891 (gnus-summary-first-unread-article))
6892 (gnus-summary-position-point)
6893 (gnus-message 6 "Wrapped"))
6894 ;; Try to get next/previous article not displayed in this group.
6895 ((and gnus-auto-extend-newsgroup
6896 (not unread) (not subject))
6897 (gnus-summary-goto-article
6898 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
6899 nil (count-lines (point-min) (point))))
6900 ;; Go to next/previous group.
6902 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
6903 (gnus-summary-jump-to-group gnus-newsgroup-name))
6904 (let ((cmd last-command-char)
6907 (set-buffer gnus-group-buffer)
6910 (if (eq gnus-keep-same-level 'best)
6911 (gnus-summary-best-group gnus-newsgroup-name)
6912 (gnus-summary-search-group backward gnus-keep-same-level))))
6913 ;; For some reason, the group window gets selected. We change
6915 (select-window (get-buffer-window (current-buffer)))
6916 ;; Select next unread newsgroup automagically.
6918 ((or (not gnus-auto-select-next)
6920 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
6921 ((or (eq gnus-auto-select-next 'quietly)
6922 (and (eq gnus-auto-select-next 'slightly-quietly)
6924 (and (eq gnus-auto-select-next 'almost-quietly)
6925 (gnus-summary-last-article-p)))
6927 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
6929 (gnus-message 7 "No more%s articles (%s)..."
6930 (if unread " unread" "")
6931 (if group (concat "selecting " group)
6933 (gnus-summary-next-group nil group backward)))
6935 (when (gnus-key-press-event-p last-input-event)
6936 (gnus-summary-walk-group-buffer
6937 gnus-newsgroup-name cmd unread backward point))))))))
6939 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
6940 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
6941 (?\C-p (gnus-group-prev-unread-group 1))))
6942 (cursor-in-echo-area t)
6943 keve key group ended)
6945 (set-buffer gnus-group-buffer)
6948 (if (eq gnus-keep-same-level 'best)
6949 (gnus-summary-best-group gnus-newsgroup-name)
6950 (gnus-summary-search-group backward gnus-keep-same-level))))
6953 5 "No more%s articles%s" (if unread " unread" "")
6955 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
6956 (format " (Type %s for %s [%s])"
6957 (single-key-description cmd) group
6958 (car (gnus-gethash group gnus-newsrc-hashtb)))
6959 (format " (Type %s to exit %s)"
6960 (single-key-description cmd)
6961 gnus-newsgroup-name)))
6962 ;; Confirm auto selection.
6963 (setq key (car (setq keve (gnus-read-event-char))))
6966 ((assq key keystrokes)
6967 (let ((obuf (current-buffer)))
6968 (switch-to-buffer gnus-group-buffer)
6970 (gnus-group-jump-to-group group))
6971 (eval (cadr (assq key keystrokes)))
6972 (setq group (gnus-group-group-name))
6973 (switch-to-buffer obuf))
6977 (gnus-ephemeral-group-p gnus-newsgroup-name))
6979 (gnus-summary-next-group nil group backward)))
6981 (push (cdr keve) unread-command-events))))))
6983 (defun gnus-summary-next-unread-article ()
6984 "Select unread article after current one."
6986 (gnus-summary-next-article
6987 (or (not (eq gnus-summary-goto-unread 'never))
6988 (gnus-summary-last-article-p (gnus-summary-article-number)))
6989 (and gnus-auto-select-same
6990 (gnus-summary-article-subject))))
6992 (defun gnus-summary-prev-article (&optional unread subject)
6993 "Select the article after the current one.
6994 If UNREAD is non-nil, only unread articles are selected."
6996 (gnus-summary-next-article unread subject t))
6998 (defun gnus-summary-prev-unread-article ()
6999 "Select unread article before current one."
7001 (gnus-summary-prev-article
7002 (or (not (eq gnus-summary-goto-unread 'never))
7003 (gnus-summary-first-article-p (gnus-summary-article-number)))
7004 (and gnus-auto-select-same
7005 (gnus-summary-article-subject))))
7007 (defun gnus-summary-next-page (&optional lines circular stop)
7008 "Show next page of the selected article.
7009 If at the end of the current article, select the next article.
7010 LINES says how many lines should be scrolled up.
7012 If CIRCULAR is non-nil, go to the start of the article instead of
7013 selecting the next article when reaching the end of the current
7016 If STOP is non-nil, just stop when reaching the end of the message."
7018 (setq gnus-summary-buffer (current-buffer))
7019 (gnus-set-global-variables)
7020 (let ((article (gnus-summary-article-number))
7021 (article-window (get-buffer-window gnus-article-buffer t))
7023 ;; If the buffer is empty, we have no article.
7025 (error "No article to select"))
7026 (gnus-configure-windows 'article)
7027 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7028 (if (and (eq gnus-summary-goto-unread 'never)
7029 (not (gnus-summary-last-article-p article)))
7030 (gnus-summary-next-article)
7031 (gnus-summary-next-unread-article))
7032 (if (or (null gnus-current-article)
7033 (null gnus-article-current)
7034 (/= article (cdr gnus-article-current))
7035 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7036 ;; Selected subject is different from current article's.
7037 (gnus-summary-display-article article)
7038 (when article-window
7039 (gnus-eval-in-buffer-window gnus-article-buffer
7040 (setq endp (gnus-article-next-page lines)))
7043 (gnus-message 3 "End of message"))
7045 (gnus-summary-beginning-of-article))
7047 (gnus-message 3 "End of message"))
7049 (if (and (eq gnus-summary-goto-unread 'never)
7050 (not (gnus-summary-last-article-p article)))
7051 (gnus-summary-next-article)
7052 (gnus-summary-next-unread-article))))))))
7053 (gnus-summary-recenter)
7054 (gnus-summary-position-point)))
7056 (defun gnus-summary-prev-page (&optional lines move)
7057 "Show previous page of selected article.
7058 Argument LINES specifies lines to be scrolled down.
7059 If MOVE, move to the previous unread article if point is at
7060 the beginning of the buffer."
7062 (let ((article (gnus-summary-article-number))
7063 (article-window (get-buffer-window gnus-article-buffer t))
7065 (gnus-configure-windows 'article)
7066 (if (or (null gnus-current-article)
7067 (null gnus-article-current)
7068 (/= article (cdr gnus-article-current))
7069 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7070 ;; Selected subject is different from current article's.
7071 (gnus-summary-display-article article)
7072 (gnus-summary-recenter)
7073 (when article-window
7074 (gnus-eval-in-buffer-window gnus-article-buffer
7075 (setq endp (gnus-article-prev-page lines)))
7076 (when (and move endp)
7078 (gnus-message 3 "Beginning of message"))
7080 (if (and (eq gnus-summary-goto-unread 'never)
7081 (not (gnus-summary-first-article-p article)))
7082 (gnus-summary-prev-article)
7083 (gnus-summary-prev-unread-article))))))))
7084 (gnus-summary-position-point))
7086 (defun gnus-summary-prev-page-or-article (&optional lines)
7087 "Show previous page of selected article.
7088 Argument LINES specifies lines to be scrolled down.
7089 If at the beginning of the article, go to the next article."
7091 (gnus-summary-prev-page lines t))
7093 (defun gnus-summary-scroll-up (lines)
7094 "Scroll up (or down) one line current article.
7095 Argument LINES specifies lines to be scrolled up (or down if negative)."
7097 (gnus-configure-windows 'article)
7098 (gnus-summary-show-thread)
7099 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7100 (gnus-eval-in-buffer-window gnus-article-buffer
7102 (when (gnus-article-next-page lines)
7103 (gnus-message 3 "End of message")))
7105 (gnus-article-prev-page (- lines))))))
7106 (gnus-summary-recenter)
7107 (gnus-summary-position-point))
7109 (defun gnus-summary-scroll-down (lines)
7110 "Scroll down (or up) one line current article.
7111 Argument LINES specifies lines to be scrolled down (or up if negative)."
7113 (gnus-summary-scroll-up (- lines)))
7115 (defun gnus-summary-next-same-subject ()
7116 "Select next article which has the same subject as current one."
7118 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7120 (defun gnus-summary-prev-same-subject ()
7121 "Select previous article which has the same subject as current one."
7123 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7125 (defun gnus-summary-next-unread-same-subject ()
7126 "Select next unread article which has the same subject as current one."
7128 (gnus-summary-next-article t (gnus-summary-article-subject)))
7130 (defun gnus-summary-prev-unread-same-subject ()
7131 "Select previous unread article which has the same subject as current one."
7133 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7135 (defun gnus-summary-first-unread-article ()
7136 "Select the first unread article.
7137 Return nil if there are no unread articles."
7140 (when (gnus-summary-first-subject t)
7141 (gnus-summary-show-thread)
7142 (gnus-summary-first-subject t)
7143 (gnus-summary-display-article (gnus-summary-article-number)))
7144 (gnus-summary-position-point)))
7146 (defun gnus-summary-first-unread-subject ()
7147 "Place the point on the subject line of the first unread article.
7148 Return nil if there are no unread articles."
7151 (when (gnus-summary-first-subject t)
7152 (gnus-summary-show-thread)
7153 (gnus-summary-first-subject t))
7154 (gnus-summary-position-point)))
7156 (defun gnus-summary-first-unseen-subject ()
7157 "Place the point on the subject line of the first unseen article.
7158 Return nil if there are no unseen articles."
7161 (when (gnus-summary-first-subject t t t)
7162 (gnus-summary-show-thread)
7163 (gnus-summary-first-subject t t t))
7164 (gnus-summary-position-point)))
7166 (defun gnus-summary-first-unseen-or-unread-subject ()
7167 "Place the point on the subject line of the first unseen article.
7168 Return nil if there are no unseen articles."
7171 (unless (when (gnus-summary-first-subject t t t)
7172 (gnus-summary-show-thread)
7173 (gnus-summary-first-subject t t t))
7174 (when (gnus-summary-first-subject t)
7175 (gnus-summary-show-thread)
7176 (gnus-summary-first-subject t)))
7177 (gnus-summary-position-point)))
7179 (defun gnus-summary-first-article ()
7180 "Select the first article.
7181 Return nil if there are no articles."
7184 (when (gnus-summary-first-subject)
7185 (gnus-summary-show-thread)
7186 (gnus-summary-first-subject)
7187 (gnus-summary-display-article (gnus-summary-article-number)))
7188 (gnus-summary-position-point)))
7190 (defun gnus-summary-best-unread-article (&optional arg)
7191 "Select the unread article with the highest score.
7192 If given a prefix argument, select the next unread article that has a
7193 score higher than the default score."
7195 (let ((article (if arg
7196 (gnus-summary-better-unread-subject)
7197 (gnus-summary-best-unread-subject))))
7199 (gnus-summary-goto-article article)
7200 (error "No unread articles"))))
7202 (defun gnus-summary-best-unread-subject ()
7203 "Select the unread subject with the highest score."
7205 (let ((best -1000000)
7206 (data gnus-newsgroup-data)
7209 (and (gnus-data-unread-p (car data))
7211 (gnus-summary-article-score (gnus-data-number (car data))))
7214 article (gnus-data-number (car data))))
7215 (setq data (cdr data)))
7217 (gnus-summary-goto-subject article))
7218 (gnus-summary-position-point)
7221 (defun gnus-summary-better-unread-subject ()
7222 "Select the first unread subject that has a score over the default score."
7224 (let ((data gnus-newsgroup-data)
7226 (while (and (setq article (gnus-data-number (car data)))
7227 (or (gnus-data-read-p (car data))
7228 (not (> (gnus-summary-article-score article)
7229 gnus-summary-default-score))))
7230 (setq data (cdr data)))
7232 (gnus-summary-goto-subject article))
7233 (gnus-summary-position-point)
7236 (defun gnus-summary-last-subject ()
7237 "Go to the last displayed subject line in the group."
7238 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7240 (gnus-summary-goto-subject article))))
7242 (defun gnus-summary-goto-article (article &optional all-headers force)
7243 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7244 If ALL-HEADERS is non-nil, no header lines are hidden.
7245 If FORCE, go to the article even if it isn't displayed. If FORCE
7246 is a number, it is the line the article is to be displayed on."
7250 "Article number or Message-ID: "
7251 (mapcar (lambda (number) (list (int-to-string number)))
7252 gnus-newsgroup-limit))
7256 (if (and (stringp article)
7257 (string-match "@" article))
7258 (gnus-summary-refer-article article)
7259 (when (stringp article)
7260 (setq article (string-to-number article)))
7261 (if (gnus-summary-goto-subject article force)
7262 (gnus-summary-display-article article all-headers)
7263 (gnus-message 4 "Couldn't go to article %s" article) nil))
7264 (gnus-summary-position-point)))
7266 (defun gnus-summary-goto-last-article ()
7267 "Go to the previously read article."
7270 (when gnus-last-article
7271 (gnus-summary-goto-article gnus-last-article nil t))
7272 (gnus-summary-position-point)))
7274 (defun gnus-summary-pop-article (number)
7275 "Pop one article off the history and go to the previous.
7276 NUMBER articles will be popped off."
7279 (setq gnus-newsgroup-history
7280 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7282 (gnus-summary-goto-article (car to) nil t)
7283 (error "Article history empty")))
7284 (gnus-summary-position-point))
7286 ;; Summary commands and functions for limiting the summary buffer.
7288 (defun gnus-summary-limit-to-articles (n)
7289 "Limit the summary buffer to the next N articles.
7290 If not given a prefix, use the process marked articles instead."
7293 (let ((articles (gnus-summary-work-articles n)))
7294 (setq gnus-newsgroup-processable nil)
7295 (gnus-summary-limit articles))
7296 (gnus-summary-position-point)))
7298 (defun gnus-summary-pop-limit (&optional total)
7299 "Restore the previous limit.
7300 If given a prefix, remove all limits."
7303 (setq gnus-newsgroup-limits
7304 (list (mapcar (lambda (h) (mail-header-number h))
7305 gnus-newsgroup-headers))))
7306 (unless gnus-newsgroup-limits
7307 (error "No limit to pop"))
7309 (gnus-summary-limit nil 'pop)
7310 (gnus-summary-position-point)))
7312 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7313 "Limit the summary buffer to articles that have subjects that match a regexp.
7314 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7316 (list (read-string (if current-prefix-arg
7317 "Exclude subject (regexp): "
7318 "Limit to subject (regexp): "))
7319 nil current-prefix-arg))
7321 (setq header "subject"))
7322 (when (not (equal "" subject))
7324 (let ((articles (gnus-summary-find-matching
7325 (or header "subject") subject 'all nil nil
7328 (error "Found no matches for \"%s\"" subject))
7329 (gnus-summary-limit articles))
7330 (gnus-summary-position-point))))
7332 (defun gnus-summary-limit-to-author (from &optional not-matching)
7333 "Limit the summary buffer to articles that have authors that match a regexp.
7334 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7336 (list (read-string (if current-prefix-arg
7337 "Exclude author (regexp): "
7338 "Limit to author (regexp): "))
7339 current-prefix-arg))
7340 (gnus-summary-limit-to-subject from "from" not-matching))
7342 (defun gnus-summary-limit-to-age (age &optional younger-p)
7343 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7344 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7345 articles that are younger than AGE days."
7347 (let ((younger current-prefix-arg)
7350 (while (not days-got)
7351 (setq days (if younger
7352 (read-string "Limit to articles younger than (in days, older when negative): ")
7354 "Limit to articles older than (in days, younger when negative): ")))
7355 (when (> (length days) 0)
7356 (setq days (read days)))
7362 (setq younger (not younger))
7363 (setq days (* days -1)))))
7364 (message "Please enter a number.")
7366 (list days younger)))
7368 (let ((data gnus-newsgroup-data)
7369 (cutoff (days-to-time age))
7370 articles d date is-younger)
7371 (while (setq d (pop data))
7372 (when (and (vectorp (gnus-data-header d))
7373 (setq date (mail-header-date (gnus-data-header d))))
7374 (setq is-younger (time-less-p
7375 (time-since (condition-case ()
7382 (push (gnus-data-number d) articles))))
7383 (gnus-summary-limit (nreverse articles)))
7384 (gnus-summary-position-point)))
7386 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7387 "Limit the summary buffer to articles that match an 'extra' header."
7391 (gnus-completing-read-with-default
7392 (symbol-name (car gnus-extra-headers))
7393 (if current-prefix-arg
7394 "Exclude extra header:"
7395 "Limit extra header:")
7397 (cons (symbol-name x) x))
7402 (read-string (format "%s header %s (regexp): "
7403 (if current-prefix-arg "Exclude" "Limit to")
7405 current-prefix-arg)))
7406 (when (not (equal "" regexp))
7408 (let ((articles (gnus-summary-find-matching
7409 (cons 'extra header) regexp 'all nil nil
7412 (error "Found no matches for \"%s\"" regexp))
7413 (gnus-summary-limit articles))
7414 (gnus-summary-position-point))))
7416 (defun gnus-summary-limit-to-display-predicate ()
7417 "Limit the summary buffer to the predicated in the `display' group parameter."
7419 (unless gnus-newsgroup-display
7420 (error "There is no `display' group parameter"))
7422 (dolist (number gnus-newsgroup-articles)
7423 (when (funcall gnus-newsgroup-display)
7424 (push number articles)))
7425 (gnus-summary-limit articles))
7426 (gnus-summary-position-point))
7428 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7430 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7432 (defun gnus-summary-limit-to-unread (&optional all)
7433 "Limit the summary buffer to articles that are not marked as read.
7434 If ALL is non-nil, limit strictly to unread articles."
7437 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7438 (gnus-summary-limit-to-marks
7439 ;; Concat all the marks that say that an article is read and have
7441 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7442 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7443 gnus-low-score-mark gnus-expirable-mark
7444 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7445 gnus-duplicate-mark gnus-souped-mark)
7448 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7449 (make-obsolete 'gnus-summary-delete-marked-with
7450 'gnus-summary-limit-exclude-marks)
7452 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7453 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7454 If REVERSE, limit the summary buffer to articles that are marked
7455 with MARKS. MARKS can either be a string of marks or a list of marks.
7456 Returns how many articles were removed."
7457 (interactive "sMarks: ")
7458 (gnus-summary-limit-to-marks marks t))
7460 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7461 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7462 If REVERSE (the prefix), limit the summary buffer to articles that are
7463 not marked with MARKS. MARKS can either be a string of marks or a
7465 Returns how many articles were removed."
7466 (interactive "sMarks: \nP")
7468 (let ((data gnus-newsgroup-data)
7469 (marks (if (listp marks) marks
7470 (append marks nil))) ; Transform to list.
7473 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7474 (memq (gnus-data-mark (car data)) marks))
7475 (push (gnus-data-number (car data)) articles))
7476 (setq data (cdr data)))
7477 (gnus-summary-limit articles))
7478 (gnus-summary-position-point)))
7480 (defun gnus-summary-limit-to-score (score)
7481 "Limit to articles with score at or above SCORE."
7482 (interactive "NLimit to articles with score of at least: ")
7483 (let ((data gnus-newsgroup-data)
7486 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7488 (push (gnus-data-number (car data)) articles))
7489 (setq data (cdr data)))
7491 (gnus-summary-limit articles)
7492 (gnus-summary-position-point))))
7494 (defun gnus-summary-limit-to-unseen ()
7495 "Limit to unseen articles."
7498 (gnus-summary-limit gnus-newsgroup-unseen)
7499 (gnus-summary-position-point)))
7501 (defun gnus-summary-limit-include-thread (id)
7502 "Display all the hidden articles that is in the thread with ID in it.
7503 When called interactively, ID is the Message-ID of the current
7505 (interactive (list (mail-header-id (gnus-summary-article-header))))
7506 (let ((articles (gnus-articles-in-thread
7507 (gnus-id-to-thread (gnus-root-id id)))))
7509 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7510 (gnus-summary-limit-include-matching-articles
7512 (regexp-quote (gnus-simplify-subject-re
7513 (mail-header-subject (gnus-id-to-header id)))))
7514 (gnus-summary-position-point))))
7516 (defun gnus-summary-limit-include-matching-articles (header regexp)
7517 "Display all the hidden articles that have HEADERs that match REGEXP."
7518 (interactive (list (read-string "Match on header: ")
7519 (read-string "Regexp: ")))
7520 (let ((articles (gnus-find-matching-articles header regexp)))
7522 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7523 (gnus-summary-position-point))))
7525 (defun gnus-summary-limit-include-dormant ()
7526 "Display all the hidden articles that are marked as dormant.
7527 Note that this command only works on a subset of the articles currently
7528 fetched for this group."
7530 (unless gnus-newsgroup-dormant
7531 (error "There are no dormant articles in this group"))
7533 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7534 (gnus-summary-position-point)))
7536 (defun gnus-summary-limit-exclude-dormant ()
7537 "Hide all dormant articles."
7540 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7541 (gnus-summary-position-point)))
7543 (defun gnus-summary-limit-exclude-childless-dormant ()
7544 "Hide all dormant articles that have no children."
7546 (let ((data (gnus-data-list t))
7547 articles d children)
7548 ;; Find all articles that are either not dormant or have
7550 (while (setq d (pop data))
7551 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7553 (gnus-article-children (gnus-data-number d)))
7556 (when (memq (car children) articles)
7561 (push (gnus-data-number d) articles)))
7564 (gnus-summary-limit articles)
7565 (gnus-summary-position-point))))
7567 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7568 "Mark all unread excluded articles as read.
7569 If ALL, mark even excluded ticked and dormants as read."
7571 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7572 (let ((articles (gnus-sorted-ndifference
7574 (mapcar (lambda (h) (mail-header-number h))
7575 gnus-newsgroup-headers)
7577 gnus-newsgroup-limit))
7579 (setq gnus-newsgroup-unreads
7580 (gnus-sorted-intersection gnus-newsgroup-unreads
7581 gnus-newsgroup-limit))
7583 (setq gnus-newsgroup-dormant nil
7584 gnus-newsgroup-marked nil
7585 gnus-newsgroup-reads
7587 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7588 gnus-newsgroup-reads))
7589 (while (setq article (pop articles))
7590 (unless (or (memq article gnus-newsgroup-dormant)
7591 (memq article gnus-newsgroup-marked))
7592 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7594 (defun gnus-summary-limit (articles &optional pop)
7596 ;; We pop the previous limit off the stack and use that.
7597 (setq articles (car gnus-newsgroup-limits)
7598 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7599 ;; We use the new limit, so we push the old limit on the stack.
7600 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7602 (setq gnus-newsgroup-limit articles)
7603 (let ((total (length gnus-newsgroup-data))
7604 (data (gnus-data-find-list (gnus-summary-article-number)))
7605 (gnus-summary-mark-below nil) ; Inhibit this.
7607 ;; This will do all the work of generating the new summary buffer
7608 ;; according to the new limit.
7609 (gnus-summary-prepare)
7610 ;; Hide any threads, possibly.
7611 (gnus-summary-maybe-hide-threads)
7612 ;; Try to return to the article you were at, or one in the
7615 ;; We try to find some article after the current one.
7617 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7620 (setq data (cdr data))))
7622 ;; If there is no data, that means that we were after the last
7623 ;; article. The same goes when we can't find any articles
7624 ;; after the current one.
7625 (goto-char (point-max))
7626 (gnus-summary-find-prev))
7627 (gnus-set-mode-line 'summary)
7628 ;; We return how many articles were removed from the summary
7629 ;; buffer as a result of the new limit.
7630 (- total (length gnus-newsgroup-data))))
7632 (defsubst gnus-invisible-cut-children (threads)
7635 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7640 (defsubst gnus-cut-thread (thread)
7641 "Go forwards in the thread until we find an article that we want to display."
7642 (when (or (eq gnus-fetch-old-headers 'some)
7643 (eq gnus-fetch-old-headers 'invisible)
7644 (numberp gnus-fetch-old-headers)
7645 (eq gnus-build-sparse-threads 'some)
7646 (eq gnus-build-sparse-threads 'more))
7647 ;; Deal with old-fetched headers and sparse threads.
7651 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7652 (gnus-summary-article-ancient-p
7653 (mail-header-number (car thread))))
7654 (if (or (<= (length (cdr thread)) 1)
7655 (eq gnus-fetch-old-headers 'invisible))
7656 (setq gnus-newsgroup-limit
7657 (delq (mail-header-number (car thread))
7658 gnus-newsgroup-limit)
7659 thread (cadr thread))
7660 (when (gnus-invisible-cut-children (cdr thread))
7661 (let ((th (cdr thread)))
7663 (if (memq (mail-header-number (caar th))
7664 gnus-newsgroup-limit)
7665 (setq thread (car th)
7667 (setq th (cdr th))))))))))
7670 (defun gnus-cut-threads (threads)
7671 "Cut off all uninteresting articles from the beginning of threads."
7672 (when (or (eq gnus-fetch-old-headers 'some)
7673 (eq gnus-fetch-old-headers 'invisible)
7674 (numberp gnus-fetch-old-headers)
7675 (eq gnus-build-sparse-threads 'some)
7676 (eq gnus-build-sparse-threads 'more))
7679 (setcar th (gnus-cut-thread (car th)))
7680 (setq th (cdr th)))))
7681 ;; Remove nixed out threads.
7684 (defun gnus-summary-initial-limit (&optional show-if-empty)
7685 "Figure out what the initial limit is supposed to be on group entry.
7686 This entails weeding out unwanted dormants, low-scored articles,
7687 fetch-old-headers verbiage, and so on."
7688 ;; Most groups have nothing to remove.
7689 (if (or gnus-inhibit-limiting
7690 (and (null gnus-newsgroup-dormant)
7691 (eq gnus-newsgroup-display 'gnus-not-ignore)
7692 (not (eq gnus-fetch-old-headers 'some))
7693 (not (numberp gnus-fetch-old-headers))
7694 (not (eq gnus-fetch-old-headers 'invisible))
7695 (null gnus-summary-expunge-below)
7696 (not (eq gnus-build-sparse-threads 'some))
7697 (not (eq gnus-build-sparse-threads 'more))
7698 (null gnus-thread-expunge-below)
7699 (not gnus-use-nocem)))
7701 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7702 (setq gnus-newsgroup-limit nil)
7705 (unless (car (symbol-value node))
7706 ;; These threads have no parents -- they are roots.
7707 (let ((nodes (cdr (symbol-value node)))
7710 (if (and gnus-thread-expunge-below
7711 (< (gnus-thread-total-score (car nodes))
7712 gnus-thread-expunge-below))
7713 (gnus-expunge-thread (pop nodes))
7714 (setq thread (pop nodes))
7715 (gnus-summary-limit-children thread))))))
7716 gnus-newsgroup-dependencies)
7717 ;; If this limitation resulted in an empty group, we might
7718 ;; pop the previous limit and use it instead.
7719 (when (and (not gnus-newsgroup-limit)
7721 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7722 gnus-newsgroup-limit))
7724 (defun gnus-summary-limit-children (thread)
7725 "Return 1 if this subthread is visible and 0 if it is not."
7726 ;; First we get the number of visible children to this thread. This
7727 ;; is done by recursing down the thread using this function, so this
7728 ;; will really go down to a leaf article first, before slowly
7729 ;; working its way up towards the root.
7731 (let* ((max-lisp-eval-depth 5000)
7734 (apply '+ (mapcar 'gnus-summary-limit-children
7737 (number (mail-header-number (car thread)))
7740 (not (memq number gnus-newsgroup-marked))
7742 ;; If this article is dormant and has absolutely no visible
7743 ;; children, then this article isn't visible.
7744 (and (memq number gnus-newsgroup-dormant)
7746 ;; If this is "fetch-old-headered" and there is no
7747 ;; visible children, then we don't want this article.
7748 (and (or (eq gnus-fetch-old-headers 'some)
7749 (numberp gnus-fetch-old-headers))
7750 (gnus-summary-article-ancient-p number)
7752 ;; If this is "fetch-old-headered" and `invisible', then
7753 ;; we don't want this article.
7754 (and (eq gnus-fetch-old-headers 'invisible)
7755 (gnus-summary-article-ancient-p number))
7756 ;; If this is a sparsely inserted article with no children,
7757 ;; we don't want it.
7758 (and (eq gnus-build-sparse-threads 'some)
7759 (gnus-summary-article-sparse-p number)
7761 ;; If we use expunging, and this article is really
7762 ;; low-scored, then we don't want this article.
7763 (when (and gnus-summary-expunge-below
7765 (or (cdr (assq number gnus-newsgroup-scored))
7766 gnus-summary-default-score))
7767 gnus-summary-expunge-below))
7768 ;; We increase the expunge-tally here, but that has
7769 ;; nothing to do with the limits, really.
7770 (incf gnus-newsgroup-expunged-tally)
7771 ;; We also mark as read here, if that's wanted.
7772 (when (and gnus-summary-mark-below
7773 (< score gnus-summary-mark-below))
7774 (setq gnus-newsgroup-unreads
7775 (delq number gnus-newsgroup-unreads))
7776 (if gnus-newsgroup-auto-expire
7777 (push number gnus-newsgroup-expirable)
7778 (push (cons number gnus-low-score-mark)
7779 gnus-newsgroup-reads)))
7781 ;; Do the `display' group parameter.
7782 (and gnus-newsgroup-display
7783 (not (funcall gnus-newsgroup-display)))
7784 ;; Check NoCeM things.
7785 (if (and gnus-use-nocem
7786 (gnus-nocem-unwanted-article-p
7787 (mail-header-id (car thread))))
7789 (setq gnus-newsgroup-unreads
7790 (delq number gnus-newsgroup-unreads))
7792 ;; Nope, invisible article.
7794 ;; Ok, this article is to be visible, so we add it to the limit
7796 (push number gnus-newsgroup-limit)
7799 (defun gnus-expunge-thread (thread)
7800 "Mark all articles in THREAD as read."
7801 (let* ((number (mail-header-number (car thread))))
7802 (incf gnus-newsgroup-expunged-tally)
7803 ;; We also mark as read here, if that's wanted.
7804 (setq gnus-newsgroup-unreads
7805 (delq number gnus-newsgroup-unreads))
7806 (if gnus-newsgroup-auto-expire
7807 (push number gnus-newsgroup-expirable)
7808 (push (cons number gnus-low-score-mark)
7809 gnus-newsgroup-reads)))
7810 ;; Go recursively through all subthreads.
7811 (mapcar 'gnus-expunge-thread (cdr thread)))
7813 ;; Summary article oriented commands
7815 (defun gnus-summary-refer-parent-article (n)
7816 "Refer parent article N times.
7817 If N is negative, go to ancestor -N instead.
7818 The difference between N and the number of articles fetched is returned."
7822 (when (not (natnump n))
7827 (setq header (gnus-summary-article-header))
7828 (if (and (eq (mail-header-number header)
7829 (cdr gnus-article-current))
7830 (equal gnus-newsgroup-name
7831 (car gnus-article-current)))
7832 ;; If we try to find the parent of the currently
7833 ;; displayed article, then we take a look at the actual
7834 ;; References header, since this is slightly more
7835 ;; reliable than the References field we got from the
7838 (set-buffer gnus-original-article-buffer)
7839 (nnheader-narrow-to-headers)
7840 (unless (setq ref (message-fetch-field "references"))
7841 (setq ref (message-fetch-field "in-reply-to")))
7844 ;; It's not the current article, so we take a bet on
7845 ;; the value we got from the server.
7846 (mail-header-references header)))
7848 (not (equal ref "")))
7849 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
7850 (gnus-message 1 "Couldn't find parent"))
7851 (gnus-message 1 "No references in article %d"
7852 (gnus-summary-article-number))
7855 (gnus-summary-position-point)
7858 (defun gnus-summary-refer-references ()
7859 "Fetch all articles mentioned in the References header.
7860 Return the number of articles fetched."
7862 (let ((ref (mail-header-references (gnus-summary-article-header)))
7863 (current (gnus-summary-article-number))
7867 (error "No References in the current article")
7868 ;; For each Message-ID in the References header...
7869 (while (string-match "<[^>]*>" ref)
7871 ;; ... fetch that article.
7872 (gnus-summary-refer-article
7873 (prog1 (match-string 0 ref)
7874 (setq ref (substring ref (match-end 0))))))
7875 (gnus-summary-goto-subject current)
7876 (gnus-summary-position-point)
7879 (defun gnus-summary-refer-thread (&optional limit)
7880 "Fetch all articles in the current thread.
7881 If LIMIT (the numerical prefix), fetch that many old headers instead
7882 of what's specified by the `gnus-refer-thread-limit' variable."
7884 (let ((id (mail-header-id (gnus-summary-article-header)))
7885 (limit (if limit (prefix-numeric-value limit)
7886 gnus-refer-thread-limit)))
7887 ;; We want to fetch LIMIT *old* headers, but we also have to
7888 ;; re-fetch all the headers in the current buffer, because many of
7889 ;; them may be undisplayed. So we adjust LIMIT.
7890 (when (numberp limit)
7891 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
7892 (unless (eq gnus-fetch-old-headers 'invisible)
7893 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
7894 ;; Retrieve the headers and read them in.
7895 (if (eq (gnus-retrieve-headers
7896 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
7898 (gnus-build-all-threads)
7899 (error "Can't fetch thread from backends that don't support NOV"))
7900 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
7901 (gnus-summary-limit-include-thread id)))
7903 (defun gnus-summary-refer-article (message-id)
7904 "Fetch an article specified by MESSAGE-ID."
7905 (interactive "sMessage-ID: ")
7906 (when (and (stringp message-id)
7907 (not (zerop (length message-id))))
7908 ;; Construct the correct Message-ID if necessary.
7909 ;; Suggested by tale@pawl.rpi.edu.
7910 (unless (string-match "^<" message-id)
7911 (setq message-id (concat "<" message-id)))
7912 (unless (string-match ">$" message-id)
7913 (setq message-id (concat message-id ">")))
7914 (let* ((header (gnus-id-to-header message-id))
7916 (gnus-summary-article-sparse-p
7917 (mail-header-number header))
7918 (memq (mail-header-number header)
7919 gnus-newsgroup-limit)))
7922 ;; If the article is present in the buffer we just go to it.
7924 (or (not (gnus-summary-article-sparse-p
7925 (mail-header-number header)))
7928 (gnus-summary-goto-article
7929 (mail-header-number header) nil t)
7931 (gnus-summary-update-article (mail-header-number header)))))
7933 ;; We fetch the article.
7935 (dolist (gnus-override-method (gnus-refer-article-methods))
7936 (gnus-check-server gnus-override-method)
7937 ;; Fetch the header, and display the article.
7938 (when (setq number (gnus-summary-insert-subject message-id))
7939 (gnus-summary-select-article nil nil nil number)
7941 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
7943 (defun gnus-refer-article-methods ()
7944 "Return a list of referable methods."
7946 ;; No method, so we default to current and native.
7947 ((null gnus-refer-article-method)
7948 (list gnus-current-select-method gnus-select-method))
7950 ((eq 'current gnus-refer-article-method)
7951 (list gnus-current-select-method))
7952 ;; List of select methods.
7953 ((not (and (symbolp (car gnus-refer-article-method))
7954 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
7956 (dolist (method gnus-refer-article-method)
7957 (push (if (eq 'current method)
7958 gnus-current-select-method
7962 ;; One single select method.
7964 (list gnus-refer-article-method))))
7966 (defun gnus-summary-edit-parameters ()
7967 "Edit the group parameters of the current group."
7969 (gnus-group-edit-group gnus-newsgroup-name 'params))
7971 (defun gnus-summary-customize-parameters ()
7972 "Customize the group parameters of the current group."
7974 (gnus-group-customize gnus-newsgroup-name))
7976 (defun gnus-summary-enter-digest-group (&optional force)
7977 "Enter an nndoc group based on the current article.
7978 If FORCE, force a digest interpretation. If not, try
7979 to guess what the document format is."
7981 (let ((conf gnus-current-window-configuration))
7983 (gnus-summary-select-article))
7984 (setq gnus-current-window-configuration conf)
7985 (let* ((name (format "%s-%d"
7986 (gnus-group-prefixed-name
7987 gnus-newsgroup-name (list 'nndoc ""))
7989 (set-buffer gnus-summary-buffer)
7990 gnus-current-article)))
7991 (ogroup gnus-newsgroup-name)
7992 (params (append (gnus-info-params (gnus-get-info ogroup))
7993 (list (cons 'to-group ogroup))
7994 (list (cons 'save-article-group ogroup))))
7995 (case-fold-search t)
7996 (buf (current-buffer))
7999 (set-buffer gnus-original-article-buffer)
8000 ;; Have the digest group inherit the main mail address of
8001 ;; the parent article.
8002 (when (setq to-address (or (gnus-fetch-field "reply-to")
8003 (gnus-fetch-field "from")))
8004 (setq params (append
8005 (list (cons 'to-address
8006 (funcall gnus-decode-encoded-word-function
8008 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8009 (insert-buffer-substring gnus-original-article-buffer)
8010 ;; Remove lines that may lead nndoc to misinterpret the
8013 (goto-char (point-min))
8014 (or (search-forward "\n\n" nil t) (point)))
8015 (goto-char (point-min))
8016 (delete-matching-lines "^Path:\\|^From ")
8019 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8020 (gnus-newsgroup-ephemeral-ignored-charsets
8021 gnus-newsgroup-ignored-charsets))
8022 (gnus-group-read-ephemeral-group
8023 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8025 ,(if force 'mbox 'guess)))
8027 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8029 ;; Make all postings to this group go to the parent group.
8030 (nconc (gnus-info-params (gnus-get-info name))
8032 ;; Couldn't select this doc group.
8033 (switch-to-buffer buf)
8034 (gnus-set-global-variables)
8035 (gnus-configure-windows 'summary)
8036 (gnus-message 3 "Article couldn't be entered?"))
8037 (kill-buffer dig)))))
8039 (defun gnus-summary-read-document (n)
8040 "Open a new group based on the current article(s).
8041 This will allow you to read digests and other similar
8042 documents as newsgroups.
8043 Obeys the standard process/prefix convention."
8045 (let* ((articles (gnus-summary-work-articles n))
8046 (ogroup gnus-newsgroup-name)
8047 (params (append (gnus-info-params (gnus-get-info ogroup))
8048 (list (cons 'to-group ogroup))))
8049 article group egroup groups vgroup)
8050 (while (setq article (pop articles))
8051 (setq group (format "%s-%d" gnus-newsgroup-name article))
8052 (gnus-summary-remove-process-mark article)
8053 (when (gnus-summary-display-article article)
8056 (insert-buffer-substring gnus-original-article-buffer)
8057 ;; Remove some headers that may lead nndoc to make
8059 (message-narrow-to-head)
8060 (goto-char (point-min))
8061 (delete-matching-lines "^\\(Path\\):\\|^From ")
8064 (gnus-group-read-ephemeral-group
8065 group `(nndoc ,group (nndoc-address ,(current-buffer))
8066 (nndoc-article-type guess))
8069 ;; Make all postings to this group go to the parent group.
8070 (nconc (gnus-info-params (gnus-get-info egroup))
8072 (push egroup groups))
8073 ;; Couldn't select this doc group.
8074 (gnus-error 3 "Article couldn't be entered"))))))
8075 ;; Now we have selected all the documents.
8078 (error "None of the articles could be interpreted as documents"))
8079 ((gnus-group-read-ephemeral-group
8080 (setq vgroup (format
8081 "nnvirtual:%s-%s" gnus-newsgroup-name
8082 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8083 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8085 (cons (current-buffer) 'summary)))
8087 (error "Couldn't select virtual nndoc group")))))
8089 (defun gnus-summary-isearch-article (&optional regexp-p)
8090 "Do incremental search forward on the current article.
8091 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8093 (let* ((gnus-inhibit-treatment t)
8094 (old (gnus-summary-select-article)))
8095 (gnus-configure-windows 'article)
8096 (gnus-eval-in-buffer-window gnus-article-buffer
8100 (gnus-article-show-all-headers))
8101 (goto-char (point-min))
8102 (isearch-forward regexp-p)))))
8104 (defun gnus-summary-search-article-forward (regexp &optional backward)
8105 "Search for an article containing REGEXP forward.
8106 If BACKWARD, search backward instead."
8109 (format "Search article %s (regexp%s): "
8110 (if current-prefix-arg "backward" "forward")
8111 (if gnus-last-search-regexp
8112 (concat ", default " gnus-last-search-regexp)
8114 current-prefix-arg))
8115 (if (string-equal regexp "")
8116 (setq regexp (or gnus-last-search-regexp ""))
8117 (setq gnus-last-search-regexp regexp)
8118 (setq gnus-article-before-search gnus-current-article))
8119 ;; Intentionally set gnus-last-article.
8120 (setq gnus-last-article gnus-article-before-search)
8121 (let ((gnus-last-article gnus-last-article))
8122 (if (gnus-summary-search-article regexp backward)
8123 (gnus-summary-show-thread)
8124 (error "Search failed: \"%s\"" regexp))))
8126 (defun gnus-summary-search-article-backward (regexp)
8127 "Search for an article containing REGEXP backward."
8130 (format "Search article backward (regexp%s): "
8131 (if gnus-last-search-regexp
8132 (concat ", default " gnus-last-search-regexp)
8134 (gnus-summary-search-article-forward regexp 'backward))
8137 (defmacro gnus-summary-search-article-position-point (regexp backward)
8138 "Dehighlight the last matched text and goto the beginning position."
8139 (` (if (and gnus-summary-search-article-matched-data
8140 (let ((text (caddr gnus-summary-search-article-matched-data))
8141 (inhibit-read-only t)
8144 (goto-char (car gnus-summary-search-article-matched-data))
8145 (cadr gnus-summary-search-article-matched-data))
8147 (string-match (, regexp) text)))
8148 (if (, backward) (beginning-of-line) (end-of-line))
8149 (goto-char (if (, backward) (point-max) (point-min))))))
8151 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
8152 "Place point where X-Face image is displayed."
8153 (if (featurep 'xemacs)
8154 (` (let ((end (if (search-forward "\n\n" nil t)
8155 (goto-char (1- (point)))
8158 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
8159 (unless (and (re-search-forward "^From:" end t)
8160 (setq extent (extent-at (point)))
8161 (extent-begin-glyph extent))
8162 (goto-char (, opoint)))))
8163 (` (let ((end (if (search-forward "\n\n" nil t)
8164 (goto-char (1- (point)))
8166 (start (or (search-backward "\n\n" nil t) (point-min))))
8168 (or (text-property-any start end 'x-face-image t);; x-face-e21
8169 (text-property-any start end 'x-face-mule-bitmap-image t)
8172 (defmacro gnus-summary-search-article-highlight-matched-text
8173 (backward treated x-face)
8174 "Highlight matched text in the function `gnus-summary-search-article'."
8175 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
8176 (end (set-marker (make-marker) (match-end 0)))
8177 (inhibit-read-only t)
8181 (let ((items (mapcar 'car gnus-treatment-function-alist)))
8183 (lambda (item) (setq items (delq item items)))
8184 '(gnus-treat-buttonize
8185 gnus-treat-fill-article
8186 gnus-treat-fill-long-lines
8187 gnus-treat-emphasize
8188 gnus-treat-highlight-headers
8189 gnus-treat-highlight-citation
8190 gnus-treat-highlight-signature
8191 gnus-treat-overstrike
8192 gnus-treat-display-xface
8193 gnus-treat-buttonize-head
8194 gnus-treat-decode-article-as-default-mime-charset))
8195 (static-if (featurep 'xemacs)
8197 (cons '(x-face-mule-delete-x-face-field
8200 (gnus-treat-display-xface
8201 (when (, x-face) gnus-treat-display-xface)))
8202 (gnus-article-prepare-mime-display)))
8203 (goto-char (if (, backward) start end))
8205 (gnus-summary-search-article-highlight-goto-x-face (point)))
8206 (setq gnus-summary-search-article-matched-data
8207 (list start end (buffer-substring start end)))
8208 (unless (eq start end);; matched text has been deleted. :-<
8209 (put-text-property start end 'face
8210 (or (find-face 'isearch)
8211 'secondary-selection))))))
8214 (defun gnus-summary-search-article (regexp &optional backward)
8215 "Search for an article containing REGEXP.
8216 Optional argument BACKWARD means do search for backward.
8217 `gnus-select-article-hook' is not called during the search."
8218 ;; We have to require this here to make sure that the following
8219 ;; dynamic binding isn't shadowed by autoloading.
8220 (require 'gnus-async)
8222 (let ((gnus-select-article-hook nil) ;Disable hook.
8223 (gnus-article-prepare-hook nil)
8224 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8225 (gnus-use-article-prefetch nil)
8226 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8227 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8228 (sum (current-buffer))
8231 (gnus-save-hidden-threads
8232 (static-if (featurep 'xemacs)
8233 (let ((gnus-inhibit-treatment t))
8234 (setq treated (eq 'old (gnus-summary-select-article)))
8236 (not (and (gnus-buffer-live-p gnus-article-buffer)
8237 (window-live-p (get-buffer-window
8238 gnus-article-buffer t)))))
8239 (gnus-summary-select-article nil t)
8240 (setq treated nil)))
8241 (let ((gnus-inhibit-treatment t)
8242 (x-face-mule-delete-x-face-field 'never))
8243 (setq treated (eq 'old (gnus-summary-select-article)))
8246 (and (gnus-buffer-live-p gnus-article-buffer)
8247 (window-live-p (get-buffer-window
8248 gnus-article-buffer t))
8249 (or (not (string-match "^\\^X-Face:" regexp))
8250 (with-current-buffer gnus-article-buffer
8251 gnus-summary-search-article-matched-data)))))
8252 (gnus-summary-select-article nil t)
8253 (setq treated nil))))
8254 (set-buffer gnus-article-buffer)
8258 (gnus-article-show-all-headers)
8259 (gnus-summary-search-article-position-point regexp backward))
8260 (goto-char (if backward (point-max) (point-min))))
8262 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8264 (re-search-backward regexp nil t)
8265 (re-search-forward regexp nil t))
8266 ;; We found the regexp.
8268 (gnus-summary-search-article-highlight-matched-text
8269 backward treated (string-match "^\\^X-Face:" regexp))
8272 (/ (- 2 (window-height
8273 (get-buffer-window gnus-article-buffer t)))
8276 (get-buffer-window (current-buffer))
8279 (setq point (point)))
8280 ;; We didn't find it, so we go to the next article.
8283 (while (eq found 'not)
8284 (if (not (if backward (gnus-summary-find-prev)
8285 (gnus-summary-find-next)))
8286 ;; No more articles.
8288 ;; Select the next article and adjust point.
8289 (unless (gnus-summary-article-sparse-p
8290 (gnus-summary-article-number))
8292 (let ((gnus-inhibit-treatment t))
8293 (gnus-summary-select-article))
8295 (set-buffer gnus-article-buffer)
8297 (goto-char (if backward (point-max) (point-min))))))))
8298 (gnus-message 7 ""))
8299 ;; Return whether we found the regexp.
8300 (when (eq found 'found)
8302 (gnus-summary-show-thread)
8303 (gnus-summary-goto-subject gnus-current-article)
8304 (gnus-summary-position-point)
8307 (defun gnus-find-matching-articles (header regexp)
8308 "Return a list of all articles that match REGEXP on HEADER.
8309 This search includes all articles in the current group that Gnus has
8310 fetched headers for, whether they are displayed or not."
8311 (let ((articles nil)
8312 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8313 (case-fold-search t))
8314 (dolist (header gnus-newsgroup-headers)
8315 (when (string-match regexp (funcall func header))
8316 (push (mail-header-number header) articles)))
8317 (nreverse articles)))
8319 (defun gnus-summary-find-matching (header regexp &optional backward unread
8320 not-case-fold not-matching)
8321 "Return a list of all articles that match REGEXP on HEADER.
8322 The search stars on the current article and goes forwards unless
8323 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8324 If UNREAD is non-nil, only unread articles will
8325 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8326 in the comparisons. If NOT-MATCHING, return a list of all articles that
8327 not match REGEXP on HEADER."
8328 (let ((case-fold-search (not not-case-fold))
8331 (if (eq (car header) 'extra)
8334 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8336 (error "%s is an invalid header" header))
8337 (unless (fboundp (intern (concat "mail-header-" header)))
8338 (error "%s is not a valid header" header))
8339 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8340 (dolist (d (if (eq backward 'all)
8342 (gnus-data-find-list
8343 (gnus-summary-article-number)
8344 (gnus-data-list backward))))
8345 (when (and (or (not unread) ; We want all articles...
8346 (gnus-data-unread-p d)) ; Or just unreads.
8347 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8351 (funcall func (gnus-data-header d))))
8352 (string-match regexp
8353 (funcall func (gnus-data-header d)))))
8354 (push (gnus-data-number d) articles))) ; Success!
8355 (nreverse articles)))
8357 (defun gnus-summary-execute-command (header regexp command &optional backward)
8358 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8359 If HEADER is an empty string (or nil), the match is done on the entire
8360 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8362 (list (let ((completion-ignore-case t))
8365 (mapcar (lambda (header) (list (format "%s" header)))
8367 '("Number" "Subject" "From" "Lines" "Date"
8368 "Message-ID" "Xref" "References" "Body")
8369 gnus-extra-headers))
8370 nil 'require-match))
8371 (read-string "Regexp: ")
8372 (read-key-sequence "Command: ")
8373 current-prefix-arg))
8374 (when (equal header "Body")
8376 ;; Hidden thread subtrees must be searched as well.
8377 (gnus-summary-show-all-threads)
8378 ;; We don't want to change current point nor window configuration.
8380 (save-window-excursion
8382 gnus-treat-strip-trailing-blank-lines
8383 gnus-treat-strip-leading-blank-lines
8384 gnus-treat-strip-multiple-blank-lines
8385 gnus-treat-hide-boring-headers
8386 gnus-treat-fold-newsgroups
8387 gnus-article-prepare-hook)
8388 (gnus-message 6 "Executing %s..." (key-description command))
8389 ;; We'd like to execute COMMAND interactively so as to give arguments.
8390 (gnus-execute header regexp
8391 `(call-interactively ',(key-binding command))
8393 (gnus-message 6 "Executing %s...done" (key-description command))))))
8395 (defun gnus-summary-beginning-of-article ()
8396 "Scroll the article back to the beginning."
8398 (gnus-summary-select-article)
8399 (gnus-configure-windows 'article)
8400 (gnus-eval-in-buffer-window gnus-article-buffer
8402 (goto-char (point-min))
8403 (when gnus-page-broken
8404 (gnus-narrow-to-page))))
8406 (defun gnus-summary-end-of-article ()
8407 "Scroll to the end of the article."
8409 (gnus-summary-select-article)
8410 (gnus-configure-windows 'article)
8411 (gnus-eval-in-buffer-window gnus-article-buffer
8413 (goto-char (point-max))
8415 (when gnus-page-broken
8416 (gnus-narrow-to-page))))
8418 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8419 "Truncate to LEN and quote all \"(\"'s in STRING."
8420 (gnus-replace-in-string (if (and len (> (length string) len))
8421 (substring string 0 len)
8425 (defun gnus-summary-print-article (&optional filename n)
8426 "Generate and print a PostScript image of the N next (mail) articles.
8428 If N is negative, print the N previous articles. If N is nil and articles
8429 have been marked with the process mark, print these instead.
8431 If the optional first argument FILENAME is nil, send the image to the
8432 printer. If FILENAME is a string, save the PostScript image in a file with
8433 that name. If FILENAME is a number, prompt the user for the name of the file
8435 (interactive (list (ps-print-preprint current-prefix-arg)))
8436 (dolist (article (gnus-summary-work-articles n))
8437 (gnus-summary-select-article nil nil 'pseudo article)
8438 (gnus-eval-in-buffer-window gnus-article-buffer
8439 (gnus-print-buffer))
8440 (gnus-summary-remove-process-mark article))
8441 (ps-despool filename))
8443 (defun gnus-print-buffer ()
8444 (let ((buffer (generate-new-buffer " *print*")))
8447 (copy-to-buffer buffer (point-min) (point-max))
8449 (gnus-article-delete-invisible-text)
8450 (gnus-remove-text-with-property 'gnus-decoration)
8451 (when (gnus-visual-p 'article-highlight 'highlight)
8452 ;; Copy-to-buffer doesn't copy overlay. So redo
8454 (let ((gnus-article-buffer buffer))
8455 (gnus-article-highlight-citation t)
8456 (gnus-article-highlight-signature)))
8457 (let ((ps-left-header
8460 (gnus-summary-print-truncate-and-quote
8461 (mail-header-subject gnus-current-headers)
8464 (gnus-summary-print-truncate-and-quote
8465 (mail-header-from gnus-current-headers)
8469 "/pagenumberstring load"
8471 (mail-header-date gnus-current-headers) ")"))))
8472 (gnus-run-hooks 'gnus-ps-print-hook)
8475 (ps-spool-buffer-with-faces)
8476 (ps-spool-buffer)))))
8477 (kill-buffer buffer))))
8479 (defun gnus-summary-show-article (&optional arg)
8480 "Force redisplaying of the current article.
8481 If ARG (the prefix) is a number, show the article with the charset
8482 defined in `gnus-summary-show-article-charset-alist', or the charset
8484 If ARG (the prefix) is non-nil and not a number, show the raw article
8485 without any article massaging functions being run. Normally, the key strokes
8490 (gnus-summary-show-article t)
8491 (let* ((gnus-newsgroup-charset
8492 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8493 (mm-read-coding-system
8494 "View as charset: " ;; actually it is coding system.
8496 (set-buffer gnus-article-buffer)
8497 (mm-detect-coding-region (point) (point-max))))))
8498 (default-mime-charset gnus-newsgroup-charset)
8499 (gnus-newsgroup-ignored-charsets 'gnus-all))
8500 (gnus-summary-select-article nil 'force)
8501 (let ((deps gnus-newsgroup-dependencies)
8504 (set-buffer gnus-original-article-buffer)
8506 (message-narrow-to-head)
8507 (setq head (buffer-string))
8508 (goto-char (point-min))
8509 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8510 (goto-char (point-max))
8512 (setq lines (1- (count-lines (point) (point-max))))))
8514 (insert (format "211 %d Article retrieved.\n"
8515 (cdr gnus-article-current)))
8517 (if lines (insert (format "Lines: %d\n" lines)))
8519 (let ((nntp-server-buffer (current-buffer)))
8520 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8521 (gnus-data-set-header
8522 (gnus-data-find (cdr gnus-article-current))
8524 (gnus-summary-update-article-line
8525 (cdr gnus-article-current) header)
8526 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8527 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8529 ;; Select the article the normal way.
8530 (gnus-summary-select-article nil 'force))
8532 ;; We have to require this here to make sure that the following
8533 ;; dynamic binding isn't shadowed by autoloading.
8534 (require 'gnus-async)
8536 ;; Bind the article treatment functions to nil.
8537 (let ((gnus-have-all-headers t)
8538 gnus-article-prepare-hook
8539 gnus-article-decode-hook
8542 (gnus-inhibit-treatment t))
8543 (gnus-summary-select-article nil 'force))))
8544 (gnus-summary-goto-subject gnus-current-article)
8545 (gnus-summary-position-point))
8547 (defun gnus-summary-show-raw-article ()
8548 "Show the raw article without any article massaging functions being run."
8550 (gnus-summary-show-article t))
8552 (defun gnus-summary-verbose-headers (&optional arg)
8553 "Toggle permanent full header display.
8554 If ARG is a positive number, turn header display on.
8555 If ARG is a negative number, turn header display off."
8557 (setq gnus-show-all-headers
8558 (cond ((or (not (numberp arg))
8560 (not gnus-show-all-headers))
8563 (gnus-summary-show-article))
8565 (defun gnus-summary-toggle-header (&optional arg)
8566 "Show the headers if they are hidden, or hide them if they are shown.
8567 If ARG is a positive number, show the entire header.
8568 If ARG is a negative number, hide the unwanted header lines."
8570 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8571 (get-buffer-window gnus-article-buffer t))))
8572 (with-current-buffer gnus-article-buffer
8574 (article-narrow-to-head)
8575 (let* ((buffer-read-only nil)
8576 (inhibit-point-motion-hooks t)
8577 (hidden (if (numberp arg)
8579 (gnus-article-hidden-text-p 'headers)))
8581 (delete-region (point-min) (point-max))
8582 (with-current-buffer gnus-original-article-buffer
8583 (goto-char (setq s (point-min)))
8584 (setq e (if (search-forward "\n\n" nil t)
8587 (insert-buffer-substring gnus-original-article-buffer s e)
8588 (article-decode-encoded-words)
8590 (let ((gnus-treat-hide-headers nil)
8591 (gnus-treat-hide-boring-headers nil))
8592 (gnus-delete-wash-type 'headers)
8593 (gnus-treat-article 'head))
8594 (gnus-treat-article 'head))
8597 (set-window-start window (goto-char (point-min))))
8598 (setq gnus-page-broken
8599 (when gnus-break-pages
8600 (gnus-narrow-to-page)
8602 (gnus-set-mode-line 'article)))))
8604 (defun gnus-summary-show-all-headers ()
8605 "Make all header lines visible."
8607 (gnus-summary-toggle-header 1))
8609 (defun gnus-summary-toggle-mime (&optional arg)
8610 "Toggle MIME processing.
8611 If ARG is a positive number, turn MIME processing on."
8613 (setq gnus-show-mime
8615 (not gnus-show-mime)
8616 (> (prefix-numeric-value arg) 0)))
8617 (gnus-summary-select-article t 'force))
8619 (defun gnus-summary-caesar-message (&optional arg)
8620 "Caesar rotate the current article by 13.
8621 The numerical prefix specifies how many places to rotate each letter
8624 (gnus-summary-select-article)
8625 (let ((mail-header-separator ""))
8626 (gnus-eval-in-buffer-window gnus-article-buffer
8629 (let ((start (window-start))
8631 (message-caesar-buffer-body arg)
8632 (set-window-start (get-buffer-window (current-buffer)) start))))))
8634 (autoload 'unmorse-region "morse"
8635 "Convert morse coded text in region to ordinary ASCII text."
8638 (defun gnus-summary-morse-message (&optional arg)
8639 "Morse decode the current article."
8641 (gnus-summary-select-article)
8642 (let ((mail-header-separator ""))
8643 (gnus-eval-in-buffer-window gnus-article-buffer
8647 (let ((pos (window-start))
8649 (goto-char (point-min))
8650 (when (message-goto-body)
8651 (gnus-narrow-to-body))
8652 (goto-char (point-min))
8653 (while (re-search-forward "·" (point-max) t)
8654 (replace-match "."))
8655 (unmorse-region (point-min) (point-max))
8657 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8659 (defun gnus-summary-stop-page-breaking ()
8660 "Stop page breaking in the current article."
8662 (gnus-summary-select-article)
8663 (gnus-eval-in-buffer-window gnus-article-buffer
8665 (when (gnus-visual-p 'page-marker)
8666 (let ((buffer-read-only nil))
8667 (gnus-remove-text-with-property 'gnus-prev)
8668 (gnus-remove-text-with-property 'gnus-next))
8669 (setq gnus-page-broken nil))))
8671 (defun gnus-summary-move-article (&optional n to-newsgroup
8672 select-method action)
8673 "Move the current article to a different newsgroup.
8674 If N is a positive number, move the N next articles.
8675 If N is a negative number, move the N previous articles.
8676 If N is nil and any articles have been marked with the process mark,
8677 move those articles instead.
8678 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8679 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8680 re-spool using this method.
8682 When called interactively with TO-NEWSGROUP being nil, the value of
8683 the variable `gnus-move-split-methods' is used for finding a default
8684 for the target newsgroup.
8686 For this function to work, both the current newsgroup and the
8687 newsgroup that you want to move to have to support the `request-move'
8688 and `request-accept' functions.
8690 ACTION can be either `move' (the default), `crosspost' or `copy'."
8693 (setq action 'move))
8694 ;; Check whether the source group supports the required functions.
8695 (cond ((and (eq action 'move)
8696 (not (gnus-check-backend-function
8697 'request-move-article gnus-newsgroup-name)))
8698 (error "The current group does not support article moving"))
8699 ((and (eq action 'crosspost)
8700 (not (gnus-check-backend-function
8701 'request-replace-article gnus-newsgroup-name)))
8702 (error "The current group does not support article editing")))
8703 (let ((articles (gnus-summary-work-articles n))
8704 (prefix (if (gnus-check-backend-function
8705 'request-move-article gnus-newsgroup-name)
8706 (gnus-group-real-prefix gnus-newsgroup-name)
8708 (names '((move "Move" "Moving")
8709 (copy "Copy" "Copying")
8710 (crosspost "Crosspost" "Crossposting")))
8711 (copy-buf (save-excursion
8712 (nnheader-set-temp-buffer " *copy article*")))
8713 (default-marks gnus-article-mark-lists)
8714 (no-expire-marks (delete '(expirable . expire)
8715 (copy-sequence gnus-article-mark-lists)))
8716 art-group to-method new-xref article to-groups)
8717 (unless (assq action names)
8718 (error "Unknown action %s" action))
8719 ;; Read the newsgroup name.
8720 (when (and (not to-newsgroup)
8721 (not select-method))
8722 (if (and gnus-move-split-methods
8724 (and (memq gnus-current-article articles)
8725 (gnus-buffer-live-p gnus-original-article-buffer))))
8726 ;; When `gnus-move-split-methods' is non-nil, we have to
8727 ;; select an article to give `gnus-read-move-group-name' an
8728 ;; opportunity to suggest an appropriate default. However,
8729 ;; we needn't render or mark the article.
8730 (let ((gnus-display-mime-function nil)
8731 (gnus-article-prepare-hook nil)
8732 (gnus-mark-article-hook nil))
8733 (gnus-summary-select-article nil nil nil (car articles))))
8735 (gnus-read-move-group-name
8736 (cadr (assq action names))
8737 (symbol-value (intern (format "gnus-current-%s-group" action)))
8739 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8740 (setq to-method (or select-method
8741 (gnus-server-to-method
8742 (gnus-group-method to-newsgroup))))
8743 ;; Check the method we are to move this article to...
8744 (unless (gnus-check-backend-function
8745 'request-accept-article (car to-method))
8746 (error "%s does not support article copying" (car to-method)))
8747 (unless (gnus-check-server to-method)
8748 (error "Can't open server %s" (car to-method)))
8749 (gnus-message 6 "%s to %s: %s..."
8750 (caddr (assq action names))
8751 (or (car select-method) to-newsgroup) articles)
8753 (setq article (pop articles))
8757 ;; Move the article.
8759 ;; Remove this article from future suppression.
8760 (gnus-dup-unsuppress-article article)
8761 (gnus-request-move-article
8762 article ; Article to move
8763 gnus-newsgroup-name ; From newsgroup
8764 (nth 1 (gnus-find-method-for-group
8765 gnus-newsgroup-name)) ; Server
8766 (list 'gnus-request-accept-article
8767 to-newsgroup (list 'quote select-method)
8768 (not articles) t) ; Accept form
8769 (not articles))) ; Only save nov last time
8770 ;; Copy the article.
8773 (set-buffer copy-buf)
8774 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8775 (gnus-request-accept-article
8776 to-newsgroup select-method (not articles) t))))
8777 ;; Crosspost the article.
8778 ((eq action 'crosspost)
8779 (let ((xref (message-tokenize-header
8780 (mail-header-xref (gnus-summary-article-header article))
8782 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8783 ":" (number-to-string article)))
8785 (setq xref (list (system-name))))
8788 (mapconcat 'identity
8789 (delete "Xref:" (delete new-xref xref))
8793 (set-buffer copy-buf)
8794 ;; First put the article in the destination group.
8795 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8796 (when (consp (setq art-group
8797 (gnus-request-accept-article
8798 to-newsgroup select-method (not articles))))
8799 (setq new-xref (concat new-xref " " (car art-group)
8801 (number-to-string (cdr art-group))))
8802 ;; Now we have the new Xrefs header, so we insert
8803 ;; it and replace the new article.
8804 (nnheader-replace-header "Xref" new-xref)
8805 (gnus-request-replace-article
8806 (cdr art-group) to-newsgroup (current-buffer))
8810 (gnus-message 1 "Couldn't %s article %s: %s"
8811 (cadr (assq action names)) article
8812 (nnheader-get-report (car to-method))))
8813 ((eq art-group 'junk)
8814 (when (eq action 'move)
8815 (gnus-summary-mark-article article gnus-canceled-mark)
8816 (gnus-message 4 "Deleted article %s" article)))
8818 (let* ((pto-group (gnus-group-prefixed-name
8819 (car art-group) to-method))
8821 (gnus-gethash pto-group gnus-newsrc-hashtb))
8822 (info (nth 2 entry))
8823 (to-group (gnus-info-group info))
8825 ;; Update the group that has been moved to.
8827 (memq action '(move copy)))
8828 (unless (member to-group to-groups)
8829 (push to-group to-groups))
8831 (unless (memq article gnus-newsgroup-unreads)
8832 (push 'read to-marks)
8834 info (gnus-add-to-range (gnus-info-read info)
8835 (list (cdr art-group)))))
8837 ;; See whether the article is to be put in the cache.
8838 (let ((marks (if (gnus-group-auto-expirable-p to-group)
8841 (to-article (cdr art-group)))
8843 ;; Enter the article into the cache in the new group,
8844 ;; if that is required.
8845 (when gnus-use-cache
8846 (gnus-cache-possibly-enter-article
8848 (let ((header (copy-sequence
8849 (gnus-summary-article-header article))))
8850 (mail-header-set-number header to-article)
8852 (memq article gnus-newsgroup-marked)
8853 (memq article gnus-newsgroup-dormant)
8854 (memq article gnus-newsgroup-unreads)))
8856 (when gnus-preserve-marks
8857 ;; Copy any marks over to the new group.
8858 (when (and (equal to-group gnus-newsgroup-name)
8859 (not (memq article gnus-newsgroup-unreads)))
8860 ;; Mark this article as read in this group.
8861 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
8862 (setcdr (gnus-active to-group) to-article)
8863 (setcdr gnus-newsgroup-active to-article))
8866 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8867 (when (memq article (symbol-value
8868 (intern (format "gnus-newsgroup-%s"
8870 (push (cdar marks) to-marks)
8871 ;; If the other group is the same as this group,
8872 ;; then we have to add the mark to the list.
8873 (when (equal to-group gnus-newsgroup-name)
8874 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
8877 (intern (format "gnus-newsgroup-%s"
8879 ;; Copy the marks to other group.
8880 (gnus-add-marked-articles
8881 to-group (cdar marks) (list to-article) info)))
8882 (setq marks (cdr marks)))
8884 (gnus-request-set-mark
8885 to-group (list (list (list to-article) 'add to-marks))))
8888 (concat "(gnus-group-set-info '"
8889 (gnus-prin1-to-string (gnus-get-info to-group))
8892 ;; Update the Xref header in this article to point to
8893 ;; the new crossposted article we have just created.
8894 (when (eq action 'crosspost)
8896 (set-buffer copy-buf)
8897 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8898 (nnheader-replace-header "Xref" new-xref)
8899 (gnus-request-replace-article
8900 article gnus-newsgroup-name (current-buffer)))))
8902 ;;;!!!Why is this necessary?
8903 (set-buffer gnus-summary-buffer)
8905 (gnus-summary-goto-subject article)
8906 (when (eq action 'move)
8907 (gnus-summary-mark-article article gnus-canceled-mark))))
8908 (gnus-summary-remove-process-mark article))
8909 ;; Re-activate all groups that have been moved to.
8911 (set-buffer gnus-group-buffer)
8912 (let ((gnus-group-marked to-groups))
8913 (gnus-group-get-new-news-this-group nil t)))
8915 (gnus-kill-buffer copy-buf)
8916 (gnus-summary-position-point)
8917 (gnus-set-mode-line 'summary)))
8919 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
8920 "Move the current article to a different newsgroup.
8921 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8922 When called interactively, if TO-NEWSGROUP is nil, use the value of
8923 the variable `gnus-move-split-methods' for finding a default target
8925 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8926 re-spool using this method."
8928 (gnus-summary-move-article n to-newsgroup select-method 'copy))
8930 (defun gnus-summary-crosspost-article (&optional n)
8931 "Crosspost the current article to some other group."
8933 (gnus-summary-move-article n nil nil 'crosspost))
8935 (defcustom gnus-summary-respool-default-method nil
8936 "Default method type for respooling an article.
8937 If nil, use to the current newsgroup method."
8939 :group 'gnus-summary-mail)
8941 (defcustom gnus-summary-display-while-building nil
8942 "If not-nil, show and update the summary buffer as it's being built.
8943 If the value is t, update the buffer after every line is inserted. If
8944 the value is an integer (N), update the display every N lines."
8946 :type '(choice (const :tag "off" nil)
8948 (const :tag "frequently" t)))
8950 (defun gnus-summary-respool-article (&optional n method)
8951 "Respool the current article.
8952 The article will be squeezed through the mail spooling process again,
8953 which means that it will be put in some mail newsgroup or other
8954 depending on `nnmail-split-methods'.
8955 If N is a positive number, respool the N next articles.
8956 If N is a negative number, respool the N previous articles.
8957 If N is nil and any articles have been marked with the process mark,
8958 respool those articles instead.
8960 Respooling can be done both from mail groups and \"real\" newsgroups.
8961 In the former case, the articles in question will be moved from the
8962 current group into whatever groups they are destined to. In the
8963 latter case, they will be copied into the relevant groups."
8965 (list current-prefix-arg
8966 (let* ((methods (gnus-methods-using 'respool))
8968 (symbol-name (or gnus-summary-respool-default-method
8969 (car (gnus-find-method-for-group
8970 gnus-newsgroup-name)))))
8972 (gnus-completing-read-with-default
8973 methname "What backend do you want to use when respooling?"
8974 methods nil t nil 'gnus-mail-method-history))
8977 ((zerop (length (setq ms (gnus-servers-using-backend
8979 (list (intern method) ""))
8983 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
8984 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
8987 (error "No method given for respooling"))
8988 (if (assoc (symbol-name
8989 (car (gnus-find-method-for-group gnus-newsgroup-name)))
8990 (gnus-methods-using 'respool))
8991 (gnus-summary-move-article n nil method)
8992 (gnus-summary-copy-article n nil method)))
8994 (defun gnus-summary-import-article (file &optional edit)
8995 "Import an arbitrary file into a mail newsgroup."
8996 (interactive "fImport file: \nP")
8997 (let ((group gnus-newsgroup-name)
8998 (now (current-time))
8999 atts lines group-art)
9000 (unless (gnus-check-backend-function 'request-accept-article group)
9001 (error "%s does not support article importing" group))
9002 (or (file-readable-p file)
9003 (not (file-regular-p file))
9004 (error "Can't read %s" file))
9006 (set-buffer (gnus-get-buffer-create " *import file*"))
9008 (nnheader-insert-file-contents file)
9009 (goto-char (point-min))
9010 (if (nnheader-article-p)
9012 (goto-char (point-min))
9013 (search-forward "\n\n" nil t)
9014 (narrow-to-region (point-min) (1- (point)))
9015 (goto-char (point-min))
9016 (unless (re-search-forward "^date:" nil t)
9017 (goto-char (point-max))
9018 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9019 ;; This doesn't look like an article, so we fudge some headers.
9020 (setq atts (file-attributes file)
9021 lines (count-lines (point-min) (point-max)))
9022 (insert "From: " (read-string "From: ") "\n"
9023 "Subject: " (read-string "Subject: ") "\n"
9024 "Date: " (message-make-date (nth 5 atts)) "\n"
9025 "Message-ID: " (message-make-message-id) "\n"
9026 "Lines: " (int-to-string lines) "\n"
9027 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9028 (setq group-art (gnus-request-accept-article group nil t))
9029 (kill-buffer (current-buffer)))
9030 (setq gnus-newsgroup-active (gnus-activate-group group))
9032 (gnus-summary-goto-article (cdr group-art) nil t)
9034 (gnus-summary-edit-article))))
9036 (defun gnus-summary-create-article ()
9037 "Create an article in a mail newsgroup."
9039 (let ((group gnus-newsgroup-name)
9040 (now (current-time))
9042 (unless (gnus-check-backend-function 'request-accept-article group)
9043 (error "%s does not support article importing" group))
9045 (set-buffer (gnus-get-buffer-create " *import file*"))
9047 (goto-char (point-min))
9048 ;; This doesn't look like an article, so we fudge some headers.
9049 (insert "From: " (read-string "From: ") "\n"
9050 "Subject: " (read-string "Subject: ") "\n"
9051 "Date: " (message-make-date now) "\n"
9052 "Message-ID: " (message-make-message-id) "\n")
9053 (setq group-art (gnus-request-accept-article group nil t))
9054 (kill-buffer (current-buffer)))
9055 (setq gnus-newsgroup-active (gnus-activate-group group))
9057 (gnus-summary-goto-article (cdr group-art) nil t)
9058 (gnus-summary-edit-article)))
9060 (defun gnus-summary-article-posted-p ()
9061 "Say whether the current (mail) article is available from news as well.
9062 This will be the case if the article has both been mailed and posted."
9064 (let ((id (mail-header-references (gnus-summary-article-header)))
9065 (gnus-override-method (car (gnus-refer-article-methods))))
9066 (if (gnus-request-head id "")
9067 (gnus-message 2 "The current message was found on %s"
9068 gnus-override-method)
9069 (gnus-message 2 "The current message couldn't be found on %s"
9070 gnus-override-method)
9073 (defun gnus-summary-expire-articles (&optional now)
9074 "Expire all articles that are marked as expirable in the current group."
9076 (when (gnus-check-backend-function
9077 'request-expire-articles gnus-newsgroup-name)
9078 ;; This backend supports expiry.
9079 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9080 (expirable (if total
9082 ;; We need to update the info for
9083 ;; this group for `gnus-list-of-read-articles'
9084 ;; to give us the right answer.
9085 (gnus-run-hooks 'gnus-exit-group-hook)
9086 (gnus-summary-update-info)
9087 (gnus-list-of-read-articles gnus-newsgroup-name))
9088 (setq gnus-newsgroup-expirable
9089 (sort gnus-newsgroup-expirable '<))))
9090 (expiry-wait (if now 'immediate
9091 (gnus-group-find-parameter
9092 gnus-newsgroup-name 'expiry-wait)))
9093 (nnmail-expiry-target
9094 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9095 nnmail-expiry-target))
9098 ;; There are expirable articles in this group, so we run them
9099 ;; through the expiry process.
9100 (gnus-message 6 "Expiring articles...")
9101 (unless (gnus-check-group gnus-newsgroup-name)
9102 (error "Can't open server for %s" gnus-newsgroup-name))
9103 ;; The list of articles that weren't expired is returned.
9106 (let ((nnmail-expiry-wait-function nil)
9107 (nnmail-expiry-wait expiry-wait))
9108 (setq es (gnus-request-expire-articles
9109 expirable gnus-newsgroup-name)))
9110 (setq es (gnus-request-expire-articles
9111 expirable gnus-newsgroup-name)))
9113 (setq gnus-newsgroup-expirable es))
9114 ;; We go through the old list of expirable, and mark all
9115 ;; really expired articles as nonexistent.
9116 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9117 (let ((gnus-use-cache nil))
9118 (dolist (article expirable)
9119 (when (and (not (memq article es))
9120 (gnus-data-find article))
9121 (gnus-summary-mark-article article gnus-canceled-mark))))))
9122 (gnus-message 6 "Expiring articles...done")))))
9124 (defun gnus-summary-expire-articles-now ()
9125 "Expunge all expirable articles in the current group.
9126 This means that *all* articles that are marked as expirable will be
9127 deleted forever, right now."
9129 (or gnus-expert-user
9131 "Are you really, really, really sure you want to delete all these messages? ")
9133 (gnus-summary-expire-articles t))
9135 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9136 (defun gnus-summary-delete-article (&optional n)
9137 "Delete the N next (mail) articles.
9138 This command actually deletes articles. This is not a marking
9139 command. The article will disappear forever from your life, never to
9141 If N is negative, delete backwards.
9142 If N is nil and articles have been marked with the process mark,
9143 delete these instead."
9145 (unless (gnus-check-backend-function 'request-expire-articles
9146 gnus-newsgroup-name)
9147 (error "The current newsgroup does not support article deletion"))
9148 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9149 (error "Couldn't open server"))
9150 ;; Compute the list of articles to delete.
9151 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9152 (nnmail-expiry-target 'delete)
9154 (if (and gnus-novice-user
9155 (not (gnus-yes-or-no-p
9156 (format "Do you really want to delete %s forever? "
9157 (if (> (length articles) 1)
9158 (format "these %s articles" (length articles))
9161 ;; Delete the articles.
9162 (setq not-deleted (gnus-request-expire-articles
9163 articles gnus-newsgroup-name 'force))
9165 (gnus-summary-remove-process-mark (car articles))
9166 ;; The backend might not have been able to delete the article
9168 (unless (memq (car articles) not-deleted)
9169 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9170 (setq articles (cdr articles)))
9172 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9173 (gnus-summary-position-point)
9174 (gnus-set-mode-line 'summary)
9177 (defun gnus-summary-edit-article (&optional force)
9178 "Edit the current article.
9179 This will have permanent effect only in mail groups.
9180 If FORCE is non-nil, allow editing of articles even in read-only
9184 (set-buffer gnus-summary-buffer)
9185 (let ((mail-parse-charset gnus-newsgroup-charset)
9186 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9187 (gnus-set-global-variables)
9188 (when (and (not force)
9189 (gnus-group-read-only-p))
9190 (error "The current newsgroup does not support article editing"))
9191 (gnus-summary-show-article t)
9192 (gnus-article-edit-article
9194 `(lambda (no-highlight)
9195 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9196 (message-options message-options)
9197 (message-options-set-recipient)
9198 (mail-parse-ignored-charsets
9199 ',gnus-newsgroup-ignored-charsets))
9200 (gnus-summary-edit-article-done
9201 ,(or (mail-header-references gnus-current-headers) "")
9202 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
9204 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9206 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9208 "Make edits to the current article permanent."
9211 ;; The buffer restriction contains the entire article if it exists.
9212 (when (article-goto-body)
9213 (let ((lines (count-lines (point) (point-max)))
9214 (length (- (point-max) (point)))
9215 (case-fold-search t)
9216 (body (copy-marker (point))))
9217 (goto-char (point-min))
9218 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9219 (delete-region (match-beginning 1) (match-end 1))
9220 (insert (number-to-string length)))
9221 (goto-char (point-min))
9222 (when (re-search-forward
9223 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9224 (delete-region (match-beginning 1) (match-end 1))
9225 (insert (number-to-string length)))
9226 (goto-char (point-min))
9227 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9228 (delete-region (match-beginning 1) (match-end 1))
9229 (insert (number-to-string lines))))))
9230 ;; Replace the article.
9231 (let ((buf (current-buffer)))
9233 (insert-buffer-substring buf)
9235 (if (and (not read-only)
9236 (not (gnus-request-replace-article
9237 (cdr gnus-article-current) (car gnus-article-current)
9238 (current-buffer) t)))
9239 (error "Couldn't replace article")
9240 ;; Update the summary buffer.
9242 (equal (message-tokenize-header references " ")
9243 (message-tokenize-header
9244 (or (message-fetch-field "references") "") " ")))
9245 ;; We only have to update this line.
9248 (message-narrow-to-head)
9249 (let ((head (buffer-string))
9252 (insert (format "211 %d Article retrieved.\n"
9253 (cdr gnus-article-current)))
9256 (let ((nntp-server-buffer (current-buffer)))
9257 (setq header (car (gnus-get-newsgroup-headers
9260 (set-buffer gnus-summary-buffer)
9261 (gnus-data-set-header
9262 (gnus-data-find (cdr gnus-article-current))
9264 (gnus-summary-update-article-line
9265 (cdr gnus-article-current) header)
9266 (if (gnus-summary-goto-subject
9267 (cdr gnus-article-current) nil t)
9268 (gnus-summary-update-secondary-mark
9269 (cdr gnus-article-current))))))))
9271 (set-buffer (or buffer gnus-summary-buffer))
9272 (gnus-summary-update-article (cdr gnus-article-current))
9273 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9274 (gnus-summary-update-secondary-mark
9275 (cdr gnus-article-current))))
9276 ;; Prettify the article buffer again.
9277 (unless no-highlight
9279 (set-buffer gnus-article-buffer)
9280 ;;;!!! Fix this -- article should be rehighlighted.
9281 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9282 (set-buffer gnus-original-article-buffer)
9283 (gnus-request-article
9284 (cdr gnus-article-current)
9285 (car gnus-article-current) (current-buffer))))
9286 ;; Prettify the summary buffer line.
9287 (when (gnus-visual-p 'summary-highlight 'highlight)
9288 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9290 (defun gnus-summary-edit-wash (key)
9291 "Perform editing command KEY in the article buffer."
9295 (message "%s" (concat (this-command-keys) "- "))
9298 (gnus-summary-edit-article)
9299 (execute-kbd-macro (concat (this-command-keys) key))
9300 (gnus-article-edit-done))
9304 (defun gnus-summary-respool-query (&optional silent trace)
9305 "Query where the respool algorithm would put this article."
9307 (let (gnus-mark-article-hook)
9308 (gnus-summary-select-article)
9310 (set-buffer gnus-original-article-buffer)
9312 (message-narrow-to-head)
9313 (let ((groups (nnmail-article-group 'identity trace)))
9316 (message "This message would go to %s"
9317 (mapconcat 'car groups ", "))
9318 (message "This message would go to no groups"))
9321 (defun gnus-summary-respool-trace ()
9322 "Trace where the respool algorithm would put this article.
9323 Display a buffer showing all fancy splitting patterns which matched."
9325 (gnus-summary-respool-query nil t))
9327 ;; Summary marking commands.
9329 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9330 "Mark articles which has the same subject as read, and then select the next.
9331 If UNMARK is positive, remove any kind of mark.
9332 If UNMARK is negative, tick articles."
9335 (setq unmark (prefix-numeric-value unmark)))
9337 (gnus-summary-mark-same-subject
9338 (gnus-summary-article-subject) unmark)))
9339 ;; Select next unread article. If auto-select-same mode, should
9340 ;; select the first unread article.
9341 (gnus-summary-next-article t (and gnus-auto-select-same
9342 (gnus-summary-article-subject)))
9343 (gnus-message 7 "%d article%s marked as %s"
9344 count (if (= count 1) " is" "s are")
9345 (if unmark "unread" "read"))))
9347 (defun gnus-summary-kill-same-subject (&optional unmark)
9348 "Mark articles which has the same subject as read.
9349 If UNMARK is positive, remove any kind of mark.
9350 If UNMARK is negative, tick articles."
9353 (setq unmark (prefix-numeric-value unmark)))
9355 (gnus-summary-mark-same-subject
9356 (gnus-summary-article-subject) unmark)))
9357 ;; If marked as read, go to next unread subject.
9359 ;; Go to next unread subject.
9360 (gnus-summary-next-subject 1 t))
9361 (gnus-message 7 "%d articles are marked as %s"
9362 count (if unmark "unread" "read"))))
9364 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9365 "Mark articles with same SUBJECT as read, and return marked number.
9366 If optional argument UNMARK is positive, remove any kinds of marks.
9367 If optional argument UNMARK is negative, mark articles as unread instead."
9371 ((null unmark) ; Mark as read.
9374 (gnus-summary-mark-article-as-read gnus-killed-mark)
9375 (gnus-summary-show-thread) t)
9376 (gnus-summary-find-subject subject))
9377 (setq count (1+ count))))
9378 ((> unmark 0) ; Tick.
9381 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9382 (gnus-summary-show-thread) t)
9383 (gnus-summary-find-subject subject))
9384 (setq count (1+ count))))
9385 (t ; Mark as unread.
9388 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9389 (gnus-summary-show-thread) t)
9390 (gnus-summary-find-subject subject))
9391 (setq count (1+ count)))))
9392 (gnus-set-mode-line 'summary)
9393 ;; Return the number of marked articles.
9396 (defun gnus-summary-mark-as-processable (n &optional unmark)
9397 "Set the process mark on the next N articles.
9398 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9399 the process mark instead. The difference between N and the actual
9400 number of articles marked is returned."
9402 (if (and (null n) (gnus-region-active-p))
9403 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9404 (setq n (prefix-numeric-value n))
9405 (let ((backward (< n 0))
9410 (gnus-summary-remove-process-mark
9411 (gnus-summary-article-number))
9412 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9413 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9416 (gnus-message 7 "No more articles"))
9417 (gnus-summary-recenter)
9418 (gnus-summary-position-point)
9421 (defun gnus-summary-unmark-as-processable (n)
9422 "Remove the process mark from the next N articles.
9423 If N is negative, unmark backward instead. The difference between N and
9424 the actual number of articles unmarked is returned."
9426 (gnus-summary-mark-as-processable n t))
9428 (defun gnus-summary-unmark-all-processable ()
9429 "Remove the process mark from all articles."
9432 (while gnus-newsgroup-processable
9433 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9434 (gnus-summary-position-point))
9436 (defun gnus-summary-add-mark (article type)
9437 "Mark ARTICLE with a mark of TYPE."
9438 (let ((vtype (car (assq type gnus-article-mark-lists)))
9441 (error "No such mark type: %s" type)
9442 (setq var (intern (format "gnus-newsgroup-%s" type)))
9443 (set var (cons article (symbol-value var)))
9444 (if (memq type '(processable cached replied forwarded recent saved))
9445 (gnus-summary-update-secondary-mark article)
9446 ;;; !!! This is bogus. We should find out what primary
9447 ;;; !!! mark we want to set.
9448 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9450 (defun gnus-summary-mark-as-expirable (n)
9451 "Mark N articles forward as expirable.
9452 If N is negative, mark backward instead. The difference between N and
9453 the actual number of articles marked is returned."
9455 (gnus-summary-mark-forward n gnus-expirable-mark))
9457 (defun gnus-summary-mark-as-spam (n)
9458 "Mark N articles forward as spam.
9459 If N is negative, mark backward instead. The difference between N and
9460 the actual number of articles marked is returned."
9462 (gnus-summary-mark-forward n gnus-spam-mark))
9464 (defun gnus-summary-mark-article-as-replied (article)
9465 "Mark ARTICLE as replied to and update the summary line.
9466 ARTICLE can also be a list of articles."
9467 (interactive (list (gnus-summary-article-number)))
9468 (let ((articles (if (listp article) article (list article))))
9469 (dolist (article articles)
9470 (push article gnus-newsgroup-replied)
9471 (let ((buffer-read-only nil))
9472 (when (gnus-summary-goto-subject article nil t)
9473 (gnus-summary-update-secondary-mark article))))))
9475 (defun gnus-summary-mark-article-as-forwarded (article)
9476 "Mark ARTICLE as forwarded and update the summary line.
9477 ARTICLE can also be a list of articles."
9478 (let ((articles (if (listp article) article (list article))))
9479 (dolist (article articles)
9480 (push article gnus-newsgroup-forwarded)
9481 (let ((buffer-read-only nil))
9482 (when (gnus-summary-goto-subject article nil t)
9483 (gnus-summary-update-secondary-mark article))))))
9485 (defun gnus-summary-set-bookmark (article)
9486 "Set a bookmark in current article."
9487 (interactive (list (gnus-summary-article-number)))
9488 (when (or (not (get-buffer gnus-article-buffer))
9489 (not gnus-current-article)
9490 (not gnus-article-current)
9491 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9492 (error "No current article selected"))
9493 ;; Remove old bookmark, if one exists.
9494 (let ((old (assq article gnus-newsgroup-bookmarks)))
9496 (setq gnus-newsgroup-bookmarks
9497 (delq old gnus-newsgroup-bookmarks))))
9498 ;; Set the new bookmark, which is on the form
9499 ;; (article-number . line-number-in-body).
9503 (set-buffer gnus-article-buffer)
9507 (goto-char (point-min))
9508 (search-forward "\n\n" nil t)
9511 gnus-newsgroup-bookmarks)
9512 (gnus-message 6 "A bookmark has been added to the current article."))
9514 (defun gnus-summary-remove-bookmark (article)
9515 "Remove the bookmark from the current article."
9516 (interactive (list (gnus-summary-article-number)))
9517 ;; Remove old bookmark, if one exists.
9518 (let ((old (assq article gnus-newsgroup-bookmarks)))
9521 (setq gnus-newsgroup-bookmarks
9522 (delq old gnus-newsgroup-bookmarks))
9523 (gnus-message 6 "Removed bookmark."))
9524 (gnus-message 6 "No bookmark in current article."))))
9526 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9527 (defun gnus-summary-mark-as-dormant (n)
9528 "Mark N articles forward as dormant.
9529 If N is negative, mark backward instead. The difference between N and
9530 the actual number of articles marked is returned."
9532 (gnus-summary-mark-forward n gnus-dormant-mark))
9534 (defun gnus-summary-set-process-mark (article)
9535 "Set the process mark on ARTICLE and update the summary line."
9536 (setq gnus-newsgroup-processable
9538 (delq article gnus-newsgroup-processable)))
9539 (when (gnus-summary-goto-subject article)
9540 (gnus-summary-show-thread)
9541 (gnus-summary-goto-subject article)
9542 (gnus-summary-update-secondary-mark article)))
9544 (defun gnus-summary-remove-process-mark (article)
9545 "Remove the process mark from ARTICLE and update the summary line."
9546 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9547 (when (gnus-summary-goto-subject article)
9548 (gnus-summary-show-thread)
9549 (gnus-summary-goto-subject article)
9550 (gnus-summary-update-secondary-mark article)))
9552 (defun gnus-summary-set-saved-mark (article)
9553 "Set the process mark on ARTICLE and update the summary line."
9554 (push article gnus-newsgroup-saved)
9555 (when (gnus-summary-goto-subject article)
9556 (gnus-summary-update-secondary-mark article)))
9558 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9559 "Mark N articles as read forwards.
9560 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9561 The difference between N and the actual number of articles marked is
9563 If NO-EXPIRE, auto-expiry will be inhibited."
9565 (gnus-summary-show-thread)
9566 (let ((backward (< n 0))
9567 (gnus-summary-goto-unread
9568 (and gnus-summary-goto-unread
9569 (not (eq gnus-summary-goto-unread 'never))
9570 (not (memq mark (list gnus-unread-mark
9571 gnus-ticked-mark gnus-dormant-mark)))))
9573 (mark (or mark gnus-del-mark)))
9575 (gnus-summary-mark-article nil mark no-expire)
9576 (zerop (gnus-summary-next-subject
9578 (and gnus-summary-goto-unread
9579 (not (eq gnus-summary-goto-unread 'never)))
9583 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9584 (gnus-summary-recenter)
9585 (gnus-summary-position-point)
9586 (gnus-set-mode-line 'summary)
9589 (defun gnus-summary-mark-article-as-read (mark)
9590 "Mark the current article quickly as read with MARK."
9591 (let ((article (gnus-summary-article-number)))
9592 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9593 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9594 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9595 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9596 (push (cons article mark) gnus-newsgroup-reads)
9597 ;; Possibly remove from cache, if that is used.
9598 (when gnus-use-cache
9599 (gnus-cache-enter-remove-article article))
9600 ;; Allow the backend to change the mark.
9601 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9602 ;; Check for auto-expiry.
9603 (when (and gnus-newsgroup-auto-expire
9604 (memq mark gnus-auto-expirable-marks))
9605 (setq mark gnus-expirable-mark)
9606 ;; Let the backend know about the mark change.
9607 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9608 (push article gnus-newsgroup-expirable))
9609 ;; Set the mark in the buffer.
9610 (gnus-summary-update-mark mark 'unread)
9613 (defun gnus-summary-mark-article-as-unread (mark)
9614 "Mark the current article quickly as unread with MARK."
9615 (let* ((article (gnus-summary-article-number))
9616 (old-mark (gnus-summary-article-mark article)))
9617 ;; Allow the backend to change the mark.
9618 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9619 (if (eq mark old-mark)
9623 (gnus-error 1 "Can't mark negative article numbers")
9625 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9626 (setq gnus-newsgroup-spam-marked
9627 (delq article gnus-newsgroup-spam-marked))
9628 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9629 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9630 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9631 (cond ((= mark gnus-ticked-mark)
9632 (setq gnus-newsgroup-marked
9633 (gnus-add-to-sorted-list gnus-newsgroup-marked
9635 ((= mark gnus-spam-mark)
9636 (setq gnus-newsgroup-spam-marked
9637 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9639 ((= mark gnus-dormant-mark)
9640 (setq gnus-newsgroup-dormant
9641 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9644 (setq gnus-newsgroup-unreads
9645 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9647 (gnus-pull article gnus-newsgroup-reads)
9649 ;; See whether the article is to be put in the cache.
9651 (vectorp (gnus-summary-article-header article))
9653 (gnus-cache-possibly-enter-article
9654 gnus-newsgroup-name article
9655 (gnus-summary-article-header article)
9656 (= mark gnus-ticked-mark)
9657 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9660 (gnus-summary-update-mark mark 'unread)
9663 (defun gnus-summary-mark-article (&optional article mark no-expire)
9664 "Mark ARTICLE with MARK. MARK can be any character.
9665 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9666 `??' (dormant) and `?E' (expirable).
9667 If MARK is nil, then the default character `?r' is used.
9668 If ARTICLE is nil, then the article on the current line will be
9670 If NO-EXPIRE, auto-expiry will be inhibited."
9671 ;; The mark might be a string.
9672 (when (stringp mark)
9673 (setq mark (aref mark 0)))
9674 ;; If no mark is given, then we check auto-expiring.
9676 (setq mark gnus-del-mark))
9677 (when (and (not no-expire)
9678 gnus-newsgroup-auto-expire
9679 (memq mark gnus-auto-expirable-marks))
9680 (setq mark gnus-expirable-mark))
9681 (let ((article (or article (gnus-summary-article-number)))
9682 (old-mark (gnus-summary-article-mark article)))
9683 ;; Allow the backend to change the mark.
9684 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9685 (if (eq mark old-mark)
9688 (error "No article on current line"))
9689 (if (not (if (or (= mark gnus-unread-mark)
9690 (= mark gnus-ticked-mark)
9691 (= mark gnus-spam-mark)
9692 (= mark gnus-dormant-mark))
9693 (gnus-mark-article-as-unread article mark)
9694 (gnus-mark-article-as-read article mark)))
9696 ;; See whether the article is to be put in the cache.
9698 (not (= mark gnus-canceled-mark))
9699 (vectorp (gnus-summary-article-header article))
9701 (gnus-cache-possibly-enter-article
9702 gnus-newsgroup-name article
9703 (gnus-summary-article-header article)
9704 (= mark gnus-ticked-mark)
9705 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9707 (when (gnus-summary-goto-subject article nil t)
9708 (let ((buffer-read-only nil))
9709 (gnus-summary-show-thread)
9711 (gnus-summary-update-mark mark 'unread)
9714 (defun gnus-summary-update-secondary-mark (article)
9715 "Update the secondary (read, process, cache) mark."
9716 (gnus-summary-update-mark
9717 (cond ((memq article gnus-newsgroup-processable)
9719 ((memq article gnus-newsgroup-cached)
9721 ((memq article gnus-newsgroup-replied)
9723 ((memq article gnus-newsgroup-forwarded)
9724 gnus-forwarded-mark)
9725 ((memq article gnus-newsgroup-saved)
9727 ((memq article gnus-newsgroup-recent)
9729 ((memq article gnus-newsgroup-unseen)
9733 (when (gnus-visual-p 'summary-highlight 'highlight)
9734 (gnus-run-hooks 'gnus-summary-update-hook))
9737 (defun gnus-summary-update-download-mark (article)
9738 "Update the secondary (read, process, cache) mark."
9739 (gnus-summary-update-mark
9740 (cond ((memq article gnus-newsgroup-undownloaded)
9741 gnus-undownloaded-mark)
9742 (gnus-newsgroup-agentized
9743 gnus-downloaded-mark)
9747 (gnus-summary-update-line t)
9750 (defun gnus-summary-update-mark (mark type)
9751 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9752 (buffer-read-only nil))
9753 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
9755 (when (looking-at "\r")
9757 (when (<= (+ forward (point)) (point-max))
9758 ;; Go to the right position on the line.
9759 (goto-char (+ forward (point)))
9760 ;; Replace the old mark with the new mark.
9761 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9762 ;; Optionally update the marks by some user rule.
9763 (when (eq type 'unread)
9765 (gnus-data-find (gnus-summary-article-number)) mark)
9766 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
9768 (defun gnus-mark-article-as-read (article &optional mark)
9769 "Enter ARTICLE in the pertinent lists and remove it from others."
9770 ;; Make the article expirable.
9771 (let ((mark (or mark gnus-del-mark)))
9772 (setq gnus-newsgroup-expirable
9773 (if (= mark gnus-expirable-mark)
9774 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
9775 (delq article gnus-newsgroup-expirable)))
9776 ;; Remove from unread and marked lists.
9777 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9778 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9779 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9780 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9781 (push (cons article mark) gnus-newsgroup-reads)
9782 ;; Possibly remove from cache, if that is used.
9783 (when gnus-use-cache
9784 (gnus-cache-enter-remove-article article))
9787 (defun gnus-mark-article-as-unread (article &optional mark)
9788 "Enter ARTICLE in the pertinent lists and remove it from others."
9789 (let ((mark (or mark gnus-ticked-mark)))
9792 (gnus-error 1 "Can't mark negative article numbers")
9794 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9795 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
9796 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9797 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9798 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9800 ;; Unsuppress duplicates?
9801 (when gnus-suppress-duplicates
9802 (gnus-dup-unsuppress-article article))
9804 (cond ((= mark gnus-ticked-mark)
9805 (setq gnus-newsgroup-marked
9806 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
9807 ((= mark gnus-spam-mark)
9808 (setq gnus-newsgroup-spam-marked
9809 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9811 ((= mark gnus-dormant-mark)
9812 (setq gnus-newsgroup-dormant
9813 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
9815 (setq gnus-newsgroup-unreads
9816 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
9817 (gnus-pull article gnus-newsgroup-reads)
9820 (defalias 'gnus-summary-mark-as-unread-forward
9821 'gnus-summary-tick-article-forward)
9822 (make-obsolete 'gnus-summary-mark-as-unread-forward
9823 'gnus-summary-tick-article-forward)
9824 (defun gnus-summary-tick-article-forward (n)
9825 "Tick N articles forwards.
9826 If N is negative, tick backwards instead.
9827 The difference between N and the number of articles ticked is returned."
9829 (gnus-summary-mark-forward n gnus-ticked-mark))
9831 (defalias 'gnus-summary-mark-as-unread-backward
9832 'gnus-summary-tick-article-backward)
9833 (make-obsolete 'gnus-summary-mark-as-unread-backward
9834 'gnus-summary-tick-article-backward)
9835 (defun gnus-summary-tick-article-backward (n)
9836 "Tick N articles backwards.
9837 The difference between N and the number of articles ticked is returned."
9839 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
9841 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9842 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9843 (defun gnus-summary-tick-article (&optional article clear-mark)
9844 "Mark current article as unread.
9845 Optional 1st argument ARTICLE specifies article number to be marked as unread.
9846 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
9848 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
9851 (defun gnus-summary-mark-as-read-forward (n)
9852 "Mark N articles as read forwards.
9853 If N is negative, mark backwards instead.
9854 The difference between N and the actual number of articles marked is
9857 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
9859 (defun gnus-summary-mark-as-read-backward (n)
9860 "Mark the N articles as read backwards.
9861 The difference between N and the actual number of articles marked is
9864 (gnus-summary-mark-forward
9865 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
9867 (defun gnus-summary-mark-as-read (&optional article mark)
9868 "Mark current article as read.
9869 ARTICLE specifies the article to be marked as read.
9870 MARK specifies a string to be inserted at the beginning of the line."
9871 (gnus-summary-mark-article article mark))
9873 (defun gnus-summary-clear-mark-forward (n)
9874 "Clear marks from N articles forward.
9875 If N is negative, clear backward instead.
9876 The difference between N and the number of marks cleared is returned."
9878 (gnus-summary-mark-forward n gnus-unread-mark))
9880 (defun gnus-summary-clear-mark-backward (n)
9881 "Clear marks from N articles backward.
9882 The difference between N and the number of marks cleared is returned."
9884 (gnus-summary-mark-forward (- n) gnus-unread-mark))
9886 (defun gnus-summary-mark-unread-as-read ()
9887 "Intended to be used by `gnus-summary-mark-article-hook'."
9888 (when (memq gnus-current-article gnus-newsgroup-unreads)
9889 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
9891 (defun gnus-summary-mark-read-and-unread-as-read ()
9892 "Intended to be used by `gnus-summary-mark-article-hook'."
9893 (let ((mark (gnus-summary-article-mark)))
9894 (when (or (gnus-unread-mark-p mark)
9895 (gnus-read-mark-p mark))
9896 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
9898 (defun gnus-summary-mark-unread-as-ticked ()
9899 "Intended to be used by `gnus-summary-mark-article-hook'."
9900 (when (memq gnus-current-article gnus-newsgroup-unreads)
9901 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
9903 (defun gnus-summary-mark-region-as-read (point mark all)
9904 "Mark all unread articles between point and mark as read.
9905 If given a prefix, mark all articles between point and mark as read,
9906 even ticked and dormant ones."
9907 (interactive "r\nP")
9916 (memq (setq article (gnus-summary-article-number))
9917 gnus-newsgroup-unreads))
9918 (gnus-summary-mark-article article gnus-del-mark))
9920 (gnus-summary-find-next))))))
9922 (defun gnus-summary-mark-below (score mark)
9923 "Mark articles with score less than SCORE with MARK."
9924 (interactive "P\ncMark: ")
9925 (setq score (if score
9926 (prefix-numeric-value score)
9927 (or gnus-summary-default-score 0)))
9929 (set-buffer gnus-summary-buffer)
9930 (goto-char (point-min))
9933 (and (< (gnus-summary-article-score) score)
9934 (gnus-summary-mark-article nil mark))
9935 (gnus-summary-find-next)))))
9937 (defun gnus-summary-kill-below (&optional score)
9938 "Mark articles with score below SCORE as read."
9940 (gnus-summary-mark-below score gnus-killed-mark))
9942 (defun gnus-summary-clear-above (&optional score)
9943 "Clear all marks from articles with score above SCORE."
9945 (gnus-summary-mark-above score gnus-unread-mark))
9947 (defun gnus-summary-tick-above (&optional score)
9948 "Tick all articles with score above SCORE."
9950 (gnus-summary-mark-above score gnus-ticked-mark))
9952 (defun gnus-summary-mark-above (score mark)
9953 "Mark articles with score over SCORE with MARK."
9954 (interactive "P\ncMark: ")
9955 (setq score (if score
9956 (prefix-numeric-value score)
9957 (or gnus-summary-default-score 0)))
9959 (set-buffer gnus-summary-buffer)
9960 (goto-char (point-min))
9962 (when (> (gnus-summary-article-score) score)
9963 (gnus-summary-mark-article nil mark))
9965 (gnus-summary-find-next)))))
9967 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9968 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
9969 (defun gnus-summary-limit-include-expunged (&optional no-error)
9970 "Display all the hidden articles that were expunged for low scores."
9972 (let ((buffer-read-only nil))
9973 (let ((scored gnus-newsgroup-scored)
9976 (unless (gnus-summary-article-header (caar scored))
9977 (and (setq h (gnus-number-to-header (caar scored)))
9978 (< (cdar scored) gnus-summary-expunge-below)
9980 (setq scored (cdr scored)))
9982 (when (not no-error)
9983 (error "No expunged articles hidden"))
9984 (goto-char (point-min))
9985 (push gnus-newsgroup-limit gnus-newsgroup-limits)
9986 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
9987 (mapcar (lambda (x) (push (mail-header-number x)
9988 gnus-newsgroup-limit))
9990 (gnus-summary-prepare-unthreaded (nreverse headers))
9991 (goto-char (point-min))
9992 (gnus-summary-position-point)
9995 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
9996 "Mark all unread articles in this newsgroup as read.
9997 If prefix argument ALL is non-nil, ticked and dormant articles will
9998 also be marked as read.
9999 If QUIETLY is non-nil, no questions will be asked.
10000 If TO-HERE is non-nil, it should be a point in the buffer. All
10001 articles before (after, if REVERSE is set) this point will be marked as read.
10002 Note that this function will only catch up the unread article
10003 in the current summary buffer limitation.
10004 The number of articles marked as read is returned."
10009 (not gnus-interactive-catchup) ;Without confirmation?
10013 "Mark absolutely all articles as read? "
10014 "Mark all unread articles as read? ")))
10016 (not gnus-newsgroup-adaptive)
10017 (not gnus-newsgroup-auto-expire)
10018 (not gnus-suppress-duplicates)
10019 (or (not gnus-use-cache)
10020 (eq gnus-use-cache 'passive)))
10023 (setq gnus-newsgroup-marked nil
10024 gnus-newsgroup-spam-marked nil
10025 gnus-newsgroup-dormant nil))
10026 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
10027 ;; We actually mark all articles as canceled, which we
10028 ;; have to do when using auto-expiry or adaptive scoring.
10029 (gnus-summary-show-all-threads)
10030 (if (and to-here reverse)
10032 (goto-char to-here)
10034 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10035 (gnus-summary-find-next (not all) nil nil t))))
10036 (when (gnus-summary-first-subject (not all) t)
10038 (if to-here (< (point) to-here) t)
10039 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10040 (gnus-summary-find-next (not all) nil nil t)))))
10041 (gnus-set-mode-line 'summary))
10043 (gnus-summary-position-point)))
10045 (defun gnus-summary-catchup-to-here (&optional all)
10046 "Mark all unticked articles before the current one as read.
10047 If ALL is non-nil, also mark ticked and dormant articles as read."
10050 (gnus-save-hidden-threads
10051 (let ((beg (point)))
10052 ;; We check that there are unread articles.
10053 (when (or all (gnus-summary-find-prev))
10054 (gnus-summary-catchup all t beg)))))
10055 (gnus-summary-position-point))
10057 (defun gnus-summary-catchup-from-here (&optional all)
10058 "Mark all unticked articles after the current one as read.
10059 If ALL is non-nil, also mark ticked and dormant articles as read."
10062 (gnus-save-hidden-threads
10063 (let ((beg (point)))
10064 ;; We check that there are unread articles.
10065 (when (or all (gnus-summary-find-next))
10066 (gnus-summary-catchup all t beg nil t)))))
10067 (gnus-summary-position-point))
10069 (defun gnus-summary-catchup-all (&optional quietly)
10070 "Mark all articles in this newsgroup as read.
10071 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10072 instead, which marks only unread articles as read."
10074 (gnus-summary-catchup t quietly))
10076 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10077 "Mark all unread articles in this group as read, then exit.
10078 If prefix argument ALL is non-nil, all articles are marked as read.
10079 If QUIETLY is non-nil, no questions will be asked."
10081 (when (gnus-summary-catchup all quietly nil 'fast)
10082 ;; Select next newsgroup or exit.
10083 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10084 (eq gnus-auto-select-next 'quietly))
10085 (gnus-summary-next-group nil)
10086 (gnus-summary-exit))))
10088 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10089 "Mark all articles in this newsgroup as read, and then exit.
10090 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10091 instead, which marks only unread articles as read."
10093 (gnus-summary-catchup-and-exit t quietly))
10095 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10096 "Mark all articles in this group as read and select the next group.
10097 If given a prefix, mark all articles, unread as well as ticked, as
10101 (gnus-summary-catchup all))
10102 (gnus-summary-next-group))
10108 (defmacro gnus-with-article (article &rest forms)
10109 "Select ARTICLE and perform FORMS in the original article buffer.
10110 Then replace the article with the result."
10112 ;; We don't want the article to be marked as read.
10113 (let (gnus-mark-article-hook)
10114 (gnus-summary-select-article t t nil ,article))
10115 (set-buffer gnus-original-article-buffer)
10117 (if (not (gnus-check-backend-function
10118 'request-replace-article (car gnus-article-current)))
10119 (gnus-message 5 "Read-only group; not replacing")
10120 (unless (gnus-request-replace-article
10121 ,article (car gnus-article-current)
10122 (current-buffer) t)
10123 (error "Couldn't replace article")))
10124 ;; The cache and backlog have to be flushed somewhat.
10125 (when gnus-keep-backlog
10126 (gnus-backlog-remove-article
10127 (car gnus-article-current) (cdr gnus-article-current)))
10128 (when gnus-use-cache
10129 (gnus-cache-update-article
10130 (car gnus-article-current) (cdr gnus-article-current)))))
10132 (put 'gnus-with-article 'lisp-indent-function 1)
10133 (put 'gnus-with-article 'edebug-form-spec '(form body))
10135 ;; Thread-based commands.
10137 (defun gnus-summary-articles-in-thread (&optional article)
10138 "Return a list of all articles in the current thread.
10139 If ARTICLE is non-nil, return all articles in the thread that starts
10140 with that article."
10141 (let* ((article (or article (gnus-summary-article-number)))
10142 (data (gnus-data-find-list article))
10143 (top-level (gnus-data-level (car data)))
10145 (cond ((null gnus-thread-operation-ignore-subject)
10146 (gnus-simplify-subject-re
10147 (mail-header-subject (gnus-data-header (car data)))))
10148 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10149 (gnus-simplify-subject-fuzzy
10150 (mail-header-subject (gnus-data-header (car data)))))
10152 (end-point (save-excursion
10153 (if (gnus-summary-go-to-next-thread)
10154 (point) (point-max))))
10157 (< (gnus-data-pos (car data)) end-point))
10158 (when (or (not top-subject)
10159 (string= top-subject
10160 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10161 (gnus-simplify-subject-fuzzy
10162 (mail-header-subject
10163 (gnus-data-header (car data))))
10164 (gnus-simplify-subject-re
10165 (mail-header-subject
10166 (gnus-data-header (car data)))))))
10167 (push (gnus-data-number (car data)) articles))
10168 (unless (and (setq data (cdr data))
10169 (> (gnus-data-level (car data)) top-level))
10171 ;; Return the list of articles.
10172 (nreverse articles)))
10174 (defun gnus-summary-rethread-current ()
10175 "Rethread the thread the current article is part of."
10177 (let* ((gnus-show-threads t)
10178 (article (gnus-summary-article-number))
10179 (id (mail-header-id (gnus-summary-article-header)))
10180 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10182 (error "No article on the current line"))
10183 (gnus-rebuild-thread id)
10184 (gnus-summary-goto-subject article)))
10186 (defun gnus-summary-reparent-thread ()
10187 "Make the current article child of the marked (or previous) article.
10189 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10190 is non-nil or the Subject: of both articles are the same."
10192 (unless (not (gnus-group-read-only-p))
10193 (error "The current newsgroup does not support article editing"))
10194 (unless (<= (length gnus-newsgroup-processable) 1)
10195 (error "No more than one article may be marked"))
10196 (save-window-excursion
10197 (let ((gnus-article-buffer " *reparent*")
10198 (current-article (gnus-summary-article-number))
10199 ;; First grab the marked article, otherwise one line up.
10200 (parent-article (if (not (null gnus-newsgroup-processable))
10201 (car gnus-newsgroup-processable)
10203 (if (eq (forward-line -1) 0)
10204 (gnus-summary-article-number)
10205 (error "Beginning of summary buffer"))))))
10206 (unless (not (eq current-article parent-article))
10207 (error "An article may not be self-referential"))
10208 (let ((message-id (mail-header-id
10209 (gnus-summary-article-header parent-article))))
10210 (unless (and message-id (not (equal message-id "")))
10211 (error "No message-id in desired parent"))
10212 (gnus-with-article current-article
10214 (goto-char (point-min))
10215 (message-narrow-to-head)
10216 (if (re-search-forward "^References: " nil t)
10218 (re-search-forward "^[^ \t]" nil t)
10221 (insert " " message-id))
10222 (insert "References: " message-id "\n"))))
10223 (set-buffer gnus-summary-buffer)
10224 (gnus-summary-unmark-all-processable)
10225 (gnus-summary-update-article current-article)
10226 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10227 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10228 (gnus-summary-rethread-current)
10229 (gnus-message 3 "Article %d is now the child of article %d"
10230 current-article parent-article)))))
10232 (defun gnus-summary-toggle-threads (&optional arg)
10233 "Toggle showing conversation threads.
10234 If ARG is positive number, turn showing conversation threads on."
10236 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10237 (setq gnus-show-threads
10238 (if (null arg) (not gnus-show-threads)
10239 (> (prefix-numeric-value arg) 0)))
10240 (gnus-summary-prepare)
10241 (gnus-summary-goto-subject current)
10242 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10243 (gnus-summary-position-point)))
10245 (defun gnus-summary-show-all-threads ()
10246 "Show all threads."
10249 (let ((buffer-read-only nil))
10250 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10251 (gnus-summary-position-point))
10253 (defun gnus-summary-show-thread ()
10254 "Show thread subtrees.
10255 Returns nil if no thread was there to be shown."
10257 (let ((buffer-read-only nil)
10259 ;; first goto end then to beg, to have point at beg after let
10260 (end (progn (end-of-line) (point)))
10261 (beg (progn (beginning-of-line) (point))))
10263 ;; Any hidden lines here?
10264 (search-forward "\r" end t)
10265 (subst-char-in-region beg end ?\^M ?\n t)
10267 (gnus-summary-position-point))))
10269 (defun gnus-summary-maybe-hide-threads ()
10270 "If requested, hide the threads that should be hidden."
10271 (when (and gnus-show-threads
10272 gnus-thread-hide-subtree)
10273 (gnus-summary-hide-all-threads
10274 (if (or (consp gnus-thread-hide-subtree)
10275 (gnus-functionp gnus-thread-hide-subtree))
10276 (gnus-make-predicate gnus-thread-hide-subtree)
10279 ;;; Hiding predicates.
10281 (defun gnus-article-unread-p (header)
10282 (memq (mail-header-number header) gnus-newsgroup-unreads))
10284 (defun gnus-article-unseen-p (header)
10285 (memq (mail-header-number header) gnus-newsgroup-unseen))
10287 (defun gnus-map-articles (predicate articles)
10288 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10289 (apply 'gnus-or (mapcar predicate
10290 (mapcar 'gnus-summary-article-header articles))))
10292 (defun gnus-summary-hide-all-threads (&optional predicate)
10293 "Hide all thread subtrees.
10294 If PREDICATE is supplied, threads that satisfy this predicate
10295 will not be hidden."
10298 (goto-char (point-min))
10301 (when (or (not predicate)
10303 predicate (gnus-summary-article-children)))
10304 (gnus-summary-hide-thread))
10305 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10306 (gnus-summary-position-point))
10308 (defun gnus-summary-hide-thread ()
10309 "Hide thread subtrees.
10310 If PREDICATE is supplied, threads that satisfy this predicate
10311 will not be hidden.
10312 Returns nil if no threads were there to be hidden."
10314 (let ((buffer-read-only nil)
10316 (article (gnus-summary-article-number)))
10318 ;; Go forward until either the buffer ends or the subthread
10320 (when (and (not (eobp))
10321 (or (zerop (gnus-summary-next-thread 1 t))
10322 (goto-char (point-max))))
10324 (if (and (> (point) start)
10325 (search-backward "\n" start t))
10327 (subst-char-in-region start (point) ?\n ?\^M)
10328 (gnus-summary-goto-subject article))
10332 (defun gnus-summary-go-to-next-thread (&optional previous)
10333 "Go to the same level (or less) next thread.
10334 If PREVIOUS is non-nil, go to previous thread instead.
10335 Return the article number moved to, or nil if moving was impossible."
10336 (let ((level (gnus-summary-thread-level))
10337 (way (if previous -1 1))
10340 (while (and (not (eobp))
10341 (< level (gnus-summary-thread-level)))
10342 (forward-line way))
10349 (gnus-summary-article-number)
10350 (goto-char beg)))))
10352 (defun gnus-summary-next-thread (n &optional silent)
10353 "Go to the same level next N'th thread.
10354 If N is negative, search backward instead.
10355 Returns the difference between N and the number of skips actually
10358 If SILENT, don't output messages."
10360 (let ((backward (< n 0))
10362 (while (and (> n 0)
10363 (gnus-summary-go-to-next-thread backward))
10366 (gnus-summary-position-point))
10367 (when (and (not silent) (/= 0 n))
10368 (gnus-message 7 "No more threads"))
10371 (defun gnus-summary-prev-thread (n)
10372 "Go to the same level previous N'th thread.
10373 Returns the difference between N and the number of skips actually
10376 (gnus-summary-next-thread (- n)))
10378 (defun gnus-summary-go-down-thread ()
10379 "Go down one level in the current thread."
10380 (let ((children (gnus-summary-article-children)))
10382 (gnus-summary-goto-subject (car children)))))
10384 (defun gnus-summary-go-up-thread ()
10385 "Go up one level in the current thread."
10386 (let ((parent (gnus-summary-article-parent)))
10388 (gnus-summary-goto-subject parent))))
10390 (defun gnus-summary-down-thread (n)
10391 "Go down thread N steps.
10392 If N is negative, go up instead.
10393 Returns the difference between N and how many steps down that were
10398 (while (and (> n 0)
10399 (if up (gnus-summary-go-up-thread)
10400 (gnus-summary-go-down-thread)))
10402 (gnus-summary-position-point)
10404 (gnus-message 7 "Can't go further"))
10407 (defun gnus-summary-up-thread (n)
10408 "Go up thread N steps.
10409 If N is negative, go down instead.
10410 Returns the difference between N and how many steps down that were
10413 (gnus-summary-down-thread (- n)))
10415 (defun gnus-summary-top-thread ()
10416 "Go to the top of the thread."
10418 (while (gnus-summary-go-up-thread))
10419 (gnus-summary-article-number))
10421 (defun gnus-summary-kill-thread (&optional unmark)
10422 "Mark articles under current thread as read.
10423 If the prefix argument is positive, remove any kinds of marks.
10424 If the prefix argument is negative, tick articles instead."
10427 (setq unmark (prefix-numeric-value unmark)))
10428 (let ((articles (gnus-summary-articles-in-thread)))
10430 ;; Expand the thread.
10431 (gnus-summary-show-thread)
10432 ;; Mark all the articles.
10434 (gnus-summary-goto-subject (car articles))
10435 (cond ((null unmark)
10436 (gnus-summary-mark-article-as-read gnus-killed-mark))
10438 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10440 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10441 (setq articles (cdr articles))))
10442 ;; Hide killed subtrees.
10444 gnus-thread-hide-killed
10445 (gnus-summary-hide-thread))
10446 ;; If marked as read, go to next unread subject.
10447 (when (null unmark)
10448 ;; Go to next unread subject.
10449 (gnus-summary-next-subject 1 t)))
10450 (gnus-set-mode-line 'summary))
10452 ;; Summary sorting commands
10454 (defun gnus-summary-sort-by-number (&optional reverse)
10455 "Sort the summary buffer by article number.
10456 Argument REVERSE means reverse order."
10458 (gnus-summary-sort 'number reverse))
10460 (defun gnus-summary-sort-by-random (&optional reverse)
10461 "Randomize the order in the summary buffer.
10462 Argument REVERSE means to randomize in reverse order."
10464 (gnus-summary-sort 'random reverse))
10466 (defun gnus-summary-sort-by-author (&optional reverse)
10467 "Sort the summary buffer by author name alphabetically.
10468 If `case-fold-search' is non-nil, case of letters is ignored.
10469 Argument REVERSE means reverse order."
10471 (gnus-summary-sort 'author reverse))
10473 (defun gnus-summary-sort-by-subject (&optional reverse)
10474 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10475 If `case-fold-search' is non-nil, case of letters is ignored.
10476 Argument REVERSE means reverse order."
10478 (gnus-summary-sort 'subject reverse))
10480 (defun gnus-summary-sort-by-date (&optional reverse)
10481 "Sort the summary buffer by date.
10482 Argument REVERSE means reverse order."
10484 (gnus-summary-sort 'date reverse))
10486 (defun gnus-summary-sort-by-score (&optional reverse)
10487 "Sort the summary buffer by score.
10488 Argument REVERSE means reverse order."
10490 (gnus-summary-sort 'score reverse))
10492 (defun gnus-summary-sort-by-lines (&optional reverse)
10493 "Sort the summary buffer by the number of lines.
10494 Argument REVERSE means reverse order."
10496 (gnus-summary-sort 'lines reverse))
10498 (defun gnus-summary-sort-by-chars (&optional reverse)
10499 "Sort the summary buffer by article length.
10500 Argument REVERSE means reverse order."
10502 (gnus-summary-sort 'chars reverse))
10504 (defun gnus-summary-sort-by-original (&optional reverse)
10505 "Sort the summary buffer using the default sorting method.
10506 Argument REVERSE means reverse order."
10508 (let* ((buffer-read-only)
10509 (gnus-summary-prepare-hook nil))
10510 ;; We do the sorting by regenerating the threads.
10511 (gnus-summary-prepare)
10512 ;; Hide subthreads if needed.
10513 (gnus-summary-maybe-hide-threads)))
10515 (defun gnus-summary-sort (predicate reverse)
10516 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10517 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10518 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10519 (gnus-thread-sort-functions
10524 (gnus-sort-gathered-threads-function
10525 gnus-thread-sort-functions)
10526 (gnus-article-sort-functions
10530 (,article t2 t1))))
10532 (gnus-summary-prepare-hook nil))
10533 ;; We do the sorting by regenerating the threads.
10534 (gnus-summary-prepare)
10535 ;; Hide subthreads if needed.
10536 (gnus-summary-maybe-hide-threads)))
10538 ;; Summary saving commands.
10540 (defun gnus-summary-save-article (&optional n not-saved)
10541 "Save the current article using the default saver function.
10542 If N is a positive number, save the N next articles.
10543 If N is a negative number, save the N previous articles.
10544 If N is nil and any articles have been marked with the process mark,
10545 save those articles instead.
10546 The variable `gnus-default-article-saver' specifies the saver function."
10548 (let* ((articles (gnus-summary-work-articles n))
10549 (save-buffer (save-excursion
10550 (nnheader-set-temp-buffer " *Gnus Save*")))
10551 (num (length articles))
10553 (dolist (article articles)
10554 (setq header (gnus-summary-article-header article))
10555 (if (not (vectorp header))
10556 ;; This is a pseudo-article.
10557 (if (assq 'name header)
10558 (gnus-copy-file (cdr (assq 'name header)))
10559 (gnus-message 1 "Article %d is unsaveable" article))
10560 ;; This is a real article.
10561 (save-window-excursion
10562 (let ((gnus-display-mime-function nil)
10563 (gnus-article-prepare-hook nil))
10564 (gnus-summary-select-article t nil nil article)))
10566 (set-buffer save-buffer)
10568 (insert-buffer-substring gnus-original-article-buffer))
10569 (setq file (gnus-article-save save-buffer file num))
10570 (gnus-summary-remove-process-mark article)
10572 (gnus-summary-set-saved-mark article))))
10573 (gnus-kill-buffer save-buffer)
10574 (gnus-summary-position-point)
10575 (gnus-set-mode-line 'summary)
10578 (defun gnus-summary-pipe-output (&optional arg headers)
10579 "Pipe the current article to a subprocess.
10580 If N is a positive number, pipe the N next articles.
10581 If N is a negative number, pipe the N previous articles.
10582 If N is nil and any articles have been marked with the process mark,
10583 pipe those articles instead.
10584 If HEADERS (the symbolic prefix), include the headers, too."
10585 (interactive (gnus-interactive "P\ny"))
10586 (require 'gnus-art)
10587 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10588 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10589 (gnus-summary-save-article arg t))
10590 (let ((buffer (get-buffer "*Shell Command Output*")))
10592 (not (zerop (buffer-size buffer))))
10593 (gnus-configure-windows 'pipe))))
10595 (defun gnus-summary-save-article-mail (&optional arg)
10596 "Append the current article to an mail file.
10597 If N is a positive number, save the N next articles.
10598 If N is a negative number, save the N previous articles.
10599 If N is nil and any articles have been marked with the process mark,
10600 save those articles instead."
10602 (require 'gnus-art)
10603 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10604 (gnus-summary-save-article arg)))
10606 (defun gnus-summary-save-article-rmail (&optional arg)
10607 "Append the current article to an rmail file.
10608 If N is a positive number, save the N next articles.
10609 If N is a negative number, save the N previous articles.
10610 If N is nil and any articles have been marked with the process mark,
10611 save those articles instead."
10613 (require 'gnus-art)
10614 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10615 (gnus-summary-save-article arg)))
10617 (defun gnus-summary-save-article-file (&optional arg)
10618 "Append the current article to a file.
10619 If N is a positive number, save the N next articles.
10620 If N is a negative number, save the N previous articles.
10621 If N is nil and any articles have been marked with the process mark,
10622 save those articles instead."
10624 (require 'gnus-art)
10625 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10626 (gnus-summary-save-article arg)))
10628 (defun gnus-summary-write-article-file (&optional arg)
10629 "Write the current article to a file, deleting the previous file.
10630 If N is a positive number, save the N next articles.
10631 If N is a negative number, save the N previous articles.
10632 If N is nil and any articles have been marked with the process mark,
10633 save those articles instead."
10635 (require 'gnus-art)
10636 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10637 (gnus-summary-save-article arg)))
10639 (defun gnus-summary-save-article-body-file (&optional arg)
10640 "Append the current article body to a file.
10641 If N is a positive number, save the N next articles.
10642 If N is a negative number, save the N previous articles.
10643 If N is nil and any articles have been marked with the process mark,
10644 save those articles instead."
10646 (require 'gnus-art)
10647 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10648 (gnus-summary-save-article arg)))
10650 (defun gnus-summary-muttprint (&optional arg)
10651 "Print the current article using Muttprint.
10652 If N is a positive number, save the N next articles.
10653 If N is a negative number, save the N previous articles.
10654 If N is nil and any articles have been marked with the process mark,
10655 save those articles instead."
10657 (require 'gnus-art)
10658 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10659 (gnus-summary-save-article arg t)))
10661 (defun gnus-summary-pipe-message (program)
10662 "Pipe the current article through PROGRAM."
10663 (interactive "sProgram: ")
10664 (gnus-summary-select-article)
10665 (let ((mail-header-separator ""))
10666 (gnus-eval-in-buffer-window gnus-article-buffer
10669 (let ((start (window-start))
10671 (message-pipe-buffer-body program)
10672 (set-window-start (get-buffer-window (current-buffer)) start))))))
10674 (defun gnus-get-split-value (methods)
10675 "Return a value based on the split METHODS."
10676 (let (split-name method result match)
10679 (set-buffer gnus-original-article-buffer)
10681 (nnheader-narrow-to-headers)
10682 (while (and methods (not split-name))
10683 (goto-char (point-min))
10684 (setq method (pop methods))
10685 (setq match (car method))
10688 ;; Regular expression.
10690 (re-search-forward match nil t)))
10691 ((gnus-functionp match)
10695 (setq result (funcall match gnus-newsgroup-name))))
10700 (setq result (eval match)))))
10701 (setq split-name (cdr method))
10702 (cond ((stringp result)
10703 (push (expand-file-name
10704 result gnus-article-save-directory)
10707 (setq split-name (append result split-name)))))))))
10708 (nreverse split-name)))
10710 (defun gnus-valid-move-group-p (group)
10711 (and (boundp group)
10712 (symbol-name group)
10713 (symbol-value group)
10714 (gnus-get-function (gnus-find-method-for-group
10715 (symbol-name group)) 'request-accept-article t)))
10717 (defun gnus-read-move-group-name (prompt default articles prefix)
10718 "Read a group name."
10719 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10720 (minibuffer-confirm-incomplete nil) ; XEmacs
10722 (format "%s %s to:"
10724 (if (> (length articles) 1)
10725 (format "these %d articles" (length articles))
10730 (gnus-completing-read-with-default
10733 'gnus-valid-move-group-p
10735 'gnus-group-history))
10736 ((= 1 (length split-name))
10737 (gnus-completing-read-with-default
10738 (car split-name) prom
10740 'gnus-valid-move-group-p
10742 'gnus-group-history))
10744 (gnus-completing-read-with-default
10746 (mapcar (lambda (el) (list el))
10747 (nreverse split-name))
10749 'gnus-group-history))))
10750 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10752 (if (or (string= to-newsgroup "")
10753 (string= to-newsgroup prefix))
10754 (setq to-newsgroup default))
10755 (unless to-newsgroup
10756 (error "No group name entered"))
10757 (or (gnus-active to-newsgroup)
10758 (gnus-activate-group to-newsgroup nil nil to-method)
10759 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10761 (or (and (gnus-request-create-group to-newsgroup to-method)
10762 (gnus-activate-group
10763 to-newsgroup nil nil to-method)
10764 (gnus-subscribe-group to-newsgroup))
10765 (error "Couldn't create group %s" to-newsgroup)))
10766 (error "No such group: %s" to-newsgroup)))
10769 (defun gnus-summary-save-parts (type dir n &optional reverse)
10770 "Save parts matching TYPE to DIR.
10771 If REVERSE, save parts that do not match TYPE."
10773 (list (read-string "Save parts of type: "
10774 (or (car gnus-summary-save-parts-type-history)
10775 gnus-summary-save-parts-default-mime)
10776 'gnus-summary-save-parts-type-history)
10777 (setq gnus-summary-save-parts-last-directory
10778 (read-file-name "Save to directory: "
10779 gnus-summary-save-parts-last-directory
10781 current-prefix-arg))
10782 (gnus-summary-iterate n
10783 (let ((gnus-display-mime-function nil)
10784 (gnus-inhibit-treatment t))
10785 (gnus-summary-select-article))
10787 (set-buffer gnus-article-buffer)
10788 (let ((handles (or gnus-article-mime-handles
10789 (mm-dissect-buffer nil gnus-article-loose-mime)
10792 (gnus-summary-save-parts-1 type dir handles reverse)
10793 (unless gnus-article-mime-handles ;; Don't destroy this case.
10794 (mm-destroy-parts handles)))))))
10796 (defun gnus-summary-save-parts-1 (type dir handle reverse)
10797 (if (stringp (car handle))
10798 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
10801 (not (string-match type (mm-handle-media-type handle)))
10802 (string-match type (mm-handle-media-type handle)))
10803 (let ((file (expand-file-name
10804 (file-name-nondirectory
10806 (mail-content-type-get
10807 (mm-handle-disposition handle) 'filename)
10808 (concat gnus-newsgroup-name
10809 "." (number-to-string
10810 (cdr gnus-article-current)))))
10812 (unless (file-exists-p file)
10813 (mm-save-part-to-file handle file))))))
10815 ;; Summary extract commands
10817 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
10818 (let ((buffer-read-only nil)
10819 (article (gnus-summary-article-number))
10821 (unless (gnus-summary-goto-subject article)
10822 (error "No such article: %d" article))
10823 (gnus-summary-position-point)
10824 ;; If all commands are to be bunched up on one line, we collect
10826 (unless gnus-view-pseudos-separately
10827 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
10830 (setq action (cdr (assq 'action (car ps))))
10831 (setq files (list (cdr (assq 'name (car ps)))))
10832 (while (and ps (cdr ps)
10833 (string= (or action "1")
10834 (or (cdr (assq 'action (cadr ps))) "2")))
10835 (push (cdr (assq 'name (cadr ps))) files)
10836 (setcdr ps (cddr ps)))
10838 (when (not (string-match "%s" action))
10841 (when (assq 'execute (car ps))
10842 (setcdr (assq 'execute (car ps))
10843 (funcall (if (string-match "%s" action)
10850 (gnus-quote-arg-for-sh-or-csh f)))
10852 (setq ps (cdr ps)))))
10853 (if (and gnus-view-pseudos (not not-view))
10855 (when (assq 'execute (car pslist))
10856 (gnus-execute-command (cdr (assq 'execute (car pslist)))
10857 (eq gnus-view-pseudos 'not-confirm)))
10858 (setq pslist (cdr pslist)))
10861 (setq after-article (or (cdr (assq 'article (car pslist)))
10862 (gnus-summary-article-number)))
10863 (gnus-summary-goto-subject after-article)
10866 (insert " " (file-name-nondirectory
10867 (cdr (assq 'name (car pslist))))
10868 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
10870 (forward-line -1) ; back to `b'
10871 (gnus-add-text-properties
10872 b (1- e) (list 'gnus-number gnus-reffed-article-number
10873 gnus-mouse-face-prop gnus-mouse-face))
10875 after-article gnus-reffed-article-number
10876 gnus-unread-mark b (car pslist) 0 (- e b))
10877 (setq gnus-newsgroup-unreads
10878 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10879 gnus-reffed-article-number))
10880 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
10881 (setq pslist (cdr pslist)))))))
10883 (defun gnus-pseudos< (p1 p2)
10884 (let ((c1 (cdr (assq 'action p1)))
10885 (c2 (cdr (assq 'action p2))))
10886 (and c1 c2 (string< c1 c2))))
10888 (defun gnus-request-pseudo-article (props)
10889 (cond ((assq 'execute props)
10890 (gnus-execute-command (cdr (assq 'execute props)))))
10891 (let ((gnus-current-article (gnus-summary-article-number)))
10892 (gnus-run-hooks 'gnus-mark-article-hook)))
10894 (defun gnus-execute-command (command &optional automatic)
10896 (gnus-article-setup-buffer)
10897 (set-buffer gnus-article-buffer)
10898 (setq buffer-read-only nil)
10899 (let ((command (if automatic command
10900 (read-string "Command: " (cons command 0)))))
10902 (insert "$ " command "\n\n")
10903 (if gnus-view-pseudo-asynchronously
10904 (start-process "gnus-execute" (current-buffer) shell-file-name
10905 shell-command-switch command)
10906 (call-process shell-file-name nil t nil
10907 shell-command-switch command)))))
10909 ;; Summary kill commands.
10911 (defun gnus-summary-edit-global-kill (article)
10912 "Edit the \"global\" kill file."
10913 (interactive (list (gnus-summary-article-number)))
10914 (gnus-group-edit-global-kill article))
10916 (defun gnus-summary-edit-local-kill ()
10917 "Edit a local kill file applied to the current newsgroup."
10919 (setq gnus-current-headers (gnus-summary-article-header))
10920 (gnus-group-edit-local-kill
10921 (gnus-summary-article-number) gnus-newsgroup-name))
10923 ;;; Header reading.
10925 (defun gnus-read-header (id &optional header)
10926 "Read the headers of article ID and enter them into the Gnus system."
10927 (let ((group gnus-newsgroup-name)
10928 (gnus-override-method
10930 gnus-override-method
10931 (and (gnus-news-group-p gnus-newsgroup-name)
10932 (car (gnus-refer-article-methods)))))
10934 ;; First we check to see whether the header in question is already
10937 ;; This is a Message-ID.
10938 (setq header (or header (gnus-id-to-header id)))
10939 ;; This is an article number.
10940 (setq header (or header (gnus-summary-article-header id))))
10942 (not (gnus-summary-article-sparse-p (mail-header-number header))))
10943 ;; We have found the header.
10945 ;; If this is a sparse article, we have to nix out its
10946 ;; previous entry in the thread hashtb.
10948 (gnus-summary-article-sparse-p (mail-header-number header)))
10949 (let* ((parent (gnus-parent-id (mail-header-references header)))
10950 (thread (and parent (gnus-id-to-thread parent))))
10952 (delq (assq header thread) thread))))
10953 ;; We have to really fetch the header to this article.
10955 (set-buffer nntp-server-buffer)
10956 (when (setq where (gnus-request-head id group))
10957 (nnheader-fold-continuation-lines)
10958 (goto-char (point-max))
10960 (goto-char (point-min))
10964 ((cdr where) (cdr where))
10965 (header (mail-header-number header))
10966 (t gnus-reffed-article-number))
10968 (insert " Article retrieved.\n"))
10969 (if (or (not where)
10970 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
10971 () ; Malformed head.
10972 (unless (gnus-summary-article-sparse-p (mail-header-number header))
10973 (when (and (stringp id)
10974 (not (string= (gnus-group-real-name group)
10976 ;; If we fetched by Message-ID and the article came
10977 ;; from a different group, we fudge some bogus article
10978 ;; numbers for this article.
10979 (mail-header-set-number header gnus-reffed-article-number))
10981 (set-buffer gnus-summary-buffer)
10982 (decf gnus-reffed-article-number)
10983 (gnus-remove-header (mail-header-number header))
10984 (push header gnus-newsgroup-headers)
10985 (setq gnus-current-headers header)
10986 (push (mail-header-number header) gnus-newsgroup-limit)))
10989 (defun gnus-remove-header (number)
10990 "Remove header NUMBER from `gnus-newsgroup-headers'."
10991 (if (and gnus-newsgroup-headers
10992 (= number (mail-header-number (car gnus-newsgroup-headers))))
10993 (pop gnus-newsgroup-headers)
10994 (let ((headers gnus-newsgroup-headers))
10995 (while (and (cdr headers)
10996 (not (= number (mail-header-number (cadr headers)))))
10998 (when (cdr headers)
10999 (setcdr headers (cddr headers))))))
11002 ;;; summary highlights
11005 (defun gnus-highlight-selected-summary ()
11006 "Highlight selected article in summary buffer."
11007 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11008 (when gnus-summary-selected-face
11010 (let* ((beg (progn (beginning-of-line) (point)))
11011 (end (progn (end-of-line) (point)))
11012 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11013 (from (if (get-text-property beg gnus-mouse-face-prop)
11015 (or (next-single-property-change
11016 beg gnus-mouse-face-prop nil end)
11021 (or (next-single-property-change
11022 from gnus-mouse-face-prop nil end)
11024 ;; If no mouse-face prop on line we will have to = from = end,
11025 ;; so we highlight the entire line instead.
11026 (when (= (+ to 2) from)
11029 (if gnus-newsgroup-selected-overlay
11030 ;; Move old overlay.
11032 gnus-newsgroup-selected-overlay from to (current-buffer))
11033 ;; Create new overlay.
11035 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11036 'face gnus-summary-selected-face))))))
11038 (defvar gnus-summary-highlight-line-cached nil)
11039 (defvar gnus-summary-highlight-line-trigger nil)
11041 (defun gnus-summary-highlight-line-0 ()
11042 (if (and (eq gnus-summary-highlight-line-trigger
11043 gnus-summary-highlight)
11044 gnus-summary-highlight-line-cached)
11045 gnus-summary-highlight-line-cached
11046 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11047 gnus-summary-highlight-line-cached
11048 (let* ((cond (list 'cond))
11050 (list gnus-summary-highlight))
11052 (setcdr c (cons (list (caar list) (list 'quote (cdar list))) nil))
11055 (gnus-byte-compile (list 'lambda nil cond))))))
11057 (defun gnus-summary-highlight-line ()
11058 "Highlight current line according to `gnus-summary-highlight'."
11059 (let* ((beg (gnus-point-at-bol))
11060 (article (or (gnus-summary-article-number) gnus-current-article))
11061 (score (or (cdr (assq article
11062 gnus-newsgroup-scored))
11063 gnus-summary-default-score 0))
11064 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11065 (inhibit-read-only t)
11066 (default gnus-summary-default-score)
11067 (default-high gnus-summary-default-high-score)
11068 (default-low gnus-summary-default-low-score)
11069 (uncached (memq article gnus-newsgroup-undownloaded))
11070 (downloaded (not uncached)))
11071 (let ((face (funcall (gnus-summary-highlight-line-0))))
11072 (unless (eq face (get-text-property beg 'face))
11073 (gnus-put-text-property-excluding-characters-with-faces
11074 beg (gnus-point-at-eol) 'face
11075 (setq face (if (boundp face) (symbol-value face) face)))
11076 (when gnus-summary-highlight-line-function
11077 (funcall gnus-summary-highlight-line-function article face))))))
11079 (defun gnus-update-read-articles (group unread &optional compute)
11080 "Update the list of read articles in GROUP.
11081 UNREAD is a sorted list."
11082 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
11083 (entry (gnus-gethash group gnus-newsrc-hashtb))
11084 (info (nth 2 entry))
11087 (if (or (not info) (not active))
11088 ;; There is no info on this group if it was, in fact,
11089 ;; killed. Gnus stores no information on killed groups, so
11090 ;; there's nothing to be done.
11091 ;; One could store the information somewhere temporarily,
11092 ;; perhaps... Hmmm...
11094 ;; Remove any negative articles numbers.
11095 (while (and unread (< (car unread) 0))
11096 (setq unread (cdr unread)))
11097 ;; Remove any expired article numbers
11098 (while (and unread (< (car unread) (car active)))
11099 (setq unread (cdr unread)))
11100 ;; Compute the ranges of read articles by looking at the list of
11101 ;; unread articles.
11103 (when (/= (car unread) prev)
11104 (push (if (= prev (1- (car unread))) prev
11105 (cons prev (1- (car unread))))
11107 (setq prev (1+ (car unread)))
11108 (setq unread (cdr unread)))
11109 (when (<= prev (cdr active))
11110 (push (cons prev (cdr active)) read))
11111 (setq read (if (> (length read) 1) (nreverse read) read))
11116 ;; Propagate the read marks to the backend.
11117 (when (gnus-check-backend-function 'request-set-mark group)
11118 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11119 (add (gnus-remove-from-range read (gnus-info-read info))))
11121 (unless (gnus-check-group group)
11122 (error "Can't open server for %s" group))
11123 (gnus-request-set-mark
11124 group (delq nil (list (if add (list add 'add '(read)))
11125 (if del (list del 'del '(read))))))
11127 `(gnus-request-set-mark
11130 (if del (list del 'add '(read)))
11131 (if add (list add 'del '(read))))))))))
11132 (set-buffer gnus-group-buffer)
11133 (gnus-undo-register
11135 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11136 (gnus-info-set-read ',info ',(gnus-info-read info))
11137 (gnus-get-unread-articles-in-group ',info
11138 (gnus-active ,group))
11139 (gnus-group-update-group ,group t)
11141 ;; Enter this list into the group info.
11142 (gnus-info-set-read info read)
11143 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11144 (gnus-get-unread-articles-in-group info (gnus-active group))
11147 (defun gnus-offer-save-summaries ()
11148 "Offer to save all active summary buffers."
11150 ;; Go through all buffers and find all summaries.
11151 (dolist (buffer (buffer-list))
11152 (when (and (setq buffer (buffer-name buffer))
11153 (string-match "Summary" buffer)
11155 (set-buffer buffer)
11156 ;; We check that this is, indeed, a summary buffer.
11157 (and (eq major-mode 'gnus-summary-mode)
11158 ;; Also make sure this isn't bogus.
11159 gnus-newsgroup-prepared
11160 ;; Also make sure that this isn't a
11161 ;; dead summary buffer.
11162 (not gnus-dead-summary-mode))))
11163 (push buffer buffers)))
11164 ;; Go through all these summary buffers and offer to save them.
11168 "Update summary buffer %s? "
11170 (switch-to-buffer buf)
11171 (gnus-summary-exit))
11175 ;;; @ for mime-partial
11178 (defun gnus-request-partial-message ()
11180 (let ((number (gnus-summary-article-number))
11181 (group gnus-newsgroup-name)
11182 (mother gnus-article-buffer))
11183 (set-buffer (get-buffer-create " *Partial Article*"))
11185 (setq mime-preview-buffer mother)
11186 (gnus-request-article-this-buffer number group)
11187 (mime-parse-buffer)
11190 (autoload 'mime-combine-message/partial-pieces-automatically
11192 "Internal method to combine message/partial messages automatically.")
11194 (mime-add-condition
11195 'action '((type . message)(subtype . partial)
11196 (major-mode . gnus-original-article-mode)
11197 (method . mime-combine-message/partial-pieces-automatically)
11198 (summary-buffer-exp . gnus-summary-buffer)
11199 (request-partial-message-method . gnus-request-partial-message)
11203 ;;; @ for message/rfc822
11206 (defun gnus-mime-extract-message/rfc822 (entity situation)
11207 "Burst a forwarded article."
11209 (set-buffer gnus-summary-buffer)
11210 (let* ((group (completing-read "Group: " gnus-active-hashtb nil t
11211 gnus-newsgroup-name 'gnus-group-history))
11212 (gnus-group-marked (list group))
11215 (mime-insert-entity-content entity)
11216 (setq article (gnus-request-accept-article group)))
11217 (when (and (consp article)
11218 (numberp (setq article (cdr article))))
11219 (setq info (gnus-get-info group))
11220 (gnus-info-set-read info
11221 (gnus-remove-from-range (gnus-info-read info)
11223 (when (string-equal group gnus-newsgroup-name)
11225 (let (gnus-show-threads)
11226 (gnus-summary-goto-subject article t))
11227 (gnus-summary-clear-mark-forward 1))
11228 (set-buffer gnus-group-buffer)
11229 (gnus-group-get-new-news-this-group nil t)))))
11231 (mime-add-condition
11232 'action '((type . message)(subtype . rfc822)
11233 (major-mode . gnus-original-article-mode)
11234 (method . gnus-mime-extract-message/rfc822)
11238 (mime-add-condition
11239 'action '((type . message)(subtype . news)
11240 (major-mode . gnus-original-article-mode)
11241 (method . gnus-mime-extract-message/rfc822)
11245 (defun gnus-mime-extract-multipart (entity situation)
11246 (let ((children (mime-entity-children entity))
11247 mime-acting-situation-to-override
11250 (mime-play-entity (car children)
11251 (cons (assq 'mode situation)
11252 mime-acting-situation-to-override))
11253 (setq children (cdr children)))
11254 (if (setq f (cdr (assq 'after-method
11255 mime-acting-situation-to-override)))
11259 (mime-add-condition
11260 'action '((type . multipart)
11261 (method . gnus-mime-extract-multipart)
11270 (defun gnus-summary-inherit-default-charset ()
11271 "Import `default-mime-charset' from summary buffer.
11272 Also take care of `default-mime-charset-unlimited' if the LIMIT version
11274 (if (buffer-live-p gnus-summary-buffer)
11275 (let (d-m-c d-m-c-u)
11276 (with-current-buffer gnus-summary-buffer
11277 (setq d-m-c (if (local-variable-p 'default-mime-charset
11278 gnus-summary-buffer)
11279 default-mime-charset
11282 d-m-c-u (if (local-variable-p 'default-mime-charset-unlimited
11283 gnus-summary-buffer)
11284 (symbol-value 'default-mime-charset-unlimited)
11287 (kill-local-variable 'default-mime-charset)
11288 (set (make-local-variable 'default-mime-charset) d-m-c))
11290 (kill-local-variable 'default-mime-charset-unlimited)
11291 (set (make-local-variable 'default-mime-charset-unlimited)
11294 (defun gnus-summary-setup-default-charset ()
11295 "Setup newsgroup default charset."
11296 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11298 (setq gnus-newsgroup-charset nil)
11299 (set (make-local-variable 'default-mime-charset) nil)
11300 (when (boundp 'default-mime-charset-unlimited);; LIMIT
11301 (set (make-local-variable 'default-mime-charset-unlimited) nil)))
11302 (let ((ignored-charsets
11303 (or gnus-newsgroup-ephemeral-ignored-charsets
11305 (and gnus-newsgroup-name
11306 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11307 gnus-newsgroup-ignored-charsets)))
11309 (setq gnus-newsgroup-charset
11310 (or gnus-newsgroup-ephemeral-charset
11311 (when (and gnus-newsgroup-name
11312 (setq charset (gnus-parameter-charset
11313 gnus-newsgroup-name)))
11314 (make-local-variable 'default-mime-charset)
11315 (setq default-mime-charset charset))
11316 gnus-default-charset))
11317 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11318 ignored-charsets))))
11324 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11325 "Display the current article buffer fully MIME-buttonized.
11326 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11327 treated as multipart/mixed."
11329 (require 'gnus-art)
11330 (let ((gnus-unbuttonized-mime-types nil)
11331 (gnus-mime-display-multipart-as-mixed show-all-parts))
11332 (gnus-summary-show-article)))
11334 (defun gnus-summary-repair-multipart (article)
11335 "Add a Content-Type header to a multipart article without one."
11336 (interactive (list (gnus-summary-article-number)))
11337 (gnus-with-article article
11338 (message-narrow-to-head)
11339 (message-remove-header "Mime-Version")
11340 (goto-char (point-max))
11341 (insert "Mime-Version: 1.0\n")
11343 (when (search-forward "\n--" nil t)
11344 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11345 (message-narrow-to-head)
11346 (message-remove-header "Content-Type")
11347 (goto-char (point-max))
11348 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11351 (let (gnus-mark-article-hook)
11352 (gnus-summary-select-article t t nil article)))
11354 (defun gnus-summary-toggle-display-buttonized ()
11355 "Toggle the buttonizing of the article buffer."
11357 (require 'gnus-art)
11358 (if (setq gnus-inhibit-mime-unbuttonizing
11359 (not gnus-inhibit-mime-unbuttonizing))
11360 (let ((gnus-unbuttonized-mime-types nil))
11361 (gnus-summary-show-article))
11362 (gnus-summary-show-article)))
11365 ;;; Intelli-mouse commmands
11368 (defun gnus-wheel-summary-scroll (event)
11370 (let ((amount (if (memq 'shift (event-modifiers event))
11371 (car gnus-wheel-scroll-amount)
11372 (cdr gnus-wheel-scroll-amount)))
11373 (direction (- (* (static-if (featurep 'xemacs)
11374 (event-button event)
11375 (cond ((eq 'mouse-4 (event-basic-type event))
11377 ((eq 'mouse-5 (event-basic-type event))
11381 (gnus-summary-scroll-up (* amount direction))
11382 (when (gnus-eval-in-buffer-window gnus-article-buffer
11385 (and (if (< 0 direction)
11386 (gnus-article-next-page 0)
11387 (gnus-article-prev-page 0)
11389 (if (setq edge (get-text-property
11390 (point-min) 'gnus-wheel-edge))
11391 (setq edge (* edge direction))
11394 (let ((buffer-read-only nil)
11395 (inhibit-read-only t))
11396 (put-text-property (point-min) (point-max)
11397 'gnus-wheel-edge direction)
11399 (or (> edge gnus-wheel-edge-resistance)
11400 (let ((buffer-read-only nil)
11401 (inhibit-read-only t))
11402 (put-text-property (point-min) (point-max)
11404 (* (1+ edge) direction))
11406 (eq last-command 'gnus-wheel-summary-scroll))))
11407 (gnus-summary-next-article nil nil (minusp direction)))))
11409 (defun gnus-wheel-install ()
11410 "Enable mouse wheel support on summary window."
11411 (when gnus-use-wheel
11413 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
11415 (define-key gnus-summary-mode-map key
11416 'gnus-wheel-summary-scroll)))))
11418 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
11421 ;;; Traditional PGP commmands
11424 (defun gnus-summary-decrypt-article (&optional force)
11425 "Decrypt the current article in traditional PGP way.
11426 This will have permanent effect only in mail groups.
11427 If FORCE is non-nil, allow editing of articles even in read-only
11430 (gnus-summary-select-article t)
11431 (gnus-eval-in-buffer-window gnus-article-buffer
11435 (goto-char (point-min))
11436 (unless (re-search-forward (car pgg-armor-header-lines) nil t)
11437 (error "Not a traditional PGP message!"))
11438 (let ((armor-start (match-beginning 0)))
11439 (if (and (pgg-decrypt-region armor-start (point-max))
11440 (or force (not (gnus-group-read-only-p))))
11441 (let ((inhibit-read-only t)
11443 (delete-region armor-start
11445 (re-search-forward "^-+END PGP" nil t)
11446 (beginning-of-line 2)
11448 (insert-buffer-substring pgg-output-buffer))))))))
11450 (defun gnus-summary-verify-article ()
11451 "Verify the current article in traditional PGP way."
11454 (set-buffer gnus-original-article-buffer)
11455 (goto-char (point-min))
11456 (unless (re-search-forward "^-+BEGIN PGP SIGNED MESSAGE" nil t)
11457 (error "Not a traditional PGP message!"))
11458 (re-search-forward "^-+END PGP" nil t)
11459 (beginning-of-line 2)
11460 (call-interactively (function pgg-verify-region))))
11463 ;;; Generic summary marking commands
11466 (defvar gnus-summary-marking-alist
11467 '((read gnus-del-mark "d")
11468 (unread gnus-unread-mark "u")
11469 (ticked gnus-ticked-mark "!")
11470 (dormant gnus-dormant-mark "?")
11471 (expirable gnus-expirable-mark "e"))
11472 "An alist of names/marks/keystrokes.")
11474 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11475 (defvar gnus-summary-mark-map)
11477 (defun gnus-summary-make-all-marking-commands ()
11478 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11479 (dolist (elem gnus-summary-marking-alist)
11480 (apply 'gnus-summary-make-marking-command elem)))
11482 (defun gnus-summary-make-marking-command (name mark keystroke)
11483 (let ((map (make-sparse-keymap)))
11484 (define-key gnus-summary-generic-mark-map keystroke map)
11485 (dolist (lway `((next "next" next nil "n")
11486 (next-unread "next unread" next t "N")
11487 (prev "previous" prev nil "p")
11488 (prev-unread "previous unread" prev t "P")
11489 (nomove "" nil nil ,keystroke)))
11490 (let ((func (gnus-summary-make-marking-command-1
11491 mark (car lway) lway name)))
11492 (setq func (eval func))
11493 (define-key map (nth 4 lway) func)))))
11495 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11497 (format "gnus-summary-put-mark-as-%s%s"
11498 name (if (eq way 'nomove)
11500 (concat "-" (symbol-name way)))))
11503 "Mark the current article as %s%s.
11504 If N, the prefix, then repeat N times.
11505 If N is negative, move in reverse order.
11506 The difference between N and the actual number of articles marked is
11508 name (car (cdr lway)))
11510 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11512 (defun gnus-summary-generic-mark (n mark move unread)
11513 "Mark N articles with MARK."
11514 (unless (eq major-mode 'gnus-summary-mode)
11515 (error "This command can only be used in the summary buffer"))
11516 (gnus-summary-show-thread)
11519 ((eq move 'next) 1)
11520 ((eq move 'prev) -1)
11522 (if (zerop nummove)
11526 nummove (* -1 nummove))))
11527 (while (and (> n 0)
11528 (gnus-summary-mark-article nil mark)
11529 (zerop (gnus-summary-next-subject nummove unread t)))
11532 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11533 (gnus-summary-recenter)
11534 (gnus-summary-position-point)
11535 (gnus-set-mode-line 'summary)
11538 (defun gnus-summary-insert-articles (articles)
11539 (when (setq articles
11540 (gnus-sorted-difference articles
11541 (mapcar (lambda (h)
11542 (mail-header-number h))
11543 gnus-newsgroup-headers)))
11544 (setq gnus-newsgroup-headers
11546 gnus-newsgroup-headers
11547 (gnus-fetch-headers articles)
11548 'gnus-article-sort-by-number))
11549 ;; Suppress duplicates?
11550 (when gnus-suppress-duplicates
11551 (gnus-dup-suppress-articles))
11553 ;; We might want to build some more threads first.
11554 (when (and gnus-fetch-old-headers
11555 (eq gnus-headers-retrieved-by 'nov))
11556 (if (eq gnus-fetch-old-headers 'invisible)
11557 (gnus-build-all-threads)
11558 (gnus-build-old-threads)))
11559 ;; Let the Gnus agent mark articles as read.
11561 (gnus-agent-get-undownloaded-list))
11562 ;; Remove list identifiers from subject
11563 (when gnus-list-identifiers
11564 (gnus-summary-remove-list-identifiers))
11565 ;; First and last article in this newsgroup.
11566 (when gnus-newsgroup-headers
11567 (setq gnus-newsgroup-begin
11568 (mail-header-number (car gnus-newsgroup-headers))
11570 (mail-header-number
11571 (gnus-last-element gnus-newsgroup-headers))))
11572 (when gnus-use-scoring
11573 (gnus-possibly-score-headers))))
11575 (defun gnus-summary-insert-old-articles (&optional all)
11576 "Insert all old articles in this group.
11577 If ALL is non-nil, already read articles become readable.
11578 If ALL is a number, fetch this number of articles."
11581 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11584 ;; Some nntp servers lie about their active range. When
11585 ;; this happens, the active range can be in the millions.
11586 ;; Use a compressed range to avoid creating a huge list.
11587 (gnus-range-difference (list gnus-newsgroup-active) old))
11588 (setq len (gnus-range-length older))
11593 (let ((older-range (nreverse older)))
11597 (let* ((r (pop older-range))
11598 (min (if (numberp r) r (car r)))
11599 (max (if (numberp r) r (cdr r))))
11600 (while (and (<= min max)
11605 (setq older (gnus-uncompress-range older))))
11607 (setq older (gnus-uncompress-range older)))
11609 (when (and (numberp gnus-large-newsgroup)
11610 (> len gnus-large-newsgroup))
11611 (let* ((cursor-in-echo-area nil)
11612 (initial (gnus-parameter-large-newsgroup-initial
11613 gnus-newsgroup-name))
11617 "How many articles from %s (%s %d): "
11619 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11620 (if initial "max" "default")
11623 (cons (number-to-string initial)
11625 (unless (string-match "^[ \t]*$" input)
11626 (setq all (string-to-number input))
11628 (let ((older-range (nreverse older)))
11632 (let* ((r (pop older-range))
11633 (min (if (numberp r) r (car r)))
11634 (max (if (numberp r) r (cdr r))))
11635 (while (and (<= min max)
11639 max (1- max))))))))))
11640 (setq older (gnus-uncompress-range older))))
11642 (message "No old news.")
11643 (gnus-summary-insert-articles older)
11644 (gnus-summary-limit (gnus-sorted-nunion old older))))
11645 (gnus-summary-position-point)))
11647 (defun gnus-summary-insert-new-articles ()
11648 "Insert all new articles in this group."
11651 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11652 (old-active gnus-newsgroup-active)
11653 (nnmail-fetched-sources (list t))
11655 (setq gnus-newsgroup-active
11656 (gnus-activate-group gnus-newsgroup-name 'scan))
11657 (setq i (cdr gnus-newsgroup-active))
11658 (while (> i (cdr old-active))
11662 (message "No gnus is bad news.")
11663 (gnus-summary-insert-articles new)
11664 (setq gnus-newsgroup-unreads
11665 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11666 (gnus-summary-limit (gnus-sorted-nunion old new))))
11667 (gnus-summary-position-point)))
11669 (gnus-summary-make-all-marking-commands)
11671 (gnus-ems-redefine)
11673 (provide 'gnus-sum)
11675 (run-hooks 'gnus-sum-load-hook)
11677 ;;; gnus-sum.el ends here