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."
60 (autoload 'gnus-outlook-unwrap-lines "deuglify" nil t)
61 (autoload 'gnus-outlook-repair-attribution "deuglify" nil t)
62 (autoload 'gnus-outlook-rearrange-citation "deuglify" nil t)
64 (defcustom gnus-kill-summary-on-exit t
65 "*If non-nil, kill the summary buffer when you exit from it.
66 If nil, the summary will become a \"*Dead Summary*\" buffer, and
67 it will be killed sometime later."
68 :group 'gnus-summary-exit
71 (defcustom gnus-fetch-old-headers nil
72 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
73 If an unread article in the group refers to an older, already read (or
74 just marked as read) article, the old article will not normally be
75 displayed in the Summary buffer. If this variable is non-nil, Gnus
76 will attempt to grab the headers to the old articles, and thereby
77 build complete threads. If it has the value `some', only enough
78 headers to connect otherwise loose threads will be displayed. This
79 variable can also be a number. In that case, no more than that number
80 of old headers will be fetched. If it has the value `invisible', all
81 old headers will be fetched, but none will be displayed.
83 The server has to support NOV for any of this to work."
85 :type '(choice (const :tag "off" nil)
88 (sexp :menu-tag "other" t)))
90 (defcustom gnus-refer-thread-limit 200
91 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
92 If t, fetch all the available old headers."
95 (sexp :menu-tag "other" t)))
97 (defcustom gnus-summary-make-false-root 'adopt
98 "*nil means that Gnus won't gather loose threads.
99 If the root of a thread has expired or been read in a previous
100 session, the information necessary to build a complete thread has been
101 lost. Instead of having many small sub-threads from this original thread
102 scattered all over the summary buffer, Gnus can gather them.
104 If non-nil, Gnus will try to gather all loose sub-threads from an
105 original thread into one large thread.
107 If this variable is non-nil, it should be one of `none', `adopt',
110 If this variable is `none', Gnus will not make a false root, but just
111 present the sub-threads after another.
112 If this variable is `dummy', Gnus will create a dummy root that will
113 have all the sub-threads as children.
114 If this variable is `adopt', Gnus will make one of the \"children\"
115 the parent and mark all the step-children as such.
116 If this variable is `empty', the \"children\" are printed with empty
117 subject fields. (Or rather, they will be printed with a string
118 given by the `gnus-summary-same-subject' variable.)"
120 :type '(choice (const :tag "off" nil)
126 (defcustom gnus-summary-make-false-root-always nil
127 "Always make a false dummy root."
131 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
132 "*A regexp to match subjects to be excluded from loose thread gathering.
133 As loose thread gathering is done on subjects only, that means that
134 there can be many false gatherings performed. By rooting out certain
135 common subjects, gathering might become saner."
139 (defcustom gnus-summary-gather-subject-limit nil
140 "*Maximum length of subject comparisons when gathering loose threads.
141 Use nil to compare full subjects. Setting this variable to a low
142 number will help gather threads that have been corrupted by
143 newsreaders chopping off subject lines, but it might also mean that
144 unrelated articles that have subject that happen to begin with the
145 same few characters will be incorrectly gathered.
147 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
150 :type '(choice (const :tag "off" nil)
152 (sexp :menu-tag "on" t)))
154 (defcustom gnus-simplify-subject-functions nil
155 "List of functions taking a string argument that simplify subjects.
156 The functions are applied recursively.
158 Useful functions to put in this list include:
159 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
160 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
162 :type '(repeat function))
164 (defcustom gnus-simplify-ignored-prefixes nil
165 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
167 :type '(choice (const :tag "off" nil)
170 (defcustom gnus-build-sparse-threads nil
171 "*If non-nil, fill in the gaps in threads.
172 If `some', only fill in the gaps that are needed to tie loose threads
173 together. If `more', fill in all leaf nodes that Gnus can find. If
174 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
176 :type '(choice (const :tag "off" nil)
179 (sexp :menu-tag "all" t)))
181 (defcustom gnus-summary-thread-gathering-function
182 'gnus-gather-threads-by-subject
183 "*Function used for gathering loose threads.
184 There are two pre-defined functions: `gnus-gather-threads-by-subject',
185 which only takes Subjects into consideration; and
186 `gnus-gather-threads-by-references', which compared the References
187 headers of the articles to find matches."
189 :type '(radio (function-item gnus-gather-threads-by-subject)
190 (function-item gnus-gather-threads-by-references)
191 (function :tag "other")))
193 (defcustom gnus-summary-same-subject ""
194 "*String indicating that the current article has the same subject as the previous.
195 This variable will only be used if the value of
196 `gnus-summary-make-false-root' is `empty'."
197 :group 'gnus-summary-format
200 (defcustom gnus-summary-goto-unread t
201 "*If t, many commands will go to the next unread article.
202 This applies to marking commands as well as other commands that
203 \"naturally\" select the next article, like, for instance, `SPC' at
204 the end of an article.
206 If nil, the marking commands do NOT go to the next unread article
207 \(they go to the next article instead). If `never', commands that
208 usually go to the next unread article, will go to the next article,
209 whether it is read or not."
210 :group 'gnus-summary-marks
211 :link '(custom-manual "(gnus)Setting Marks")
212 :type '(choice (const :tag "off" nil)
214 (sexp :menu-tag "on" t)))
216 (defcustom gnus-summary-default-score 0
217 "*Default article score level.
218 All scores generated by the score files will be added to this score.
219 If this variable is nil, scoring will be disabled."
220 :group 'gnus-score-default
221 :type '(choice (const :tag "disable")
224 (defcustom gnus-summary-default-high-score 0
225 "*Default threshold for a high scored article.
226 An article will be highlighted as high scored if its score is greater
228 :group 'gnus-score-default
231 (defcustom gnus-summary-default-low-score 0
232 "*Default threshold for a low scored article.
233 An article will be highlighted as low scored if its score is smaller
235 :group 'gnus-score-default
238 (defcustom gnus-summary-zcore-fuzz 0
239 "*Fuzziness factor for the zcore in the summary buffer.
240 Articles with scores closer than this to `gnus-summary-default-score'
242 :group 'gnus-summary-format
245 (defcustom gnus-simplify-subject-fuzzy-regexp nil
246 "*Strings to be removed when doing fuzzy matches.
247 This can either be a regular expression or list of regular expressions
248 that will be removed from subject strings if fuzzy subject
249 simplification is selected."
251 :type '(repeat regexp))
253 (defcustom gnus-show-threads t
254 "*If non-nil, display threads in summary mode."
258 (defcustom gnus-thread-hide-subtree nil
259 "*If non-nil, hide all threads initially.
260 This can be a predicate specifier which says which threads to hide.
261 If threads are hidden, you have to run the command
262 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
263 to expose hidden threads."
267 (defcustom gnus-thread-hide-killed t
268 "*If non-nil, hide killed threads automatically."
272 (defcustom gnus-thread-ignore-subject t
273 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
274 If nil, articles that have different subjects from their parents will
275 start separate threads."
279 (defcustom gnus-thread-operation-ignore-subject t
280 "*If non-nil, subjects will be ignored when doing thread commands.
281 This affects commands like `gnus-summary-kill-thread' and
282 `gnus-summary-lower-thread'.
284 If this variable is nil, articles in the same thread with different
285 subjects will not be included in the operation in question. If this
286 variable is `fuzzy', only articles that have subjects that are fuzzily
287 equal will be included."
289 :type '(choice (const :tag "off" nil)
293 (defcustom gnus-thread-indent-level 4
294 "*Number that says how much each sub-thread should be indented."
298 (defcustom gnus-auto-extend-newsgroup t
299 "*If non-nil, extend newsgroup forward and backward when requested."
300 :group 'gnus-summary-choose
303 (defcustom gnus-auto-select-first t
304 "*If non-nil, select the article under point.
305 Which article this is is controlled by the `gnus-auto-select-subject'
308 If you want to prevent automatic selection of articles in some
309 newsgroups, set the variable to nil in `gnus-select-group-hook'."
310 :group 'gnus-group-select
311 :type '(choice (const :tag "none" nil)
312 (sexp :menu-tag "first" t)))
314 (defcustom gnus-auto-select-subject 'unread
315 "*Says what subject to place under point when entering a group.
317 This variable can either be the symbols `first' (place point on the
318 first subject), `unread' (place point on the subject line of the first
319 unread article), `best' (place point on the subject line of the
320 higest-scored article), `unseen' (place point on the subject line of
321 the first unseen article), 'unseen-or-unread' (place point on the subject
322 line of the first unseen article or, if all article have been seen, on the
323 subject line of the first unread article), or a function to be called to
324 place point on some subject line."
325 :group 'gnus-group-select
326 :type '(choice (const best)
330 (const unseen-or-unread)))
332 (defcustom gnus-dont-select-after-jump-to-other-group nil
333 "If non-nil, don't select the first unread article after entering the
334 other group by the command `gnus-summary-jump-to-other-group'. If nil,
335 it is depend on the value of `gnus-auto-select-first' whether to select
337 :group 'gnus-group-select
340 (defcustom gnus-auto-select-next t
341 "*If non-nil, offer to go to the next group from the end of the previous.
342 If the value is t and the next newsgroup is empty, Gnus will exit
343 summary mode and go back to group mode. If the value is neither nil
344 nor t, Gnus will select the following unread newsgroup. In
345 particular, if the value is the symbol `quietly', the next unread
346 newsgroup will be selected without any confirmation, and if it is
347 `almost-quietly', the next group will be selected without any
348 confirmation if you are located on the last article in the group.
349 Finally, if this variable is `slightly-quietly', the `Z n' command
350 will go to the next group without confirmation."
351 :group 'gnus-summary-maneuvering
352 :type '(choice (const :tag "off" nil)
354 (const almost-quietly)
355 (const slightly-quietly)
356 (sexp :menu-tag "on" t)))
358 (defcustom gnus-auto-select-same nil
359 "*If non-nil, select the next article with the same subject.
360 If there are no more articles with the same subject, go to
361 the first unread article."
362 :group 'gnus-summary-maneuvering
365 (defcustom gnus-summary-check-current nil
366 "*If non-nil, consider the current article when moving.
367 The \"unread\" movement commands will stay on the same line if the
368 current article is unread."
369 :group 'gnus-summary-maneuvering
372 (defcustom gnus-auto-center-summary t
373 "*If non-nil, always center the current summary buffer.
374 In particular, if `vertical' do only vertical recentering. If non-nil
375 and non-`vertical', do both horizontal and vertical recentering."
376 :group 'gnus-summary-maneuvering
377 :type '(choice (const :tag "none" nil)
379 (integer :tag "height")
380 (sexp :menu-tag "both" t)))
382 (defcustom gnus-show-all-headers nil
383 "*If non-nil, don't hide any headers."
384 :group 'gnus-article-hiding
385 :group 'gnus-article-headers
388 (defcustom gnus-summary-ignore-duplicates nil
389 "*If non-nil, ignore articles with identical Message-ID headers."
393 (defcustom gnus-single-article-buffer t
394 "*If non-nil, display all articles in the same buffer.
395 If nil, each group will get its own article buffer."
396 :group 'gnus-article-various
399 (defcustom gnus-break-pages t
400 "*If non-nil, do page breaking on articles.
401 The page delimiter is specified by the `gnus-page-delimiter'
403 :group 'gnus-article-various
406 (defcustom gnus-show-mime t
407 "*If non-nil, do mime processing of articles.
408 The articles will simply be fed to the function given by
409 `gnus-article-display-method-for-mime'."
410 :group 'gnus-article-mime
413 (defcustom gnus-move-split-methods nil
414 "*Variable used to suggest where articles are to be moved to.
415 It uses the same syntax as the `gnus-split-methods' variable.
416 However, whereas `gnus-split-methods' specifies file names as targets,
417 this variable specifies group names."
418 :group 'gnus-summary-mail
419 :type '(repeat (choice (list :value (fun) function)
420 (cons :value ("" "") regexp (repeat string))
423 (defcustom gnus-unread-mark ?\ ;;;Whitespace
424 "*Mark used for unread articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-ticked-mark ?!
429 "*Mark used for ticked articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-dormant-mark ??
434 "*Mark used for dormant articles."
435 :group 'gnus-summary-marks
438 (defcustom gnus-del-mark ?r
439 "*Mark used for del'd articles."
440 :group 'gnus-summary-marks
443 (defcustom gnus-read-mark ?R
444 "*Mark used for read articles."
445 :group 'gnus-summary-marks
448 (defcustom gnus-expirable-mark ?E
449 "*Mark used for expirable articles."
450 :group 'gnus-summary-marks
453 (defcustom gnus-killed-mark ?K
454 "*Mark used for killed articles."
455 :group 'gnus-summary-marks
458 (defcustom gnus-spam-mark ?H
459 "*Mark used for spam articles."
460 :group 'gnus-summary-marks
463 (defcustom gnus-souped-mark ?F
464 "*Mark used for souped articles."
465 :group 'gnus-summary-marks
468 (defcustom gnus-kill-file-mark ?X
469 "*Mark used for articles killed by kill files."
470 :group 'gnus-summary-marks
473 (defcustom gnus-low-score-mark ?Y
474 "*Mark used for articles with a low score."
475 :group 'gnus-summary-marks
478 (defcustom gnus-catchup-mark ?C
479 "*Mark used for articles that are caught up."
480 :group 'gnus-summary-marks
483 (defcustom gnus-replied-mark ?A
484 "*Mark used for articles that have been replied to."
485 :group 'gnus-summary-marks
488 (defcustom gnus-forwarded-mark ?F
489 "*Mark used for articles that have been forwarded."
490 :group 'gnus-summary-marks
493 (defcustom gnus-recent-mark ?N
494 "*Mark used for articles that are recent."
495 :group 'gnus-summary-marks
498 (defcustom gnus-cached-mark ?*
499 "*Mark used for articles that are in the cache."
500 :group 'gnus-summary-marks
503 (defcustom gnus-saved-mark ?S
504 "*Mark used for articles that have been saved."
505 :group 'gnus-summary-marks
508 (defcustom gnus-unseen-mark ?.
509 "*Mark used for articles that haven't been seen."
510 :group 'gnus-summary-marks
513 (defcustom gnus-no-mark ?\ ;;;Whitespace
514 "*Mark used for articles that have no other secondary mark."
515 :group 'gnus-summary-marks
518 (defcustom gnus-ancient-mark ?O
519 "*Mark used for ancient articles."
520 :group 'gnus-summary-marks
523 (defcustom gnus-sparse-mark ?Q
524 "*Mark used for sparsely reffed articles."
525 :group 'gnus-summary-marks
528 (defcustom gnus-canceled-mark ?G
529 "*Mark used for canceled articles."
530 :group 'gnus-summary-marks
533 (defcustom gnus-duplicate-mark ?M
534 "*Mark used for duplicate articles."
535 :group 'gnus-summary-marks
538 (defcustom gnus-undownloaded-mark ?-
539 "*Mark used for articles that weren't downloaded."
540 :group 'gnus-summary-marks
543 (defcustom gnus-downloaded-mark ?+
544 "*Mark used for articles that were downloaded."
545 :group 'gnus-summary-marks
548 (defcustom gnus-downloadable-mark ?%
549 "*Mark used for articles that are to be downloaded."
550 :group 'gnus-summary-marks
553 (defcustom gnus-unsendable-mark ?=
554 "*Mark used for articles that won't be sent."
555 :group 'gnus-summary-marks
558 (defcustom gnus-score-over-mark ?+
559 "*Score mark used for articles with high scores."
560 :group 'gnus-summary-marks
563 (defcustom gnus-score-below-mark ?-
564 "*Score mark used for articles with low scores."
565 :group 'gnus-summary-marks
568 (defcustom gnus-empty-thread-mark ?\ ;;;Whitespace
569 "*There is no thread under the article."
570 :group 'gnus-summary-marks
573 (defcustom gnus-not-empty-thread-mark ?=
574 "*There is a thread under the article."
575 :group 'gnus-summary-marks
578 (defcustom gnus-view-pseudo-asynchronously nil
579 "*If non-nil, Gnus will view pseudo-articles asynchronously."
580 :group 'gnus-extract-view
583 (defcustom gnus-auto-expirable-marks
584 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
585 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
586 gnus-souped-mark gnus-duplicate-mark)
587 "*The list of marks converted into expiration if a group is auto-expirable."
590 :type '(repeat character))
592 (defcustom gnus-inhibit-user-auto-expire t
593 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
598 (defcustom gnus-view-pseudos nil
599 "*If `automatic', pseudo-articles will be viewed automatically.
600 If `not-confirm', pseudos will be viewed automatically, and the user
601 will not be asked to confirm the command."
602 :group 'gnus-extract-view
603 :type '(choice (const :tag "off" nil)
605 (const not-confirm)))
607 (defcustom gnus-view-pseudos-separately t
608 "*If non-nil, one pseudo-article will be created for each file to be viewed.
609 If nil, all files that use the same viewing command will be given as a
610 list of parameters to that command."
611 :group 'gnus-extract-view
614 (defcustom gnus-insert-pseudo-articles t
615 "*If non-nil, insert pseudo-articles when decoding articles."
616 :group 'gnus-extract-view
619 (defcustom gnus-summary-dummy-line-format
621 "*The format specification for the dummy roots in the summary buffer.
622 It works along the same lines as a normal formatting string,
623 with some simple extensions.
627 General format specifiers can also be used.
628 See `(gnus)Formatting Variables'."
629 :link '(custom-manual "(gnus)Formatting Variables")
630 :group 'gnus-threading
633 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
634 "*The format specification for the summary mode line.
635 It works along the same lines as a normal formatting string,
636 with some simple extensions:
639 %p Unprefixed group name
640 %A Current article number
641 %z Current article score
643 %U Number of unread articles in the group
644 %e Number of unselected articles in the group
645 %Z A string with unread/unselected article counts
646 %g Shortish group name
647 %S Subject of the current article
649 %s Current score file name
650 %d Number of dormant articles
651 %r Number of articles that have been marked as read in this session
652 %E Number of articles expunged by the score files"
653 :group 'gnus-summary-format
656 (defcustom gnus-list-identifiers nil
657 "Regexp that matches list identifiers to be removed from subject.
658 This can also be a list of regexps."
660 :group 'gnus-summary-format
661 :group 'gnus-article-hiding
662 :type '(choice (const :tag "none" nil)
664 (repeat :value (".*") regexp)))
666 (defcustom gnus-summary-mark-below 0
667 "*Mark all articles with a score below this variable as read.
668 This variable is local to each summary buffer and usually set by the
670 :group 'gnus-score-default
673 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
674 "*List of functions used for sorting articles in the summary buffer.
676 Each function takes two articles and returns non-nil if the first
677 article should be sorted before the other. If you use more than one
678 function, the primary sort function should be the last. You should
679 probably always include `gnus-article-sort-by-number' in the list of
680 sorting functions -- preferably first. Also note that sorting by date
681 is often much slower than sorting by number, and the sorting order is
682 very similar. (Sorting by date means sorting by the time the message
683 was sent, sorting by number means sorting by arrival time.)
685 Ready-made functions include `gnus-article-sort-by-number',
686 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
687 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
688 and `gnus-article-sort-by-score'.
690 When threading is turned on, the variable `gnus-thread-sort-functions'
691 controls how articles are sorted."
692 :group 'gnus-summary-sort
693 :type '(repeat (choice (function-item gnus-article-sort-by-number)
694 (function-item gnus-article-sort-by-author)
695 (function-item gnus-article-sort-by-subject)
696 (function-item gnus-article-sort-by-date)
697 (function-item gnus-article-sort-by-score)
698 (function-item gnus-article-sort-by-random)
699 (function :tag "other"))))
701 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
702 "*List of functions used for sorting threads in the summary buffer.
703 By default, threads are sorted by article number.
705 Each function takes two threads and returns non-nil if the first
706 thread should be sorted before the other. If you use more than one
707 function, the primary sort function should be the last. You should
708 probably always include `gnus-thread-sort-by-number' in the list of
709 sorting functions -- preferably first. Also note that sorting by date
710 is often much slower than sorting by number, and the sorting order is
711 very similar. (Sorting by date means sorting by the time the message
712 was sent, sorting by number means sorting by arrival time.)
714 Ready-made functions include `gnus-thread-sort-by-number',
715 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
716 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
717 `gnus-thread-sort-by-most-recent-number',
718 `gnus-thread-sort-by-most-recent-date',
719 `gnus-thread-sort-by-random', and
720 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
722 When threading is turned off, the variable
723 `gnus-article-sort-functions' controls how articles are sorted."
724 :group 'gnus-summary-sort
725 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
726 (function-item gnus-thread-sort-by-author)
727 (function-item gnus-thread-sort-by-subject)
728 (function-item gnus-thread-sort-by-date)
729 (function-item gnus-thread-sort-by-score)
730 (function-item gnus-thread-sort-by-total-score)
731 (function-item gnus-thread-sort-by-random)
732 (function :tag "other"))))
734 (defcustom gnus-thread-score-function '+
735 "*Function used for calculating the total score of a thread.
737 The function is called with the scores of the article and each
738 subthread and should then return the score of the thread.
740 Some functions you can use are `+', `max', or `min'."
741 :group 'gnus-summary-sort
744 (defcustom gnus-summary-expunge-below nil
745 "All articles that have a score less than this variable will be expunged.
746 This variable is local to the summary buffers."
747 :group 'gnus-score-default
748 :type '(choice (const :tag "off" nil)
751 (defcustom gnus-thread-expunge-below nil
752 "All threads that have a total score less than this variable will be expunged.
753 See `gnus-thread-score-function' for en explanation of what a
756 This variable is local to the summary buffers."
757 :group 'gnus-threading
758 :group 'gnus-score-default
759 :type '(choice (const :tag "off" nil)
762 (defcustom gnus-summary-mode-hook nil
763 "*A hook for Gnus summary mode.
764 This hook is run before any variables are set in the summary buffer."
765 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
766 :group 'gnus-summary-various
769 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
770 (when (featurep 'xemacs)
771 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
772 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
773 (add-hook 'gnus-summary-mode-hook
774 'gnus-xmas-switch-horizontal-scrollbar-off))
776 (defcustom gnus-summary-menu-hook nil
777 "*Hook run after the creation of the summary mode menu."
778 :group 'gnus-summary-visual
781 (defcustom gnus-summary-exit-hook nil
782 "*A hook called on exit from the summary buffer.
783 It will be called with point in the group buffer."
784 :group 'gnus-summary-exit
787 (defcustom gnus-summary-prepare-hook nil
788 "*A hook called after the summary buffer has been generated.
789 If you want to modify the summary buffer, you can use this hook."
790 :group 'gnus-summary-various
793 (defcustom gnus-summary-prepared-hook nil
794 "*A hook called as the last thing after the summary buffer has been generated."
795 :group 'gnus-summary-various
798 (defcustom gnus-summary-generate-hook nil
799 "*A hook run just before generating the summary buffer.
800 This hook is commonly used to customize threading variables and the
802 :group 'gnus-summary-various
805 (defcustom gnus-select-group-hook nil
806 "*A hook called when a newsgroup is selected.
808 If you'd like to simplify subjects like the
809 `gnus-summary-next-same-subject' command does, you can use the
812 (add-hook gnus-select-group-hook
814 (mapcar (lambda (header)
815 (mail-header-set-subject
817 (gnus-simplify-subject
818 (mail-header-subject header) 're-only)))
819 gnus-newsgroup-headers)))"
820 :group 'gnus-group-select
823 (defcustom gnus-select-article-hook nil
824 "*A hook called when an article is selected."
825 :group 'gnus-summary-choose
826 :options '(gnus-agent-fetch-selected-article)
829 (defcustom gnus-visual-mark-article-hook
830 (list 'gnus-highlight-selected-summary)
831 "*Hook run after selecting an article in the summary buffer.
832 It is meant to be used for highlighting the article in some way. It
833 is not run if `gnus-visual' is nil."
834 :group 'gnus-summary-visual
837 (defcustom gnus-parse-headers-hook '(gnus-summary-inherit-default-charset)
838 "*A hook called before parsing the headers."
842 (defcustom gnus-exit-group-hook nil
843 "*A hook called when exiting summary mode.
844 This hook is not called from the non-updating exit commands like `Q'."
848 (defcustom gnus-summary-update-hook
849 (list 'gnus-summary-highlight-line)
850 "*A hook called when a summary line is changed.
851 The hook will not be called if `gnus-visual' is nil.
853 The default function `gnus-summary-highlight-line' will
854 highlight the line according to the `gnus-summary-highlight'
856 :group 'gnus-summary-visual
859 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
860 "*A hook called when an article is selected for the first time.
861 The hook is intended to mark an article as read (or unread)
862 automatically when it is selected."
863 :group 'gnus-summary-choose
866 (defcustom gnus-group-no-more-groups-hook nil
867 "*A hook run when returning to group mode having no more (unread) groups."
868 :group 'gnus-group-select
871 (defcustom gnus-ps-print-hook nil
872 "*A hook run before ps-printing something from Gnus."
876 (defcustom gnus-summary-display-arrow
877 (and (fboundp 'display-graphic-p)
879 "*If non-nil, display an arrow highlighting the current article."
884 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
885 "Face used for highlighting the current article in the summary buffer."
886 :group 'gnus-summary-visual
889 (defvar gnus-tmp-downloaded nil)
891 (defcustom gnus-summary-highlight
892 '(((eq mark gnus-canceled-mark)
893 . gnus-summary-cancelled-face)
894 ((and uncached (> score default-high))
895 . gnus-summary-high-undownloaded-face)
896 ((and uncached (< score default-low))
897 . gnus-summary-low-undownloaded-face)
899 . gnus-summary-normal-undownloaded-face)
900 ((and (> score default-high)
901 (or (eq mark gnus-dormant-mark)
902 (eq mark gnus-ticked-mark)))
903 . gnus-summary-high-ticked-face)
904 ((and (< score default-low)
905 (or (eq mark gnus-dormant-mark)
906 (eq mark gnus-ticked-mark)))
907 . gnus-summary-low-ticked-face)
908 ((or (eq mark gnus-dormant-mark)
909 (eq mark gnus-ticked-mark))
910 . gnus-summary-normal-ticked-face)
911 ((and (> score default-high) (eq mark gnus-ancient-mark))
912 . gnus-summary-high-ancient-face)
913 ((and (< score default-low) (eq mark gnus-ancient-mark))
914 . gnus-summary-low-ancient-face)
915 ((eq mark gnus-ancient-mark)
916 . gnus-summary-normal-ancient-face)
917 ((and (> score default-high) (eq mark gnus-unread-mark))
918 . gnus-summary-high-unread-face)
919 ((and (< score default-low) (eq mark gnus-unread-mark))
920 . gnus-summary-low-unread-face)
921 ((eq mark gnus-unread-mark)
922 . gnus-summary-normal-unread-face)
923 ((> score default-high)
924 . gnus-summary-high-read-face)
925 ((< score default-low)
926 . gnus-summary-low-read-face)
928 . gnus-summary-normal-read-face))
929 "*Controls the highlighting of summary buffer lines.
931 A list of (FORM . FACE) pairs. When deciding how a a particular
932 summary line should be displayed, each form is evaluated. The content
933 of the face field after the first true form is used. You can change
934 how those summary lines are displayed, by editing the face field.
936 You can use the following variables in the FORM field.
938 score: The article's score
939 default: The default article score.
940 default-high: The default score for high scored articles.
941 default-low: The default score for low scored articles.
942 below: The score below which articles are automatically marked as read.
943 mark: The articles mark."
944 :group 'gnus-summary-visual
945 :type '(repeat (cons (sexp :tag "Form" nil)
948 (defcustom gnus-alter-header-function nil
949 "Function called to allow alteration of article header structures.
950 The function is called with one parameter, the article header vector,
951 which it may alter in any way.")
953 (defvar gnus-decode-encoded-word-function
954 (mime-find-field-decoder 'From 'nov)
955 "Variable that says which function should be used to decode a string with encoded words.")
957 (defcustom gnus-extra-headers '(To Newsgroups)
958 "*Extra headers to parse."
961 :type '(repeat symbol))
963 (defcustom gnus-ignored-from-addresses
964 (and user-mail-address (regexp-quote user-mail-address))
965 "*Regexp of From headers that may be suppressed in favor of To headers."
970 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
971 "List of charsets that should be ignored.
972 When these charsets are used in the \"charset\" parameter, the
973 default charset will be used instead."
975 :type '(repeat symbol)
976 :group 'gnus-charset)
978 (gnus-define-group-parameter
982 "Return the ignored charsets of GROUP."
983 :variable gnus-group-ignored-charsets-alist
985 '(("alt\\.chinese\\.text" iso-8859-1))
987 "Alist of regexps (to match group names) and charsets that should be ignored.
988 When these charsets are used in the \"charset\" parameter, the
989 default charset will be used instead."
990 :variable-group gnus-charset
991 :variable-type '(repeat (cons (regexp :tag "Group")
993 :parameter-type '(choice :tag "Ignored charsets"
996 :parameter-document "\
997 List of charsets that should be ignored.
999 When these charsets are used in the \"charset\" parameter, the
1000 default charset will be used instead.")
1002 (defcustom gnus-group-highlight-words-alist nil
1003 "Alist of group regexps and highlight regexps.
1004 This variable uses the same syntax as `gnus-emphasis-alist'."
1006 :type '(repeat (cons (regexp :tag "Group")
1007 (repeat (list (regexp :tag "Highlight regexp")
1008 (number :tag "Group for entire word" 0)
1009 (number :tag "Group for displayed part" 0)
1011 gnus-emphasis-highlight-words)))))
1012 :group 'gnus-summary-visual)
1014 (defcustom gnus-use-wheel nil
1015 "Use Intelli-mouse on summary movement"
1017 :group 'gnus-summary-maneuvering)
1019 (defcustom gnus-wheel-scroll-amount '(5 . 1)
1020 "Amount to scroll messages by spinning the mouse wheel.
1021 This is actually a cons cell, where the first item is the amount to scroll
1022 on a normal wheel event, and the second is the amount to scroll when the
1023 wheel is moved with the shift key depressed."
1024 :type '(cons (integer :tag "Shift") integer)
1025 :group 'gnus-summary-maneuvering)
1027 (defcustom gnus-wheel-edge-resistance 2
1028 "How hard it should be to change the current article
1029 by moving the mouse over the edge of the article window."
1031 :group 'gnus-summary-maneuvering)
1033 (defcustom gnus-summary-show-article-charset-alist
1035 "Alist of number and charset.
1036 The article will be shown with the charset corresponding to the
1038 For example: ((1 . cn-gb-2312) (2 . big5))."
1040 :type '(repeat (cons (number :tag "Argument" 1)
1041 (symbol :tag "Charset")))
1042 :group 'gnus-charset)
1044 (defcustom gnus-preserve-marks t
1045 "Whether marks are preserved when moving, copying and respooling messages."
1048 :group 'gnus-summary-marks)
1050 (defcustom gnus-alter-articles-to-read-function nil
1051 "Function to be called to alter the list of articles to be selected."
1052 :type '(choice (const nil) function)
1053 :group 'gnus-summary)
1055 (defcustom gnus-orphan-score nil
1056 "*All orphans get this score added. Set in the score file."
1057 :group 'gnus-score-default
1058 :type '(choice (const nil)
1061 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1062 "*A regexp to match MIME parts when saving multiple parts of a message
1063 with gnus-summary-save-parts (X m). This regexp will be used by default
1064 when prompting the user for which type of files to save."
1065 :group 'gnus-summary
1068 (defcustom gnus-read-all-available-headers nil
1069 "Whether Gnus should parse all headers made available to it.
1070 This is mostly relevant for slow backends where the user may
1071 wish to widen the summary buffer to include all headers
1072 that were fetched. Say, for nnultimate groups."
1073 :group 'gnus-summary
1074 :type '(choice boolean regexp))
1076 (defcustom gnus-summary-muttprint-program "muttprint"
1077 "Command (and optional arguments) used to run Muttprint."
1079 :group 'gnus-summary
1082 (defcustom gnus-article-loose-mime nil
1083 "If non-nil, don't require MIME-Version header.
1084 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1085 supply the MIME-Version header or deliberately strip it From the mail.
1086 Set it to non-nil, Gnus will treat some articles as MIME even if
1087 the MIME-Version header is missed."
1090 :group 'gnus-article)
1092 (defcustom gnus-article-emulate-mime t
1093 "If non-nil, use MIME emulation for uuencode and the like.
1094 This means that Gnus will search message bodies for text that look
1095 like uuencoded bits, yEncoded bits, and so on, and present that using
1096 the normal Gnus MIME machinery."
1098 :group 'gnus-article)
1100 ;;; Internal variables
1102 (defvar gnus-summary-display-cache nil)
1103 (defvar gnus-article-mime-handles nil)
1104 (defvar gnus-article-decoded-p nil)
1105 (defvar gnus-article-charset nil)
1106 (defvar gnus-article-ignored-charsets nil)
1107 (defvar gnus-scores-exclude-files nil)
1108 (defvar gnus-page-broken nil)
1110 (defvar gnus-original-article nil)
1111 (defvar gnus-article-internal-prepare-hook nil)
1112 (defvar gnus-newsgroup-process-stack nil)
1114 (defvar gnus-thread-indent-array nil)
1115 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1116 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1117 "Function called to sort the articles within a thread after it has been gathered together.")
1119 (defvar gnus-summary-save-parts-type-history nil)
1120 (defvar gnus-summary-save-parts-last-directory nil)
1122 ;; Avoid highlighting in kill files.
1123 (defvar gnus-summary-inhibit-highlight nil)
1124 (defvar gnus-newsgroup-selected-overlay nil)
1125 (defvar gnus-inhibit-limiting nil)
1126 (defvar gnus-newsgroup-adaptive-score-file nil)
1127 (defvar gnus-current-score-file nil)
1128 (defvar gnus-current-move-group nil)
1129 (defvar gnus-current-copy-group nil)
1130 (defvar gnus-current-crosspost-group nil)
1131 (defvar gnus-newsgroup-display nil)
1133 (defvar gnus-newsgroup-dependencies nil)
1134 (defvar gnus-newsgroup-adaptive nil)
1135 (defvar gnus-summary-display-article-function nil)
1136 (defvar gnus-summary-highlight-line-function nil
1137 "Function called after highlighting a summary line.")
1139 (defvar gnus-summary-line-format-alist
1140 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1141 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1142 (?s gnus-tmp-subject-or-nil ?s)
1143 (?n gnus-tmp-name ?s)
1144 (?A (std11-address-string
1145 (car (mime-entity-read-field gnus-tmp-header 'From))) ?s)
1146 (?a (or (std11-full-name-string
1147 (car (mime-entity-read-field gnus-tmp-header 'From)))
1149 (?F gnus-tmp-from ?s)
1150 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1151 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1152 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1153 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1154 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1155 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1156 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1157 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1158 (?L gnus-tmp-lines ?s)
1159 (?O gnus-tmp-downloaded ?c)
1160 (?I gnus-tmp-indentation ?s)
1161 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1162 (?R gnus-tmp-replied ?c)
1163 (?\[ gnus-tmp-opening-bracket ?c)
1164 (?\] gnus-tmp-closing-bracket ?c)
1165 (?\> (make-string gnus-tmp-level ? ) ?s)
1166 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1167 (?i gnus-tmp-score ?d)
1168 (?z gnus-tmp-score-char ?c)
1169 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1170 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1171 (?U gnus-tmp-unread ?c)
1172 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1174 (?t (gnus-summary-number-of-articles-in-thread
1175 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1177 (?e (gnus-summary-number-of-articles-in-thread
1178 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1180 (?u gnus-tmp-user-defined ?s)
1181 (?P (gnus-pick-line-number) ?d)
1182 (?B gnus-tmp-thread-tree-header-string ?s)
1183 (user-date (gnus-user-date
1184 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1185 "An alist of format specifications that can appear in summary lines.
1186 These are paired with what variables they correspond with, along with
1187 the type of the variable (string, integer, character, etc).")
1189 (defvar gnus-summary-dummy-line-format-alist
1190 `((?S gnus-tmp-subject ?s)
1191 (?N gnus-tmp-number ?d)
1192 (?u gnus-tmp-user-defined ?s)))
1194 (defvar gnus-summary-mode-line-format-alist
1195 `((?G gnus-tmp-group-name ?s)
1196 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1197 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1198 (?A gnus-tmp-article-number ?d)
1199 (?Z gnus-tmp-unread-and-unselected ?s)
1200 (?V gnus-version ?s)
1201 (?U gnus-tmp-unread-and-unticked ?d)
1202 (?S gnus-tmp-subject ?s)
1203 (?e gnus-tmp-unselected ?d)
1204 (?u gnus-tmp-user-defined ?s)
1205 (?d (length gnus-newsgroup-dormant) ?d)
1206 (?t (length gnus-newsgroup-marked) ?d)
1207 (?h (length gnus-newsgroup-spam-marked) ?d)
1208 (?r (length gnus-newsgroup-reads) ?d)
1209 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1210 (?E gnus-newsgroup-expunged-tally ?d)
1211 (?s (gnus-current-score-file-nondirectory) ?s)))
1213 (defvar gnus-last-search-regexp nil
1214 "Default regexp for article search command.")
1216 (defvar gnus-summary-search-article-matched-data nil
1217 "Last matched data of article search command. It is the local variable
1218 in `gnus-article-buffer' which consists of the list of start position,
1219 end position and text.")
1221 (defvar gnus-last-shell-command nil
1222 "Default shell command on article.")
1224 (defvar gnus-newsgroup-agentized nil
1225 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1226 (defvar gnus-newsgroup-begin nil)
1227 (defvar gnus-newsgroup-end nil)
1228 (defvar gnus-newsgroup-last-rmail nil)
1229 (defvar gnus-newsgroup-last-mail nil)
1230 (defvar gnus-newsgroup-last-folder nil)
1231 (defvar gnus-newsgroup-last-file nil)
1232 (defvar gnus-newsgroup-auto-expire nil)
1233 (defvar gnus-newsgroup-active nil)
1235 (defvar gnus-newsgroup-data nil)
1236 (defvar gnus-newsgroup-data-reverse nil)
1237 (defvar gnus-newsgroup-limit nil)
1238 (defvar gnus-newsgroup-limits nil)
1240 (defvar gnus-newsgroup-unreads nil
1241 "Sorted list of unread articles in the current newsgroup.")
1243 (defvar gnus-newsgroup-unselected nil
1244 "Sorted list of unselected unread articles in the current newsgroup.")
1246 (defvar gnus-newsgroup-reads nil
1247 "Alist of read articles and article marks in the current newsgroup.")
1249 (defvar gnus-newsgroup-expunged-tally nil)
1251 (defvar gnus-newsgroup-marked nil
1252 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1254 (defvar gnus-newsgroup-spam-marked nil
1255 "List of ranges of articles that have been marked as spam.")
1257 (defvar gnus-newsgroup-killed nil
1258 "List of ranges of articles that have been through the scoring process.")
1260 (defvar gnus-newsgroup-cached nil
1261 "Sorted list of articles that come from the article cache.")
1263 (defvar gnus-newsgroup-saved nil
1264 "List of articles that have been saved.")
1266 (defvar gnus-newsgroup-kill-headers nil)
1268 (defvar gnus-newsgroup-replied nil
1269 "List of articles that have been replied to in the current newsgroup.")
1271 (defvar gnus-newsgroup-forwarded nil
1272 "List of articles that have been forwarded in the current newsgroup.")
1274 (defvar gnus-newsgroup-recent nil
1275 "List of articles that have are recent in the current newsgroup.")
1277 (defvar gnus-newsgroup-expirable nil
1278 "Sorted list of articles in the current newsgroup that can be expired.")
1280 (defvar gnus-newsgroup-processable nil
1281 "List of articles in the current newsgroup that can be processed.")
1283 (defvar gnus-newsgroup-downloadable nil
1284 "Sorted list of articles in the current newsgroup that can be processed.")
1286 (defvar gnus-newsgroup-undownloaded nil
1287 "List of articles in the current newsgroup that haven't been downloaded..")
1289 (defvar gnus-newsgroup-unsendable nil
1290 "List of articles in the current newsgroup that won't be sent.")
1292 (defvar gnus-newsgroup-bookmarks nil
1293 "List of articles in the current newsgroup that have bookmarks.")
1295 (defvar gnus-newsgroup-dormant nil
1296 "Sorted list of dormant articles in the current newsgroup.")
1298 (defvar gnus-newsgroup-unseen nil
1299 "List of unseen articles in the current newsgroup.")
1301 (defvar gnus-newsgroup-seen nil
1302 "Range of seen articles in the current newsgroup.")
1304 (defvar gnus-newsgroup-articles nil
1305 "List of articles in the current newsgroup.")
1307 (defvar gnus-newsgroup-scored nil
1308 "List of scored articles in the current newsgroup.")
1310 (defvar gnus-newsgroup-incorporated nil
1311 "List of incorporated articles in the current newsgroup.")
1313 (defvar gnus-newsgroup-headers nil
1314 "List of article headers in the current newsgroup.")
1316 (defvar gnus-newsgroup-threads nil)
1318 (defvar gnus-newsgroup-prepared nil
1319 "Whether the current group has been prepared properly.")
1321 (defvar gnus-newsgroup-ancient nil
1322 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1324 (defvar gnus-newsgroup-sparse nil)
1326 (defvar gnus-current-article nil)
1327 (defvar gnus-article-current nil)
1328 (defvar gnus-current-headers nil)
1329 (defvar gnus-have-all-headers nil)
1330 (defvar gnus-last-article nil)
1331 (defvar gnus-newsgroup-history nil)
1332 (defvar gnus-newsgroup-charset nil)
1333 (defvar gnus-newsgroup-ephemeral-charset nil)
1334 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1336 (defvar gnus-article-before-search nil)
1338 (defconst gnus-summary-local-variables
1339 '(gnus-newsgroup-name
1340 gnus-newsgroup-begin gnus-newsgroup-end
1341 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1342 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1343 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1344 gnus-newsgroup-unselected gnus-newsgroup-marked
1345 gnus-newsgroup-spam-marked
1346 gnus-newsgroup-reads gnus-newsgroup-saved
1347 gnus-newsgroup-replied gnus-newsgroup-forwarded
1348 gnus-newsgroup-recent
1349 gnus-newsgroup-expirable
1350 gnus-newsgroup-processable gnus-newsgroup-killed
1351 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1352 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1353 gnus-newsgroup-seen gnus-newsgroup-articles
1354 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1355 gnus-newsgroup-headers gnus-newsgroup-threads
1356 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1357 gnus-current-article gnus-current-headers gnus-have-all-headers
1358 gnus-last-article gnus-article-internal-prepare-hook
1359 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1360 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1361 gnus-thread-expunge-below
1362 gnus-score-alist gnus-current-score-file
1363 (gnus-summary-expunge-below . global)
1364 (gnus-summary-mark-below . global)
1365 (gnus-orphan-score . global)
1366 gnus-newsgroup-active gnus-scores-exclude-files
1367 gnus-newsgroup-history gnus-newsgroup-ancient
1368 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1369 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1370 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1371 (gnus-newsgroup-expunged-tally . 0)
1372 gnus-cache-removable-articles gnus-newsgroup-cached
1373 gnus-newsgroup-data gnus-newsgroup-data-reverse
1374 gnus-newsgroup-limit gnus-newsgroup-limits
1375 gnus-newsgroup-charset gnus-newsgroup-display
1376 gnus-newsgroup-incorporated)
1377 "Variables that are buffer-local to the summary buffers.")
1379 (defvar gnus-newsgroup-variables nil
1380 "A list of variables that have separate values in different newsgroups.
1381 A list of newsgroup (summary buffer) local variables, or cons of
1382 variables and their default values (when the default values are not
1383 nil), that should be made global while the summary buffer is active.
1384 These variables can be used to set variables in the group parameters
1385 while still allowing them to affect operations done in other
1386 buffers. For example:
1388 \(setq gnus-newsgroup-variables
1389 '(message-use-followup-to
1390 (gnus-visible-headers .
1391 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1394 ;; Byte-compiler warning.
1395 ;(eval-when-compile (defvar gnus-article-mode-map))
1397 (let ((features (cons 'gnus-sum features)))
1399 (require 'gnus-agent)
1400 (require 'gnus-art)))
1402 ;; Subject simplification.
1404 (defun gnus-simplify-whitespace (str)
1405 "Remove excessive whitespace from STR."
1408 (while (string-match "[ \t][ \t]+" mystr)
1409 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1411 (substring mystr (match-end 0)))))
1413 (when (string-match "^[ \t]+" mystr)
1414 (setq mystr (substring mystr (match-end 0))))
1416 (when (string-match "[ \t]+$" mystr)
1417 (setq mystr (substring mystr 0 (match-beginning 0))))
1420 (defun gnus-simplify-all-whitespace (str)
1421 "Remove all whitespace from STR."
1423 (while (string-match "[ \t\n]+" mystr)
1424 (setq mystr (replace-match "" nil nil mystr)))
1427 (defsubst gnus-simplify-subject-re (subject)
1428 "Remove \"Re:\" from subject lines."
1429 (if (string-match message-subject-re-regexp subject)
1430 (substring subject (match-end 0))
1433 (defun gnus-simplify-subject (subject &optional re-only)
1434 "Remove `Re:' and words in parentheses.
1435 If RE-ONLY is non-nil, strip leading `Re:'s only."
1436 (let ((case-fold-search t)) ;Ignore case.
1437 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1438 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1439 (setq subject (substring subject (match-end 0))))
1440 ;; Remove uninteresting prefixes.
1441 (when (and (not re-only)
1442 gnus-simplify-ignored-prefixes
1443 (string-match gnus-simplify-ignored-prefixes subject))
1444 (setq subject (substring subject (match-end 0))))
1445 ;; Remove words in parentheses from end.
1447 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1448 (setq subject (substring subject 0 (match-beginning 0)))))
1449 ;; Return subject string.
1452 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1454 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1455 (goto-char (point-min))
1456 (while (re-search-forward regexp nil t)
1457 (replace-match (or newtext ""))))
1459 (defun gnus-simplify-buffer-fuzzy ()
1460 "Simplify string in the buffer fuzzily.
1461 The string in the accessible portion of the current buffer is simplified.
1462 It is assumed to be a single-line subject.
1463 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1464 matter is removed. Additional things can be deleted by setting
1465 `gnus-simplify-subject-fuzzy-regexp'."
1466 (let ((case-fold-search t)
1468 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1470 (while (not (eq modified-tick (buffer-modified-tick)))
1471 (setq modified-tick (buffer-modified-tick))
1473 ((listp gnus-simplify-subject-fuzzy-regexp)
1474 (mapcar 'gnus-simplify-buffer-fuzzy-step
1475 gnus-simplify-subject-fuzzy-regexp))
1476 (gnus-simplify-subject-fuzzy-regexp
1477 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1478 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1479 (gnus-simplify-buffer-fuzzy-step
1480 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1481 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1483 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1484 (gnus-simplify-buffer-fuzzy-step " +" " ")
1485 (gnus-simplify-buffer-fuzzy-step " $")
1486 (gnus-simplify-buffer-fuzzy-step "^ +")))
1488 (defun gnus-simplify-subject-fuzzy (subject)
1489 "Simplify a subject string fuzzily.
1490 See `gnus-simplify-buffer-fuzzy' for details."
1492 (gnus-set-work-buffer)
1493 (let ((case-fold-search t))
1494 ;; Remove uninteresting prefixes.
1495 (when (and gnus-simplify-ignored-prefixes
1496 (string-match gnus-simplify-ignored-prefixes subject))
1497 (setq subject (substring subject (match-end 0))))
1499 (inline (gnus-simplify-buffer-fuzzy))
1502 (defsubst gnus-simplify-subject-fully (subject)
1503 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1505 (gnus-simplify-subject-functions
1506 (gnus-map-function gnus-simplify-subject-functions subject))
1507 ((null gnus-summary-gather-subject-limit)
1508 (gnus-simplify-subject-re subject))
1509 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1510 (gnus-simplify-subject-fuzzy subject))
1511 ((numberp gnus-summary-gather-subject-limit)
1512 (gnus-limit-string (gnus-simplify-subject-re subject)
1513 gnus-summary-gather-subject-limit))
1517 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1518 "Check whether two subjects are equal.
1519 If optional argument simple-first is t, first argument is already
1522 ((null simple-first)
1523 (equal (gnus-simplify-subject-fully s1)
1524 (gnus-simplify-subject-fully s2)))
1527 (gnus-simplify-subject-fully s2)))))
1529 (defun gnus-summary-bubble-group ()
1530 "Increase the score of the current group.
1531 This is a handy function to add to `gnus-summary-exit-hook' to
1532 increase the score of each group you read."
1533 (gnus-group-add-score gnus-newsgroup-name))
1537 ;;; Gnus summary mode
1540 (put 'gnus-summary-mode 'mode-class 'special)
1542 (defvar gnus-article-commands-menu)
1545 ;; Non-orthogonal keys
1547 (gnus-define-keys gnus-summary-mode-map
1548 " " gnus-summary-next-page
1549 "\177" gnus-summary-prev-page
1550 [delete] gnus-summary-prev-page
1551 [backspace] gnus-summary-prev-page
1552 "\r" gnus-summary-scroll-up
1553 "\M-\r" gnus-summary-scroll-down
1554 "n" gnus-summary-next-unread-article
1555 "p" gnus-summary-prev-unread-article
1556 "N" gnus-summary-next-article
1557 "P" gnus-summary-prev-article
1558 "\M-\C-n" gnus-summary-next-same-subject
1559 "\M-\C-p" gnus-summary-prev-same-subject
1560 "\M-n" gnus-summary-next-unread-subject
1561 "\M-p" gnus-summary-prev-unread-subject
1562 "." gnus-summary-first-unread-article
1563 "," gnus-summary-best-unread-article
1564 "\M-s" gnus-summary-search-article-forward
1565 "\M-r" gnus-summary-search-article-backward
1566 "<" gnus-summary-beginning-of-article
1567 ">" gnus-summary-end-of-article
1568 "j" gnus-summary-goto-article
1569 "^" gnus-summary-refer-parent-article
1570 "\M-^" gnus-summary-refer-article
1571 "u" gnus-summary-tick-article-forward
1572 "!" gnus-summary-tick-article-forward
1573 "U" gnus-summary-tick-article-backward
1574 "d" gnus-summary-mark-as-read-forward
1575 "D" gnus-summary-mark-as-read-backward
1576 "E" gnus-summary-mark-as-expirable
1577 "\M-u" gnus-summary-clear-mark-forward
1578 "\M-U" gnus-summary-clear-mark-backward
1579 "k" gnus-summary-kill-same-subject-and-select
1580 "\C-k" gnus-summary-kill-same-subject
1581 "\M-\C-k" gnus-summary-kill-thread
1582 "\M-\C-l" gnus-summary-lower-thread
1583 "e" gnus-summary-edit-article
1584 "#" gnus-summary-mark-as-processable
1585 "\M-#" gnus-summary-unmark-as-processable
1586 "\M-\C-t" gnus-summary-toggle-threads
1587 "\M-\C-s" gnus-summary-show-thread
1588 "\M-\C-h" gnus-summary-hide-thread
1589 "\M-\C-f" gnus-summary-next-thread
1590 "\M-\C-b" gnus-summary-prev-thread
1591 [(meta down)] gnus-summary-next-thread
1592 [(meta up)] gnus-summary-prev-thread
1593 "\M-\C-u" gnus-summary-up-thread
1594 "\M-\C-d" gnus-summary-down-thread
1595 "&" gnus-summary-execute-command
1596 "c" gnus-summary-catchup-and-exit
1597 "\C-w" gnus-summary-mark-region-as-read
1598 "\C-t" gnus-summary-toggle-truncation
1599 "?" gnus-summary-mark-as-dormant
1600 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1601 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1602 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1603 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1604 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1605 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1606 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1607 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1608 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1609 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1610 "=" gnus-summary-expand-window
1611 "\C-x\C-s" gnus-summary-reselect-current-group
1612 "\M-g" gnus-summary-rescan-group
1613 "w" gnus-summary-stop-page-breaking
1614 "\C-c\C-r" gnus-summary-caesar-message
1615 "\M-t" gnus-summary-toggle-mime
1616 "f" gnus-summary-followup
1617 "F" gnus-summary-followup-with-original
1618 "C" gnus-summary-cancel-article
1619 "r" gnus-summary-reply
1620 "R" gnus-summary-reply-with-original
1621 "\C-c\C-f" gnus-summary-mail-forward
1622 "o" gnus-summary-save-article
1623 "\C-o" gnus-summary-save-article-mail
1624 "|" gnus-summary-pipe-output
1625 "\M-k" gnus-summary-edit-local-kill
1626 "\M-K" gnus-summary-edit-global-kill
1628 "\C-c\C-d" gnus-summary-describe-group
1629 "q" gnus-summary-exit
1630 "Q" gnus-summary-exit-no-update
1631 "\C-c\C-i" gnus-info-find-node
1632 gnus-mouse-2 gnus-mouse-pick-article
1633 "m" gnus-summary-mail-other-window
1634 "a" gnus-summary-post-news
1635 "i" gnus-summary-news-other-window
1636 "x" gnus-summary-limit-to-unread
1637 "s" gnus-summary-isearch-article
1638 "t" gnus-summary-toggle-header
1639 "g" gnus-summary-show-article
1640 "l" gnus-summary-goto-last-article
1641 "v" gnus-summary-preview-mime-message
1642 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1643 "\C-d" gnus-summary-enter-digest-group
1644 "\M-\C-d" gnus-summary-read-document
1645 "\M-\C-e" gnus-summary-edit-parameters
1646 "\M-\C-a" gnus-summary-customize-parameters
1648 "\C-c\C-n" gnus-namazu-search
1649 "*" gnus-cache-enter-article
1650 "\M-*" gnus-cache-remove-article
1651 "\M-&" gnus-summary-universal-argument
1652 "\C-l" gnus-recenter
1653 "I" gnus-summary-increase-score
1654 "L" gnus-summary-lower-score
1655 "\M-i" gnus-symbolic-argument
1656 "h" gnus-summary-select-article-buffer
1658 "V" gnus-summary-score-map
1659 "X" gnus-uu-extract-map
1660 "S" gnus-summary-send-map)
1662 ;; Sort of orthogonal keymap
1663 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1664 "t" gnus-summary-tick-article-forward
1665 "!" gnus-summary-tick-article-forward
1666 "d" gnus-summary-mark-as-read-forward
1667 "r" gnus-summary-mark-as-read-forward
1668 "c" gnus-summary-clear-mark-forward
1669 " " gnus-summary-clear-mark-forward
1670 "e" gnus-summary-mark-as-expirable
1671 "x" gnus-summary-mark-as-expirable
1672 "?" gnus-summary-mark-as-dormant
1673 "b" gnus-summary-set-bookmark
1674 "B" gnus-summary-remove-bookmark
1675 "#" gnus-summary-mark-as-processable
1676 "\M-#" gnus-summary-unmark-as-processable
1677 "S" gnus-summary-limit-include-expunged
1678 "C" gnus-summary-catchup
1679 "H" gnus-summary-catchup-to-here
1680 "h" gnus-summary-catchup-from-here
1681 "\C-c" gnus-summary-catchup-all
1682 "k" gnus-summary-kill-same-subject-and-select
1683 "K" gnus-summary-kill-same-subject
1684 "P" gnus-uu-mark-map)
1686 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1687 "c" gnus-summary-clear-above
1688 "u" gnus-summary-tick-above
1689 "m" gnus-summary-mark-above
1690 "k" gnus-summary-kill-below)
1692 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1693 "/" gnus-summary-limit-to-subject
1694 "n" gnus-summary-limit-to-articles
1695 "w" gnus-summary-pop-limit
1696 "s" gnus-summary-limit-to-subject
1697 "a" gnus-summary-limit-to-author
1698 "u" gnus-summary-limit-to-unread
1699 "m" gnus-summary-limit-to-marks
1700 "M" gnus-summary-limit-exclude-marks
1701 "v" gnus-summary-limit-to-score
1702 "*" gnus-summary-limit-include-cached
1703 "D" gnus-summary-limit-include-dormant
1704 "T" gnus-summary-limit-include-thread
1705 "d" gnus-summary-limit-exclude-dormant
1706 "t" gnus-summary-limit-to-age
1707 "." gnus-summary-limit-to-unseen
1708 "x" gnus-summary-limit-to-extra
1709 "p" gnus-summary-limit-to-display-predicate
1710 "E" gnus-summary-limit-include-expunged
1711 "c" gnus-summary-limit-exclude-childless-dormant
1712 "C" gnus-summary-limit-mark-excluded-as-read
1713 "o" gnus-summary-insert-old-articles
1714 "N" gnus-summary-insert-new-articles)
1716 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1717 "n" gnus-summary-next-unread-article
1718 "p" gnus-summary-prev-unread-article
1719 "N" gnus-summary-next-article
1720 "P" gnus-summary-prev-article
1721 "\C-n" gnus-summary-next-same-subject
1722 "\C-p" gnus-summary-prev-same-subject
1723 "\M-n" gnus-summary-next-unread-subject
1724 "\M-p" gnus-summary-prev-unread-subject
1725 "f" gnus-summary-first-unread-article
1726 "b" gnus-summary-best-unread-article
1727 "j" gnus-summary-goto-article
1728 "g" gnus-summary-goto-subject
1729 "l" gnus-summary-goto-last-article
1730 "o" gnus-summary-pop-article)
1732 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1733 "k" gnus-summary-kill-thread
1734 "l" gnus-summary-lower-thread
1735 "i" gnus-summary-raise-thread
1736 "T" gnus-summary-toggle-threads
1737 "t" gnus-summary-rethread-current
1738 "^" gnus-summary-reparent-thread
1739 "s" gnus-summary-show-thread
1740 "S" gnus-summary-show-all-threads
1741 "h" gnus-summary-hide-thread
1742 "H" gnus-summary-hide-all-threads
1743 "n" gnus-summary-next-thread
1744 "p" gnus-summary-prev-thread
1745 "u" gnus-summary-up-thread
1746 "o" gnus-summary-top-thread
1747 "d" gnus-summary-down-thread
1748 "#" gnus-uu-mark-thread
1749 "\M-#" gnus-uu-unmark-thread)
1751 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1752 "g" gnus-summary-prepare
1753 "c" gnus-summary-insert-cached-articles
1754 "d" gnus-summary-insert-dormant-articles)
1756 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1757 "c" gnus-summary-catchup-and-exit
1758 "C" gnus-summary-catchup-all-and-exit
1759 "E" gnus-summary-exit-no-update
1760 "J" gnus-summary-jump-to-other-group
1761 "Q" gnus-summary-exit
1762 "Z" gnus-summary-exit
1763 "n" gnus-summary-catchup-and-goto-next-group
1764 "R" gnus-summary-reselect-current-group
1765 "G" gnus-summary-rescan-group
1766 "N" gnus-summary-next-group
1767 "s" gnus-summary-save-newsrc
1768 "P" gnus-summary-prev-group)
1770 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1771 " " gnus-summary-next-page
1772 "n" gnus-summary-next-page
1773 "\177" gnus-summary-prev-page
1774 [delete] gnus-summary-prev-page
1775 "p" gnus-summary-prev-page
1776 "\r" gnus-summary-scroll-up
1777 "\M-\r" gnus-summary-scroll-down
1778 "<" gnus-summary-beginning-of-article
1779 ">" gnus-summary-end-of-article
1780 "b" gnus-summary-beginning-of-article
1781 "e" gnus-summary-end-of-article
1782 "^" gnus-summary-refer-parent-article
1783 "r" gnus-summary-refer-parent-article
1784 "D" gnus-summary-enter-digest-group
1785 "R" gnus-summary-refer-references
1786 "T" gnus-summary-refer-thread
1787 "g" gnus-summary-show-article
1788 "s" gnus-summary-isearch-article
1789 "P" gnus-summary-print-article
1790 "M" gnus-mailing-list-insinuate
1791 "t" gnus-article-babel)
1793 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1794 "b" gnus-article-add-buttons
1795 "B" gnus-article-add-buttons-to-head
1796 "o" gnus-article-treat-overstrike
1797 "e" gnus-article-emphasize
1798 "w" gnus-article-fill-cited-article
1799 "Q" gnus-article-fill-long-lines
1800 "C" gnus-article-capitalize-sentences
1801 "c" gnus-article-remove-cr
1802 "Z" gnus-article-decode-HZ
1803 "h" gnus-article-wash-html
1804 "u" gnus-article-unsplit-urls
1805 "f" gnus-article-display-x-face
1806 "l" gnus-summary-stop-page-breaking
1807 "r" gnus-summary-caesar-message
1808 "m" gnus-summary-morse-message
1809 "t" gnus-summary-toggle-header
1810 "g" gnus-treat-smiley
1811 "v" gnus-summary-verbose-headers
1812 "m" gnus-summary-toggle-mime
1813 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1814 "p" gnus-article-verify-x-pgp-sig
1815 "d" gnus-article-treat-dumbquotes
1816 "k" gnus-article-outlook-deuglify-article) ;; mnemonic: outloo*k*
1818 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1819 ;; mnemonic: deuglif*Y*
1820 "u" gnus-outlook-unwrap-lines
1821 "a" gnus-outlook-repair-attribution
1822 "c" gnus-outlook-rearrange-citation
1823 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1825 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1826 "a" gnus-article-hide
1827 "h" gnus-article-hide-headers
1828 "b" gnus-article-hide-boring-headers
1829 "s" gnus-article-hide-signature
1830 "c" gnus-article-hide-citation
1831 "C" gnus-article-hide-citation-in-followups
1832 "l" gnus-article-hide-list-identifiers
1833 "p" gnus-article-hide-pgp
1834 "B" gnus-article-strip-banner
1835 "P" gnus-article-hide-pem
1836 "\C-c" gnus-article-hide-citation-maybe)
1838 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1839 "a" gnus-article-highlight
1840 "h" gnus-article-highlight-headers
1841 "c" gnus-article-highlight-citation
1842 "s" gnus-article-highlight-signature)
1844 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1845 "f" gnus-article-treat-fold-headers
1846 "u" gnus-article-treat-unfold-headers
1847 "n" gnus-article-treat-fold-newsgroups)
1849 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1850 "x" gnus-article-display-x-face
1851 "s" gnus-treat-smiley
1852 "D" gnus-article-remove-images
1853 "f" gnus-treat-from-picon
1854 "m" gnus-treat-mail-picon
1855 "n" gnus-treat-newsgroups-picon)
1857 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1858 "z" gnus-article-date-ut
1859 "u" gnus-article-date-ut
1860 "l" gnus-article-date-local
1861 "p" gnus-article-date-english
1862 "e" gnus-article-date-lapsed
1863 "o" gnus-article-date-original
1864 "i" gnus-article-date-iso8601
1865 "s" gnus-article-date-user)
1867 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1868 "t" gnus-article-remove-trailing-blank-lines
1869 "l" gnus-article-strip-leading-blank-lines
1870 "m" gnus-article-strip-multiple-blank-lines
1871 "a" gnus-article-strip-blank-lines
1872 "A" gnus-article-strip-all-blank-lines
1873 "s" gnus-article-strip-leading-space
1874 "e" gnus-article-strip-trailing-space
1875 "w" gnus-article-remove-leading-whitespace)
1877 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1879 "f" gnus-summary-fetch-faq
1880 "d" gnus-summary-describe-group
1881 "h" gnus-summary-describe-briefly
1882 "i" gnus-info-find-node
1883 "c" gnus-group-fetch-charter
1884 "C" gnus-group-fetch-control)
1886 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1887 "e" gnus-summary-expire-articles
1888 "\M-\C-e" gnus-summary-expire-articles-now
1889 "\177" gnus-summary-delete-article
1890 [delete] gnus-summary-delete-article
1891 [backspace] gnus-summary-delete-article
1892 "m" gnus-summary-move-article
1893 "r" gnus-summary-respool-article
1894 "w" gnus-summary-edit-article
1895 "c" gnus-summary-copy-article
1896 "B" gnus-summary-crosspost-article
1897 "q" gnus-summary-respool-query
1898 "t" gnus-summary-respool-trace
1899 "i" gnus-summary-import-article
1900 "I" gnus-summary-create-article
1901 "p" gnus-summary-article-posted-p)
1903 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1904 "o" gnus-summary-save-article
1905 "m" gnus-summary-save-article-mail
1906 "F" gnus-summary-write-article-file
1907 "r" gnus-summary-save-article-rmail
1908 "f" gnus-summary-save-article-file
1909 "b" gnus-summary-save-article-body-file
1910 "h" gnus-summary-save-article-folder
1911 "v" gnus-summary-save-article-vm
1912 "p" gnus-summary-pipe-output
1913 "P" gnus-summary-muttprint
1914 "s" gnus-soup-add-article)
1916 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1917 "b" gnus-summary-display-buttonized
1918 "m" gnus-summary-repair-multipart
1919 "v" gnus-article-view-part
1920 "o" gnus-article-save-part
1921 "c" gnus-article-copy-part
1922 "C" gnus-article-view-part-as-charset
1923 "e" gnus-article-view-part-externally
1924 "E" gnus-article-encrypt-body
1925 "i" gnus-article-inline-part
1926 "|" gnus-article-pipe-part)
1928 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
1929 "p" gnus-summary-mark-as-processable
1930 "u" gnus-summary-unmark-as-processable
1931 "U" gnus-summary-unmark-all-processable
1932 "v" gnus-uu-mark-over
1933 "s" gnus-uu-mark-series
1934 "r" gnus-uu-mark-region
1935 "g" gnus-uu-unmark-region
1936 "R" gnus-uu-mark-by-regexp
1937 "G" gnus-uu-unmark-by-regexp
1938 "t" gnus-uu-mark-thread
1939 "T" gnus-uu-unmark-thread
1940 "a" gnus-uu-mark-all
1941 "b" gnus-uu-mark-buffer
1942 "S" gnus-uu-mark-sparse
1943 "k" gnus-summary-kill-process-mark
1944 "y" gnus-summary-yank-process-mark
1945 "w" gnus-summary-save-process-mark
1946 "i" gnus-uu-invert-processable)
1948 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
1949 ;;"x" gnus-uu-extract-any
1950 "m" gnus-summary-save-parts
1951 "u" gnus-uu-decode-uu
1952 "U" gnus-uu-decode-uu-and-save
1953 "s" gnus-uu-decode-unshar
1954 "S" gnus-uu-decode-unshar-and-save
1955 "o" gnus-uu-decode-save
1956 "O" gnus-uu-decode-save
1957 "b" gnus-uu-decode-binhex
1958 "B" gnus-uu-decode-binhex
1959 "p" gnus-uu-decode-postscript
1960 "P" gnus-uu-decode-postscript-and-save)
1963 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
1964 "u" gnus-uu-decode-uu-view
1965 "U" gnus-uu-decode-uu-and-save-view
1966 "s" gnus-uu-decode-unshar-view
1967 "S" gnus-uu-decode-unshar-and-save-view
1968 "o" gnus-uu-decode-save-view
1969 "O" gnus-uu-decode-save-view
1970 "b" gnus-uu-decode-binhex-view
1971 "B" gnus-uu-decode-binhex-view
1972 "p" gnus-uu-decode-postscript-view
1973 "P" gnus-uu-decode-postscript-and-save-view))
1975 (defvar gnus-article-post-menu nil)
1977 (defconst gnus-summary-menu-maxlen 20)
1979 (defun gnus-summary-menu-split (menu)
1980 ;; If we have lots of elements, divide them into groups of 20
1981 ;; and make a pane (or submenu) for each one.
1982 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
1983 (let ((menu menu) sublists next
1986 ;; Pull off the next gnus-summary-menu-maxlen elements
1987 ;; and make them the next element of sublist.
1988 (setq next (nthcdr gnus-summary-menu-maxlen menu))
1990 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
1992 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
1993 (aref (car (last menu)) 0)) menu)
1997 (nreverse sublists))
1998 ;; Few elements--put them all in one pane.
2001 (defun gnus-summary-make-menu-bar ()
2002 (gnus-turn-off-edit-menu 'summary)
2004 (unless (boundp 'gnus-summary-misc-menu)
2007 gnus-summary-kill-menu gnus-summary-mode-map ""
2012 ["Customize" gnus-score-customize t])
2013 (gnus-make-score-map 'increase)
2014 (gnus-make-score-map 'lower)
2016 ["Kill below" gnus-summary-kill-below t]
2017 ["Mark above" gnus-summary-mark-above t]
2018 ["Tick above" gnus-summary-tick-above t]
2019 ["Clear above" gnus-summary-clear-above t])
2020 ["Current score" gnus-summary-current-score t]
2021 ["Set score" gnus-summary-set-score t]
2022 ["Switch current score file..." gnus-score-change-score-file t]
2023 ["Set mark below..." gnus-score-set-mark-below t]
2024 ["Set expunge below..." gnus-score-set-expunge-below t]
2025 ["Edit current score file" gnus-score-edit-current-scores t]
2026 ["Edit score file" gnus-score-edit-file t]
2027 ["Trace score" gnus-score-find-trace t]
2028 ["Find words" gnus-score-find-favourite-words t]
2029 ["Rescore buffer" gnus-summary-rescore t]
2030 ["Increase score..." gnus-summary-increase-score t]
2031 ["Lower score..." gnus-summary-lower-score t]))))
2033 ;; Define both the Article menu in the summary buffer and the
2034 ;; equivalent Commands menu in the article buffer here for
2038 ["All" gnus-article-hide t]
2039 ["Headers" gnus-article-hide-headers t]
2040 ["Signature" gnus-article-hide-signature t]
2041 ["Citation" gnus-article-hide-citation t]
2042 ["List identifiers" gnus-article-hide-list-identifiers t]
2043 ["PGP" gnus-article-hide-pgp t]
2044 ["Banner" gnus-article-strip-banner t]
2045 ["Boring headers" gnus-article-hide-boring-headers t])
2047 ["All" gnus-article-highlight t]
2048 ["Headers" gnus-article-highlight-headers t]
2049 ["Signature" gnus-article-highlight-signature t]
2050 ["Citation" gnus-article-highlight-citation t])
2052 ["Local" gnus-article-date-local t]
2053 ["ISO8601" gnus-article-date-iso8601 t]
2054 ["UT" gnus-article-date-ut t]
2055 ["Original" gnus-article-date-original t]
2056 ["Lapsed" gnus-article-date-lapsed t]
2057 ["User-defined" gnus-article-date-user t])
2059 ["Remove images" gnus-article-remove-images t]
2060 ["Toggle smiley" gnus-treat-smiley t]
2061 ["Show X-Face" gnus-article-display-x-face t]
2062 ["Show picons in From" gnus-treat-from-picon t]
2063 ["Show picons in mail headers" gnus-treat-mail-picon t]
2064 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2065 ("View as different encoding"
2066 ,@(gnus-summary-menu-split
2069 ;; Since easymenu under FSF Emacs doesn't allow lambda
2070 ;; forms for menu commands, we should provide intern'ed
2071 ;; function symbols.
2072 (let ((command (intern (format "\
2073 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2077 (let ((gnus-summary-show-article-charset-alist
2079 (gnus-summary-show-article 1))))
2080 `[,(symbol-name cs) ,command t]))
2081 (sort (if (fboundp 'coding-system-list)
2082 (coding-system-list)
2083 ;;(mapcar 'car mm-mime-mule-charset-alist)
2088 ["Leading" gnus-article-strip-leading-blank-lines t]
2089 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2090 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2091 ["All of the above" gnus-article-strip-blank-lines t]
2092 ["All" gnus-article-strip-all-blank-lines t]
2093 ["Leading space" gnus-article-strip-leading-space t]
2094 ["Trailing space" gnus-article-strip-trailing-space t]
2095 ["Leading space in headers"
2096 gnus-article-remove-leading-whitespace t])
2097 ["Overstrike" gnus-article-treat-overstrike t]
2098 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2099 ["Emphasis" gnus-article-emphasize t]
2100 ["Word wrap" gnus-article-fill-cited-article t]
2101 ["Fill long lines" gnus-article-fill-long-lines t]
2102 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2103 ["CR" gnus-article-remove-cr t]
2104 ["Rot 13" gnus-summary-caesar-message
2105 ,@(if (featurep 'xemacs) '(t)
2106 '(:help "\"Caesar rotate\" article by 13"))]
2107 ["Morse decode" gnus-summary-morse-message t]
2108 ["Unix pipe..." gnus-summary-pipe-message t]
2109 ["Add buttons" gnus-article-add-buttons t]
2110 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2111 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2112 ["Toggle MIME" gnus-summary-toggle-mime t]
2113 ["Verbose header" gnus-summary-verbose-headers t]
2114 ["Toggle header" gnus-summary-toggle-header t]
2115 ["Unfold headers" gnus-article-treat-unfold-headers t]
2116 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2117 ["Html" gnus-article-wash-html t]
2118 ["URLs" gnus-article-unsplit-urls t]
2119 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2120 ["HZ" gnus-article-decode-HZ t]
2121 ("(Outlook) Deuglify"
2122 ["Unwrap lines" gnus-outlook-unwrap-lines t]
2123 ["Repair attribution" gnus-outlook-repair-attribution t]
2124 ["Rearrange citation" gnus-outlook-rearrange-citation t]
2125 ["Full (Outlook) deuglify"
2126 gnus-article-outlook-deuglify-article t])
2129 ["Save in default format" gnus-summary-save-article
2130 ,@(if (featurep 'xemacs) '(t)
2131 '(:help "Save article using default method"))]
2132 ["Save in file" gnus-summary-save-article-file
2133 ,@(if (featurep 'xemacs) '(t)
2134 '(:help "Save article in file"))]
2135 ["Save in Unix mail format" gnus-summary-save-article-mail t]
2136 ["Save in MH folder" gnus-summary-save-article-folder t]
2137 ["Save in VM folder" gnus-summary-save-article-vm t]
2138 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
2139 ["Save body in file" gnus-summary-save-article-body-file t]
2140 ["Pipe through a filter" gnus-summary-pipe-output t]
2141 ["Add to SOUP packet" gnus-soup-add-article t]
2142 ["Print with Muttprint" gnus-summary-muttprint t]
2143 ["Print" gnus-summary-print-article t])
2145 ["Respool article..." gnus-summary-respool-article t]
2146 ["Move article..." gnus-summary-move-article
2147 (gnus-check-backend-function
2148 'request-move-article gnus-newsgroup-name)]
2149 ["Copy article..." gnus-summary-copy-article t]
2150 ["Crosspost article..." gnus-summary-crosspost-article
2151 (gnus-check-backend-function
2152 'request-replace-article gnus-newsgroup-name)]
2153 ["Import file..." gnus-summary-import-article t]
2154 ["Create article..." gnus-summary-create-article t]
2155 ["Check if posted" gnus-summary-article-posted-p t]
2156 ["Edit article" gnus-summary-edit-article
2157 (not (gnus-group-read-only-p))]
2158 ["Delete article" gnus-summary-delete-article
2159 (gnus-check-backend-function
2160 'request-expire-articles gnus-newsgroup-name)]
2161 ["Query respool" gnus-summary-respool-query t]
2162 ["Trace respool" gnus-summary-respool-trace t]
2163 ["Delete expirable articles" gnus-summary-expire-articles-now
2164 (gnus-check-backend-function
2165 'request-expire-articles gnus-newsgroup-name)])
2167 ["Uudecode" gnus-uu-decode-uu
2168 ,@(if (featurep 'xemacs) '(t)
2169 '(:help "Decode uuencoded article(s)"))]
2170 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2171 ["Unshar" gnus-uu-decode-unshar t]
2172 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2173 ["Save" gnus-uu-decode-save t]
2174 ["Binhex" gnus-uu-decode-binhex t]
2175 ["Postscript" gnus-uu-decode-postscript t])
2177 ["Enter article" gnus-cache-enter-article t]
2178 ["Remove article" gnus-cache-remove-article t])
2179 ["Translate" gnus-article-babel t]
2180 ["Select article buffer" gnus-summary-select-article-buffer t]
2181 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2182 ["Isearch article..." gnus-summary-isearch-article t]
2183 ["Beginning of the article" gnus-summary-beginning-of-article t]
2184 ["End of the article" gnus-summary-end-of-article t]
2185 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2186 ["Fetch referenced articles" gnus-summary-refer-references t]
2187 ["Fetch current thread" gnus-summary-refer-thread t]
2188 ["Fetch article with id..." gnus-summary-refer-article t]
2189 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2190 ["Redisplay" gnus-summary-show-article t]
2191 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2193 gnus-summary-article-menu gnus-summary-mode-map ""
2194 (cons "Article" innards))
2196 (if (not (keymapp gnus-summary-article-menu))
2198 gnus-article-commands-menu gnus-article-mode-map ""
2199 (cons "Commands" innards))
2200 ;; in Emacs, don't share menu.
2201 (setq gnus-article-commands-menu
2202 (copy-keymap gnus-summary-article-menu))
2203 (define-key gnus-article-mode-map [menu-bar commands]
2204 (cons "Commands" gnus-article-commands-menu))))
2207 gnus-summary-thread-menu gnus-summary-mode-map ""
2209 ["Find all messages in thread" gnus-summary-refer-thread t]
2210 ["Toggle threading" gnus-summary-toggle-threads t]
2211 ["Hide threads" gnus-summary-hide-all-threads t]
2212 ["Show threads" gnus-summary-show-all-threads t]
2213 ["Hide thread" gnus-summary-hide-thread t]
2214 ["Show thread" gnus-summary-show-thread t]
2215 ["Go to next thread" gnus-summary-next-thread t]
2216 ["Go to previous thread" gnus-summary-prev-thread t]
2217 ["Go down thread" gnus-summary-down-thread t]
2218 ["Go up thread" gnus-summary-up-thread t]
2219 ["Top of thread" gnus-summary-top-thread t]
2220 ["Mark thread as read" gnus-summary-kill-thread t]
2221 ["Lower thread score" gnus-summary-lower-thread t]
2222 ["Raise thread score" gnus-summary-raise-thread t]
2223 ["Rethread current" gnus-summary-rethread-current t]))
2226 gnus-summary-post-menu gnus-summary-mode-map ""
2228 ["Send a message (mail or news)" gnus-summary-post-news
2229 ,@(if (featurep 'xemacs) '(t)
2230 '(:help "Post an article"))]
2231 ["Followup" gnus-summary-followup
2232 ,@(if (featurep 'xemacs) '(t)
2233 '(:help "Post followup to this article"))]
2234 ["Followup and yank" gnus-summary-followup-with-original
2235 ,@(if (featurep 'xemacs) '(t)
2236 '(:help "Post followup to this article, quoting its contents"))]
2237 ["Supersede article" gnus-summary-supersede-article t]
2238 ["Cancel article" gnus-summary-cancel-article
2239 ,@(if (featurep 'xemacs) '(t)
2240 '(:help "Cancel an article you posted"))]
2241 ["Reply" gnus-summary-reply t]
2242 ["Reply and yank" gnus-summary-reply-with-original t]
2243 ["Wide reply" gnus-summary-wide-reply t]
2244 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2245 ,@(if (featurep 'xemacs) '(t)
2246 '(:help "Mail a reply, quoting this article"))]
2247 ["Very wide reply" gnus-summary-very-wide-reply t]
2248 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2249 ,@(if (featurep 'xemacs) '(t)
2250 '(:help "Mail a very wide reply, quoting this article"))]
2251 ["Mail forward" gnus-summary-mail-forward t]
2252 ["Post forward" gnus-summary-post-forward t]
2253 ["Digest and mail" gnus-summary-digest-mail-forward t]
2254 ["Digest and post" gnus-summary-digest-post-forward t]
2255 ["Resend message" gnus-summary-resend-message t]
2256 ["Resend message edit" gnus-summary-resend-message-edit t]
2257 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2258 ["Send a mail" gnus-summary-mail-other-window t]
2259 ["Create a local message" gnus-summary-news-other-window t]
2260 ["Uuencode and post" gnus-uu-post-news
2261 ,@(if (featurep 'xemacs) '(t)
2262 '(:help "Post a uuencoded article"))]
2263 ["Followup via news" gnus-summary-followup-to-mail t]
2264 ["Followup via news and yank"
2265 gnus-summary-followup-to-mail-with-original t]
2267 ;;["Send" gnus-summary-send-draft t]
2268 ;;["Send bounced" gnus-resend-bounced-mail t])
2272 ((not (keymapp gnus-summary-post-menu))
2273 (setq gnus-article-post-menu gnus-summary-post-menu))
2274 ((not gnus-article-post-menu)
2275 ;; Don't share post menu.
2276 (setq gnus-article-post-menu
2277 (copy-keymap gnus-summary-post-menu))))
2278 (define-key gnus-article-mode-map [menu-bar post]
2279 (cons "Post" gnus-article-post-menu))
2282 gnus-summary-misc-menu gnus-summary-mode-map ""
2285 ["Mark as read" gnus-summary-mark-as-read-forward t]
2286 ["Mark same subject and select"
2287 gnus-summary-kill-same-subject-and-select t]
2288 ["Mark same subject" gnus-summary-kill-same-subject t]
2289 ["Catchup" gnus-summary-catchup
2290 ,@(if (featurep 'xemacs) '(t)
2291 '(:help "Mark unread articles in this group as read"))]
2292 ["Catchup all" gnus-summary-catchup-all t]
2293 ["Catchup to here" gnus-summary-catchup-to-here t]
2294 ["Catchup from here" gnus-summary-catchup-from-here t]
2295 ["Catchup region" gnus-summary-mark-region-as-read t]
2296 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2298 ["Tick" gnus-summary-tick-article-forward t]
2299 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2300 ["Remove marks" gnus-summary-clear-mark-forward t]
2301 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2302 ["Set bookmark" gnus-summary-set-bookmark t]
2303 ["Remove bookmark" gnus-summary-remove-bookmark t])
2305 ["Marks..." gnus-summary-limit-to-marks t]
2306 ["Subject..." gnus-summary-limit-to-subject t]
2307 ["Author..." gnus-summary-limit-to-author t]
2308 ["Age..." gnus-summary-limit-to-age t]
2309 ["Extra..." gnus-summary-limit-to-extra t]
2310 ["Score..." gnus-summary-limit-to-score t]
2311 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2312 ["Unread" gnus-summary-limit-to-unread t]
2313 ["Unseen" gnus-summary-limit-to-unseen t]
2314 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2315 ["Next articles" gnus-summary-limit-to-articles t]
2316 ["Pop limit" gnus-summary-pop-limit t]
2317 ["Show dormant" gnus-summary-limit-include-dormant t]
2318 ["Hide childless dormant"
2319 gnus-summary-limit-exclude-childless-dormant t]
2320 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2321 ["Hide marked" gnus-summary-limit-exclude-marks t]
2322 ["Show expunged" gnus-summary-limit-include-expunged t])
2324 ["Set mark" gnus-summary-mark-as-processable t]
2325 ["Remove mark" gnus-summary-unmark-as-processable t]
2326 ["Remove all marks" gnus-summary-unmark-all-processable t]
2327 ["Mark above" gnus-uu-mark-over t]
2328 ["Mark series" gnus-uu-mark-series t]
2329 ["Mark region" gnus-uu-mark-region t]
2330 ["Unmark region" gnus-uu-unmark-region t]
2331 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2332 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2333 ["Mark all" gnus-uu-mark-all t]
2334 ["Mark buffer" gnus-uu-mark-buffer t]
2335 ["Mark sparse" gnus-uu-mark-sparse t]
2336 ["Mark thread" gnus-uu-mark-thread t]
2337 ["Unmark thread" gnus-uu-unmark-thread t]
2338 ("Process Mark Sets"
2339 ["Kill" gnus-summary-kill-process-mark t]
2340 ["Yank" gnus-summary-yank-process-mark
2341 gnus-newsgroup-process-stack]
2342 ["Save" gnus-summary-save-process-mark t]))
2344 ["Page forward" gnus-summary-next-page
2345 ,@(if (featurep 'xemacs) '(t)
2346 '(:help "Show next page of article"))]
2347 ["Page backward" gnus-summary-prev-page
2348 ,@(if (featurep 'xemacs) '(t)
2349 '(:help "Show previous page of article"))]
2350 ["Line forward" gnus-summary-scroll-up t])
2352 ["Next unread article" gnus-summary-next-unread-article t]
2353 ["Previous unread article" gnus-summary-prev-unread-article t]
2354 ["Next article" gnus-summary-next-article t]
2355 ["Previous article" gnus-summary-prev-article t]
2356 ["Next unread subject" gnus-summary-next-unread-subject t]
2357 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2358 ["Next article same subject" gnus-summary-next-same-subject t]
2359 ["Previous article same subject" gnus-summary-prev-same-subject t]
2360 ["First unread article" gnus-summary-first-unread-article t]
2361 ["Best unread article" gnus-summary-best-unread-article t]
2362 ["Go to subject number..." gnus-summary-goto-subject t]
2363 ["Go to article number..." gnus-summary-goto-article t]
2364 ["Go to the last article" gnus-summary-goto-last-article t]
2365 ["Pop article off history" gnus-summary-pop-article t])
2367 ["Sort by number" gnus-summary-sort-by-number t]
2368 ["Sort by author" gnus-summary-sort-by-author t]
2369 ["Sort by subject" gnus-summary-sort-by-subject t]
2370 ["Sort by date" gnus-summary-sort-by-date t]
2371 ["Sort by score" gnus-summary-sort-by-score t]
2372 ["Sort by lines" gnus-summary-sort-by-lines t]
2373 ["Sort by characters" gnus-summary-sort-by-chars t]
2374 ["Randomize" gnus-summary-sort-by-random t]
2375 ["Original sort" gnus-summary-sort-by-original t])
2377 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2378 ["Describe group" gnus-summary-describe-group t]
2379 ["Fetch charter" gnus-group-fetch-charter
2380 ,@(if (featurep 'xemacs) nil
2381 '(:help "Display the charter of the current group"))]
2382 ["Fetch control message" gnus-group-fetch-control
2383 ,@(if (featurep 'xemacs) nil
2384 '(:help "Display the archived control message for the current group"))]
2385 ["Read manual" gnus-info-find-node t])
2387 ["Pick and read" gnus-pick-mode t]
2388 ["Binary" gnus-binary-mode t])
2390 ["Regenerate" gnus-summary-prepare t]
2391 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2392 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2393 ["Toggle threading" gnus-summary-toggle-threads t])
2394 ["See old articles" gnus-summary-insert-old-articles t]
2395 ["See new articles" gnus-summary-insert-new-articles t]
2396 ["Filter articles..." gnus-summary-execute-command t]
2397 ["Run command on subjects..." gnus-summary-universal-argument t]
2398 ["Search articles forward..." gnus-summary-search-article-forward t]
2399 ["Search articles backward..." gnus-summary-search-article-backward t]
2400 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2401 ["Expand window" gnus-summary-expand-window t]
2402 ["Expire expirable articles" gnus-summary-expire-articles
2403 (gnus-check-backend-function
2404 'request-expire-articles gnus-newsgroup-name)]
2405 ["Edit local kill file" gnus-summary-edit-local-kill t]
2406 ["Edit main kill file" gnus-summary-edit-global-kill t]
2407 ["Edit group parameters" gnus-summary-edit-parameters t]
2408 ["Customize group parameters" gnus-summary-customize-parameters t]
2409 ["Send a bug report" gnus-bug t]
2411 ["Catchup and exit" gnus-summary-catchup-and-exit
2412 ,@(if (featurep 'xemacs) '(t)
2413 '(:help "Mark unread articles in this group as read, then exit"))]
2414 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2415 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2416 ["Exit group" gnus-summary-exit
2417 ,@(if (featurep 'xemacs) '(t)
2418 '(:help "Exit current group, return to group selection mode"))]
2419 ["Exit group without updating" gnus-summary-exit-no-update t]
2420 ["Exit and goto next group" gnus-summary-next-group t]
2421 ["Exit and goto prev group" gnus-summary-prev-group t]
2422 ["Reselect group" gnus-summary-reselect-current-group t]
2423 ["Rescan group" gnus-summary-rescan-group t]
2424 ["Update dribble" gnus-summary-save-newsrc t])))
2426 (gnus-run-hooks 'gnus-summary-menu-hook)))
2428 (defvar gnus-summary-tool-bar-map nil)
2430 ;; Emacs 21 tool bar. Should be no-op otherwise.
2431 (defun gnus-summary-make-tool-bar ()
2432 (if (and (fboundp 'tool-bar-add-item-from-menu)
2433 (default-value 'tool-bar-mode)
2434 (not gnus-summary-tool-bar-map))
2435 (setq gnus-summary-tool-bar-map
2436 (let ((tool-bar-map (make-sparse-keymap))
2437 (load-path (mm-image-load-path)))
2438 (tool-bar-add-item-from-menu
2439 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2440 (tool-bar-add-item-from-menu
2441 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2442 (tool-bar-add-item-from-menu
2443 'gnus-summary-post-news "post" gnus-summary-mode-map)
2444 (tool-bar-add-item-from-menu
2445 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2446 (tool-bar-add-item-from-menu
2447 'gnus-summary-followup "followup" gnus-summary-mode-map)
2448 (tool-bar-add-item-from-menu
2449 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2450 (tool-bar-add-item-from-menu
2451 'gnus-summary-reply "reply" gnus-summary-mode-map)
2452 (tool-bar-add-item-from-menu
2453 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2454 (tool-bar-add-item-from-menu
2455 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2456 (tool-bar-add-item-from-menu
2457 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2458 (tool-bar-add-item-from-menu
2459 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2460 (tool-bar-add-item-from-menu
2461 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2462 (tool-bar-add-item-from-menu
2463 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2464 (tool-bar-add-item-from-menu
2465 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2466 (tool-bar-add-item-from-menu
2467 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2469 (if gnus-summary-tool-bar-map
2470 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2472 (defun gnus-score-set-default (var value)
2473 "A version of set that updates the GNU Emacs menu-bar."
2475 ;; It is the message that forces the active status to be updated.
2478 (defun gnus-make-score-map (type)
2479 "Make a summary score map of type TYPE."
2482 (let ((headers '(("author" "from" string)
2483 ("subject" "subject" string)
2484 ("article body" "body" string)
2485 ("article head" "head" string)
2486 ("xref" "xref" string)
2487 ("extra header" "extra" string)
2488 ("lines" "lines" number)
2489 ("followups to author" "followup" string)))
2490 (types '((number ("less than" <)
2493 (string ("substring" s)
2497 (perms '(("temporary" (current-time-string))
2505 (if (eq type 'lower)
2510 (setq header (car headers))
2516 (let ((ts (cdr (assoc (nth 2 header) types)))
2532 'gnus-summary-score-entry
2534 (if (or (string= (nth 1 header)
2536 (string= (nth 1 header)
2539 (list 'gnus-summary-header
2541 (list 'quote (nth 1 (car ts)))
2542 (list 'gnus-score-delta-default
2549 (list (nreverse outp))))
2552 (list (nreverse outt))))
2554 (setq headers (cdr headers)))
2555 (list (nreverse outh))))))))
2559 (defun gnus-summary-mode (&optional group)
2560 "Major mode for reading articles.
2562 All normal editing commands are switched off.
2563 \\<gnus-summary-mode-map>
2564 Each line in this buffer represents one article. To read an
2565 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2566 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2569 You can also post articles and send mail from this buffer. To
2570 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2571 of an article, type `\\[gnus-summary-reply]'.
2573 There are approx. one gazillion commands you can execute in this
2574 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2576 The following commands are available:
2578 \\{gnus-summary-mode-map}"
2580 (kill-all-local-variables)
2581 (when (gnus-visual-p 'summary-menu 'menu)
2582 (gnus-summary-make-menu-bar)
2583 (gnus-summary-make-tool-bar))
2584 (gnus-summary-make-local-variables)
2585 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2586 (gnus-summary-make-local-variables))
2587 (gnus-make-thread-indent-array)
2588 (gnus-simplify-mode-line)
2589 (setq major-mode 'gnus-summary-mode)
2590 (setq mode-name "Summary")
2591 (make-local-variable 'minor-mode-alist)
2592 (use-local-map gnus-summary-mode-map)
2593 (buffer-disable-undo)
2594 (setq buffer-read-only t) ;Disable modification
2595 (setq truncate-lines t)
2596 (setq selective-display t)
2597 (setq selective-display-ellipses t) ;Display `...'
2598 (gnus-summary-set-display-table)
2599 (gnus-set-default-directory)
2600 (setq gnus-newsgroup-name group)
2601 (unless (gnus-news-group-p group)
2602 (setq gnus-newsgroup-incorporated
2603 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2604 (make-local-variable 'gnus-summary-line-format)
2605 (make-local-variable 'gnus-summary-line-format-spec)
2606 (make-local-variable 'gnus-summary-dummy-line-format)
2607 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2608 (make-local-variable 'gnus-summary-mark-positions)
2609 (make-local-hook 'pre-command-hook)
2610 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2611 (gnus-run-hooks 'gnus-summary-mode-hook)
2612 (turn-on-gnus-mailing-list-mode)
2613 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2614 (gnus-update-summary-mark-positions))
2616 (defun gnus-summary-make-local-variables ()
2617 "Make all the local summary buffer variables."
2619 (dolist (local gnus-summary-local-variables)
2622 (if (eq (cdr local) 'global)
2623 ;; Copy the global value of the variable.
2624 (setq global (symbol-value (car local)))
2625 ;; Use the value from the list.
2626 (setq global (eval (cdr local))))
2627 (set (make-local-variable (car local)) global))
2628 ;; Simple nil-valued local variable.
2629 (set (make-local-variable local) nil)))))
2631 (defun gnus-summary-clear-local-variables ()
2632 (let ((locals gnus-summary-local-variables))
2634 (if (consp (car locals))
2635 (and (vectorp (caar locals))
2636 (set (caar locals) nil))
2637 (and (vectorp (car locals))
2638 (set (car locals) nil)))
2639 (setq locals (cdr locals)))))
2641 ;; Summary data functions.
2643 (defmacro gnus-data-number (data)
2646 (defmacro gnus-data-set-number (data number)
2647 `(setcar ,data ,number))
2649 (defmacro gnus-data-mark (data)
2652 (defmacro gnus-data-set-mark (data mark)
2653 `(setcar (nthcdr 1 ,data) ,mark))
2655 (defmacro gnus-data-pos (data)
2658 (defmacro gnus-data-set-pos (data pos)
2659 `(setcar (nthcdr 2 ,data) ,pos))
2661 (defmacro gnus-data-header (data)
2664 (defmacro gnus-data-set-header (data header)
2665 `(setcar (nthcdr 3 ,data) ,header))
2667 (defmacro gnus-data-level (data)
2670 (defmacro gnus-data-unread-p (data)
2671 `(= (nth 1 ,data) gnus-unread-mark))
2673 (defmacro gnus-data-read-p (data)
2674 `(/= (nth 1 ,data) gnus-unread-mark))
2676 (defmacro gnus-data-pseudo-p (data)
2677 `(consp (nth 3 ,data)))
2679 (defmacro gnus-data-find (number)
2680 `(assq ,number gnus-newsgroup-data))
2682 (defmacro gnus-data-find-list (number &optional data)
2683 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2684 (memq (assq ,number bdata)
2687 (defmacro gnus-data-make (number mark pos header level)
2688 `(list ,number ,mark ,pos ,header ,level))
2690 (defun gnus-data-enter (after-article number mark pos header level offset)
2691 (let ((data (gnus-data-find-list after-article)))
2693 (error "No such article: %d" after-article))
2694 (setcdr data (cons (gnus-data-make number mark pos header level)
2696 (setq gnus-newsgroup-data-reverse nil)
2697 (gnus-data-update-list (cddr data) offset)))
2699 (defun gnus-data-enter-list (after-article list &optional offset)
2701 (let ((data (and after-article (gnus-data-find-list after-article)))
2705 (let ((odata gnus-newsgroup-data))
2706 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2708 (gnus-data-update-list odata offset)))
2709 ;; Find the last element in the list to be spliced into the main
2712 (setq list (cdr list)))
2715 (setcdr list gnus-newsgroup-data)
2716 (setq gnus-newsgroup-data ilist)
2718 (gnus-data-update-list (cdr list) offset)))
2719 (setcdr list (cdr data))
2722 (gnus-data-update-list (cdr list) offset))))
2723 (setq gnus-newsgroup-data-reverse nil))))
2725 (defun gnus-data-remove (article &optional offset)
2726 (let ((data gnus-newsgroup-data))
2727 (if (= (gnus-data-number (car data)) article)
2729 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2730 gnus-newsgroup-data-reverse nil)
2732 (gnus-data-update-list gnus-newsgroup-data offset)))
2734 (when (= (gnus-data-number (cadr data)) article)
2735 (setcdr data (cddr data))
2737 (gnus-data-update-list (cdr data) offset))
2739 gnus-newsgroup-data-reverse nil))
2740 (setq data (cdr data))))))
2742 (defmacro gnus-data-list (backward)
2744 (or gnus-newsgroup-data-reverse
2745 (setq gnus-newsgroup-data-reverse
2746 (reverse gnus-newsgroup-data)))
2747 gnus-newsgroup-data))
2749 (defun gnus-data-update-list (data offset)
2750 "Add OFFSET to the POS of all data entries in DATA."
2751 (setq gnus-newsgroup-data-reverse nil)
2753 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2754 (setq data (cdr data))))
2756 (defun gnus-summary-article-pseudo-p (article)
2757 "Say whether this article is a pseudo article or not."
2758 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2760 (defmacro gnus-summary-article-sparse-p (article)
2761 "Say whether this article is a sparse article or not."
2762 `(memq ,article gnus-newsgroup-sparse))
2764 (defmacro gnus-summary-article-ancient-p (article)
2765 "Say whether this article is a sparse article or not."
2766 `(memq ,article gnus-newsgroup-ancient))
2768 (defun gnus-article-parent-p (number)
2769 "Say whether this article is a parent or not."
2770 (let ((data (gnus-data-find-list number)))
2771 (and (cdr data) ; There has to be an article after...
2772 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2773 (gnus-data-level (nth 1 data))))))
2775 (defun gnus-article-children (number)
2776 "Return a list of all children to NUMBER."
2777 (let* ((data (gnus-data-find-list number))
2778 (level (gnus-data-level (car data)))
2780 (setq data (cdr data))
2782 (= (gnus-data-level (car data)) (1+ level)))
2783 (push (gnus-data-number (car data)) children)
2784 (setq data (cdr data)))
2787 (defmacro gnus-summary-skip-intangible ()
2788 "If the current article is intangible, then jump to a different article."
2789 '(let ((to (get-text-property (point) 'gnus-intangible)))
2790 (and to (gnus-summary-goto-subject to))))
2792 (defmacro gnus-summary-article-intangible-p ()
2793 "Say whether this article is intangible or not."
2794 '(get-text-property (point) 'gnus-intangible))
2796 (defun gnus-article-read-p (article)
2797 "Say whether ARTICLE is read or not."
2798 (not (or (memq article gnus-newsgroup-marked)
2799 (memq article gnus-newsgroup-spam-marked)
2800 (memq article gnus-newsgroup-unreads)
2801 (memq article gnus-newsgroup-unselected)
2802 (memq article gnus-newsgroup-dormant))))
2804 ;; Some summary mode macros.
2806 (defmacro gnus-summary-article-number ()
2807 "The article number of the article on the current line.
2808 If there isn't an article number here, then we return the current
2811 (gnus-summary-skip-intangible)
2812 (or (get-text-property (point) 'gnus-number)
2813 (gnus-summary-last-subject))))
2815 (defmacro gnus-summary-article-header (&optional number)
2816 "Return the header of article NUMBER."
2817 `(gnus-data-header (gnus-data-find
2818 ,(or number '(gnus-summary-article-number)))))
2820 (defmacro gnus-summary-thread-level (&optional number)
2821 "Return the level of thread that starts with article NUMBER."
2822 `(if (and (eq gnus-summary-make-false-root 'dummy)
2823 (get-text-property (point) 'gnus-intangible))
2825 (gnus-data-level (gnus-data-find
2826 ,(or number '(gnus-summary-article-number))))))
2828 (defmacro gnus-summary-article-mark (&optional number)
2829 "Return the mark of article NUMBER."
2830 `(gnus-data-mark (gnus-data-find
2831 ,(or number '(gnus-summary-article-number)))))
2833 (defmacro gnus-summary-article-pos (&optional number)
2834 "Return the position of the line of article NUMBER."
2835 `(gnus-data-pos (gnus-data-find
2836 ,(or number '(gnus-summary-article-number)))))
2838 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2839 (defmacro gnus-summary-article-subject (&optional number)
2840 "Return current subject string or nil if nothing."
2843 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2844 '(gnus-data-header (assq (gnus-summary-article-number)
2845 gnus-newsgroup-data)))))
2848 (mail-header-subject headers))))
2850 (defmacro gnus-summary-article-score (&optional number)
2851 "Return current article score."
2852 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2853 gnus-newsgroup-scored))
2854 gnus-summary-default-score 0))
2856 (defun gnus-summary-article-children (&optional number)
2857 "Return a list of article numbers that are children of article NUMBER."
2858 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2859 (level (gnus-data-level (car data)))
2861 (while (and (setq data (cdr data))
2862 (> (setq l (gnus-data-level (car data))) level))
2863 (and (= (1+ level) l)
2864 (push (gnus-data-number (car data))
2866 (nreverse children)))
2868 (defun gnus-summary-article-parent (&optional number)
2869 "Return the article number of the parent of article NUMBER."
2870 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2871 (gnus-data-list t)))
2872 (level (gnus-data-level (car data))))
2874 () ; This is a root.
2875 ;; We search until we find an article with a level less than
2876 ;; this one. That function has to be the parent.
2877 (while (and (setq data (cdr data))
2878 (not (< (gnus-data-level (car data)) level))))
2879 (and data (gnus-data-number (car data))))))
2881 (defun gnus-unread-mark-p (mark)
2882 "Say whether MARK is the unread mark."
2883 (= mark gnus-unread-mark))
2885 (defun gnus-read-mark-p (mark)
2886 "Say whether MARK is one of the marks that mark as read.
2887 This is all marks except unread, ticked, dormant, and expirable."
2888 (not (or (= mark gnus-unread-mark)
2889 (= mark gnus-ticked-mark)
2890 (= mark gnus-spam-mark)
2891 (= mark gnus-dormant-mark)
2892 (= mark gnus-expirable-mark))))
2894 (defmacro gnus-article-mark (number)
2895 "Return the MARK of article NUMBER.
2896 This macro should only be used when computing the mark the \"first\"
2897 time; i.e., when generating the summary lines. After that,
2898 `gnus-summary-article-mark' should be used to examine the
2901 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2902 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2903 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2904 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2905 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
2906 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2907 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2908 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2909 gnus-ancient-mark))))
2911 ;; Saving hidden threads.
2913 (defmacro gnus-save-hidden-threads (&rest forms)
2914 "Save hidden threads, eval FORMS, and restore the hidden threads."
2915 (let ((config (make-symbol "config")))
2916 `(let ((,config (gnus-hidden-threads-configuration)))
2920 (gnus-restore-hidden-threads-configuration ,config)))))
2921 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2922 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2924 (defun gnus-data-compute-positions ()
2925 "Compute the positions of all articles."
2926 (setq gnus-newsgroup-data-reverse nil)
2927 (let ((data gnus-newsgroup-data))
2929 (gnus-save-hidden-threads
2930 (gnus-summary-show-all-threads)
2931 (goto-char (point-min))
2933 (while (get-text-property (point) 'gnus-intangible)
2935 (gnus-data-set-pos (car data) (+ (point) 3))
2936 (setq data (cdr data))
2937 (forward-line 1))))))
2939 (defun gnus-hidden-threads-configuration ()
2940 "Return the current hidden threads configuration."
2943 (goto-char (point-min))
2944 (while (search-forward "\r" nil t)
2945 (push (1- (point)) config))
2948 (defun gnus-restore-hidden-threads-configuration (config)
2949 "Restore hidden threads configuration from CONFIG."
2951 (let (point buffer-read-only)
2952 (while (setq point (pop config))
2953 (when (and (< point (point-max))
2955 (eq (char-after) ?\n))
2956 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2958 ;; Various summary mode internalish functions.
2960 (defun gnus-mouse-pick-article (e)
2963 (gnus-summary-next-page nil t))
2965 (defun gnus-summary-set-display-table ()
2966 "Change the display table.
2967 Odd characters have a tendency to mess
2968 up nicely formatted displays - we make all possible glyphs
2969 display only a single character."
2971 ;; We start from the standard display table, if any.
2972 (let ((table (or (copy-sequence standard-display-table)
2973 (make-display-table)))
2975 ;; Nix out all the control chars...
2976 (while (>= (setq i (1- i)) 0)
2977 (aset table i [??]))
2978 ;; ... but not newline and cr, of course. (cr is necessary for the
2979 ;; selective display).
2980 (aset table ?\n nil)
2981 (aset table ?\r nil)
2982 ;; We keep TAB as well.
2983 (aset table ?\t nil)
2984 ;; We nix out any glyphs over 126 that are not set already.
2986 (while (>= (setq i (1- i)) 127)
2987 ;; Only modify if the entry is nil.
2988 (unless (aref table i)
2989 (aset table i [??]))))
2990 (setq buffer-display-table table)))
2992 (defun gnus-summary-set-article-display-arrow (pos)
2993 "Update the overlay arrow to point to line at position POS."
2994 (when (and gnus-summary-display-arrow
2995 (boundp 'overlay-arrow-position)
2996 (boundp 'overlay-arrow-string))
3000 (unless overlay-arrow-position
3001 (setq overlay-arrow-position (make-marker)))
3002 (setq overlay-arrow-string "=>"
3003 overlay-arrow-position (set-marker overlay-arrow-position
3005 (current-buffer))))))
3007 (defun gnus-summary-buffer-name (group)
3008 "Return the summary buffer name of GROUP."
3009 (concat "*Summary " (gnus-group-decoded-name group) "*"))
3011 (defun gnus-summary-setup-buffer (group)
3012 "Initialize summary buffer."
3013 (let ((buffer (gnus-summary-buffer-name group))
3014 (dead-name (concat "*Dead Summary "
3015 (gnus-group-decoded-name group) "*")))
3016 ;; If a dead summary buffer exists, we kill it.
3017 (when (gnus-buffer-live-p dead-name)
3018 (gnus-kill-buffer dead-name))
3019 (if (get-buffer buffer)
3022 (setq gnus-summary-buffer (current-buffer))
3023 (not gnus-newsgroup-prepared))
3024 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3025 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3026 (gnus-summary-mode group)
3028 (gnus-carpal-setup-buffer 'summary))
3029 (unless gnus-single-article-buffer
3030 (make-local-variable 'gnus-article-buffer)
3031 (make-local-variable 'gnus-article-current)
3032 (make-local-variable 'gnus-original-article-buffer))
3033 (setq gnus-newsgroup-name group)
3034 ;; Set any local variables in the group parameters.
3035 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3038 (defun gnus-set-global-variables ()
3039 "Set the global equivalents of the buffer-local variables.
3040 They are set to the latest values they had. These reflect the summary
3041 buffer that was in action when the last article was fetched."
3042 (when (eq major-mode 'gnus-summary-mode)
3043 (setq gnus-summary-buffer (current-buffer))
3044 (let ((name gnus-newsgroup-name)
3045 (marked gnus-newsgroup-marked)
3046 (spam gnus-newsgroup-spam-marked)
3047 (unread gnus-newsgroup-unreads)
3048 (headers gnus-current-headers)
3049 (data gnus-newsgroup-data)
3050 (summary gnus-summary-buffer)
3051 (article-buffer gnus-article-buffer)
3052 (original gnus-original-article-buffer)
3053 (gac gnus-article-current)
3054 (reffed gnus-reffed-article-number)
3055 (score-file gnus-current-score-file)
3056 (default-charset gnus-newsgroup-charset)
3058 (let ((locals gnus-newsgroup-variables))
3060 (if (consp (car locals))
3061 (push (eval (caar locals)) vlist)
3062 (push (eval (car locals)) vlist))
3063 (setq locals (cdr locals)))
3064 (setq vlist (nreverse vlist)))
3066 (set-buffer gnus-group-buffer)
3067 (setq gnus-newsgroup-name name
3068 gnus-newsgroup-marked marked
3069 gnus-newsgroup-spam-marked spam
3070 gnus-newsgroup-unreads unread
3071 gnus-current-headers headers
3072 gnus-newsgroup-data data
3073 gnus-article-current gac
3074 gnus-summary-buffer summary
3075 gnus-article-buffer article-buffer
3076 gnus-original-article-buffer original
3077 gnus-reffed-article-number reffed
3078 gnus-current-score-file score-file
3079 gnus-newsgroup-charset default-charset)
3080 (let ((locals gnus-newsgroup-variables))
3082 (if (consp (car locals))
3083 (set (caar locals) (pop vlist))
3084 (set (car locals) (pop vlist)))
3085 (setq locals (cdr locals))))
3086 ;; The article buffer also has local variables.
3087 (when (gnus-buffer-live-p gnus-article-buffer)
3088 (set-buffer gnus-article-buffer)
3089 (setq gnus-summary-buffer summary))))))
3091 (defun gnus-summary-article-unread-p (article)
3092 "Say whether ARTICLE is unread or not."
3093 (memq article gnus-newsgroup-unreads))
3095 (defun gnus-summary-first-article-p (&optional article)
3096 "Return whether ARTICLE is the first article in the buffer."
3097 (if (not (setq article (or article (gnus-summary-article-number))))
3099 (eq article (caar gnus-newsgroup-data))))
3101 (defun gnus-summary-last-article-p (&optional article)
3102 "Return whether ARTICLE is the last article in the buffer."
3103 (if (not (setq article (or article (gnus-summary-article-number))))
3104 ;; All non-existent numbers are the last article. :-)
3106 (not (cdr (gnus-data-find-list article)))))
3108 (defun gnus-make-thread-indent-array ()
3110 (unless (and gnus-thread-indent-array
3111 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3112 (setq gnus-thread-indent-array (make-vector 201 "")
3113 gnus-thread-indent-array-level gnus-thread-indent-level)
3115 (aset gnus-thread-indent-array n
3116 (make-string (* n gnus-thread-indent-level) ? ))
3119 (defun gnus-update-summary-mark-positions ()
3120 "Compute where the summary marks are to go."
3122 (when (gnus-buffer-exists-p gnus-summary-buffer)
3123 (set-buffer gnus-summary-buffer))
3124 (let ((gnus-replied-mark 129)
3125 (gnus-score-below-mark 130)
3126 (gnus-score-over-mark 130)
3127 (gnus-undownloaded-mark 131)
3128 (spec gnus-summary-line-format-spec)
3131 (gnus-set-work-buffer)
3132 (let ((gnus-summary-line-format-spec spec)
3133 (gnus-newsgroup-downloadable '(0)))
3134 (gnus-summary-insert-line
3135 (make-full-mail-header 0 "" "nobody"
3136 "05 Apr 2001 23:33:09 +0400"
3138 0 nil t 128 t nil "" nil 1)
3139 (goto-char (point-min))
3140 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3141 (- (point) (point-min) 1)))))
3142 (goto-char (point-min))
3143 (push (cons 'replied (and (search-forward "\201" nil t)
3144 (- (point) (point-min) 1)))
3146 (goto-char (point-min))
3147 (push (cons 'score (and (search-forward "\202" nil t)
3148 (- (point) (point-min) 1)))
3150 (goto-char (point-min))
3151 (push (cons 'download
3152 (and (search-forward "\203" nil t)
3153 (- (point) (point-min) 1)))
3155 (setq gnus-summary-mark-positions pos))))
3157 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3158 "Insert a dummy root in the summary buffer."
3160 (gnus-add-text-properties
3161 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3162 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3164 (defun gnus-summary-extract-address-component (from)
3165 (or (car (funcall gnus-extract-address-components from))
3168 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3169 (let ((default-mime-charset (with-current-buffer gnus-summary-buffer
3170 default-mime-charset)))
3171 ;; Is it really necessary to do this next part for each summary line?
3172 ;; Luckily, doesn't seem to slow things down much.
3174 (and gnus-ignored-from-addresses
3175 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3176 (let ((extra-headers (mail-header-extra header))
3180 ((setq to (cdr (assq 'To extra-headers)))
3183 (gnus-summary-extract-address-component
3184 (funcall gnus-decode-encoded-word-function to)))))
3185 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3186 (concat "=> " newsgroups)))))
3187 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3189 (defun gnus-summary-insert-line (gnus-tmp-header
3190 gnus-tmp-level gnus-tmp-current
3191 undownloaded gnus-tmp-unread gnus-tmp-replied
3192 gnus-tmp-expirable gnus-tmp-subject-or-nil
3193 &optional gnus-tmp-dummy gnus-tmp-score
3195 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3196 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3197 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3198 (gnus-tmp-score-char
3199 (if (or (null gnus-summary-default-score)
3200 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3201 gnus-summary-zcore-fuzz))
3203 (if (< gnus-tmp-score gnus-summary-default-score)
3204 gnus-score-below-mark gnus-score-over-mark)))
3205 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3207 (cond (gnus-tmp-process gnus-process-mark)
3208 ((memq gnus-tmp-current gnus-newsgroup-cached)
3210 (gnus-tmp-replied gnus-replied-mark)
3211 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3212 gnus-forwarded-mark)
3213 ((memq gnus-tmp-current gnus-newsgroup-saved)
3215 ((memq gnus-tmp-number gnus-newsgroup-recent)
3217 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3220 (gnus-tmp-downloaded
3222 gnus-undownloaded-mark)
3223 (gnus-newsgroup-agentized
3224 gnus-downloaded-mark)
3227 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3230 ((string-match "<[^>]+> *$" gnus-tmp-from)
3231 (let ((beg (match-beginning 0)))
3232 (or (and (string-match "^\".+\"" gnus-tmp-from)
3233 (substring gnus-tmp-from 1 (1- (match-end 0))))
3234 (substring gnus-tmp-from 0 beg))))
3235 ((string-match "(.+)" gnus-tmp-from)
3236 (substring gnus-tmp-from
3237 (1+ (match-beginning 0)) (1- (match-end 0))))
3239 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3240 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3241 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3242 (buffer-read-only nil))
3243 (when (string= gnus-tmp-name "")
3244 (setq gnus-tmp-name gnus-tmp-from))
3245 (unless (numberp gnus-tmp-lines)
3246 (setq gnus-tmp-lines -1))
3247 (if (= gnus-tmp-lines -1)
3248 (setq gnus-tmp-lines "?")
3249 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3250 (gnus-put-text-property-excluding-characters-with-faces
3252 (progn (eval gnus-summary-line-format-spec) (point))
3253 'gnus-number gnus-tmp-number)
3254 (when (gnus-visual-p 'summary-highlight 'highlight)
3256 (gnus-run-hooks 'gnus-summary-update-hook)
3259 (defun gnus-summary-update-line (&optional dont-update)
3260 "Update summary line after change."
3261 (when (and gnus-summary-default-score
3262 (not gnus-summary-inhibit-highlight))
3263 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3264 (article (gnus-summary-article-number))
3265 (score (gnus-summary-article-score article)))
3267 (if (and gnus-summary-mark-below
3268 (< (gnus-summary-article-score)
3269 gnus-summary-mark-below))
3270 ;; This article has a low score, so we mark it as read.
3271 (when (memq article gnus-newsgroup-unreads)
3272 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3273 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3274 ;; This article was previously marked as read on account
3275 ;; of a low score, but now it has risen, so we mark it as
3277 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3278 (gnus-summary-update-mark
3279 (if (or (null gnus-summary-default-score)
3280 (<= (abs (- score gnus-summary-default-score))
3281 gnus-summary-zcore-fuzz))
3283 (if (< score gnus-summary-default-score)
3284 gnus-score-below-mark gnus-score-over-mark))
3286 ;; Do visual highlighting.
3287 (when (gnus-visual-p 'summary-highlight 'highlight)
3288 (gnus-run-hooks 'gnus-summary-update-hook)))))
3290 (defvar gnus-tmp-new-adopts nil)
3292 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3293 "Return the number of articles in THREAD.
3294 This may be 0 in some cases -- if none of the articles in
3295 the thread are to be displayed."
3297 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3299 ((not (listp thread))
3301 ((and (consp thread) (cdr thread))
3304 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3307 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3310 (when (and level (zerop level) gnus-tmp-new-adopts)
3313 'gnus-summary-number-of-articles-in-thread
3314 gnus-tmp-new-adopts))))
3316 (if (> number 1) gnus-not-empty-thread-mark
3317 gnus-empty-thread-mark)
3320 (defsubst gnus-summary-line-message-size (head)
3321 "Return pretty-printed version of message size.
3322 This function is intended to be used in
3323 `gnus-summary-line-format-alist', which see."
3324 (let ((c (or (mail-header-chars head) -1)))
3325 (cond ((< c 0) "n/a") ; chars not available
3326 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3327 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3328 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3329 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3332 (defun gnus-summary-set-local-parameters (group)
3333 "Go through the local params of GROUP and set all variable specs in that list."
3334 (let ((params (gnus-group-find-parameter group))
3335 (vars '(quit-config)) ; Ignore quit-config.
3338 (setq elem (car params)
3339 params (cdr params))
3340 (and (consp elem) ; Has to be a cons.
3341 (consp (cdr elem)) ; The cdr has to be a list.
3342 (symbolp (car elem)) ; Has to be a symbol in there.
3343 (not (memq (car elem) vars))
3344 (ignore-errors ; So we set it.
3345 (push (car elem) vars)
3346 (make-local-variable (car elem))
3347 (set (car elem) (eval (nth 1 elem))))))))
3349 (defun gnus-summary-read-group (group &optional show-all no-article
3350 kill-buffer no-display backward
3352 "Start reading news in newsgroup GROUP.
3353 If SHOW-ALL is non-nil, already read articles are also listed.
3354 If NO-ARTICLE is non-nil, no article is selected initially.
3355 If NO-DISPLAY, don't generate a summary buffer."
3359 (let ((gnus-auto-select-next nil))
3360 (or (gnus-summary-read-group-1
3361 group show-all no-article
3362 kill-buffer no-display
3365 select-articles nil)))))
3366 (eq gnus-auto-select-next 'quietly))
3367 (set-buffer gnus-group-buffer)
3368 ;; The entry function called above goes to the next
3369 ;; group automatically, so we go two groups back
3370 ;; if we are searching for the previous group.
3372 (gnus-group-prev-unread-group 2))
3373 (if (not (equal group (gnus-group-group-name)))
3374 (setq group (gnus-group-group-name))
3378 (defun gnus-summary-jump-to-other-group (group &optional show-all)
3379 "Directly jump to the other GROUP from summary buffer.
3380 If SHOW-ALL is non-nil, already read articles are also listed."
3382 (if (eq gnus-summary-buffer (current-buffer))
3383 (list (completing-read
3384 "Group: " gnus-active-hashtb nil t
3385 (when (and gnus-newsgroup-name
3386 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
3387 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
3388 'gnus-group-history)
3390 (error "%s must be invoked from a gnus summary buffer." this-command)))
3391 (unless (or (zerop (length group))
3392 (and gnus-newsgroup-name
3393 (string-equal gnus-newsgroup-name group)))
3395 (gnus-summary-read-group group show-all
3396 gnus-dont-select-after-jump-to-other-group)))
3398 (defun gnus-summary-read-group-1 (group show-all no-article
3399 kill-buffer no-display
3400 &optional select-articles)
3401 ;; Killed foreign groups can't be entered.
3402 ;; (when (and (not (gnus-group-native-p group))
3403 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3404 ;; (error "Dead non-native groups can't be entered"))
3405 (gnus-message 5 "Retrieving newsgroup: %s..."
3406 (gnus-group-decoded-name group))
3407 (let* ((new-group (gnus-summary-setup-buffer group))
3408 (quit-config (gnus-group-quit-config group))
3409 (did-select (and new-group (gnus-select-newsgroup
3410 group show-all select-articles))))
3412 ;; This summary buffer exists already, so we just select it.
3414 (gnus-set-global-variables)
3416 (gnus-kill-or-deaden-summary kill-buffer))
3417 (gnus-configure-windows 'summary 'force)
3418 (gnus-set-mode-line 'summary)
3419 (gnus-summary-position-point)
3422 ;; We couldn't select this group.
3424 (when (and (eq major-mode 'gnus-summary-mode)
3425 (not (equal (current-buffer) kill-buffer)))
3426 (kill-buffer (current-buffer))
3427 (if (not quit-config)
3429 ;; Update the info -- marks might need to be removed,
3431 (gnus-summary-update-info)
3432 (set-buffer gnus-group-buffer)
3433 (gnus-group-jump-to-group group)
3434 (gnus-group-next-unread-group 1))
3435 (gnus-handle-ephemeral-exit quit-config)))
3436 (let ((grpinfo (gnus-get-info group)))
3437 (if (null (gnus-info-read grpinfo))
3438 (gnus-message 3 "Group %s contains no messages"
3439 (gnus-group-decoded-name group))
3440 (gnus-message 3 "Can't select group")))
3442 ;; The user did a `C-g' while prompting for number of articles,
3443 ;; so we exit this group.
3444 ((eq did-select 'quit)
3445 (and (eq major-mode 'gnus-summary-mode)
3446 (not (equal (current-buffer) kill-buffer))
3447 (kill-buffer (current-buffer)))
3449 (gnus-kill-or-deaden-summary kill-buffer))
3450 (if (not quit-config)
3452 (set-buffer gnus-group-buffer)
3453 (gnus-group-jump-to-group group)
3454 (gnus-group-next-unread-group 1)
3455 (gnus-configure-windows 'group 'force))
3456 (gnus-handle-ephemeral-exit quit-config))
3457 ;; Finally signal the quit.
3459 ;; The group was successfully selected.
3461 (gnus-set-global-variables)
3462 ;; Save the active value in effect when the group was entered.
3463 (setq gnus-newsgroup-active
3465 (gnus-active gnus-newsgroup-name)))
3466 ;; You can change the summary buffer in some way with this hook.
3467 (gnus-run-hooks 'gnus-select-group-hook)
3468 (gnus-update-format-specifications
3469 nil 'summary 'summary-mode 'summary-dummy)
3470 (gnus-update-summary-mark-positions)
3471 ;; Do score processing.
3472 (when gnus-use-scoring
3473 (gnus-possibly-score-headers))
3474 ;; Check whether to fill in the gaps in the threads.
3475 (when gnus-build-sparse-threads
3476 (gnus-build-sparse-threads))
3477 ;; Find the initial limit.
3478 (if gnus-show-threads
3480 (let ((gnus-newsgroup-dormant nil))
3481 (gnus-summary-initial-limit show-all))
3482 (gnus-summary-initial-limit show-all))
3483 ;; When unthreaded, all articles are always shown.
3484 (setq gnus-newsgroup-limit
3486 (lambda (header) (mail-header-number header))
3487 gnus-newsgroup-headers)))
3488 ;; Generate the summary buffer.
3490 (gnus-summary-prepare))
3491 (when gnus-use-trees
3492 (gnus-tree-open group)
3493 (setq gnus-summary-highlight-line-function
3494 'gnus-tree-highlight-article))
3495 ;; If the summary buffer is empty, but there are some low-scored
3496 ;; articles or some excluded dormants, we include these in the
3498 (when (and (zerop (buffer-size))
3500 (cond (gnus-newsgroup-dormant
3501 (gnus-summary-limit-include-dormant))
3502 ((and gnus-newsgroup-scored show-all)
3503 (gnus-summary-limit-include-expunged t))))
3504 ;; Function `gnus-apply-kill-file' must be called in this hook.
3505 (gnus-run-hooks 'gnus-apply-kill-hook)
3506 (if (and (zerop (buffer-size))
3509 ;; This newsgroup is empty.
3510 (gnus-summary-catchup-and-exit nil t)
3511 (gnus-message 6 "No unread news")
3513 (gnus-kill-or-deaden-summary kill-buffer))
3514 ;; Return nil from this function.
3516 ;; Hide conversation thread subtrees. We cannot do this in
3517 ;; gnus-summary-prepare-hook since kill processing may not
3518 ;; work with hidden articles.
3519 (gnus-summary-maybe-hide-threads)
3521 (gnus-kill-or-deaden-summary kill-buffer))
3522 (gnus-summary-auto-select-subject)
3523 ;; Show first unread article if requested.
3524 (if (and (not no-article)
3526 gnus-newsgroup-unreads
3527 gnus-auto-select-first)
3529 (gnus-configure-windows 'summary)
3530 (let ((art (gnus-summary-article-number)))
3531 (unless (and (not gnus-plugged)
3532 (or (memq art gnus-newsgroup-undownloaded)
3533 (memq art gnus-newsgroup-downloadable)))
3534 (gnus-summary-goto-article art))))
3535 ;; Don't select any articles.
3536 (gnus-summary-position-point)
3537 (gnus-configure-windows 'summary 'force)
3538 (gnus-set-mode-line 'summary))
3539 (when (get-buffer-window gnus-group-buffer t)
3540 ;; Gotta use windows, because recenter does weird stuff if
3541 ;; the current buffer ain't the displayed window.
3542 (let ((owin (selected-window)))
3543 (select-window (get-buffer-window gnus-group-buffer t))
3544 (when (gnus-group-goto-group group)
3546 (select-window owin)))
3547 ;; Mark this buffer as "prepared".
3548 (setq gnus-newsgroup-prepared t)
3549 (gnus-run-hooks 'gnus-summary-prepared-hook)
3550 (unless (gnus-ephemeral-group-p group)
3551 (gnus-group-update-group group))
3554 (defun gnus-summary-auto-select-subject ()
3555 "Select the subject line on initial group entry."
3556 (goto-char (point-min))
3558 ((eq gnus-auto-select-subject 'best)
3559 (gnus-summary-best-unread-subject))
3560 ((eq gnus-auto-select-subject 'unread)
3561 (gnus-summary-first-unread-subject))
3562 ((eq gnus-auto-select-subject 'unseen)
3563 (gnus-summary-first-unseen-subject))
3564 ((eq gnus-auto-select-subject 'unseen-or-unread)
3565 (gnus-summary-first-unseen-or-unread-subject))
3566 ((eq gnus-auto-select-subject 'first)
3569 ((gnus-functionp gnus-auto-select-subject)
3570 (funcall gnus-auto-select-subject))))
3572 (defun gnus-summary-prepare ()
3573 "Generate the summary buffer."
3575 (let ((buffer-read-only nil))
3577 (setq gnus-newsgroup-data nil
3578 gnus-newsgroup-data-reverse nil)
3579 (gnus-run-hooks 'gnus-summary-generate-hook)
3580 ;; Generate the buffer, either with threads or without.
3581 (when gnus-newsgroup-headers
3582 (gnus-summary-prepare-threads
3583 (if gnus-show-threads
3584 (gnus-sort-gathered-threads
3585 (funcall gnus-summary-thread-gathering-function
3587 (gnus-cut-threads (gnus-make-threads)))))
3588 ;; Unthreaded display.
3589 (gnus-sort-articles gnus-newsgroup-headers))))
3590 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3591 ;; Call hooks for modifying summary buffer.
3592 (goto-char (point-min))
3593 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3595 (defsubst gnus-general-simplify-subject (subject)
3596 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3599 ;; Truncate the subject.
3600 (gnus-simplify-subject-functions
3601 (gnus-map-function gnus-simplify-subject-functions subject))
3602 ((numberp gnus-summary-gather-subject-limit)
3603 (setq subject (gnus-simplify-subject-re subject))
3604 (if (> (length subject) gnus-summary-gather-subject-limit)
3605 (substring subject 0 gnus-summary-gather-subject-limit)
3607 ;; Fuzzily simplify it.
3608 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3609 (gnus-simplify-subject-fuzzy subject))
3610 ;; Just remove the leading "Re:".
3612 (gnus-simplify-subject-re subject))))
3614 (if (and gnus-summary-gather-exclude-subject
3615 (string-match gnus-summary-gather-exclude-subject subject))
3616 nil ; This article shouldn't be gathered
3619 (defun gnus-summary-simplify-subject-query ()
3620 "Query where the respool algorithm would put this article."
3622 (gnus-summary-select-article)
3624 (gnus-general-simplify-subject (gnus-summary-article-subject))))
3626 (defun gnus-gather-threads-by-subject (threads)
3627 "Gather threads by looking at Subject headers."
3628 (if (not gnus-summary-make-false-root)
3630 (let ((hashtb (gnus-make-hashtable 1024))
3633 subject hthread whole-subject)
3635 (setq subject (gnus-general-simplify-subject
3636 (setq whole-subject (mail-header-subject
3639 (if (setq hthread (gnus-gethash subject hashtb))
3641 ;; We enter a dummy root into the thread, if we
3642 ;; haven't done that already.
3643 (unless (stringp (caar hthread))
3644 (setcar hthread (list whole-subject (car hthread))))
3645 ;; We add this new gathered thread to this gathered
3647 (setcdr (car hthread)
3648 (nconc (cdar hthread) (list (car threads))))
3649 ;; Remove it from the list of threads.
3650 (setcdr prev (cdr threads))
3651 (setq threads prev))
3652 ;; Enter this thread into the hash table.
3653 (gnus-sethash subject
3654 (if gnus-summary-make-false-root-always
3656 ;; If you want a dummy root above all
3658 (setcar threads (list whole-subject
3664 (setq threads (cdr threads)))
3667 (defun gnus-gather-threads-by-references (threads)
3668 "Gather threads by looking at References headers."
3669 (let ((idhashtb (gnus-make-hashtable 1024))
3670 (thhashtb (gnus-make-hashtable 1024))
3673 ids references id gthread gid entered ref)
3675 (when (setq references (mail-header-references (caar threads)))
3676 (setq id (mail-header-id (caar threads))
3677 ids (inline (gnus-split-references references))
3679 (while (setq ref (pop ids))
3680 (setq ids (delete ref ids))
3681 (if (not (setq gid (gnus-gethash ref idhashtb)))
3683 (gnus-sethash ref id idhashtb)
3684 (gnus-sethash id threads thhashtb))
3685 (setq gthread (gnus-gethash gid thhashtb))
3687 ;; We enter a dummy root into the thread, if we
3688 ;; haven't done that already.
3689 (unless (stringp (caar gthread))
3690 (setcar gthread (list (mail-header-subject (caar gthread))
3692 ;; We add this new gathered thread to this gathered
3694 (setcdr (car gthread)
3695 (nconc (cdar gthread) (list (car threads)))))
3696 ;; Add it into the thread hash table.
3697 (gnus-sethash id gthread thhashtb)
3699 ;; Remove it from the list of threads.
3700 (setcdr prev (cdr threads))
3701 (setq threads prev))))
3703 (setq threads (cdr threads)))
3706 (defun gnus-sort-gathered-threads (threads)
3707 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3708 (let ((result threads))
3710 (when (stringp (caar threads))
3711 (setcdr (car threads)
3712 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3713 (setq threads (cdr threads)))
3716 (defun gnus-thread-loop-p (root thread)
3717 "Say whether ROOT is in THREAD."
3718 (let ((stack (list thread))
3721 (while (setq thread (pop stack))
3722 (setq th (cdr thread))
3724 (not (eq (caar th) root)))
3727 ;; We have found a loop.
3729 (setcdr thread (delq (car th) (cdr thread)))
3730 (if (boundp (setq ref-dep (intern "none"
3731 gnus-newsgroup-dependencies)))
3732 (setcdr (symbol-value ref-dep)
3733 (nconc (cdr (symbol-value ref-dep))
3735 (set ref-dep (list nil (car th))))
3738 ;; Push all the subthreads onto the stack.
3739 (push (cdr thread) stack)))
3742 (defun gnus-make-threads ()
3743 "Go through the dependency hashtb and find the roots. Return all threads."
3745 (while (catch 'infloop
3748 ;; Deal with self-referencing References loops.
3749 (when (and (car (symbol-value refs))
3756 (car (symbol-value refs)) thread))
3757 (cdr (symbol-value refs)))))))
3760 (unless (car (symbol-value refs))
3761 ;; These threads do not refer back to any other articles,
3762 ;; so they're roots.
3763 (setq threads (append (cdr (symbol-value refs)) threads))))
3764 gnus-newsgroup-dependencies)))
3767 ;; Build the thread tree.
3768 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3769 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3771 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3772 if it was already present.
3774 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3775 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3776 Message-IDs will be renamed to a unique Message-ID before being
3779 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3780 (let* ((id (mail-header-id header))
3781 (id-dep (and id (intern id dependencies)))
3782 parent-id ref ref-dep ref-header replaced)
3783 ;; Enter this `header' in the `dependencies' table.
3787 ;; The first two cases do the normal part: enter a new `header'
3788 ;; in the `dependencies' table.
3789 ((not (boundp id-dep))
3790 (set id-dep (list header)))
3791 ((null (car (symbol-value id-dep)))
3792 (setcar (symbol-value id-dep) header))
3794 ;; From here the `header' was already present in the
3795 ;; `dependencies' table.
3797 ;; Overrides an existing entry;
3798 ;; just set the header part of the entry.
3799 (setcar (symbol-value id-dep) header)
3802 ;; Renames the existing `header' to a unique Message-ID.
3803 ((not gnus-summary-ignore-duplicates)
3804 ;; An article with this Message-ID has already been seen.
3805 ;; We rename the Message-ID.
3806 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3808 (mail-header-set-id header id))
3810 ;; The last case ignores an existing entry, except it adds any
3811 ;; additional Xrefs (in case the two articles came from different
3813 ;; Also sets `header' to `nil' meaning that the `dependencies'
3814 ;; table was *not* modified.
3816 (mail-header-set-xref
3817 (car (symbol-value id-dep))
3818 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3820 (or (mail-header-xref header) "")))
3823 (when (and header (not replaced))
3824 ;; First check that we are not creating a References loop.
3825 (setq parent-id (gnus-parent-id (mail-header-references header)))
3826 (setq ref parent-id)
3828 (setq ref-dep (intern-soft ref dependencies))
3830 (setq ref-header (car (symbol-value ref-dep))))
3831 (if (string= id ref)
3832 ;; Yuk! This is a reference loop. Make the article be a
3835 (mail-header-set-references (car (symbol-value id-dep)) "none")
3837 (setq parent-id nil))
3838 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3839 (setq ref-dep (intern (or parent-id "none") dependencies))
3840 (if (boundp ref-dep)
3841 (setcdr (symbol-value ref-dep)
3842 (nconc (cdr (symbol-value ref-dep))
3843 (list (symbol-value id-dep))))
3844 (set ref-dep (list nil (symbol-value id-dep)))))
3847 (defun gnus-extract-message-id-from-in-reply-to (string)
3848 (if (string-match "<[^>]+>" string)
3849 (substring string (match-beginning 0) (match-end 0))
3852 (defun gnus-build-sparse-threads ()
3853 (let ((headers gnus-newsgroup-headers)
3854 (mail-parse-charset gnus-newsgroup-charset)
3855 (gnus-summary-ignore-duplicates t)
3856 header references generation relations
3857 subject child end new-child date)
3858 ;; First we create an alist of generations/relations, where
3859 ;; generations is how much we trust the relation, and the relation
3861 (gnus-message 7 "Making sparse threads...")
3863 (nnheader-set-temp-buffer " *gnus sparse threads*")
3864 (while (setq header (pop headers))
3865 (when (and (setq references (mail-header-references header))
3866 (not (string= references "")))
3868 (setq child (mail-header-id header)
3869 subject (mail-header-subject header)
3870 date (mail-header-date header)
3872 (while (search-backward ">" nil t)
3873 (setq end (1+ (point)))
3874 (when (search-backward "<" nil t)
3875 (setq new-child (buffer-substring (point) end))
3876 (push (list (incf generation)
3877 child (setq child new-child)
3881 (push (list (1+ generation) child nil subject) relations))
3883 (kill-buffer (current-buffer)))
3884 ;; Sort over trustworthiness.
3887 (when (gnus-dependencies-add-header
3888 (make-full-mail-header-from-decoded-header
3889 gnus-reffed-article-number
3890 (nth 3 relation) "" (or (nth 4 relation) "")
3892 (or (nth 2 relation) "") 0 0 "")
3893 gnus-newsgroup-dependencies nil)
3894 (push gnus-reffed-article-number gnus-newsgroup-limit)
3895 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3896 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3897 gnus-newsgroup-reads)
3898 (decf gnus-reffed-article-number)))
3899 (sort relations 'car-less-than-car))
3900 (gnus-message 7 "Making sparse threads...done")))
3902 (defun gnus-build-old-threads ()
3903 ;; Look at all the articles that refer back to old articles, and
3904 ;; fetch the headers for the articles that aren't there. This will
3905 ;; build complete threads - if the roots haven't been expired by the
3907 (let ((mail-parse-charset gnus-newsgroup-charset)
3911 (when (not (car (symbol-value refs)))
3912 (setq heads (cdr (symbol-value refs)))
3914 (if (memq (mail-header-number (caar heads))
3915 gnus-newsgroup-dormant)
3916 (setq heads (cdr heads))
3917 (setq id (symbol-name refs))
3918 (while (and (setq id (gnus-build-get-header id))
3919 (not (car (gnus-id-to-thread id)))))
3920 (setq heads nil)))))
3921 gnus-newsgroup-dependencies)))
3923 ;; This function has to be called with point after the article number
3924 ;; on the beginning of the line.
3925 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3926 (let ((eol (gnus-point-at-eol))
3927 (buffer (current-buffer))
3928 header references in-reply-to)
3930 ;; overview: [num subject from date id refs chars lines misc]
3933 (narrow-to-region (point) eol)
3938 (make-full-mail-header
3940 (nnheader-nov-field) ; subject
3941 (nnheader-nov-field) ; from
3942 (nnheader-nov-field) ; date
3943 (nnheader-nov-read-message-id) ; id
3944 (nnheader-nov-field) ; refs
3945 (nnheader-nov-read-integer) ; chars
3946 (nnheader-nov-read-integer) ; lines
3948 (if (looking-at "Xref: ")
3949 (goto-char (match-end 0)))
3950 (nnheader-nov-field)) ; Xref
3951 (nnheader-nov-parse-extra)))) ; extra
3955 (when (and (string= references "")
3956 (setq in-reply-to (mail-header-extra header))
3957 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
3958 (mail-header-set-references
3959 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
3961 (when gnus-alter-header-function
3962 (funcall gnus-alter-header-function header))
3963 (gnus-dependencies-add-header header dependencies force-new)))
3965 (defun gnus-build-get-header (id)
3966 "Look through the buffer of NOV lines and find the header to ID.
3967 Enter this line into the dependencies hash table, and return
3968 the id of the parent article (if any)."
3969 (let ((deps gnus-newsgroup-dependencies)
3973 (set-buffer nntp-server-buffer)
3974 (let ((case-fold-search nil))
3975 (goto-char (point-min))
3976 (while (and (not found)
3977 (search-forward id nil t))
3979 (setq found (looking-at
3980 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3981 (regexp-quote id))))
3982 (or found (beginning-of-line 2)))
3986 (setq header (gnus-nov-parse-line
3987 (read (current-buffer)) deps))
3988 (gnus-parent-id (mail-header-references header))))))
3990 (let ((number (mail-header-number header)))
3991 (push number gnus-newsgroup-limit)
3992 (push header gnus-newsgroup-headers)
3993 (if (memq number gnus-newsgroup-unselected)
3995 (setq gnus-newsgroup-unreads
3996 (gnus-add-to-sorted-list gnus-newsgroup-unreads
3998 (setq gnus-newsgroup-unselected
3999 (delq number gnus-newsgroup-unselected)))
4000 (push number gnus-newsgroup-ancient)))))))
4002 (defun gnus-build-all-threads ()
4003 "Read all the headers."
4004 (let ((gnus-summary-ignore-duplicates t)
4005 (mail-parse-charset gnus-newsgroup-charset)
4006 (dependencies gnus-newsgroup-dependencies)
4009 (set-buffer nntp-server-buffer)
4010 (let ((case-fold-search nil))
4011 (goto-char (point-min))
4014 (setq article (read (current-buffer))
4015 header (gnus-nov-parse-line article dependencies)))
4018 (set-buffer gnus-summary-buffer)
4019 (push header gnus-newsgroup-headers)
4020 (if (memq (setq article (mail-header-number header))
4021 gnus-newsgroup-unselected)
4023 (setq gnus-newsgroup-unreads
4024 (gnus-add-to-sorted-list
4025 gnus-newsgroup-unreads article))
4026 (setq gnus-newsgroup-unselected
4027 (delq article gnus-newsgroup-unselected)))
4028 (push article gnus-newsgroup-ancient)))
4029 (forward-line 1)))))))
4031 (defun gnus-summary-update-article-line (article header)
4032 "Update the line for ARTICLE using HEADERS."
4033 (let* ((id (mail-header-id header))
4034 (thread (gnus-id-to-thread id)))
4036 (error "Article in no thread"))
4037 ;; Update the thread.
4038 (setcar thread header)
4039 (gnus-summary-goto-subject article)
4040 (let* ((datal (gnus-data-find-list article))
4042 (length (when (cdr datal)
4043 (- (gnus-data-pos data)
4044 (gnus-data-pos (cadr datal)))))
4045 (buffer-read-only nil)
4046 (level (gnus-summary-thread-level)))
4048 (gnus-summary-insert-line
4050 (memq article gnus-newsgroup-undownloaded)
4051 (gnus-article-mark article)
4052 (memq article gnus-newsgroup-replied)
4053 (memq article gnus-newsgroup-expirable)
4054 ;; Only insert the Subject string when it's different
4055 ;; from the previous Subject string.
4060 (mail-header-subject
4063 (gnus-data-find-list
4065 (gnus-data-list t)))))
4066 ;; Error on the side of excessive subjects.
4068 (mail-header-subject header)))
4070 (mail-header-subject header))
4071 nil (cdr (assq article gnus-newsgroup-scored))
4072 (memq article gnus-newsgroup-processable))
4074 (gnus-data-update-list
4075 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
4077 (defun gnus-summary-update-article (article &optional iheader)
4078 "Update ARTICLE in the summary buffer."
4079 (set-buffer gnus-summary-buffer)
4080 (let* ((header (gnus-summary-article-header article))
4081 (id (mail-header-id header))
4082 (data (gnus-data-find article))
4083 (thread (gnus-id-to-thread id))
4084 (references (mail-header-references header))
4088 (when (and references
4089 (not (equal "" references)))
4092 (buffer-read-only nil)
4098 (delq thread parent)))
4099 (if (gnus-summary-insert-subject id header)
4100 ;; Set the (possibly) new article number in the data structure.
4101 (gnus-data-set-number data (gnus-id-to-article id))
4105 (defun gnus-rebuild-thread (id &optional line)
4106 "Rebuild the thread containing ID.
4107 If LINE, insert the rebuilt thread starting on line LINE."
4108 (let ((buffer-read-only nil)
4109 old-pos current thread data)
4110 (if (not gnus-show-threads)
4111 (setq thread (list (car (gnus-id-to-thread id))))
4112 ;; Get the thread this article is part of.
4113 (setq thread (gnus-remove-thread id)))
4114 (setq old-pos (gnus-point-at-bol))
4115 (setq current (save-excursion
4116 (and (re-search-backward "[\r\n]" nil t)
4117 (gnus-summary-article-number))))
4118 ;; If this is a gathered thread, we have to go some re-gathering.
4119 (when (stringp (car thread))
4120 (let ((subject (car thread))
4122 (setq thread (cdr thread))
4124 (unless (memq (setq thr (gnus-id-to-thread
4126 (mail-header-id (caar thread)))))
4129 (setq thread (cdr thread)))
4130 ;; We now have all (unique) roots.
4131 (if (= (length roots) 1)
4132 ;; All the loose roots are now one solid root.
4133 (setq thread (car roots))
4134 (setq thread (cons subject (gnus-sort-threads roots))))))
4136 ;; We then insert this thread into the summary buffer.
4138 (goto-char (point-min))
4139 (forward-line (1- line)))
4140 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4141 (if gnus-show-threads
4142 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4143 (gnus-summary-prepare-unthreaded thread))
4144 (setq data (nreverse gnus-newsgroup-data))
4145 (setq threads gnus-newsgroup-threads))
4146 ;; We splice the new data into the data structure.
4147 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4148 ;;!!! then we want to insert at the beginning of the buffer.
4149 ;;!!! That happens to be true with Gnus now, but that may
4150 ;;!!! change in the future. Perhaps.
4151 (gnus-data-enter-list
4152 (if line nil current) data (- (point) old-pos))
4153 (setq gnus-newsgroup-threads
4154 (nconc threads gnus-newsgroup-threads))
4155 (gnus-data-compute-positions))))
4157 (defun gnus-number-to-header (number)
4158 "Return the header for article NUMBER."
4159 (let ((headers gnus-newsgroup-headers))
4161 (not (= number (mail-header-number (car headers)))))
4166 (defun gnus-parent-headers (in-headers &optional generation)
4167 "Return the headers of the GENERATIONeth parent of HEADERS."
4169 (setq generation 1))
4171 (headers in-headers)
4174 (not (zerop generation))
4175 (setq references (mail-header-references headers)))
4176 (setq headers (if (and references
4177 (setq parent (gnus-parent-id references)))
4178 (car (gnus-id-to-thread parent))
4181 (and (not (eq headers in-headers))
4184 (defun gnus-id-to-thread (id)
4185 "Return the (sub-)thread where ID appears."
4186 (gnus-gethash id gnus-newsgroup-dependencies))
4188 (defun gnus-id-to-article (id)
4189 "Return the article number of ID."
4190 (let ((thread (gnus-id-to-thread id)))
4193 (mail-header-number (car thread)))))
4195 (defun gnus-id-to-header (id)
4196 "Return the article headers of ID."
4197 (car (gnus-id-to-thread id)))
4199 (defun gnus-article-displayed-root-p (article)
4200 "Say whether ARTICLE is a root(ish) article."
4201 (let ((level (gnus-summary-thread-level article))
4202 (refs (mail-header-references (gnus-summary-article-header article)))
4208 ((null (gnus-parent-id refs)) t)
4210 (null (setq particle (gnus-id-to-article
4211 (gnus-parent-id refs))))
4212 (null (gnus-summary-thread-level particle)))))))
4214 (defun gnus-root-id (id)
4215 "Return the id of the root of the thread where ID appears."
4217 (while (and id (setq prev (car (gnus-id-to-thread id))))
4219 id (gnus-parent-id (mail-header-references prev))))
4222 (defun gnus-articles-in-thread (thread)
4223 "Return the list of articles in THREAD."
4224 (cons (mail-header-number (car thread))
4225 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4227 (defun gnus-remove-thread (id &optional dont-remove)
4228 "Remove the thread that has ID in it."
4229 (let (headers thread last-id)
4230 ;; First go up in this thread until we find the root.
4231 (setq last-id (gnus-root-id id)
4232 headers (message-flatten-list (gnus-id-to-thread last-id)))
4233 ;; We have now found the real root of this thread. It might have
4234 ;; been gathered into some loose thread, so we have to search
4235 ;; through the threads to find the thread we wanted.
4236 (let ((threads gnus-newsgroup-threads)
4239 (setq sub (car threads))
4240 (if (stringp (car sub))
4241 ;; This is a gathered thread, so we look at the roots
4242 ;; below it to find whether this article is in this
4245 (setq sub (cdr sub))
4247 (when (member (caar sub) headers)
4248 (setq thread (car threads)
4251 (setq sub (cdr sub))))
4252 ;; It's an ordinary thread, so we check it.
4253 (when (eq (car sub) (car headers))
4256 (setq threads (cdr threads)))
4257 ;; If this article is in no thread, then it's a root.
4260 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4261 (setq thread (gnus-id-to-thread last-id)))
4264 thread ; We return this thread.
4266 (if (stringp (car thread))
4268 ;; If we use dummy roots, then we have to remove the
4269 ;; dummy root as well.
4270 (when (eq gnus-summary-make-false-root 'dummy)
4271 ;; We go to the dummy root by going to
4272 ;; the first sub-"thread", and then one line up.
4273 (gnus-summary-goto-article
4274 (mail-header-number (caadr thread)))
4277 (gnus-data-compute-positions))
4278 (setq thread (cdr thread))
4280 (gnus-remove-thread-1 (car thread))
4281 (setq thread (cdr thread))))
4282 (gnus-remove-thread-1 thread))))))))
4284 (defun gnus-remove-thread-1 (thread)
4285 "Remove the thread THREAD recursively."
4286 (let ((number (mail-header-number (pop thread)))
4288 (setq thread (reverse thread))
4290 (gnus-remove-thread-1 (pop thread)))
4291 (when (setq d (gnus-data-find number))
4292 (goto-char (gnus-data-pos d))
4293 (gnus-summary-show-thread)
4296 (- (gnus-point-at-bol)
4298 (1+ (gnus-point-at-eol))
4299 (gnus-delete-line)))))))
4301 (defun gnus-sort-threads-1 (threads func)
4302 (sort (mapcar (lambda (thread)
4305 (gnus-sort-threads-1 (cdr thread) func))))
4308 (defun gnus-sort-threads (threads)
4310 (if (not gnus-thread-sort-functions)
4312 (gnus-message 8 "Sorting threads...")
4313 (let ((max-lisp-eval-depth 5000))
4314 (prog1 (gnus-sort-threads-1
4316 (gnus-make-sort-function gnus-thread-sort-functions))
4317 (gnus-message 8 "Sorting threads...done")))))
4319 (defun gnus-sort-articles (articles)
4321 (when gnus-article-sort-functions
4322 (gnus-message 7 "Sorting articles...")
4324 (setq gnus-newsgroup-headers
4325 (sort articles (gnus-make-sort-function
4326 gnus-article-sort-functions)))
4327 (gnus-message 7 "Sorting articles...done"))))
4329 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4330 (defmacro gnus-thread-header (thread)
4331 "Return header of first article in THREAD.
4332 Note that THREAD must never, ever be anything else than a variable -
4333 using some other form will lead to serious barfage."
4334 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4335 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4336 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4339 (defsubst gnus-article-sort-by-number (h1 h2)
4340 "Sort articles by article number."
4341 (< (mail-header-number h1)
4342 (mail-header-number h2)))
4344 (defun gnus-thread-sort-by-number (h1 h2)
4345 "Sort threads by root article number."
4346 (gnus-article-sort-by-number
4347 (gnus-thread-header h1) (gnus-thread-header h2)))
4349 (defsubst gnus-article-sort-by-random (h1 h2)
4350 "Sort articles by article number."
4353 (defun gnus-thread-sort-by-random (h1 h2)
4354 "Sort threads by root article number."
4355 (gnus-article-sort-by-random
4356 (gnus-thread-header h1) (gnus-thread-header h2)))
4358 (defsubst gnus-article-sort-by-lines (h1 h2)
4359 "Sort articles by article Lines header."
4360 (< (mail-header-lines h1)
4361 (mail-header-lines h2)))
4363 (defun gnus-thread-sort-by-lines (h1 h2)
4364 "Sort threads by root article Lines header."
4365 (gnus-article-sort-by-lines
4366 (gnus-thread-header h1) (gnus-thread-header h2)))
4368 (defsubst gnus-article-sort-by-chars (h1 h2)
4369 "Sort articles by octet length."
4370 (< (mail-header-chars h1)
4371 (mail-header-chars h2)))
4373 (defun gnus-thread-sort-by-chars (h1 h2)
4374 "Sort threads by root article octet length."
4375 (gnus-article-sort-by-chars
4376 (gnus-thread-header h1) (gnus-thread-header h2)))
4378 (defsubst gnus-article-sort-by-author (h1 h2)
4379 "Sort articles by root author."
4381 (let ((addr (car (mime-entity-read-field h1 'From))))
4382 (or (std11-full-name-string addr)
4383 (std11-address-string addr)
4385 (let ((addr (car (mime-entity-read-field h2 'From))))
4386 (or (std11-full-name-string addr)
4387 (std11-address-string addr)
4391 (defun gnus-thread-sort-by-author (h1 h2)
4392 "Sort threads by root author."
4393 (gnus-article-sort-by-author
4394 (gnus-thread-header h1) (gnus-thread-header h2)))
4396 (defsubst gnus-article-sort-by-subject (h1 h2)
4397 "Sort articles by root subject."
4399 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4400 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4402 (defun gnus-thread-sort-by-subject (h1 h2)
4403 "Sort threads by root subject."
4404 (gnus-article-sort-by-subject
4405 (gnus-thread-header h1) (gnus-thread-header h2)))
4407 (defsubst gnus-article-sort-by-date (h1 h2)
4408 "Sort articles by root article date."
4410 (gnus-date-get-time (mail-header-date h1))
4411 (gnus-date-get-time (mail-header-date h2))))
4413 (defun gnus-thread-sort-by-date (h1 h2)
4414 "Sort threads by root article date."
4415 (gnus-article-sort-by-date
4416 (gnus-thread-header h1) (gnus-thread-header h2)))
4418 (defsubst gnus-article-sort-by-score (h1 h2)
4419 "Sort articles by root article score.
4420 Unscored articles will be counted as having a score of zero."
4421 (> (or (cdr (assq (mail-header-number h1)
4422 gnus-newsgroup-scored))
4423 gnus-summary-default-score 0)
4424 (or (cdr (assq (mail-header-number h2)
4425 gnus-newsgroup-scored))
4426 gnus-summary-default-score 0)))
4428 (defun gnus-thread-sort-by-score (h1 h2)
4429 "Sort threads by root article score."
4430 (gnus-article-sort-by-score
4431 (gnus-thread-header h1) (gnus-thread-header h2)))
4433 (defun gnus-thread-sort-by-total-score (h1 h2)
4434 "Sort threads by the sum of all scores in the thread.
4435 Unscored articles will be counted as having a score of zero."
4436 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4438 (defun gnus-thread-total-score (thread)
4439 ;; This function find the total score of THREAD.
4444 (if (stringp (car thread))
4445 (apply gnus-thread-score-function 0
4446 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4447 (gnus-thread-total-score-1 thread)))
4449 (gnus-thread-total-score-1 (list thread)))))
4451 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4452 "Sort threads such that the thread with the most recently arrived article comes first."
4453 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4455 (defun gnus-thread-highest-number (thread)
4456 "Return the highest article number in THREAD."
4457 (apply 'max (mapcar (lambda (header)
4458 (mail-header-number header))
4459 (message-flatten-list thread))))
4461 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4462 "Sort threads such that the thread with the most recently dated article comes first."
4463 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4465 (defun gnus-thread-latest-date (thread)
4466 "Return the highest article date in THREAD."
4467 (let ((previous-time 0))
4474 (mail-header-parse-date (mail-header-date header))
4475 (error previous-time)))))
4477 (message-flatten-list thread)
4479 (< (mail-header-number h1)
4480 (mail-header-number h2))))))))
4482 (defun gnus-thread-total-score-1 (root)
4483 ;; This function find the total score of the thread below ROOT.
4484 (setq root (car root))
4485 (apply gnus-thread-score-function
4487 (mapcar 'gnus-thread-total-score
4488 (cdr (gnus-id-to-thread (mail-header-id root))))
4489 (when (> (mail-header-number root) 0)
4490 (list (or (cdr (assq (mail-header-number root)
4491 gnus-newsgroup-scored))
4492 gnus-summary-default-score 0))))
4493 (list gnus-summary-default-score)
4496 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4497 (defvar gnus-tmp-prev-subject nil)
4498 (defvar gnus-tmp-false-parent nil)
4499 (defvar gnus-tmp-root-expunged nil)
4500 (defvar gnus-tmp-dummy-line nil)
4502 (eval-when-compile (defvar gnus-tmp-header))
4503 (defun gnus-extra-header (type &optional header)
4504 "Return the extra header of TYPE."
4505 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4508 (defvar gnus-tmp-thread-tree-header-string "")
4510 (defcustom gnus-sum-thread-tree-root "> "
4511 "With %B spec, used for the root of a thread.
4512 If nil, use subject instead."
4514 :group 'gnus-thread)
4515 (defcustom gnus-sum-thread-tree-single-indent ""
4516 "With %B spec, used for a thread with just one message.
4517 If nil, use subject instead."
4519 :group 'gnus-thread)
4520 (defcustom gnus-sum-thread-tree-vertical "| "
4521 "With %B spec, used for drawing a vertical line."
4523 :group 'gnus-thread)
4524 (defcustom gnus-sum-thread-tree-indent " "
4525 "With %B spec, used for indenting."
4527 :group 'gnus-thread)
4528 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4529 "With %B spec, used for a leaf with brothers."
4531 :group 'gnus-thread)
4532 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4533 "With %B spec, used for a leaf without brothers."
4535 :group 'gnus-thread)
4537 (defun gnus-summary-prepare-threads (threads)
4538 "Prepare summary buffer from THREADS and indentation LEVEL.
4539 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4540 or a straight list of headers."
4541 (gnus-message 7 "Generating summary...")
4543 (setq gnus-newsgroup-threads threads)
4546 (let ((gnus-tmp-level 0)
4547 (default-score (or gnus-summary-default-score 0))
4548 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4549 (building-line-count gnus-summary-display-while-building)
4550 (building-count (integerp gnus-summary-display-while-building))
4551 thread number subject stack state gnus-tmp-gathered beg-match
4552 new-roots gnus-tmp-new-adopts thread-end simp-subject
4553 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4554 gnus-tmp-replied gnus-tmp-subject-or-nil
4555 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4556 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4557 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4560 (setq gnus-tmp-prev-subject nil)
4562 (if (vectorp (car threads))
4563 ;; If this is a straight (sic) list of headers, then a
4564 ;; threaded summary display isn't required, so we just create
4565 ;; an unthreaded one.
4566 (gnus-summary-prepare-unthreaded threads)
4568 ;; Do the threaded display.
4570 (if gnus-summary-display-while-building
4571 (switch-to-buffer (buffer-name)))
4572 (while (or threads stack gnus-tmp-new-adopts new-roots)
4574 (if (and (= gnus-tmp-level 0)
4577 (not gnus-tmp-false-parent)
4578 (or gnus-tmp-new-adopts new-roots))
4579 (if gnus-tmp-new-adopts
4580 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4581 thread (list (car gnus-tmp-new-adopts))
4582 gnus-tmp-header (caar thread)
4583 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4585 (setq thread (list (car new-roots))
4586 gnus-tmp-header (caar thread)
4587 new-roots (cdr new-roots))))
4590 ;; If there are some threads, we do them before the
4591 ;; threads on the stack.
4592 (setq thread threads
4593 gnus-tmp-header (caar thread))
4594 ;; There were no current threads, so we pop something off
4596 (setq state (car stack)
4597 gnus-tmp-level (car state)
4598 tree-stack (cadr state)
4599 thread (caddr state)
4601 gnus-tmp-header (caar thread))))
4603 (setq gnus-tmp-false-parent nil)
4604 (setq gnus-tmp-root-expunged nil)
4605 (setq thread-end nil)
4607 (if (stringp gnus-tmp-header)
4608 ;; The header is a dummy root.
4610 ((eq gnus-summary-make-false-root 'adopt)
4611 ;; We let the first article adopt the rest.
4612 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4614 (setq gnus-tmp-gathered
4616 (lambda (h) (mail-header-number (car h)))
4619 (setq thread (cons (list (caar thread)
4622 (setq gnus-tmp-level -1
4623 gnus-tmp-false-parent t))
4624 ((eq gnus-summary-make-false-root 'empty)
4625 ;; We print adopted articles with empty subject fields.
4626 (setq gnus-tmp-gathered
4628 (lambda (h) (mail-header-number (car h)))
4631 (setq gnus-tmp-level -1))
4632 ((eq gnus-summary-make-false-root 'dummy)
4633 ;; We remember that we probably want to output a dummy
4635 (setq gnus-tmp-dummy-line gnus-tmp-header)
4636 (setq gnus-tmp-prev-subject gnus-tmp-header))
4638 ;; We do not make a root for the gathered
4639 ;; sub-threads at all.
4640 (setq gnus-tmp-level -1)))
4642 (setq number (mail-header-number gnus-tmp-header)
4643 subject (mail-header-subject gnus-tmp-header)
4644 simp-subject (gnus-simplify-subject-fully subject))
4647 ;; If the thread has changed subject, we might want to make
4648 ;; this subthread into a root.
4649 ((and (null gnus-thread-ignore-subject)
4650 (not (zerop gnus-tmp-level))
4651 gnus-tmp-prev-subject
4652 (not (string= gnus-tmp-prev-subject simp-subject)))
4653 (setq new-roots (nconc new-roots (list (car thread)))
4655 gnus-tmp-header nil))
4656 ;; If the article lies outside the current limit,
4657 ;; then we do not display it.
4658 ((not (memq number gnus-newsgroup-limit))
4659 (setq gnus-tmp-gathered
4661 (lambda (h) (mail-header-number (car h)))
4664 (setq gnus-tmp-new-adopts (if (cdar thread)
4665 (append gnus-tmp-new-adopts
4667 gnus-tmp-new-adopts)
4669 gnus-tmp-header nil)
4670 (when (zerop gnus-tmp-level)
4671 (setq gnus-tmp-root-expunged t)))
4672 ;; Perhaps this article is to be marked as read?
4673 ((and gnus-summary-mark-below
4674 (< (or (cdr (assq number gnus-newsgroup-scored))
4676 gnus-summary-mark-below)
4677 ;; Don't touch sparse articles.
4678 (not (gnus-summary-article-sparse-p number))
4679 (not (gnus-summary-article-ancient-p number)))
4680 (setq gnus-newsgroup-unreads
4681 (delq number gnus-newsgroup-unreads))
4682 (if gnus-newsgroup-auto-expire
4683 (setq gnus-newsgroup-expirable
4684 (gnus-add-to-sorted-list
4685 gnus-newsgroup-expirable number))
4686 (push (cons number gnus-low-score-mark)
4687 gnus-newsgroup-reads))))
4689 (when gnus-tmp-header
4690 ;; We may have an old dummy line to output before this
4692 (when (and gnus-tmp-dummy-line
4695 (mail-header-subject gnus-tmp-header)))
4696 (gnus-summary-insert-dummy-line
4697 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4698 (setq gnus-tmp-dummy-line nil))
4700 ;; Compute the mark.
4701 (setq gnus-tmp-unread (gnus-article-mark number))
4703 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4704 gnus-tmp-header gnus-tmp-level)
4705 gnus-newsgroup-data)
4707 ;; Actually insert the line.
4709 gnus-tmp-subject-or-nil
4711 ((and gnus-thread-ignore-subject
4712 gnus-tmp-prev-subject
4713 (not (string= gnus-tmp-prev-subject simp-subject)))
4715 ((zerop gnus-tmp-level)
4716 (if (and (eq gnus-summary-make-false-root 'empty)
4717 (memq number gnus-tmp-gathered)
4718 gnus-tmp-prev-subject
4719 (string= gnus-tmp-prev-subject simp-subject))
4720 gnus-summary-same-subject
4722 (t gnus-summary-same-subject)))
4723 (if (and (eq gnus-summary-make-false-root 'adopt)
4724 (= gnus-tmp-level 1)
4725 (memq number gnus-tmp-gathered))
4726 (setq gnus-tmp-opening-bracket ?\<
4727 gnus-tmp-closing-bracket ?\>)
4728 (setq gnus-tmp-opening-bracket ?\[
4729 gnus-tmp-closing-bracket ?\]))
4731 gnus-tmp-indentation
4732 (aref gnus-thread-indent-array gnus-tmp-level)
4733 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4734 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4735 gnus-summary-default-score 0)
4737 (if (or (null gnus-summary-default-score)
4738 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4739 gnus-summary-zcore-fuzz))
4741 (if (< gnus-tmp-score gnus-summary-default-score)
4742 gnus-score-below-mark gnus-score-over-mark))
4744 (cond ((memq number gnus-newsgroup-processable)
4746 ((memq number gnus-newsgroup-cached)
4748 ((memq number gnus-newsgroup-replied)
4750 ((memq number gnus-newsgroup-forwarded)
4751 gnus-forwarded-mark)
4752 ((memq number gnus-newsgroup-saved)
4754 ((memq number gnus-newsgroup-recent)
4756 ((memq number gnus-newsgroup-unseen)
4760 (cond ((memq number gnus-newsgroup-undownloaded)
4761 gnus-undownloaded-mark)
4762 (gnus-newsgroup-agentized
4763 gnus-downloaded-mark)
4766 gnus-tmp-from (mail-header-from gnus-tmp-header)
4769 ((string-match "<[^>]+> *$" gnus-tmp-from)
4770 (setq beg-match (match-beginning 0))
4771 (or (and (string-match "^\".+\"" gnus-tmp-from)
4772 (substring gnus-tmp-from 1 (1- (match-end 0))))
4773 (substring gnus-tmp-from 0 beg-match)))
4774 ((string-match "(.+)" gnus-tmp-from)
4775 (substring gnus-tmp-from
4776 (1+ (match-beginning 0)) (1- (match-end 0))))
4778 gnus-tmp-thread-tree-header-string
4780 ((not gnus-show-threads) "")
4781 ((zerop gnus-tmp-level)
4783 (or gnus-sum-thread-tree-root subject)
4784 (or gnus-sum-thread-tree-single-indent subject)))
4786 (concat (apply 'concat
4787 (mapcar (lambda (item)
4789 gnus-sum-thread-tree-vertical
4790 gnus-sum-thread-tree-indent))
4791 (cdr (reverse tree-stack))))
4793 gnus-sum-thread-tree-leaf-with-other
4794 gnus-sum-thread-tree-single-leaf)))))
4795 (when (string= gnus-tmp-name "")
4796 (setq gnus-tmp-name gnus-tmp-from))
4797 (unless (numberp gnus-tmp-lines)
4798 (setq gnus-tmp-lines -1))
4799 (if (= gnus-tmp-lines -1)
4800 (setq gnus-tmp-lines "?")
4801 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4802 (gnus-put-text-property
4804 (progn (eval gnus-summary-line-format-spec) (point))
4805 'gnus-number number)
4808 (gnus-run-hooks 'gnus-summary-update-hook)
4811 (setq gnus-tmp-prev-subject simp-subject)))
4813 (when (nth 1 thread)
4814 (push (list (max 0 gnus-tmp-level)
4815 (copy-list tree-stack)
4818 (push (if (nth 1 thread) 1 0) tree-stack)
4819 (incf gnus-tmp-level)
4820 (setq threads (if thread-end nil (cdar thread)))
4821 (if gnus-summary-display-while-building
4824 ;; use a set frequency
4825 (setq building-line-count (1- building-line-count))
4826 (when (= building-line-count 0)
4828 (setq building-line-count
4829 gnus-summary-display-while-building)))
4833 (setq gnus-tmp-level 0)))))
4834 (gnus-message 7 "Generating summary...done"))
4836 (defun gnus-summary-prepare-unthreaded (headers)
4837 "Generate an unthreaded summary buffer based on HEADERS."
4838 (let (header number mark)
4843 ;; We may have to root out some bad articles...
4844 (when (memq (setq number (mail-header-number
4845 (setq header (pop headers))))
4846 gnus-newsgroup-limit)
4847 ;; Mark article as read when it has a low score.
4848 (when (and gnus-summary-mark-below
4849 (< (or (cdr (assq number gnus-newsgroup-scored))
4850 gnus-summary-default-score 0)
4851 gnus-summary-mark-below)
4852 (not (gnus-summary-article-ancient-p number)))
4853 (setq gnus-newsgroup-unreads
4854 (delq number gnus-newsgroup-unreads))
4855 (if gnus-newsgroup-auto-expire
4856 (push number gnus-newsgroup-expirable)
4857 (push (cons number gnus-low-score-mark)
4858 gnus-newsgroup-reads)))
4860 (setq mark (gnus-article-mark number))
4861 (push (gnus-data-make number mark (1+ (point)) header 0)
4862 gnus-newsgroup-data)
4863 (gnus-summary-insert-line
4865 (memq number gnus-newsgroup-undownloaded)
4866 mark (memq number gnus-newsgroup-replied)
4867 (memq number gnus-newsgroup-expirable)
4868 (mail-header-subject header) nil
4869 (cdr (assq number gnus-newsgroup-scored))
4870 (memq number gnus-newsgroup-processable))))))
4872 (defun gnus-summary-remove-list-identifiers ()
4873 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4874 (let ((regexp (if (consp gnus-list-identifiers)
4875 (mapconcat 'identity gnus-list-identifiers " *\\|")
4876 gnus-list-identifiers))
4879 (dolist (header gnus-newsgroup-headers)
4880 (setq subject (mail-header-subject header)
4882 (while (string-match
4883 (concat "^\\(R[Ee]: +\\)*\\(" regexp " *\\)")
4886 (concat (substring subject 0 (match-beginning 2))
4887 (substring subject (match-end 0)))
4891 "^\\(\\(R[Ee]: +\\)+\\)R[Ee]: +" subject))
4893 (concat (substring subject 0 (match-beginning 1))
4894 (substring subject (match-end 1)))))
4896 (mail-header-set-subject header subject))))))
4898 (defun gnus-fetch-headers (articles)
4899 "Fetch headers of ARTICLES."
4900 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
4901 (gnus-message 5 "Fetching headers for %s..." name)
4904 (setq gnus-headers-retrieved-by
4905 (gnus-retrieve-headers
4906 articles gnus-newsgroup-name
4907 ;; We might want to fetch old headers, but
4908 ;; not if there is only 1 article.
4910 (not (eq gnus-fetch-old-headers 'some))
4911 (not (numberp gnus-fetch-old-headers)))
4912 (> (length articles) 1))
4913 gnus-fetch-old-headers))))
4914 (gnus-get-newsgroup-headers-xover
4915 articles nil nil gnus-newsgroup-name t)
4916 (gnus-get-newsgroup-headers))
4917 (gnus-message 5 "Fetching headers for %s...done" name))))
4919 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4920 "Select newsgroup GROUP.
4921 If READ-ALL is non-nil, all articles in the group are selected.
4922 If SELECT-ARTICLES, only select those articles from GROUP."
4923 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4924 ;;!!! Dirty hack; should be removed.
4925 (gnus-summary-ignore-duplicates
4926 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4928 gnus-summary-ignore-duplicates))
4929 (info (nth 2 entry))
4930 articles fetched-articles cached)
4932 (unless (gnus-check-server
4933 (set (make-local-variable 'gnus-current-select-method)
4934 (gnus-find-method-for-group group)))
4935 (error "Couldn't open server"))
4937 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4938 (gnus-activate-group group) ; Or we can activate it...
4939 (progn ; Or we bug out.
4940 (when (equal major-mode 'gnus-summary-mode)
4941 (kill-buffer (current-buffer)))
4942 (error "Couldn't activate group %s: %s"
4943 group (gnus-status-message group))))
4945 (unless (gnus-request-group group t)
4946 (when (equal major-mode 'gnus-summary-mode)
4947 (kill-buffer (current-buffer)))
4948 (error "Couldn't request group %s: %s"
4949 group (gnus-status-message group)))
4951 (setq gnus-newsgroup-name group
4952 gnus-newsgroup-unselected nil
4953 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4955 (let ((display (gnus-group-find-parameter group 'display)))
4956 (setq gnus-newsgroup-display
4958 ((not (zerop (or (car-safe read-all) 0)))
4959 ;; The user entered the group with C-u SPC/RET, let's show
4965 (gnus-summary-display-make-predicate (mapcar 'identity display)))
4967 ;; The following is probably the "correct" solution, but
4968 ;; it makes Gnus fetch all headers and then limit the
4969 ;; articles (which is slow), so instead we hack the
4970 ;; select-articles parameter instead. -- Simon Josefsson
4973 ;; (gnus-byte-compile
4974 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
4976 (setq select-articles
4977 (gnus-uncompress-range
4978 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
4982 (cdr (gnus-active group)))))
4987 (gnus-summary-setup-default-charset)
4989 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4990 (when (gnus-virtual-group-p group)
4991 (setq cached gnus-newsgroup-cached))
4993 (setq gnus-newsgroup-unreads
4994 (gnus-sorted-ndifference
4995 (gnus-sorted-ndifference gnus-newsgroup-unreads
4996 gnus-newsgroup-marked)
4997 gnus-newsgroup-dormant))
4999 (setq gnus-newsgroup-processable nil)
5001 (gnus-update-read-articles group gnus-newsgroup-unreads)
5003 ;; Adjust and set lists of article marks.
5005 (gnus-adjust-marked-articles info))
5006 (if (setq articles select-articles)
5007 (setq gnus-newsgroup-unselected
5008 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5009 (setq articles (gnus-articles-to-read group read-all)))
5013 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5015 ((eq articles 0) nil)
5017 ;; Init the dependencies hash table.
5018 (setq gnus-newsgroup-dependencies
5019 (gnus-make-hashtable (length articles)))
5020 (gnus-set-global-variables)
5021 ;; Retrieve the headers and read them in.
5023 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5025 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5027 (setq gnus-newsgroup-cached cached))
5029 ;; Suppress duplicates?
5030 (when gnus-suppress-duplicates
5031 (gnus-dup-suppress-articles))
5033 ;; Set the initial limit.
5034 (setq gnus-newsgroup-limit (copy-sequence articles))
5035 ;; Remove canceled articles from the list of unread articles.
5036 (setq fetched-articles
5037 (mapcar (lambda (headers) (mail-header-number headers))
5038 gnus-newsgroup-headers))
5039 (setq gnus-newsgroup-articles fetched-articles)
5040 (setq gnus-newsgroup-unreads
5041 (gnus-sorted-nintersection
5042 gnus-newsgroup-unreads fetched-articles))
5043 (gnus-compute-unseen-list)
5045 ;; Removed marked articles that do not exist.
5046 (gnus-update-missing-marks
5047 (gnus-sorted-difference articles fetched-articles))
5048 ;; We might want to build some more threads first.
5049 (when (and gnus-fetch-old-headers
5050 (eq gnus-headers-retrieved-by 'nov))
5051 (if (eq gnus-fetch-old-headers 'invisible)
5052 (gnus-build-all-threads)
5053 (gnus-build-old-threads)))
5054 ;; Let the Gnus agent mark articles as read.
5056 (gnus-agent-get-undownloaded-list))
5057 ;; Remove list identifiers from subject
5058 (when gnus-list-identifiers
5059 (gnus-summary-remove-list-identifiers))
5060 ;; Check whether auto-expire is to be done in this group.
5061 (setq gnus-newsgroup-auto-expire
5062 (gnus-group-auto-expirable-p group))
5063 ;; Set up the article buffer now, if necessary.
5064 (unless gnus-single-article-buffer
5065 (gnus-article-setup-buffer))
5066 ;; First and last article in this newsgroup.
5067 (when gnus-newsgroup-headers
5068 (setq gnus-newsgroup-begin
5069 (mail-header-number (car gnus-newsgroup-headers))
5072 (gnus-last-element gnus-newsgroup-headers))))
5073 ;; GROUP is successfully selected.
5074 (or gnus-newsgroup-headers t)))))
5076 (defun gnus-compute-unseen-list ()
5077 ;; The `seen' marks are treated specially.
5078 (if (not gnus-newsgroup-seen)
5079 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5080 (setq gnus-newsgroup-unseen
5081 (gnus-inverse-list-range-intersection
5082 gnus-newsgroup-articles gnus-newsgroup-seen))))
5084 (defun gnus-summary-display-make-predicate (display)
5085 (require 'gnus-agent)
5086 (when (= (length display) 1)
5087 (setq display (car display)))
5088 (unless gnus-summary-display-cache
5089 (dolist (elem (append '((unread . unread)
5092 gnus-article-mark-lists))
5093 (push (cons (cdr elem)
5095 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5096 gnus-summary-display-cache)))
5097 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5098 (gnus-category-predicate-cache gnus-summary-display-cache))
5099 (gnus-get-predicate display)))
5101 ;; Uses the dynamically bound `number' variable.
5104 (defun gnus-article-marked-p (type &optional article)
5105 (let ((article (or article number)))
5108 (memq article gnus-newsgroup-marked))
5110 (memq article gnus-newsgroup-spam-marked))
5112 (memq article gnus-newsgroup-unsendable))
5113 ((eq type 'undownload)
5114 (memq article gnus-newsgroup-undownloaded))
5115 ((eq type 'download)
5116 (memq article gnus-newsgroup-downloadable))
5118 (memq article gnus-newsgroup-unreads))
5120 (memq article gnus-newsgroup-reads))
5122 (memq article gnus-newsgroup-dormant) )
5124 (memq article gnus-newsgroup-expirable))
5126 (memq article gnus-newsgroup-replied))
5128 (memq article gnus-newsgroup-killed))
5129 ((eq type 'bookmark)
5130 (assq article gnus-newsgroup-bookmarks))
5132 (assq article gnus-newsgroup-scored))
5134 (memq article gnus-newsgroup-saved))
5136 (memq article gnus-newsgroup-cached))
5138 (memq article gnus-newsgroup-forwarded))
5140 (not (memq article gnus-newsgroup-unseen)))
5142 (memq article gnus-newsgroup-recent))
5145 (defun gnus-articles-to-read (group &optional read-all)
5146 "Find out what articles the user wants to read."
5147 (let* ((display (gnus-group-find-parameter group 'display))
5149 ;; Select all articles if `read-all' is non-nil, or if there
5150 ;; are no unread articles.
5152 (and (zerop (length gnus-newsgroup-marked))
5153 (zerop (length gnus-newsgroup-unreads)))
5154 ;; Fetch all if the predicate is non-nil.
5155 gnus-newsgroup-display)
5156 ;; We want to select the headers for all the articles in
5157 ;; the group, so we select either all the active
5158 ;; articles in the group, or (if that's nil), the
5159 ;; articles in the cache.
5161 (gnus-uncompress-range (gnus-active group))
5162 (gnus-cache-articles-in-group group))
5163 ;; Select only the "normal" subset of articles.
5165 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5166 gnus-newsgroup-unreads)))
5167 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5168 (scored (length scored-list))
5169 (number (length articles))
5170 (marked (+ (length gnus-newsgroup-marked)
5171 (length gnus-newsgroup-dormant)))
5176 ((numberp gnus-newsgroup-display)
5177 gnus-newsgroup-display)
5181 ((and (or (<= scored marked) (= scored number))
5182 (numberp gnus-large-newsgroup)
5183 (> number gnus-large-newsgroup))
5184 (let* ((cursor-in-echo-area nil)
5185 (initial (gnus-parameter-large-newsgroup-initial
5186 gnus-newsgroup-name))
5190 "How many articles from %s (%s %d): "
5192 (gnus-group-decoded-name gnus-newsgroup-name)
5194 (if initial "max" "default")
5197 (cons (number-to-string initial)
5199 (if (string-match "^[ \t]*$" input) number input)))
5200 ((and (> scored marked) (< scored number)
5201 (> (- scored number) 20))
5204 (format "%s %s (%d scored, %d total): "
5205 "How many articles from"
5206 (gnus-group-decoded-name group)
5208 (if (string-match "^[ \t]*$" input)
5212 (message "Quit getting the articles to read")
5214 (setq select (if (stringp select) (string-to-number select) select))
5215 (if (or (null select) (zerop select))
5217 (if (and (not (zerop scored)) (<= (abs select) scored))
5219 (setq articles (sort scored-list '<))
5220 (setq number (length articles)))
5221 (setq articles (copy-sequence articles)))
5223 (when (< (abs select) number)
5225 ;; Select the N oldest articles.
5226 (setcdr (nthcdr (1- (abs select)) articles) nil)
5227 ;; Select the N most recent articles.
5228 (setq articles (nthcdr (- number select) articles))))
5229 (setq gnus-newsgroup-unselected
5230 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5231 (when gnus-alter-articles-to-read-function
5232 (setq gnus-newsgroup-unreads
5234 (funcall gnus-alter-articles-to-read-function
5235 gnus-newsgroup-name gnus-newsgroup-unreads)
5239 (defun gnus-killed-articles (killed articles)
5242 (when (inline (gnus-member-of-range (car articles) killed))
5243 (push (car articles) out))
5244 (setq articles (cdr articles)))
5247 (defun gnus-uncompress-marks (marks)
5248 "Uncompress the mark ranges in MARKS."
5249 (let ((uncompressed '(score bookmark))
5252 (if (memq (caar marks) uncompressed)
5253 (push (car marks) out)
5254 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5255 (setq marks (cdr marks)))
5258 (defun gnus-article-mark-to-type (mark)
5259 "Return the type of MARK."
5260 (or (cadr (assq mark gnus-article-special-mark-lists))
5263 (defun gnus-article-unpropagatable-p (mark)
5264 "Return whether MARK should be propagated to backend."
5265 (memq mark gnus-article-unpropagated-mark-lists))
5267 (defun gnus-adjust-marked-articles (info)
5268 "Set all article lists and remove all marks that are no longer valid."
5269 (let* ((marked-lists (gnus-info-marks info))
5270 (active (gnus-active (gnus-info-group info)))
5273 (types gnus-article-mark-lists)
5274 marks var articles article mark mark-type)
5276 (dolist (marks marked-lists)
5277 (setq mark (car marks)
5278 mark-type (gnus-article-mark-to-type mark)
5279 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5281 ;; We set the variable according to the type of the marks list,
5282 ;; and then adjust the marks to a subset of the active articles.
5284 ;; Adjust "simple" lists.
5285 ((eq mark-type 'list)
5286 (set var (setq articles (gnus-uncompress-range (cdr marks))))
5287 (when (memq mark '(tick dormant expire reply save))
5289 (when (or (< (setq article (pop articles)) min) (> article max))
5290 (set var (delq article (symbol-value var)))))))
5292 ((eq mark-type 'tuple)
5293 (set var (setq articles (cdr marks)))
5294 (when (not (listp (cdr (symbol-value var))))
5295 (set var (list (symbol-value var))))
5296 (when (not (listp (cdr articles)))
5297 (setq articles (list articles)))
5299 (when (or (not (consp (setq article (pop articles))))
5300 (< (car article) min)
5301 (> (car article) max))
5302 (set var (delq article (symbol-value var))))))
5303 ;; Adjust ranges (sloppily).
5304 ((eq mark-type 'range)
5307 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5308 ;; It should be (seen (NUM1 . NUM2)).
5309 (when (numberp (cddr marks))
5310 (setcdr marks (list (cdr marks))))
5311 (setq articles (cdr marks))
5312 (while (and articles
5313 (or (and (consp (car articles))
5314 (> min (cdar articles)))
5315 (and (numberp (car articles))
5316 (> min (car articles)))))
5318 (set var articles))))))))
5320 (defun gnus-update-missing-marks (missing)
5321 "Go through the list of MISSING articles and remove them from the mark lists."
5324 ;; Go through all types.
5325 (dolist (elem gnus-article-mark-lists)
5326 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5327 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5328 (when (symbol-value var)
5329 ;; This list has articles. So we delete all missing
5330 ;; articles from it.
5333 (set var (delq (pop m) (symbol-value var))))))))))
5335 (defun gnus-update-marks ()
5336 "Enter the various lists of marked articles into the newsgroup info list."
5337 (let ((types gnus-article-mark-lists)
5338 (info (gnus-get-info gnus-newsgroup-name))
5339 type list newmarked symbol delta-marks)
5341 ;; Add all marks lists to the list of marks lists.
5342 (while (setq type (pop types))
5343 (setq list (symbol-value
5345 (intern (format "gnus-newsgroup-%s" (car type))))))
5348 ;; Get rid of the entries of the articles that have the
5350 (when (and (eq (cdr type) 'score)
5354 (prev (cons nil list))
5357 (if (or (not (consp (car arts)))
5358 (= (cdar arts) gnus-summary-default-score))
5359 (setcdr prev (cdr arts))
5361 (setq arts (cdr arts)))
5362 (setq list (cdr all)))))
5364 (when (eq (cdr type) 'seen)
5365 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5367 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5368 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5370 (when (and (gnus-check-backend-function
5371 'request-set-mark gnus-newsgroup-name)
5372 (not (gnus-article-unpropagatable-p (cdr type))))
5373 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5374 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5375 (add (gnus-remove-from-range
5376 (gnus-copy-sequence list) old)))
5378 (push (list add 'add (list (cdr type))) delta-marks))
5380 (push (list del 'del (list (cdr type))) delta-marks))))
5383 (push (cons (cdr type) list) newmarked)))
5386 (unless (gnus-check-group gnus-newsgroup-name)
5387 (error "Can't open server for %s" gnus-newsgroup-name))
5388 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5390 ;; Enter these new marks into the info of the group.
5392 (setcar (nthcdr 3 info) newmarked)
5393 ;; Add the marks lists to the end of the info.
5395 (setcdr (nthcdr 2 info) (list newmarked))))
5397 ;; Cut off the end of the info if there's nothing else there.
5401 (when (nthcdr (decf i) info)
5402 (setcdr (nthcdr i info) nil)))))))
5404 (defun gnus-set-mode-line (where)
5405 "Set the mode line of the article or summary buffers.
5406 If WHERE is `summary', the summary mode line format will be used."
5407 ;; Is this mode line one we keep updated?
5408 (when (and (memq where gnus-updated-mode-lines)
5410 (intern (format "gnus-%s-mode-line-format-spec" where))))
5413 ;; We evaluate this in the summary buffer since these
5414 ;; variables are buffer-local to that buffer.
5415 (set-buffer gnus-summary-buffer)
5416 ;; We bind all these variables that are used in the `eval' form
5418 (let* ((mformat (symbol-value
5420 (format "gnus-%s-mode-line-format-spec" where))))
5421 (gnus-tmp-group-name (gnus-group-decoded-name
5422 gnus-newsgroup-name))
5423 (gnus-tmp-article-number (or gnus-current-article 0))
5424 (gnus-tmp-unread gnus-newsgroup-unreads)
5425 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5426 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5427 (gnus-tmp-unread-and-unselected
5428 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5429 (zerop gnus-tmp-unselected))
5431 ((zerop gnus-tmp-unselected)
5432 (format "{%d more}" gnus-tmp-unread-and-unticked))
5433 (t (format "{%d(+%d) more}"
5434 gnus-tmp-unread-and-unticked
5435 gnus-tmp-unselected))))
5437 (if (and gnus-current-headers
5438 (vectorp gnus-current-headers))
5439 (gnus-mode-string-quote
5440 (mail-header-subject gnus-current-headers))
5442 bufname-length max-len
5443 gnus-tmp-header);; passed as argument to any user-format-funcs
5444 (setq mode-string (eval mformat))
5445 (setq bufname-length (if (string-match "%b" mode-string)
5448 (if (eq where 'summary)
5450 (get-buffer gnus-article-buffer))))
5453 (setq max-len (max 4 (if gnus-mode-non-string-length
5455 gnus-mode-non-string-length
5457 (length mode-string))))
5458 ;; We might have to chop a bit of the string off...
5459 (when (> (length mode-string) max-len)
5461 (concat (gnus-truncate-string mode-string (- max-len 3))
5463 ;; Pad the mode string a bit.
5464 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5465 ;; Update the mode line.
5466 (setq mode-line-buffer-identification
5467 (gnus-mode-line-buffer-identification (list mode-string)))
5468 (set-buffer-modified-p t))))
5470 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5471 "Go through the HEADERS list and add all Xrefs to a hash table.
5472 The resulting hash table is returned, or nil if no Xrefs were found."
5473 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5474 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5475 (xref-hashtb (gnus-make-hashtable))
5476 start group entry number xrefs header)
5478 (setq header (pop headers))
5479 (when (and (setq xrefs (mail-header-xref header))
5480 (not (memq (setq number (mail-header-number header))
5483 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5484 (setq start (match-end 0))
5485 (setq group (if prefix
5486 (concat prefix (substring xrefs (match-beginning 1)
5488 (substring xrefs (match-beginning 1) (match-end 1))))
5490 (string-to-int (substring xrefs (match-beginning 2)
5492 (if (setq entry (gnus-gethash group xref-hashtb))
5493 (setcdr entry (cons number (cdr entry)))
5494 (gnus-sethash group (cons number nil) xref-hashtb)))))
5495 (and start xref-hashtb)))
5497 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5498 "Look through all the headers and mark the Xrefs as read."
5499 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5500 name entry info xref-hashtb idlist method nth4)
5502 (set-buffer gnus-group-buffer)
5503 (when (setq xref-hashtb
5504 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5507 (unless (string= from-newsgroup (setq name (symbol-name group)))
5508 (setq idlist (symbol-value group))
5509 ;; Dead groups are not updated.
5511 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
5513 (when (stringp (setq nth4 (gnus-info-method info)))
5514 (setq nth4 (gnus-server-to-method nth4))))
5515 ;; Only do the xrefs if the group has the same
5516 ;; select method as the group we have just read.
5517 (or (gnus-methods-equal-p
5518 nth4 (gnus-find-method-for-group from-newsgroup))
5520 (equal nth4 (setq method (gnus-find-method-for-group
5522 (and (equal (car nth4) (car method))
5523 (equal (nth 1 nth4) (nth 1 method))))
5524 gnus-use-cross-reference
5525 (or (not (eq gnus-use-cross-reference t))
5527 ;; Only do cross-references on subscribed
5528 ;; groups, if that is what is wanted.
5529 (<= (gnus-info-level info) gnus-level-subscribed))
5530 (gnus-group-make-articles-read name idlist))))
5533 (defun gnus-compute-read-articles (group articles)
5534 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
5535 (info (nth 2 entry))
5536 (active (gnus-active group))
5539 ;; First peel off all invalid article numbers.
5541 (let ((ids articles)
5543 (while (setq id (pop ids))
5544 (when (and first (> id (cdr active)))
5545 ;; We'll end up in this situation in one particular
5546 ;; obscure situation. If you re-scan a group and get
5547 ;; a new article that is cross-posted to a different
5548 ;; group that has not been re-scanned, you might get
5549 ;; crossposted article that has a higher number than
5550 ;; Gnus believes possible. So we re-activate this
5551 ;; group as well. This might mean doing the
5552 ;; crossposting thingy will *increase* the number
5553 ;; of articles in some groups. Tsk, tsk.
5554 (setq active (or (gnus-activate-group group) active)))
5555 (when (or (> id (cdr active))
5556 (< id (car active)))
5557 (setq articles (delq id articles))))))
5558 ;; If the read list is nil, we init it.
5560 (null (gnus-info-read info))
5562 (setq ninfo (cons 1 (1- (car active))))
5563 (setq ninfo (gnus-info-read info)))
5564 ;; Then we add the read articles to the range.
5566 ninfo (setq articles (sort articles '<))))))
5568 (defun gnus-group-make-articles-read (group articles)
5569 "Update the info of GROUP to say that ARTICLES are read."
5571 (entry (gnus-gethash group gnus-newsrc-hashtb))
5572 (info (nth 2 entry))
5573 (active (gnus-active group))
5576 (setq range (gnus-compute-read-articles group articles))
5578 (set-buffer gnus-group-buffer)
5581 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5582 (gnus-info-set-read ',info ',(gnus-info-read info))
5583 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5584 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5585 (gnus-group-update-group ,group t))))
5586 ;; Add the read articles to the range.
5587 (gnus-info-set-read info range)
5588 (gnus-request-set-mark group (list (list range 'add '(read))))
5589 ;; Then we have to re-compute how many unread
5590 ;; articles there are in this group.
5594 (setq num (- (1+ (cdr active)) (car active))))
5595 ((not (listp (cdr range)))
5596 (setq num (- (cdr active) (- (1+ (cdr range))
5600 (if (numberp (car range))
5602 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5603 (setq range (cdr range)))
5604 (setq num (- (cdr active) num))))
5605 ;; Update the number of unread articles.
5607 ;; Update the group buffer.
5608 (unless (gnus-ephemeral-group-p group)
5609 (gnus-group-update-group group t))))))
5611 (defvar gnus-newsgroup-none-id 0)
5613 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5614 (let ((cur nntp-server-buffer)
5617 (save-excursion (set-buffer gnus-summary-buffer)
5618 gnus-newsgroup-dependencies)))
5620 (mail-parse-charset gnus-newsgroup-charset)
5621 (mail-parse-ignored-charsets
5622 (save-excursion (condition-case nil
5623 (set-buffer gnus-summary-buffer)
5625 gnus-newsgroup-ignored-charsets)))
5627 (set-buffer nntp-server-buffer)
5628 ;; Translate all TAB characters into SPACE characters.
5629 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5630 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5631 (gnus-run-hooks 'gnus-parse-headers-hook)
5632 (let ((case-fold-search t)
5633 in-reply-to header p lines chars ctype)
5634 (goto-char (point-min))
5635 ;; Search to the beginning of the next header. Error messages
5636 ;; do not begin with 2 or 3.
5637 (while (re-search-forward "^[23][0-9]+ " nil t)
5640 ;; This implementation of this function, with nine
5641 ;; search-forwards instead of the one re-search-forward and
5642 ;; a case (which basically was the old function) is actually
5643 ;; about twice as fast, even though it looks messier. You
5644 ;; can't have everything, I guess. Speed and elegance
5645 ;; doesn't always go hand in hand.
5648 (make-full-mail-header
5654 (narrow-to-region (point)
5655 (or (and (search-forward "\n.\n" nil t)
5661 (if (search-forward "\nsubject:" nil t)
5662 (nnheader-header-value)
5667 (if (search-forward "\nfrom:" nil t)
5668 (nnheader-header-value)
5673 (if (search-forward "\ndate:" nil t)
5674 (nnheader-header-value) ""))
5678 (setq id (if (re-search-forward
5679 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5680 ;; We do it this way to make sure the Message-ID
5681 ;; is (somewhat) syntactically valid.
5682 (buffer-substring (match-beginning 1)
5684 ;; If there was no message-id, we just fake one
5685 ;; to make subsequent routines simpler.
5686 (nnheader-generate-fake-message-id))))
5690 (if (search-forward "\nreferences:" nil t)
5694 (nnheader-header-value)
5699 (search-backward ">" end t)
5702 (search-backward "<" end t)
5704 ;; Get the references from the in-reply-to header if there
5705 ;; were no references and the in-reply-to header looks
5707 (if (and (search-forward "\nin-reply-to:" nil t)
5708 (setq in-reply-to (nnheader-header-value))
5709 (string-match "<[^>]+>" in-reply-to))
5711 (setq ref (substring in-reply-to (match-beginning 0)
5713 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5714 (setq ref2 (substring in-reply-to (match-beginning 0)
5716 (when (> (length ref2) (length ref))
5723 (if (search-forward "\nchars: " nil t)
5724 (if (numberp (setq chars (ignore-errors (read cur))))
5730 (if (search-forward "\nlines: " nil t)
5731 (if (numberp (setq lines (ignore-errors (read cur))))
5737 (and (search-forward "\nxref:" nil t)
5738 (nnheader-header-value)))
5740 (when gnus-extra-headers
5741 (let ((extra gnus-extra-headers)
5745 (when (search-forward
5746 (concat "\n" (symbol-name (car extra)) ":") nil t)
5747 (push (cons (car extra) (nnheader-header-value)) out))
5751 (if (and (search-forward "\ncontent-type: " nil t)
5752 (setq ctype (nnheader-header-value)))
5753 (mime-entity-set-content-type-internal
5754 header (mime-parse-Content-Type ctype)))
5755 (when (equal id ref)
5758 (when gnus-alter-header-function
5759 (funcall gnus-alter-header-function header)
5760 (setq id (mail-header-id header)
5761 ref (gnus-parent-id (mail-header-references header))))
5764 (gnus-dependencies-add-header
5765 header dependencies force-new))
5766 (push header headers))
5767 (goto-char (point-max))
5769 (nreverse headers)))))
5771 ;; Goes through the xover lines and returns a list of vectors
5772 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5773 force-new dependencies
5774 group also-fetch-heads)
5775 "Parse the news overview data in the server buffer.
5776 Return a list of headers that match SEQUENCE (see
5777 `nntp-retrieve-headers')."
5778 ;; Get the Xref when the users reads the articles since most/some
5779 ;; NNTP servers do not include Xrefs when using XOVER.
5780 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5781 (let ((mail-parse-charset gnus-newsgroup-charset)
5782 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5783 (cur nntp-server-buffer)
5784 (dependencies (or dependencies gnus-newsgroup-dependencies))
5786 ((eq gnus-read-all-available-headers t)
5788 ((stringp gnus-read-all-available-headers)
5789 (string-match gnus-read-all-available-headers group))
5792 number headers header)
5794 (set-buffer nntp-server-buffer)
5795 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5796 ;; Allow the user to mangle the headers before parsing them.
5797 (gnus-run-hooks 'gnus-parse-headers-hook)
5798 (goto-char (point-min))
5799 (gnus-parse-without-error
5800 (while (and (or sequence allp)
5802 (setq number (read cur))
5804 (while (and sequence
5805 (< (car sequence) number))
5806 (setq sequence (cdr sequence))))
5809 (eq number (car sequence))))
5811 (setq sequence (cdr sequence))
5812 (setq header (inline
5813 (gnus-nov-parse-line
5814 number dependencies force-new)))))
5815 (push header headers))
5817 ;; A common bug in inn is that if you have posted an article and
5818 ;; then retrieves the active file, it will answer correctly --
5819 ;; the new article is included. However, a NOV entry for the
5820 ;; article may not have been generated yet, so this may fail.
5821 ;; We work around this problem by retrieving the last few
5822 ;; headers using HEAD.
5823 (if (or (not also-fetch-heads)
5825 ;; We (probably) got all the headers.
5827 (let ((gnus-nov-is-evil t))
5830 (when (eq (gnus-retrieve-headers sequence group) 'headers)
5831 (gnus-get-newsgroup-headers))))))))
5833 (defun gnus-article-get-xrefs ()
5834 "Fill in the Xref value in `gnus-current-headers', if necessary.
5835 This is meant to be called in `gnus-article-internal-prepare-hook'."
5836 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
5837 gnus-current-headers)))
5838 (or (not gnus-use-cross-reference)
5840 (and (mail-header-xref headers)
5841 (not (string= (mail-header-xref headers) "")))
5842 (let ((case-fold-search t)
5845 (nnheader-narrow-to-headers)
5846 (goto-char (point-min))
5847 (when (or (and (not (eobp))
5848 (eq (downcase (char-after)) ?x)
5849 (looking-at "Xref:"))
5850 (search-forward "\nXref:" nil t))
5851 (goto-char (1+ (match-end 0)))
5852 (setq xref (buffer-substring (point)
5853 (progn (end-of-line) (point))))
5854 (mail-header-set-xref headers xref)))))))
5856 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
5857 "Find article ID and insert the summary line for that article.
5858 OLD-HEADER can either be a header or a line number to insert
5859 the subject line on."
5860 (let* ((line (and (numberp old-header) old-header))
5861 (old-header (and (vectorp old-header) old-header))
5862 (header (cond ((and old-header use-old-header)
5865 (gnus-number-to-header id))
5866 (gnus-number-to-header id))
5868 (gnus-read-header id))))
5869 (number (and (numberp id) id))
5872 ;; Rebuild the thread that this article is part of and go to the
5873 ;; article we have fetched.
5874 (when (and (not gnus-show-threads)
5877 (setq d (gnus-data-find (mail-header-number old-header))))
5878 (goto-char (gnus-data-pos d))
5881 (- (gnus-point-at-bol)
5883 (1+ (gnus-point-at-eol))
5884 (gnus-delete-line))))))
5886 (mail-header-set-number header (mail-header-number old-header)))
5887 (setq gnus-newsgroup-sparse
5888 (delq (setq number (mail-header-number header))
5889 gnus-newsgroup-sparse))
5890 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
5891 (push number gnus-newsgroup-limit)
5892 (gnus-rebuild-thread (mail-header-id header) line)
5893 (gnus-summary-goto-subject number nil t))
5894 (when (and (numberp number)
5896 ;; We have to update the boundaries even if we can't fetch the
5897 ;; article if ID is a number -- so that the next `P' or `N'
5898 ;; command will fetch the previous (or next) article even
5899 ;; if the one we tried to fetch this time has been canceled.
5900 (when (> number gnus-newsgroup-end)
5901 (setq gnus-newsgroup-end number))
5902 (when (< number gnus-newsgroup-begin)
5903 (setq gnus-newsgroup-begin number))
5904 (setq gnus-newsgroup-unselected
5905 (delq number gnus-newsgroup-unselected)))
5906 ;; Report back a success?
5907 (and header (mail-header-number header))))
5909 ;;; Process/prefix in the summary buffer
5911 (defun gnus-summary-work-articles (n)
5912 "Return a list of articles to be worked upon.
5913 The prefix argument, the list of process marked articles, and the
5914 current article will be taken into consideration."
5916 (set-buffer gnus-summary-buffer)
5919 ;; A numerical prefix has been given.
5920 (setq n (prefix-numeric-value n))
5921 (let ((backward (< n 0))
5922 (n (abs (prefix-numeric-value n)))
5927 (push (setq article (gnus-summary-article-number))
5930 (gnus-summary-find-prev nil article)
5931 (gnus-summary-find-next nil article)))
5933 (nreverse articles)))
5934 ((and (gnus-region-active-p) (mark))
5935 (message "region active")
5936 ;; Work on the region between point and mark.
5937 (let ((max (max (point) (mark)))
5940 (goto-char (min (point) (mark)))
5943 (push (setq article (gnus-summary-article-number)) articles)
5944 (gnus-summary-find-next nil article)
5946 (nreverse articles))))
5947 (gnus-newsgroup-processable
5948 ;; There are process-marked articles present.
5949 ;; Save current state.
5950 (gnus-summary-save-process-mark)
5952 (reverse gnus-newsgroup-processable))
5954 ;; Just return the current article.
5955 (list (gnus-summary-article-number))))))
5957 (defmacro gnus-summary-iterate (arg &rest forms)
5958 "Iterate over the process/prefixed articles and do FORMS.
5959 ARG is the interactive prefix given to the command. FORMS will be
5960 executed with point over the summary line of the articles."
5961 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5962 `(let ((,articles (gnus-summary-work-articles ,arg)))
5964 (gnus-summary-goto-subject (car ,articles))
5968 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5969 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5971 (defun gnus-summary-save-process-mark ()
5972 "Push the current set of process marked articles on the stack."
5974 (push (copy-sequence gnus-newsgroup-processable)
5975 gnus-newsgroup-process-stack))
5977 (defun gnus-summary-kill-process-mark ()
5978 "Push the current set of process marked articles on the stack and unmark."
5980 (gnus-summary-save-process-mark)
5981 (gnus-summary-unmark-all-processable))
5983 (defun gnus-summary-yank-process-mark ()
5984 "Pop the last process mark state off the stack and restore it."
5986 (unless gnus-newsgroup-process-stack
5987 (error "Empty mark stack"))
5988 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5990 (defun gnus-summary-process-mark-set (set)
5991 "Make SET into the current process marked articles."
5992 (gnus-summary-unmark-all-processable)
5994 (gnus-summary-set-process-mark (pop set))))
5996 ;;; Searching and stuff
5998 (defun gnus-summary-search-group (&optional backward use-level)
5999 "Search for next unread newsgroup.
6000 If optional argument BACKWARD is non-nil, search backward instead."
6002 (set-buffer gnus-group-buffer)
6003 (when (gnus-group-search-forward
6004 backward nil (if use-level (gnus-group-group-level) nil))
6005 (gnus-group-group-name))))
6007 (defun gnus-summary-best-group (&optional exclude-group)
6008 "Find the name of the best unread group.
6009 If EXCLUDE-GROUP, do not go to this group."
6011 (set-buffer gnus-group-buffer)
6013 (gnus-group-best-unread-group exclude-group))))
6015 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
6016 (if backward (gnus-summary-find-prev)
6017 (let* ((dummy (gnus-summary-article-intangible-p))
6018 (article (or article (gnus-summary-article-number)))
6019 (arts (gnus-data-find-list article))
6021 (when (and (not dummy)
6022 (or (not gnus-summary-check-current)
6024 (not (gnus-data-unread-p (car arts)))))
6025 (setq arts (cdr arts)))
6030 (when (or (and undownloaded
6031 (memq (car arts) gnus-newsgroup-undownloaded))
6032 (gnus-data-unread-p (car arts)))
6033 (setq result (car arts)
6035 (setq arts (cdr arts)))
6038 (goto-char (gnus-data-pos result))
6039 (gnus-data-number result)))))
6041 (defun gnus-summary-find-prev (&optional unread article)
6042 (let* ((eobp (eobp))
6043 (article (or article (gnus-summary-article-number)))
6044 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
6046 (when (and (not eobp)
6047 (or (not gnus-summary-check-current)
6049 (not (gnus-data-unread-p (car arts)))))
6050 (setq arts (cdr arts)))
6055 (when (gnus-data-unread-p (car arts))
6056 (setq result (car arts)
6058 (setq arts (cdr arts)))
6061 (goto-char (gnus-data-pos result))
6062 (gnus-data-number result))))
6064 (defun gnus-summary-find-subject (subject &optional unread backward article)
6065 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6066 (article (or article (gnus-summary-article-number)))
6067 (articles (gnus-data-list backward))
6068 (arts (gnus-data-find-list article articles))
6070 (when (or (not gnus-summary-check-current)
6072 (not (gnus-data-unread-p (car arts))))
6073 (setq arts (cdr arts)))
6075 (and (or (not unread)
6076 (gnus-data-unread-p (car arts)))
6077 (vectorp (gnus-data-header (car arts)))
6079 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6080 (setq result (car arts)
6082 (setq arts (cdr arts)))
6084 (goto-char (gnus-data-pos result))
6085 (gnus-data-number result))))
6087 (defun gnus-summary-search-forward (&optional unread subject backward)
6088 "Search forward for an article.
6089 If UNREAD, look for unread articles. If SUBJECT, look for
6090 articles with that subject. If BACKWARD, search backward instead."
6091 (cond (subject (gnus-summary-find-subject subject unread backward))
6092 (backward (gnus-summary-find-prev unread))
6093 (t (gnus-summary-find-next unread))))
6095 (defun gnus-recenter (&optional n)
6096 "Center point in window and redisplay frame.
6097 Also do horizontal recentering."
6099 (when (and gnus-auto-center-summary
6100 (not (eq gnus-auto-center-summary 'vertical)))
6101 (gnus-horizontal-recenter))
6104 (defun gnus-summary-recenter ()
6105 "Center point in the summary window.
6106 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6107 displayed, no centering will be performed."
6108 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6109 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6111 (let* ((top (cond ((< (window-height) 4) 0)
6112 ((< (window-height) 7) 1)
6113 (t (if (numberp gnus-auto-center-summary)
6114 gnus-auto-center-summary
6116 (height (1- (window-height)))
6117 (bottom (save-excursion (goto-char (point-max))
6118 (forward-line (- height))
6120 (window (get-buffer-window (current-buffer))))
6121 ;; The user has to want it.
6122 (when gnus-auto-center-summary
6123 (when (get-buffer-window gnus-article-buffer)
6124 ;; Only do recentering when the article buffer is displayed,
6125 ;; Set the window start to either `bottom', which is the biggest
6126 ;; possible valid number, or the second line from the top,
6127 ;; whichever is the least.
6128 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6129 (if (> bottom top-pos)
6130 ;; Keep the second line from the top visible
6131 (set-window-start window top-pos t)
6132 ;; Try to keep the bottom line visible; if it's partially
6133 ;; obscured, either scroll one more line to make it fully
6134 ;; visible, or revert to using TOP-POS.
6136 (goto-char (point-max))
6138 (let ((last-line-start (point)))
6140 (set-window-start window (point) t)
6141 (when (not (pos-visible-in-window-p last-line-start window))
6143 (set-window-start window (min (point) top-pos) t)))))))
6144 ;; Do horizontal recentering while we're at it.
6145 (when (and (get-buffer-window (current-buffer) t)
6146 (not (eq gnus-auto-center-summary 'vertical)))
6147 (let ((selected (selected-window)))
6148 (select-window (get-buffer-window (current-buffer) t))
6149 (gnus-summary-position-point)
6150 (gnus-horizontal-recenter)
6151 (select-window selected))))))
6153 (defun gnus-summary-jump-to-group (newsgroup)
6154 "Move point to NEWSGROUP in group mode buffer."
6155 ;; Keep update point of group mode buffer if visible.
6156 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6157 (save-window-excursion
6158 ;; Take care of tree window mode.
6159 (when (get-buffer-window gnus-group-buffer)
6160 (pop-to-buffer gnus-group-buffer))
6161 (gnus-group-jump-to-group newsgroup))
6163 ;; Take care of tree window mode.
6164 (if (get-buffer-window gnus-group-buffer)
6165 (pop-to-buffer gnus-group-buffer)
6166 (set-buffer gnus-group-buffer))
6167 (gnus-group-jump-to-group newsgroup))))
6169 ;; This function returns a list of article numbers based on the
6170 ;; difference between the ranges of read articles in this group and
6171 ;; the range of active articles.
6172 (defun gnus-list-of-unread-articles (group)
6173 (let* ((read (gnus-info-read (gnus-get-info group)))
6174 (active (or (gnus-active group) (gnus-activate-group group)))
6177 ;; If none are read, then all are unread.
6179 (setq first (car active))
6180 ;; If the range of read articles is a single range, then the
6181 ;; first unread article is the article after the last read
6182 ;; article. Sounds logical, doesn't it?
6183 (if (and (not (listp (cdr read)))
6184 (or (< (car read) (car active))
6185 (progn (setq read (list read))
6187 (setq first (max (car active) (1+ (cdr read))))
6188 ;; `read' is a list of ranges.
6189 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6192 (setq first (car active)))
6195 (while (< first nlast)
6197 (setq first (1+ first))))
6198 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6199 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6200 (setq read (cdr read)))))
6201 ;; And add the last unread articles.
6202 (while (<= first last)
6204 (setq first (1+ first)))
6205 ;; Return the list of unread articles.
6206 (delq 0 (nreverse unread))))
6208 (defun gnus-list-of-read-articles (group)
6209 "Return a list of unread, unticked and non-dormant articles."
6210 (let* ((info (gnus-get-info group))
6211 (marked (gnus-info-marks info))
6212 (active (gnus-active group)))
6214 (gnus-list-range-difference
6215 (gnus-list-range-difference
6216 (gnus-sorted-complement
6217 (gnus-uncompress-range active)
6218 (gnus-list-of-unread-articles group))
6219 (cdr (assq 'dormant marked)))
6220 (cdr (assq 'tick marked))))))
6222 ;; Various summary commands
6224 (defun gnus-summary-select-article-buffer ()
6225 "Reconfigure windows to show article buffer."
6227 (if (not (gnus-buffer-live-p gnus-article-buffer))
6228 (error "There is no article buffer for this summary buffer")
6229 (gnus-configure-windows 'article)
6230 (select-window (get-buffer-window gnus-article-buffer))))
6232 (defun gnus-summary-universal-argument (arg)
6233 "Perform any operation on all articles that are process/prefixed."
6235 (let ((articles (gnus-summary-work-articles arg))
6242 (substitute-command-keys
6243 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6245 (gnus-error 1 "Undefined key")
6248 (gnus-summary-goto-subject (setq article (pop articles)))
6249 (let (gnus-newsgroup-processable)
6250 (command-execute func))
6251 (gnus-summary-remove-process-mark article)))))
6252 (gnus-summary-position-point))
6254 (defun gnus-summary-toggle-truncation (&optional arg)
6255 "Toggle truncation of summary lines.
6256 With arg, turn line truncation on if arg is positive."
6258 (setq truncate-lines
6259 (if (null arg) (not truncate-lines)
6260 (> (prefix-numeric-value arg) 0)))
6263 (defun gnus-summary-find-uncancelled ()
6264 "Return the number of an uncancelled article.
6265 The current article is considered, then following articles, then previous
6266 articles. If all articles are cancelled then return a dummy 0."
6268 (dolist (rev '(nil t))
6269 (unless found ; don't demand the reverse list if we don't need it
6270 (let ((data (gnus-data-find-list
6271 (gnus-summary-article-number) (gnus-data-list rev))))
6272 (while (and data (not found))
6273 (if (not (eq gnus-canceled-mark (gnus-data-mark (car data))))
6274 (setq found (gnus-data-number (car data))))
6275 (setq data (cdr data))))))
6278 (defun gnus-summary-reselect-current-group (&optional all rescan)
6279 "Exit and then reselect the current newsgroup.
6280 The prefix argument ALL means to select all articles."
6282 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6283 (error "Ephemeral groups can't be reselected"))
6284 (let ((current-subject (gnus-summary-find-uncancelled))
6285 (group gnus-newsgroup-name))
6286 (setq gnus-newsgroup-begin nil)
6288 ;; We have to adjust the point of group mode buffer because
6289 ;; point was moved to the next unread newsgroup by exiting.
6290 (gnus-summary-jump-to-group group)
6293 (save-window-excursion
6294 ;; Don't show group contents.
6295 (set-window-start (selected-window) (point-max))
6296 (gnus-group-get-new-news-this-group 1))))
6297 (gnus-group-read-group all t)
6298 (gnus-summary-goto-subject current-subject nil t)))
6300 (defun gnus-summary-rescan-group (&optional all)
6301 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6303 (gnus-summary-reselect-current-group all t))
6305 (defun gnus-summary-update-info (&optional non-destructive)
6307 (let ((group gnus-newsgroup-name))
6309 (when gnus-newsgroup-kill-headers
6310 (setq gnus-newsgroup-killed
6311 (gnus-compress-sequence
6313 (gnus-list-range-intersection
6314 gnus-newsgroup-unselected gnus-newsgroup-killed)
6315 gnus-newsgroup-unreads)
6317 (unless (listp (cdr gnus-newsgroup-killed))
6318 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6319 (let ((headers gnus-newsgroup-headers))
6320 ;; Set the new ranges of read articles.
6322 (set-buffer gnus-group-buffer)
6323 (gnus-undo-force-boundary))
6324 (gnus-update-read-articles
6325 group (gnus-sorted-union
6326 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6327 ;; Set the current article marks.
6328 (let ((gnus-newsgroup-scored
6329 (if (and (not gnus-save-score)
6330 (not non-destructive))
6332 gnus-newsgroup-scored)))
6334 (gnus-update-marks)))
6335 ;; Do the cross-ref thing.
6336 (when gnus-use-cross-reference
6337 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6338 ;; Do not switch windows but change the buffer to work.
6339 (set-buffer gnus-group-buffer)
6340 (unless (gnus-ephemeral-group-p group)
6341 (gnus-group-update-group group)))))))
6343 (defun gnus-summary-save-newsrc (&optional force)
6344 "Save the current number of read/marked articles in the dribble buffer.
6345 The dribble buffer will then be saved.
6346 If FORCE (the prefix), also save the .newsrc file(s)."
6348 (gnus-summary-update-info t)
6350 (gnus-save-newsrc-file)
6351 (gnus-dribble-save)))
6353 (defun gnus-summary-exit (&optional temporary)
6354 "Exit reading current newsgroup, and then return to group selection mode.
6355 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6357 (gnus-set-global-variables)
6358 (gnus-kill-save-kill-buffer)
6359 (gnus-async-halt-prefetch)
6360 (let* ((group gnus-newsgroup-name)
6361 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6362 (gnus-group-is-exiting-p t)
6365 (buf (current-buffer)))
6367 ;; Do adaptive scoring, and possibly save score files.
6368 (when gnus-newsgroup-adaptive
6369 (gnus-score-adaptive))
6370 (when gnus-use-scoring
6372 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6373 ;; If we have several article buffers, we kill them at exit.
6374 (unless gnus-single-article-buffer
6375 (gnus-kill-buffer gnus-original-article-buffer)
6376 (setq gnus-article-current nil))
6377 (when gnus-use-cache
6378 (gnus-cache-possibly-remove-articles)
6379 (gnus-cache-save-buffers))
6380 (gnus-async-prefetch-remove-group group)
6381 (when gnus-suppress-duplicates
6382 (gnus-dup-enter-articles))
6383 (when gnus-use-trees
6384 (gnus-tree-close group))
6385 (when gnus-use-cache
6386 (gnus-cache-write-active))
6387 ;; Remove entries for this group.
6388 (nnmail-purge-split-history (gnus-group-real-name group))
6389 ;; Make all changes in this group permanent.
6391 (gnus-run-hooks 'gnus-exit-group-hook)
6392 (gnus-summary-update-info))
6393 (gnus-close-group group)
6394 ;; Make sure where we were, and go to next newsgroup.
6395 (set-buffer gnus-group-buffer)
6397 (gnus-group-jump-to-group group))
6398 (gnus-run-hooks 'gnus-summary-exit-hook)
6399 (unless (or quit-config
6400 ;; If this group has disappeared from the summary
6401 ;; buffer, don't skip forwards.
6402 (not (string= group (gnus-group-group-name))))
6403 (gnus-group-next-unread-group 1))
6404 (setq group-point (point))
6407 ;; If we have several article buffers, we kill them at exit.
6408 (unless gnus-single-article-buffer
6409 (gnus-kill-buffer gnus-article-buffer)
6410 (gnus-kill-buffer gnus-original-article-buffer)
6411 (setq gnus-article-current nil))
6413 (if (not gnus-kill-summary-on-exit)
6415 (gnus-deaden-summary)
6417 ;; We set all buffer-local variables to nil. It is unclear why
6418 ;; this is needed, but if we don't, buffer-local variables are
6419 ;; not garbage-collected, it seems. This would the lead to en
6420 ;; ever-growing Emacs.
6421 (gnus-summary-clear-local-variables)
6422 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6423 (gnus-summary-clear-local-variables))
6424 (when (get-buffer gnus-article-buffer)
6425 (bury-buffer gnus-article-buffer))
6426 ;; We clear the global counterparts of the buffer-local
6427 ;; variables as well, just to be on the safe side.
6428 (set-buffer gnus-group-buffer)
6429 (gnus-summary-clear-local-variables)
6430 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6431 (gnus-summary-clear-local-variables))
6432 ;; Return to group mode buffer.
6433 (when (eq mode 'gnus-summary-mode)
6434 (gnus-kill-buffer buf)))
6435 (setq gnus-current-select-method gnus-select-method)
6436 (pop-to-buffer gnus-group-buffer)
6437 (if (not quit-config)
6439 (goto-char group-point)
6440 (gnus-configure-windows 'group 'force)
6441 (unless (pos-visible-in-window-p)
6442 (forward-line (/ (static-if (featurep 'xemacs)
6443 (window-displayed-height)
6444 (1- (window-height)))
6446 (set-window-start (selected-window) (point))
6447 (goto-char group-point)))
6448 (gnus-handle-ephemeral-exit quit-config))
6449 ;; Clear the current group name.
6451 (setq gnus-newsgroup-name nil)))))
6453 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6454 (defun gnus-summary-exit-no-update (&optional no-questions)
6455 "Quit reading current newsgroup without updating read article info."
6457 (let* ((group gnus-newsgroup-name)
6458 (gnus-group-is-exiting-p t)
6459 (quit-config (gnus-group-quit-config group)))
6460 (when (or no-questions
6462 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6463 (gnus-async-halt-prefetch)
6465 (delq 'gnus-summary-expire-articles
6466 (copy-sequence gnus-summary-prepare-exit-hook)))
6467 ;; If we have several article buffers, we kill them at exit.
6468 (unless gnus-single-article-buffer
6469 (gnus-kill-buffer gnus-article-buffer)
6470 (gnus-kill-buffer gnus-original-article-buffer)
6471 (setq gnus-article-current nil))
6472 (if (not gnus-kill-summary-on-exit)
6473 (gnus-deaden-summary)
6474 (gnus-close-group group)
6475 (gnus-summary-clear-local-variables)
6476 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6477 (gnus-summary-clear-local-variables))
6478 (set-buffer gnus-group-buffer)
6479 (gnus-summary-clear-local-variables)
6480 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6481 (gnus-summary-clear-local-variables))
6482 (when (get-buffer gnus-summary-buffer)
6483 (kill-buffer gnus-summary-buffer)))
6484 (unless gnus-single-article-buffer
6485 (setq gnus-article-current nil))
6486 (when gnus-use-trees
6487 (gnus-tree-close group))
6488 (gnus-async-prefetch-remove-group group)
6489 (when (get-buffer gnus-article-buffer)
6490 (bury-buffer gnus-article-buffer))
6491 ;; Return to the group buffer.
6492 (gnus-configure-windows 'group 'force)
6493 ;; Clear the current group name.
6494 (setq gnus-newsgroup-name nil)
6495 (unless (gnus-ephemeral-group-p group)
6496 (gnus-group-update-group group))
6497 (when (equal (gnus-group-group-name) group)
6498 (gnus-group-next-unread-group 1))
6500 (gnus-handle-ephemeral-exit quit-config)))))
6502 (defun gnus-handle-ephemeral-exit (quit-config)
6503 "Handle movement when leaving an ephemeral group.
6504 The state which existed when entering the ephemeral is reset."
6505 (if (not (buffer-name (car quit-config)))
6506 (gnus-configure-windows 'group 'force)
6507 (set-buffer (car quit-config))
6508 (cond ((eq major-mode 'gnus-summary-mode)
6509 (gnus-set-global-variables))
6510 ((eq major-mode 'gnus-article-mode)
6512 ;; The `gnus-summary-buffer' variable may point
6513 ;; to the old summary buffer when using a single
6515 (unless (gnus-buffer-live-p gnus-summary-buffer)
6516 (set-buffer gnus-group-buffer))
6517 (set-buffer gnus-summary-buffer)
6518 (gnus-set-global-variables))))
6519 (if (or (eq (cdr quit-config) 'article)
6520 (eq (cdr quit-config) 'pick))
6522 ;; The current article may be from the ephemeral group
6523 ;; thus it is best that we reload this article
6524 (gnus-summary-show-article)
6525 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6526 (gnus-configure-windows 'pick 'force)
6527 (gnus-configure-windows (cdr quit-config) 'force)))
6528 (gnus-configure-windows (cdr quit-config) 'force))
6529 (when (eq major-mode 'gnus-summary-mode)
6530 (gnus-summary-next-subject 1 nil t)
6531 (gnus-summary-recenter)
6532 (gnus-summary-position-point))))
6534 (defun gnus-summary-preview-mime-message ()
6535 "MIME decode and play this message."
6537 (let ((gnus-break-pages nil)
6539 (gnus-summary-select-article gnus-show-all-headers t))
6540 (let ((w (get-buffer-window gnus-article-buffer)))
6542 (select-window (get-buffer-window gnus-article-buffer)))))
6546 (defvar gnus-dead-summary-mode-map nil)
6548 (unless gnus-dead-summary-mode-map
6549 (setq gnus-dead-summary-mode-map (make-keymap))
6550 (suppress-keymap gnus-dead-summary-mode-map)
6551 (substitute-key-definition
6552 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6553 (dolist (key '("\C-d" "\r" "\177" [delete]))
6554 (define-key gnus-dead-summary-mode-map
6555 key 'gnus-summary-wake-up-the-dead))
6556 (dolist (key '("q" "Q"))
6557 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6559 (defvar gnus-dead-summary-mode nil
6560 "Minor mode for Gnus summary buffers.")
6562 (defun gnus-dead-summary-mode (&optional arg)
6563 "Minor mode for Gnus summary buffers."
6565 (when (eq major-mode 'gnus-summary-mode)
6566 (make-local-variable 'gnus-dead-summary-mode)
6567 (setq gnus-dead-summary-mode
6568 (if (null arg) (not gnus-dead-summary-mode)
6569 (> (prefix-numeric-value arg) 0)))
6570 (when gnus-dead-summary-mode
6571 (gnus-add-minor-mode
6572 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6574 (defun gnus-deaden-summary ()
6575 "Make the current summary buffer into a dead summary buffer."
6576 ;; Kill any previous dead summary buffer.
6577 (when (and gnus-dead-summary
6578 (buffer-name gnus-dead-summary))
6580 (set-buffer gnus-dead-summary)
6581 (when gnus-dead-summary-mode
6582 (kill-buffer (current-buffer)))))
6583 ;; Make this the current dead summary.
6584 (setq gnus-dead-summary (current-buffer))
6585 (gnus-dead-summary-mode 1)
6586 (let ((name (buffer-name)))
6587 (when (string-match "Summary" name)
6589 (concat (substring name 0 (match-beginning 0)) "Dead "
6590 (substring name (match-beginning 0)))
6594 (defun gnus-kill-or-deaden-summary (buffer)
6595 "Kill or deaden the summary BUFFER."
6597 (when (and (buffer-name buffer)
6598 (not gnus-single-article-buffer))
6601 (gnus-kill-buffer gnus-article-buffer)
6602 (gnus-kill-buffer gnus-original-article-buffer)))
6605 (gnus-kill-summary-on-exit
6606 (when (and gnus-use-trees
6607 (gnus-buffer-exists-p buffer))
6610 (gnus-tree-close gnus-newsgroup-name)))
6611 (gnus-kill-buffer buffer))
6612 ;; Deaden the buffer.
6613 ((gnus-buffer-exists-p buffer)
6616 (gnus-deaden-summary))))))
6618 (defun gnus-summary-wake-up-the-dead (&rest args)
6619 "Wake up the dead summary buffer."
6621 (gnus-dead-summary-mode -1)
6622 (let ((name (buffer-name)))
6623 (when (string-match "Dead " name)
6625 (concat (substring name 0 (match-beginning 0))
6626 (substring name (match-end 0)))
6628 (gnus-message 3 "This dead summary is now alive again"))
6630 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6631 (defun gnus-summary-fetch-faq (&optional faq-dir)
6632 "Fetch the FAQ for the current group.
6633 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6637 (when current-prefix-arg
6639 "FAQ dir: " (and (listp gnus-group-faq-directory)
6640 (mapcar (lambda (file) (list file))
6641 gnus-group-faq-directory))))))
6642 (let (gnus-faq-buffer)
6643 (when (setq gnus-faq-buffer
6644 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6645 (gnus-configure-windows 'summary-faq))))
6647 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6648 (defun gnus-summary-describe-group (&optional force)
6649 "Describe the current newsgroup."
6651 (gnus-group-describe-group force gnus-newsgroup-name))
6653 (defun gnus-summary-describe-briefly ()
6654 "Describe summary mode commands briefly."
6656 (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")))
6658 ;; Walking around group mode buffer from summary mode.
6660 (defun gnus-summary-next-group (&optional no-article target-group backward)
6661 "Exit current newsgroup and then select next unread newsgroup.
6662 If prefix argument NO-ARTICLE is non-nil, no article is selected
6663 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
6664 previous group instead."
6666 ;; Stop pre-fetching.
6667 (gnus-async-halt-prefetch)
6668 (let ((current-group gnus-newsgroup-name)
6669 (current-buffer (current-buffer))
6671 (gnus-summary-exit t)
6672 (while (not entered)
6673 ;; Then we find what group we are supposed to enter.
6674 (set-buffer gnus-group-buffer)
6675 (gnus-group-jump-to-group current-group)
6678 (if (eq gnus-keep-same-level 'best)
6679 (gnus-summary-best-group gnus-newsgroup-name)
6680 (gnus-summary-search-group backward gnus-keep-same-level))))
6681 (if (not target-group)
6682 ;; There are no further groups, so we return to the group
6685 (gnus-message 5 "Returning to the group buffer")
6687 (when (gnus-buffer-live-p current-buffer)
6688 (set-buffer current-buffer)
6689 (gnus-summary-exit))
6690 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6691 ;; We try to enter the target group.
6692 (gnus-group-jump-to-group target-group)
6693 (let ((unreads (gnus-group-group-unread)))
6694 (if (and (or (eq t unreads)
6695 (and unreads (not (zerop unreads))))
6697 ;; Now we semi-exit this group to update Xrefs
6698 ;; and all variables. We can't do a real exit,
6699 ;; because the window conf must remain the same
6700 ;; in case the user is prompted for info, and we
6701 ;; don't want the window conf to change before
6703 (when (gnus-buffer-live-p current-buffer)
6704 (set-buffer current-buffer)
6705 (gnus-summary-exit t))
6706 (gnus-summary-read-group
6707 target-group nil no-article
6708 (and (buffer-name current-buffer) current-buffer)
6711 (setq current-group target-group
6712 target-group nil)))))))
6714 (defun gnus-summary-prev-group (&optional no-article)
6715 "Exit current newsgroup and then select previous unread newsgroup.
6716 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6718 (gnus-summary-next-group no-article nil t))
6720 ;; Walking around summary lines.
6722 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6723 "Go to the first unread subject.
6724 If UNREAD is non-nil, go to the first unread article.
6725 Returns the article selected or nil if there are no unread articles."
6730 ((null gnus-newsgroup-data)
6731 (gnus-message 3 "No articles in the group")
6733 ;; Pick the first article.
6735 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6736 (gnus-data-number (car gnus-newsgroup-data)))
6737 ;; No unread articles.
6738 ((null gnus-newsgroup-unreads)
6739 (gnus-message 3 "No more unread articles")
6741 ;; Find the first unread article.
6743 (let ((data gnus-newsgroup-data))
6745 (and (not (and undownloaded
6747 gnus-newsgroup-undownloaded)))
6750 (gnus-data-number (car data))
6751 gnus-newsgroup-unseen))
6752 (not (gnus-data-unread-p (car data))))
6753 (not (gnus-data-unread-p (car data))))))
6754 (setq data (cdr data)))
6756 (goto-char (gnus-data-pos (car data)))
6757 (gnus-data-number (car data))))))
6758 (gnus-summary-position-point)))
6760 (defun gnus-summary-next-subject (n &optional unread dont-display)
6761 "Go to next N'th summary line.
6762 If N is negative, go to the previous N'th subject line.
6763 If UNREAD is non-nil, only unread articles are selected.
6764 The difference between N and the actual number of steps taken is
6767 (let ((backward (< n 0))
6771 (gnus-summary-find-prev unread)
6772 (gnus-summary-find-next unread)))
6773 (unless (zerop (setq n (1- n)))
6774 (gnus-summary-show-thread)))
6776 (gnus-message 7 "No more%s articles"
6777 (if unread " unread" "")))
6778 (unless dont-display
6779 (gnus-summary-recenter)
6780 (gnus-summary-position-point))
6783 (defun gnus-summary-next-unread-subject (n)
6784 "Go to next N'th unread summary line."
6786 (gnus-summary-next-subject n t))
6788 (defun gnus-summary-prev-subject (n &optional unread)
6789 "Go to previous N'th summary line.
6790 If optional argument UNREAD is non-nil, only unread article is selected."
6792 (gnus-summary-next-subject (- n) unread))
6794 (defun gnus-summary-prev-unread-subject (n)
6795 "Go to previous N'th unread summary line."
6797 (gnus-summary-next-subject (- n) t))
6799 (defun gnus-summary-goto-subjects (articles)
6800 "Insert the subject header for ARTICLES in the current buffer."
6802 (dolist (article articles)
6803 (gnus-summary-goto-subject article t)))
6804 (gnus-summary-limit (append articles gnus-newsgroup-limit))
6805 (gnus-summary-position-point))
6807 (defun gnus-summary-goto-subject (article &optional force silent)
6808 "Go the subject line of ARTICLE.
6809 If FORCE, also allow jumping to articles not currently shown."
6810 (interactive "nArticle number: ")
6811 (unless (numberp article)
6812 (error "Article %s is not a number" article))
6814 (data (gnus-data-find article)))
6815 ;; We read in the article if we have to.
6818 (gnus-summary-insert-subject
6820 (if (or (numberp force) (vectorp force)) force)
6822 (setq data (gnus-data-find article)))
6827 (gnus-message 3 "Can't find article %d" article))
6829 (let ((pt (gnus-data-pos data)))
6831 (gnus-summary-set-article-display-arrow pt))
6832 (gnus-summary-position-point)
6835 ;; Walking around summary lines with displaying articles.
6837 (defun gnus-summary-expand-window (&optional arg)
6838 "Make the summary buffer take up the entire Emacs frame.
6839 Given a prefix, will force an `article' buffer configuration."
6842 (gnus-configure-windows 'article 'force)
6843 (gnus-configure-windows 'summary 'force)))
6845 (defun gnus-summary-display-article (article &optional all-header)
6846 "Display ARTICLE in article buffer."
6847 (when (gnus-buffer-live-p gnus-article-buffer)
6848 (with-current-buffer gnus-article-buffer
6849 (set-buffer-multibyte t)))
6850 (gnus-set-global-variables)
6851 (when (gnus-buffer-live-p gnus-article-buffer)
6852 (with-current-buffer gnus-article-buffer
6853 (setq gnus-article-charset gnus-newsgroup-charset)
6854 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
6855 (set-buffer-multibyte t)))
6859 (if gnus-summary-display-article-function
6860 (funcall gnus-summary-display-article-function article all-header)
6861 (gnus-article-prepare article all-header))
6862 (with-current-buffer gnus-article-buffer
6863 (set (make-local-variable 'gnus-summary-search-article-matched-data)
6865 (gnus-run-hooks 'gnus-select-article-hook)
6866 (when (and gnus-current-article
6867 (not (zerop gnus-current-article)))
6868 (gnus-summary-goto-subject gnus-current-article))
6869 (gnus-summary-recenter)
6870 (when (and gnus-use-trees gnus-show-threads)
6871 (gnus-possibly-generate-tree article)
6872 (gnus-highlight-selected-tree article))
6873 ;; Successfully display article.
6874 (gnus-article-set-window-start
6875 (cdr (assq article gnus-newsgroup-bookmarks))))))
6877 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
6878 "Select the current article.
6879 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
6880 non-nil, the article will be re-fetched even if it already present in
6881 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
6883 ;; Make sure we are in the summary buffer to work around bbdb bug.
6884 (unless (eq major-mode 'gnus-summary-mode)
6885 (set-buffer gnus-summary-buffer))
6886 (let ((article (or article (gnus-summary-article-number)))
6887 (all-headers (not (not all-headers))) ;Must be T or NIL.
6888 gnus-summary-display-article-function)
6890 (gnus-summary-article-pseudo-p article)
6891 (error "This is a pseudo-article"))
6893 (set-buffer gnus-summary-buffer)
6894 (if (or (and gnus-single-article-buffer
6895 (or (null gnus-current-article)
6896 (null gnus-article-current)
6897 (null (get-buffer gnus-article-buffer))
6898 (not (eq article (cdr gnus-article-current)))
6899 (not (equal (car gnus-article-current)
6900 gnus-newsgroup-name))))
6901 (and (not gnus-single-article-buffer)
6902 (or (null gnus-current-article)
6903 (not (eq gnus-current-article article))))
6905 ;; The requested article is different from the current article.
6907 (gnus-summary-display-article article all-headers)
6908 (gnus-article-set-window-start
6909 (cdr (assq article gnus-newsgroup-bookmarks)))
6913 (defun gnus-summary-force-verify-and-decrypt ()
6915 (let ((mm-verify-option 'known)
6916 (mm-decrypt-option 'known)
6917 (gnus-buttonized-mime-types (append (list "multipart/signed"
6918 "multipart/encrypted")
6919 gnus-buttonized-mime-types)))
6920 (gnus-summary-select-article nil 'force)))
6922 (defun gnus-summary-set-current-mark (&optional current-mark)
6923 "Obsolete function."
6926 (defun gnus-summary-next-article (&optional unread subject backward push)
6927 "Select the next article.
6928 If UNREAD, only unread articles are selected.
6929 If SUBJECT, only articles with SUBJECT are selected.
6930 If BACKWARD, the previous article is selected instead of the next."
6933 ;; Is there such an article?
6934 ((and (gnus-summary-search-forward unread subject backward)
6935 (or (gnus-summary-display-article (gnus-summary-article-number))
6936 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
6937 (gnus-summary-position-point))
6938 ;; If not, we try the first unread, if that is wanted.
6940 gnus-auto-select-same
6941 (gnus-summary-first-unread-article))
6942 (gnus-summary-position-point)
6943 (gnus-message 6 "Wrapped"))
6944 ;; Try to get next/previous article not displayed in this group.
6945 ((and gnus-auto-extend-newsgroup
6946 (not unread) (not subject))
6947 (gnus-summary-goto-article
6948 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
6949 nil (count-lines (point-min) (point))))
6950 ;; Go to next/previous group.
6952 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
6953 (gnus-summary-jump-to-group gnus-newsgroup-name))
6954 (let ((cmd last-command-char)
6957 (set-buffer gnus-group-buffer)
6960 (if (eq gnus-keep-same-level 'best)
6961 (gnus-summary-best-group gnus-newsgroup-name)
6962 (gnus-summary-search-group backward gnus-keep-same-level))))
6963 ;; For some reason, the group window gets selected. We change
6965 (select-window (get-buffer-window (current-buffer)))
6966 ;; Select next unread newsgroup automagically.
6968 ((or (not gnus-auto-select-next)
6970 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
6971 ((or (eq gnus-auto-select-next 'quietly)
6972 (and (eq gnus-auto-select-next 'slightly-quietly)
6974 (and (eq gnus-auto-select-next 'almost-quietly)
6975 (gnus-summary-last-article-p)))
6977 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
6979 (gnus-message 7 "No more%s articles (%s)..."
6980 (if unread " unread" "")
6981 (if group (concat "selecting " group)
6983 (gnus-summary-next-group nil group backward)))
6985 (when (gnus-key-press-event-p last-input-event)
6986 (gnus-summary-walk-group-buffer
6987 gnus-newsgroup-name cmd unread backward point))))))))
6989 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
6990 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
6991 (?\C-p (gnus-group-prev-unread-group 1))))
6992 (cursor-in-echo-area t)
6993 keve key group ended prompt)
6995 (set-buffer gnus-group-buffer)
6998 (if (eq gnus-keep-same-level 'best)
6999 (gnus-summary-best-group gnus-newsgroup-name)
7000 (gnus-summary-search-group backward gnus-keep-same-level))))
7004 "No more%s articles%s " (if unread " unread" "")
7006 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7007 (format " (Type %s for %s [%s])"
7008 (single-key-description cmd) group
7009 (car (gnus-gethash group gnus-newsrc-hashtb)))
7010 (format " (Type %s to exit %s)"
7011 (single-key-description cmd)
7012 gnus-newsgroup-name))))
7013 ;; Confirm auto selection.
7014 (setq key (car (setq keve (gnus-read-event-char prompt)))
7017 ((assq key keystrokes)
7018 (let ((obuf (current-buffer)))
7019 (switch-to-buffer gnus-group-buffer)
7021 (gnus-group-jump-to-group group))
7022 (eval (cadr (assq key keystrokes)))
7023 (setq group (gnus-group-group-name))
7024 (switch-to-buffer obuf))
7028 (gnus-ephemeral-group-p gnus-newsgroup-name))
7030 (gnus-summary-next-group nil group backward)))
7032 (push (cdr keve) unread-command-events))))))
7034 (defun gnus-summary-next-unread-article ()
7035 "Select unread article after current one."
7037 (gnus-summary-next-article
7038 (or (not (eq gnus-summary-goto-unread 'never))
7039 (gnus-summary-last-article-p (gnus-summary-article-number)))
7040 (and gnus-auto-select-same
7041 (gnus-summary-article-subject))))
7043 (defun gnus-summary-prev-article (&optional unread subject)
7044 "Select the article after the current one.
7045 If UNREAD is non-nil, only unread articles are selected."
7047 (gnus-summary-next-article unread subject t))
7049 (defun gnus-summary-prev-unread-article ()
7050 "Select unread article before current one."
7052 (gnus-summary-prev-article
7053 (or (not (eq gnus-summary-goto-unread 'never))
7054 (gnus-summary-first-article-p (gnus-summary-article-number)))
7055 (and gnus-auto-select-same
7056 (gnus-summary-article-subject))))
7058 (defun gnus-summary-next-page (&optional lines circular stop)
7059 "Show next page of the selected article.
7060 If at the end of the current article, select the next article.
7061 LINES says how many lines should be scrolled up.
7063 If CIRCULAR is non-nil, go to the start of the article instead of
7064 selecting the next article when reaching the end of the current
7067 If STOP is non-nil, just stop when reaching the end of the message."
7069 (setq gnus-summary-buffer (current-buffer))
7070 (gnus-set-global-variables)
7071 (let ((article (gnus-summary-article-number))
7072 (article-window (get-buffer-window gnus-article-buffer t))
7074 ;; If the buffer is empty, we have no article.
7076 (error "No article to select"))
7077 (gnus-configure-windows 'article)
7078 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7079 (if (and (eq gnus-summary-goto-unread 'never)
7080 (not (gnus-summary-last-article-p article)))
7081 (gnus-summary-next-article)
7082 (gnus-summary-next-unread-article))
7083 (if (or (null gnus-current-article)
7084 (null gnus-article-current)
7085 (/= article (cdr gnus-article-current))
7086 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7087 ;; Selected subject is different from current article's.
7088 (gnus-summary-display-article article)
7089 (when article-window
7090 (gnus-eval-in-buffer-window gnus-article-buffer
7091 (setq endp (gnus-article-next-page lines)))
7094 (gnus-message 3 "End of message"))
7096 (gnus-summary-beginning-of-article))
7098 (gnus-message 3 "End of message"))
7100 (if (and (eq gnus-summary-goto-unread 'never)
7101 (not (gnus-summary-last-article-p article)))
7102 (gnus-summary-next-article)
7103 (gnus-summary-next-unread-article))))))))
7104 (gnus-summary-recenter)
7105 (gnus-summary-position-point)))
7107 (defun gnus-summary-prev-page (&optional lines move)
7108 "Show previous page of selected article.
7109 Argument LINES specifies lines to be scrolled down.
7110 If MOVE, move to the previous unread article if point is at
7111 the beginning of the buffer."
7113 (let ((article (gnus-summary-article-number))
7114 (article-window (get-buffer-window gnus-article-buffer t))
7116 (gnus-configure-windows 'article)
7117 (if (or (null gnus-current-article)
7118 (null gnus-article-current)
7119 (/= article (cdr gnus-article-current))
7120 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7121 ;; Selected subject is different from current article's.
7122 (gnus-summary-display-article article)
7123 (gnus-summary-recenter)
7124 (when article-window
7125 (gnus-eval-in-buffer-window gnus-article-buffer
7126 (setq endp (gnus-article-prev-page lines)))
7127 (when (and move endp)
7129 (gnus-message 3 "Beginning of message"))
7131 (if (and (eq gnus-summary-goto-unread 'never)
7132 (not (gnus-summary-first-article-p article)))
7133 (gnus-summary-prev-article)
7134 (gnus-summary-prev-unread-article))))))))
7135 (gnus-summary-position-point))
7137 (defun gnus-summary-prev-page-or-article (&optional lines)
7138 "Show previous page of selected article.
7139 Argument LINES specifies lines to be scrolled down.
7140 If at the beginning of the article, go to the next article."
7142 (gnus-summary-prev-page lines t))
7144 (defun gnus-summary-scroll-up (lines)
7145 "Scroll up (or down) one line current article.
7146 Argument LINES specifies lines to be scrolled up (or down if negative)."
7148 (gnus-configure-windows 'article)
7149 (gnus-summary-show-thread)
7150 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7151 (gnus-eval-in-buffer-window gnus-article-buffer
7153 (when (gnus-article-next-page lines)
7154 (gnus-message 3 "End of message")))
7156 (gnus-article-prev-page (- lines))))))
7157 (gnus-summary-recenter)
7158 (gnus-summary-position-point))
7160 (defun gnus-summary-scroll-down (lines)
7161 "Scroll down (or up) one line current article.
7162 Argument LINES specifies lines to be scrolled down (or up if negative)."
7164 (gnus-summary-scroll-up (- lines)))
7166 (defun gnus-summary-next-same-subject ()
7167 "Select next article which has the same subject as current one."
7169 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7171 (defun gnus-summary-prev-same-subject ()
7172 "Select previous article which has the same subject as current one."
7174 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7176 (defun gnus-summary-next-unread-same-subject ()
7177 "Select next unread article which has the same subject as current one."
7179 (gnus-summary-next-article t (gnus-summary-article-subject)))
7181 (defun gnus-summary-prev-unread-same-subject ()
7182 "Select previous unread article which has the same subject as current one."
7184 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7186 (defun gnus-summary-first-unread-article ()
7187 "Select the first unread article.
7188 Return nil if there are no unread articles."
7191 (when (gnus-summary-first-subject t)
7192 (gnus-summary-show-thread)
7193 (gnus-summary-first-subject t)
7194 (gnus-summary-display-article (gnus-summary-article-number)))
7195 (gnus-summary-position-point)))
7197 (defun gnus-summary-first-unread-subject ()
7198 "Place the point on the subject line of the first unread article.
7199 Return nil if there are no unread articles."
7202 (when (gnus-summary-first-subject t)
7203 (gnus-summary-show-thread)
7204 (gnus-summary-first-subject t))
7205 (gnus-summary-position-point)))
7207 (defun gnus-summary-first-unseen-subject ()
7208 "Place the point on the subject line of the first unseen article.
7209 Return nil if there are no unseen articles."
7212 (when (gnus-summary-first-subject t t t)
7213 (gnus-summary-show-thread)
7214 (gnus-summary-first-subject t t t))
7215 (gnus-summary-position-point)))
7217 (defun gnus-summary-first-unseen-or-unread-subject ()
7218 "Place the point on the subject line of the first unseen article.
7219 Return nil if there are no unseen articles."
7222 (unless (when (gnus-summary-first-subject t t t)
7223 (gnus-summary-show-thread)
7224 (gnus-summary-first-subject t t t))
7225 (when (gnus-summary-first-subject t)
7226 (gnus-summary-show-thread)
7227 (gnus-summary-first-subject t)))
7228 (gnus-summary-position-point)))
7230 (defun gnus-summary-first-article ()
7231 "Select the first article.
7232 Return nil if there are no articles."
7235 (when (gnus-summary-first-subject)
7236 (gnus-summary-show-thread)
7237 (gnus-summary-first-subject)
7238 (gnus-summary-display-article (gnus-summary-article-number)))
7239 (gnus-summary-position-point)))
7241 (defun gnus-summary-best-unread-article (&optional arg)
7242 "Select the unread article with the highest score.
7243 If given a prefix argument, select the next unread article that has a
7244 score higher than the default score."
7246 (let ((article (if arg
7247 (gnus-summary-better-unread-subject)
7248 (gnus-summary-best-unread-subject))))
7250 (gnus-summary-goto-article article)
7251 (error "No unread articles"))))
7253 (defun gnus-summary-best-unread-subject ()
7254 "Select the unread subject with the highest score."
7256 (let ((best -1000000)
7257 (data gnus-newsgroup-data)
7260 (and (gnus-data-unread-p (car data))
7262 (gnus-summary-article-score (gnus-data-number (car data))))
7265 article (gnus-data-number (car data))))
7266 (setq data (cdr data)))
7268 (gnus-summary-goto-subject article))
7269 (gnus-summary-position-point)
7272 (defun gnus-summary-better-unread-subject ()
7273 "Select the first unread subject that has a score over the default score."
7275 (let ((data gnus-newsgroup-data)
7277 (while (and (setq article (gnus-data-number (car data)))
7278 (or (gnus-data-read-p (car data))
7279 (not (> (gnus-summary-article-score article)
7280 gnus-summary-default-score))))
7281 (setq data (cdr data)))
7283 (gnus-summary-goto-subject article))
7284 (gnus-summary-position-point)
7287 (defun gnus-summary-last-subject ()
7288 "Go to the last displayed subject line in the group."
7289 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7291 (gnus-summary-goto-subject article))))
7293 (defun gnus-summary-goto-article (article &optional all-headers force)
7294 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7295 If ALL-HEADERS is non-nil, no header lines are hidden.
7296 If FORCE, go to the article even if it isn't displayed. If FORCE
7297 is a number, it is the line the article is to be displayed on."
7301 "Article number or Message-ID: "
7302 (mapcar (lambda (number) (list (int-to-string number)))
7303 gnus-newsgroup-limit))
7307 (if (and (stringp article)
7308 (string-match "@" article))
7309 (gnus-summary-refer-article article)
7310 (when (stringp article)
7311 (setq article (string-to-number article)))
7312 (if (gnus-summary-goto-subject article force)
7313 (gnus-summary-display-article article all-headers)
7314 (gnus-message 4 "Couldn't go to article %s" article) nil))
7315 (gnus-summary-position-point)))
7317 (defun gnus-summary-goto-last-article ()
7318 "Go to the previously read article."
7321 (when gnus-last-article
7322 (gnus-summary-goto-article gnus-last-article nil t))
7323 (gnus-summary-position-point)))
7325 (defun gnus-summary-pop-article (number)
7326 "Pop one article off the history and go to the previous.
7327 NUMBER articles will be popped off."
7330 (setq gnus-newsgroup-history
7331 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7333 (gnus-summary-goto-article (car to) nil t)
7334 (error "Article history empty")))
7335 (gnus-summary-position-point))
7337 ;; Summary commands and functions for limiting the summary buffer.
7339 (defun gnus-summary-limit-to-articles (n)
7340 "Limit the summary buffer to the next N articles.
7341 If not given a prefix, use the process marked articles instead."
7344 (let ((articles (gnus-summary-work-articles n)))
7345 (setq gnus-newsgroup-processable nil)
7346 (gnus-summary-limit articles))
7347 (gnus-summary-position-point)))
7349 (defun gnus-summary-pop-limit (&optional total)
7350 "Restore the previous limit.
7351 If given a prefix, remove all limits."
7354 (setq gnus-newsgroup-limits
7355 (list (mapcar (lambda (h) (mail-header-number h))
7356 gnus-newsgroup-headers))))
7357 (unless gnus-newsgroup-limits
7358 (error "No limit to pop"))
7360 (gnus-summary-limit nil 'pop)
7361 (gnus-summary-position-point)))
7363 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7364 "Limit the summary buffer to articles that have subjects that match a regexp.
7365 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7367 (list (read-string (if current-prefix-arg
7368 "Exclude subject (regexp): "
7369 "Limit to subject (regexp): "))
7370 nil current-prefix-arg))
7372 (setq header "subject"))
7373 (when (not (equal "" subject))
7375 (let ((articles (gnus-summary-find-matching
7376 (or header "subject") subject 'all nil nil
7379 (error "Found no matches for \"%s\"" subject))
7380 (gnus-summary-limit articles))
7381 (gnus-summary-position-point))))
7383 (defun gnus-summary-limit-to-author (from &optional not-matching)
7384 "Limit the summary buffer to articles that have authors that match a regexp.
7385 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7387 (list (read-string (if current-prefix-arg
7388 "Exclude author (regexp): "
7389 "Limit to author (regexp): "))
7390 current-prefix-arg))
7391 (gnus-summary-limit-to-subject from "from" not-matching))
7393 (defun gnus-summary-limit-to-age (age &optional younger-p)
7394 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7395 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7396 articles that are younger than AGE days."
7398 (let ((younger current-prefix-arg)
7401 (while (not days-got)
7402 (setq days (if younger
7403 (read-string "Limit to articles younger than (in days, older when negative): ")
7405 "Limit to articles older than (in days, younger when negative): ")))
7406 (when (> (length days) 0)
7407 (setq days (read days)))
7413 (setq younger (not younger))
7414 (setq days (* days -1)))))
7415 (message "Please enter a number.")
7417 (list days younger)))
7419 (let ((data gnus-newsgroup-data)
7420 (cutoff (days-to-time age))
7421 articles d date is-younger)
7422 (while (setq d (pop data))
7423 (when (and (vectorp (gnus-data-header d))
7424 (setq date (mail-header-date (gnus-data-header d))))
7425 (setq is-younger (time-less-p
7426 (time-since (condition-case ()
7433 (push (gnus-data-number d) articles))))
7434 (gnus-summary-limit (nreverse articles)))
7435 (gnus-summary-position-point)))
7437 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7438 "Limit the summary buffer to articles that match an 'extra' header."
7442 (gnus-completing-read-with-default
7443 (symbol-name (car gnus-extra-headers))
7444 (if current-prefix-arg
7445 "Exclude extra header:"
7446 "Limit extra header:")
7448 (cons (symbol-name x) x))
7453 (read-string (format "%s header %s (regexp): "
7454 (if current-prefix-arg "Exclude" "Limit to")
7456 current-prefix-arg)))
7457 (when (not (equal "" regexp))
7459 (let ((articles (gnus-summary-find-matching
7460 (cons 'extra header) regexp 'all nil nil
7463 (error "Found no matches for \"%s\"" regexp))
7464 (gnus-summary-limit articles))
7465 (gnus-summary-position-point))))
7467 (defun gnus-summary-limit-to-display-predicate ()
7468 "Limit the summary buffer to the predicated in the `display' group parameter."
7470 (unless gnus-newsgroup-display
7471 (error "There is no `display' group parameter"))
7473 (dolist (number gnus-newsgroup-articles)
7474 (when (funcall gnus-newsgroup-display)
7475 (push number articles)))
7476 (gnus-summary-limit articles))
7477 (gnus-summary-position-point))
7479 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7481 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7483 (defun gnus-summary-limit-to-unread (&optional all)
7484 "Limit the summary buffer to articles that are not marked as read.
7485 If ALL is non-nil, limit strictly to unread articles."
7488 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7489 (gnus-summary-limit-to-marks
7490 ;; Concat all the marks that say that an article is read and have
7492 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7493 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7494 gnus-low-score-mark gnus-expirable-mark
7495 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7496 gnus-duplicate-mark gnus-souped-mark)
7499 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7500 (make-obsolete 'gnus-summary-delete-marked-with
7501 'gnus-summary-limit-exclude-marks)
7503 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7504 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7505 If REVERSE, limit the summary buffer to articles that are marked
7506 with MARKS. MARKS can either be a string of marks or a list of marks.
7507 Returns how many articles were removed."
7508 (interactive "sMarks: ")
7509 (gnus-summary-limit-to-marks marks t))
7511 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7512 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7513 If REVERSE (the prefix), limit the summary buffer to articles that are
7514 not marked with MARKS. MARKS can either be a string of marks or a
7516 Returns how many articles were removed."
7517 (interactive "sMarks: \nP")
7519 (let ((data gnus-newsgroup-data)
7520 (marks (if (listp marks) marks
7521 (append marks nil))) ; Transform to list.
7524 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7525 (memq (gnus-data-mark (car data)) marks))
7526 (push (gnus-data-number (car data)) articles))
7527 (setq data (cdr data)))
7528 (gnus-summary-limit articles))
7529 (gnus-summary-position-point)))
7531 (defun gnus-summary-limit-to-score (score)
7532 "Limit to articles with score at or above SCORE."
7533 (interactive "NLimit to articles with score of at least: ")
7534 (let ((data gnus-newsgroup-data)
7537 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7539 (push (gnus-data-number (car data)) articles))
7540 (setq data (cdr data)))
7542 (gnus-summary-limit articles)
7543 (gnus-summary-position-point))))
7545 (defun gnus-summary-limit-to-unseen ()
7546 "Limit to unseen articles."
7549 (gnus-summary-limit gnus-newsgroup-unseen)
7550 (gnus-summary-position-point)))
7552 (defun gnus-summary-limit-include-thread (id)
7553 "Display all the hidden articles that is in the thread with ID in it.
7554 When called interactively, ID is the Message-ID of the current
7556 (interactive (list (mail-header-id (gnus-summary-article-header))))
7557 (let ((articles (gnus-articles-in-thread
7558 (gnus-id-to-thread (gnus-root-id id)))))
7560 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7561 (gnus-summary-limit-include-matching-articles
7563 (regexp-quote (gnus-simplify-subject-re
7564 (mail-header-subject (gnus-id-to-header id)))))
7565 (gnus-summary-position-point))))
7567 (defun gnus-summary-limit-include-matching-articles (header regexp)
7568 "Display all the hidden articles that have HEADERs that match REGEXP."
7569 (interactive (list (read-string "Match on header: ")
7570 (read-string "Regexp: ")))
7571 (let ((articles (gnus-find-matching-articles header regexp)))
7573 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7574 (gnus-summary-position-point))))
7576 (defun gnus-summary-insert-dormant-articles ()
7577 "Insert all the dormat articles for this group into the current buffer."
7579 (let ((gnus-verbose (max 6 gnus-verbose)))
7580 (if (not gnus-newsgroup-dormant)
7581 (gnus-message 3 "No cached articles for this group")
7582 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7584 (defun gnus-summary-limit-include-dormant ()
7585 "Display all the hidden articles that are marked as dormant.
7586 Note that this command only works on a subset of the articles currently
7587 fetched for this group."
7589 (unless gnus-newsgroup-dormant
7590 (error "There are no dormant articles in this group"))
7592 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7593 (gnus-summary-position-point)))
7595 (defun gnus-summary-limit-exclude-dormant ()
7596 "Hide all dormant articles."
7599 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7600 (gnus-summary-position-point)))
7602 (defun gnus-summary-limit-exclude-childless-dormant ()
7603 "Hide all dormant articles that have no children."
7605 (let ((data (gnus-data-list t))
7606 articles d children)
7607 ;; Find all articles that are either not dormant or have
7609 (while (setq d (pop data))
7610 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7612 (gnus-article-children (gnus-data-number d)))
7615 (when (memq (car children) articles)
7620 (push (gnus-data-number d) articles)))
7623 (gnus-summary-limit articles)
7624 (gnus-summary-position-point))))
7626 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7627 "Mark all unread excluded articles as read.
7628 If ALL, mark even excluded ticked and dormants as read."
7630 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7631 (let ((articles (gnus-sorted-ndifference
7633 (mapcar (lambda (h) (mail-header-number h))
7634 gnus-newsgroup-headers)
7636 gnus-newsgroup-limit))
7638 (setq gnus-newsgroup-unreads
7639 (gnus-sorted-intersection gnus-newsgroup-unreads
7640 gnus-newsgroup-limit))
7642 (setq gnus-newsgroup-dormant nil
7643 gnus-newsgroup-marked nil
7644 gnus-newsgroup-reads
7646 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7647 gnus-newsgroup-reads))
7648 (while (setq article (pop articles))
7649 (unless (or (memq article gnus-newsgroup-dormant)
7650 (memq article gnus-newsgroup-marked))
7651 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7653 (defun gnus-summary-limit (articles &optional pop)
7655 ;; We pop the previous limit off the stack and use that.
7656 (setq articles (car gnus-newsgroup-limits)
7657 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7658 ;; We use the new limit, so we push the old limit on the stack.
7659 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7661 (setq gnus-newsgroup-limit articles)
7662 (let ((total (length gnus-newsgroup-data))
7663 (data (gnus-data-find-list (gnus-summary-article-number)))
7664 (gnus-summary-mark-below nil) ; Inhibit this.
7666 ;; This will do all the work of generating the new summary buffer
7667 ;; according to the new limit.
7668 (gnus-summary-prepare)
7669 ;; Hide any threads, possibly.
7670 (gnus-summary-maybe-hide-threads)
7671 ;; Try to return to the article you were at, or one in the
7674 ;; We try to find some article after the current one.
7676 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7679 (setq data (cdr data))))
7681 ;; If there is no data, that means that we were after the last
7682 ;; article. The same goes when we can't find any articles
7683 ;; after the current one.
7684 (goto-char (point-max))
7685 (gnus-summary-find-prev))
7686 (gnus-set-mode-line 'summary)
7687 ;; We return how many articles were removed from the summary
7688 ;; buffer as a result of the new limit.
7689 (- total (length gnus-newsgroup-data))))
7691 (defsubst gnus-invisible-cut-children (threads)
7694 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7699 (defsubst gnus-cut-thread (thread)
7700 "Go forwards in the thread until we find an article that we want to display."
7701 (when (or (eq gnus-fetch-old-headers 'some)
7702 (eq gnus-fetch-old-headers 'invisible)
7703 (numberp gnus-fetch-old-headers)
7704 (eq gnus-build-sparse-threads 'some)
7705 (eq gnus-build-sparse-threads 'more))
7706 ;; Deal with old-fetched headers and sparse threads.
7710 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7711 (gnus-summary-article-ancient-p
7712 (mail-header-number (car thread))))
7713 (if (or (<= (length (cdr thread)) 1)
7714 (eq gnus-fetch-old-headers 'invisible))
7715 (setq gnus-newsgroup-limit
7716 (delq (mail-header-number (car thread))
7717 gnus-newsgroup-limit)
7718 thread (cadr thread))
7719 (when (gnus-invisible-cut-children (cdr thread))
7720 (let ((th (cdr thread)))
7722 (if (memq (mail-header-number (caar th))
7723 gnus-newsgroup-limit)
7724 (setq thread (car th)
7726 (setq th (cdr th))))))))))
7729 (defun gnus-cut-threads (threads)
7730 "Cut off all uninteresting articles from the beginning of threads."
7731 (when (or (eq gnus-fetch-old-headers 'some)
7732 (eq gnus-fetch-old-headers 'invisible)
7733 (numberp gnus-fetch-old-headers)
7734 (eq gnus-build-sparse-threads 'some)
7735 (eq gnus-build-sparse-threads 'more))
7738 (setcar th (gnus-cut-thread (car th)))
7739 (setq th (cdr th)))))
7740 ;; Remove nixed out threads.
7743 (defun gnus-summary-initial-limit (&optional show-if-empty)
7744 "Figure out what the initial limit is supposed to be on group entry.
7745 This entails weeding out unwanted dormants, low-scored articles,
7746 fetch-old-headers verbiage, and so on."
7747 ;; Most groups have nothing to remove.
7748 (if (or gnus-inhibit-limiting
7749 (and (null gnus-newsgroup-dormant)
7750 (eq gnus-newsgroup-display 'gnus-not-ignore)
7751 (not (eq gnus-fetch-old-headers 'some))
7752 (not (numberp gnus-fetch-old-headers))
7753 (not (eq gnus-fetch-old-headers 'invisible))
7754 (null gnus-summary-expunge-below)
7755 (not (eq gnus-build-sparse-threads 'some))
7756 (not (eq gnus-build-sparse-threads 'more))
7757 (null gnus-thread-expunge-below)
7758 (not gnus-use-nocem)))
7760 (push gnus-newsgroup-limit gnus-newsgroup-limits)
7761 (setq gnus-newsgroup-limit nil)
7764 (unless (car (symbol-value node))
7765 ;; These threads have no parents -- they are roots.
7766 (let ((nodes (cdr (symbol-value node)))
7769 (if (and gnus-thread-expunge-below
7770 (< (gnus-thread-total-score (car nodes))
7771 gnus-thread-expunge-below))
7772 (gnus-expunge-thread (pop nodes))
7773 (setq thread (pop nodes))
7774 (gnus-summary-limit-children thread))))))
7775 gnus-newsgroup-dependencies)
7776 ;; If this limitation resulted in an empty group, we might
7777 ;; pop the previous limit and use it instead.
7778 (when (and (not gnus-newsgroup-limit)
7780 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
7781 gnus-newsgroup-limit))
7783 (defun gnus-summary-limit-children (thread)
7784 "Return 1 if this subthread is visible and 0 if it is not."
7785 ;; First we get the number of visible children to this thread. This
7786 ;; is done by recursing down the thread using this function, so this
7787 ;; will really go down to a leaf article first, before slowly
7788 ;; working its way up towards the root.
7790 (let* ((max-lisp-eval-depth 5000)
7793 (apply '+ (mapcar 'gnus-summary-limit-children
7796 (number (mail-header-number (car thread)))
7799 (not (memq number gnus-newsgroup-marked))
7801 ;; If this article is dormant and has absolutely no visible
7802 ;; children, then this article isn't visible.
7803 (and (memq number gnus-newsgroup-dormant)
7805 ;; If this is "fetch-old-headered" and there is no
7806 ;; visible children, then we don't want this article.
7807 (and (or (eq gnus-fetch-old-headers 'some)
7808 (numberp gnus-fetch-old-headers))
7809 (gnus-summary-article-ancient-p number)
7811 ;; If this is "fetch-old-headered" and `invisible', then
7812 ;; we don't want this article.
7813 (and (eq gnus-fetch-old-headers 'invisible)
7814 (gnus-summary-article-ancient-p number))
7815 ;; If this is a sparsely inserted article with no children,
7816 ;; we don't want it.
7817 (and (eq gnus-build-sparse-threads 'some)
7818 (gnus-summary-article-sparse-p number)
7820 ;; If we use expunging, and this article is really
7821 ;; low-scored, then we don't want this article.
7822 (when (and gnus-summary-expunge-below
7824 (or (cdr (assq number gnus-newsgroup-scored))
7825 gnus-summary-default-score))
7826 gnus-summary-expunge-below))
7827 ;; We increase the expunge-tally here, but that has
7828 ;; nothing to do with the limits, really.
7829 (incf gnus-newsgroup-expunged-tally)
7830 ;; We also mark as read here, if that's wanted.
7831 (when (and gnus-summary-mark-below
7832 (< score gnus-summary-mark-below))
7833 (setq gnus-newsgroup-unreads
7834 (delq number gnus-newsgroup-unreads))
7835 (if gnus-newsgroup-auto-expire
7836 (push number gnus-newsgroup-expirable)
7837 (push (cons number gnus-low-score-mark)
7838 gnus-newsgroup-reads)))
7840 ;; Do the `display' group parameter.
7841 (and gnus-newsgroup-display
7842 (not (funcall gnus-newsgroup-display)))
7843 ;; Check NoCeM things.
7844 (if (and gnus-use-nocem
7845 (gnus-nocem-unwanted-article-p
7846 (mail-header-id (car thread))))
7848 (setq gnus-newsgroup-unreads
7849 (delq number gnus-newsgroup-unreads))
7851 ;; Nope, invisible article.
7853 ;; Ok, this article is to be visible, so we add it to the limit
7855 (push number gnus-newsgroup-limit)
7858 (defun gnus-expunge-thread (thread)
7859 "Mark all articles in THREAD as read."
7860 (let* ((number (mail-header-number (car thread))))
7861 (incf gnus-newsgroup-expunged-tally)
7862 ;; We also mark as read here, if that's wanted.
7863 (setq gnus-newsgroup-unreads
7864 (delq number gnus-newsgroup-unreads))
7865 (if gnus-newsgroup-auto-expire
7866 (push number gnus-newsgroup-expirable)
7867 (push (cons number gnus-low-score-mark)
7868 gnus-newsgroup-reads)))
7869 ;; Go recursively through all subthreads.
7870 (mapcar 'gnus-expunge-thread (cdr thread)))
7872 ;; Summary article oriented commands
7874 (defun gnus-summary-refer-parent-article (n)
7875 "Refer parent article N times.
7876 If N is negative, go to ancestor -N instead.
7877 The difference between N and the number of articles fetched is returned."
7881 (when (not (natnump n))
7886 (setq header (gnus-summary-article-header))
7887 (if (and (eq (mail-header-number header)
7888 (cdr gnus-article-current))
7889 (equal gnus-newsgroup-name
7890 (car gnus-article-current)))
7891 ;; If we try to find the parent of the currently
7892 ;; displayed article, then we take a look at the actual
7893 ;; References header, since this is slightly more
7894 ;; reliable than the References field we got from the
7897 (set-buffer gnus-original-article-buffer)
7898 (nnheader-narrow-to-headers)
7899 (unless (setq ref (message-fetch-field "references"))
7900 (setq ref (message-fetch-field "in-reply-to")))
7903 ;; It's not the current article, so we take a bet on
7904 ;; the value we got from the server.
7905 (mail-header-references header)))
7907 (not (equal ref "")))
7908 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
7909 (gnus-message 1 "Couldn't find parent"))
7910 (gnus-message 1 "No references in article %d"
7911 (gnus-summary-article-number))
7914 (gnus-summary-position-point)
7917 (defun gnus-summary-refer-references ()
7918 "Fetch all articles mentioned in the References header.
7919 Return the number of articles fetched."
7921 (let ((ref (mail-header-references (gnus-summary-article-header)))
7922 (current (gnus-summary-article-number))
7926 (error "No References in the current article")
7927 ;; For each Message-ID in the References header...
7928 (while (string-match "<[^>]*>" ref)
7930 ;; ... fetch that article.
7931 (gnus-summary-refer-article
7932 (prog1 (match-string 0 ref)
7933 (setq ref (substring ref (match-end 0))))))
7934 (gnus-summary-goto-subject current)
7935 (gnus-summary-position-point)
7938 (defun gnus-summary-refer-thread (&optional limit)
7939 "Fetch all articles in the current thread.
7940 If LIMIT (the numerical prefix), fetch that many old headers instead
7941 of what's specified by the `gnus-refer-thread-limit' variable."
7943 (let ((id (mail-header-id (gnus-summary-article-header)))
7944 (limit (if limit (prefix-numeric-value limit)
7945 gnus-refer-thread-limit)))
7946 ;; We want to fetch LIMIT *old* headers, but we also have to
7947 ;; re-fetch all the headers in the current buffer, because many of
7948 ;; them may be undisplayed. So we adjust LIMIT.
7949 (when (numberp limit)
7950 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
7951 (unless (eq gnus-fetch-old-headers 'invisible)
7952 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
7953 ;; Retrieve the headers and read them in.
7954 (if (eq (gnus-retrieve-headers
7955 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
7957 (gnus-build-all-threads)
7958 (error "Can't fetch thread from backends that don't support NOV"))
7959 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
7960 (gnus-summary-limit-include-thread id)))
7962 (defun gnus-summary-refer-article (message-id)
7963 "Fetch an article specified by MESSAGE-ID."
7964 (interactive "sMessage-ID: ")
7965 (when (and (stringp message-id)
7966 (not (zerop (length message-id))))
7967 ;; Construct the correct Message-ID if necessary.
7968 ;; Suggested by tale@pawl.rpi.edu.
7969 (unless (string-match "^<" message-id)
7970 (setq message-id (concat "<" message-id)))
7971 (unless (string-match ">$" message-id)
7972 (setq message-id (concat message-id ">")))
7973 (let* ((header (gnus-id-to-header message-id))
7975 (gnus-summary-article-sparse-p
7976 (mail-header-number header))
7977 (memq (mail-header-number header)
7978 gnus-newsgroup-limit)))
7981 ;; If the article is present in the buffer we just go to it.
7983 (or (not (gnus-summary-article-sparse-p
7984 (mail-header-number header)))
7987 (gnus-summary-goto-article
7988 (mail-header-number header) nil t)
7990 (gnus-summary-update-article (mail-header-number header)))))
7992 ;; We fetch the article.
7994 (dolist (gnus-override-method (gnus-refer-article-methods))
7995 (gnus-check-server gnus-override-method)
7996 ;; Fetch the header, and display the article.
7997 (when (setq number (gnus-summary-insert-subject message-id))
7998 (gnus-summary-select-article nil nil nil number)
8000 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8002 (defun gnus-refer-article-methods ()
8003 "Return a list of referable methods."
8005 ;; No method, so we default to current and native.
8006 ((null gnus-refer-article-method)
8007 (list gnus-current-select-method gnus-select-method))
8009 ((eq 'current gnus-refer-article-method)
8010 (list gnus-current-select-method))
8011 ;; List of select methods.
8012 ((not (and (symbolp (car gnus-refer-article-method))
8013 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8015 (dolist (method gnus-refer-article-method)
8016 (push (if (eq 'current method)
8017 gnus-current-select-method
8021 ;; One single select method.
8023 (list gnus-refer-article-method))))
8025 (defun gnus-summary-edit-parameters ()
8026 "Edit the group parameters of the current group."
8028 (gnus-group-edit-group gnus-newsgroup-name 'params))
8030 (defun gnus-summary-customize-parameters ()
8031 "Customize the group parameters of the current group."
8033 (gnus-group-customize gnus-newsgroup-name))
8035 (defun gnus-summary-enter-digest-group (&optional force)
8036 "Enter an nndoc group based on the current article.
8037 If FORCE, force a digest interpretation. If not, try
8038 to guess what the document format is."
8040 (let ((conf gnus-current-window-configuration))
8042 (gnus-summary-select-article))
8043 (setq gnus-current-window-configuration conf)
8044 (let* ((name (format "%s-%d"
8045 (gnus-group-prefixed-name
8046 gnus-newsgroup-name (list 'nndoc ""))
8048 (set-buffer gnus-summary-buffer)
8049 gnus-current-article)))
8050 (ogroup gnus-newsgroup-name)
8051 (params (append (gnus-info-params (gnus-get-info ogroup))
8052 (list (cons 'to-group ogroup))
8053 (list (cons 'save-article-group ogroup))))
8054 (case-fold-search t)
8055 (buf (current-buffer))
8058 (set-buffer gnus-original-article-buffer)
8059 ;; Have the digest group inherit the main mail address of
8060 ;; the parent article.
8061 (when (setq to-address (or (gnus-fetch-field "reply-to")
8062 (gnus-fetch-field "from")))
8063 (setq params (append
8064 (list (cons 'to-address
8065 (funcall gnus-decode-encoded-word-function
8067 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8068 (insert-buffer-substring gnus-original-article-buffer)
8069 ;; Remove lines that may lead nndoc to misinterpret the
8072 (goto-char (point-min))
8073 (or (search-forward "\n\n" nil t) (point)))
8074 (goto-char (point-min))
8075 (delete-matching-lines "^Path:\\|^From ")
8078 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8079 (gnus-newsgroup-ephemeral-ignored-charsets
8080 gnus-newsgroup-ignored-charsets))
8081 (gnus-group-read-ephemeral-group
8082 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8084 ,(if force 'mbox 'guess)))
8086 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8088 ;; Make all postings to this group go to the parent group.
8089 (nconc (gnus-info-params (gnus-get-info name))
8091 ;; Couldn't select this doc group.
8092 (switch-to-buffer buf)
8093 (gnus-set-global-variables)
8094 (gnus-configure-windows 'summary)
8095 (gnus-message 3 "Article couldn't be entered?"))
8096 (kill-buffer dig)))))
8098 (defun gnus-summary-read-document (n)
8099 "Open a new group based on the current article(s).
8100 This will allow you to read digests and other similar
8101 documents as newsgroups.
8102 Obeys the standard process/prefix convention."
8104 (let* ((articles (gnus-summary-work-articles n))
8105 (ogroup gnus-newsgroup-name)
8106 (params (append (gnus-info-params (gnus-get-info ogroup))
8107 (list (cons 'to-group ogroup))))
8108 article group egroup groups vgroup)
8109 (while (setq article (pop articles))
8110 (setq group (format "%s-%d" gnus-newsgroup-name article))
8111 (gnus-summary-remove-process-mark article)
8112 (when (gnus-summary-display-article article)
8115 (insert-buffer-substring gnus-original-article-buffer)
8116 ;; Remove some headers that may lead nndoc to make
8118 (message-narrow-to-head)
8119 (goto-char (point-min))
8120 (delete-matching-lines "^\\(Path\\):\\|^From ")
8123 (gnus-group-read-ephemeral-group
8124 group `(nndoc ,group (nndoc-address ,(current-buffer))
8125 (nndoc-article-type guess))
8128 ;; Make all postings to this group go to the parent group.
8129 (nconc (gnus-info-params (gnus-get-info egroup))
8131 (push egroup groups))
8132 ;; Couldn't select this doc group.
8133 (gnus-error 3 "Article couldn't be entered"))))))
8134 ;; Now we have selected all the documents.
8137 (error "None of the articles could be interpreted as documents"))
8138 ((gnus-group-read-ephemeral-group
8139 (setq vgroup (format
8140 "nnvirtual:%s-%s" gnus-newsgroup-name
8141 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8142 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8144 (cons (current-buffer) 'summary)))
8146 (error "Couldn't select virtual nndoc group")))))
8148 (defun gnus-summary-isearch-article (&optional regexp-p)
8149 "Do incremental search forward on the current article.
8150 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8152 (let* ((gnus-inhibit-treatment t)
8153 (old (gnus-summary-select-article)))
8154 (gnus-configure-windows 'article)
8155 (gnus-eval-in-buffer-window gnus-article-buffer
8159 (gnus-article-show-all-headers))
8160 (goto-char (point-min))
8161 (isearch-forward regexp-p)))))
8163 (defun gnus-summary-search-article-forward (regexp &optional backward)
8164 "Search for an article containing REGEXP forward.
8165 If BACKWARD, search backward instead."
8168 (format "Search article %s (regexp%s): "
8169 (if current-prefix-arg "backward" "forward")
8170 (if gnus-last-search-regexp
8171 (concat ", default " gnus-last-search-regexp)
8173 current-prefix-arg))
8174 (if (string-equal regexp "")
8175 (setq regexp (or gnus-last-search-regexp ""))
8176 (setq gnus-last-search-regexp regexp)
8177 (setq gnus-article-before-search gnus-current-article))
8178 ;; Intentionally set gnus-last-article.
8179 (setq gnus-last-article gnus-article-before-search)
8180 (let ((gnus-last-article gnus-last-article))
8181 (if (gnus-summary-search-article regexp backward)
8182 (gnus-summary-show-thread)
8183 (error "Search failed: \"%s\"" regexp))))
8185 (defun gnus-summary-search-article-backward (regexp)
8186 "Search for an article containing REGEXP backward."
8189 (format "Search article backward (regexp%s): "
8190 (if gnus-last-search-regexp
8191 (concat ", default " gnus-last-search-regexp)
8193 (gnus-summary-search-article-forward regexp 'backward))
8196 (defmacro gnus-summary-search-article-position-point (regexp backward)
8197 "Dehighlight the last matched text and goto the beginning position."
8198 (` (if (and gnus-summary-search-article-matched-data
8199 (let ((text (caddr gnus-summary-search-article-matched-data))
8200 (inhibit-read-only t)
8203 (goto-char (car gnus-summary-search-article-matched-data))
8204 (cadr gnus-summary-search-article-matched-data))
8206 (string-match (, regexp) text)))
8207 (if (, backward) (beginning-of-line) (end-of-line))
8208 (goto-char (if (, backward) (point-max) (point-min))))))
8210 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
8211 "Place point where X-Face image is displayed."
8212 (if (featurep 'xemacs)
8213 (` (let ((end (if (search-forward "\n\n" nil t)
8214 (goto-char (1- (point)))
8217 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
8218 (unless (and (re-search-forward "^From:" end t)
8219 (setq extent (extent-at (point)))
8220 (extent-begin-glyph extent))
8221 (goto-char (, opoint)))))
8222 (` (let ((end (if (search-forward "\n\n" nil t)
8223 (goto-char (1- (point)))
8225 (start (or (search-backward "\n\n" nil t) (point-min))))
8227 (or (text-property-any start end 'x-face-image t);; x-face-e21
8228 (text-property-any start end 'x-face-mule-bitmap-image t)
8231 (defmacro gnus-summary-search-article-highlight-matched-text
8232 (backward treated x-face)
8233 "Highlight matched text in the function `gnus-summary-search-article'."
8234 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
8235 (end (set-marker (make-marker) (match-end 0)))
8236 (inhibit-read-only t)
8240 (let ((items (mapcar 'car gnus-treatment-function-alist)))
8242 (lambda (item) (setq items (delq item items)))
8243 '(gnus-treat-buttonize
8244 gnus-treat-fill-article
8245 gnus-treat-fill-long-lines
8246 gnus-treat-emphasize
8247 gnus-treat-highlight-headers
8248 gnus-treat-highlight-citation
8249 gnus-treat-highlight-signature
8250 gnus-treat-overstrike
8251 gnus-treat-display-xface
8252 gnus-treat-buttonize-head
8253 gnus-treat-decode-article-as-default-mime-charset))
8254 (static-if (featurep 'xemacs)
8256 (cons '(x-face-mule-delete-x-face-field
8259 (gnus-treat-display-xface
8260 (when (, x-face) gnus-treat-display-xface)))
8261 (gnus-article-prepare-mime-display)))
8262 (goto-char (if (, backward) start end))
8264 (gnus-summary-search-article-highlight-goto-x-face (point)))
8265 (setq gnus-summary-search-article-matched-data
8266 (list start end (buffer-substring start end)))
8267 (unless (eq start end);; matched text has been deleted. :-<
8268 (put-text-property start end 'face
8269 (or (find-face 'isearch)
8270 'secondary-selection))))))
8273 (defun gnus-summary-search-article (regexp &optional backward)
8274 "Search for an article containing REGEXP.
8275 Optional argument BACKWARD means do search for backward.
8276 `gnus-select-article-hook' is not called during the search."
8277 ;; We have to require this here to make sure that the following
8278 ;; dynamic binding isn't shadowed by autoloading.
8279 (require 'gnus-async)
8281 (let ((gnus-select-article-hook nil) ;Disable hook.
8282 (gnus-article-prepare-hook nil)
8283 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8284 (gnus-use-article-prefetch nil)
8285 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8286 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8287 (sum (current-buffer))
8290 (gnus-save-hidden-threads
8291 (static-if (featurep 'xemacs)
8292 (let ((gnus-inhibit-treatment t))
8293 (setq treated (eq 'old (gnus-summary-select-article)))
8295 (not (and (gnus-buffer-live-p gnus-article-buffer)
8296 (window-live-p (get-buffer-window
8297 gnus-article-buffer t)))))
8298 (gnus-summary-select-article nil t)
8299 (setq treated nil)))
8300 (let ((gnus-inhibit-treatment t)
8301 (x-face-mule-delete-x-face-field 'never))
8302 (setq treated (eq 'old (gnus-summary-select-article)))
8305 (and (gnus-buffer-live-p gnus-article-buffer)
8306 (window-live-p (get-buffer-window
8307 gnus-article-buffer t))
8308 (or (not (string-match "^\\^X-Face:" regexp))
8309 (with-current-buffer gnus-article-buffer
8310 gnus-summary-search-article-matched-data)))))
8311 (gnus-summary-select-article nil t)
8312 (setq treated nil))))
8313 (set-buffer gnus-article-buffer)
8317 (gnus-article-show-all-headers)
8318 (gnus-summary-search-article-position-point regexp backward))
8319 (goto-char (if backward (point-max) (point-min))))
8321 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8323 (re-search-backward regexp nil t)
8324 (re-search-forward regexp nil t))
8325 ;; We found the regexp.
8327 (gnus-summary-search-article-highlight-matched-text
8328 backward treated (string-match "^\\^X-Face:" regexp))
8331 (/ (- 2 (window-height
8332 (get-buffer-window gnus-article-buffer t)))
8335 (get-buffer-window (current-buffer))
8338 (setq point (point)))
8339 ;; We didn't find it, so we go to the next article.
8342 (while (eq found 'not)
8343 (if (not (if backward (gnus-summary-find-prev)
8344 (gnus-summary-find-next)))
8345 ;; No more articles.
8347 ;; Select the next article and adjust point.
8348 (unless (gnus-summary-article-sparse-p
8349 (gnus-summary-article-number))
8351 (let ((gnus-inhibit-treatment t))
8352 (gnus-summary-select-article))
8354 (set-buffer gnus-article-buffer)
8356 (goto-char (if backward (point-max) (point-min))))))))
8357 (gnus-message 7 ""))
8358 ;; Return whether we found the regexp.
8359 (when (eq found 'found)
8361 (gnus-summary-show-thread)
8362 (gnus-summary-goto-subject gnus-current-article)
8363 (gnus-summary-position-point)
8366 (defun gnus-find-matching-articles (header regexp)
8367 "Return a list of all articles that match REGEXP on HEADER.
8368 This search includes all articles in the current group that Gnus has
8369 fetched headers for, whether they are displayed or not."
8370 (let ((articles nil)
8371 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8372 (case-fold-search t))
8373 (dolist (header gnus-newsgroup-headers)
8374 (when (string-match regexp (funcall func header))
8375 (push (mail-header-number header) articles)))
8376 (nreverse articles)))
8378 (defun gnus-summary-find-matching (header regexp &optional backward unread
8379 not-case-fold not-matching)
8380 "Return a list of all articles that match REGEXP on HEADER.
8381 The search stars on the current article and goes forwards unless
8382 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8383 If UNREAD is non-nil, only unread articles will
8384 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8385 in the comparisons. If NOT-MATCHING, return a list of all articles that
8386 not match REGEXP on HEADER."
8387 (let ((case-fold-search (not not-case-fold))
8390 (if (eq (car header) 'extra)
8393 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8395 (error "%s is an invalid header" header))
8396 (unless (fboundp (intern (concat "mail-header-" header)))
8397 (error "%s is not a valid header" header))
8398 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8399 (dolist (d (if (eq backward 'all)
8401 (gnus-data-find-list
8402 (gnus-summary-article-number)
8403 (gnus-data-list backward))))
8404 (when (and (or (not unread) ; We want all articles...
8405 (gnus-data-unread-p d)) ; Or just unreads.
8406 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8410 (funcall func (gnus-data-header d))))
8411 (string-match regexp
8412 (funcall func (gnus-data-header d)))))
8413 (push (gnus-data-number d) articles))) ; Success!
8414 (nreverse articles)))
8416 (defun gnus-summary-execute-command (header regexp command &optional backward)
8417 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8418 If HEADER is an empty string (or nil), the match is done on the entire
8419 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8421 (list (let ((completion-ignore-case t))
8424 (mapcar (lambda (header) (list (format "%s" header)))
8426 '("Number" "Subject" "From" "Lines" "Date"
8427 "Message-ID" "Xref" "References" "Body")
8428 gnus-extra-headers))
8429 nil 'require-match))
8430 (read-string "Regexp: ")
8431 (read-key-sequence "Command: ")
8432 current-prefix-arg))
8433 (when (equal header "Body")
8435 ;; Hidden thread subtrees must be searched as well.
8436 (gnus-summary-show-all-threads)
8437 ;; We don't want to change current point nor window configuration.
8439 (save-window-excursion
8441 gnus-treat-strip-trailing-blank-lines
8442 gnus-treat-strip-leading-blank-lines
8443 gnus-treat-strip-multiple-blank-lines
8444 gnus-treat-hide-boring-headers
8445 gnus-treat-fold-newsgroups
8446 gnus-article-prepare-hook)
8447 (gnus-message 6 "Executing %s..." (key-description command))
8448 ;; We'd like to execute COMMAND interactively so as to give arguments.
8449 (gnus-execute header regexp
8450 `(call-interactively ',(key-binding command))
8452 (gnus-message 6 "Executing %s...done" (key-description command))))))
8454 (defun gnus-summary-beginning-of-article ()
8455 "Scroll the article back to the beginning."
8457 (gnus-summary-select-article)
8458 (gnus-configure-windows 'article)
8459 (gnus-eval-in-buffer-window gnus-article-buffer
8461 (goto-char (point-min))
8462 (when gnus-page-broken
8463 (gnus-narrow-to-page))))
8465 (defun gnus-summary-end-of-article ()
8466 "Scroll to the end of the article."
8468 (gnus-summary-select-article)
8469 (gnus-configure-windows 'article)
8470 (gnus-eval-in-buffer-window gnus-article-buffer
8472 (goto-char (point-max))
8474 (when gnus-page-broken
8475 (gnus-narrow-to-page))))
8477 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8478 "Truncate to LEN and quote all \"(\"'s in STRING."
8479 (gnus-replace-in-string (if (and len (> (length string) len))
8480 (substring string 0 len)
8484 (defun gnus-summary-print-article (&optional filename n)
8485 "Generate and print a PostScript image of the N next (mail) articles.
8487 If N is negative, print the N previous articles. If N is nil and articles
8488 have been marked with the process mark, print these instead.
8490 If the optional first argument FILENAME is nil, send the image to the
8491 printer. If FILENAME is a string, save the PostScript image in a file with
8492 that name. If FILENAME is a number, prompt the user for the name of the file
8494 (interactive (list (ps-print-preprint current-prefix-arg)))
8495 (dolist (article (gnus-summary-work-articles n))
8496 (gnus-summary-select-article nil nil 'pseudo article)
8497 (gnus-eval-in-buffer-window gnus-article-buffer
8498 (gnus-print-buffer))
8499 (gnus-summary-remove-process-mark article))
8500 (ps-despool filename))
8502 (defun gnus-print-buffer ()
8503 (let ((buffer (generate-new-buffer " *print*")))
8506 (copy-to-buffer buffer (point-min) (point-max))
8508 (gnus-article-delete-invisible-text)
8509 (gnus-remove-text-with-property 'gnus-decoration)
8510 (when (gnus-visual-p 'article-highlight 'highlight)
8511 ;; Copy-to-buffer doesn't copy overlay. So redo
8513 (let ((gnus-article-buffer buffer))
8514 (gnus-article-highlight-citation t)
8515 (gnus-article-highlight-signature)))
8516 (let ((ps-left-header
8519 (gnus-summary-print-truncate-and-quote
8520 (mail-header-subject gnus-current-headers)
8523 (gnus-summary-print-truncate-and-quote
8524 (mail-header-from gnus-current-headers)
8528 "/pagenumberstring load"
8530 (mail-header-date gnus-current-headers) ")"))))
8531 (gnus-run-hooks 'gnus-ps-print-hook)
8534 (ps-spool-buffer-with-faces)
8535 (ps-spool-buffer)))))
8536 (kill-buffer buffer))))
8538 (defun gnus-summary-show-article (&optional arg)
8539 "Force redisplaying of the current article.
8540 If ARG (the prefix) is a number, show the article with the charset
8541 defined in `gnus-summary-show-article-charset-alist', or the charset
8543 If ARG (the prefix) is non-nil and not a number, show the raw article
8544 without any article massaging functions being run. Normally, the key strokes
8549 (gnus-summary-show-article t)
8550 (let* ((gnus-newsgroup-charset
8551 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8552 (mm-read-coding-system
8553 "View as charset: " ;; actually it is coding system.
8555 (set-buffer gnus-article-buffer)
8556 (mm-detect-coding-region (point) (point-max))))))
8557 (default-mime-charset gnus-newsgroup-charset)
8558 (gnus-newsgroup-ignored-charsets 'gnus-all))
8559 (gnus-summary-select-article nil 'force)
8560 (let ((deps gnus-newsgroup-dependencies)
8563 (set-buffer gnus-original-article-buffer)
8565 (message-narrow-to-head)
8566 (setq head (buffer-string))
8567 (goto-char (point-min))
8568 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8569 (goto-char (point-max))
8571 (setq lines (1- (count-lines (point) (point-max))))))
8573 (insert (format "211 %d Article retrieved.\n"
8574 (cdr gnus-article-current)))
8576 (if lines (insert (format "Lines: %d\n" lines)))
8578 (let ((nntp-server-buffer (current-buffer)))
8579 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8580 (gnus-data-set-header
8581 (gnus-data-find (cdr gnus-article-current))
8583 (gnus-summary-update-article-line
8584 (cdr gnus-article-current) header)
8585 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8586 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8588 ;; Select the article the normal way.
8589 (gnus-summary-select-article nil 'force))
8591 ;; We have to require this here to make sure that the following
8592 ;; dynamic binding isn't shadowed by autoloading.
8593 (require 'gnus-async)
8595 ;; Bind the article treatment functions to nil.
8596 (let ((gnus-have-all-headers t)
8597 gnus-article-prepare-hook
8598 gnus-article-decode-hook
8601 (gnus-inhibit-treatment t))
8602 (gnus-summary-select-article nil 'force))))
8603 (gnus-summary-goto-subject gnus-current-article)
8604 (gnus-summary-position-point))
8606 (defun gnus-summary-show-raw-article ()
8607 "Show the raw article without any article massaging functions being run."
8609 (gnus-summary-show-article t))
8611 (defun gnus-summary-verbose-headers (&optional arg)
8612 "Toggle permanent full header display.
8613 If ARG is a positive number, turn header display on.
8614 If ARG is a negative number, turn header display off."
8616 (setq gnus-show-all-headers
8617 (cond ((or (not (numberp arg))
8619 (not gnus-show-all-headers))
8622 (gnus-summary-show-article))
8624 (defun gnus-summary-toggle-header (&optional arg)
8625 "Show the headers if they are hidden, or hide them if they are shown.
8626 If ARG is a positive number, show the entire header.
8627 If ARG is a negative number, hide the unwanted header lines."
8629 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8630 (get-buffer-window gnus-article-buffer t))))
8631 (with-current-buffer gnus-article-buffer
8633 (article-narrow-to-head)
8634 (let* ((buffer-read-only nil)
8635 (inhibit-point-motion-hooks t)
8636 (hidden (if (numberp arg)
8638 (gnus-article-hidden-text-p 'headers)))
8640 (delete-region (point-min) (point-max))
8641 (with-current-buffer gnus-original-article-buffer
8642 (goto-char (setq s (point-min)))
8643 (setq e (if (search-forward "\n\n" nil t)
8646 (insert-buffer-substring gnus-original-article-buffer s e)
8647 (article-decode-encoded-words)
8649 (let ((gnus-treat-hide-headers nil)
8650 (gnus-treat-hide-boring-headers nil))
8651 (gnus-delete-wash-type 'headers)
8652 (gnus-treat-article 'head))
8653 (gnus-treat-article 'head))
8656 (set-window-start window (goto-char (point-min))))
8657 (setq gnus-page-broken
8658 (when gnus-break-pages
8659 (gnus-narrow-to-page)
8661 (gnus-set-mode-line 'article)))))
8663 (defun gnus-summary-show-all-headers ()
8664 "Make all header lines visible."
8666 (gnus-summary-toggle-header 1))
8668 (defun gnus-summary-toggle-mime (&optional arg)
8669 "Toggle MIME processing.
8670 If ARG is a positive number, turn MIME processing on."
8672 (setq gnus-show-mime
8674 (not gnus-show-mime)
8675 (> (prefix-numeric-value arg) 0)))
8676 (gnus-summary-select-article t 'force))
8678 (defun gnus-summary-caesar-message (&optional arg)
8679 "Caesar rotate the current article by 13.
8680 The numerical prefix specifies how many places to rotate each letter
8683 (gnus-summary-select-article)
8684 (let ((mail-header-separator ""))
8685 (gnus-eval-in-buffer-window gnus-article-buffer
8688 (let ((start (window-start))
8690 (message-caesar-buffer-body arg)
8691 (set-window-start (get-buffer-window (current-buffer)) start))))))
8693 (autoload 'unmorse-region "morse"
8694 "Convert morse coded text in region to ordinary ASCII text."
8697 (defun gnus-summary-morse-message (&optional arg)
8698 "Morse decode the current article."
8700 (gnus-summary-select-article)
8701 (let ((mail-header-separator ""))
8702 (gnus-eval-in-buffer-window gnus-article-buffer
8706 (let ((pos (window-start))
8708 (goto-char (point-min))
8709 (when (message-goto-body)
8710 (gnus-narrow-to-body))
8711 (goto-char (point-min))
8712 (while (re-search-forward "·" (point-max) t)
8713 (replace-match "."))
8714 (unmorse-region (point-min) (point-max))
8716 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8718 (defun gnus-summary-stop-page-breaking ()
8719 "Stop page breaking in the current article."
8721 (gnus-summary-select-article)
8722 (gnus-eval-in-buffer-window gnus-article-buffer
8724 (when (gnus-visual-p 'page-marker)
8725 (let ((buffer-read-only nil))
8726 (gnus-remove-text-with-property 'gnus-prev)
8727 (gnus-remove-text-with-property 'gnus-next))
8728 (setq gnus-page-broken nil))))
8730 (defun gnus-summary-move-article (&optional n to-newsgroup
8731 select-method action)
8732 "Move the current article to a different newsgroup.
8733 If N is a positive number, move the N next articles.
8734 If N is a negative number, move the N previous articles.
8735 If N is nil and any articles have been marked with the process mark,
8736 move those articles instead.
8737 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8738 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8739 re-spool using this method.
8741 When called interactively with TO-NEWSGROUP being nil, the value of
8742 the variable `gnus-move-split-methods' is used for finding a default
8743 for the target newsgroup.
8745 For this function to work, both the current newsgroup and the
8746 newsgroup that you want to move to have to support the `request-move'
8747 and `request-accept' functions.
8749 ACTION can be either `move' (the default), `crosspost' or `copy'."
8752 (setq action 'move))
8753 ;; Check whether the source group supports the required functions.
8754 (cond ((and (eq action 'move)
8755 (not (gnus-check-backend-function
8756 'request-move-article gnus-newsgroup-name)))
8757 (error "The current group does not support article moving"))
8758 ((and (eq action 'crosspost)
8759 (not (gnus-check-backend-function
8760 'request-replace-article gnus-newsgroup-name)))
8761 (error "The current group does not support article editing")))
8762 (let ((articles (gnus-summary-work-articles n))
8763 (prefix (if (gnus-check-backend-function
8764 'request-move-article gnus-newsgroup-name)
8765 (gnus-group-real-prefix gnus-newsgroup-name)
8767 (names '((move "Move" "Moving")
8768 (copy "Copy" "Copying")
8769 (crosspost "Crosspost" "Crossposting")))
8770 (copy-buf (save-excursion
8771 (nnheader-set-temp-buffer " *copy article*")))
8772 (default-marks gnus-article-mark-lists)
8773 (no-expire-marks (delete '(expirable . expire)
8774 (copy-sequence gnus-article-mark-lists)))
8775 art-group to-method new-xref article to-groups)
8776 (unless (assq action names)
8777 (error "Unknown action %s" action))
8778 ;; Read the newsgroup name.
8779 (when (and (not to-newsgroup)
8780 (not select-method))
8781 (if (and gnus-move-split-methods
8783 (and (memq gnus-current-article articles)
8784 (gnus-buffer-live-p gnus-original-article-buffer))))
8785 ;; When `gnus-move-split-methods' is non-nil, we have to
8786 ;; select an article to give `gnus-read-move-group-name' an
8787 ;; opportunity to suggest an appropriate default. However,
8788 ;; we needn't render or mark the article.
8789 (let ((gnus-display-mime-function nil)
8790 (gnus-article-prepare-hook nil)
8791 (gnus-mark-article-hook nil))
8792 (gnus-summary-select-article nil nil nil (car articles))))
8794 (gnus-read-move-group-name
8795 (cadr (assq action names))
8796 (symbol-value (intern (format "gnus-current-%s-group" action)))
8798 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8799 (setq to-method (or select-method
8800 (gnus-server-to-method
8801 (gnus-group-method to-newsgroup))))
8802 ;; Check the method we are to move this article to...
8803 (unless (gnus-check-backend-function
8804 'request-accept-article (car to-method))
8805 (error "%s does not support article copying" (car to-method)))
8806 (unless (gnus-check-server to-method)
8807 (error "Can't open server %s" (car to-method)))
8808 (gnus-message 6 "%s to %s: %s..."
8809 (caddr (assq action names))
8810 (or (car select-method) to-newsgroup) articles)
8812 (setq article (pop articles))
8816 ;; Move the article.
8818 ;; Remove this article from future suppression.
8819 (gnus-dup-unsuppress-article article)
8820 (gnus-request-move-article
8821 article ; Article to move
8822 gnus-newsgroup-name ; From newsgroup
8823 (nth 1 (gnus-find-method-for-group
8824 gnus-newsgroup-name)) ; Server
8825 (list 'gnus-request-accept-article
8826 to-newsgroup (list 'quote select-method)
8827 (not articles) t) ; Accept form
8828 (not articles))) ; Only save nov last time
8829 ;; Copy the article.
8832 (set-buffer copy-buf)
8833 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
8834 (gnus-request-accept-article
8835 to-newsgroup select-method (not articles) t))))
8836 ;; Crosspost the article.
8837 ((eq action 'crosspost)
8838 (let ((xref (message-tokenize-header
8839 (mail-header-xref (gnus-summary-article-header article))
8841 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
8842 ":" (number-to-string article)))
8844 (setq xref (list (system-name))))
8847 (mapconcat 'identity
8848 (delete "Xref:" (delete new-xref xref))
8852 (set-buffer copy-buf)
8853 ;; First put the article in the destination group.
8854 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8855 (when (consp (setq art-group
8856 (gnus-request-accept-article
8857 to-newsgroup select-method (not articles))))
8858 (setq new-xref (concat new-xref " " (car art-group)
8860 (number-to-string (cdr art-group))))
8861 ;; Now we have the new Xrefs header, so we insert
8862 ;; it and replace the new article.
8863 (nnheader-replace-header "Xref" new-xref)
8864 (gnus-request-replace-article
8865 (cdr art-group) to-newsgroup (current-buffer))
8869 (gnus-message 1 "Couldn't %s article %s: %s"
8870 (cadr (assq action names)) article
8871 (nnheader-get-report (car to-method))))
8872 ((eq art-group 'junk)
8873 (when (eq action 'move)
8874 (gnus-summary-mark-article article gnus-canceled-mark)
8875 (gnus-message 4 "Deleted article %s" article)))
8877 (let* ((pto-group (gnus-group-prefixed-name
8878 (car art-group) to-method))
8880 (gnus-gethash pto-group gnus-newsrc-hashtb))
8881 (info (nth 2 entry))
8882 (to-group (gnus-info-group info))
8884 ;; Update the group that has been moved to.
8886 (memq action '(move copy)))
8887 (unless (member to-group to-groups)
8888 (push to-group to-groups))
8890 (unless (memq article gnus-newsgroup-unreads)
8891 (push 'read to-marks)
8893 info (gnus-add-to-range (gnus-info-read info)
8894 (list (cdr art-group)))))
8896 ;; See whether the article is to be put in the cache.
8897 (let ((marks (if (gnus-group-auto-expirable-p to-group)
8900 (to-article (cdr art-group)))
8902 ;; Enter the article into the cache in the new group,
8903 ;; if that is required.
8904 (when gnus-use-cache
8905 (gnus-cache-possibly-enter-article
8907 (let ((header (copy-sequence
8908 (gnus-summary-article-header article))))
8909 (mail-header-set-number header to-article)
8911 (memq article gnus-newsgroup-marked)
8912 (memq article gnus-newsgroup-dormant)
8913 (memq article gnus-newsgroup-unreads)))
8915 (when gnus-preserve-marks
8916 ;; Copy any marks over to the new group.
8917 (when (and (equal to-group gnus-newsgroup-name)
8918 (not (memq article gnus-newsgroup-unreads)))
8919 ;; Mark this article as read in this group.
8920 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
8921 (setcdr (gnus-active to-group) to-article)
8922 (setcdr gnus-newsgroup-active to-article))
8925 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
8926 (when (memq article (symbol-value
8927 (intern (format "gnus-newsgroup-%s"
8929 (push (cdar marks) to-marks)
8930 ;; If the other group is the same as this group,
8931 ;; then we have to add the mark to the list.
8932 (when (equal to-group gnus-newsgroup-name)
8933 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
8936 (intern (format "gnus-newsgroup-%s"
8938 ;; Copy the marks to other group.
8939 (gnus-add-marked-articles
8940 to-group (cdar marks) (list to-article) info)))
8941 (setq marks (cdr marks)))
8943 (gnus-request-set-mark
8944 to-group (list (list (list to-article) 'add to-marks))))
8947 (concat "(gnus-group-set-info '"
8948 (gnus-prin1-to-string (gnus-get-info to-group))
8951 ;; Update the Xref header in this article to point to
8952 ;; the new crossposted article we have just created.
8953 (when (eq action 'crosspost)
8955 (set-buffer copy-buf)
8956 (gnus-request-article-this-buffer article gnus-newsgroup-name)
8957 (nnheader-replace-header "Xref" new-xref)
8958 (gnus-request-replace-article
8959 article gnus-newsgroup-name (current-buffer)))))
8961 ;;;!!!Why is this necessary?
8962 (set-buffer gnus-summary-buffer)
8964 (gnus-summary-goto-subject article)
8965 (when (eq action 'move)
8966 (gnus-summary-mark-article article gnus-canceled-mark))))
8967 (gnus-summary-remove-process-mark article))
8968 ;; Re-activate all groups that have been moved to.
8970 (set-buffer gnus-group-buffer)
8971 (let ((gnus-group-marked to-groups))
8972 (gnus-group-get-new-news-this-group nil t)))
8974 (gnus-kill-buffer copy-buf)
8975 (gnus-summary-position-point)
8976 (gnus-set-mode-line 'summary)))
8978 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
8979 "Move the current article to a different newsgroup.
8980 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8981 When called interactively, if TO-NEWSGROUP is nil, use the value of
8982 the variable `gnus-move-split-methods' for finding a default target
8984 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8985 re-spool using this method."
8987 (gnus-summary-move-article n to-newsgroup select-method 'copy))
8989 (defun gnus-summary-crosspost-article (&optional n)
8990 "Crosspost the current article to some other group."
8992 (gnus-summary-move-article n nil nil 'crosspost))
8994 (defcustom gnus-summary-respool-default-method nil
8995 "Default method type for respooling an article.
8996 If nil, use to the current newsgroup method."
8998 :group 'gnus-summary-mail)
9000 (defcustom gnus-summary-display-while-building nil
9001 "If not-nil, show and update the summary buffer as it's being built.
9002 If the value is t, update the buffer after every line is inserted. If
9003 the value is an integer (N), update the display every N lines."
9005 :type '(choice (const :tag "off" nil)
9007 (const :tag "frequently" t)))
9009 (defun gnus-summary-respool-article (&optional n method)
9010 "Respool the current article.
9011 The article will be squeezed through the mail spooling process again,
9012 which means that it will be put in some mail newsgroup or other
9013 depending on `nnmail-split-methods'.
9014 If N is a positive number, respool the N next articles.
9015 If N is a negative number, respool the N previous articles.
9016 If N is nil and any articles have been marked with the process mark,
9017 respool those articles instead.
9019 Respooling can be done both from mail groups and \"real\" newsgroups.
9020 In the former case, the articles in question will be moved from the
9021 current group into whatever groups they are destined to. In the
9022 latter case, they will be copied into the relevant groups."
9024 (list current-prefix-arg
9025 (let* ((methods (gnus-methods-using 'respool))
9027 (symbol-name (or gnus-summary-respool-default-method
9028 (car (gnus-find-method-for-group
9029 gnus-newsgroup-name)))))
9031 (gnus-completing-read-with-default
9032 methname "What backend do you want to use when respooling?"
9033 methods nil t nil 'gnus-mail-method-history))
9036 ((zerop (length (setq ms (gnus-servers-using-backend
9038 (list (intern method) ""))
9042 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9043 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9046 (error "No method given for respooling"))
9047 (if (assoc (symbol-name
9048 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9049 (gnus-methods-using 'respool))
9050 (gnus-summary-move-article n nil method)
9051 (gnus-summary-copy-article n nil method)))
9053 (defun gnus-summary-import-article (file &optional edit)
9054 "Import an arbitrary file into a mail newsgroup."
9055 (interactive "fImport file: \nP")
9056 (let ((group gnus-newsgroup-name)
9057 (now (current-time))
9058 atts lines group-art)
9059 (unless (gnus-check-backend-function 'request-accept-article group)
9060 (error "%s does not support article importing" group))
9061 (or (file-readable-p file)
9062 (not (file-regular-p file))
9063 (error "Can't read %s" file))
9065 (set-buffer (gnus-get-buffer-create " *import file*"))
9067 (nnheader-insert-file-contents file)
9068 (goto-char (point-min))
9069 (if (nnheader-article-p)
9071 (goto-char (point-min))
9072 (search-forward "\n\n" nil t)
9073 (narrow-to-region (point-min) (1- (point)))
9074 (goto-char (point-min))
9075 (unless (re-search-forward "^date:" nil t)
9076 (goto-char (point-max))
9077 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9078 ;; This doesn't look like an article, so we fudge some headers.
9079 (setq atts (file-attributes file)
9080 lines (count-lines (point-min) (point-max)))
9081 (insert "From: " (read-string "From: ") "\n"
9082 "Subject: " (read-string "Subject: ") "\n"
9083 "Date: " (message-make-date (nth 5 atts)) "\n"
9084 "Message-ID: " (message-make-message-id) "\n"
9085 "Lines: " (int-to-string lines) "\n"
9086 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9087 (setq group-art (gnus-request-accept-article group nil t))
9088 (kill-buffer (current-buffer)))
9089 (setq gnus-newsgroup-active (gnus-activate-group group))
9091 (gnus-summary-goto-article (cdr group-art) nil t)
9093 (gnus-summary-edit-article))))
9095 (defun gnus-summary-create-article ()
9096 "Create an article in a mail newsgroup."
9098 (let ((group gnus-newsgroup-name)
9099 (now (current-time))
9101 (unless (gnus-check-backend-function 'request-accept-article group)
9102 (error "%s does not support article importing" group))
9104 (set-buffer (gnus-get-buffer-create " *import file*"))
9106 (goto-char (point-min))
9107 ;; This doesn't look like an article, so we fudge some headers.
9108 (insert "From: " (read-string "From: ") "\n"
9109 "Subject: " (read-string "Subject: ") "\n"
9110 "Date: " (message-make-date now) "\n"
9111 "Message-ID: " (message-make-message-id) "\n")
9112 (setq group-art (gnus-request-accept-article group nil t))
9113 (kill-buffer (current-buffer)))
9114 (setq gnus-newsgroup-active (gnus-activate-group group))
9116 (gnus-summary-goto-article (cdr group-art) nil t)
9117 (gnus-summary-edit-article)))
9119 (defun gnus-summary-article-posted-p ()
9120 "Say whether the current (mail) article is available from news as well.
9121 This will be the case if the article has both been mailed and posted."
9123 (let ((id (mail-header-references (gnus-summary-article-header)))
9124 (gnus-override-method (car (gnus-refer-article-methods))))
9125 (if (gnus-request-head id "")
9126 (gnus-message 2 "The current message was found on %s"
9127 gnus-override-method)
9128 (gnus-message 2 "The current message couldn't be found on %s"
9129 gnus-override-method)
9132 (defun gnus-summary-expire-articles (&optional now)
9133 "Expire all articles that are marked as expirable in the current group."
9135 (when (gnus-check-backend-function
9136 'request-expire-articles gnus-newsgroup-name)
9137 ;; This backend supports expiry.
9138 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9139 (expirable (if total
9141 ;; We need to update the info for
9142 ;; this group for `gnus-list-of-read-articles'
9143 ;; to give us the right answer.
9144 (gnus-run-hooks 'gnus-exit-group-hook)
9145 (gnus-summary-update-info)
9146 (gnus-list-of-read-articles gnus-newsgroup-name))
9147 (setq gnus-newsgroup-expirable
9148 (sort gnus-newsgroup-expirable '<))))
9149 (expiry-wait (if now 'immediate
9150 (gnus-group-find-parameter
9151 gnus-newsgroup-name 'expiry-wait)))
9152 (nnmail-expiry-target
9153 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9154 nnmail-expiry-target))
9157 ;; There are expirable articles in this group, so we run them
9158 ;; through the expiry process.
9159 (gnus-message 6 "Expiring articles...")
9160 (unless (gnus-check-group gnus-newsgroup-name)
9161 (error "Can't open server for %s" gnus-newsgroup-name))
9162 ;; The list of articles that weren't expired is returned.
9165 (let ((nnmail-expiry-wait-function nil)
9166 (nnmail-expiry-wait expiry-wait))
9167 (setq es (gnus-request-expire-articles
9168 expirable gnus-newsgroup-name)))
9169 (setq es (gnus-request-expire-articles
9170 expirable gnus-newsgroup-name)))
9172 (setq gnus-newsgroup-expirable es))
9173 ;; We go through the old list of expirable, and mark all
9174 ;; really expired articles as nonexistent.
9175 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9176 (let ((gnus-use-cache nil))
9177 (dolist (article expirable)
9178 (when (and (not (memq article es))
9179 (gnus-data-find article))
9180 (gnus-summary-mark-article article gnus-canceled-mark))))))
9181 (gnus-message 6 "Expiring articles...done")))))
9183 (defun gnus-summary-expire-articles-now ()
9184 "Expunge all expirable articles in the current group.
9185 This means that *all* articles that are marked as expirable will be
9186 deleted forever, right now."
9188 (or gnus-expert-user
9190 "Are you really, really, really sure you want to delete all these messages? ")
9192 (gnus-summary-expire-articles t))
9194 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9195 (defun gnus-summary-delete-article (&optional n)
9196 "Delete the N next (mail) articles.
9197 This command actually deletes articles. This is not a marking
9198 command. The article will disappear forever from your life, never to
9200 If N is negative, delete backwards.
9201 If N is nil and articles have been marked with the process mark,
9202 delete these instead."
9204 (unless (gnus-check-backend-function 'request-expire-articles
9205 gnus-newsgroup-name)
9206 (error "The current newsgroup does not support article deletion"))
9207 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9208 (error "Couldn't open server"))
9209 ;; Compute the list of articles to delete.
9210 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9211 (nnmail-expiry-target 'delete)
9213 (if (and gnus-novice-user
9214 (not (gnus-yes-or-no-p
9215 (format "Do you really want to delete %s forever? "
9216 (if (> (length articles) 1)
9217 (format "these %s articles" (length articles))
9220 ;; Delete the articles.
9221 (setq not-deleted (gnus-request-expire-articles
9222 articles gnus-newsgroup-name 'force))
9224 (gnus-summary-remove-process-mark (car articles))
9225 ;; The backend might not have been able to delete the article
9227 (unless (memq (car articles) not-deleted)
9228 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9229 (setq articles (cdr articles)))
9231 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9232 (gnus-summary-position-point)
9233 (gnus-set-mode-line 'summary)
9236 (defun gnus-summary-edit-article (&optional force)
9237 "Edit the current article.
9238 This will have permanent effect only in mail groups.
9239 If FORCE is non-nil, allow editing of articles even in read-only
9243 (set-buffer gnus-summary-buffer)
9244 (let ((mail-parse-charset gnus-newsgroup-charset)
9245 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9246 (gnus-set-global-variables)
9247 (when (and (not force)
9248 (gnus-group-read-only-p))
9249 (error "The current newsgroup does not support article editing"))
9250 (gnus-summary-show-article t)
9251 (gnus-article-edit-article
9253 `(lambda (no-highlight)
9254 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9255 (message-options message-options)
9256 (message-options-set-recipient)
9257 (mail-parse-ignored-charsets
9258 ',gnus-newsgroup-ignored-charsets))
9259 (gnus-summary-edit-article-done
9260 ,(or (mail-header-references gnus-current-headers) "")
9261 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
9263 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9265 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9267 "Make edits to the current article permanent."
9270 ;; The buffer restriction contains the entire article if it exists.
9271 (when (article-goto-body)
9272 (let ((lines (count-lines (point) (point-max)))
9273 (length (- (point-max) (point)))
9274 (case-fold-search t)
9275 (body (copy-marker (point))))
9276 (goto-char (point-min))
9277 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9278 (delete-region (match-beginning 1) (match-end 1))
9279 (insert (number-to-string length)))
9280 (goto-char (point-min))
9281 (when (re-search-forward
9282 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9283 (delete-region (match-beginning 1) (match-end 1))
9284 (insert (number-to-string length)))
9285 (goto-char (point-min))
9286 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9287 (delete-region (match-beginning 1) (match-end 1))
9288 (insert (number-to-string lines))))))
9289 ;; Replace the article.
9290 (let ((buf (current-buffer)))
9292 (insert-buffer-substring buf)
9294 (if (and (not read-only)
9295 (not (gnus-request-replace-article
9296 (cdr gnus-article-current) (car gnus-article-current)
9297 (current-buffer) t)))
9298 (error "Couldn't replace article")
9299 ;; Update the summary buffer.
9301 (equal (message-tokenize-header references " ")
9302 (message-tokenize-header
9303 (or (message-fetch-field "references") "") " ")))
9304 ;; We only have to update this line.
9307 (message-narrow-to-head)
9308 (let ((head (buffer-string))
9311 (insert (format "211 %d Article retrieved.\n"
9312 (cdr gnus-article-current)))
9315 (let ((nntp-server-buffer (current-buffer)))
9316 (setq header (car (gnus-get-newsgroup-headers
9319 (set-buffer gnus-summary-buffer)
9320 (gnus-data-set-header
9321 (gnus-data-find (cdr gnus-article-current))
9323 (gnus-summary-update-article-line
9324 (cdr gnus-article-current) header)
9325 (if (gnus-summary-goto-subject
9326 (cdr gnus-article-current) nil t)
9327 (gnus-summary-update-secondary-mark
9328 (cdr gnus-article-current))))))))
9330 (set-buffer (or buffer gnus-summary-buffer))
9331 (gnus-summary-update-article (cdr gnus-article-current))
9332 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9333 (gnus-summary-update-secondary-mark
9334 (cdr gnus-article-current))))
9335 ;; Prettify the article buffer again.
9336 (unless no-highlight
9338 (set-buffer gnus-article-buffer)
9339 ;;;!!! Fix this -- article should be rehighlighted.
9340 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9341 (set-buffer gnus-original-article-buffer)
9342 (gnus-request-article
9343 (cdr gnus-article-current)
9344 (car gnus-article-current) (current-buffer))))
9345 ;; Prettify the summary buffer line.
9346 (when (gnus-visual-p 'summary-highlight 'highlight)
9347 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9349 (defun gnus-summary-edit-wash (key)
9350 "Perform editing command KEY in the article buffer."
9354 (message "%s" (concat (this-command-keys) "- "))
9357 (gnus-summary-edit-article)
9358 (execute-kbd-macro (concat (this-command-keys) key))
9359 (gnus-article-edit-done))
9363 (defun gnus-summary-respool-query (&optional silent trace)
9364 "Query where the respool algorithm would put this article."
9366 (let (gnus-mark-article-hook)
9367 (gnus-summary-select-article)
9369 (set-buffer gnus-original-article-buffer)
9371 (message-narrow-to-head)
9372 (let ((groups (nnmail-article-group 'identity trace)))
9375 (message "This message would go to %s"
9376 (mapconcat 'car groups ", "))
9377 (message "This message would go to no groups"))
9380 (defun gnus-summary-respool-trace ()
9381 "Trace where the respool algorithm would put this article.
9382 Display a buffer showing all fancy splitting patterns which matched."
9384 (gnus-summary-respool-query nil t))
9386 ;; Summary marking commands.
9388 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9389 "Mark articles which has the same subject as read, and then select the next.
9390 If UNMARK is positive, remove any kind of mark.
9391 If UNMARK is negative, tick articles."
9394 (setq unmark (prefix-numeric-value unmark)))
9396 (gnus-summary-mark-same-subject
9397 (gnus-summary-article-subject) unmark)))
9398 ;; Select next unread article. If auto-select-same mode, should
9399 ;; select the first unread article.
9400 (gnus-summary-next-article t (and gnus-auto-select-same
9401 (gnus-summary-article-subject)))
9402 (gnus-message 7 "%d article%s marked as %s"
9403 count (if (= count 1) " is" "s are")
9404 (if unmark "unread" "read"))))
9406 (defun gnus-summary-kill-same-subject (&optional unmark)
9407 "Mark articles which has the same subject as read.
9408 If UNMARK is positive, remove any kind of mark.
9409 If UNMARK is negative, tick articles."
9412 (setq unmark (prefix-numeric-value unmark)))
9414 (gnus-summary-mark-same-subject
9415 (gnus-summary-article-subject) unmark)))
9416 ;; If marked as read, go to next unread subject.
9418 ;; Go to next unread subject.
9419 (gnus-summary-next-subject 1 t))
9420 (gnus-message 7 "%d articles are marked as %s"
9421 count (if unmark "unread" "read"))))
9423 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9424 "Mark articles with same SUBJECT as read, and return marked number.
9425 If optional argument UNMARK is positive, remove any kinds of marks.
9426 If optional argument UNMARK is negative, mark articles as unread instead."
9430 ((null unmark) ; Mark as read.
9433 (gnus-summary-mark-article-as-read gnus-killed-mark)
9434 (gnus-summary-show-thread) t)
9435 (gnus-summary-find-subject subject))
9436 (setq count (1+ count))))
9437 ((> unmark 0) ; Tick.
9440 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9441 (gnus-summary-show-thread) t)
9442 (gnus-summary-find-subject subject))
9443 (setq count (1+ count))))
9444 (t ; Mark as unread.
9447 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9448 (gnus-summary-show-thread) t)
9449 (gnus-summary-find-subject subject))
9450 (setq count (1+ count)))))
9451 (gnus-set-mode-line 'summary)
9452 ;; Return the number of marked articles.
9455 (defun gnus-summary-mark-as-processable (n &optional unmark)
9456 "Set the process mark on the next N articles.
9457 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9458 the process mark instead. The difference between N and the actual
9459 number of articles marked is returned."
9461 (if (and (null n) (gnus-region-active-p))
9462 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9463 (setq n (prefix-numeric-value n))
9464 (let ((backward (< n 0))
9469 (gnus-summary-remove-process-mark
9470 (gnus-summary-article-number))
9471 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9472 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9475 (gnus-message 7 "No more articles"))
9476 (gnus-summary-recenter)
9477 (gnus-summary-position-point)
9480 (defun gnus-summary-unmark-as-processable (n)
9481 "Remove the process mark from the next N articles.
9482 If N is negative, unmark backward instead. The difference between N and
9483 the actual number of articles unmarked is returned."
9485 (gnus-summary-mark-as-processable n t))
9487 (defun gnus-summary-unmark-all-processable ()
9488 "Remove the process mark from all articles."
9491 (while gnus-newsgroup-processable
9492 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9493 (gnus-summary-position-point))
9495 (defun gnus-summary-add-mark (article type)
9496 "Mark ARTICLE with a mark of TYPE."
9497 (let ((vtype (car (assq type gnus-article-mark-lists)))
9500 (error "No such mark type: %s" type)
9501 (setq var (intern (format "gnus-newsgroup-%s" type)))
9502 (set var (cons article (symbol-value var)))
9503 (if (memq type '(processable cached replied forwarded recent saved))
9504 (gnus-summary-update-secondary-mark article)
9505 ;;; !!! This is bogus. We should find out what primary
9506 ;;; !!! mark we want to set.
9507 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9509 (defun gnus-summary-mark-as-expirable (n)
9510 "Mark N articles forward as expirable.
9511 If N is negative, mark backward instead. The difference between N and
9512 the actual number of articles marked is returned."
9514 (gnus-summary-mark-forward n gnus-expirable-mark))
9516 (defun gnus-summary-mark-as-spam (n)
9517 "Mark N articles forward as spam.
9518 If N is negative, mark backward instead. The difference between N and
9519 the actual number of articles marked is returned."
9521 (gnus-summary-mark-forward n gnus-spam-mark))
9523 (defun gnus-summary-mark-article-as-replied (article)
9524 "Mark ARTICLE as replied to and update the summary line.
9525 ARTICLE can also be a list of articles."
9526 (interactive (list (gnus-summary-article-number)))
9527 (let ((articles (if (listp article) article (list article))))
9528 (dolist (article articles)
9529 (push article gnus-newsgroup-replied)
9530 (let ((buffer-read-only nil))
9531 (when (gnus-summary-goto-subject article nil t)
9532 (gnus-summary-update-secondary-mark article))))))
9534 (defun gnus-summary-mark-article-as-forwarded (article)
9535 "Mark ARTICLE as forwarded and update the summary line.
9536 ARTICLE can also be a list of articles."
9537 (let ((articles (if (listp article) article (list article))))
9538 (dolist (article articles)
9539 (push article gnus-newsgroup-forwarded)
9540 (let ((buffer-read-only nil))
9541 (when (gnus-summary-goto-subject article nil t)
9542 (gnus-summary-update-secondary-mark article))))))
9544 (defun gnus-summary-set-bookmark (article)
9545 "Set a bookmark in current article."
9546 (interactive (list (gnus-summary-article-number)))
9547 (when (or (not (get-buffer gnus-article-buffer))
9548 (not gnus-current-article)
9549 (not gnus-article-current)
9550 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9551 (error "No current article selected"))
9552 ;; Remove old bookmark, if one exists.
9553 (gnus-pull article gnus-newsgroup-bookmarks)
9554 ;; Set the new bookmark, which is on the form
9555 ;; (article-number . line-number-in-body).
9559 (set-buffer gnus-article-buffer)
9566 gnus-newsgroup-bookmarks)
9567 (gnus-message 6 "A bookmark has been added to the current article."))
9569 (defun gnus-summary-remove-bookmark (article)
9570 "Remove the bookmark from the current article."
9571 (interactive (list (gnus-summary-article-number)))
9572 ;; Remove old bookmark, if one exists.
9573 (if (not (assq article gnus-newsgroup-bookmarks))
9574 (gnus-message 6 "No bookmark in current article.")
9575 (gnus-pull article gnus-newsgroup-bookmarks)
9576 (gnus-message 6 "Removed bookmark.")))
9578 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9579 (defun gnus-summary-mark-as-dormant (n)
9580 "Mark N articles forward as dormant.
9581 If N is negative, mark backward instead. The difference between N and
9582 the actual number of articles marked is returned."
9584 (gnus-summary-mark-forward n gnus-dormant-mark))
9586 (defun gnus-summary-set-process-mark (article)
9587 "Set the process mark on ARTICLE and update the summary line."
9588 (setq gnus-newsgroup-processable
9590 (delq article gnus-newsgroup-processable)))
9591 (when (gnus-summary-goto-subject article)
9592 (gnus-summary-show-thread)
9593 (gnus-summary-goto-subject article)
9594 (gnus-summary-update-secondary-mark article)))
9596 (defun gnus-summary-remove-process-mark (article)
9597 "Remove the process mark from ARTICLE and update the summary line."
9598 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9599 (when (gnus-summary-goto-subject article)
9600 (gnus-summary-show-thread)
9601 (gnus-summary-goto-subject article)
9602 (gnus-summary-update-secondary-mark article)))
9604 (defun gnus-summary-set-saved-mark (article)
9605 "Set the process mark on ARTICLE and update the summary line."
9606 (push article gnus-newsgroup-saved)
9607 (when (gnus-summary-goto-subject article)
9608 (gnus-summary-update-secondary-mark article)))
9610 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9611 "Mark N articles as read forwards.
9612 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9613 The difference between N and the actual number of articles marked is
9615 If NO-EXPIRE, auto-expiry will be inhibited."
9617 (gnus-summary-show-thread)
9618 (let ((backward (< n 0))
9619 (gnus-summary-goto-unread
9620 (and gnus-summary-goto-unread
9621 (not (eq gnus-summary-goto-unread 'never))
9622 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9623 gnus-ticked-mark gnus-dormant-mark)))))
9625 (mark (or mark gnus-del-mark)))
9627 (gnus-summary-mark-article nil mark no-expire)
9628 (zerop (gnus-summary-next-subject
9630 (and gnus-summary-goto-unread
9631 (not (eq gnus-summary-goto-unread 'never)))
9635 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9636 (gnus-summary-recenter)
9637 (gnus-summary-position-point)
9638 (gnus-set-mode-line 'summary)
9641 (defun gnus-summary-mark-article-as-read (mark)
9642 "Mark the current article quickly as read with MARK."
9643 (let ((article (gnus-summary-article-number)))
9644 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9645 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9646 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9647 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9648 (push (cons article mark) gnus-newsgroup-reads)
9649 ;; Possibly remove from cache, if that is used.
9650 (when gnus-use-cache
9651 (gnus-cache-enter-remove-article article))
9652 ;; Allow the backend to change the mark.
9653 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9654 ;; Check for auto-expiry.
9655 (when (and gnus-newsgroup-auto-expire
9656 (memq mark gnus-auto-expirable-marks))
9657 (setq mark gnus-expirable-mark)
9658 ;; Let the backend know about the mark change.
9659 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9660 (push article gnus-newsgroup-expirable))
9661 ;; Set the mark in the buffer.
9662 (gnus-summary-update-mark mark 'unread)
9665 (defun gnus-summary-mark-article-as-unread (mark)
9666 "Mark the current article quickly as unread with MARK."
9667 (let* ((article (gnus-summary-article-number))
9668 (old-mark (gnus-summary-article-mark article)))
9669 ;; Allow the backend to change the mark.
9670 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9671 (if (eq mark old-mark)
9675 (gnus-error 1 "Can't mark negative article numbers")
9677 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9678 (setq gnus-newsgroup-spam-marked
9679 (delq article gnus-newsgroup-spam-marked))
9680 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9681 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9682 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9683 (cond ((= mark gnus-ticked-mark)
9684 (setq gnus-newsgroup-marked
9685 (gnus-add-to-sorted-list gnus-newsgroup-marked
9687 ((= mark gnus-spam-mark)
9688 (setq gnus-newsgroup-spam-marked
9689 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9691 ((= mark gnus-dormant-mark)
9692 (setq gnus-newsgroup-dormant
9693 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9696 (setq gnus-newsgroup-unreads
9697 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9699 (gnus-pull article gnus-newsgroup-reads)
9701 ;; See whether the article is to be put in the cache.
9703 (vectorp (gnus-summary-article-header article))
9705 (gnus-cache-possibly-enter-article
9706 gnus-newsgroup-name article
9707 (gnus-summary-article-header article)
9708 (= mark gnus-ticked-mark)
9709 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9712 (gnus-summary-update-mark mark 'unread)
9715 (defun gnus-summary-mark-article (&optional article mark no-expire)
9716 "Mark ARTICLE with MARK. MARK can be any character.
9717 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9718 `??' (dormant) and `?E' (expirable).
9719 If MARK is nil, then the default character `?r' is used.
9720 If ARTICLE is nil, then the article on the current line will be
9722 If NO-EXPIRE, auto-expiry will be inhibited."
9723 ;; The mark might be a string.
9724 (when (stringp mark)
9725 (setq mark (aref mark 0)))
9726 ;; If no mark is given, then we check auto-expiring.
9728 (setq mark gnus-del-mark))
9729 (when (and (not no-expire)
9730 gnus-newsgroup-auto-expire
9731 (memq mark gnus-auto-expirable-marks))
9732 (setq mark gnus-expirable-mark))
9733 (let ((article (or article (gnus-summary-article-number)))
9734 (old-mark (gnus-summary-article-mark article)))
9735 ;; Allow the backend to change the mark.
9736 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9737 (if (eq mark old-mark)
9740 (error "No article on current line"))
9741 (if (not (if (or (= mark gnus-unread-mark)
9742 (= mark gnus-ticked-mark)
9743 (= mark gnus-spam-mark)
9744 (= mark gnus-dormant-mark))
9745 (gnus-mark-article-as-unread article mark)
9746 (gnus-mark-article-as-read article mark)))
9748 ;; See whether the article is to be put in the cache.
9750 (not (= mark gnus-canceled-mark))
9751 (vectorp (gnus-summary-article-header article))
9753 (gnus-cache-possibly-enter-article
9754 gnus-newsgroup-name article
9755 (gnus-summary-article-header article)
9756 (= mark gnus-ticked-mark)
9757 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9759 (when (gnus-summary-goto-subject article nil t)
9760 (let ((buffer-read-only nil))
9761 (gnus-summary-show-thread)
9763 (gnus-summary-update-mark mark 'unread)
9766 (defun gnus-summary-update-secondary-mark (article)
9767 "Update the secondary (read, process, cache) mark."
9768 (gnus-summary-update-mark
9769 (cond ((memq article gnus-newsgroup-processable)
9771 ((memq article gnus-newsgroup-cached)
9773 ((memq article gnus-newsgroup-replied)
9775 ((memq article gnus-newsgroup-forwarded)
9776 gnus-forwarded-mark)
9777 ((memq article gnus-newsgroup-saved)
9779 ((memq article gnus-newsgroup-recent)
9781 ((memq article gnus-newsgroup-unseen)
9785 (when (gnus-visual-p 'summary-highlight 'highlight)
9786 (gnus-run-hooks 'gnus-summary-update-hook))
9789 (defun gnus-summary-update-download-mark (article)
9790 "Update the secondary (read, process, cache) mark."
9791 (gnus-summary-update-mark
9792 (cond ((memq article gnus-newsgroup-undownloaded)
9793 gnus-undownloaded-mark)
9794 (gnus-newsgroup-agentized
9795 gnus-downloaded-mark)
9799 (gnus-summary-update-line t)
9802 (defun gnus-summary-update-mark (mark type)
9803 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
9804 (buffer-read-only nil))
9805 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
9807 (when (looking-at "\r")
9809 (when (<= (+ forward (point)) (point-max))
9810 ;; Go to the right position on the line.
9811 (goto-char (+ forward (point)))
9812 ;; Replace the old mark with the new mark.
9813 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
9814 ;; Optionally update the marks by some user rule.
9815 (when (eq type 'unread)
9817 (gnus-data-find (gnus-summary-article-number)) mark)
9818 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
9820 (defun gnus-mark-article-as-read (article &optional mark)
9821 "Enter ARTICLE in the pertinent lists and remove it from others."
9822 ;; Make the article expirable.
9823 (let ((mark (or mark gnus-del-mark)))
9824 (setq gnus-newsgroup-expirable
9825 (if (= mark gnus-expirable-mark)
9826 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
9827 (delq article gnus-newsgroup-expirable)))
9828 ;; Remove from unread and marked lists.
9829 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9830 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9831 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9832 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9833 (push (cons article mark) gnus-newsgroup-reads)
9834 ;; Possibly remove from cache, if that is used.
9835 (when gnus-use-cache
9836 (gnus-cache-enter-remove-article article))
9839 (defun gnus-mark-article-as-unread (article &optional mark)
9840 "Enter ARTICLE in the pertinent lists and remove it from others."
9841 (let ((mark (or mark gnus-ticked-mark)))
9844 (gnus-error 1 "Can't mark negative article numbers")
9846 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
9847 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
9848 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
9849 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
9850 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9852 ;; Unsuppress duplicates?
9853 (when gnus-suppress-duplicates
9854 (gnus-dup-unsuppress-article article))
9856 (cond ((= mark gnus-ticked-mark)
9857 (setq gnus-newsgroup-marked
9858 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
9859 ((= mark gnus-spam-mark)
9860 (setq gnus-newsgroup-spam-marked
9861 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9863 ((= mark gnus-dormant-mark)
9864 (setq gnus-newsgroup-dormant
9865 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
9867 (setq gnus-newsgroup-unreads
9868 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
9869 (gnus-pull article gnus-newsgroup-reads)
9872 (defalias 'gnus-summary-mark-as-unread-forward
9873 'gnus-summary-tick-article-forward)
9874 (make-obsolete 'gnus-summary-mark-as-unread-forward
9875 'gnus-summary-tick-article-forward)
9876 (defun gnus-summary-tick-article-forward (n)
9877 "Tick N articles forwards.
9878 If N is negative, tick backwards instead.
9879 The difference between N and the number of articles ticked is returned."
9881 (gnus-summary-mark-forward n gnus-ticked-mark))
9883 (defalias 'gnus-summary-mark-as-unread-backward
9884 'gnus-summary-tick-article-backward)
9885 (make-obsolete 'gnus-summary-mark-as-unread-backward
9886 'gnus-summary-tick-article-backward)
9887 (defun gnus-summary-tick-article-backward (n)
9888 "Tick N articles backwards.
9889 The difference between N and the number of articles ticked is returned."
9891 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
9893 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9894 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
9895 (defun gnus-summary-tick-article (&optional article clear-mark)
9896 "Mark current article as unread.
9897 Optional 1st argument ARTICLE specifies article number to be marked as unread.
9898 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
9900 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
9903 (defun gnus-summary-mark-as-read-forward (n)
9904 "Mark N articles as read forwards.
9905 If N is negative, mark backwards instead.
9906 The difference between N and the actual number of articles marked is
9909 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
9911 (defun gnus-summary-mark-as-read-backward (n)
9912 "Mark the N articles as read backwards.
9913 The difference between N and the actual number of articles marked is
9916 (gnus-summary-mark-forward
9917 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
9919 (defun gnus-summary-mark-as-read (&optional article mark)
9920 "Mark current article as read.
9921 ARTICLE specifies the article to be marked as read.
9922 MARK specifies a string to be inserted at the beginning of the line."
9923 (gnus-summary-mark-article article mark))
9925 (defun gnus-summary-clear-mark-forward (n)
9926 "Clear marks from N articles forward.
9927 If N is negative, clear backward instead.
9928 The difference between N and the number of marks cleared is returned."
9930 (gnus-summary-mark-forward n gnus-unread-mark))
9932 (defun gnus-summary-clear-mark-backward (n)
9933 "Clear marks from N articles backward.
9934 The difference between N and the number of marks cleared is returned."
9936 (gnus-summary-mark-forward (- n) gnus-unread-mark))
9938 (defun gnus-summary-mark-unread-as-read ()
9939 "Intended to be used by `gnus-summary-mark-article-hook'."
9940 (when (memq gnus-current-article gnus-newsgroup-unreads)
9941 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
9943 (defun gnus-summary-mark-read-and-unread-as-read ()
9944 "Intended to be used by `gnus-summary-mark-article-hook'."
9945 (let ((mark (gnus-summary-article-mark)))
9946 (when (or (gnus-unread-mark-p mark)
9947 (gnus-read-mark-p mark))
9948 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
9950 (defun gnus-summary-mark-unread-as-ticked ()
9951 "Intended to be used by `gnus-summary-mark-article-hook'."
9952 (when (memq gnus-current-article gnus-newsgroup-unreads)
9953 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
9955 (defun gnus-summary-mark-region-as-read (point mark all)
9956 "Mark all unread articles between point and mark as read.
9957 If given a prefix, mark all articles between point and mark as read,
9958 even ticked and dormant ones."
9959 (interactive "r\nP")
9968 (memq (setq article (gnus-summary-article-number))
9969 gnus-newsgroup-unreads))
9970 (gnus-summary-mark-article article gnus-del-mark))
9972 (gnus-summary-find-next))))))
9974 (defun gnus-summary-mark-below (score mark)
9975 "Mark articles with score less than SCORE with MARK."
9976 (interactive "P\ncMark: ")
9977 (setq score (if score
9978 (prefix-numeric-value score)
9979 (or gnus-summary-default-score 0)))
9981 (set-buffer gnus-summary-buffer)
9982 (goto-char (point-min))
9985 (and (< (gnus-summary-article-score) score)
9986 (gnus-summary-mark-article nil mark))
9987 (gnus-summary-find-next)))))
9989 (defun gnus-summary-kill-below (&optional score)
9990 "Mark articles with score below SCORE as read."
9992 (gnus-summary-mark-below score gnus-killed-mark))
9994 (defun gnus-summary-clear-above (&optional score)
9995 "Clear all marks from articles with score above SCORE."
9997 (gnus-summary-mark-above score gnus-unread-mark))
9999 (defun gnus-summary-tick-above (&optional score)
10000 "Tick all articles with score above SCORE."
10002 (gnus-summary-mark-above score gnus-ticked-mark))
10004 (defun gnus-summary-mark-above (score mark)
10005 "Mark articles with score over SCORE with MARK."
10006 (interactive "P\ncMark: ")
10007 (setq score (if score
10008 (prefix-numeric-value score)
10009 (or gnus-summary-default-score 0)))
10011 (set-buffer gnus-summary-buffer)
10012 (goto-char (point-min))
10014 (when (> (gnus-summary-article-score) score)
10015 (gnus-summary-mark-article nil mark))
10017 (gnus-summary-find-next)))))
10019 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10020 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10021 (defun gnus-summary-limit-include-expunged (&optional no-error)
10022 "Display all the hidden articles that were expunged for low scores."
10024 (let ((buffer-read-only nil))
10025 (let ((scored gnus-newsgroup-scored)
10028 (unless (gnus-summary-article-header (caar scored))
10029 (and (setq h (gnus-number-to-header (caar scored)))
10030 (< (cdar scored) gnus-summary-expunge-below)
10032 (setq scored (cdr scored)))
10034 (when (not no-error)
10035 (error "No expunged articles hidden"))
10036 (goto-char (point-min))
10037 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10038 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10039 (mapcar (lambda (x) (push (mail-header-number x)
10040 gnus-newsgroup-limit))
10042 (gnus-summary-prepare-unthreaded (nreverse headers))
10043 (goto-char (point-min))
10044 (gnus-summary-position-point)
10047 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10048 "Mark all unread articles in this newsgroup as read.
10049 If prefix argument ALL is non-nil, ticked and dormant articles will
10050 also be marked as read.
10051 If QUIETLY is non-nil, no questions will be asked.
10052 If TO-HERE is non-nil, it should be a point in the buffer. All
10053 articles before (after, if REVERSE is set) this point will be marked as read.
10054 Note that this function will only catch up the unread article
10055 in the current summary buffer limitation.
10056 The number of articles marked as read is returned."
10061 (not gnus-interactive-catchup) ;Without confirmation?
10065 "Mark absolutely all articles as read? "
10066 "Mark all unread articles as read? ")))
10068 (not gnus-newsgroup-adaptive)
10069 (not gnus-newsgroup-auto-expire)
10070 (not gnus-suppress-duplicates)
10071 (or (not gnus-use-cache)
10072 (eq gnus-use-cache 'passive)))
10075 (setq gnus-newsgroup-marked nil
10076 gnus-newsgroup-spam-marked nil
10077 gnus-newsgroup-dormant nil))
10078 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
10079 ;; We actually mark all articles as canceled, which we
10080 ;; have to do when using auto-expiry or adaptive scoring.
10081 (gnus-summary-show-all-threads)
10082 (if (and to-here reverse)
10084 (goto-char to-here)
10086 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10087 (gnus-summary-find-next (not all) nil nil t))))
10088 (when (gnus-summary-first-subject (not all) t)
10090 (if to-here (< (point) to-here) t)
10091 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10092 (gnus-summary-find-next (not all) nil nil t)))))
10093 (gnus-set-mode-line 'summary))
10095 (gnus-summary-position-point)))
10097 (defun gnus-summary-catchup-to-here (&optional all)
10098 "Mark all unticked articles before the current one as read.
10099 If ALL is non-nil, also mark ticked and dormant articles as read."
10102 (gnus-save-hidden-threads
10103 (let ((beg (point)))
10104 ;; We check that there are unread articles.
10105 (when (or all (gnus-summary-find-prev))
10106 (gnus-summary-catchup all t beg)))))
10107 (gnus-summary-position-point))
10109 (defun gnus-summary-catchup-from-here (&optional all)
10110 "Mark all unticked articles after the current one as read.
10111 If ALL is non-nil, also mark ticked and dormant articles as read."
10114 (gnus-save-hidden-threads
10115 (let ((beg (point)))
10116 ;; We check that there are unread articles.
10117 (when (or all (gnus-summary-find-next))
10118 (gnus-summary-catchup all t beg nil t)))))
10119 (gnus-summary-position-point))
10121 (defun gnus-summary-catchup-all (&optional quietly)
10122 "Mark all articles in this newsgroup as read.
10123 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10124 instead, which marks only unread articles as read."
10126 (gnus-summary-catchup t quietly))
10128 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10129 "Mark all unread articles in this group as read, then exit.
10130 If prefix argument ALL is non-nil, all articles are marked as read.
10131 If QUIETLY is non-nil, no questions will be asked."
10133 (when (gnus-summary-catchup all quietly nil 'fast)
10134 ;; Select next newsgroup or exit.
10135 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10136 (eq gnus-auto-select-next 'quietly))
10137 (gnus-summary-next-group nil)
10138 (gnus-summary-exit))))
10140 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10141 "Mark all articles in this newsgroup as read, and then exit.
10142 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10143 instead, which marks only unread articles as read."
10145 (gnus-summary-catchup-and-exit t quietly))
10147 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10148 "Mark all articles in this group as read and select the next group.
10149 If given a prefix, mark all articles, unread as well as ticked, as
10153 (gnus-summary-catchup all))
10154 (gnus-summary-next-group))
10160 (defmacro gnus-with-article (article &rest forms)
10161 "Select ARTICLE and perform FORMS in the original article buffer.
10162 Then replace the article with the result."
10164 ;; We don't want the article to be marked as read.
10165 (let (gnus-mark-article-hook)
10166 (gnus-summary-select-article t t nil ,article))
10167 (set-buffer gnus-original-article-buffer)
10169 (if (not (gnus-check-backend-function
10170 'request-replace-article (car gnus-article-current)))
10171 (gnus-message 5 "Read-only group; not replacing")
10172 (unless (gnus-request-replace-article
10173 ,article (car gnus-article-current)
10174 (current-buffer) t)
10175 (error "Couldn't replace article")))
10176 ;; The cache and backlog have to be flushed somewhat.
10177 (when gnus-keep-backlog
10178 (gnus-backlog-remove-article
10179 (car gnus-article-current) (cdr gnus-article-current)))
10180 (when gnus-use-cache
10181 (gnus-cache-update-article
10182 (car gnus-article-current) (cdr gnus-article-current)))))
10184 (put 'gnus-with-article 'lisp-indent-function 1)
10185 (put 'gnus-with-article 'edebug-form-spec '(form body))
10187 ;; Thread-based commands.
10189 (defun gnus-summary-articles-in-thread (&optional article)
10190 "Return a list of all articles in the current thread.
10191 If ARTICLE is non-nil, return all articles in the thread that starts
10192 with that article."
10193 (let* ((article (or article (gnus-summary-article-number)))
10194 (data (gnus-data-find-list article))
10195 (top-level (gnus-data-level (car data)))
10197 (cond ((null gnus-thread-operation-ignore-subject)
10198 (gnus-simplify-subject-re
10199 (mail-header-subject (gnus-data-header (car data)))))
10200 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10201 (gnus-simplify-subject-fuzzy
10202 (mail-header-subject (gnus-data-header (car data)))))
10204 (end-point (save-excursion
10205 (if (gnus-summary-go-to-next-thread)
10206 (point) (point-max))))
10209 (< (gnus-data-pos (car data)) end-point))
10210 (when (or (not top-subject)
10211 (string= top-subject
10212 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10213 (gnus-simplify-subject-fuzzy
10214 (mail-header-subject
10215 (gnus-data-header (car data))))
10216 (gnus-simplify-subject-re
10217 (mail-header-subject
10218 (gnus-data-header (car data)))))))
10219 (push (gnus-data-number (car data)) articles))
10220 (unless (and (setq data (cdr data))
10221 (> (gnus-data-level (car data)) top-level))
10223 ;; Return the list of articles.
10224 (nreverse articles)))
10226 (defun gnus-summary-rethread-current ()
10227 "Rethread the thread the current article is part of."
10229 (let* ((gnus-show-threads t)
10230 (article (gnus-summary-article-number))
10231 (id (mail-header-id (gnus-summary-article-header)))
10232 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10234 (error "No article on the current line"))
10235 (gnus-rebuild-thread id)
10236 (gnus-summary-goto-subject article)))
10238 (defun gnus-summary-reparent-thread ()
10239 "Make the current article child of the marked (or previous) article.
10241 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10242 is non-nil or the Subject: of both articles are the same."
10244 (unless (not (gnus-group-read-only-p))
10245 (error "The current newsgroup does not support article editing"))
10246 (unless (<= (length gnus-newsgroup-processable) 1)
10247 (error "No more than one article may be marked"))
10248 (save-window-excursion
10249 (let ((gnus-article-buffer " *reparent*")
10250 (current-article (gnus-summary-article-number))
10251 ;; First grab the marked article, otherwise one line up.
10252 (parent-article (if (not (null gnus-newsgroup-processable))
10253 (car gnus-newsgroup-processable)
10255 (if (eq (forward-line -1) 0)
10256 (gnus-summary-article-number)
10257 (error "Beginning of summary buffer"))))))
10258 (unless (not (eq current-article parent-article))
10259 (error "An article may not be self-referential"))
10260 (let ((message-id (mail-header-id
10261 (gnus-summary-article-header parent-article))))
10262 (unless (and message-id (not (equal message-id "")))
10263 (error "No message-id in desired parent"))
10264 (gnus-with-article current-article
10266 (goto-char (point-min))
10267 (message-narrow-to-head)
10268 (if (re-search-forward "^References: " nil t)
10270 (re-search-forward "^[^ \t]" nil t)
10273 (insert " " message-id))
10274 (insert "References: " message-id "\n"))))
10275 (set-buffer gnus-summary-buffer)
10276 (gnus-summary-unmark-all-processable)
10277 (gnus-summary-update-article current-article)
10278 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10279 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10280 (gnus-summary-rethread-current)
10281 (gnus-message 3 "Article %d is now the child of article %d"
10282 current-article parent-article)))))
10284 (defun gnus-summary-toggle-threads (&optional arg)
10285 "Toggle showing conversation threads.
10286 If ARG is positive number, turn showing conversation threads on."
10288 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10289 (setq gnus-show-threads
10290 (if (null arg) (not gnus-show-threads)
10291 (> (prefix-numeric-value arg) 0)))
10292 (gnus-summary-prepare)
10293 (gnus-summary-goto-subject current)
10294 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10295 (gnus-summary-position-point)))
10297 (defun gnus-summary-show-all-threads ()
10298 "Show all threads."
10301 (let ((buffer-read-only nil))
10302 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10303 (gnus-summary-position-point))
10305 (defun gnus-summary-show-thread ()
10306 "Show thread subtrees.
10307 Returns nil if no thread was there to be shown."
10309 (let ((buffer-read-only nil)
10311 ;; first goto end then to beg, to have point at beg after let
10312 (end (progn (end-of-line) (point)))
10313 (beg (progn (beginning-of-line) (point))))
10315 ;; Any hidden lines here?
10316 (search-forward "\r" end t)
10317 (subst-char-in-region beg end ?\^M ?\n t)
10319 (gnus-summary-position-point))))
10321 (defun gnus-summary-maybe-hide-threads ()
10322 "If requested, hide the threads that should be hidden."
10323 (when (and gnus-show-threads
10324 gnus-thread-hide-subtree)
10325 (gnus-summary-hide-all-threads
10326 (if (or (consp gnus-thread-hide-subtree)
10327 (gnus-functionp gnus-thread-hide-subtree))
10328 (gnus-make-predicate gnus-thread-hide-subtree)
10331 ;;; Hiding predicates.
10333 (defun gnus-article-unread-p (header)
10334 (memq (mail-header-number header) gnus-newsgroup-unreads))
10336 (defun gnus-article-unseen-p (header)
10337 (memq (mail-header-number header) gnus-newsgroup-unseen))
10339 (defun gnus-map-articles (predicate articles)
10340 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10341 (apply 'gnus-or (mapcar predicate
10342 (mapcar 'gnus-summary-article-header articles))))
10344 (defun gnus-summary-hide-all-threads (&optional predicate)
10345 "Hide all thread subtrees.
10346 If PREDICATE is supplied, threads that satisfy this predicate
10347 will not be hidden."
10350 (goto-char (point-min))
10353 (when (or (not predicate)
10355 predicate (gnus-summary-article-children)))
10356 (gnus-summary-hide-thread))
10357 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10358 (gnus-summary-position-point))
10360 (defun gnus-summary-hide-thread ()
10361 "Hide thread subtrees.
10362 If PREDICATE is supplied, threads that satisfy this predicate
10363 will not be hidden.
10364 Returns nil if no threads were there to be hidden."
10366 (let ((buffer-read-only nil)
10368 (article (gnus-summary-article-number)))
10370 ;; Go forward until either the buffer ends or the subthread
10372 (when (and (not (eobp))
10373 (or (zerop (gnus-summary-next-thread 1 t))
10374 (goto-char (point-max))))
10376 (if (and (> (point) start)
10377 (search-backward "\n" start t))
10379 (subst-char-in-region start (point) ?\n ?\^M)
10380 (gnus-summary-goto-subject article))
10384 (defun gnus-summary-go-to-next-thread (&optional previous)
10385 "Go to the same level (or less) next thread.
10386 If PREVIOUS is non-nil, go to previous thread instead.
10387 Return the article number moved to, or nil if moving was impossible."
10388 (let ((level (gnus-summary-thread-level))
10389 (way (if previous -1 1))
10392 (while (and (not (eobp))
10393 (< level (gnus-summary-thread-level)))
10394 (forward-line way))
10401 (gnus-summary-article-number)
10402 (goto-char beg)))))
10404 (defun gnus-summary-next-thread (n &optional silent)
10405 "Go to the same level next N'th thread.
10406 If N is negative, search backward instead.
10407 Returns the difference between N and the number of skips actually
10410 If SILENT, don't output messages."
10412 (let ((backward (< n 0))
10414 (while (and (> n 0)
10415 (gnus-summary-go-to-next-thread backward))
10418 (gnus-summary-position-point))
10419 (when (and (not silent) (/= 0 n))
10420 (gnus-message 7 "No more threads"))
10423 (defun gnus-summary-prev-thread (n)
10424 "Go to the same level previous N'th thread.
10425 Returns the difference between N and the number of skips actually
10428 (gnus-summary-next-thread (- n)))
10430 (defun gnus-summary-go-down-thread ()
10431 "Go down one level in the current thread."
10432 (let ((children (gnus-summary-article-children)))
10434 (gnus-summary-goto-subject (car children)))))
10436 (defun gnus-summary-go-up-thread ()
10437 "Go up one level in the current thread."
10438 (let ((parent (gnus-summary-article-parent)))
10440 (gnus-summary-goto-subject parent))))
10442 (defun gnus-summary-down-thread (n)
10443 "Go down thread N steps.
10444 If N is negative, go up instead.
10445 Returns the difference between N and how many steps down that were
10450 (while (and (> n 0)
10451 (if up (gnus-summary-go-up-thread)
10452 (gnus-summary-go-down-thread)))
10454 (gnus-summary-position-point)
10456 (gnus-message 7 "Can't go further"))
10459 (defun gnus-summary-up-thread (n)
10460 "Go up thread N steps.
10461 If N is negative, go down instead.
10462 Returns the difference between N and how many steps down that were
10465 (gnus-summary-down-thread (- n)))
10467 (defun gnus-summary-top-thread ()
10468 "Go to the top of the thread."
10470 (while (gnus-summary-go-up-thread))
10471 (gnus-summary-article-number))
10473 (defun gnus-summary-kill-thread (&optional unmark)
10474 "Mark articles under current thread as read.
10475 If the prefix argument is positive, remove any kinds of marks.
10476 If the prefix argument is negative, tick articles instead."
10479 (setq unmark (prefix-numeric-value unmark)))
10480 (let ((articles (gnus-summary-articles-in-thread)))
10482 ;; Expand the thread.
10483 (gnus-summary-show-thread)
10484 ;; Mark all the articles.
10486 (gnus-summary-goto-subject (car articles))
10487 (cond ((null unmark)
10488 (gnus-summary-mark-article-as-read gnus-killed-mark))
10490 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10492 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10493 (setq articles (cdr articles))))
10494 ;; Hide killed subtrees.
10496 gnus-thread-hide-killed
10497 (gnus-summary-hide-thread))
10498 ;; If marked as read, go to next unread subject.
10499 (when (null unmark)
10500 ;; Go to next unread subject.
10501 (gnus-summary-next-subject 1 t)))
10502 (gnus-set-mode-line 'summary))
10504 ;; Summary sorting commands
10506 (defun gnus-summary-sort-by-number (&optional reverse)
10507 "Sort the summary buffer by article number.
10508 Argument REVERSE means reverse order."
10510 (gnus-summary-sort 'number reverse))
10512 (defun gnus-summary-sort-by-random (&optional reverse)
10513 "Randomize the order in the summary buffer.
10514 Argument REVERSE means to randomize in reverse order."
10516 (gnus-summary-sort 'random reverse))
10518 (defun gnus-summary-sort-by-author (&optional reverse)
10519 "Sort the summary buffer by author name alphabetically.
10520 If `case-fold-search' is non-nil, case of letters is ignored.
10521 Argument REVERSE means reverse order."
10523 (gnus-summary-sort 'author reverse))
10525 (defun gnus-summary-sort-by-subject (&optional reverse)
10526 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10527 If `case-fold-search' is non-nil, case of letters is ignored.
10528 Argument REVERSE means reverse order."
10530 (gnus-summary-sort 'subject reverse))
10532 (defun gnus-summary-sort-by-date (&optional reverse)
10533 "Sort the summary buffer by date.
10534 Argument REVERSE means reverse order."
10536 (gnus-summary-sort 'date reverse))
10538 (defun gnus-summary-sort-by-score (&optional reverse)
10539 "Sort the summary buffer by score.
10540 Argument REVERSE means reverse order."
10542 (gnus-summary-sort 'score reverse))
10544 (defun gnus-summary-sort-by-lines (&optional reverse)
10545 "Sort the summary buffer by the number of lines.
10546 Argument REVERSE means reverse order."
10548 (gnus-summary-sort 'lines reverse))
10550 (defun gnus-summary-sort-by-chars (&optional reverse)
10551 "Sort the summary buffer by article length.
10552 Argument REVERSE means reverse order."
10554 (gnus-summary-sort 'chars reverse))
10556 (defun gnus-summary-sort-by-original (&optional reverse)
10557 "Sort the summary buffer using the default sorting method.
10558 Argument REVERSE means reverse order."
10560 (let* ((buffer-read-only)
10561 (gnus-summary-prepare-hook nil))
10562 ;; We do the sorting by regenerating the threads.
10563 (gnus-summary-prepare)
10564 ;; Hide subthreads if needed.
10565 (gnus-summary-maybe-hide-threads)))
10567 (defun gnus-summary-sort (predicate reverse)
10568 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10569 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10570 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10571 (gnus-thread-sort-functions
10576 (gnus-sort-gathered-threads-function
10577 gnus-thread-sort-functions)
10578 (gnus-article-sort-functions
10582 (,article t2 t1))))
10584 (gnus-summary-prepare-hook nil))
10585 ;; We do the sorting by regenerating the threads.
10586 (gnus-summary-prepare)
10587 ;; Hide subthreads if needed.
10588 (gnus-summary-maybe-hide-threads)))
10590 ;; Summary saving commands.
10592 (defun gnus-summary-save-article (&optional n not-saved)
10593 "Save the current article using the default saver function.
10594 If N is a positive number, save the N next articles.
10595 If N is a negative number, save the N previous articles.
10596 If N is nil and any articles have been marked with the process mark,
10597 save those articles instead.
10598 The variable `gnus-default-article-saver' specifies the saver function."
10600 (let* ((articles (gnus-summary-work-articles n))
10601 (save-buffer (save-excursion
10602 (nnheader-set-temp-buffer " *Gnus Save*")))
10603 (num (length articles))
10605 (dolist (article articles)
10606 (setq header (gnus-summary-article-header article))
10607 (if (not (vectorp header))
10608 ;; This is a pseudo-article.
10609 (if (assq 'name header)
10610 (gnus-copy-file (cdr (assq 'name header)))
10611 (gnus-message 1 "Article %d is unsaveable" article))
10612 ;; This is a real article.
10613 (save-window-excursion
10614 (let ((gnus-display-mime-function nil)
10615 (gnus-article-prepare-hook nil))
10616 (gnus-summary-select-article t nil nil article)))
10618 (set-buffer save-buffer)
10620 (insert-buffer-substring gnus-original-article-buffer))
10621 (setq file (gnus-article-save save-buffer file num))
10622 (gnus-summary-remove-process-mark article)
10624 (gnus-summary-set-saved-mark article))))
10625 (gnus-kill-buffer save-buffer)
10626 (gnus-summary-position-point)
10627 (gnus-set-mode-line 'summary)
10630 (defun gnus-summary-pipe-output (&optional arg headers)
10631 "Pipe the current article to a subprocess.
10632 If N is a positive number, pipe the N next articles.
10633 If N is a negative number, pipe the N previous articles.
10634 If N is nil and any articles have been marked with the process mark,
10635 pipe those articles instead.
10636 If HEADERS (the symbolic prefix), include the headers, too."
10637 (interactive (gnus-interactive "P\ny"))
10638 (require 'gnus-art)
10639 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10640 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10641 (gnus-summary-save-article arg t))
10642 (let ((buffer (get-buffer "*Shell Command Output*")))
10644 (not (zerop (buffer-size buffer))))
10645 (gnus-configure-windows 'pipe))))
10647 (defun gnus-summary-save-article-mail (&optional arg)
10648 "Append the current article to an mail file.
10649 If N is a positive number, save the N next articles.
10650 If N is a negative number, save the N previous articles.
10651 If N is nil and any articles have been marked with the process mark,
10652 save those articles instead."
10654 (require 'gnus-art)
10655 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10656 (gnus-summary-save-article arg)))
10658 (defun gnus-summary-save-article-rmail (&optional arg)
10659 "Append the current article to an rmail file.
10660 If N is a positive number, save the N next articles.
10661 If N is a negative number, save the N previous articles.
10662 If N is nil and any articles have been marked with the process mark,
10663 save those articles instead."
10665 (require 'gnus-art)
10666 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10667 (gnus-summary-save-article arg)))
10669 (defun gnus-summary-save-article-file (&optional arg)
10670 "Append the current article to a file.
10671 If N is a positive number, save the N next articles.
10672 If N is a negative number, save the N previous articles.
10673 If N is nil and any articles have been marked with the process mark,
10674 save those articles instead."
10676 (require 'gnus-art)
10677 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10678 (gnus-summary-save-article arg)))
10680 (defun gnus-summary-write-article-file (&optional arg)
10681 "Write the current article to a file, deleting the previous file.
10682 If N is a positive number, save the N next articles.
10683 If N is a negative number, save the N previous articles.
10684 If N is nil and any articles have been marked with the process mark,
10685 save those articles instead."
10687 (require 'gnus-art)
10688 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10689 (gnus-summary-save-article arg)))
10691 (defun gnus-summary-save-article-body-file (&optional arg)
10692 "Append the current article body to a file.
10693 If N is a positive number, save the N next articles.
10694 If N is a negative number, save the N previous articles.
10695 If N is nil and any articles have been marked with the process mark,
10696 save those articles instead."
10698 (require 'gnus-art)
10699 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10700 (gnus-summary-save-article arg)))
10702 (defun gnus-summary-muttprint (&optional arg)
10703 "Print the current article using Muttprint.
10704 If N is a positive number, save the N next articles.
10705 If N is a negative number, save the N previous articles.
10706 If N is nil and any articles have been marked with the process mark,
10707 save those articles instead."
10709 (require 'gnus-art)
10710 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10711 (gnus-summary-save-article arg t)))
10713 (defun gnus-summary-pipe-message (program)
10714 "Pipe the current article through PROGRAM."
10715 (interactive "sProgram: ")
10716 (gnus-summary-select-article)
10717 (let ((mail-header-separator ""))
10718 (gnus-eval-in-buffer-window gnus-article-buffer
10721 (let ((start (window-start))
10723 (message-pipe-buffer-body program)
10724 (set-window-start (get-buffer-window (current-buffer)) start))))))
10726 (defun gnus-get-split-value (methods)
10727 "Return a value based on the split METHODS."
10728 (let (split-name method result match)
10731 (set-buffer gnus-original-article-buffer)
10733 (nnheader-narrow-to-headers)
10734 (while (and methods (not split-name))
10735 (goto-char (point-min))
10736 (setq method (pop methods))
10737 (setq match (car method))
10740 ;; Regular expression.
10742 (re-search-forward match nil t)))
10743 ((gnus-functionp match)
10747 (setq result (funcall match gnus-newsgroup-name))))
10752 (setq result (eval match)))))
10753 (setq split-name (cdr method))
10754 (cond ((stringp result)
10755 (push (expand-file-name
10756 result gnus-article-save-directory)
10759 (setq split-name (append result split-name)))))))))
10760 (nreverse split-name)))
10762 (defun gnus-valid-move-group-p (group)
10763 (and (boundp group)
10764 (symbol-name group)
10765 (symbol-value group)
10766 (gnus-get-function (gnus-find-method-for-group
10767 (symbol-name group)) 'request-accept-article t)))
10769 (defun gnus-read-move-group-name (prompt default articles prefix)
10770 "Read a group name."
10771 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
10772 (minibuffer-confirm-incomplete nil) ; XEmacs
10774 (format "%s %s to:"
10776 (if (> (length articles) 1)
10777 (format "these %d articles" (length articles))
10782 (gnus-completing-read-with-default
10785 'gnus-valid-move-group-p
10787 'gnus-group-history))
10788 ((= 1 (length split-name))
10789 (gnus-completing-read-with-default
10790 (car split-name) prom
10792 'gnus-valid-move-group-p
10794 'gnus-group-history))
10796 (gnus-completing-read-with-default
10798 (mapcar (lambda (el) (list el))
10799 (nreverse split-name))
10801 'gnus-group-history))))
10802 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
10804 (if (or (string= to-newsgroup "")
10805 (string= to-newsgroup prefix))
10806 (setq to-newsgroup default))
10807 (unless to-newsgroup
10808 (error "No group name entered"))
10809 (or (gnus-active to-newsgroup)
10810 (gnus-activate-group to-newsgroup nil nil to-method)
10811 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
10813 (or (and (gnus-request-create-group to-newsgroup to-method)
10814 (gnus-activate-group
10815 to-newsgroup nil nil to-method)
10816 (gnus-subscribe-group to-newsgroup))
10817 (error "Couldn't create group %s" to-newsgroup)))
10818 (error "No such group: %s" to-newsgroup)))
10821 (defun gnus-summary-save-parts (type dir n &optional reverse)
10822 "Save parts matching TYPE to DIR.
10823 If REVERSE, save parts that do not match TYPE."
10825 (list (read-string "Save parts of type: "
10826 (or (car gnus-summary-save-parts-type-history)
10827 gnus-summary-save-parts-default-mime)
10828 'gnus-summary-save-parts-type-history)
10829 (setq gnus-summary-save-parts-last-directory
10830 (read-file-name "Save to directory: "
10831 gnus-summary-save-parts-last-directory
10833 current-prefix-arg))
10834 (gnus-summary-iterate n
10835 (let ((gnus-display-mime-function nil)
10836 (gnus-inhibit-treatment t))
10837 (gnus-summary-select-article))
10839 (set-buffer gnus-article-buffer)
10840 (let ((handles (or gnus-article-mime-handles
10841 (mm-dissect-buffer nil gnus-article-loose-mime)
10842 (and gnus-article-emulate-mime
10843 (mm-uu-dissect)))))
10845 (gnus-summary-save-parts-1 type dir handles reverse)
10846 (unless gnus-article-mime-handles ;; Don't destroy this case.
10847 (mm-destroy-parts handles)))))))
10849 (defun gnus-summary-save-parts-1 (type dir handle reverse)
10850 (if (stringp (car handle))
10851 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
10854 (not (string-match type (mm-handle-media-type handle)))
10855 (string-match type (mm-handle-media-type handle)))
10856 (let ((file (expand-file-name
10857 (file-name-nondirectory
10859 (mail-content-type-get
10860 (mm-handle-disposition handle) 'filename)
10861 (concat gnus-newsgroup-name
10862 "." (number-to-string
10863 (cdr gnus-article-current)))))
10865 (unless (file-exists-p file)
10866 (mm-save-part-to-file handle file))))))
10868 ;; Summary extract commands
10870 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
10871 (let ((buffer-read-only nil)
10872 (article (gnus-summary-article-number))
10874 (unless (gnus-summary-goto-subject article)
10875 (error "No such article: %d" article))
10876 (gnus-summary-position-point)
10877 ;; If all commands are to be bunched up on one line, we collect
10879 (unless gnus-view-pseudos-separately
10880 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
10883 (setq action (cdr (assq 'action (car ps))))
10884 (setq files (list (cdr (assq 'name (car ps)))))
10885 (while (and ps (cdr ps)
10886 (string= (or action "1")
10887 (or (cdr (assq 'action (cadr ps))) "2")))
10888 (push (cdr (assq 'name (cadr ps))) files)
10889 (setcdr ps (cddr ps)))
10891 (when (not (string-match "%s" action))
10894 (when (assq 'execute (car ps))
10895 (setcdr (assq 'execute (car ps))
10896 (funcall (if (string-match "%s" action)
10903 (gnus-quote-arg-for-sh-or-csh f)))
10905 (setq ps (cdr ps)))))
10906 (if (and gnus-view-pseudos (not not-view))
10908 (when (assq 'execute (car pslist))
10909 (gnus-execute-command (cdr (assq 'execute (car pslist)))
10910 (eq gnus-view-pseudos 'not-confirm)))
10911 (setq pslist (cdr pslist)))
10914 (setq after-article (or (cdr (assq 'article (car pslist)))
10915 (gnus-summary-article-number)))
10916 (gnus-summary-goto-subject after-article)
10919 (insert " " (file-name-nondirectory
10920 (cdr (assq 'name (car pslist))))
10921 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
10923 (forward-line -1) ; back to `b'
10924 (gnus-add-text-properties
10925 b (1- e) (list 'gnus-number gnus-reffed-article-number
10926 gnus-mouse-face-prop gnus-mouse-face))
10928 after-article gnus-reffed-article-number
10929 gnus-unread-mark b (car pslist) 0 (- e b))
10930 (setq gnus-newsgroup-unreads
10931 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10932 gnus-reffed-article-number))
10933 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
10934 (setq pslist (cdr pslist)))))))
10936 (defun gnus-pseudos< (p1 p2)
10937 (let ((c1 (cdr (assq 'action p1)))
10938 (c2 (cdr (assq 'action p2))))
10939 (and c1 c2 (string< c1 c2))))
10941 (defun gnus-request-pseudo-article (props)
10942 (cond ((assq 'execute props)
10943 (gnus-execute-command (cdr (assq 'execute props)))))
10944 (let ((gnus-current-article (gnus-summary-article-number)))
10945 (gnus-run-hooks 'gnus-mark-article-hook)))
10947 (defun gnus-execute-command (command &optional automatic)
10949 (gnus-article-setup-buffer)
10950 (set-buffer gnus-article-buffer)
10951 (setq buffer-read-only nil)
10952 (let ((command (if automatic command
10953 (read-string "Command: " (cons command 0)))))
10955 (insert "$ " command "\n\n")
10956 (if gnus-view-pseudo-asynchronously
10957 (start-process "gnus-execute" (current-buffer) shell-file-name
10958 shell-command-switch command)
10959 (call-process shell-file-name nil t nil
10960 shell-command-switch command)))))
10962 ;; Summary kill commands.
10964 (defun gnus-summary-edit-global-kill (article)
10965 "Edit the \"global\" kill file."
10966 (interactive (list (gnus-summary-article-number)))
10967 (gnus-group-edit-global-kill article))
10969 (defun gnus-summary-edit-local-kill ()
10970 "Edit a local kill file applied to the current newsgroup."
10972 (setq gnus-current-headers (gnus-summary-article-header))
10973 (gnus-group-edit-local-kill
10974 (gnus-summary-article-number) gnus-newsgroup-name))
10976 ;;; Header reading.
10978 (defun gnus-read-header (id &optional header)
10979 "Read the headers of article ID and enter them into the Gnus system."
10980 (let ((group gnus-newsgroup-name)
10981 (gnus-override-method
10983 gnus-override-method
10984 (and (gnus-news-group-p gnus-newsgroup-name)
10985 (car (gnus-refer-article-methods)))))
10987 ;; First we check to see whether the header in question is already
10990 ;; This is a Message-ID.
10991 (setq header (or header (gnus-id-to-header id)))
10992 ;; This is an article number.
10993 (setq header (or header (gnus-summary-article-header id))))
10995 (not (gnus-summary-article-sparse-p (mail-header-number header))))
10996 ;; We have found the header.
10998 ;; If this is a sparse article, we have to nix out its
10999 ;; previous entry in the thread hashtb.
11001 (gnus-summary-article-sparse-p (mail-header-number header)))
11002 (let* ((parent (gnus-parent-id (mail-header-references header)))
11003 (thread (and parent (gnus-id-to-thread parent))))
11005 (delq (assq header thread) thread))))
11006 ;; We have to really fetch the header to this article.
11008 (set-buffer nntp-server-buffer)
11009 (when (setq where (gnus-request-head id group))
11010 (nnheader-fold-continuation-lines)
11011 (goto-char (point-max))
11013 (goto-char (point-min))
11017 ((cdr where) (cdr where))
11018 (header (mail-header-number header))
11019 (t gnus-reffed-article-number))
11021 (insert " Article retrieved.\n"))
11022 (if (or (not where)
11023 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11024 () ; Malformed head.
11025 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11026 (when (and (stringp id)
11027 (not (string= (gnus-group-real-name group)
11029 ;; If we fetched by Message-ID and the article came
11030 ;; from a different group, we fudge some bogus article
11031 ;; numbers for this article.
11032 (mail-header-set-number header gnus-reffed-article-number))
11034 (set-buffer gnus-summary-buffer)
11035 (decf gnus-reffed-article-number)
11036 (gnus-remove-header (mail-header-number header))
11037 (push header gnus-newsgroup-headers)
11038 (setq gnus-current-headers header)
11039 (push (mail-header-number header) gnus-newsgroup-limit)))
11042 (defun gnus-remove-header (number)
11043 "Remove header NUMBER from `gnus-newsgroup-headers'."
11044 (if (and gnus-newsgroup-headers
11045 (= number (mail-header-number (car gnus-newsgroup-headers))))
11046 (pop gnus-newsgroup-headers)
11047 (let ((headers gnus-newsgroup-headers))
11048 (while (and (cdr headers)
11049 (not (= number (mail-header-number (cadr headers)))))
11051 (when (cdr headers)
11052 (setcdr headers (cddr headers))))))
11055 ;;; summary highlights
11058 (defun gnus-highlight-selected-summary ()
11059 "Highlight selected article in summary buffer."
11060 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11061 (when gnus-summary-selected-face
11063 (let* ((beg (progn (beginning-of-line) (point)))
11064 (end (progn (end-of-line) (point)))
11065 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11066 (from (if (get-text-property beg gnus-mouse-face-prop)
11068 (or (next-single-property-change
11069 beg gnus-mouse-face-prop nil end)
11074 (or (next-single-property-change
11075 from gnus-mouse-face-prop nil end)
11077 ;; If no mouse-face prop on line we will have to = from = end,
11078 ;; so we highlight the entire line instead.
11079 (when (= (+ to 2) from)
11082 (if gnus-newsgroup-selected-overlay
11083 ;; Move old overlay.
11085 gnus-newsgroup-selected-overlay from to (current-buffer))
11086 ;; Create new overlay.
11088 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11089 'face gnus-summary-selected-face))))))
11091 (defvar gnus-summary-highlight-line-cached nil)
11092 (defvar gnus-summary-highlight-line-trigger nil)
11094 (defun gnus-summary-highlight-line-0 ()
11095 (if (and (eq gnus-summary-highlight-line-trigger
11096 gnus-summary-highlight)
11097 gnus-summary-highlight-line-cached)
11098 gnus-summary-highlight-line-cached
11099 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11100 gnus-summary-highlight-line-cached
11101 (let* ((cond (list 'cond))
11103 (list gnus-summary-highlight))
11105 (setcdr c (cons (list (caar list) (list 'quote (cdar list))) nil))
11108 (gnus-byte-compile (list 'lambda nil cond))))))
11110 (defun gnus-summary-highlight-line ()
11111 "Highlight current line according to `gnus-summary-highlight'."
11112 (let* ((beg (gnus-point-at-bol))
11113 (article (or (gnus-summary-article-number) gnus-current-article))
11114 (score (or (cdr (assq article
11115 gnus-newsgroup-scored))
11116 gnus-summary-default-score 0))
11117 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11118 (inhibit-read-only t)
11119 (default gnus-summary-default-score)
11120 (default-high gnus-summary-default-high-score)
11121 (default-low gnus-summary-default-low-score)
11122 (uncached (memq article gnus-newsgroup-undownloaded))
11123 (downloaded (not uncached)))
11124 (let ((face (funcall (gnus-summary-highlight-line-0))))
11125 (unless (eq face (get-text-property beg 'face))
11126 (gnus-put-text-property-excluding-characters-with-faces
11127 beg (gnus-point-at-eol) 'face
11128 (setq face (if (boundp face) (symbol-value face) face)))
11129 (when gnus-summary-highlight-line-function
11130 (funcall gnus-summary-highlight-line-function article face))))))
11132 (defun gnus-update-read-articles (group unread &optional compute)
11133 "Update the list of read articles in GROUP.
11134 UNREAD is a sorted list."
11135 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
11136 (entry (gnus-gethash group gnus-newsrc-hashtb))
11137 (info (nth 2 entry))
11140 (if (or (not info) (not active))
11141 ;; There is no info on this group if it was, in fact,
11142 ;; killed. Gnus stores no information on killed groups, so
11143 ;; there's nothing to be done.
11144 ;; One could store the information somewhere temporarily,
11145 ;; perhaps... Hmmm...
11147 ;; Remove any negative articles numbers.
11148 (while (and unread (< (car unread) 0))
11149 (setq unread (cdr unread)))
11150 ;; Remove any expired article numbers
11151 (while (and unread (< (car unread) (car active)))
11152 (setq unread (cdr unread)))
11153 ;; Compute the ranges of read articles by looking at the list of
11154 ;; unread articles.
11156 (when (/= (car unread) prev)
11157 (push (if (= prev (1- (car unread))) prev
11158 (cons prev (1- (car unread))))
11160 (setq prev (1+ (car unread)))
11161 (setq unread (cdr unread)))
11162 (when (<= prev (cdr active))
11163 (push (cons prev (cdr active)) read))
11164 (setq read (if (> (length read) 1) (nreverse read) read))
11169 ;; Propagate the read marks to the backend.
11170 (when (gnus-check-backend-function 'request-set-mark group)
11171 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11172 (add (gnus-remove-from-range read (gnus-info-read info))))
11174 (unless (gnus-check-group group)
11175 (error "Can't open server for %s" group))
11176 (gnus-request-set-mark
11177 group (delq nil (list (if add (list add 'add '(read)))
11178 (if del (list del 'del '(read))))))
11180 `(gnus-request-set-mark
11183 (if del (list del 'add '(read)))
11184 (if add (list add 'del '(read))))))))))
11185 (set-buffer gnus-group-buffer)
11186 (gnus-undo-register
11188 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11189 (gnus-info-set-read ',info ',(gnus-info-read info))
11190 (gnus-get-unread-articles-in-group ',info
11191 (gnus-active ,group))
11192 (gnus-group-update-group ,group t)
11194 ;; Enter this list into the group info.
11195 (gnus-info-set-read info read)
11196 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11197 (gnus-get-unread-articles-in-group info (gnus-active group))
11200 (defun gnus-offer-save-summaries ()
11201 "Offer to save all active summary buffers."
11203 ;; Go through all buffers and find all summaries.
11204 (dolist (buffer (buffer-list))
11205 (when (and (setq buffer (buffer-name buffer))
11206 (string-match "Summary" buffer)
11208 (set-buffer buffer)
11209 ;; We check that this is, indeed, a summary buffer.
11210 (and (eq major-mode 'gnus-summary-mode)
11211 ;; Also make sure this isn't bogus.
11212 gnus-newsgroup-prepared
11213 ;; Also make sure that this isn't a
11214 ;; dead summary buffer.
11215 (not gnus-dead-summary-mode))))
11216 (push buffer buffers)))
11217 ;; Go through all these summary buffers and offer to save them.
11221 "Update summary buffer %s? "
11223 (switch-to-buffer buf)
11224 (gnus-summary-exit))
11228 ;;; @ for mime-partial
11231 (defun gnus-request-partial-message ()
11233 (let ((number (gnus-summary-article-number))
11234 (group gnus-newsgroup-name)
11235 (mother gnus-article-buffer))
11236 (set-buffer (get-buffer-create " *Partial Article*"))
11238 (setq mime-preview-buffer mother)
11239 (gnus-request-article-this-buffer number group)
11240 (mime-parse-buffer)
11243 (autoload 'mime-combine-message/partial-pieces-automatically
11245 "Internal method to combine message/partial messages automatically.")
11247 (mime-add-condition
11248 'action '((type . message)(subtype . partial)
11249 (major-mode . gnus-original-article-mode)
11250 (method . mime-combine-message/partial-pieces-automatically)
11251 (summary-buffer-exp . gnus-summary-buffer)
11252 (request-partial-message-method . gnus-request-partial-message)
11256 ;;; @ for message/rfc822
11259 (defun gnus-mime-extract-message/rfc822 (entity situation)
11260 "Burst a forwarded article."
11262 (set-buffer gnus-summary-buffer)
11263 (let* ((group (completing-read "Group: " gnus-active-hashtb nil t
11264 gnus-newsgroup-name 'gnus-group-history))
11265 (gnus-group-marked (list group))
11268 (mime-insert-entity-content entity)
11269 (setq article (gnus-request-accept-article group)))
11270 (when (and (consp article)
11271 (numberp (setq article (cdr article))))
11272 (setq info (gnus-get-info group))
11273 (gnus-info-set-read info
11274 (gnus-remove-from-range (gnus-info-read info)
11276 (when (string-equal group gnus-newsgroup-name)
11278 (let (gnus-show-threads)
11279 (gnus-summary-goto-subject article t))
11280 (gnus-summary-clear-mark-forward 1))
11281 (set-buffer gnus-group-buffer)
11282 (gnus-group-get-new-news-this-group nil t)))))
11284 (mime-add-condition
11285 'action '((type . message)(subtype . rfc822)
11286 (major-mode . gnus-original-article-mode)
11287 (method . gnus-mime-extract-message/rfc822)
11291 (mime-add-condition
11292 'action '((type . message)(subtype . news)
11293 (major-mode . gnus-original-article-mode)
11294 (method . gnus-mime-extract-message/rfc822)
11298 (defun gnus-mime-extract-multipart (entity situation)
11299 (let ((children (mime-entity-children entity))
11300 mime-acting-situation-to-override
11303 (mime-play-entity (car children)
11304 (cons (assq 'mode situation)
11305 mime-acting-situation-to-override))
11306 (setq children (cdr children)))
11307 (if (setq f (cdr (assq 'after-method
11308 mime-acting-situation-to-override)))
11312 (mime-add-condition
11313 'action '((type . multipart)
11314 (method . gnus-mime-extract-multipart)
11323 (defun gnus-summary-inherit-default-charset ()
11324 "Import `default-mime-charset' from summary buffer.
11325 Also take care of `default-mime-charset-unlimited' if the LIMIT version
11327 (if (buffer-live-p gnus-summary-buffer)
11328 (let (d-m-c d-m-c-u)
11329 (with-current-buffer gnus-summary-buffer
11330 (setq d-m-c (if (local-variable-p 'default-mime-charset
11331 gnus-summary-buffer)
11332 default-mime-charset
11335 d-m-c-u (if (local-variable-p 'default-mime-charset-unlimited
11336 gnus-summary-buffer)
11337 (symbol-value 'default-mime-charset-unlimited)
11340 (kill-local-variable 'default-mime-charset)
11341 (set (make-local-variable 'default-mime-charset) d-m-c))
11343 (kill-local-variable 'default-mime-charset-unlimited)
11344 (set (make-local-variable 'default-mime-charset-unlimited)
11347 (defun gnus-summary-setup-default-charset ()
11348 "Setup newsgroup default charset."
11349 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11351 (setq gnus-newsgroup-charset nil)
11352 (set (make-local-variable 'default-mime-charset) nil)
11353 (when (boundp 'default-mime-charset-unlimited);; LIMIT
11354 (set (make-local-variable 'default-mime-charset-unlimited) nil)))
11355 (let ((ignored-charsets
11356 (or gnus-newsgroup-ephemeral-ignored-charsets
11358 (and gnus-newsgroup-name
11359 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11360 gnus-newsgroup-ignored-charsets)))
11362 (setq gnus-newsgroup-charset
11363 (or gnus-newsgroup-ephemeral-charset
11364 (when (and gnus-newsgroup-name
11365 (setq charset (gnus-parameter-charset
11366 gnus-newsgroup-name)))
11367 (make-local-variable 'default-mime-charset)
11368 (setq default-mime-charset charset))
11369 gnus-default-charset))
11370 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11371 ignored-charsets))))
11377 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11378 "Display the current article buffer fully MIME-buttonized.
11379 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11380 treated as multipart/mixed."
11382 (require 'gnus-art)
11383 (let ((gnus-unbuttonized-mime-types nil)
11384 (gnus-mime-display-multipart-as-mixed show-all-parts))
11385 (gnus-summary-show-article)))
11387 (defun gnus-summary-repair-multipart (article)
11388 "Add a Content-Type header to a multipart article without one."
11389 (interactive (list (gnus-summary-article-number)))
11390 (gnus-with-article article
11391 (message-narrow-to-head)
11392 (message-remove-header "Mime-Version")
11393 (goto-char (point-max))
11394 (insert "Mime-Version: 1.0\n")
11396 (when (search-forward "\n--" nil t)
11397 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
11398 (message-narrow-to-head)
11399 (message-remove-header "Content-Type")
11400 (goto-char (point-max))
11401 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11404 (let (gnus-mark-article-hook)
11405 (gnus-summary-select-article t t nil article)))
11407 (defun gnus-summary-toggle-display-buttonized ()
11408 "Toggle the buttonizing of the article buffer."
11410 (require 'gnus-art)
11411 (if (setq gnus-inhibit-mime-unbuttonizing
11412 (not gnus-inhibit-mime-unbuttonizing))
11413 (let ((gnus-unbuttonized-mime-types nil))
11414 (gnus-summary-show-article))
11415 (gnus-summary-show-article)))
11418 ;;; Intelli-mouse commmands
11421 (defun gnus-wheel-summary-scroll (event)
11423 (let ((amount (if (memq 'shift (event-modifiers event))
11424 (car gnus-wheel-scroll-amount)
11425 (cdr gnus-wheel-scroll-amount)))
11426 (direction (- (* (static-if (featurep 'xemacs)
11427 (event-button event)
11428 (cond ((eq 'mouse-4 (event-basic-type event))
11430 ((eq 'mouse-5 (event-basic-type event))
11434 (gnus-summary-scroll-up (* amount direction))
11435 (when (gnus-eval-in-buffer-window gnus-article-buffer
11438 (and (if (< 0 direction)
11439 (gnus-article-next-page 0)
11440 (gnus-article-prev-page 0)
11442 (if (setq edge (get-text-property
11443 (point-min) 'gnus-wheel-edge))
11444 (setq edge (* edge direction))
11447 (let ((buffer-read-only nil)
11448 (inhibit-read-only t))
11449 (put-text-property (point-min) (point-max)
11450 'gnus-wheel-edge direction)
11452 (or (> edge gnus-wheel-edge-resistance)
11453 (let ((buffer-read-only nil)
11454 (inhibit-read-only t))
11455 (put-text-property (point-min) (point-max)
11457 (* (1+ edge) direction))
11459 (eq last-command 'gnus-wheel-summary-scroll))))
11460 (gnus-summary-next-article nil nil (minusp direction)))))
11462 (defun gnus-wheel-install ()
11463 "Enable mouse wheel support on summary window."
11464 (when gnus-use-wheel
11466 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
11468 (define-key gnus-summary-mode-map key
11469 'gnus-wheel-summary-scroll)))))
11471 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
11474 ;;; Traditional PGP commmands
11477 (defun gnus-summary-decrypt-article (&optional force)
11478 "Decrypt the current article in traditional PGP way.
11479 This will have permanent effect only in mail groups.
11480 If FORCE is non-nil, allow editing of articles even in read-only
11483 (gnus-summary-select-article t)
11484 (gnus-eval-in-buffer-window gnus-article-buffer
11488 (goto-char (point-min))
11489 (unless (re-search-forward (car pgg-armor-header-lines) nil t)
11490 (error "Not a traditional PGP message!"))
11491 (let ((armor-start (match-beginning 0)))
11492 (if (and (pgg-decrypt-region armor-start (point-max))
11493 (or force (not (gnus-group-read-only-p))))
11494 (let ((inhibit-read-only t)
11496 (delete-region armor-start
11498 (re-search-forward "^-+END PGP" nil t)
11499 (beginning-of-line 2)
11501 (insert-buffer-substring pgg-output-buffer))))))))
11503 (defun gnus-summary-verify-article ()
11504 "Verify the current article in traditional PGP way."
11507 (set-buffer gnus-original-article-buffer)
11508 (goto-char (point-min))
11509 (unless (re-search-forward "^-+BEGIN PGP SIGNED MESSAGE" nil t)
11510 (error "Not a traditional PGP message!"))
11511 (re-search-forward "^-+END PGP" nil t)
11512 (beginning-of-line 2)
11513 (call-interactively (function pgg-verify-region))))
11516 ;;; Generic summary marking commands
11519 (defvar gnus-summary-marking-alist
11520 '((read gnus-del-mark "d")
11521 (unread gnus-unread-mark "u")
11522 (ticked gnus-ticked-mark "!")
11523 (dormant gnus-dormant-mark "?")
11524 (expirable gnus-expirable-mark "e"))
11525 "An alist of names/marks/keystrokes.")
11527 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11528 (defvar gnus-summary-mark-map)
11530 (defun gnus-summary-make-all-marking-commands ()
11531 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11532 (dolist (elem gnus-summary-marking-alist)
11533 (apply 'gnus-summary-make-marking-command elem)))
11535 (defun gnus-summary-make-marking-command (name mark keystroke)
11536 (let ((map (make-sparse-keymap)))
11537 (define-key gnus-summary-generic-mark-map keystroke map)
11538 (dolist (lway `((next "next" next nil "n")
11539 (next-unread "next unread" next t "N")
11540 (prev "previous" prev nil "p")
11541 (prev-unread "previous unread" prev t "P")
11542 (nomove "" nil nil ,keystroke)))
11543 (let ((func (gnus-summary-make-marking-command-1
11544 mark (car lway) lway name)))
11545 (setq func (eval func))
11546 (define-key map (nth 4 lway) func)))))
11548 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11550 (format "gnus-summary-put-mark-as-%s%s"
11551 name (if (eq way 'nomove)
11553 (concat "-" (symbol-name way)))))
11556 "Mark the current article as %s%s.
11557 If N, the prefix, then repeat N times.
11558 If N is negative, move in reverse order.
11559 The difference between N and the actual number of articles marked is
11561 name (car (cdr lway)))
11563 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11565 (defun gnus-summary-generic-mark (n mark move unread)
11566 "Mark N articles with MARK."
11567 (unless (eq major-mode 'gnus-summary-mode)
11568 (error "This command can only be used in the summary buffer"))
11569 (gnus-summary-show-thread)
11572 ((eq move 'next) 1)
11573 ((eq move 'prev) -1)
11575 (if (zerop nummove)
11579 nummove (* -1 nummove))))
11580 (while (and (> n 0)
11581 (gnus-summary-mark-article nil mark)
11582 (zerop (gnus-summary-next-subject nummove unread t)))
11585 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11586 (gnus-summary-recenter)
11587 (gnus-summary-position-point)
11588 (gnus-set-mode-line 'summary)
11591 (defun gnus-summary-insert-articles (articles)
11592 (when (setq articles
11593 (gnus-sorted-difference articles
11594 (mapcar (lambda (h)
11595 (mail-header-number h))
11596 gnus-newsgroup-headers)))
11597 (setq gnus-newsgroup-headers
11599 gnus-newsgroup-headers
11600 (gnus-fetch-headers articles)
11601 'gnus-article-sort-by-number))
11602 ;; Suppress duplicates?
11603 (when gnus-suppress-duplicates
11604 (gnus-dup-suppress-articles))
11606 ;; We might want to build some more threads first.
11607 (when (and gnus-fetch-old-headers
11608 (eq gnus-headers-retrieved-by 'nov))
11609 (if (eq gnus-fetch-old-headers 'invisible)
11610 (gnus-build-all-threads)
11611 (gnus-build-old-threads)))
11612 ;; Let the Gnus agent mark articles as read.
11614 (gnus-agent-get-undownloaded-list))
11615 ;; Remove list identifiers from subject
11616 (when gnus-list-identifiers
11617 (gnus-summary-remove-list-identifiers))
11618 ;; First and last article in this newsgroup.
11619 (when gnus-newsgroup-headers
11620 (setq gnus-newsgroup-begin
11621 (mail-header-number (car gnus-newsgroup-headers))
11623 (mail-header-number
11624 (gnus-last-element gnus-newsgroup-headers))))
11625 (when gnus-use-scoring
11626 (gnus-possibly-score-headers))))
11628 (defun gnus-summary-insert-old-articles (&optional all)
11629 "Insert all old articles in this group.
11630 If ALL is non-nil, already read articles become readable.
11631 If ALL is a number, fetch this number of articles."
11634 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11637 ;; Some nntp servers lie about their active range. When
11638 ;; this happens, the active range can be in the millions.
11639 ;; Use a compressed range to avoid creating a huge list.
11640 (gnus-range-difference (list gnus-newsgroup-active) old))
11641 (setq len (gnus-range-length older))
11646 (let ((older-range (nreverse older)))
11650 (let* ((r (pop older-range))
11651 (min (if (numberp r) r (car r)))
11652 (max (if (numberp r) r (cdr r))))
11653 (while (and (<= min max)
11658 (setq older (gnus-uncompress-range older))))
11660 (setq older (gnus-uncompress-range older)))
11662 (when (and (numberp gnus-large-newsgroup)
11663 (> len gnus-large-newsgroup))
11664 (let* ((cursor-in-echo-area nil)
11665 (initial (gnus-parameter-large-newsgroup-initial
11666 gnus-newsgroup-name))
11670 "How many articles from %s (%s %d): "
11672 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11673 (if initial "max" "default")
11676 (cons (number-to-string initial)
11678 (unless (string-match "^[ \t]*$" input)
11679 (setq all (string-to-number input))
11681 (let ((older-range (nreverse older)))
11685 (let* ((r (pop older-range))
11686 (min (if (numberp r) r (car r)))
11687 (max (if (numberp r) r (cdr r))))
11688 (while (and (<= min max)
11692 max (1- max))))))))))
11693 (setq older (gnus-uncompress-range older))))
11695 (message "No old news.")
11696 (gnus-summary-insert-articles older)
11697 (gnus-summary-limit (gnus-sorted-nunion old older))))
11698 (gnus-summary-position-point)))
11700 (defun gnus-summary-insert-new-articles ()
11701 "Insert all new articles in this group."
11704 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11705 (old-active gnus-newsgroup-active)
11706 (nnmail-fetched-sources (list t))
11708 (setq gnus-newsgroup-active
11709 (gnus-activate-group gnus-newsgroup-name 'scan))
11710 (setq i (cdr gnus-newsgroup-active))
11711 (while (> i (cdr old-active))
11715 (message "No gnus is bad news.")
11716 (gnus-summary-insert-articles new)
11717 (setq gnus-newsgroup-unreads
11718 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11719 (gnus-summary-limit (gnus-sorted-nunion old new))))
11720 (gnus-summary-position-point)))
11722 (gnus-summary-make-all-marking-commands)
11724 (gnus-ems-redefine)
11726 (provide 'gnus-sum)
11728 (run-hooks 'gnus-sum-load-hook)
11730 ;;; gnus-sum.el ends here