1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (defvar tool-bar-map))
43 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44 (autoload 'gnus-cache-write-active "gnus-cache")
45 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
46 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
47 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
48 (autoload 'mm-uu-dissect "mm-uu")
49 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
50 "Deuglify broken Outlook (Express) articles and redisplay."
52 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
53 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
54 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
56 (defcustom gnus-kill-summary-on-exit t
57 "*If non-nil, kill the summary buffer when you exit from it.
58 If nil, the summary will become a \"*Dead Summary*\" buffer, and
59 it will be killed sometime later."
60 :group 'gnus-summary-exit
63 (defcustom gnus-fetch-old-headers nil
64 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
65 If an unread article in the group refers to an older, already read (or
66 just marked as read) article, the old article will not normally be
67 displayed in the Summary buffer. If this variable is non-nil, Gnus
68 will attempt to grab the headers to the old articles, and thereby
69 build complete threads. If it has the value `some', only enough
70 headers to connect otherwise loose threads will be displayed. This
71 variable can also be a number. In that case, no more than that number
72 of old headers will be fetched. If it has the value `invisible', all
73 old headers will be fetched, but none will be displayed.
75 The server has to support NOV for any of this to work."
77 :type '(choice (const :tag "off" nil)
80 (sexp :menu-tag "other" t)))
82 (defcustom gnus-refer-thread-limit 200
83 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
84 If t, fetch all the available old headers."
87 (sexp :menu-tag "other" t)))
89 (defcustom gnus-summary-make-false-root 'adopt
90 "*nil means that Gnus won't gather loose threads.
91 If the root of a thread has expired or been read in a previous
92 session, the information necessary to build a complete thread has been
93 lost. Instead of having many small sub-threads from this original thread
94 scattered all over the summary buffer, Gnus can gather them.
96 If non-nil, Gnus will try to gather all loose sub-threads from an
97 original thread into one large thread.
99 If this variable is non-nil, it should be one of `none', `adopt',
102 If this variable is `none', Gnus will not make a false root, but just
103 present the sub-threads after another.
104 If this variable is `dummy', Gnus will create a dummy root that will
105 have all the sub-threads as children.
106 If this variable is `adopt', Gnus will make one of the \"children\"
107 the parent and mark all the step-children as such.
108 If this variable is `empty', the \"children\" are printed with empty
109 subject fields. (Or rather, they will be printed with a string
110 given by the `gnus-summary-same-subject' variable.)"
112 :type '(choice (const :tag "off" nil)
118 (defcustom gnus-summary-make-false-root-always nil
119 "Always make a false dummy root."
123 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
124 "*A regexp to match subjects to be excluded from loose thread gathering.
125 As loose thread gathering is done on subjects only, that means that
126 there can be many false gatherings performed. By rooting out certain
127 common subjects, gathering might become saner."
131 (defcustom gnus-summary-gather-subject-limit nil
132 "*Maximum length of subject comparisons when gathering loose threads.
133 Use nil to compare full subjects. Setting this variable to a low
134 number will help gather threads that have been corrupted by
135 newsreaders chopping off subject lines, but it might also mean that
136 unrelated articles that have subject that happen to begin with the
137 same few characters will be incorrectly gathered.
139 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
142 :type '(choice (const :tag "off" nil)
144 (sexp :menu-tag "on" t)))
146 (defcustom gnus-simplify-subject-functions nil
147 "List of functions taking a string argument that simplify subjects.
148 The functions are applied recursively.
150 Useful functions to put in this list include:
151 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
152 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
154 :type '(repeat function))
156 (defcustom gnus-simplify-ignored-prefixes nil
157 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
159 :type '(choice (const :tag "off" nil)
162 (defcustom gnus-build-sparse-threads nil
163 "*If non-nil, fill in the gaps in threads.
164 If `some', only fill in the gaps that are needed to tie loose threads
165 together. If `more', fill in all leaf nodes that Gnus can find. If
166 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
168 :type '(choice (const :tag "off" nil)
171 (sexp :menu-tag "all" t)))
173 (defcustom gnus-summary-thread-gathering-function
174 'gnus-gather-threads-by-subject
175 "*Function used for gathering loose threads.
176 There are two pre-defined functions: `gnus-gather-threads-by-subject',
177 which only takes Subjects into consideration; and
178 `gnus-gather-threads-by-references', which compared the References
179 headers of the articles to find matches."
181 :type '(radio (function-item gnus-gather-threads-by-subject)
182 (function-item gnus-gather-threads-by-references)
183 (function :tag "other")))
185 (defcustom gnus-summary-same-subject ""
186 "*String indicating that the current article has the same subject as the previous.
187 This variable will only be used if the value of
188 `gnus-summary-make-false-root' is `empty'."
189 :group 'gnus-summary-format
192 (defcustom gnus-summary-goto-unread t
193 "*If t, many commands will go to the next unread article.
194 This applies to marking commands as well as other commands that
195 \"naturally\" select the next article, like, for instance, `SPC' at
196 the end of an article.
198 If nil, the marking commands do NOT go to the next unread article
199 \(they go to the next article instead). If `never', commands that
200 usually go to the next unread article, will go to the next article,
201 whether it is read or not."
202 :group 'gnus-summary-marks
203 :link '(custom-manual "(gnus)Setting Marks")
204 :type '(choice (const :tag "off" nil)
206 (sexp :menu-tag "on" t)))
208 (defcustom gnus-summary-default-score 0
209 "*Default article score level.
210 All scores generated by the score files will be added to this score.
211 If this variable is nil, scoring will be disabled."
212 :group 'gnus-score-default
213 :type '(choice (const :tag "disable")
216 (defcustom gnus-summary-default-high-score 0
217 "*Default threshold for a high scored article.
218 An article will be highlighted as high scored if its score is greater
220 :group 'gnus-score-default
223 (defcustom gnus-summary-default-low-score 0
224 "*Default threshold for a low scored article.
225 An article will be highlighted as low scored if its score is smaller
227 :group 'gnus-score-default
230 (defcustom gnus-summary-zcore-fuzz 0
231 "*Fuzziness factor for the zcore in the summary buffer.
232 Articles with scores closer than this to `gnus-summary-default-score'
234 :group 'gnus-summary-format
237 (defcustom gnus-simplify-subject-fuzzy-regexp nil
238 "*Strings to be removed when doing fuzzy matches.
239 This can either be a regular expression or list of regular expressions
240 that will be removed from subject strings if fuzzy subject
241 simplification is selected."
243 :type '(repeat regexp))
245 (defcustom gnus-show-threads t
246 "*If non-nil, display threads in summary mode."
250 (defcustom gnus-thread-hide-subtree nil
251 "*If non-nil, hide all threads initially.
252 This can be a predicate specifier which says which threads to hide.
253 If threads are hidden, you have to run the command
254 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
255 to expose hidden threads."
257 :type '(radio (sexp :format "Non-nil\n"
258 :match (lambda (widget value)
259 (not (or (consp value) (functionp value))))
262 (sexp :tag "Predicate specifier" :size 0)))
264 (defcustom gnus-thread-hide-killed t
265 "*If non-nil, hide killed threads automatically."
269 (defcustom gnus-thread-ignore-subject t
270 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
271 If nil, articles that have different subjects from their parents will
272 start separate threads."
276 (defcustom gnus-thread-operation-ignore-subject t
277 "*If non-nil, subjects will be ignored when doing thread commands.
278 This affects commands like `gnus-summary-kill-thread' and
279 `gnus-summary-lower-thread'.
281 If this variable is nil, articles in the same thread with different
282 subjects will not be included in the operation in question. If this
283 variable is `fuzzy', only articles that have subjects that are fuzzily
284 equal will be included."
286 :type '(choice (const :tag "off" nil)
290 (defcustom gnus-thread-indent-level 4
291 "*Number that says how much each sub-thread should be indented."
295 (defcustom gnus-auto-extend-newsgroup t
296 "*If non-nil, extend newsgroup forward and backward when requested."
297 :group 'gnus-summary-choose
300 (defcustom gnus-auto-select-first t
301 "*If non-nil, select the article under point.
302 Which article this is is controlled by the `gnus-auto-select-subject'
305 If you want to prevent automatic selection of articles in some
306 newsgroups, set the variable to nil in `gnus-select-group-hook'."
307 :group 'gnus-group-select
308 :type '(choice (const :tag "none" nil)
309 (sexp :menu-tag "first" t)))
311 (defcustom gnus-auto-select-subject 'unread
312 "*Says what subject to place under point when entering a group.
314 This variable can either be the symbols `first' (place point on the
315 first subject), `unread' (place point on the subject line of the first
316 unread article), `best' (place point on the subject line of the
317 higest-scored article), `unseen' (place point on the subject line of
318 the first unseen article), 'unseen-or-unread' (place point on the subject
319 line of the first unseen article or, if all article have been seen, on the
320 subject line of the first unread article), or a function to be called to
321 place point on some subject line."
322 :group 'gnus-group-select
323 :type '(choice (const best)
327 (const unseen-or-unread)))
329 (defcustom gnus-auto-select-next t
330 "*If non-nil, offer to go to the next group from the end of the previous.
331 If the value is t and the next newsgroup is empty, Gnus will exit
332 summary mode and go back to group mode. If the value is neither nil
333 nor t, Gnus will select the following unread newsgroup. In
334 particular, if the value is the symbol `quietly', the next unread
335 newsgroup will be selected without any confirmation, and if it is
336 `almost-quietly', the next group will be selected without any
337 confirmation if you are located on the last article in the group.
338 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
339 will go to the next group without confirmation."
340 :group 'gnus-summary-maneuvering
341 :type '(choice (const :tag "off" nil)
343 (const almost-quietly)
344 (const slightly-quietly)
345 (sexp :menu-tag "on" t)))
347 (defcustom gnus-auto-select-same nil
348 "*If non-nil, select the next article with the same subject.
349 If there are no more articles with the same subject, go to
350 the first unread article."
351 :group 'gnus-summary-maneuvering
354 (defcustom gnus-auto-goto-ignores 'unfetched
355 "*Says how to handle unfetched articles when maneuvering.
357 This variable can either be the symbols nil (maneuver to any
358 article), `undownloaded' (maneuvering while unplugged ignores articles
359 that have not been fetched), `always-undownloaded' (maneuvering always
360 ignores articles that have not been fetched), `unfetched' (maneuvering
361 ignores articles whose headers have not been fetched).
363 NOTE: The list of unfetched articles will always be nil when plugged
364 and, when unplugged, a subset of the undownloaded article list."
365 :group 'gnus-summary-maneuvering
366 :type '(choice (const :tag "None" nil)
367 (const :tag "Undownloaded when unplugged" undownloaded)
368 (const :tag "Undownloaded" always-undownloaded)
369 (const :tag "Unfetched" unfetched)))
371 (defcustom gnus-summary-check-current nil
372 "*If non-nil, consider the current article when moving.
373 The \"unread\" movement commands will stay on the same line if the
374 current article is unread."
375 :group 'gnus-summary-maneuvering
378 (defcustom gnus-auto-center-summary t
379 "*If non-nil, always center the current summary buffer.
380 In particular, if `vertical' do only vertical recentering. If non-nil
381 and non-`vertical', do both horizontal and vertical recentering."
382 :group 'gnus-summary-maneuvering
383 :type '(choice (const :tag "none" nil)
385 (integer :tag "height")
386 (sexp :menu-tag "both" t)))
388 (defvar gnus-auto-center-group t
389 "*If non-nil, always center the group buffer.")
391 (defcustom gnus-show-all-headers nil
392 "*If non-nil, don't hide any headers."
393 :group 'gnus-article-hiding
394 :group 'gnus-article-headers
397 (defcustom gnus-summary-ignore-duplicates nil
398 "*If non-nil, ignore articles with identical Message-ID headers."
402 (defcustom gnus-single-article-buffer t
403 "*If non-nil, display all articles in the same buffer.
404 If nil, each group will get its own article buffer."
405 :group 'gnus-article-various
408 (defcustom gnus-break-pages t
409 "*If non-nil, do page breaking on articles.
410 The page delimiter is specified by the `gnus-page-delimiter'
412 :group 'gnus-article-various
415 (defcustom gnus-move-split-methods nil
416 "*Variable used to suggest where articles are to be moved to.
417 It uses the same syntax as the `gnus-split-methods' variable.
418 However, whereas `gnus-split-methods' specifies file names as targets,
419 this variable specifies group names."
420 :group 'gnus-summary-mail
421 :type '(repeat (choice (list :value (fun) function)
422 (cons :value ("" "") regexp (repeat string))
425 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
426 "Function used to compute default prefix for article move/copy/etc prompts.
427 The function should take one argument, a group name, and return a
428 string with the suggested prefix."
429 :group 'gnus-summary-mail
432 (defcustom gnus-unread-mark ? ;Whitespace
433 "*Mark used for unread articles."
434 :group 'gnus-summary-marks
437 (defcustom gnus-ticked-mark ?!
438 "*Mark used for ticked articles."
439 :group 'gnus-summary-marks
442 (defcustom gnus-dormant-mark ??
443 "*Mark used for dormant articles."
444 :group 'gnus-summary-marks
447 (defcustom gnus-del-mark ?r
448 "*Mark used for del'd articles."
449 :group 'gnus-summary-marks
452 (defcustom gnus-read-mark ?R
453 "*Mark used for read articles."
454 :group 'gnus-summary-marks
457 (defcustom gnus-expirable-mark ?E
458 "*Mark used for expirable articles."
459 :group 'gnus-summary-marks
462 (defcustom gnus-killed-mark ?K
463 "*Mark used for killed articles."
464 :group 'gnus-summary-marks
467 (defcustom gnus-spam-mark ?$
468 "*Mark used for spam articles."
469 :group 'gnus-summary-marks
472 (defcustom gnus-souped-mark ?F
473 "*Mark used for souped articles."
474 :group 'gnus-summary-marks
477 (defcustom gnus-kill-file-mark ?X
478 "*Mark used for articles killed by kill files."
479 :group 'gnus-summary-marks
482 (defcustom gnus-low-score-mark ?Y
483 "*Mark used for articles with a low score."
484 :group 'gnus-summary-marks
487 (defcustom gnus-catchup-mark ?C
488 "*Mark used for articles that are caught up."
489 :group 'gnus-summary-marks
492 (defcustom gnus-replied-mark ?A
493 "*Mark used for articles that have been replied to."
494 :group 'gnus-summary-marks
497 (defcustom gnus-forwarded-mark ?F
498 "*Mark used for articles that have been forwarded."
499 :group 'gnus-summary-marks
502 (defcustom gnus-recent-mark ?N
503 "*Mark used for articles that are recent."
504 :group 'gnus-summary-marks
507 (defcustom gnus-cached-mark ?*
508 "*Mark used for articles that are in the cache."
509 :group 'gnus-summary-marks
512 (defcustom gnus-saved-mark ?S
513 "*Mark used for articles that have been saved."
514 :group 'gnus-summary-marks
517 (defcustom gnus-unseen-mark ?.
518 "*Mark used for articles that haven't been seen."
519 :group 'gnus-summary-marks
522 (defcustom gnus-no-mark ? ;Whitespace
523 "*Mark used for articles that have no other secondary mark."
524 :group 'gnus-summary-marks
527 (defcustom gnus-ancient-mark ?O
528 "*Mark used for ancient articles."
529 :group 'gnus-summary-marks
532 (defcustom gnus-sparse-mark ?Q
533 "*Mark used for sparsely reffed articles."
534 :group 'gnus-summary-marks
537 (defcustom gnus-canceled-mark ?G
538 "*Mark used for canceled articles."
539 :group 'gnus-summary-marks
542 (defcustom gnus-duplicate-mark ?M
543 "*Mark used for duplicate articles."
544 :group 'gnus-summary-marks
547 (defcustom gnus-undownloaded-mark ?-
548 "*Mark used for articles that weren't downloaded."
549 :group 'gnus-summary-marks
552 (defcustom gnus-downloaded-mark ?+
553 "*Mark used for articles that were downloaded."
554 :group 'gnus-summary-marks
557 (defcustom gnus-downloadable-mark ?%
558 "*Mark used for articles that are to be downloaded."
559 :group 'gnus-summary-marks
562 (defcustom gnus-unsendable-mark ?=
563 "*Mark used for articles that won't be sent."
564 :group 'gnus-summary-marks
567 (defcustom gnus-score-over-mark ?+
568 "*Score mark used for articles with high scores."
569 :group 'gnus-summary-marks
572 (defcustom gnus-score-below-mark ?-
573 "*Score mark used for articles with low scores."
574 :group 'gnus-summary-marks
577 (defcustom gnus-empty-thread-mark ? ;Whitespace
578 "*There is no thread under the article."
579 :group 'gnus-summary-marks
582 (defcustom gnus-not-empty-thread-mark ?=
583 "*There is a thread under the article."
584 :group 'gnus-summary-marks
587 (defcustom gnus-view-pseudo-asynchronously nil
588 "*If non-nil, Gnus will view pseudo-articles asynchronously."
589 :group 'gnus-extract-view
592 (defcustom gnus-auto-expirable-marks
593 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
594 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
595 gnus-souped-mark gnus-duplicate-mark)
596 "*The list of marks converted into expiration if a group is auto-expirable."
599 :type '(repeat character))
601 (defcustom gnus-inhibit-user-auto-expire t
602 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
607 (defcustom gnus-view-pseudos nil
608 "*If `automatic', pseudo-articles will be viewed automatically.
609 If `not-confirm', pseudos will be viewed automatically, and the user
610 will not be asked to confirm the command."
611 :group 'gnus-extract-view
612 :type '(choice (const :tag "off" nil)
614 (const not-confirm)))
616 (defcustom gnus-view-pseudos-separately t
617 "*If non-nil, one pseudo-article will be created for each file to be viewed.
618 If nil, all files that use the same viewing command will be given as a
619 list of parameters to that command."
620 :group 'gnus-extract-view
623 (defcustom gnus-insert-pseudo-articles t
624 "*If non-nil, insert pseudo-articles when decoding articles."
625 :group 'gnus-extract-view
628 (defcustom gnus-summary-dummy-line-format
630 "*The format specification for the dummy roots in the summary buffer.
631 It works along the same lines as a normal formatting string,
632 with some simple extensions.
636 General format specifiers can also be used.
637 See `(gnus)Formatting Variables'."
638 :link '(custom-manual "(gnus)Formatting Variables")
639 :group 'gnus-threading
642 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
643 "*The format specification for the summary mode line.
644 It works along the same lines as a normal formatting string,
645 with some simple extensions:
648 %p Unprefixed group name
649 %A Current article number
650 %z Current article score
652 %U Number of unread articles in the group
653 %e Number of unselected articles in the group
654 %Z A string with unread/unselected article counts
655 %g Shortish group name
656 %S Subject of the current article
658 %s Current score file name
659 %d Number of dormant articles
660 %r Number of articles that have been marked as read in this session
661 %E Number of articles expunged by the score files"
662 :group 'gnus-summary-format
665 (defcustom gnus-list-identifiers nil
666 "Regexp that matches list identifiers to be removed from subject.
667 This can also be a list of regexps."
669 :group 'gnus-summary-format
670 :group 'gnus-article-hiding
671 :type '(choice (const :tag "none" nil)
673 (repeat :value (".*") regexp)))
675 (defcustom gnus-summary-mark-below 0
676 "*Mark all articles with a score below this variable as read.
677 This variable is local to each summary buffer and usually set by the
679 :group 'gnus-score-default
682 (defun gnus-widget-reversible-match (widget value)
683 "Ignoring WIDGET, convert VALUE to internal form.
684 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
688 (eq (length value) 2)
689 (eq (nth 0 value) 'not)
690 (symbolp (nth 1 value)))))
692 (defun gnus-widget-reversible-to-internal (widget value)
693 "Ignoring WIDGET, convert VALUE to internal form.
694 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
695 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
699 (list (nth 1 value) t)))
701 (defun gnus-widget-reversible-to-external (widget value)
702 "Ignoring WIDGET, convert VALUE to external form.
703 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
704 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
707 (list 'not (nth 0 value))
710 (define-widget 'gnus-widget-reversible 'group
711 "A `group' that convert values."
712 :match 'gnus-widget-reversible-match
713 :value-to-internal 'gnus-widget-reversible-to-internal
714 :value-to-external 'gnus-widget-reversible-to-external)
717 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
718 "*List of functions used for sorting articles in the summary buffer.
720 Each function takes two articles and returns non-nil if the first
721 article should be sorted before the other. If you use more than one
722 function, the primary sort function should be the last. You should
723 probably always include `gnus-article-sort-by-number' in the list of
724 sorting functions -- preferably first. Also note that sorting by date
725 is often much slower than sorting by number, and the sorting order is
726 very similar. (Sorting by date means sorting by the time the message
727 was sent, sorting by number means sorting by arrival time.)
729 Each item can also be a list `(not F)' where F is a function;
730 this reverses the sort order.
732 Ready-made functions include `gnus-article-sort-by-number',
733 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
734 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
735 and `gnus-article-sort-by-score'.
737 When threading is turned on, the variable `gnus-thread-sort-functions'
738 controls how articles are sorted."
739 :group 'gnus-summary-sort
740 :type '(repeat (gnus-widget-reversible
741 (choice (function-item gnus-article-sort-by-number)
742 (function-item gnus-article-sort-by-author)
743 (function-item gnus-article-sort-by-subject)
744 (function-item gnus-article-sort-by-date)
745 (function-item gnus-article-sort-by-score)
746 (function-item gnus-article-sort-by-random)
747 (function :tag "other"))
748 (boolean :tag "Reverse order"))))
751 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
752 "*List of functions used for sorting threads in the summary buffer.
753 By default, threads are sorted by article number.
755 Each function takes two threads and returns non-nil if the first
756 thread should be sorted before the other. If you use more than one
757 function, the primary sort function should be the last. You should
758 probably always include `gnus-thread-sort-by-number' in the list of
759 sorting functions -- preferably first. Also note that sorting by date
760 is often much slower than sorting by number, and the sorting order is
761 very similar. (Sorting by date means sorting by the time the message
762 was sent, sorting by number means sorting by arrival time.)
764 Each list item can also be a list `(not F)' where F is a
765 function; this specifies reversed sort order.
767 Ready-made functions include `gnus-thread-sort-by-number',
768 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
769 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
770 `gnus-thread-sort-by-most-recent-number',
771 `gnus-thread-sort-by-most-recent-date',
772 `gnus-thread-sort-by-random', and
773 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
775 When threading is turned off, the variable
776 `gnus-article-sort-functions' controls how articles are sorted."
777 :group 'gnus-summary-sort
779 (gnus-widget-reversible
780 (choice (function-item gnus-thread-sort-by-number)
781 (function-item gnus-thread-sort-by-author)
782 (function-item gnus-thread-sort-by-subject)
783 (function-item gnus-thread-sort-by-date)
784 (function-item gnus-thread-sort-by-score)
785 (function-item gnus-thread-sort-by-most-recent-number)
786 (function-item gnus-thread-sort-by-most-recent-date)
787 (function-item gnus-thread-sort-by-random)
788 (function-item gnus-thread-sort-by-total-score)
789 (function :tag "other"))
790 (boolean :tag "Reverse order"))))
792 (defcustom gnus-thread-score-function '+
793 "*Function used for calculating the total score of a thread.
795 The function is called with the scores of the article and each
796 subthread and should then return the score of the thread.
798 Some functions you can use are `+', `max', or `min'."
799 :group 'gnus-summary-sort
802 (defcustom gnus-summary-expunge-below nil
803 "All articles that have a score less than this variable will be expunged.
804 This variable is local to the summary buffers."
805 :group 'gnus-score-default
806 :type '(choice (const :tag "off" nil)
809 (defcustom gnus-thread-expunge-below nil
810 "All threads that have a total score less than this variable will be expunged.
811 See `gnus-thread-score-function' for en explanation of what a
814 This variable is local to the summary buffers."
815 :group 'gnus-threading
816 :group 'gnus-score-default
817 :type '(choice (const :tag "off" nil)
820 (defcustom gnus-summary-mode-hook nil
821 "*A hook for Gnus summary mode.
822 This hook is run before any variables are set in the summary buffer."
823 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
824 :group 'gnus-summary-various
827 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
828 (when (featurep 'xemacs)
829 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
830 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
831 (add-hook 'gnus-summary-mode-hook
832 'gnus-xmas-switch-horizontal-scrollbar-off))
834 (defcustom gnus-summary-menu-hook nil
835 "*Hook run after the creation of the summary mode menu."
836 :group 'gnus-summary-visual
839 (defcustom gnus-summary-exit-hook nil
840 "*A hook called on exit from the summary buffer.
841 It will be called with point in the group buffer."
842 :group 'gnus-summary-exit
845 (defcustom gnus-summary-prepare-hook nil
846 "*A hook called after the summary buffer has been generated.
847 If you want to modify the summary buffer, you can use this hook."
848 :group 'gnus-summary-various
851 (defcustom gnus-summary-prepared-hook nil
852 "*A hook called as the last thing after the summary buffer has been generated."
853 :group 'gnus-summary-various
856 (defcustom gnus-summary-generate-hook nil
857 "*A hook run just before generating the summary buffer.
858 This hook is commonly used to customize threading variables and the
860 :group 'gnus-summary-various
863 (defcustom gnus-select-group-hook nil
864 "*A hook called when a newsgroup is selected.
866 If you'd like to simplify subjects like the
867 `gnus-summary-next-same-subject' command does, you can use the
870 (add-hook gnus-select-group-hook
872 (mapcar (lambda (header)
873 (mail-header-set-subject
875 (gnus-simplify-subject
876 (mail-header-subject header) 're-only)))
877 gnus-newsgroup-headers)))"
878 :group 'gnus-group-select
881 (defcustom gnus-select-article-hook nil
882 "*A hook called when an article is selected."
883 :group 'gnus-summary-choose
884 :options '(gnus-agent-fetch-selected-article)
887 (defcustom gnus-visual-mark-article-hook
888 (list 'gnus-highlight-selected-summary)
889 "*Hook run after selecting an article in the summary buffer.
890 It is meant to be used for highlighting the article in some way. It
891 is not run if `gnus-visual' is nil."
892 :group 'gnus-summary-visual
895 (defcustom gnus-parse-headers-hook nil
896 "*A hook called before parsing the headers."
900 (defcustom gnus-exit-group-hook nil
901 "*A hook called when exiting summary mode.
902 This hook is not called from the non-updating exit commands like `Q'."
906 (defcustom gnus-summary-update-hook
907 (list 'gnus-summary-highlight-line)
908 "*A hook called when a summary line is changed.
909 The hook will not be called if `gnus-visual' is nil.
911 The default function `gnus-summary-highlight-line' will
912 highlight the line according to the `gnus-summary-highlight'
914 :group 'gnus-summary-visual
917 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
918 "*A hook called when an article is selected for the first time.
919 The hook is intended to mark an article as read (or unread)
920 automatically when it is selected."
921 :group 'gnus-summary-choose
924 (defcustom gnus-group-no-more-groups-hook nil
925 "*A hook run when returning to group mode having no more (unread) groups."
926 :group 'gnus-group-select
929 (defcustom gnus-ps-print-hook nil
930 "*A hook run before ps-printing something from Gnus."
934 (defcustom gnus-summary-article-move-hook nil
935 "*A hook called after an article is moved, copied, respooled, or crossposted."
939 (defcustom gnus-summary-article-delete-hook nil
940 "*A hook called after an article is deleted."
944 (defcustom gnus-summary-article-expire-hook nil
945 "*A hook called after an article is expired."
949 (defcustom gnus-summary-display-arrow
950 (and (fboundp 'display-graphic-p)
952 "*If non-nil, display an arrow highlighting the current article."
957 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
958 "Face used for highlighting the current article in the summary buffer."
959 :group 'gnus-summary-visual
962 (defvar gnus-tmp-downloaded nil)
964 (defcustom gnus-summary-highlight
965 '(((eq mark gnus-canceled-mark)
966 . gnus-summary-cancelled-face)
967 ((and uncached (> score default-high))
968 . gnus-summary-high-undownloaded-face)
969 ((and uncached (< score default-low))
970 . gnus-summary-low-undownloaded-face)
972 . gnus-summary-normal-undownloaded-face)
973 ((and (> score default-high)
974 (or (eq mark gnus-dormant-mark)
975 (eq mark gnus-ticked-mark)))
976 . gnus-summary-high-ticked-face)
977 ((and (< score default-low)
978 (or (eq mark gnus-dormant-mark)
979 (eq mark gnus-ticked-mark)))
980 . gnus-summary-low-ticked-face)
981 ((or (eq mark gnus-dormant-mark)
982 (eq mark gnus-ticked-mark))
983 . gnus-summary-normal-ticked-face)
984 ((and (> score default-high) (eq mark gnus-ancient-mark))
985 . gnus-summary-high-ancient-face)
986 ((and (< score default-low) (eq mark gnus-ancient-mark))
987 . gnus-summary-low-ancient-face)
988 ((eq mark gnus-ancient-mark)
989 . gnus-summary-normal-ancient-face)
990 ((and (> score default-high) (eq mark gnus-unread-mark))
991 . gnus-summary-high-unread-face)
992 ((and (< score default-low) (eq mark gnus-unread-mark))
993 . gnus-summary-low-unread-face)
994 ((eq mark gnus-unread-mark)
995 . gnus-summary-normal-unread-face)
996 ((> score default-high)
997 . gnus-summary-high-read-face)
998 ((< score default-low)
999 . gnus-summary-low-read-face)
1001 . gnus-summary-normal-read-face))
1002 "*Controls the highlighting of summary buffer lines.
1004 A list of (FORM . FACE) pairs. When deciding how a a particular
1005 summary line should be displayed, each form is evaluated. The content
1006 of the face field after the first true form is used. You can change
1007 how those summary lines are displayed, by editing the face field.
1009 You can use the following variables in the FORM field.
1011 score: The article's score
1012 default: The default article score.
1013 default-high: The default score for high scored articles.
1014 default-low: The default score for low scored articles.
1015 below: The score below which articles are automatically marked as read.
1016 mark: The article's mark.
1017 uncached: Non-nil if the article is uncached."
1018 :group 'gnus-summary-visual
1019 :type '(repeat (cons (sexp :tag "Form" nil)
1022 (defcustom gnus-alter-header-function nil
1023 "Function called to allow alteration of article header structures.
1024 The function is called with one parameter, the article header vector,
1025 which it may alter in any way."
1026 :type '(choice (const :tag "None" nil)
1028 :group 'gnus-summary)
1030 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1031 "Variable that says which function should be used to decode a string with encoded words.")
1033 (defcustom gnus-extra-headers '(To Newsgroups)
1034 "*Extra headers to parse."
1036 :group 'gnus-summary
1037 :type '(repeat symbol))
1039 (defcustom gnus-ignored-from-addresses
1040 (and user-mail-address (regexp-quote user-mail-address))
1041 "*Regexp of From headers that may be suppressed in favor of To headers."
1043 :group 'gnus-summary
1046 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1047 "List of charsets that should be ignored.
1048 When these charsets are used in the \"charset\" parameter, the
1049 default charset will be used instead."
1051 :type '(repeat symbol)
1052 :group 'gnus-charset)
1054 (gnus-define-group-parameter
1058 "Return the ignored charsets of GROUP."
1059 :variable gnus-group-ignored-charsets-alist
1061 '(("alt\\.chinese\\.text" iso-8859-1))
1063 "Alist of regexps (to match group names) and charsets that should be ignored.
1064 When these charsets are used in the \"charset\" parameter, the
1065 default charset will be used instead."
1066 :variable-group gnus-charset
1067 :variable-type '(repeat (cons (regexp :tag "Group")
1069 :parameter-type '(choice :tag "Ignored charsets"
1072 :parameter-document "\
1073 List of charsets that should be ignored.
1075 When these charsets are used in the \"charset\" parameter, the
1076 default charset will be used instead.")
1078 (defcustom gnus-group-highlight-words-alist nil
1079 "Alist of group regexps and highlight regexps.
1080 This variable uses the same syntax as `gnus-emphasis-alist'."
1082 :type '(repeat (cons (regexp :tag "Group")
1083 (repeat (list (regexp :tag "Highlight regexp")
1084 (number :tag "Group for entire word" 0)
1085 (number :tag "Group for displayed part" 0)
1087 gnus-emphasis-highlight-words)))))
1088 :group 'gnus-summary-visual)
1090 (defcustom gnus-summary-show-article-charset-alist
1092 "Alist of number and charset.
1093 The article will be shown with the charset corresponding to the
1095 For example: ((1 . cn-gb-2312) (2 . big5))."
1097 :type '(repeat (cons (number :tag "Argument" 1)
1098 (symbol :tag "Charset")))
1099 :group 'gnus-charset)
1101 (defcustom gnus-preserve-marks t
1102 "Whether marks are preserved when moving, copying and respooling messages."
1105 :group 'gnus-summary-marks)
1107 (defcustom gnus-alter-articles-to-read-function nil
1108 "Function to be called to alter the list of articles to be selected."
1109 :type '(choice (const nil) function)
1110 :group 'gnus-summary)
1112 (defcustom gnus-orphan-score nil
1113 "*All orphans get this score added. Set in the score file."
1114 :group 'gnus-score-default
1115 :type '(choice (const nil)
1118 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1119 "*A regexp to match MIME parts when saving multiple parts of a
1120 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1121 This regexp will be used by default when prompting the user for which
1122 type of files to save."
1123 :group 'gnus-summary
1126 (defcustom gnus-read-all-available-headers nil
1127 "Whether Gnus should parse all headers made available to it.
1128 This is mostly relevant for slow back ends where the user may
1129 wish to widen the summary buffer to include all headers
1130 that were fetched. Say, for nnultimate groups."
1131 :group 'gnus-summary
1132 :type '(choice boolean regexp))
1134 (defcustom gnus-summary-muttprint-program "muttprint"
1135 "Command (and optional arguments) used to run Muttprint."
1137 :group 'gnus-summary
1140 (defcustom gnus-article-loose-mime nil
1141 "If non-nil, don't require MIME-Version header.
1142 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1143 supply the MIME-Version header or deliberately strip it From the mail.
1144 Set it to non-nil, Gnus will treat some articles as MIME even if
1145 the MIME-Version header is missed."
1148 :group 'gnus-article-mime)
1150 (defcustom gnus-article-emulate-mime t
1151 "If non-nil, use MIME emulation for uuencode and the like.
1152 This means that Gnus will search message bodies for text that look
1153 like uuencoded bits, yEncoded bits, and so on, and present that using
1154 the normal Gnus MIME machinery."
1156 :group 'gnus-article-mime)
1158 ;;; Internal variables
1160 (defvar gnus-summary-display-cache nil)
1161 (defvar gnus-article-mime-handles nil)
1162 (defvar gnus-article-decoded-p nil)
1163 (defvar gnus-article-charset nil)
1164 (defvar gnus-article-ignored-charsets nil)
1165 (defvar gnus-scores-exclude-files nil)
1166 (defvar gnus-page-broken nil)
1168 (defvar gnus-original-article nil)
1169 (defvar gnus-article-internal-prepare-hook nil)
1170 (defvar gnus-newsgroup-process-stack nil)
1172 (defvar gnus-thread-indent-array nil)
1173 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1174 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1175 "Function called to sort the articles within a thread after it has been gathered together.")
1177 (defvar gnus-summary-save-parts-type-history nil)
1178 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1180 ;; Avoid highlighting in kill files.
1181 (defvar gnus-summary-inhibit-highlight nil)
1182 (defvar gnus-newsgroup-selected-overlay nil)
1183 (defvar gnus-inhibit-limiting nil)
1184 (defvar gnus-newsgroup-adaptive-score-file nil)
1185 (defvar gnus-current-score-file nil)
1186 (defvar gnus-current-move-group nil)
1187 (defvar gnus-current-copy-group nil)
1188 (defvar gnus-current-crosspost-group nil)
1189 (defvar gnus-newsgroup-display nil)
1191 (defvar gnus-newsgroup-dependencies nil)
1192 (defvar gnus-newsgroup-adaptive nil)
1193 (defvar gnus-summary-display-article-function nil)
1194 (defvar gnus-summary-highlight-line-function nil
1195 "Function called after highlighting a summary line.")
1197 (defvar gnus-summary-line-format-alist
1198 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1199 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1200 (?s gnus-tmp-subject-or-nil ?s)
1201 (?n gnus-tmp-name ?s)
1202 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1204 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1206 (?F gnus-tmp-from ?s)
1207 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1208 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1209 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1210 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1211 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1212 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1213 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1214 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1215 (?L gnus-tmp-lines ?s)
1216 (?O gnus-tmp-downloaded ?c)
1217 (?I gnus-tmp-indentation ?s)
1218 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1219 (?R gnus-tmp-replied ?c)
1220 (?\[ gnus-tmp-opening-bracket ?c)
1221 (?\] gnus-tmp-closing-bracket ?c)
1222 (?\> (make-string gnus-tmp-level ? ) ?s)
1223 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1224 (?i gnus-tmp-score ?d)
1225 (?z gnus-tmp-score-char ?c)
1226 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1227 (?U gnus-tmp-unread ?c)
1228 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1230 (?t (gnus-summary-number-of-articles-in-thread
1231 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1233 (?e (gnus-summary-number-of-articles-in-thread
1234 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1236 (?u gnus-tmp-user-defined ?s)
1237 (?P (gnus-pick-line-number) ?d)
1238 (?B gnus-tmp-thread-tree-header-string ?s)
1239 (user-date (gnus-user-date
1240 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1241 "An alist of format specifications that can appear in summary lines.
1242 These are paired with what variables they correspond with, along with
1243 the type of the variable (string, integer, character, etc).")
1245 (defvar gnus-summary-dummy-line-format-alist
1246 `((?S gnus-tmp-subject ?s)
1247 (?N gnus-tmp-number ?d)
1248 (?u gnus-tmp-user-defined ?s)))
1250 (defvar gnus-summary-mode-line-format-alist
1251 `((?G gnus-tmp-group-name ?s)
1252 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1253 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1254 (?A gnus-tmp-article-number ?d)
1255 (?Z gnus-tmp-unread-and-unselected ?s)
1256 (?V gnus-version ?s)
1257 (?U gnus-tmp-unread-and-unticked ?d)
1258 (?S gnus-tmp-subject ?s)
1259 (?e gnus-tmp-unselected ?d)
1260 (?u gnus-tmp-user-defined ?s)
1261 (?d (length gnus-newsgroup-dormant) ?d)
1262 (?t (length gnus-newsgroup-marked) ?d)
1263 (?h (length gnus-newsgroup-spam-marked) ?d)
1264 (?r (length gnus-newsgroup-reads) ?d)
1265 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1266 (?E gnus-newsgroup-expunged-tally ?d)
1267 (?s (gnus-current-score-file-nondirectory) ?s)))
1269 (defvar gnus-last-search-regexp nil
1270 "Default regexp for article search command.")
1272 (defvar gnus-last-shell-command nil
1273 "Default shell command on article.")
1275 (defvar gnus-newsgroup-agentized nil
1276 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1277 (defvar gnus-newsgroup-begin nil)
1278 (defvar gnus-newsgroup-end nil)
1279 (defvar gnus-newsgroup-last-rmail nil)
1280 (defvar gnus-newsgroup-last-mail nil)
1281 (defvar gnus-newsgroup-last-folder nil)
1282 (defvar gnus-newsgroup-last-file nil)
1283 (defvar gnus-newsgroup-auto-expire nil)
1284 (defvar gnus-newsgroup-active nil)
1286 (defvar gnus-newsgroup-data nil)
1287 (defvar gnus-newsgroup-data-reverse nil)
1288 (defvar gnus-newsgroup-limit nil)
1289 (defvar gnus-newsgroup-limits nil)
1290 (defvar gnus-summary-use-undownloaded-faces nil)
1292 (defvar gnus-newsgroup-unreads nil
1293 "Sorted list of unread articles in the current newsgroup.")
1295 (defvar gnus-newsgroup-unselected nil
1296 "Sorted list of unselected unread articles in the current newsgroup.")
1298 (defvar gnus-newsgroup-reads nil
1299 "Alist of read articles and article marks in the current newsgroup.")
1301 (defvar gnus-newsgroup-expunged-tally nil)
1303 (defvar gnus-newsgroup-marked nil
1304 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1306 (defvar gnus-newsgroup-spam-marked nil
1307 "List of ranges of articles that have been marked as spam.")
1309 (defvar gnus-newsgroup-killed nil
1310 "List of ranges of articles that have been through the scoring process.")
1312 (defvar gnus-newsgroup-cached nil
1313 "Sorted list of articles that come from the article cache.")
1315 (defvar gnus-newsgroup-saved nil
1316 "List of articles that have been saved.")
1318 (defvar gnus-newsgroup-kill-headers nil)
1320 (defvar gnus-newsgroup-replied nil
1321 "List of articles that have been replied to in the current newsgroup.")
1323 (defvar gnus-newsgroup-forwarded nil
1324 "List of articles that have been forwarded in the current newsgroup.")
1326 (defvar gnus-newsgroup-recent nil
1327 "List of articles that have are recent in the current newsgroup.")
1329 (defvar gnus-newsgroup-expirable nil
1330 "Sorted list of articles in the current newsgroup that can be expired.")
1332 (defvar gnus-newsgroup-processable nil
1333 "List of articles in the current newsgroup that can be processed.")
1335 (defvar gnus-newsgroup-downloadable nil
1336 "Sorted list of articles in the current newsgroup that can be processed.")
1338 (defvar gnus-newsgroup-unfetched nil
1339 "Sorted list of articles in the current newsgroup whose headers have
1340 not been fetched into the agent.
1342 This list will always be a subset of gnus-newsgroup-undownloaded.")
1344 (defvar gnus-newsgroup-undownloaded nil
1345 "List of articles in the current newsgroup that haven't been downloaded.")
1347 (defvar gnus-newsgroup-unsendable nil
1348 "List of articles in the current newsgroup that won't be sent.")
1350 (defvar gnus-newsgroup-bookmarks nil
1351 "List of articles in the current newsgroup that have bookmarks.")
1353 (defvar gnus-newsgroup-dormant nil
1354 "Sorted list of dormant articles in the current newsgroup.")
1356 (defvar gnus-newsgroup-unseen nil
1357 "List of unseen articles in the current newsgroup.")
1359 (defvar gnus-newsgroup-seen nil
1360 "Range of seen articles in the current newsgroup.")
1362 (defvar gnus-newsgroup-articles nil
1363 "List of articles in the current newsgroup.")
1365 (defvar gnus-newsgroup-scored nil
1366 "List of scored articles in the current newsgroup.")
1368 (defvar gnus-newsgroup-headers nil
1369 "List of article headers in the current newsgroup.")
1371 (defvar gnus-newsgroup-threads nil)
1373 (defvar gnus-newsgroup-prepared nil
1374 "Whether the current group has been prepared properly.")
1376 (defvar gnus-newsgroup-ancient nil
1377 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1379 (defvar gnus-newsgroup-sparse nil)
1381 (defvar gnus-current-article nil)
1382 (defvar gnus-article-current nil)
1383 (defvar gnus-current-headers nil)
1384 (defvar gnus-have-all-headers nil)
1385 (defvar gnus-last-article nil)
1386 (defvar gnus-newsgroup-history nil)
1387 (defvar gnus-newsgroup-charset nil)
1388 (defvar gnus-newsgroup-ephemeral-charset nil)
1389 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1391 (defvar gnus-article-before-search nil)
1393 (defvar gnus-summary-local-variables
1394 '(gnus-newsgroup-name
1395 gnus-newsgroup-begin gnus-newsgroup-end
1396 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1397 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1398 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1399 gnus-newsgroup-unselected gnus-newsgroup-marked
1400 gnus-newsgroup-spam-marked
1401 gnus-newsgroup-reads gnus-newsgroup-saved
1402 gnus-newsgroup-replied gnus-newsgroup-forwarded
1403 gnus-newsgroup-recent
1404 gnus-newsgroup-expirable
1405 gnus-newsgroup-processable gnus-newsgroup-killed
1406 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1407 gnus-newsgroup-unfetched
1408 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1409 gnus-newsgroup-seen gnus-newsgroup-articles
1410 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1411 gnus-newsgroup-headers gnus-newsgroup-threads
1412 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1413 gnus-current-article gnus-current-headers gnus-have-all-headers
1414 gnus-last-article gnus-article-internal-prepare-hook
1415 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1416 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1417 gnus-thread-expunge-below
1418 gnus-score-alist gnus-current-score-file
1419 (gnus-summary-expunge-below . global)
1420 (gnus-summary-mark-below . global)
1421 (gnus-orphan-score . global)
1422 gnus-newsgroup-active gnus-scores-exclude-files
1423 gnus-newsgroup-history gnus-newsgroup-ancient
1424 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1425 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1426 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1427 (gnus-newsgroup-expunged-tally . 0)
1428 gnus-cache-removable-articles gnus-newsgroup-cached
1429 gnus-newsgroup-data gnus-newsgroup-data-reverse
1430 gnus-newsgroup-limit gnus-newsgroup-limits
1431 gnus-newsgroup-charset gnus-newsgroup-display
1432 gnus-summary-use-undownloaded-faces)
1433 "Variables that are buffer-local to the summary buffers.")
1435 (defvar gnus-newsgroup-variables nil
1436 "A list of variables that have separate values in different newsgroups.
1437 A list of newsgroup (summary buffer) local variables, or cons of
1438 variables and their default expressions to be evalled (when the default
1439 values are not nil), that should be made global while the summary buffer
1442 Note: The default expressions will be evaluated (using function `eval')
1443 before assignment to the local variable rather than just assigned to it.
1444 If the default expression is the symbol `global', that symbol will not
1445 be evaluated but the global value of the local variable will be used
1448 These variables can be used to set variables in the group parameters
1449 while still allowing them to affect operations done in other buffers.
1452 \(setq gnus-newsgroup-variables
1453 '(message-use-followup-to
1454 (gnus-visible-headers .
1455 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1458 ;; Byte-compiler warning.
1460 ;; Bind features so that require will believe that gnus-sum has
1461 ;; already been loaded (avoids infinite recursion)
1462 (let ((features (cons 'gnus-sum features)))
1463 ;; Several of the declarations in gnus-sum are needed to load the
1464 ;; following files. Right now, these definitions have been
1465 ;; compiled but not defined (evaluated). We could either do a
1466 ;; eval-and-compile about all of the declarations or evaluate the
1468 (if (boundp 'gnus-newsgroup-variables)
1470 (load "gnus-sum.el" t t t))
1472 (require 'gnus-agent)
1473 (require 'gnus-art)))
1477 (defvar gnus-decode-encoded-word-methods
1478 '(mail-decode-encoded-word-string)
1479 "List of methods used to decode encoded words.
1481 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1482 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1483 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1484 whose names match REGEXP.
1487 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1488 mail-decode-encoded-word-string
1489 (\"chinese\" . rfc1843-decode-string))")
1491 (defvar gnus-decode-encoded-word-methods-cache nil)
1493 (defun gnus-multi-decode-encoded-word-string (string)
1494 "Apply the functions from `gnus-encoded-word-methods' that match."
1495 (unless (and gnus-decode-encoded-word-methods-cache
1496 (eq gnus-newsgroup-name
1497 (car gnus-decode-encoded-word-methods-cache)))
1498 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1501 (nconc gnus-decode-encoded-word-methods-cache (list x))
1502 (if (and gnus-newsgroup-name
1503 (string-match (car x) gnus-newsgroup-name))
1504 (nconc gnus-decode-encoded-word-methods-cache
1506 gnus-decode-encoded-word-methods))
1507 (let ((xlist gnus-decode-encoded-word-methods-cache))
1510 (setq string (funcall (pop xlist) string))))
1513 ;; Subject simplification.
1515 (defun gnus-simplify-whitespace (str)
1516 "Remove excessive whitespace from STR."
1518 (while (string-match "[ \t][ \t]+" str)
1519 (setq str (concat (substring str 0 (match-beginning 0))
1521 (substring str (match-end 0)))))
1523 (when (string-match "^[ \t]+" str)
1524 (setq str (substring str (match-end 0))))
1526 (when (string-match "[ \t]+$" str)
1527 (setq str (substring str 0 (match-beginning 0))))
1530 (defun gnus-simplify-all-whitespace (str)
1531 "Remove all whitespace from STR."
1532 (while (string-match "[ \t\n]+" str)
1533 (setq str (replace-match "" nil nil str)))
1536 (defsubst gnus-simplify-subject-re (subject)
1537 "Remove \"Re:\" from subject lines."
1538 (if (string-match message-subject-re-regexp subject)
1539 (substring subject (match-end 0))
1542 (defun gnus-simplify-subject (subject &optional re-only)
1543 "Remove `Re:' and words in parentheses.
1544 If RE-ONLY is non-nil, strip leading `Re:'s only."
1545 (let ((case-fold-search t)) ;Ignore case.
1546 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1547 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1548 (setq subject (substring subject (match-end 0))))
1549 ;; Remove uninteresting prefixes.
1550 (when (and (not re-only)
1551 gnus-simplify-ignored-prefixes
1552 (string-match gnus-simplify-ignored-prefixes subject))
1553 (setq subject (substring subject (match-end 0))))
1554 ;; Remove words in parentheses from end.
1556 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1557 (setq subject (substring subject 0 (match-beginning 0)))))
1558 ;; Return subject string.
1561 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1563 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1564 (goto-char (point-min))
1565 (while (re-search-forward regexp nil t)
1566 (replace-match (or newtext ""))))
1568 (defun gnus-simplify-buffer-fuzzy ()
1569 "Simplify string in the buffer fuzzily.
1570 The string in the accessible portion of the current buffer is simplified.
1571 It is assumed to be a single-line subject.
1572 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1573 matter is removed. Additional things can be deleted by setting
1574 `gnus-simplify-subject-fuzzy-regexp'."
1575 (let ((case-fold-search t)
1577 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1579 (while (not (eq modified-tick (buffer-modified-tick)))
1580 (setq modified-tick (buffer-modified-tick))
1582 ((listp gnus-simplify-subject-fuzzy-regexp)
1583 (mapcar 'gnus-simplify-buffer-fuzzy-step
1584 gnus-simplify-subject-fuzzy-regexp))
1585 (gnus-simplify-subject-fuzzy-regexp
1586 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1587 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1588 (gnus-simplify-buffer-fuzzy-step
1589 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1590 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1592 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1593 (gnus-simplify-buffer-fuzzy-step " +" " ")
1594 (gnus-simplify-buffer-fuzzy-step " $")
1595 (gnus-simplify-buffer-fuzzy-step "^ +")))
1597 (defun gnus-simplify-subject-fuzzy (subject)
1598 "Simplify a subject string fuzzily.
1599 See `gnus-simplify-buffer-fuzzy' for details."
1601 (gnus-set-work-buffer)
1602 (let ((case-fold-search t))
1603 ;; Remove uninteresting prefixes.
1604 (when (and gnus-simplify-ignored-prefixes
1605 (string-match gnus-simplify-ignored-prefixes subject))
1606 (setq subject (substring subject (match-end 0))))
1608 (inline (gnus-simplify-buffer-fuzzy))
1611 (defsubst gnus-simplify-subject-fully (subject)
1612 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1614 (gnus-simplify-subject-functions
1615 (gnus-map-function gnus-simplify-subject-functions subject))
1616 ((null gnus-summary-gather-subject-limit)
1617 (gnus-simplify-subject-re subject))
1618 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1619 (gnus-simplify-subject-fuzzy subject))
1620 ((numberp gnus-summary-gather-subject-limit)
1621 (gnus-limit-string (gnus-simplify-subject-re subject)
1622 gnus-summary-gather-subject-limit))
1626 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1627 "Check whether two subjects are equal.
1628 If optional argument SIMPLE-FIRST is t, first argument is already
1631 ((null simple-first)
1632 (equal (gnus-simplify-subject-fully s1)
1633 (gnus-simplify-subject-fully s2)))
1636 (gnus-simplify-subject-fully s2)))))
1638 (defun gnus-summary-bubble-group ()
1639 "Increase the score of the current group.
1640 This is a handy function to add to `gnus-summary-exit-hook' to
1641 increase the score of each group you read."
1642 (gnus-group-add-score gnus-newsgroup-name))
1646 ;;; Gnus summary mode
1649 (put 'gnus-summary-mode 'mode-class 'special)
1651 (defvar gnus-article-commands-menu)
1653 ;; Non-orthogonal keys
1655 (gnus-define-keys gnus-summary-mode-map
1656 " " gnus-summary-next-page
1657 "\177" gnus-summary-prev-page
1658 [delete] gnus-summary-prev-page
1659 [backspace] gnus-summary-prev-page
1660 "\r" gnus-summary-scroll-up
1661 "\M-\r" gnus-summary-scroll-down
1662 "n" gnus-summary-next-unread-article
1663 "p" gnus-summary-prev-unread-article
1664 "N" gnus-summary-next-article
1665 "P" gnus-summary-prev-article
1666 "\M-\C-n" gnus-summary-next-same-subject
1667 "\M-\C-p" gnus-summary-prev-same-subject
1668 "\M-n" gnus-summary-next-unread-subject
1669 "\M-p" gnus-summary-prev-unread-subject
1670 "." gnus-summary-first-unread-article
1671 "," gnus-summary-best-unread-article
1672 "\M-s" gnus-summary-search-article-forward
1673 "\M-r" gnus-summary-search-article-backward
1674 "<" gnus-summary-beginning-of-article
1675 ">" gnus-summary-end-of-article
1676 "j" gnus-summary-goto-article
1677 "^" gnus-summary-refer-parent-article
1678 "\M-^" gnus-summary-refer-article
1679 "u" gnus-summary-tick-article-forward
1680 "!" gnus-summary-tick-article-forward
1681 "U" gnus-summary-tick-article-backward
1682 "d" gnus-summary-mark-as-read-forward
1683 "D" gnus-summary-mark-as-read-backward
1684 "E" gnus-summary-mark-as-expirable
1685 "\M-u" gnus-summary-clear-mark-forward
1686 "\M-U" gnus-summary-clear-mark-backward
1687 "k" gnus-summary-kill-same-subject-and-select
1688 "\C-k" gnus-summary-kill-same-subject
1689 "\M-\C-k" gnus-summary-kill-thread
1690 "\M-\C-l" gnus-summary-lower-thread
1691 "e" gnus-summary-edit-article
1692 "#" gnus-summary-mark-as-processable
1693 "\M-#" gnus-summary-unmark-as-processable
1694 "\M-\C-t" gnus-summary-toggle-threads
1695 "\M-\C-s" gnus-summary-show-thread
1696 "\M-\C-h" gnus-summary-hide-thread
1697 "\M-\C-f" gnus-summary-next-thread
1698 "\M-\C-b" gnus-summary-prev-thread
1699 [(meta down)] gnus-summary-next-thread
1700 [(meta up)] gnus-summary-prev-thread
1701 "\M-\C-u" gnus-summary-up-thread
1702 "\M-\C-d" gnus-summary-down-thread
1703 "&" gnus-summary-execute-command
1704 "c" gnus-summary-catchup-and-exit
1705 "\C-w" gnus-summary-mark-region-as-read
1706 "\C-t" gnus-summary-toggle-truncation
1707 "?" gnus-summary-mark-as-dormant
1708 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1709 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1710 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1711 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1712 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1713 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1714 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1715 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1716 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1717 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1718 "=" gnus-summary-expand-window
1719 "\C-x\C-s" gnus-summary-reselect-current-group
1720 "\M-g" gnus-summary-rescan-group
1721 "w" gnus-summary-stop-page-breaking
1722 "\C-c\C-r" gnus-summary-caesar-message
1723 "f" gnus-summary-followup
1724 "F" gnus-summary-followup-with-original
1725 "C" gnus-summary-cancel-article
1726 "r" gnus-summary-reply
1727 "R" gnus-summary-reply-with-original
1728 "\C-c\C-f" gnus-summary-mail-forward
1729 "o" gnus-summary-save-article
1730 "\C-o" gnus-summary-save-article-mail
1731 "|" gnus-summary-pipe-output
1732 "\M-k" gnus-summary-edit-local-kill
1733 "\M-K" gnus-summary-edit-global-kill
1735 "\C-c\C-d" gnus-summary-describe-group
1736 "q" gnus-summary-exit
1737 "Q" gnus-summary-exit-no-update
1738 "\C-c\C-i" gnus-info-find-node
1739 gnus-mouse-2 gnus-mouse-pick-article
1740 "m" gnus-summary-mail-other-window
1741 "a" gnus-summary-post-news
1742 "i" gnus-summary-news-other-window
1743 "x" gnus-summary-limit-to-unread
1744 "s" gnus-summary-isearch-article
1745 "t" gnus-summary-toggle-header
1746 "g" gnus-summary-show-article
1747 "l" gnus-summary-goto-last-article
1748 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1749 "\C-d" gnus-summary-enter-digest-group
1750 "\M-\C-d" gnus-summary-read-document
1751 "\M-\C-e" gnus-summary-edit-parameters
1752 "\M-\C-a" gnus-summary-customize-parameters
1754 "*" gnus-cache-enter-article
1755 "\M-*" gnus-cache-remove-article
1756 "\M-&" gnus-summary-universal-argument
1757 "\C-l" gnus-recenter
1758 "I" gnus-summary-increase-score
1759 "L" gnus-summary-lower-score
1760 "\M-i" gnus-symbolic-argument
1761 "h" gnus-summary-select-article-buffer
1763 "b" gnus-article-view-part
1764 "\M-t" gnus-summary-toggle-display-buttonized
1766 "V" gnus-summary-score-map
1767 "X" gnus-uu-extract-map
1768 "S" gnus-summary-send-map)
1770 ;; Sort of orthogonal keymap
1771 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1772 "t" gnus-summary-tick-article-forward
1773 "!" gnus-summary-tick-article-forward
1774 "d" gnus-summary-mark-as-read-forward
1775 "r" gnus-summary-mark-as-read-forward
1776 "c" gnus-summary-clear-mark-forward
1777 " " gnus-summary-clear-mark-forward
1778 "e" gnus-summary-mark-as-expirable
1779 "x" gnus-summary-mark-as-expirable
1780 "?" gnus-summary-mark-as-dormant
1781 "b" gnus-summary-set-bookmark
1782 "B" gnus-summary-remove-bookmark
1783 "#" gnus-summary-mark-as-processable
1784 "\M-#" gnus-summary-unmark-as-processable
1785 "S" gnus-summary-limit-include-expunged
1786 "C" gnus-summary-catchup
1787 "H" gnus-summary-catchup-to-here
1788 "h" gnus-summary-catchup-from-here
1789 "\C-c" gnus-summary-catchup-all
1790 "k" gnus-summary-kill-same-subject-and-select
1791 "K" gnus-summary-kill-same-subject
1792 "P" gnus-uu-mark-map)
1794 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1795 "c" gnus-summary-clear-above
1796 "u" gnus-summary-tick-above
1797 "m" gnus-summary-mark-above
1798 "k" gnus-summary-kill-below)
1800 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1801 "/" gnus-summary-limit-to-subject
1802 "n" gnus-summary-limit-to-articles
1803 "w" gnus-summary-pop-limit
1804 "s" gnus-summary-limit-to-subject
1805 "a" gnus-summary-limit-to-author
1806 "u" gnus-summary-limit-to-unread
1807 "m" gnus-summary-limit-to-marks
1808 "M" gnus-summary-limit-exclude-marks
1809 "v" gnus-summary-limit-to-score
1810 "*" gnus-summary-limit-include-cached
1811 "D" gnus-summary-limit-include-dormant
1812 "T" gnus-summary-limit-include-thread
1813 "d" gnus-summary-limit-exclude-dormant
1814 "t" gnus-summary-limit-to-age
1815 "." gnus-summary-limit-to-unseen
1816 "x" gnus-summary-limit-to-extra
1817 "p" gnus-summary-limit-to-display-predicate
1818 "E" gnus-summary-limit-include-expunged
1819 "c" gnus-summary-limit-exclude-childless-dormant
1820 "C" gnus-summary-limit-mark-excluded-as-read
1821 "o" gnus-summary-insert-old-articles
1822 "N" gnus-summary-insert-new-articles
1823 "r" gnus-summary-limit-to-replied)
1825 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1826 "n" gnus-summary-next-unread-article
1827 "p" gnus-summary-prev-unread-article
1828 "N" gnus-summary-next-article
1829 "P" gnus-summary-prev-article
1830 "\C-n" gnus-summary-next-same-subject
1831 "\C-p" gnus-summary-prev-same-subject
1832 "\M-n" gnus-summary-next-unread-subject
1833 "\M-p" gnus-summary-prev-unread-subject
1834 "f" gnus-summary-first-unread-article
1835 "b" gnus-summary-best-unread-article
1836 "j" gnus-summary-goto-article
1837 "g" gnus-summary-goto-subject
1838 "l" gnus-summary-goto-last-article
1839 "o" gnus-summary-pop-article)
1841 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1842 "k" gnus-summary-kill-thread
1843 "l" gnus-summary-lower-thread
1844 "i" gnus-summary-raise-thread
1845 "T" gnus-summary-toggle-threads
1846 "t" gnus-summary-rethread-current
1847 "^" gnus-summary-reparent-thread
1848 "s" gnus-summary-show-thread
1849 "S" gnus-summary-show-all-threads
1850 "h" gnus-summary-hide-thread
1851 "H" gnus-summary-hide-all-threads
1852 "n" gnus-summary-next-thread
1853 "p" gnus-summary-prev-thread
1854 "u" gnus-summary-up-thread
1855 "o" gnus-summary-top-thread
1856 "d" gnus-summary-down-thread
1857 "#" gnus-uu-mark-thread
1858 "\M-#" gnus-uu-unmark-thread)
1860 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1861 "g" gnus-summary-prepare
1862 "c" gnus-summary-insert-cached-articles
1863 "d" gnus-summary-insert-dormant-articles)
1865 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1866 "c" gnus-summary-catchup-and-exit
1867 "C" gnus-summary-catchup-all-and-exit
1868 "E" gnus-summary-exit-no-update
1869 "Q" gnus-summary-exit
1870 "Z" gnus-summary-exit
1871 "n" gnus-summary-catchup-and-goto-next-group
1872 "R" gnus-summary-reselect-current-group
1873 "G" gnus-summary-rescan-group
1874 "N" gnus-summary-next-group
1875 "s" gnus-summary-save-newsrc
1876 "P" gnus-summary-prev-group)
1878 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1879 " " gnus-summary-next-page
1880 "n" gnus-summary-next-page
1881 "\177" gnus-summary-prev-page
1882 [delete] gnus-summary-prev-page
1883 "p" gnus-summary-prev-page
1884 "\r" gnus-summary-scroll-up
1885 "\M-\r" gnus-summary-scroll-down
1886 "<" gnus-summary-beginning-of-article
1887 ">" gnus-summary-end-of-article
1888 "b" gnus-summary-beginning-of-article
1889 "e" gnus-summary-end-of-article
1890 "^" gnus-summary-refer-parent-article
1891 "r" gnus-summary-refer-parent-article
1892 "D" gnus-summary-enter-digest-group
1893 "R" gnus-summary-refer-references
1894 "T" gnus-summary-refer-thread
1895 "g" gnus-summary-show-article
1896 "s" gnus-summary-isearch-article
1897 "P" gnus-summary-print-article
1898 "M" gnus-mailing-list-insinuate
1899 "t" gnus-article-babel)
1901 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1902 "b" gnus-article-add-buttons
1903 "B" gnus-article-add-buttons-to-head
1904 "o" gnus-article-treat-overstrike
1905 "e" gnus-article-emphasize
1906 "w" gnus-article-fill-cited-article
1907 "Q" gnus-article-fill-long-lines
1908 "C" gnus-article-capitalize-sentences
1909 "c" gnus-article-remove-cr
1910 "q" gnus-article-de-quoted-unreadable
1911 "6" gnus-article-de-base64-unreadable
1912 "Z" gnus-article-decode-HZ
1913 "A" gnus-article-treat-ansi-sequences
1914 "h" gnus-article-wash-html
1915 "u" gnus-article-unsplit-urls
1916 "s" gnus-summary-force-verify-and-decrypt
1917 "f" gnus-article-display-x-face
1918 "l" gnus-summary-stop-page-breaking
1919 "r" gnus-summary-caesar-message
1920 "m" gnus-summary-morse-message
1921 "t" gnus-summary-toggle-header
1922 "g" gnus-treat-smiley
1923 "v" gnus-summary-verbose-headers
1924 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1925 "p" gnus-article-verify-x-pgp-sig
1926 "d" gnus-article-treat-dumbquotes)
1928 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1929 ;; mnemonic: deuglif*Y*
1930 "u" gnus-article-outlook-unwrap-lines
1931 "a" gnus-article-outlook-repair-attribution
1932 "c" gnus-article-outlook-rearrange-citation
1933 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1935 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1936 "a" gnus-article-hide
1937 "h" gnus-article-hide-headers
1938 "b" gnus-article-hide-boring-headers
1939 "s" gnus-article-hide-signature
1940 "c" gnus-article-hide-citation
1941 "C" gnus-article-hide-citation-in-followups
1942 "l" gnus-article-hide-list-identifiers
1943 "B" gnus-article-strip-banner
1944 "P" gnus-article-hide-pem
1945 "\C-c" gnus-article-hide-citation-maybe)
1947 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1948 "a" gnus-article-highlight
1949 "h" gnus-article-highlight-headers
1950 "c" gnus-article-highlight-citation
1951 "s" gnus-article-highlight-signature)
1953 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1954 "f" gnus-article-treat-fold-headers
1955 "u" gnus-article-treat-unfold-headers
1956 "n" gnus-article-treat-fold-newsgroups)
1958 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1959 "x" gnus-article-display-x-face
1960 "d" gnus-article-display-face
1961 "s" gnus-treat-smiley
1962 "D" gnus-article-remove-images
1963 "f" gnus-treat-from-picon
1964 "m" gnus-treat-mail-picon
1965 "n" gnus-treat-newsgroups-picon)
1967 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1968 "w" gnus-article-decode-mime-words
1969 "c" gnus-article-decode-charset
1970 "v" gnus-mime-view-all-parts
1971 "b" gnus-article-view-part)
1973 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1974 "z" gnus-article-date-ut
1975 "u" gnus-article-date-ut
1976 "l" gnus-article-date-local
1977 "p" gnus-article-date-english
1978 "e" gnus-article-date-lapsed
1979 "o" gnus-article-date-original
1980 "i" gnus-article-date-iso8601
1981 "s" gnus-article-date-user)
1983 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1984 "t" gnus-article-remove-trailing-blank-lines
1985 "l" gnus-article-strip-leading-blank-lines
1986 "m" gnus-article-strip-multiple-blank-lines
1987 "a" gnus-article-strip-blank-lines
1988 "A" gnus-article-strip-all-blank-lines
1989 "s" gnus-article-strip-leading-space
1990 "e" gnus-article-strip-trailing-space
1991 "w" gnus-article-remove-leading-whitespace)
1993 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1995 "f" gnus-summary-fetch-faq
1996 "d" gnus-summary-describe-group
1997 "h" gnus-summary-describe-briefly
1998 "i" gnus-info-find-node
1999 "c" gnus-group-fetch-charter
2000 "C" gnus-group-fetch-control)
2002 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2003 "e" gnus-summary-expire-articles
2004 "\M-\C-e" gnus-summary-expire-articles-now
2005 "\177" gnus-summary-delete-article
2006 [delete] gnus-summary-delete-article
2007 [backspace] gnus-summary-delete-article
2008 "m" gnus-summary-move-article
2009 "r" gnus-summary-respool-article
2010 "w" gnus-summary-edit-article
2011 "c" gnus-summary-copy-article
2012 "B" gnus-summary-crosspost-article
2013 "q" gnus-summary-respool-query
2014 "t" gnus-summary-respool-trace
2015 "i" gnus-summary-import-article
2016 "I" gnus-summary-create-article
2017 "p" gnus-summary-article-posted-p)
2019 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2020 "o" gnus-summary-save-article
2021 "m" gnus-summary-save-article-mail
2022 "F" gnus-summary-write-article-file
2023 "r" gnus-summary-save-article-rmail
2024 "f" gnus-summary-save-article-file
2025 "b" gnus-summary-save-article-body-file
2026 "h" gnus-summary-save-article-folder
2027 "v" gnus-summary-save-article-vm
2028 "p" gnus-summary-pipe-output
2029 "P" gnus-summary-muttprint
2030 "s" gnus-soup-add-article)
2032 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2033 "b" gnus-summary-display-buttonized
2034 "m" gnus-summary-repair-multipart
2035 "v" gnus-article-view-part
2036 "o" gnus-article-save-part
2037 "c" gnus-article-copy-part
2038 "C" gnus-article-view-part-as-charset
2039 "e" gnus-article-view-part-externally
2040 "E" gnus-article-encrypt-body
2041 "i" gnus-article-inline-part
2042 "|" gnus-article-pipe-part)
2044 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2045 "p" gnus-summary-mark-as-processable
2046 "u" gnus-summary-unmark-as-processable
2047 "U" gnus-summary-unmark-all-processable
2048 "v" gnus-uu-mark-over
2049 "s" gnus-uu-mark-series
2050 "r" gnus-uu-mark-region
2051 "g" gnus-uu-unmark-region
2052 "R" gnus-uu-mark-by-regexp
2053 "G" gnus-uu-unmark-by-regexp
2054 "t" gnus-uu-mark-thread
2055 "T" gnus-uu-unmark-thread
2056 "a" gnus-uu-mark-all
2057 "b" gnus-uu-mark-buffer
2058 "S" gnus-uu-mark-sparse
2059 "k" gnus-summary-kill-process-mark
2060 "y" gnus-summary-yank-process-mark
2061 "w" gnus-summary-save-process-mark
2062 "i" gnus-uu-invert-processable)
2064 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2065 ;;"x" gnus-uu-extract-any
2066 "m" gnus-summary-save-parts
2067 "u" gnus-uu-decode-uu
2068 "U" gnus-uu-decode-uu-and-save
2069 "s" gnus-uu-decode-unshar
2070 "S" gnus-uu-decode-unshar-and-save
2071 "o" gnus-uu-decode-save
2072 "O" gnus-uu-decode-save
2073 "b" gnus-uu-decode-binhex
2074 "B" gnus-uu-decode-binhex
2075 "p" gnus-uu-decode-postscript
2076 "P" gnus-uu-decode-postscript-and-save)
2079 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2080 "u" gnus-uu-decode-uu-view
2081 "U" gnus-uu-decode-uu-and-save-view
2082 "s" gnus-uu-decode-unshar-view
2083 "S" gnus-uu-decode-unshar-and-save-view
2084 "o" gnus-uu-decode-save-view
2085 "O" gnus-uu-decode-save-view
2086 "b" gnus-uu-decode-binhex-view
2087 "B" gnus-uu-decode-binhex-view
2088 "p" gnus-uu-decode-postscript-view
2089 "P" gnus-uu-decode-postscript-and-save-view)
2091 (defvar gnus-article-post-menu nil)
2093 (defconst gnus-summary-menu-maxlen 20)
2095 (defun gnus-summary-menu-split (menu)
2096 ;; If we have lots of elements, divide them into groups of 20
2097 ;; and make a pane (or submenu) for each one.
2098 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2099 (let ((menu menu) sublists next
2102 ;; Pull off the next gnus-summary-menu-maxlen elements
2103 ;; and make them the next element of sublist.
2104 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2106 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2108 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2109 (aref (car (last menu)) 0)) menu)
2113 (nreverse sublists))
2114 ;; Few elements--put them all in one pane.
2117 (defun gnus-summary-make-menu-bar ()
2118 (gnus-turn-off-edit-menu 'summary)
2120 (unless (boundp 'gnus-summary-misc-menu)
2123 gnus-summary-kill-menu gnus-summary-mode-map ""
2128 ["Customize" gnus-score-customize t])
2129 (gnus-make-score-map 'increase)
2130 (gnus-make-score-map 'lower)
2132 ["Kill below" gnus-summary-kill-below t]
2133 ["Mark above" gnus-summary-mark-above t]
2134 ["Tick above" gnus-summary-tick-above t]
2135 ["Clear above" gnus-summary-clear-above t])
2136 ["Current score" gnus-summary-current-score t]
2137 ["Set score" gnus-summary-set-score t]
2138 ["Switch current score file..." gnus-score-change-score-file t]
2139 ["Set mark below..." gnus-score-set-mark-below t]
2140 ["Set expunge below..." gnus-score-set-expunge-below t]
2141 ["Edit current score file" gnus-score-edit-current-scores t]
2142 ["Edit score file" gnus-score-edit-file t]
2143 ["Trace score" gnus-score-find-trace t]
2144 ["Find words" gnus-score-find-favourite-words t]
2145 ["Rescore buffer" gnus-summary-rescore t]
2146 ["Increase score..." gnus-summary-increase-score t]
2147 ["Lower score..." gnus-summary-lower-score t]))))
2149 ;; Define both the Article menu in the summary buffer and the
2150 ;; equivalent Commands menu in the article buffer here for
2154 ["All" gnus-article-hide t]
2155 ["Headers" gnus-article-hide-headers t]
2156 ["Signature" gnus-article-hide-signature t]
2157 ["Citation" gnus-article-hide-citation t]
2158 ["List identifiers" gnus-article-hide-list-identifiers t]
2159 ["Banner" gnus-article-strip-banner t]
2160 ["Boring headers" gnus-article-hide-boring-headers t])
2162 ["All" gnus-article-highlight t]
2163 ["Headers" gnus-article-highlight-headers t]
2164 ["Signature" gnus-article-highlight-signature t]
2165 ["Citation" gnus-article-highlight-citation t])
2167 ["Words" gnus-article-decode-mime-words t]
2168 ["Charset" gnus-article-decode-charset t]
2169 ["QP" gnus-article-de-quoted-unreadable t]
2170 ["Base64" gnus-article-de-base64-unreadable t]
2171 ["View MIME buttons" gnus-summary-display-buttonized t]
2172 ["View all" gnus-mime-view-all-parts t]
2173 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2174 ["Encrypt body" gnus-article-encrypt-body
2175 :active (not (gnus-group-read-only-p))
2176 ,@(if (featurep 'xemacs) nil
2177 '(:help "Encrypt the message body on disk"))]
2178 ["Extract all parts..." gnus-summary-save-parts t]
2180 ["Repair multipart" gnus-summary-repair-multipart t]
2181 ["Pipe part..." gnus-article-pipe-part t]
2182 ["Inline part" gnus-article-inline-part t]
2183 ["Encrypt body" gnus-article-encrypt-body
2184 :active (not (gnus-group-read-only-p))
2185 ,@(if (featurep 'xemacs) nil
2186 '(:help "Encrypt the message body on disk"))]
2187 ["View part externally" gnus-article-view-part-externally t]
2188 ["View part with charset..." gnus-article-view-part-as-charset t]
2189 ["Copy part" gnus-article-copy-part t]
2190 ["Save part..." gnus-article-save-part t]
2191 ["View part" gnus-article-view-part t]))
2193 ["Local" gnus-article-date-local t]
2194 ["ISO8601" gnus-article-date-iso8601 t]
2195 ["UT" gnus-article-date-ut t]
2196 ["Original" gnus-article-date-original t]
2197 ["Lapsed" gnus-article-date-lapsed t]
2198 ["User-defined" gnus-article-date-user t])
2200 ["Remove images" gnus-article-remove-images t]
2201 ["Toggle smiley" gnus-treat-smiley t]
2202 ["Show X-Face" gnus-article-display-x-face t]
2203 ["Show picons in From" gnus-treat-from-picon t]
2204 ["Show picons in mail headers" gnus-treat-mail-picon t]
2205 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2206 ("View as different encoding"
2207 ,@(gnus-summary-menu-split
2210 ;; Since easymenu under Emacs doesn't allow
2211 ;; lambda forms for menu commands, we should
2212 ;; provide intern'ed function symbols.
2213 (let ((command (intern (format "\
2214 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2218 (let ((gnus-summary-show-article-charset-alist
2220 (gnus-summary-show-article 1))))
2221 `[,(symbol-name cs) ,command t]))
2222 (sort (if (fboundp 'coding-system-list)
2223 (coding-system-list)
2224 (mapcar 'car mm-mime-mule-charset-alist))
2228 ["Leading" gnus-article-strip-leading-blank-lines t]
2229 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2230 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2231 ["All of the above" gnus-article-strip-blank-lines t]
2232 ["All" gnus-article-strip-all-blank-lines t]
2233 ["Leading space" gnus-article-strip-leading-space t]
2234 ["Trailing space" gnus-article-strip-trailing-space t]
2235 ["Leading space in headers"
2236 gnus-article-remove-leading-whitespace t])
2237 ["Overstrike" gnus-article-treat-overstrike t]
2238 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2239 ["Emphasis" gnus-article-emphasize t]
2240 ["Word wrap" gnus-article-fill-cited-article t]
2241 ["Fill long lines" gnus-article-fill-long-lines t]
2242 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2243 ["Remove CR" gnus-article-remove-cr t]
2244 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2245 ["Base64" gnus-article-de-base64-unreadable t]
2246 ["Rot 13" gnus-summary-caesar-message
2247 ,@(if (featurep 'xemacs) '(t)
2248 '(:help "\"Caesar rotate\" article by 13"))]
2249 ["Morse decode" gnus-summary-morse-message t]
2250 ["Unix pipe..." gnus-summary-pipe-message t]
2251 ["Add buttons" gnus-article-add-buttons t]
2252 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2253 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2254 ["Verbose header" gnus-summary-verbose-headers t]
2255 ["Toggle header" gnus-summary-toggle-header t]
2256 ["Unfold headers" gnus-article-treat-unfold-headers t]
2257 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2258 ["Html" gnus-article-wash-html t]
2259 ["Unsplit URLs" gnus-article-unsplit-urls t]
2260 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2261 ["Decode HZ" gnus-article-decode-HZ t]
2262 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2263 ("(Outlook) Deuglify"
2264 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2265 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2266 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2267 ["Full (Outlook) deuglify"
2268 gnus-article-outlook-deuglify-article t])
2271 ["Save in default format..." gnus-summary-save-article
2272 ,@(if (featurep 'xemacs) '(t)
2273 '(:help "Save article using default method"))]
2274 ["Save in file..." gnus-summary-save-article-file
2275 ,@(if (featurep 'xemacs) '(t)
2276 '(:help "Save article in file"))]
2277 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2278 ["Save in MH folder..." gnus-summary-save-article-folder t]
2279 ["Save in VM folder..." gnus-summary-save-article-vm t]
2280 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2281 ["Save body in file..." gnus-summary-save-article-body-file t]
2282 ["Pipe through a filter..." gnus-summary-pipe-output t]
2283 ["Add to SOUP packet" gnus-soup-add-article t]
2284 ["Print with Muttprint..." gnus-summary-muttprint t]
2285 ["Print" gnus-summary-print-article t])
2287 ["Respool article..." gnus-summary-respool-article t]
2288 ["Move article..." gnus-summary-move-article
2289 (gnus-check-backend-function
2290 'request-move-article gnus-newsgroup-name)]
2291 ["Copy article..." gnus-summary-copy-article t]
2292 ["Crosspost article..." gnus-summary-crosspost-article
2293 (gnus-check-backend-function
2294 'request-replace-article gnus-newsgroup-name)]
2295 ["Import file..." gnus-summary-import-article
2296 (gnus-check-backend-function
2297 'request-accept-article gnus-newsgroup-name)]
2298 ["Create article..." gnus-summary-create-article
2299 (gnus-check-backend-function
2300 'request-accept-article gnus-newsgroup-name)]
2301 ["Check if posted" gnus-summary-article-posted-p t]
2302 ["Edit article" gnus-summary-edit-article
2303 (not (gnus-group-read-only-p))]
2304 ["Delete article" gnus-summary-delete-article
2305 (gnus-check-backend-function
2306 'request-expire-articles gnus-newsgroup-name)]
2307 ["Query respool" gnus-summary-respool-query t]
2308 ["Trace respool" gnus-summary-respool-trace t]
2309 ["Delete expirable articles" gnus-summary-expire-articles-now
2310 (gnus-check-backend-function
2311 'request-expire-articles gnus-newsgroup-name)])
2313 ["Uudecode" gnus-uu-decode-uu
2314 ,@(if (featurep 'xemacs) '(t)
2315 '(:help "Decode uuencoded article(s)"))]
2316 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2317 ["Unshar" gnus-uu-decode-unshar t]
2318 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2319 ["Save" gnus-uu-decode-save t]
2320 ["Binhex" gnus-uu-decode-binhex t]
2321 ["Postscript" gnus-uu-decode-postscript t]
2322 ["All MIME parts" gnus-summary-save-parts t])
2324 ["Enter article" gnus-cache-enter-article t]
2325 ["Remove article" gnus-cache-remove-article t])
2326 ["Translate" gnus-article-babel t]
2327 ["Select article buffer" gnus-summary-select-article-buffer t]
2328 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2329 ["Isearch article..." gnus-summary-isearch-article t]
2330 ["Beginning of the article" gnus-summary-beginning-of-article t]
2331 ["End of the article" gnus-summary-end-of-article t]
2332 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2333 ["Fetch referenced articles" gnus-summary-refer-references t]
2334 ["Fetch current thread" gnus-summary-refer-thread t]
2335 ["Fetch article with id..." gnus-summary-refer-article t]
2336 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2337 ["Redisplay" gnus-summary-show-article t]
2338 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2340 gnus-summary-article-menu gnus-summary-mode-map ""
2341 (cons "Article" innards))
2343 (if (not (keymapp gnus-summary-article-menu))
2345 gnus-article-commands-menu gnus-article-mode-map ""
2346 (cons "Commands" innards))
2347 ;; in Emacs, don't share menu.
2348 (setq gnus-article-commands-menu
2349 (copy-keymap gnus-summary-article-menu))
2350 (define-key gnus-article-mode-map [menu-bar commands]
2351 (cons "Commands" gnus-article-commands-menu))))
2354 gnus-summary-thread-menu gnus-summary-mode-map ""
2356 ["Find all messages in thread" gnus-summary-refer-thread t]
2357 ["Toggle threading" gnus-summary-toggle-threads t]
2358 ["Hide threads" gnus-summary-hide-all-threads t]
2359 ["Show threads" gnus-summary-show-all-threads t]
2360 ["Hide thread" gnus-summary-hide-thread t]
2361 ["Show thread" gnus-summary-show-thread t]
2362 ["Go to next thread" gnus-summary-next-thread t]
2363 ["Go to previous thread" gnus-summary-prev-thread t]
2364 ["Go down thread" gnus-summary-down-thread t]
2365 ["Go up thread" gnus-summary-up-thread t]
2366 ["Top of thread" gnus-summary-top-thread t]
2367 ["Mark thread as read" gnus-summary-kill-thread t]
2368 ["Lower thread score" gnus-summary-lower-thread t]
2369 ["Raise thread score" gnus-summary-raise-thread t]
2370 ["Rethread current" gnus-summary-rethread-current t]))
2373 gnus-summary-post-menu gnus-summary-mode-map ""
2375 ["Send a message (mail or news)" gnus-summary-post-news
2376 ,@(if (featurep 'xemacs) '(t)
2377 '(:help "Post an article"))]
2378 ["Followup" gnus-summary-followup
2379 ,@(if (featurep 'xemacs) '(t)
2380 '(:help "Post followup to this article"))]
2381 ["Followup and yank" gnus-summary-followup-with-original
2382 ,@(if (featurep 'xemacs) '(t)
2383 '(:help "Post followup to this article, quoting its contents"))]
2384 ["Supersede article" gnus-summary-supersede-article t]
2385 ["Cancel article" gnus-summary-cancel-article
2386 ,@(if (featurep 'xemacs) '(t)
2387 '(:help "Cancel an article you posted"))]
2388 ["Reply" gnus-summary-reply t]
2389 ["Reply and yank" gnus-summary-reply-with-original t]
2390 ["Wide reply" gnus-summary-wide-reply t]
2391 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2392 ,@(if (featurep 'xemacs) '(t)
2393 '(:help "Mail a reply, quoting this article"))]
2394 ["Very wide reply" gnus-summary-very-wide-reply t]
2395 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2396 ,@(if (featurep 'xemacs) '(t)
2397 '(:help "Mail a very wide reply, quoting this article"))]
2398 ["Mail forward" gnus-summary-mail-forward t]
2399 ["Post forward" gnus-summary-post-forward t]
2400 ["Digest and mail" gnus-uu-digest-mail-forward t]
2401 ["Digest and post" gnus-uu-digest-post-forward t]
2402 ["Resend message" gnus-summary-resend-message t]
2403 ["Resend message edit" gnus-summary-resend-message-edit t]
2404 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2405 ["Send a mail" gnus-summary-mail-other-window t]
2406 ["Create a local message" gnus-summary-news-other-window t]
2407 ["Uuencode and post" gnus-uu-post-news
2408 ,@(if (featurep 'xemacs) '(t)
2409 '(:help "Post a uuencoded article"))]
2410 ["Followup via news" gnus-summary-followup-to-mail t]
2411 ["Followup via news and yank"
2412 gnus-summary-followup-to-mail-with-original t]
2414 ;;["Send" gnus-summary-send-draft t]
2415 ;;["Send bounced" gnus-resend-bounced-mail t])
2419 ((not (keymapp gnus-summary-post-menu))
2420 (setq gnus-article-post-menu gnus-summary-post-menu))
2421 ((not gnus-article-post-menu)
2422 ;; Don't share post menu.
2423 (setq gnus-article-post-menu
2424 (copy-keymap gnus-summary-post-menu))))
2425 (define-key gnus-article-mode-map [menu-bar post]
2426 (cons "Post" gnus-article-post-menu))
2429 gnus-summary-misc-menu gnus-summary-mode-map ""
2432 ["Mark as read" gnus-summary-mark-as-read-forward t]
2433 ["Mark same subject and select"
2434 gnus-summary-kill-same-subject-and-select t]
2435 ["Mark same subject" gnus-summary-kill-same-subject t]
2436 ["Catchup" gnus-summary-catchup
2437 ,@(if (featurep 'xemacs) '(t)
2438 '(:help "Mark unread articles in this group as read"))]
2439 ["Catchup all" gnus-summary-catchup-all t]
2440 ["Catchup to here" gnus-summary-catchup-to-here t]
2441 ["Catchup from here" gnus-summary-catchup-from-here t]
2442 ["Catchup region" gnus-summary-mark-region-as-read
2443 (gnus-mark-active-p)]
2444 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2446 ["Tick" gnus-summary-tick-article-forward t]
2447 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2448 ["Remove marks" gnus-summary-clear-mark-forward t]
2449 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2450 ["Set bookmark" gnus-summary-set-bookmark t]
2451 ["Remove bookmark" gnus-summary-remove-bookmark t])
2453 ["Marks..." gnus-summary-limit-to-marks t]
2454 ["Subject..." gnus-summary-limit-to-subject t]
2455 ["Author..." gnus-summary-limit-to-author t]
2456 ["Age..." gnus-summary-limit-to-age t]
2457 ["Extra..." gnus-summary-limit-to-extra t]
2458 ["Score..." gnus-summary-limit-to-score t]
2459 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2460 ["Unread" gnus-summary-limit-to-unread t]
2461 ["Unseen" gnus-summary-limit-to-unseen t]
2462 ["Replied" gnus-summary-limit-to-replied t]
2463 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2464 ["Next articles" gnus-summary-limit-to-articles t]
2465 ["Pop limit" gnus-summary-pop-limit t]
2466 ["Show dormant" gnus-summary-limit-include-dormant t]
2467 ["Hide childless dormant"
2468 gnus-summary-limit-exclude-childless-dormant t]
2469 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2470 ["Hide marked" gnus-summary-limit-exclude-marks t]
2471 ["Show expunged" gnus-summary-limit-include-expunged t])
2473 ["Set mark" gnus-summary-mark-as-processable t]
2474 ["Remove mark" gnus-summary-unmark-as-processable t]
2475 ["Remove all marks" gnus-summary-unmark-all-processable t]
2476 ["Mark above" gnus-uu-mark-over t]
2477 ["Mark series" gnus-uu-mark-series t]
2478 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2479 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2480 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2481 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2482 ["Mark all" gnus-uu-mark-all t]
2483 ["Mark buffer" gnus-uu-mark-buffer t]
2484 ["Mark sparse" gnus-uu-mark-sparse t]
2485 ["Mark thread" gnus-uu-mark-thread t]
2486 ["Unmark thread" gnus-uu-unmark-thread t]
2487 ("Process Mark Sets"
2488 ["Kill" gnus-summary-kill-process-mark t]
2489 ["Yank" gnus-summary-yank-process-mark
2490 gnus-newsgroup-process-stack]
2491 ["Save" gnus-summary-save-process-mark t]
2492 ["Run command on marked..." gnus-summary-universal-argument t]))
2494 ["Page forward" gnus-summary-next-page
2495 ,@(if (featurep 'xemacs) '(t)
2496 '(:help "Show next page of article"))]
2497 ["Page backward" gnus-summary-prev-page
2498 ,@(if (featurep 'xemacs) '(t)
2499 '(:help "Show previous page of article"))]
2500 ["Line forward" gnus-summary-scroll-up t])
2502 ["Next unread article" gnus-summary-next-unread-article t]
2503 ["Previous unread article" gnus-summary-prev-unread-article t]
2504 ["Next article" gnus-summary-next-article t]
2505 ["Previous article" gnus-summary-prev-article t]
2506 ["Next unread subject" gnus-summary-next-unread-subject t]
2507 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2508 ["Next article same subject" gnus-summary-next-same-subject t]
2509 ["Previous article same subject" gnus-summary-prev-same-subject t]
2510 ["First unread article" gnus-summary-first-unread-article t]
2511 ["Best unread article" gnus-summary-best-unread-article t]
2512 ["Go to subject number..." gnus-summary-goto-subject t]
2513 ["Go to article number..." gnus-summary-goto-article t]
2514 ["Go to the last article" gnus-summary-goto-last-article t]
2515 ["Pop article off history" gnus-summary-pop-article t])
2517 ["Sort by number" gnus-summary-sort-by-number t]
2518 ["Sort by author" gnus-summary-sort-by-author t]
2519 ["Sort by subject" gnus-summary-sort-by-subject t]
2520 ["Sort by date" gnus-summary-sort-by-date t]
2521 ["Sort by score" gnus-summary-sort-by-score t]
2522 ["Sort by lines" gnus-summary-sort-by-lines t]
2523 ["Sort by characters" gnus-summary-sort-by-chars t]
2524 ["Randomize" gnus-summary-sort-by-random t]
2525 ["Original sort" gnus-summary-sort-by-original t])
2527 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2528 ["Describe group" gnus-summary-describe-group t]
2529 ["Fetch charter" gnus-group-fetch-charter
2530 ,@(if (featurep 'xemacs) nil
2531 '(:help "Display the charter of the current group"))]
2532 ["Fetch control message" gnus-group-fetch-control
2533 ,@(if (featurep 'xemacs) nil
2534 '(:help "Display the archived control message for the current group"))]
2535 ["Read manual" gnus-info-find-node t])
2537 ["Pick and read" gnus-pick-mode t]
2538 ["Binary" gnus-binary-mode t])
2540 ["Regenerate" gnus-summary-prepare t]
2541 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2542 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2543 ["Toggle threading" gnus-summary-toggle-threads t])
2544 ["See old articles" gnus-summary-insert-old-articles t]
2545 ["See new articles" gnus-summary-insert-new-articles t]
2546 ["Filter articles..." gnus-summary-execute-command t]
2547 ["Run command on articles..." gnus-summary-universal-argument t]
2548 ["Search articles forward..." gnus-summary-search-article-forward t]
2549 ["Search articles backward..." gnus-summary-search-article-backward t]
2550 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2551 ["Expand window" gnus-summary-expand-window t]
2552 ["Expire expirable articles" gnus-summary-expire-articles
2553 (gnus-check-backend-function
2554 'request-expire-articles gnus-newsgroup-name)]
2555 ["Edit local kill file" gnus-summary-edit-local-kill t]
2556 ["Edit main kill file" gnus-summary-edit-global-kill t]
2557 ["Edit group parameters" gnus-summary-edit-parameters t]
2558 ["Customize group parameters" gnus-summary-customize-parameters t]
2559 ["Send a bug report" gnus-bug t]
2561 ["Catchup and exit" gnus-summary-catchup-and-exit
2562 ,@(if (featurep 'xemacs) '(t)
2563 '(:help "Mark unread articles in this group as read, then exit"))]
2564 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2565 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2566 ["Exit group" gnus-summary-exit
2567 ,@(if (featurep 'xemacs) '(t)
2568 '(:help "Exit current group, return to group selection mode"))]
2569 ["Exit group without updating" gnus-summary-exit-no-update t]
2570 ["Exit and goto next group" gnus-summary-next-group t]
2571 ["Exit and goto prev group" gnus-summary-prev-group t]
2572 ["Reselect group" gnus-summary-reselect-current-group t]
2573 ["Rescan group" gnus-summary-rescan-group t]
2574 ["Update dribble" gnus-summary-save-newsrc t])))
2576 (gnus-run-hooks 'gnus-summary-menu-hook)))
2578 (defvar gnus-summary-tool-bar-map nil)
2580 ;; Emacs 21 tool bar. Should be no-op otherwise.
2581 (defun gnus-summary-make-tool-bar ()
2582 (if (and (fboundp 'tool-bar-add-item-from-menu)
2583 (default-value 'tool-bar-mode)
2584 (not gnus-summary-tool-bar-map))
2585 (setq gnus-summary-tool-bar-map
2586 (let ((tool-bar-map (make-sparse-keymap))
2587 (load-path (mm-image-load-path)))
2588 (tool-bar-add-item-from-menu
2589 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2590 (tool-bar-add-item-from-menu
2591 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2592 (tool-bar-add-item-from-menu
2593 'gnus-summary-post-news "post" gnus-summary-mode-map)
2594 (tool-bar-add-item-from-menu
2595 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2596 (tool-bar-add-item-from-menu
2597 'gnus-summary-followup "followup" gnus-summary-mode-map)
2598 (tool-bar-add-item-from-menu
2599 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2600 (tool-bar-add-item-from-menu
2601 'gnus-summary-reply "reply" gnus-summary-mode-map)
2602 (tool-bar-add-item-from-menu
2603 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2604 (tool-bar-add-item-from-menu
2605 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2606 (tool-bar-add-item-from-menu
2607 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2608 (tool-bar-add-item-from-menu
2609 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2610 (tool-bar-add-item-from-menu
2611 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2612 (tool-bar-add-item-from-menu
2613 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2614 (tool-bar-add-item-from-menu
2615 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2616 (tool-bar-add-item-from-menu
2617 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2618 (tool-bar-add-item-from-menu
2619 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2621 (if gnus-summary-tool-bar-map
2622 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2624 (defun gnus-score-set-default (var value)
2625 "A version of set that updates the GNU Emacs menu-bar."
2627 ;; It is the message that forces the active status to be updated.
2630 (defun gnus-make-score-map (type)
2631 "Make a summary score map of type TYPE."
2634 (let ((headers '(("author" "from" string)
2635 ("subject" "subject" string)
2636 ("article body" "body" string)
2637 ("article head" "head" string)
2638 ("xref" "xref" string)
2639 ("extra header" "extra" string)
2640 ("lines" "lines" number)
2641 ("followups to author" "followup" string)))
2642 (types '((number ("less than" <)
2645 (string ("substring" s)
2649 (perms '(("temporary" (current-time-string))
2657 (if (eq type 'lower)
2662 (setq header (car headers))
2668 (let ((ts (cdr (assoc (nth 2 header) types)))
2684 'gnus-summary-score-entry
2686 (if (or (string= (nth 1 header)
2688 (string= (nth 1 header)
2691 (list 'gnus-summary-header
2693 (list 'quote (nth 1 (car ts)))
2694 (list 'gnus-score-delta-default
2701 (list (nreverse outp))))
2704 (list (nreverse outt))))
2706 (setq headers (cdr headers)))
2707 (list (nreverse outh))))))))
2711 (defun gnus-summary-mode (&optional group)
2712 "Major mode for reading articles.
2714 All normal editing commands are switched off.
2715 \\<gnus-summary-mode-map>
2716 Each line in this buffer represents one article. To read an
2717 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2718 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2721 You can also post articles and send mail from this buffer. To
2722 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2723 of an article, type `\\[gnus-summary-reply]'.
2725 There are approx. one gazillion commands you can execute in this
2726 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2728 The following commands are available:
2730 \\{gnus-summary-mode-map}"
2732 (kill-all-local-variables)
2733 (when (gnus-visual-p 'summary-menu 'menu)
2734 (gnus-summary-make-menu-bar)
2735 (gnus-summary-make-tool-bar))
2736 (gnus-summary-make-local-variables)
2737 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2738 (gnus-summary-make-local-variables))
2739 (gnus-make-thread-indent-array)
2740 (gnus-simplify-mode-line)
2741 (setq major-mode 'gnus-summary-mode)
2742 (setq mode-name "Summary")
2743 (make-local-variable 'minor-mode-alist)
2744 (use-local-map gnus-summary-mode-map)
2745 (buffer-disable-undo)
2746 (setq buffer-read-only t ;Disable modification
2747 show-trailing-whitespace nil)
2748 (setq truncate-lines t)
2749 (setq selective-display t)
2750 (setq selective-display-ellipses t) ;Display `...'
2751 (gnus-summary-set-display-table)
2752 (gnus-set-default-directory)
2753 (setq gnus-newsgroup-name group)
2754 (make-local-variable 'gnus-summary-line-format)
2755 (make-local-variable 'gnus-summary-line-format-spec)
2756 (make-local-variable 'gnus-summary-dummy-line-format)
2757 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2758 (make-local-variable 'gnus-summary-mark-positions)
2759 (gnus-make-local-hook 'pre-command-hook)
2760 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2761 (gnus-run-hooks 'gnus-summary-mode-hook)
2762 (turn-on-gnus-mailing-list-mode)
2763 (mm-enable-multibyte)
2764 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2765 (gnus-update-summary-mark-positions))
2767 (defun gnus-summary-make-local-variables ()
2768 "Make all the local summary buffer variables."
2770 (dolist (local gnus-summary-local-variables)
2773 (if (eq (cdr local) 'global)
2774 ;; Copy the global value of the variable.
2775 (setq global (symbol-value (car local)))
2776 ;; Use the value from the list.
2777 (setq global (eval (cdr local))))
2778 (set (make-local-variable (car local)) global))
2779 ;; Simple nil-valued local variable.
2780 (set (make-local-variable local) nil)))))
2782 (defun gnus-summary-clear-local-variables ()
2783 (let ((locals gnus-summary-local-variables))
2785 (if (consp (car locals))
2786 (and (vectorp (caar locals))
2787 (set (caar locals) nil))
2788 (and (vectorp (car locals))
2789 (set (car locals) nil)))
2790 (setq locals (cdr locals)))))
2792 ;; Summary data functions.
2794 (defmacro gnus-data-number (data)
2797 (defmacro gnus-data-set-number (data number)
2798 `(setcar ,data ,number))
2800 (defmacro gnus-data-mark (data)
2803 (defmacro gnus-data-set-mark (data mark)
2804 `(setcar (nthcdr 1 ,data) ,mark))
2806 (defmacro gnus-data-pos (data)
2809 (defmacro gnus-data-set-pos (data pos)
2810 `(setcar (nthcdr 2 ,data) ,pos))
2812 (defmacro gnus-data-header (data)
2815 (defmacro gnus-data-set-header (data header)
2816 `(setf (nth 3 ,data) ,header))
2818 (defmacro gnus-data-level (data)
2821 (defmacro gnus-data-unread-p (data)
2822 `(= (nth 1 ,data) gnus-unread-mark))
2824 (defmacro gnus-data-read-p (data)
2825 `(/= (nth 1 ,data) gnus-unread-mark))
2827 (defmacro gnus-data-pseudo-p (data)
2828 `(consp (nth 3 ,data)))
2830 (defmacro gnus-data-find (number)
2831 `(assq ,number gnus-newsgroup-data))
2833 (defmacro gnus-data-find-list (number &optional data)
2834 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2835 (memq (assq ,number bdata)
2838 (defmacro gnus-data-make (number mark pos header level)
2839 `(list ,number ,mark ,pos ,header ,level))
2841 (defun gnus-data-enter (after-article number mark pos header level offset)
2842 (let ((data (gnus-data-find-list after-article)))
2844 (error "No such article: %d" after-article))
2845 (setcdr data (cons (gnus-data-make number mark pos header level)
2847 (setq gnus-newsgroup-data-reverse nil)
2848 (gnus-data-update-list (cddr data) offset)))
2850 (defun gnus-data-enter-list (after-article list &optional offset)
2852 (let ((data (and after-article (gnus-data-find-list after-article)))
2856 (let ((odata gnus-newsgroup-data))
2857 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2859 (gnus-data-update-list odata offset)))
2860 ;; Find the last element in the list to be spliced into the main
2863 (setq list (cdr list)))
2866 (setcdr list gnus-newsgroup-data)
2867 (setq gnus-newsgroup-data ilist)
2869 (gnus-data-update-list (cdr list) offset)))
2870 (setcdr list (cdr data))
2873 (gnus-data-update-list (cdr list) offset))))
2874 (setq gnus-newsgroup-data-reverse nil))))
2876 (defun gnus-data-remove (article &optional offset)
2877 (let ((data gnus-newsgroup-data))
2878 (if (= (gnus-data-number (car data)) article)
2880 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2881 gnus-newsgroup-data-reverse nil)
2883 (gnus-data-update-list gnus-newsgroup-data offset)))
2885 (when (= (gnus-data-number (cadr data)) article)
2886 (setcdr data (cddr data))
2888 (gnus-data-update-list (cdr data) offset))
2890 gnus-newsgroup-data-reverse nil))
2891 (setq data (cdr data))))))
2893 (defmacro gnus-data-list (backward)
2895 (or gnus-newsgroup-data-reverse
2896 (setq gnus-newsgroup-data-reverse
2897 (reverse gnus-newsgroup-data)))
2898 gnus-newsgroup-data))
2900 (defun gnus-data-update-list (data offset)
2901 "Add OFFSET to the POS of all data entries in DATA."
2902 (setq gnus-newsgroup-data-reverse nil)
2904 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2905 (setq data (cdr data))))
2907 (defun gnus-summary-article-pseudo-p (article)
2908 "Say whether this article is a pseudo article or not."
2909 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2911 (defmacro gnus-summary-article-sparse-p (article)
2912 "Say whether this article is a sparse article or not."
2913 `(memq ,article gnus-newsgroup-sparse))
2915 (defmacro gnus-summary-article-ancient-p (article)
2916 "Say whether this article is a sparse article or not."
2917 `(memq ,article gnus-newsgroup-ancient))
2919 (defun gnus-article-parent-p (number)
2920 "Say whether this article is a parent or not."
2921 (let ((data (gnus-data-find-list number)))
2922 (and (cdr data) ; There has to be an article after...
2923 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2924 (gnus-data-level (nth 1 data))))))
2926 (defun gnus-article-children (number)
2927 "Return a list of all children to NUMBER."
2928 (let* ((data (gnus-data-find-list number))
2929 (level (gnus-data-level (car data)))
2931 (setq data (cdr data))
2933 (= (gnus-data-level (car data)) (1+ level)))
2934 (push (gnus-data-number (car data)) children)
2935 (setq data (cdr data)))
2938 (defmacro gnus-summary-skip-intangible ()
2939 "If the current article is intangible, then jump to a different article."
2940 '(let ((to (get-text-property (point) 'gnus-intangible)))
2941 (and to (gnus-summary-goto-subject to))))
2943 (defmacro gnus-summary-article-intangible-p ()
2944 "Say whether this article is intangible or not."
2945 '(get-text-property (point) 'gnus-intangible))
2947 (defun gnus-article-read-p (article)
2948 "Say whether ARTICLE is read or not."
2949 (not (or (memq article gnus-newsgroup-marked)
2950 (memq article gnus-newsgroup-spam-marked)
2951 (memq article gnus-newsgroup-unreads)
2952 (memq article gnus-newsgroup-unselected)
2953 (memq article gnus-newsgroup-dormant))))
2955 ;; Some summary mode macros.
2957 (defmacro gnus-summary-article-number ()
2958 "The article number of the article on the current line.
2959 If there isn't an article number here, then we return the current
2962 (gnus-summary-skip-intangible)
2963 (or (get-text-property (point) 'gnus-number)
2964 (gnus-summary-last-subject))))
2966 (defmacro gnus-summary-article-header (&optional number)
2967 "Return the header of article NUMBER."
2968 `(gnus-data-header (gnus-data-find
2969 ,(or number '(gnus-summary-article-number)))))
2971 (defmacro gnus-summary-thread-level (&optional number)
2972 "Return the level of thread that starts with article NUMBER."
2973 `(if (and (eq gnus-summary-make-false-root 'dummy)
2974 (get-text-property (point) 'gnus-intangible))
2976 (gnus-data-level (gnus-data-find
2977 ,(or number '(gnus-summary-article-number))))))
2979 (defmacro gnus-summary-article-mark (&optional number)
2980 "Return the mark of article NUMBER."
2981 `(gnus-data-mark (gnus-data-find
2982 ,(or number '(gnus-summary-article-number)))))
2984 (defmacro gnus-summary-article-pos (&optional number)
2985 "Return the position of the line of article NUMBER."
2986 `(gnus-data-pos (gnus-data-find
2987 ,(or number '(gnus-summary-article-number)))))
2989 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2990 (defmacro gnus-summary-article-subject (&optional number)
2991 "Return current subject string or nil if nothing."
2994 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2995 '(gnus-data-header (assq (gnus-summary-article-number)
2996 gnus-newsgroup-data)))))
2999 (mail-header-subject headers))))
3001 (defmacro gnus-summary-article-score (&optional number)
3002 "Return current article score."
3003 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3004 gnus-newsgroup-scored))
3005 gnus-summary-default-score 0))
3007 (defun gnus-summary-article-children (&optional number)
3008 "Return a list of article numbers that are children of article NUMBER."
3009 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3010 (level (gnus-data-level (car data)))
3012 (while (and (setq data (cdr data))
3013 (> (setq l (gnus-data-level (car data))) level))
3014 (and (= (1+ level) l)
3015 (push (gnus-data-number (car data))
3017 (nreverse children)))
3019 (defun gnus-summary-article-parent (&optional number)
3020 "Return the article number of the parent of article NUMBER."
3021 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3022 (gnus-data-list t)))
3023 (level (gnus-data-level (car data))))
3025 () ; This is a root.
3026 ;; We search until we find an article with a level less than
3027 ;; this one. That function has to be the parent.
3028 (while (and (setq data (cdr data))
3029 (not (< (gnus-data-level (car data)) level))))
3030 (and data (gnus-data-number (car data))))))
3032 (defun gnus-unread-mark-p (mark)
3033 "Say whether MARK is the unread mark."
3034 (= mark gnus-unread-mark))
3036 (defun gnus-read-mark-p (mark)
3037 "Say whether MARK is one of the marks that mark as read.
3038 This is all marks except unread, ticked, dormant, and expirable."
3039 (not (or (= mark gnus-unread-mark)
3040 (= mark gnus-ticked-mark)
3041 (= mark gnus-spam-mark)
3042 (= mark gnus-dormant-mark)
3043 (= mark gnus-expirable-mark))))
3045 (defmacro gnus-article-mark (number)
3046 "Return the MARK of article NUMBER.
3047 This macro should only be used when computing the mark the \"first\"
3048 time; i.e., when generating the summary lines. After that,
3049 `gnus-summary-article-mark' should be used to examine the
3052 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3053 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3054 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3055 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3056 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3057 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3058 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3059 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3060 gnus-ancient-mark))))
3062 ;; Saving hidden threads.
3064 (defmacro gnus-save-hidden-threads (&rest forms)
3065 "Save hidden threads, eval FORMS, and restore the hidden threads."
3066 (let ((config (make-symbol "config")))
3067 `(let ((,config (gnus-hidden-threads-configuration)))
3071 (gnus-restore-hidden-threads-configuration ,config)))))
3072 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3073 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3075 (defun gnus-data-compute-positions ()
3076 "Compute the positions of all articles."
3077 (setq gnus-newsgroup-data-reverse nil)
3078 (let ((data gnus-newsgroup-data))
3080 (gnus-save-hidden-threads
3081 (gnus-summary-show-all-threads)
3082 (goto-char (point-min))
3084 (while (get-text-property (point) 'gnus-intangible)
3086 (gnus-data-set-pos (car data) (+ (point) 3))
3087 (setq data (cdr data))
3088 (forward-line 1))))))
3090 (defun gnus-hidden-threads-configuration ()
3091 "Return the current hidden threads configuration."
3094 (goto-char (point-min))
3095 (while (search-forward "\r" nil t)
3096 (push (1- (point)) config))
3099 (defun gnus-restore-hidden-threads-configuration (config)
3100 "Restore hidden threads configuration from CONFIG."
3102 (let (point buffer-read-only)
3103 (while (setq point (pop config))
3104 (when (and (< point (point-max))
3106 (eq (char-after) ?\n))
3107 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3109 ;; Various summary mode internalish functions.
3111 (defun gnus-mouse-pick-article (e)
3114 (gnus-summary-next-page nil t))
3116 (defun gnus-summary-set-display-table ()
3117 "Change the display table.
3118 Odd characters have a tendency to mess
3119 up nicely formatted displays - we make all possible glyphs
3120 display only a single character."
3122 ;; We start from the standard display table, if any.
3123 (let ((table (or (copy-sequence standard-display-table)
3124 (make-display-table)))
3126 ;; Nix out all the control chars...
3127 (while (>= (setq i (1- i)) 0)
3128 (aset table i [??]))
3129 ;; ... but not newline and cr, of course. (cr is necessary for the
3130 ;; selective display).
3131 (aset table ?\n nil)
3132 (aset table ?\r nil)
3133 ;; We keep TAB as well.
3134 (aset table ?\t nil)
3135 ;; We nix out any glyphs over 126 that are not set already.
3137 (while (>= (setq i (1- i)) 127)
3138 ;; Only modify if the entry is nil.
3139 (unless (aref table i)
3140 (aset table i [??]))))
3141 (setq buffer-display-table table)))
3143 (defun gnus-summary-set-article-display-arrow (pos)
3144 "Update the overlay arrow to point to line at position POS."
3145 (when (and gnus-summary-display-arrow
3146 (boundp 'overlay-arrow-position)
3147 (boundp 'overlay-arrow-string))
3151 (unless overlay-arrow-position
3152 (setq overlay-arrow-position (make-marker)))
3153 (setq overlay-arrow-string "=>"
3154 overlay-arrow-position (set-marker overlay-arrow-position
3156 (current-buffer))))))
3158 (defun gnus-summary-setup-buffer (group)
3159 "Initialize summary buffer."
3160 (let ((buffer (gnus-summary-buffer-name group))
3161 (dead-name (concat "*Dead Summary "
3162 (gnus-group-decoded-name group) "*")))
3163 ;; If a dead summary buffer exists, we kill it.
3164 (when (gnus-buffer-live-p dead-name)
3165 (gnus-kill-buffer dead-name))
3166 (if (get-buffer buffer)
3169 (setq gnus-summary-buffer (current-buffer))
3170 (not gnus-newsgroup-prepared))
3171 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3172 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3173 (gnus-summary-mode group)
3175 (gnus-carpal-setup-buffer 'summary))
3176 (unless gnus-single-article-buffer
3177 (make-local-variable 'gnus-article-buffer)
3178 (make-local-variable 'gnus-article-current)
3179 (make-local-variable 'gnus-original-article-buffer))
3180 (setq gnus-newsgroup-name group)
3181 ;; Set any local variables in the group parameters.
3182 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3185 (defun gnus-set-global-variables ()
3186 "Set the global equivalents of the buffer-local variables.
3187 They are set to the latest values they had. These reflect the summary
3188 buffer that was in action when the last article was fetched."
3189 (when (eq major-mode 'gnus-summary-mode)
3190 (setq gnus-summary-buffer (current-buffer))
3191 (let ((name gnus-newsgroup-name)
3192 (marked gnus-newsgroup-marked)
3193 (spam gnus-newsgroup-spam-marked)
3194 (unread gnus-newsgroup-unreads)
3195 (headers gnus-current-headers)
3196 (data gnus-newsgroup-data)
3197 (summary gnus-summary-buffer)
3198 (article-buffer gnus-article-buffer)
3199 (original gnus-original-article-buffer)
3200 (gac gnus-article-current)
3201 (reffed gnus-reffed-article-number)
3202 (score-file gnus-current-score-file)
3203 (default-charset gnus-newsgroup-charset)
3205 (let ((locals gnus-newsgroup-variables))
3207 (if (consp (car locals))
3208 (push (eval (caar locals)) vlist)
3209 (push (eval (car locals)) vlist))
3210 (setq locals (cdr locals)))
3211 (setq vlist (nreverse vlist)))
3212 (with-current-buffer gnus-group-buffer
3213 (setq gnus-newsgroup-name name
3214 gnus-newsgroup-marked marked
3215 gnus-newsgroup-spam-marked spam
3216 gnus-newsgroup-unreads unread
3217 gnus-current-headers headers
3218 gnus-newsgroup-data data
3219 gnus-article-current gac
3220 gnus-summary-buffer summary
3221 gnus-article-buffer article-buffer
3222 gnus-original-article-buffer original
3223 gnus-reffed-article-number reffed
3224 gnus-current-score-file score-file
3225 gnus-newsgroup-charset default-charset)
3226 (let ((locals gnus-newsgroup-variables))
3228 (if (consp (car locals))
3229 (set (caar locals) (pop vlist))
3230 (set (car locals) (pop vlist)))
3231 (setq locals (cdr locals))))
3232 ;; The article buffer also has local variables.
3233 (when (gnus-buffer-live-p gnus-article-buffer)
3234 (set-buffer gnus-article-buffer)
3235 (setq gnus-summary-buffer summary))))))
3237 (defun gnus-summary-article-unread-p (article)
3238 "Say whether ARTICLE is unread or not."
3239 (memq article gnus-newsgroup-unreads))
3241 (defun gnus-summary-first-article-p (&optional article)
3242 "Return whether ARTICLE is the first article in the buffer."
3243 (if (not (setq article (or article (gnus-summary-article-number))))
3245 (eq article (caar gnus-newsgroup-data))))
3247 (defun gnus-summary-last-article-p (&optional article)
3248 "Return whether ARTICLE is the last article in the buffer."
3249 (if (not (setq article (or article (gnus-summary-article-number))))
3250 ;; All non-existent numbers are the last article. :-)
3252 (not (cdr (gnus-data-find-list article)))))
3254 (defun gnus-make-thread-indent-array ()
3256 (unless (and gnus-thread-indent-array
3257 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3258 (setq gnus-thread-indent-array (make-vector 201 "")
3259 gnus-thread-indent-array-level gnus-thread-indent-level)
3261 (aset gnus-thread-indent-array n
3262 (make-string (* n gnus-thread-indent-level) ? ))
3265 (defun gnus-update-summary-mark-positions ()
3266 "Compute where the summary marks are to go."
3268 (when (gnus-buffer-exists-p gnus-summary-buffer)
3269 (set-buffer gnus-summary-buffer))
3270 (let ((gnus-replied-mark 129)
3271 (gnus-score-below-mark 130)
3272 (gnus-score-over-mark 130)
3273 (gnus-undownloaded-mark 131)
3274 (spec gnus-summary-line-format-spec)
3277 (gnus-set-work-buffer)
3278 (let ((gnus-summary-line-format-spec spec)
3279 (gnus-newsgroup-downloadable '(0)))
3280 (gnus-summary-insert-line
3281 [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil]
3282 0 nil t 128 t nil "" nil 1)
3283 (goto-char (point-min))
3284 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
3285 (- (point) (point-min) 1)))))
3286 (goto-char (point-min))
3287 (push (cons 'replied (and (search-forward "\201" nil t)
3288 (- (point) (point-min) 1)))
3290 (goto-char (point-min))
3291 (push (cons 'score (and (search-forward "\202" nil t)
3292 (- (point) (point-min) 1)))
3294 (goto-char (point-min))
3295 (push (cons 'download
3296 (and (search-forward "\203" nil t)
3297 (- (point) (point-min) 1)))
3299 (setq gnus-summary-mark-positions pos))))
3301 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3302 "Insert a dummy root in the summary buffer."
3304 (gnus-add-text-properties
3305 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3306 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3308 (defun gnus-summary-extract-address-component (from)
3309 (or (car (funcall gnus-extract-address-components from))
3312 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3313 (let ((mail-parse-charset gnus-newsgroup-charset)
3314 ; Is it really necessary to do this next part for each summary line?
3315 ; Luckily, doesn't seem to slow things down much.
3316 (mail-parse-ignored-charsets
3317 (with-current-buffer gnus-summary-buffer
3318 gnus-newsgroup-ignored-charsets)))
3320 (and gnus-ignored-from-addresses
3321 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3322 (let ((extra-headers (mail-header-extra header))
3326 ((setq to (cdr (assq 'To extra-headers)))
3329 (gnus-summary-extract-address-component
3330 (funcall gnus-decode-encoded-word-function to)))))
3331 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3332 (concat "=> " newsgroups)))))
3333 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3335 (defun gnus-summary-insert-line (gnus-tmp-header
3336 gnus-tmp-level gnus-tmp-current
3337 undownloaded gnus-tmp-unread gnus-tmp-replied
3338 gnus-tmp-expirable gnus-tmp-subject-or-nil
3339 &optional gnus-tmp-dummy gnus-tmp-score
3341 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3342 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3343 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3344 (gnus-tmp-score-char
3345 (if (or (null gnus-summary-default-score)
3346 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3347 gnus-summary-zcore-fuzz))
3349 (if (< gnus-tmp-score gnus-summary-default-score)
3350 gnus-score-below-mark gnus-score-over-mark)))
3351 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3353 (cond (gnus-tmp-process gnus-process-mark)
3354 ((memq gnus-tmp-current gnus-newsgroup-cached)
3356 (gnus-tmp-replied gnus-replied-mark)
3357 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3358 gnus-forwarded-mark)
3359 ((memq gnus-tmp-current gnus-newsgroup-saved)
3361 ((memq gnus-tmp-number gnus-newsgroup-recent)
3363 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3366 (gnus-tmp-downloaded
3368 gnus-undownloaded-mark)
3369 (gnus-newsgroup-agentized
3370 gnus-downloaded-mark)
3373 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3376 ((string-match "<[^>]+> *$" gnus-tmp-from)
3377 (let ((beg (match-beginning 0)))
3378 (or (and (string-match "^\".+\"" gnus-tmp-from)
3379 (substring gnus-tmp-from 1 (1- (match-end 0))))
3380 (substring gnus-tmp-from 0 beg))))
3381 ((string-match "(.+)" gnus-tmp-from)
3382 (substring gnus-tmp-from
3383 (1+ (match-beginning 0)) (1- (match-end 0))))
3385 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3386 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3387 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3388 (buffer-read-only nil))
3389 (when (string= gnus-tmp-name "")
3390 (setq gnus-tmp-name gnus-tmp-from))
3391 (unless (numberp gnus-tmp-lines)
3392 (setq gnus-tmp-lines -1))
3393 (if (= gnus-tmp-lines -1)
3394 (setq gnus-tmp-lines "?")
3395 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3396 (gnus-put-text-property
3398 (progn (eval gnus-summary-line-format-spec) (point))
3399 'gnus-number gnus-tmp-number)
3400 (when (gnus-visual-p 'summary-highlight 'highlight)
3402 (gnus-run-hooks 'gnus-summary-update-hook)
3405 (defun gnus-summary-update-line (&optional dont-update)
3406 "Update summary line after change."
3407 (when (and gnus-summary-default-score
3408 (not gnus-summary-inhibit-highlight))
3409 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3410 (article (gnus-summary-article-number))
3411 (score (gnus-summary-article-score article)))
3413 (if (and gnus-summary-mark-below
3414 (< (gnus-summary-article-score)
3415 gnus-summary-mark-below))
3416 ;; This article has a low score, so we mark it as read.
3417 (when (memq article gnus-newsgroup-unreads)
3418 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3419 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3420 ;; This article was previously marked as read on account
3421 ;; of a low score, but now it has risen, so we mark it as
3423 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3424 (gnus-summary-update-mark
3425 (if (or (null gnus-summary-default-score)
3426 (<= (abs (- score gnus-summary-default-score))
3427 gnus-summary-zcore-fuzz))
3429 (if (< score gnus-summary-default-score)
3430 gnus-score-below-mark gnus-score-over-mark))
3432 ;; Do visual highlighting.
3433 (when (gnus-visual-p 'summary-highlight 'highlight)
3434 (gnus-run-hooks 'gnus-summary-update-hook)))))
3436 (defvar gnus-tmp-new-adopts nil)
3438 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3439 "Return the number of articles in THREAD.
3440 This may be 0 in some cases -- if none of the articles in
3441 the thread are to be displayed."
3443 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3445 ((not (listp thread))
3447 ((and (consp thread) (cdr thread))
3450 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3453 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3456 (when (and level (zerop level) gnus-tmp-new-adopts)
3459 'gnus-summary-number-of-articles-in-thread
3460 gnus-tmp-new-adopts))))
3462 (if (> number 1) gnus-not-empty-thread-mark
3463 gnus-empty-thread-mark)
3466 (defsubst gnus-summary-line-message-size (head)
3467 "Return pretty-printed version of message size.
3468 This function is intended to be used in
3469 `gnus-summary-line-format-alist'."
3470 (let ((c (or (mail-header-chars head) -1)))
3471 (cond ((< c 0) "n/a") ; chars not available
3472 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3473 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3474 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3475 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3478 (defun gnus-summary-set-local-parameters (group)
3479 "Go through the local params of GROUP and set all variable specs in that list."
3480 (let ((params (gnus-group-find-parameter group))
3481 (vars '(quit-config)) ; Ignore quit-config.
3484 (setq elem (car params)
3485 params (cdr params))
3486 (and (consp elem) ; Has to be a cons.
3487 (consp (cdr elem)) ; The cdr has to be a list.
3488 (symbolp (car elem)) ; Has to be a symbol in there.
3489 (not (memq (car elem) vars))
3490 (ignore-errors ; So we set it.
3491 (push (car elem) vars)
3492 (make-local-variable (car elem))
3493 (set (car elem) (eval (nth 1 elem))))))))
3495 (defun gnus-summary-read-group (group &optional show-all no-article
3496 kill-buffer no-display backward
3498 "Start reading news in newsgroup GROUP.
3499 If SHOW-ALL is non-nil, already read articles are also listed.
3500 If NO-ARTICLE is non-nil, no article is selected initially.
3501 If NO-DISPLAY, don't generate a summary buffer."
3505 (let ((gnus-auto-select-next nil))
3506 (or (gnus-summary-read-group-1
3507 group show-all no-article
3508 kill-buffer no-display
3511 select-articles nil)))))
3512 (eq gnus-auto-select-next 'quietly))
3513 (set-buffer gnus-group-buffer)
3514 ;; The entry function called above goes to the next
3515 ;; group automatically, so we go two groups back
3516 ;; if we are searching for the previous group.
3518 (gnus-group-prev-unread-group 2))
3519 (if (not (equal group (gnus-group-group-name)))
3520 (setq group (gnus-group-group-name))
3524 (defun gnus-summary-read-group-1 (group show-all no-article
3525 kill-buffer no-display
3526 &optional select-articles)
3527 ;; Killed foreign groups can't be entered.
3528 ;; (when (and (not (gnus-group-native-p group))
3529 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3530 ;; (error "Dead non-native groups can't be entered"))
3531 (gnus-message 5 "Retrieving newsgroup: %s..."
3532 (gnus-group-decoded-name group))
3533 (let* ((new-group (gnus-summary-setup-buffer group))
3534 (quit-config (gnus-group-quit-config group))
3535 (did-select (and new-group (gnus-select-newsgroup
3536 group show-all select-articles))))
3538 ;; This summary buffer exists already, so we just select it.
3540 (gnus-set-global-variables)
3542 (gnus-kill-or-deaden-summary kill-buffer))
3543 (gnus-configure-windows 'summary 'force)
3544 (gnus-set-mode-line 'summary)
3545 (gnus-summary-position-point)
3548 ;; We couldn't select this group.
3550 (when (and (eq major-mode 'gnus-summary-mode)
3551 (not (equal (current-buffer) kill-buffer)))
3552 (kill-buffer (current-buffer))
3553 (if (not quit-config)
3555 ;; Update the info -- marks might need to be removed,
3557 (gnus-summary-update-info)
3558 (set-buffer gnus-group-buffer)
3559 (gnus-group-jump-to-group group)
3560 (gnus-group-next-unread-group 1))
3561 (gnus-handle-ephemeral-exit quit-config)))
3562 (let ((grpinfo (gnus-get-info group)))
3563 (if (null (gnus-info-read grpinfo))
3564 (gnus-message 3 "Group %s contains no messages"
3565 (gnus-group-decoded-name group))
3566 (gnus-message 3 "Can't select group")))
3568 ;; The user did a `C-g' while prompting for number of articles,
3569 ;; so we exit this group.
3570 ((eq did-select 'quit)
3571 (and (eq major-mode 'gnus-summary-mode)
3572 (not (equal (current-buffer) kill-buffer))
3573 (kill-buffer (current-buffer)))
3575 (gnus-kill-or-deaden-summary kill-buffer))
3576 (if (not quit-config)
3578 (set-buffer gnus-group-buffer)
3579 (gnus-group-jump-to-group group)
3580 (gnus-group-next-unread-group 1)
3581 (gnus-configure-windows 'group 'force))
3582 (gnus-handle-ephemeral-exit quit-config))
3583 ;; Finally signal the quit.
3585 ;; The group was successfully selected.
3587 (gnus-set-global-variables)
3588 ;; Save the active value in effect when the group was entered.
3589 (setq gnus-newsgroup-active
3591 (gnus-active gnus-newsgroup-name)))
3592 ;; You can change the summary buffer in some way with this hook.
3593 (gnus-run-hooks 'gnus-select-group-hook)
3594 (gnus-update-format-specifications
3595 nil 'summary 'summary-mode 'summary-dummy)
3596 (gnus-update-summary-mark-positions)
3597 ;; Do score processing.
3598 (when gnus-use-scoring
3599 (gnus-possibly-score-headers))
3600 ;; Check whether to fill in the gaps in the threads.
3601 (when gnus-build-sparse-threads
3602 (gnus-build-sparse-threads))
3603 ;; Find the initial limit.
3604 (if gnus-show-threads
3606 (let ((gnus-newsgroup-dormant nil))
3607 (gnus-summary-initial-limit show-all))
3608 (gnus-summary-initial-limit show-all))
3609 ;; When unthreaded, all articles are always shown.
3610 (setq gnus-newsgroup-limit
3612 (lambda (header) (mail-header-number header))
3613 gnus-newsgroup-headers)))
3614 ;; Generate the summary buffer.
3616 (gnus-summary-prepare))
3617 (when gnus-use-trees
3618 (gnus-tree-open group)
3619 (setq gnus-summary-highlight-line-function
3620 'gnus-tree-highlight-article))
3621 ;; If the summary buffer is empty, but there are some low-scored
3622 ;; articles or some excluded dormants, we include these in the
3624 (when (and (zerop (buffer-size))
3626 (cond (gnus-newsgroup-dormant
3627 (gnus-summary-limit-include-dormant))
3628 ((and gnus-newsgroup-scored show-all)
3629 (gnus-summary-limit-include-expunged t))))
3630 ;; Function `gnus-apply-kill-file' must be called in this hook.
3631 (gnus-run-hooks 'gnus-apply-kill-hook)
3632 (if (and (zerop (buffer-size))
3635 ;; This newsgroup is empty.
3636 (gnus-summary-catchup-and-exit nil t)
3637 (gnus-message 6 "No unread news")
3639 (gnus-kill-or-deaden-summary kill-buffer))
3640 ;; Return nil from this function.
3642 ;; Hide conversation thread subtrees. We cannot do this in
3643 ;; gnus-summary-prepare-hook since kill processing may not
3644 ;; work with hidden articles.
3645 (gnus-summary-maybe-hide-threads)
3647 (gnus-kill-or-deaden-summary kill-buffer))
3648 (gnus-summary-auto-select-subject)
3649 ;; Show first unread article if requested.
3650 (if (and (not no-article)
3652 gnus-newsgroup-unreads
3653 gnus-auto-select-first)
3655 (gnus-configure-windows 'summary)
3656 (let ((art (gnus-summary-article-number)))
3657 (unless (and (not gnus-plugged)
3658 (or (memq art gnus-newsgroup-undownloaded)
3659 (memq art gnus-newsgroup-downloadable)))
3660 (gnus-summary-goto-article art))))
3661 ;; Don't select any articles.
3662 (gnus-summary-position-point)
3663 (gnus-configure-windows 'summary 'force)
3664 (gnus-set-mode-line 'summary))
3665 (when (and gnus-auto-center-group
3666 (get-buffer-window gnus-group-buffer t))
3667 ;; Gotta use windows, because recenter does weird stuff if
3668 ;; the current buffer ain't the displayed window.
3669 (let ((owin (selected-window)))
3670 (select-window (get-buffer-window gnus-group-buffer t))
3671 (when (gnus-group-goto-group group)
3673 (select-window owin)))
3674 ;; Mark this buffer as "prepared".
3675 (setq gnus-newsgroup-prepared t)
3676 (gnus-run-hooks 'gnus-summary-prepared-hook)
3677 (unless (gnus-ephemeral-group-p group)
3678 (gnus-group-update-group group))
3681 (defun gnus-summary-auto-select-subject ()
3682 "Select the subject line on initial group entry."
3683 (goto-char (point-min))
3685 ((eq gnus-auto-select-subject 'best)
3686 (gnus-summary-best-unread-subject))
3687 ((eq gnus-auto-select-subject 'unread)
3688 (gnus-summary-first-unread-subject))
3689 ((eq gnus-auto-select-subject 'unseen)
3690 (gnus-summary-first-unseen-subject))
3691 ((eq gnus-auto-select-subject 'unseen-or-unread)
3692 (gnus-summary-first-unseen-or-unread-subject))
3693 ((eq gnus-auto-select-subject 'first)
3696 ((functionp gnus-auto-select-subject)
3697 (funcall gnus-auto-select-subject))))
3699 (defun gnus-summary-prepare ()
3700 "Generate the summary buffer."
3702 (let ((buffer-read-only nil))
3704 (setq gnus-newsgroup-data nil
3705 gnus-newsgroup-data-reverse nil)
3706 (gnus-run-hooks 'gnus-summary-generate-hook)
3707 ;; Generate the buffer, either with threads or without.
3708 (when gnus-newsgroup-headers
3709 (gnus-summary-prepare-threads
3710 (if gnus-show-threads
3711 (gnus-sort-gathered-threads
3712 (funcall gnus-summary-thread-gathering-function
3714 (gnus-cut-threads (gnus-make-threads)))))
3715 ;; Unthreaded display.
3716 (gnus-sort-articles gnus-newsgroup-headers))))
3717 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3718 ;; Call hooks for modifying summary buffer.
3719 (goto-char (point-min))
3720 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3722 (defsubst gnus-general-simplify-subject (subject)
3723 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3726 ;; Truncate the subject.
3727 (gnus-simplify-subject-functions
3728 (gnus-map-function gnus-simplify-subject-functions subject))
3729 ((numberp gnus-summary-gather-subject-limit)
3730 (setq subject (gnus-simplify-subject-re subject))
3731 (if (> (length subject) gnus-summary-gather-subject-limit)
3732 (substring subject 0 gnus-summary-gather-subject-limit)
3734 ;; Fuzzily simplify it.
3735 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3736 (gnus-simplify-subject-fuzzy subject))
3737 ;; Just remove the leading "Re:".
3739 (gnus-simplify-subject-re subject))))
3741 (if (and gnus-summary-gather-exclude-subject
3742 (string-match gnus-summary-gather-exclude-subject subject))
3743 nil ; This article shouldn't be gathered
3746 (defun gnus-summary-simplify-subject-query ()
3747 "Query where the respool algorithm would put this article."
3749 (gnus-summary-select-article)
3750 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3752 (defun gnus-gather-threads-by-subject (threads)
3753 "Gather threads by looking at Subject headers."
3754 (if (not gnus-summary-make-false-root)
3756 (let ((hashtb (gnus-make-hashtable 1024))
3759 subject hthread whole-subject)
3761 (setq subject (gnus-general-simplify-subject
3762 (setq whole-subject (mail-header-subject
3765 (if (setq hthread (gnus-gethash subject hashtb))
3767 ;; We enter a dummy root into the thread, if we
3768 ;; haven't done that already.
3769 (unless (stringp (caar hthread))
3770 (setcar hthread (list whole-subject (car hthread))))
3771 ;; We add this new gathered thread to this gathered
3773 (setcdr (car hthread)
3774 (nconc (cdar hthread) (list (car threads))))
3775 ;; Remove it from the list of threads.
3776 (setcdr prev (cdr threads))
3777 (setq threads prev))
3778 ;; Enter this thread into the hash table.
3779 (gnus-sethash subject
3780 (if gnus-summary-make-false-root-always
3782 ;; If you want a dummy root above all
3784 (setcar threads (list whole-subject
3790 (setq threads (cdr threads)))
3793 (defun gnus-gather-threads-by-references (threads)
3794 "Gather threads by looking at References headers."
3795 (let ((idhashtb (gnus-make-hashtable 1024))
3796 (thhashtb (gnus-make-hashtable 1024))
3799 ids references id gthread gid entered ref)
3801 (when (setq references (mail-header-references (caar threads)))
3802 (setq id (mail-header-id (caar threads))
3803 ids (inline (gnus-split-references references))
3805 (while (setq ref (pop ids))
3806 (setq ids (delete ref ids))
3807 (if (not (setq gid (gnus-gethash ref idhashtb)))
3809 (gnus-sethash ref id idhashtb)
3810 (gnus-sethash id threads thhashtb))
3811 (setq gthread (gnus-gethash gid thhashtb))
3813 ;; We enter a dummy root into the thread, if we
3814 ;; haven't done that already.
3815 (unless (stringp (caar gthread))
3816 (setcar gthread (list (mail-header-subject (caar gthread))
3818 ;; We add this new gathered thread to this gathered
3820 (setcdr (car gthread)
3821 (nconc (cdar gthread) (list (car threads)))))
3822 ;; Add it into the thread hash table.
3823 (gnus-sethash id gthread thhashtb)
3825 ;; Remove it from the list of threads.
3826 (setcdr prev (cdr threads))
3827 (setq threads prev))))
3829 (setq threads (cdr threads)))
3832 (defun gnus-sort-gathered-threads (threads)
3833 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3834 (let ((result threads))
3836 (when (stringp (caar threads))
3837 (setcdr (car threads)
3838 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3839 (setq threads (cdr threads)))
3842 (defun gnus-thread-loop-p (root thread)
3843 "Say whether ROOT is in THREAD."
3844 (let ((stack (list thread))
3847 (while (setq thread (pop stack))
3848 (setq th (cdr thread))
3850 (not (eq (caar th) root)))
3853 ;; We have found a loop.
3855 (setcdr thread (delq (car th) (cdr thread)))
3856 (if (boundp (setq ref-dep (intern "none"
3857 gnus-newsgroup-dependencies)))
3858 (setcdr (symbol-value ref-dep)
3859 (nconc (cdr (symbol-value ref-dep))
3861 (set ref-dep (list nil (car th))))
3864 ;; Push all the subthreads onto the stack.
3865 (push (cdr thread) stack)))
3868 (defun gnus-make-threads ()
3869 "Go through the dependency hashtb and find the roots. Return all threads."
3871 (while (catch 'infloop
3874 ;; Deal with self-referencing References loops.
3875 (when (and (car (symbol-value refs))
3882 (car (symbol-value refs)) thread))
3883 (cdr (symbol-value refs)))))))
3886 (unless (car (symbol-value refs))
3887 ;; These threads do not refer back to any other
3888 ;; articles, so they're roots.
3889 (setq threads (append (cdr (symbol-value refs)) threads))))
3890 gnus-newsgroup-dependencies)))
3893 ;; Build the thread tree.
3894 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3895 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3897 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3898 if it was already present.
3900 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3901 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3902 Message-IDs will be renamed to a unique Message-ID before being
3905 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3906 (let* ((id (mail-header-id header))
3907 (id-dep (and id (intern id dependencies)))
3908 parent-id ref ref-dep ref-header replaced)
3909 ;; Enter this `header' in the `dependencies' table.
3913 ;; The first two cases do the normal part: enter a new `header'
3914 ;; in the `dependencies' table.
3915 ((not (boundp id-dep))
3916 (set id-dep (list header)))
3917 ((null (car (symbol-value id-dep)))
3918 (setcar (symbol-value id-dep) header))
3920 ;; From here the `header' was already present in the
3921 ;; `dependencies' table.
3923 ;; Overrides an existing entry;
3924 ;; just set the header part of the entry.
3925 (setcar (symbol-value id-dep) header)
3928 ;; Renames the existing `header' to a unique Message-ID.
3929 ((not gnus-summary-ignore-duplicates)
3930 ;; An article with this Message-ID has already been seen.
3931 ;; We rename the Message-ID.
3932 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3934 (mail-header-set-id header id))
3936 ;; The last case ignores an existing entry, except it adds any
3937 ;; additional Xrefs (in case the two articles came from different
3939 ;; Also sets `header' to `nil' meaning that the `dependencies'
3940 ;; table was *not* modified.
3942 (mail-header-set-xref
3943 (car (symbol-value id-dep))
3944 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3946 (or (mail-header-xref header) "")))
3949 (when (and header (not replaced))
3950 ;; First check that we are not creating a References loop.
3951 (setq parent-id (gnus-parent-id (mail-header-references header)))
3952 (setq ref parent-id)
3954 (setq ref-dep (intern-soft ref dependencies))
3956 (setq ref-header (car (symbol-value ref-dep))))
3957 (if (string= id ref)
3958 ;; Yuk! This is a reference loop. Make the article be a
3961 (mail-header-set-references (car (symbol-value id-dep)) "none")
3963 (setq parent-id nil))
3964 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3965 (setq ref-dep (intern (or parent-id "none") dependencies))
3966 (if (boundp ref-dep)
3967 (setcdr (symbol-value ref-dep)
3968 (nconc (cdr (symbol-value ref-dep))
3969 (list (symbol-value id-dep))))
3970 (set ref-dep (list nil (symbol-value id-dep)))))
3973 (defun gnus-extract-message-id-from-in-reply-to (string)
3974 (if (string-match "<[^>]+>" string)
3975 (substring string (match-beginning 0) (match-end 0))
3978 (defun gnus-build-sparse-threads ()
3979 (let ((headers gnus-newsgroup-headers)
3980 (mail-parse-charset gnus-newsgroup-charset)
3981 (gnus-summary-ignore-duplicates t)
3982 header references generation relations
3983 subject child end new-child date)
3984 ;; First we create an alist of generations/relations, where
3985 ;; generations is how much we trust the relation, and the relation
3987 (gnus-message 7 "Making sparse threads...")
3989 (nnheader-set-temp-buffer " *gnus sparse threads*")
3990 (while (setq header (pop headers))
3991 (when (and (setq references (mail-header-references header))
3992 (not (string= references "")))
3994 (setq child (mail-header-id header)
3995 subject (mail-header-subject header)
3996 date (mail-header-date header)
3998 (while (search-backward ">" nil t)
3999 (setq end (1+ (point)))
4000 (when (search-backward "<" nil t)
4001 (setq new-child (buffer-substring (point) end))
4002 (push (list (incf generation)
4003 child (setq child new-child)
4007 (push (list (1+ generation) child nil subject) relations))
4009 (kill-buffer (current-buffer)))
4010 ;; Sort over trustworthiness.
4013 (when (gnus-dependencies-add-header
4014 (make-full-mail-header
4015 gnus-reffed-article-number
4016 (nth 3 relation) "" (or (nth 4 relation) "")
4018 (or (nth 2 relation) "") 0 0 "")
4019 gnus-newsgroup-dependencies nil)
4020 (push gnus-reffed-article-number gnus-newsgroup-limit)
4021 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4022 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4023 gnus-newsgroup-reads)
4024 (decf gnus-reffed-article-number)))
4025 (sort relations 'car-less-than-car))
4026 (gnus-message 7 "Making sparse threads...done")))
4028 (defun gnus-build-old-threads ()
4029 ;; Look at all the articles that refer back to old articles, and
4030 ;; fetch the headers for the articles that aren't there. This will
4031 ;; build complete threads - if the roots haven't been expired by the
4033 (let ((mail-parse-charset gnus-newsgroup-charset)
4037 (when (not (car (symbol-value refs)))
4038 (setq heads (cdr (symbol-value refs)))
4040 (if (memq (mail-header-number (caar heads))
4041 gnus-newsgroup-dormant)
4042 (setq heads (cdr heads))
4043 (setq id (symbol-name refs))
4044 (while (and (setq id (gnus-build-get-header id))
4045 (not (car (gnus-id-to-thread id)))))
4046 (setq heads nil)))))
4047 gnus-newsgroup-dependencies)))
4049 (defsubst gnus-remove-odd-characters (string)
4050 "Translate STRING into something that doesn't contain weird characters."
4051 (mm-subst-char-in-string
4053 (mm-subst-char-in-string ?\n ?\- string t) t))
4055 ;; This function has to be called with point after the article number
4056 ;; on the beginning of the line.
4057 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4058 (let ((eol (point-at-eol))
4059 (buffer (current-buffer))
4060 header references in-reply-to)
4062 ;; overview: [num subject from date id refs chars lines misc]
4065 (narrow-to-region (point) eol)
4070 (make-full-mail-header
4072 (condition-case () ; subject
4073 (gnus-remove-odd-characters
4074 (funcall gnus-decode-encoded-word-function
4075 (setq x (nnheader-nov-field))))
4077 (condition-case () ; from
4078 (gnus-remove-odd-characters
4079 (funcall gnus-decode-encoded-word-function
4080 (setq x (nnheader-nov-field))))
4082 (nnheader-nov-field) ; date
4083 (nnheader-nov-read-message-id) ; id
4084 (setq references (nnheader-nov-field)) ; refs
4085 (nnheader-nov-read-integer) ; chars
4086 (nnheader-nov-read-integer) ; lines
4088 (if (looking-at "Xref: ")
4089 (goto-char (match-end 0)))
4090 (nnheader-nov-field)) ; Xref
4091 (nnheader-nov-parse-extra)))) ; extra
4095 (when (and (string= references "")
4096 (setq in-reply-to (mail-header-extra header))
4097 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4098 (mail-header-set-references
4099 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4101 (when gnus-alter-header-function
4102 (funcall gnus-alter-header-function header))
4103 (gnus-dependencies-add-header header dependencies force-new)))
4105 (defun gnus-build-get-header (id)
4106 "Look through the buffer of NOV lines and find the header to ID.
4107 Enter this line into the dependencies hash table, and return
4108 the id of the parent article (if any)."
4109 (let ((deps gnus-newsgroup-dependencies)
4113 (set-buffer nntp-server-buffer)
4114 (let ((case-fold-search nil))
4115 (goto-char (point-min))
4116 (while (and (not found)
4117 (search-forward id nil t))
4119 (setq found (looking-at
4120 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4121 (regexp-quote id))))
4122 (or found (beginning-of-line 2)))
4126 (setq header (gnus-nov-parse-line
4127 (read (current-buffer)) deps))
4128 (gnus-parent-id (mail-header-references header))))))
4130 (let ((number (mail-header-number header)))
4131 (push number gnus-newsgroup-limit)
4132 (push header gnus-newsgroup-headers)
4133 (if (memq number gnus-newsgroup-unselected)
4135 (setq gnus-newsgroup-unreads
4136 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4138 (setq gnus-newsgroup-unselected
4139 (delq number gnus-newsgroup-unselected)))
4140 (push number gnus-newsgroup-ancient)))))))
4142 (defun gnus-build-all-threads ()
4143 "Read all the headers."
4144 (let ((gnus-summary-ignore-duplicates t)
4145 (mail-parse-charset gnus-newsgroup-charset)
4146 (dependencies gnus-newsgroup-dependencies)
4149 (set-buffer nntp-server-buffer)
4150 (let ((case-fold-search nil))
4151 (goto-char (point-min))
4154 (setq article (read (current-buffer))
4155 header (gnus-nov-parse-line article dependencies)))
4157 (with-current-buffer gnus-summary-buffer
4158 (push header gnus-newsgroup-headers)
4159 (if (memq (setq article (mail-header-number header))
4160 gnus-newsgroup-unselected)
4162 (setq gnus-newsgroup-unreads
4163 (gnus-add-to-sorted-list
4164 gnus-newsgroup-unreads article))
4165 (setq gnus-newsgroup-unselected
4166 (delq article gnus-newsgroup-unselected)))
4167 (push article gnus-newsgroup-ancient)))
4168 (forward-line 1)))))))
4170 (defun gnus-summary-update-article-line (article header)
4171 "Update the line for ARTICLE using HEADER."
4172 (let* ((id (mail-header-id header))
4173 (thread (gnus-id-to-thread id)))
4175 (error "Article in no thread"))
4176 ;; Update the thread.
4177 (setcar thread header)
4178 (gnus-summary-goto-subject article)
4179 (let* ((datal (gnus-data-find-list article))
4181 (buffer-read-only nil)
4182 (level (gnus-summary-thread-level)))
4184 (let ((inserted (- (point)
4186 (gnus-summary-insert-line
4188 (memq article gnus-newsgroup-undownloaded)
4189 (gnus-article-mark article)
4190 (memq article gnus-newsgroup-replied)
4191 (memq article gnus-newsgroup-expirable)
4192 ;; Only insert the Subject string when it's different
4193 ;; from the previous Subject string.
4198 (mail-header-subject
4201 (gnus-data-find-list
4203 (gnus-data-list t)))))
4204 ;; Error on the side of excessive subjects.
4206 (mail-header-subject header)))
4208 (mail-header-subject header))
4209 nil (cdr (assq article gnus-newsgroup-scored))
4210 (memq article gnus-newsgroup-processable))
4213 (gnus-data-update-list
4215 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4217 (defun gnus-summary-update-article (article &optional iheader)
4218 "Update ARTICLE in the summary buffer."
4219 (set-buffer gnus-summary-buffer)
4220 (let* ((header (gnus-summary-article-header article))
4221 (id (mail-header-id header))
4222 (data (gnus-data-find article))
4223 (thread (gnus-id-to-thread id))
4224 (references (mail-header-references header))
4228 (when (and references
4229 (not (equal "" references)))
4232 (buffer-read-only nil)
4238 (delq thread parent)))
4239 (if (gnus-summary-insert-subject id header)
4240 ;; Set the (possibly) new article number in the data structure.
4241 (gnus-data-set-number data (gnus-id-to-article id))
4245 (defun gnus-rebuild-thread (id &optional line)
4246 "Rebuild the thread containing ID.
4247 If LINE, insert the rebuilt thread starting on line LINE."
4248 (let ((buffer-read-only nil)
4249 old-pos current thread data)
4250 (if (not gnus-show-threads)
4251 (setq thread (list (car (gnus-id-to-thread id))))
4252 ;; Get the thread this article is part of.
4253 (setq thread (gnus-remove-thread id)))
4254 (setq old-pos (point-at-bol))
4255 (setq current (save-excursion
4256 (and (re-search-backward "[\r\n]" nil t)
4257 (gnus-summary-article-number))))
4258 ;; If this is a gathered thread, we have to go some re-gathering.
4259 (when (stringp (car thread))
4260 (let ((subject (car thread))
4262 (setq thread (cdr thread))
4264 (unless (memq (setq thr (gnus-id-to-thread
4266 (mail-header-id (caar thread)))))
4269 (setq thread (cdr thread)))
4270 ;; We now have all (unique) roots.
4271 (if (= (length roots) 1)
4272 ;; All the loose roots are now one solid root.
4273 (setq thread (car roots))
4274 (setq thread (cons subject (gnus-sort-threads roots))))))
4276 ;; We then insert this thread into the summary buffer.
4278 (goto-char (point-min))
4279 (forward-line (1- line)))
4280 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4281 (if gnus-show-threads
4282 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4283 (gnus-summary-prepare-unthreaded thread))
4284 (setq data (nreverse gnus-newsgroup-data))
4285 (setq threads gnus-newsgroup-threads))
4286 ;; We splice the new data into the data structure.
4287 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4288 ;;!!! then we want to insert at the beginning of the buffer.
4289 ;;!!! That happens to be true with Gnus now, but that may
4290 ;;!!! change in the future. Perhaps.
4291 (gnus-data-enter-list
4292 (if line nil current) data (- (point) old-pos))
4293 (setq gnus-newsgroup-threads
4294 (nconc threads gnus-newsgroup-threads))
4295 (gnus-data-compute-positions))))
4297 (defun gnus-number-to-header (number)
4298 "Return the header for article NUMBER."
4299 (let ((headers gnus-newsgroup-headers))
4301 (not (= number (mail-header-number (car headers)))))
4306 (defun gnus-parent-headers (in-headers &optional generation)
4307 "Return the headers of the GENERATIONeth parent of HEADERS."
4309 (setq generation 1))
4311 (headers in-headers)
4314 (not (zerop generation))
4315 (setq references (mail-header-references headers)))
4316 (setq headers (if (and references
4317 (setq parent (gnus-parent-id references)))
4318 (car (gnus-id-to-thread parent))
4321 (and (not (eq headers in-headers))
4324 (defun gnus-id-to-thread (id)
4325 "Return the (sub-)thread where ID appears."
4326 (gnus-gethash id gnus-newsgroup-dependencies))
4328 (defun gnus-id-to-article (id)
4329 "Return the article number of ID."
4330 (let ((thread (gnus-id-to-thread id)))
4333 (mail-header-number (car thread)))))
4335 (defun gnus-id-to-header (id)
4336 "Return the article headers of ID."
4337 (car (gnus-id-to-thread id)))
4339 (defun gnus-article-displayed-root-p (article)
4340 "Say whether ARTICLE is a root(ish) article."
4341 (let ((level (gnus-summary-thread-level article))
4342 (refs (mail-header-references (gnus-summary-article-header article)))
4348 ((null (gnus-parent-id refs)) t)
4350 (null (setq particle (gnus-id-to-article
4351 (gnus-parent-id refs))))
4352 (null (gnus-summary-thread-level particle)))))))
4354 (defun gnus-root-id (id)
4355 "Return the id of the root of the thread where ID appears."
4357 (while (and id (setq prev (car (gnus-id-to-thread id))))
4359 id (gnus-parent-id (mail-header-references prev))))
4362 (defun gnus-articles-in-thread (thread)
4363 "Return the list of articles in THREAD."
4364 (cons (mail-header-number (car thread))
4365 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4367 (defun gnus-remove-thread (id &optional dont-remove)
4368 "Remove the thread that has ID in it."
4369 (let (headers thread last-id)
4370 ;; First go up in this thread until we find the root.
4371 (setq last-id (gnus-root-id id)
4372 headers (message-flatten-list (gnus-id-to-thread last-id)))
4373 ;; We have now found the real root of this thread. It might have
4374 ;; been gathered into some loose thread, so we have to search
4375 ;; through the threads to find the thread we wanted.
4376 (let ((threads gnus-newsgroup-threads)
4379 (setq sub (car threads))
4380 (if (stringp (car sub))
4381 ;; This is a gathered thread, so we look at the roots
4382 ;; below it to find whether this article is in this
4385 (setq sub (cdr sub))
4387 (when (member (caar sub) headers)
4388 (setq thread (car threads)
4391 (setq sub (cdr sub))))
4392 ;; It's an ordinary thread, so we check it.
4393 (when (eq (car sub) (car headers))
4396 (setq threads (cdr threads)))
4397 ;; If this article is in no thread, then it's a root.
4400 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4401 (setq thread (gnus-id-to-thread last-id)))
4404 thread ; We return this thread.
4406 (if (stringp (car thread))
4408 ;; If we use dummy roots, then we have to remove the
4409 ;; dummy root as well.
4410 (when (eq gnus-summary-make-false-root 'dummy)
4411 ;; We go to the dummy root by going to
4412 ;; the first sub-"thread", and then one line up.
4413 (gnus-summary-goto-article
4414 (mail-header-number (caadr thread)))
4417 (gnus-data-compute-positions))
4418 (setq thread (cdr thread))
4420 (gnus-remove-thread-1 (car thread))
4421 (setq thread (cdr thread))))
4422 (gnus-remove-thread-1 thread))))))))
4424 (defun gnus-remove-thread-1 (thread)
4425 "Remove the thread THREAD recursively."
4426 (let ((number (mail-header-number (pop thread)))
4428 (setq thread (reverse thread))
4430 (gnus-remove-thread-1 (pop thread)))
4431 (when (setq d (gnus-data-find number))
4432 (goto-char (gnus-data-pos d))
4433 (gnus-summary-show-thread)
4439 (gnus-delete-line)))))))
4441 (defun gnus-sort-threads-1 (threads func)
4442 (sort (mapcar (lambda (thread)
4445 (gnus-sort-threads-1 (cdr thread) func))))
4448 (defun gnus-sort-threads (threads)
4450 (if (not gnus-thread-sort-functions)
4452 (gnus-message 8 "Sorting threads...")
4453 (let ((max-lisp-eval-depth 5000))
4454 (prog1 (gnus-sort-threads-1
4456 (gnus-make-sort-function gnus-thread-sort-functions))
4457 (gnus-message 8 "Sorting threads...done")))))
4459 (defun gnus-sort-articles (articles)
4461 (when gnus-article-sort-functions
4462 (gnus-message 7 "Sorting articles...")
4464 (setq gnus-newsgroup-headers
4465 (sort articles (gnus-make-sort-function
4466 gnus-article-sort-functions)))
4467 (gnus-message 7 "Sorting articles...done"))))
4469 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4470 (defmacro gnus-thread-header (thread)
4471 "Return header of first article in THREAD.
4472 Note that THREAD must never, ever be anything else than a variable -
4473 using some other form will lead to serious barfage."
4474 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4475 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4476 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4479 (defsubst gnus-article-sort-by-number (h1 h2)
4480 "Sort articles by article number."
4481 (< (mail-header-number h1)
4482 (mail-header-number h2)))
4484 (defun gnus-thread-sort-by-number (h1 h2)
4485 "Sort threads by root article number."
4486 (gnus-article-sort-by-number
4487 (gnus-thread-header h1) (gnus-thread-header h2)))
4489 (defsubst gnus-article-sort-by-random (h1 h2)
4490 "Sort articles by article number."
4493 (defun gnus-thread-sort-by-random (h1 h2)
4494 "Sort threads by root article number."
4495 (gnus-article-sort-by-random
4496 (gnus-thread-header h1) (gnus-thread-header h2)))
4498 (defsubst gnus-article-sort-by-lines (h1 h2)
4499 "Sort articles by article Lines header."
4500 (< (mail-header-lines h1)
4501 (mail-header-lines h2)))
4503 (defun gnus-thread-sort-by-lines (h1 h2)
4504 "Sort threads by root article Lines header."
4505 (gnus-article-sort-by-lines
4506 (gnus-thread-header h1) (gnus-thread-header h2)))
4508 (defsubst gnus-article-sort-by-chars (h1 h2)
4509 "Sort articles by octet length."
4510 (< (mail-header-chars h1)
4511 (mail-header-chars h2)))
4513 (defun gnus-thread-sort-by-chars (h1 h2)
4514 "Sort threads by root article octet length."
4515 (gnus-article-sort-by-chars
4516 (gnus-thread-header h1) (gnus-thread-header h2)))
4518 (defsubst gnus-article-sort-by-author (h1 h2)
4519 "Sort articles by root author."
4521 (let ((extract (funcall
4522 gnus-extract-address-components
4523 (mail-header-from h1))))
4524 (or (car extract) (cadr extract) ""))
4525 (let ((extract (funcall
4526 gnus-extract-address-components
4527 (mail-header-from h2))))
4528 (or (car extract) (cadr extract) ""))))
4530 (defun gnus-thread-sort-by-author (h1 h2)
4531 "Sort threads by root author."
4532 (gnus-article-sort-by-author
4533 (gnus-thread-header h1) (gnus-thread-header h2)))
4535 (defsubst gnus-article-sort-by-subject (h1 h2)
4536 "Sort articles by root subject."
4538 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4539 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4541 (defun gnus-thread-sort-by-subject (h1 h2)
4542 "Sort threads by root subject."
4543 (gnus-article-sort-by-subject
4544 (gnus-thread-header h1) (gnus-thread-header h2)))
4546 (defsubst gnus-article-sort-by-date (h1 h2)
4547 "Sort articles by root article date."
4549 (gnus-date-get-time (mail-header-date h1))
4550 (gnus-date-get-time (mail-header-date h2))))
4552 (defun gnus-thread-sort-by-date (h1 h2)
4553 "Sort threads by root article date."
4554 (gnus-article-sort-by-date
4555 (gnus-thread-header h1) (gnus-thread-header h2)))
4557 (defsubst gnus-article-sort-by-score (h1 h2)
4558 "Sort articles by root article score.
4559 Unscored articles will be counted as having a score of zero."
4560 (> (or (cdr (assq (mail-header-number h1)
4561 gnus-newsgroup-scored))
4562 gnus-summary-default-score 0)
4563 (or (cdr (assq (mail-header-number h2)
4564 gnus-newsgroup-scored))
4565 gnus-summary-default-score 0)))
4567 (defun gnus-thread-sort-by-score (h1 h2)
4568 "Sort threads by root article score."
4569 (gnus-article-sort-by-score
4570 (gnus-thread-header h1) (gnus-thread-header h2)))
4572 (defun gnus-thread-sort-by-total-score (h1 h2)
4573 "Sort threads by the sum of all scores in the thread.
4574 Unscored articles will be counted as having a score of zero."
4575 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4577 (defun gnus-thread-total-score (thread)
4578 ;; This function find the total score of THREAD.
4583 (if (stringp (car thread))
4584 (apply gnus-thread-score-function 0
4585 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4586 (gnus-thread-total-score-1 thread)))
4588 (gnus-thread-total-score-1 (list thread)))))
4590 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4591 "Sort threads such that the thread with the most recently arrived article comes first."
4592 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4594 (defun gnus-thread-highest-number (thread)
4595 "Return the highest article number in THREAD."
4596 (apply 'max (mapcar (lambda (header)
4597 (mail-header-number header))
4598 (message-flatten-list thread))))
4600 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4601 "Sort threads such that the thread with the most recently dated article comes first."
4602 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4604 (defun gnus-thread-latest-date (thread)
4605 "Return the highest article date in THREAD."
4606 (let ((previous-time 0))
4612 (time-to-seconds (mail-header-parse-date
4613 (mail-header-date header)))
4614 (error previous-time))))
4616 (message-flatten-list thread)
4618 (< (mail-header-number h1)
4619 (mail-header-number h2))))))))
4621 (defun gnus-thread-total-score-1 (root)
4622 ;; This function find the total score of the thread below ROOT.
4623 (setq root (car root))
4624 (apply gnus-thread-score-function
4626 (mapcar 'gnus-thread-total-score
4627 (cdr (gnus-id-to-thread (mail-header-id root))))
4628 (when (> (mail-header-number root) 0)
4629 (list (or (cdr (assq (mail-header-number root)
4630 gnus-newsgroup-scored))
4631 gnus-summary-default-score 0))))
4632 (list gnus-summary-default-score)
4635 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4636 (defvar gnus-tmp-prev-subject nil)
4637 (defvar gnus-tmp-false-parent nil)
4638 (defvar gnus-tmp-root-expunged nil)
4639 (defvar gnus-tmp-dummy-line nil)
4641 (eval-when-compile (defvar gnus-tmp-header))
4642 (defun gnus-extra-header (type &optional header)
4643 "Return the extra header of TYPE."
4644 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4647 (defvar gnus-tmp-thread-tree-header-string "")
4649 (defcustom gnus-sum-thread-tree-root "> "
4650 "With %B spec, used for the root of a thread.
4651 If nil, use subject instead."
4652 :type '(radio (const :format "%v " nil) (string :size 0))
4653 :group 'gnus-thread)
4654 (defcustom gnus-sum-thread-tree-false-root "> "
4655 "With %B spec, used for a false root of a thread.
4656 If nil, use subject instead."
4657 :type '(radio (const :format "%v " nil) (string :size 0))
4658 :group 'gnus-thread)
4659 (defcustom gnus-sum-thread-tree-single-indent ""
4660 "With %B spec, used for a thread with just one message.
4661 If nil, use subject instead."
4662 :type '(radio (const :format "%v " nil) (string :size 0))
4663 :group 'gnus-thread)
4664 (defcustom gnus-sum-thread-tree-vertical "| "
4665 "With %B spec, used for drawing a vertical line."
4667 :group 'gnus-thread)
4668 (defcustom gnus-sum-thread-tree-indent " "
4669 "With %B spec, used for indenting."
4671 :group 'gnus-thread)
4672 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4673 "With %B spec, used for a leaf with brothers."
4675 :group 'gnus-thread)
4676 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4677 "With %B spec, used for a leaf without brothers."
4679 :group 'gnus-thread)
4681 (defun gnus-summary-prepare-threads (threads)
4682 "Prepare summary buffer from THREADS and indentation LEVEL.
4683 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4684 or a straight list of headers."
4685 (gnus-message 7 "Generating summary...")
4687 (setq gnus-newsgroup-threads threads)
4690 (let ((gnus-tmp-level 0)
4691 (default-score (or gnus-summary-default-score 0))
4692 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4693 (building-line-count gnus-summary-display-while-building)
4694 (building-count (integerp gnus-summary-display-while-building))
4695 thread number subject stack state gnus-tmp-gathered beg-match
4696 new-roots gnus-tmp-new-adopts thread-end simp-subject
4697 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4698 gnus-tmp-replied gnus-tmp-subject-or-nil
4699 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4700 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4701 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4704 (setq gnus-tmp-prev-subject nil
4705 gnus-tmp-thread-tree-header-string "")
4707 (if (vectorp (car threads))
4708 ;; If this is a straight (sic) list of headers, then a
4709 ;; threaded summary display isn't required, so we just create
4710 ;; an unthreaded one.
4711 (gnus-summary-prepare-unthreaded threads)
4713 ;; Do the threaded display.
4715 (if gnus-summary-display-while-building
4716 (switch-to-buffer (buffer-name)))
4717 (while (or threads stack gnus-tmp-new-adopts new-roots)
4719 (if (and (= gnus-tmp-level 0)
4722 (not gnus-tmp-false-parent)
4723 (or gnus-tmp-new-adopts new-roots))
4724 (if gnus-tmp-new-adopts
4725 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4726 thread (list (car gnus-tmp-new-adopts))
4727 gnus-tmp-header (caar thread)
4728 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4730 (setq thread (list (car new-roots))
4731 gnus-tmp-header (caar thread)
4732 new-roots (cdr new-roots))))
4735 ;; If there are some threads, we do them before the
4736 ;; threads on the stack.
4737 (setq thread threads
4738 gnus-tmp-header (caar thread))
4739 ;; There were no current threads, so we pop something off
4741 (setq state (car stack)
4742 gnus-tmp-level (car state)
4743 tree-stack (cadr state)
4744 thread (caddr state)
4746 gnus-tmp-header (caar thread))))
4748 (setq gnus-tmp-false-parent nil)
4749 (setq gnus-tmp-root-expunged nil)
4750 (setq thread-end nil)
4752 (if (stringp gnus-tmp-header)
4753 ;; The header is a dummy root.
4755 ((eq gnus-summary-make-false-root 'adopt)
4756 ;; We let the first article adopt the rest.
4757 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4759 (setq gnus-tmp-gathered
4761 (lambda (h) (mail-header-number (car h)))
4764 (setq thread (cons (list (caar thread)
4767 (setq gnus-tmp-level -1
4768 gnus-tmp-false-parent t))
4769 ((eq gnus-summary-make-false-root 'empty)
4770 ;; We print adopted articles with empty subject fields.
4771 (setq gnus-tmp-gathered
4773 (lambda (h) (mail-header-number (car h)))
4776 (setq gnus-tmp-level -1))
4777 ((eq gnus-summary-make-false-root 'dummy)
4778 ;; We remember that we probably want to output a dummy
4780 (setq gnus-tmp-dummy-line gnus-tmp-header)
4781 (setq gnus-tmp-prev-subject gnus-tmp-header))
4783 ;; We do not make a root for the gathered
4784 ;; sub-threads at all.
4785 (setq gnus-tmp-level -1)))
4787 (setq number (mail-header-number gnus-tmp-header)
4788 subject (mail-header-subject gnus-tmp-header)
4789 simp-subject (gnus-simplify-subject-fully subject))
4792 ;; If the thread has changed subject, we might want to make
4793 ;; this subthread into a root.
4794 ((and (null gnus-thread-ignore-subject)
4795 (not (zerop gnus-tmp-level))
4796 gnus-tmp-prev-subject
4797 (not (string= gnus-tmp-prev-subject simp-subject)))
4798 (setq new-roots (nconc new-roots (list (car thread)))
4800 gnus-tmp-header nil))
4801 ;; If the article lies outside the current limit,
4802 ;; then we do not display it.
4803 ((not (memq number gnus-newsgroup-limit))
4804 (setq gnus-tmp-gathered
4806 (lambda (h) (mail-header-number (car h)))
4809 (setq gnus-tmp-new-adopts (if (cdar thread)
4810 (append gnus-tmp-new-adopts
4812 gnus-tmp-new-adopts)
4814 gnus-tmp-header nil)
4815 (when (zerop gnus-tmp-level)
4816 (setq gnus-tmp-root-expunged t)))
4817 ;; Perhaps this article is to be marked as read?
4818 ((and gnus-summary-mark-below
4819 (< (or (cdr (assq number gnus-newsgroup-scored))
4821 gnus-summary-mark-below)
4822 ;; Don't touch sparse articles.
4823 (not (gnus-summary-article-sparse-p number))
4824 (not (gnus-summary-article-ancient-p number)))
4825 (setq gnus-newsgroup-unreads
4826 (delq number gnus-newsgroup-unreads))
4827 (if gnus-newsgroup-auto-expire
4828 (setq gnus-newsgroup-expirable
4829 (gnus-add-to-sorted-list
4830 gnus-newsgroup-expirable number))
4831 (push (cons number gnus-low-score-mark)
4832 gnus-newsgroup-reads))))
4834 (when gnus-tmp-header
4835 ;; We may have an old dummy line to output before this
4837 (when (and gnus-tmp-dummy-line
4840 (mail-header-subject gnus-tmp-header)))
4841 (gnus-summary-insert-dummy-line
4842 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4843 (setq gnus-tmp-dummy-line nil))
4845 ;; Compute the mark.
4846 (setq gnus-tmp-unread (gnus-article-mark number))
4848 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4849 gnus-tmp-header gnus-tmp-level)
4850 gnus-newsgroup-data)
4852 ;; Actually insert the line.
4854 gnus-tmp-subject-or-nil
4856 ((and gnus-thread-ignore-subject
4857 gnus-tmp-prev-subject
4858 (not (string= gnus-tmp-prev-subject simp-subject)))
4860 ((zerop gnus-tmp-level)
4861 (if (and (eq gnus-summary-make-false-root 'empty)
4862 (memq number gnus-tmp-gathered)
4863 gnus-tmp-prev-subject
4864 (string= gnus-tmp-prev-subject simp-subject))
4865 gnus-summary-same-subject
4867 (t gnus-summary-same-subject)))
4868 (if (and (eq gnus-summary-make-false-root 'adopt)
4869 (= gnus-tmp-level 1)
4870 (memq number gnus-tmp-gathered))
4871 (setq gnus-tmp-opening-bracket ?\<
4872 gnus-tmp-closing-bracket ?\>)
4873 (setq gnus-tmp-opening-bracket ?\[
4874 gnus-tmp-closing-bracket ?\]))
4876 gnus-tmp-indentation
4877 (aref gnus-thread-indent-array gnus-tmp-level)
4878 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4879 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4880 gnus-summary-default-score 0)
4882 (if (or (null gnus-summary-default-score)
4883 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4884 gnus-summary-zcore-fuzz))
4886 (if (< gnus-tmp-score gnus-summary-default-score)
4887 gnus-score-below-mark gnus-score-over-mark))
4889 (cond ((memq number gnus-newsgroup-processable)
4891 ((memq number gnus-newsgroup-cached)
4893 ((memq number gnus-newsgroup-replied)
4895 ((memq number gnus-newsgroup-forwarded)
4896 gnus-forwarded-mark)
4897 ((memq number gnus-newsgroup-saved)
4899 ((memq number gnus-newsgroup-recent)
4901 ((memq number gnus-newsgroup-unseen)
4905 (cond ((memq number gnus-newsgroup-undownloaded)
4906 gnus-undownloaded-mark)
4907 (gnus-newsgroup-agentized
4908 gnus-downloaded-mark)
4911 gnus-tmp-from (mail-header-from gnus-tmp-header)
4914 ((string-match "<[^>]+> *$" gnus-tmp-from)
4915 (setq beg-match (match-beginning 0))
4916 (or (and (string-match "^\".+\"" gnus-tmp-from)
4917 (substring gnus-tmp-from 1 (1- (match-end 0))))
4918 (substring gnus-tmp-from 0 beg-match)))
4919 ((string-match "(.+)" gnus-tmp-from)
4920 (substring gnus-tmp-from
4921 (1+ (match-beginning 0)) (1- (match-end 0))))
4925 gnus-tmp-thread-tree-header-string
4927 ((not gnus-show-threads) "")
4928 ((zerop gnus-tmp-level)
4929 (cond ((cdar thread)
4930 (or gnus-sum-thread-tree-root subject))
4931 (gnus-tmp-new-adopts
4932 (or gnus-sum-thread-tree-false-root subject))
4934 (or gnus-sum-thread-tree-single-indent subject))))
4936 (concat (apply 'concat
4937 (mapcar (lambda (item)
4939 gnus-sum-thread-tree-vertical
4940 gnus-sum-thread-tree-indent))
4941 (cdr (reverse tree-stack))))
4943 gnus-sum-thread-tree-leaf-with-other
4944 gnus-sum-thread-tree-single-leaf)))))
4945 (when (string= gnus-tmp-name "")
4946 (setq gnus-tmp-name gnus-tmp-from))
4947 (unless (numberp gnus-tmp-lines)
4948 (setq gnus-tmp-lines -1))
4949 (if (= gnus-tmp-lines -1)
4950 (setq gnus-tmp-lines "?")
4951 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
4952 (gnus-put-text-property
4954 (progn (eval gnus-summary-line-format-spec) (point))
4955 'gnus-number number)
4958 (gnus-run-hooks 'gnus-summary-update-hook)
4961 (setq gnus-tmp-prev-subject simp-subject)))
4963 (when (nth 1 thread)
4964 (push (list (max 0 gnus-tmp-level)
4965 (copy-sequence tree-stack)
4968 (push (if (nth 1 thread) 1 0) tree-stack)
4969 (incf gnus-tmp-level)
4970 (setq threads (if thread-end nil (cdar thread)))
4971 (if gnus-summary-display-while-building
4974 ;; use a set frequency
4975 (setq building-line-count (1- building-line-count))
4976 (when (= building-line-count 0)
4978 (setq building-line-count
4979 gnus-summary-display-while-building)))
4983 (setq gnus-tmp-level 0)))))
4984 (gnus-message 7 "Generating summary...done"))
4986 (defun gnus-summary-prepare-unthreaded (headers)
4987 "Generate an unthreaded summary buffer based on HEADERS."
4988 (let (header number mark)
4993 ;; We may have to root out some bad articles...
4994 (when (memq (setq number (mail-header-number
4995 (setq header (pop headers))))
4996 gnus-newsgroup-limit)
4997 ;; Mark article as read when it has a low score.
4998 (when (and gnus-summary-mark-below
4999 (< (or (cdr (assq number gnus-newsgroup-scored))
5000 gnus-summary-default-score 0)
5001 gnus-summary-mark-below)
5002 (not (gnus-summary-article-ancient-p number)))
5003 (setq gnus-newsgroup-unreads
5004 (delq number gnus-newsgroup-unreads))
5005 (if gnus-newsgroup-auto-expire
5006 (push number gnus-newsgroup-expirable)
5007 (push (cons number gnus-low-score-mark)
5008 gnus-newsgroup-reads)))
5010 (setq mark (gnus-article-mark number))
5011 (push (gnus-data-make number mark (1+ (point)) header 0)
5012 gnus-newsgroup-data)
5013 (gnus-summary-insert-line
5015 (memq number gnus-newsgroup-undownloaded)
5016 mark (memq number gnus-newsgroup-replied)
5017 (memq number gnus-newsgroup-expirable)
5018 (mail-header-subject header) nil
5019 (cdr (assq number gnus-newsgroup-scored))
5020 (memq number gnus-newsgroup-processable))))))
5022 (defun gnus-summary-remove-list-identifiers ()
5023 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5024 (let ((regexp (if (consp gnus-list-identifiers)
5025 (mapconcat 'identity gnus-list-identifiers " *\\|")
5026 gnus-list-identifiers))
5029 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5030 (dolist (header gnus-newsgroup-headers)
5031 (setq subject (mail-header-subject header)
5033 (while (string-match regexp subject)
5035 (concat (substring subject 0 (match-beginning 1))
5036 (substring subject (match-end 0)))
5039 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5041 (concat (substring subject 0 (match-beginning 1))
5042 (substring subject (match-end 1)))))
5043 (mail-header-set-subject header subject))))))
5045 (defun gnus-fetch-headers (articles)
5046 "Fetch headers of ARTICLES."
5047 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5048 (gnus-message 5 "Fetching headers for %s..." name)
5051 (setq gnus-headers-retrieved-by
5052 (gnus-retrieve-headers
5053 articles gnus-newsgroup-name
5054 ;; We might want to fetch old headers, but
5055 ;; not if there is only 1 article.
5057 (not (eq gnus-fetch-old-headers 'some))
5058 (not (numberp gnus-fetch-old-headers)))
5059 (> (length articles) 1))
5060 gnus-fetch-old-headers))))
5061 (gnus-get-newsgroup-headers-xover
5062 articles nil nil gnus-newsgroup-name t)
5063 (gnus-get-newsgroup-headers))
5064 (gnus-message 5 "Fetching headers for %s...done" name))))
5066 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5067 "Select newsgroup GROUP.
5068 If READ-ALL is non-nil, all articles in the group are selected.
5069 If SELECT-ARTICLES, only select those articles from GROUP."
5070 (let* ((entry (gnus-group-entry group))
5071 ;;!!! Dirty hack; should be removed.
5072 (gnus-summary-ignore-duplicates
5073 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5075 gnus-summary-ignore-duplicates))
5076 (info (nth 2 entry))
5077 articles fetched-articles cached)
5079 (unless (gnus-check-server
5080 (set (make-local-variable 'gnus-current-select-method)
5081 (gnus-find-method-for-group group)))
5082 (error "Couldn't open server"))
5084 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5085 (gnus-activate-group group) ; Or we can activate it...
5086 (progn ; Or we bug out.
5087 (when (equal major-mode 'gnus-summary-mode)
5088 (gnus-kill-buffer (current-buffer)))
5089 (error "Couldn't activate group %s: %s"
5090 group (gnus-status-message group))))
5092 (unless (gnus-request-group group t)
5093 (when (equal major-mode 'gnus-summary-mode)
5094 (gnus-kill-buffer (current-buffer)))
5095 (error "Couldn't request group %s: %s"
5096 group (gnus-status-message group)))
5099 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5101 (setq gnus-summary-use-undownloaded-faces
5102 (gnus-agent-find-parameter
5104 'agent-enable-undownloaded-faces)))
5106 (setq gnus-newsgroup-name group
5107 gnus-newsgroup-unselected nil
5108 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5110 (let ((display (gnus-group-find-parameter group 'display)))
5111 (setq gnus-newsgroup-display
5113 ((not (zerop (or (car-safe read-all) 0)))
5114 ;; The user entered the group with C-u SPC/RET, let's show
5120 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5122 ;; The following is probably the "correct" solution, but
5123 ;; it makes Gnus fetch all headers and then limit the
5124 ;; articles (which is slow), so instead we hack the
5125 ;; select-articles parameter instead. -- Simon Josefsson
5128 ;; (gnus-byte-compile
5129 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5131 (setq select-articles
5132 (gnus-uncompress-range
5133 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5137 (cdr (gnus-active group)))))
5142 (gnus-summary-setup-default-charset)
5144 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5145 (when (gnus-virtual-group-p group)
5146 (setq cached gnus-newsgroup-cached))
5148 (setq gnus-newsgroup-unreads
5149 (gnus-sorted-ndifference
5150 (gnus-sorted-ndifference gnus-newsgroup-unreads
5151 gnus-newsgroup-marked)
5152 gnus-newsgroup-dormant))
5154 (setq gnus-newsgroup-processable nil)
5156 (gnus-update-read-articles group gnus-newsgroup-unreads)
5158 ;; Adjust and set lists of article marks.
5160 (gnus-adjust-marked-articles info))
5161 (if (setq articles select-articles)
5162 (setq gnus-newsgroup-unselected
5163 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5164 (setq articles (gnus-articles-to-read group read-all)))
5168 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5170 ((eq articles 0) nil)
5172 ;; Init the dependencies hash table.
5173 (setq gnus-newsgroup-dependencies
5174 (gnus-make-hashtable (length articles)))
5175 (gnus-set-global-variables)
5176 ;; Retrieve the headers and read them in.
5178 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5180 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5182 (setq gnus-newsgroup-cached cached))
5184 ;; Suppress duplicates?
5185 (when gnus-suppress-duplicates
5186 (gnus-dup-suppress-articles))
5188 ;; Set the initial limit.
5189 (setq gnus-newsgroup-limit (copy-sequence articles))
5190 ;; Remove canceled articles from the list of unread articles.
5191 (setq fetched-articles
5192 (mapcar (lambda (headers) (mail-header-number headers))
5193 gnus-newsgroup-headers))
5194 (setq gnus-newsgroup-articles fetched-articles)
5195 (setq gnus-newsgroup-unreads
5196 (gnus-sorted-nintersection
5197 gnus-newsgroup-unreads fetched-articles))
5198 (gnus-compute-unseen-list)
5200 ;; Removed marked articles that do not exist.
5201 (gnus-update-missing-marks
5202 (gnus-sorted-difference articles fetched-articles))
5203 ;; We might want to build some more threads first.
5204 (when (and gnus-fetch-old-headers
5205 (eq gnus-headers-retrieved-by 'nov))
5206 (if (eq gnus-fetch-old-headers 'invisible)
5207 (gnus-build-all-threads)
5208 (gnus-build-old-threads)))
5209 ;; Let the Gnus agent mark articles as read.
5211 (gnus-agent-get-undownloaded-list))
5212 ;; Remove list identifiers from subject
5213 (when gnus-list-identifiers
5214 (gnus-summary-remove-list-identifiers))
5215 ;; Check whether auto-expire is to be done in this group.
5216 (setq gnus-newsgroup-auto-expire
5217 (gnus-group-auto-expirable-p group))
5218 ;; Set up the article buffer now, if necessary.
5219 (unless gnus-single-article-buffer
5220 (gnus-article-setup-buffer))
5221 ;; First and last article in this newsgroup.
5222 (when gnus-newsgroup-headers
5223 (setq gnus-newsgroup-begin
5224 (mail-header-number (car gnus-newsgroup-headers))
5227 (gnus-last-element gnus-newsgroup-headers))))
5228 ;; GROUP is successfully selected.
5229 (or gnus-newsgroup-headers t)))))
5231 (defun gnus-compute-unseen-list ()
5232 ;; The `seen' marks are treated specially.
5233 (if (not gnus-newsgroup-seen)
5234 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5235 (setq gnus-newsgroup-unseen
5236 (gnus-inverse-list-range-intersection
5237 gnus-newsgroup-articles gnus-newsgroup-seen))))
5239 (defun gnus-summary-display-make-predicate (display)
5240 (require 'gnus-agent)
5241 (when (= (length display) 1)
5242 (setq display (car display)))
5243 (unless gnus-summary-display-cache
5244 (dolist (elem (append '((unread . unread)
5247 gnus-article-mark-lists))
5248 (push (cons (cdr elem)
5250 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5251 gnus-summary-display-cache)))
5252 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5253 (gnus-category-predicate-cache gnus-summary-display-cache))
5254 (gnus-get-predicate display)))
5256 ;; Uses the dynamically bound `number' variable.
5259 (defun gnus-article-marked-p (type &optional article)
5260 (let ((article (or article number)))
5263 (memq article gnus-newsgroup-marked))
5265 (memq article gnus-newsgroup-spam-marked))
5267 (memq article gnus-newsgroup-unsendable))
5268 ((eq type 'undownload)
5269 (memq article gnus-newsgroup-undownloaded))
5270 ((eq type 'download)
5271 (memq article gnus-newsgroup-downloadable))
5273 (memq article gnus-newsgroup-unreads))
5275 (memq article gnus-newsgroup-reads))
5277 (memq article gnus-newsgroup-dormant) )
5279 (memq article gnus-newsgroup-expirable))
5281 (memq article gnus-newsgroup-replied))
5283 (memq article gnus-newsgroup-killed))
5284 ((eq type 'bookmark)
5285 (assq article gnus-newsgroup-bookmarks))
5287 (assq article gnus-newsgroup-scored))
5289 (memq article gnus-newsgroup-saved))
5291 (memq article gnus-newsgroup-cached))
5293 (memq article gnus-newsgroup-forwarded))
5295 (not (memq article gnus-newsgroup-unseen)))
5297 (memq article gnus-newsgroup-recent))
5300 (defun gnus-articles-to-read (group &optional read-all)
5301 "Find out what articles the user wants to read."
5302 (let* ((display (gnus-group-find-parameter group 'display))
5304 ;; Select all articles if `read-all' is non-nil, or if there
5305 ;; are no unread articles.
5307 (and (zerop (length gnus-newsgroup-marked))
5308 (zerop (length gnus-newsgroup-unreads)))
5309 ;; Fetch all if the predicate is non-nil.
5310 gnus-newsgroup-display)
5311 ;; We want to select the headers for all the articles in
5312 ;; the group, so we select either all the active
5313 ;; articles in the group, or (if that's nil), the
5314 ;; articles in the cache.
5316 (gnus-uncompress-range (gnus-active group))
5317 (gnus-cache-articles-in-group group))
5318 ;; Select only the "normal" subset of articles.
5320 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5321 gnus-newsgroup-unreads)))
5322 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5323 (scored (length scored-list))
5324 (number (length articles))
5325 (marked (+ (length gnus-newsgroup-marked)
5326 (length gnus-newsgroup-dormant)))
5331 ((numberp gnus-newsgroup-display)
5332 gnus-newsgroup-display)
5336 ((and (or (<= scored marked) (= scored number))
5337 (numberp gnus-large-newsgroup)
5338 (> number gnus-large-newsgroup))
5339 (let* ((cursor-in-echo-area nil)
5340 (initial (gnus-parameter-large-newsgroup-initial
5341 gnus-newsgroup-name))
5345 "How many articles from %s (%s %d): "
5347 (gnus-group-decoded-name gnus-newsgroup-name)
5349 (if initial "max" "default")
5352 (cons (number-to-string initial)
5354 (if (string-match "^[ \t]*$" input) number input)))
5355 ((and (> scored marked) (< scored number)
5356 (> (- scored number) 20))
5359 (format "%s %s (%d scored, %d total): "
5360 "How many articles from"
5361 (gnus-group-decoded-name group)
5363 (if (string-match "^[ \t]*$" input)
5367 (message "Quit getting the articles to read")
5369 (setq select (if (stringp select) (string-to-number select) select))
5370 (if (or (null select) (zerop select))
5372 (if (and (not (zerop scored)) (<= (abs select) scored))
5374 (setq articles (sort scored-list '<))
5375 (setq number (length articles)))
5376 (setq articles (copy-sequence articles)))
5378 (when (< (abs select) number)
5380 ;; Select the N oldest articles.
5381 (setcdr (nthcdr (1- (abs select)) articles) nil)
5382 ;; Select the N most recent articles.
5383 (setq articles (nthcdr (- number select) articles))))
5384 (setq gnus-newsgroup-unselected
5385 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5386 (when gnus-alter-articles-to-read-function
5389 (funcall gnus-alter-articles-to-read-function
5390 gnus-newsgroup-name articles)
5394 (defun gnus-killed-articles (killed articles)
5397 (when (inline (gnus-member-of-range (car articles) killed))
5398 (push (car articles) out))
5399 (setq articles (cdr articles)))
5402 (defun gnus-uncompress-marks (marks)
5403 "Uncompress the mark ranges in MARKS."
5404 (let ((uncompressed '(score bookmark))
5407 (if (memq (caar marks) uncompressed)
5408 (push (car marks) out)
5409 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5410 (setq marks (cdr marks)))
5413 (defun gnus-article-mark-to-type (mark)
5414 "Return the type of MARK."
5415 (or (cadr (assq mark gnus-article-special-mark-lists))
5418 (defun gnus-article-unpropagatable-p (mark)
5419 "Return whether MARK should be propagated to back end."
5420 (memq mark gnus-article-unpropagated-mark-lists))
5422 (defun gnus-adjust-marked-articles (info)
5423 "Set all article lists and remove all marks that are no longer valid."
5424 (let* ((marked-lists (gnus-info-marks info))
5425 (active (gnus-active (gnus-info-group info)))
5428 (types gnus-article-mark-lists)
5429 marks var articles article mark mark-type
5432 (dolist (marks marked-lists)
5433 (setq mark (car marks)
5434 mark-type (gnus-article-mark-to-type mark)
5435 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5437 ;; We set the variable according to the type of the marks list,
5438 ;; and then adjust the marks to a subset of the active articles.
5440 ;; Adjust "simple" lists - compressed yet unsorted
5441 ((eq mark-type 'list)
5442 ;; Simultaneously uncompress and clip to active range
5443 ;; See gnus-uncompress-range for a description of possible marks
5445 (if (not (cadr marks))
5447 (setq articles (if (numberp (cddr marks))
5453 (while (setq article (pop articles))
5454 (cond ((consp article)
5455 (setq bgn (max (car article) min)
5456 end (min (cdr article) max))
5458 (setq l (setcdr l (cons bgn nil))
5460 ((and (<= min article)
5462 (setq l (setcdr l (cons article nil))))))
5463 (set var (cdr lh)))))
5465 ((eq mark-type 'tuple)
5466 (set var (setq articles (cdr marks)))
5467 (when (not (listp (cdr (symbol-value var))))
5468 (set var (list (symbol-value var))))
5469 (when (not (listp (cdr articles)))
5470 (setq articles (list articles)))
5472 (when (or (not (consp (setq article (pop articles))))
5473 (< (car article) min)
5474 (> (car article) max))
5475 (set var (delq article (symbol-value var))))))
5476 ;; Adjust ranges (sloppily).
5477 ((eq mark-type 'range)
5480 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5481 ;; It should be (seen (NUM1 . NUM2)).
5482 (when (numberp (cddr marks))
5483 (setcdr marks (list (cdr marks))))
5484 (setq articles (cdr marks))
5485 (while (and articles
5486 (or (and (consp (car articles))
5487 (> min (cdar articles)))
5488 (and (numberp (car articles))
5489 (> min (car articles)))))
5491 (set var articles))))))))
5493 (defun gnus-update-missing-marks (missing)
5494 "Go through the list of MISSING articles and remove them from the mark lists."
5497 ;; Go through all types.
5498 (dolist (elem gnus-article-mark-lists)
5499 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5500 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5501 (when (symbol-value var)
5502 ;; This list has articles. So we delete all missing
5503 ;; articles from it.
5506 (set var (delq (pop m) (symbol-value var))))))))))
5508 (defun gnus-update-marks ()
5509 "Enter the various lists of marked articles into the newsgroup info list."
5510 (let ((types gnus-article-mark-lists)
5511 (info (gnus-get-info gnus-newsgroup-name))
5512 type list newmarked symbol delta-marks)
5514 ;; Add all marks lists to the list of marks lists.
5515 (while (setq type (pop types))
5516 (setq list (symbol-value
5518 (intern (format "gnus-newsgroup-%s" (car type))))))
5521 ;; Get rid of the entries of the articles that have the
5523 (when (and (eq (cdr type) 'score)
5527 (prev (cons nil list))
5530 (if (or (not (consp (car arts)))
5531 (= (cdar arts) gnus-summary-default-score))
5532 (setcdr prev (cdr arts))
5534 (setq arts (cdr arts)))
5535 (setq list (cdr all)))))
5537 (when (eq (cdr type) 'seen)
5538 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5540 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5541 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5543 (when (and (gnus-check-backend-function
5544 'request-set-mark gnus-newsgroup-name)
5545 (not (gnus-article-unpropagatable-p (cdr type))))
5546 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5547 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5548 (add (gnus-remove-from-range
5549 (gnus-copy-sequence list) old)))
5551 (push (list add 'add (list (cdr type))) delta-marks))
5553 (push (list del 'del (list (cdr type))) delta-marks))))
5556 (push (cons (cdr type) list) newmarked)))
5559 (unless (gnus-check-group gnus-newsgroup-name)
5560 (error "Can't open server for %s" gnus-newsgroup-name))
5561 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5563 ;; Enter these new marks into the info of the group.
5565 (setcar (nthcdr 3 info) newmarked)
5566 ;; Add the marks lists to the end of the info.
5568 (setcdr (nthcdr 2 info) (list newmarked))))
5570 ;; Cut off the end of the info if there's nothing else there.
5574 (when (nthcdr (decf i) info)
5575 (setcdr (nthcdr i info) nil)))))))
5577 (defun gnus-set-mode-line (where)
5578 "Set the mode line of the article or summary buffers.
5579 If WHERE is `summary', the summary mode line format will be used."
5580 ;; Is this mode line one we keep updated?
5581 (when (and (memq where gnus-updated-mode-lines)
5583 (intern (format "gnus-%s-mode-line-format-spec" where))))
5586 ;; We evaluate this in the summary buffer since these
5587 ;; variables are buffer-local to that buffer.
5588 (set-buffer gnus-summary-buffer)
5589 ;; We bind all these variables that are used in the `eval' form
5591 (let* ((mformat (symbol-value
5593 (format "gnus-%s-mode-line-format-spec" where))))
5594 (gnus-tmp-group-name (gnus-group-decoded-name
5595 gnus-newsgroup-name))
5596 (gnus-tmp-article-number (or gnus-current-article 0))
5597 (gnus-tmp-unread gnus-newsgroup-unreads)
5598 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5599 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5600 (gnus-tmp-unread-and-unselected
5601 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5602 (zerop gnus-tmp-unselected))
5604 ((zerop gnus-tmp-unselected)
5605 (format "{%d more}" gnus-tmp-unread-and-unticked))
5606 (t (format "{%d(+%d) more}"
5607 gnus-tmp-unread-and-unticked
5608 gnus-tmp-unselected))))
5610 (if (and gnus-current-headers
5611 (vectorp gnus-current-headers))
5612 (gnus-mode-string-quote
5613 (mail-header-subject gnus-current-headers))
5615 bufname-length max-len
5616 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5617 (setq mode-string (eval mformat))
5618 (setq bufname-length (if (string-match "%b" mode-string)
5621 (if (eq where 'summary)
5623 (get-buffer gnus-article-buffer))))
5626 (setq max-len (max 4 (if gnus-mode-non-string-length
5628 gnus-mode-non-string-length
5630 (length mode-string))))
5631 ;; We might have to chop a bit of the string off...
5632 (when (> (length mode-string) max-len)
5634 (concat (truncate-string-to-width mode-string (- max-len 3))
5636 ;; Pad the mode string a bit.
5637 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5638 ;; Update the mode line.
5639 (setq mode-line-buffer-identification
5640 (gnus-mode-line-buffer-identification (list mode-string)))
5641 (set-buffer-modified-p t))))
5643 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5644 "Go through the HEADERS list and add all Xrefs to a hash table.
5645 The resulting hash table is returned, or nil if no Xrefs were found."
5646 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5647 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5648 (xref-hashtb (gnus-make-hashtable))
5649 start group entry number xrefs header)
5651 (setq header (pop headers))
5652 (when (and (setq xrefs (mail-header-xref header))
5653 (not (memq (setq number (mail-header-number header))
5656 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5657 (setq start (match-end 0))
5658 (setq group (if prefix
5659 (concat prefix (substring xrefs (match-beginning 1)
5661 (substring xrefs (match-beginning 1) (match-end 1))))
5663 (string-to-int (substring xrefs (match-beginning 2)
5665 (if (setq entry (gnus-gethash group xref-hashtb))
5666 (setcdr entry (cons number (cdr entry)))
5667 (gnus-sethash group (cons number nil) xref-hashtb)))))
5668 (and start xref-hashtb)))
5670 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5671 "Look through all the headers and mark the Xrefs as read."
5672 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5673 name info xref-hashtb idlist method nth4)
5675 (set-buffer gnus-group-buffer)
5676 (when (setq xref-hashtb
5677 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5680 (unless (string= from-newsgroup (setq name (symbol-name group)))
5681 (setq idlist (symbol-value group))
5682 ;; Dead groups are not updated.
5684 (setq info (gnus-get-info name))
5685 (when (stringp (setq nth4 (gnus-info-method info)))
5686 (setq nth4 (gnus-server-to-method nth4))))
5687 ;; Only do the xrefs if the group has the same
5688 ;; select method as the group we have just read.
5689 (or (gnus-methods-equal-p
5690 nth4 (gnus-find-method-for-group from-newsgroup))
5692 (equal nth4 (setq method (gnus-find-method-for-group
5694 (and (equal (car nth4) (car method))
5695 (equal (nth 1 nth4) (nth 1 method))))
5696 gnus-use-cross-reference
5697 (or (not (eq gnus-use-cross-reference t))
5699 ;; Only do cross-references on subscribed
5700 ;; groups, if that is what is wanted.
5701 (<= (gnus-info-level info) gnus-level-subscribed))
5702 (gnus-group-make-articles-read name idlist))))
5705 (defun gnus-compute-read-articles (group articles)
5706 (let* ((entry (gnus-group-entry group))
5707 (info (nth 2 entry))
5708 (active (gnus-active group))
5711 ;; First peel off all invalid article numbers.
5713 (let ((ids articles)
5715 (while (setq id (pop ids))
5716 (when (and first (> id (cdr active)))
5717 ;; We'll end up in this situation in one particular
5718 ;; obscure situation. If you re-scan a group and get
5719 ;; a new article that is cross-posted to a different
5720 ;; group that has not been re-scanned, you might get
5721 ;; crossposted article that has a higher number than
5722 ;; Gnus believes possible. So we re-activate this
5723 ;; group as well. This might mean doing the
5724 ;; crossposting thingy will *increase* the number
5725 ;; of articles in some groups. Tsk, tsk.
5726 (setq active (or (gnus-activate-group group) active)))
5727 (when (or (> id (cdr active))
5728 (< id (car active)))
5729 (setq articles (delq id articles))))))
5730 ;; If the read list is nil, we init it.
5732 (null (gnus-info-read info))
5734 (setq ninfo (cons 1 (1- (car active))))
5735 (setq ninfo (gnus-info-read info)))
5736 ;; Then we add the read articles to the range.
5738 ninfo (setq articles (sort articles '<))))))
5740 (defun gnus-group-make-articles-read (group articles)
5741 "Update the info of GROUP to say that ARTICLES are read."
5743 (entry (gnus-group-entry group))
5744 (info (nth 2 entry))
5745 (active (gnus-active group))
5748 (setq range (gnus-compute-read-articles group articles))
5749 (with-current-buffer gnus-group-buffer
5752 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5753 (gnus-info-set-read ',info ',(gnus-info-read info))
5754 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5755 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5756 (gnus-group-update-group ,group t))))
5757 ;; Add the read articles to the range.
5758 (gnus-info-set-read info range)
5759 (gnus-request-set-mark group (list (list range 'add '(read))))
5760 ;; Then we have to re-compute how many unread
5761 ;; articles there are in this group.
5765 (setq num (- (1+ (cdr active)) (car active))))
5766 ((not (listp (cdr range)))
5767 (setq num (- (cdr active) (- (1+ (cdr range))
5771 (if (numberp (car range))
5773 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5774 (setq range (cdr range)))
5775 (setq num (- (cdr active) num))))
5776 ;; Update the number of unread articles.
5778 ;; Update the group buffer.
5779 (unless (gnus-ephemeral-group-p group)
5780 (gnus-group-update-group group t))))))
5782 (defvar gnus-newsgroup-none-id 0)
5784 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5785 (let ((cur nntp-server-buffer)
5788 (with-current-buffer gnus-summary-buffer
5789 gnus-newsgroup-dependencies)))
5791 (mail-parse-charset gnus-newsgroup-charset)
5792 (mail-parse-ignored-charsets
5793 (save-excursion (condition-case nil
5794 (set-buffer gnus-summary-buffer)
5796 gnus-newsgroup-ignored-charsets)))
5798 (set-buffer nntp-server-buffer)
5799 ;; Translate all TAB characters into SPACE characters.
5800 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5801 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5802 (ietf-drums-unfold-fws)
5803 (gnus-run-hooks 'gnus-parse-headers-hook)
5804 (let ((case-fold-search t)
5805 in-reply-to header p lines chars)
5806 (goto-char (point-min))
5807 ;; Search to the beginning of the next header. Error messages
5808 ;; do not begin with 2 or 3.
5809 (while (re-search-forward "^[23][0-9]+ " nil t)
5812 ;; This implementation of this function, with nine
5813 ;; search-forwards instead of the one re-search-forward and
5814 ;; a case (which basically was the old function) is actually
5815 ;; about twice as fast, even though it looks messier. You
5816 ;; can't have everything, I guess. Speed and elegance
5817 ;; doesn't always go hand in hand.
5826 (narrow-to-region (point)
5827 (or (and (search-forward "\n.\n" nil t)
5833 (if (search-forward "\nsubject:" nil t)
5834 (funcall gnus-decode-encoded-word-function
5835 (nnheader-header-value))
5840 (if (search-forward "\nfrom:" nil t)
5841 (funcall gnus-decode-encoded-word-function
5842 (nnheader-header-value))
5847 (if (search-forward "\ndate:" nil t)
5848 (nnheader-header-value) ""))
5852 (setq id (if (re-search-forward
5853 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5854 ;; We do it this way to make sure the Message-ID
5855 ;; is (somewhat) syntactically valid.
5856 (buffer-substring (match-beginning 1)
5858 ;; If there was no message-id, we just fake one
5859 ;; to make subsequent routines simpler.
5860 (nnheader-generate-fake-message-id))))
5864 (if (search-forward "\nreferences:" nil t)
5868 (nnheader-header-value)
5873 (search-backward ">" end t)
5876 (search-backward "<" end t)
5878 ;; Get the references from the in-reply-to header if there
5879 ;; were no references and the in-reply-to header looks
5881 (if (and (search-forward "\nin-reply-to:" nil t)
5882 (setq in-reply-to (nnheader-header-value))
5883 (string-match "<[^>]+>" in-reply-to))
5885 (setq ref (substring in-reply-to (match-beginning 0)
5887 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5888 (setq ref2 (substring in-reply-to (match-beginning 0)
5890 (when (> (length ref2) (length ref))
5897 (if (search-forward "\nchars: " nil t)
5898 (if (numberp (setq chars (ignore-errors (read cur))))
5904 (if (search-forward "\nlines: " nil t)
5905 (if (numberp (setq lines (ignore-errors (read cur))))
5911 (and (search-forward "\nxref:" nil t)
5912 (nnheader-header-value)))
5914 (when gnus-extra-headers
5915 (let ((extra gnus-extra-headers)
5919 (when (search-forward
5920 (concat "\n" (symbol-name (car extra)) ":") nil t)
5921 (push (cons (car extra) (nnheader-header-value))
5925 (when (equal id ref)
5928 (when gnus-alter-header-function
5929 (funcall gnus-alter-header-function header)
5930 (setq id (mail-header-id header)
5931 ref (gnus-parent-id (mail-header-references header))))
5934 (gnus-dependencies-add-header
5935 header dependencies force-new))
5936 (push header headers))
5937 (goto-char (point-max))
5939 (nreverse headers)))))
5941 ;; Goes through the xover lines and returns a list of vectors
5942 (defun gnus-get-newsgroup-headers-xover (sequence &optional
5943 force-new dependencies
5944 group also-fetch-heads)
5945 "Parse the news overview data in the server buffer.
5946 Return a list of headers that match SEQUENCE (see
5947 `nntp-retrieve-headers')."
5948 ;; Get the Xref when the users reads the articles since most/some
5949 ;; NNTP servers do not include Xrefs when using XOVER.
5950 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
5951 (let ((mail-parse-charset gnus-newsgroup-charset)
5952 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
5953 (cur nntp-server-buffer)
5954 (dependencies (or dependencies gnus-newsgroup-dependencies))
5956 ((eq gnus-read-all-available-headers t)
5958 ((stringp gnus-read-all-available-headers)
5959 (string-match gnus-read-all-available-headers group))
5962 number headers header)
5964 (set-buffer nntp-server-buffer)
5965 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5966 ;; Allow the user to mangle the headers before parsing them.
5967 (gnus-run-hooks 'gnus-parse-headers-hook)
5968 (goto-char (point-min))
5969 (gnus-parse-without-error
5970 (while (and (or sequence allp)
5972 (setq number (read cur))
5974 (while (and sequence
5975 (< (car sequence) number))
5976 (setq sequence (cdr sequence))))
5979 (eq number (car sequence))))
5981 (setq sequence (cdr sequence))
5982 (setq header (inline
5983 (gnus-nov-parse-line
5984 number dependencies force-new)))))
5985 (push header headers))
5987 ;; A common bug in inn is that if you have posted an article and
5988 ;; then retrieves the active file, it will answer correctly --
5989 ;; the new article is included. However, a NOV entry for the
5990 ;; article may not have been generated yet, so this may fail.
5991 ;; We work around this problem by retrieving the last few
5992 ;; headers using HEAD.
5993 (if (or (not also-fetch-heads)
5995 ;; We (probably) got all the headers.
5997 (let ((gnus-nov-is-evil t))
6000 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6001 (gnus-get-newsgroup-headers))))))))
6003 (defun gnus-article-get-xrefs ()
6004 "Fill in the Xref value in `gnus-current-headers', if necessary.
6005 This is meant to be called in `gnus-article-internal-prepare-hook'."
6006 (let ((headers (with-current-buffer gnus-summary-buffer
6007 gnus-current-headers)))
6008 (or (not gnus-use-cross-reference)
6010 (and (mail-header-xref headers)
6011 (not (string= (mail-header-xref headers) "")))
6012 (let ((case-fold-search t)
6015 (nnheader-narrow-to-headers)
6016 (goto-char (point-min))
6017 (when (or (and (not (eobp))
6018 (eq (downcase (char-after)) ?x)
6019 (looking-at "Xref:"))
6020 (search-forward "\nXref:" nil t))
6021 (goto-char (1+ (match-end 0)))
6022 (setq xref (buffer-substring (point) (point-at-eol)))
6023 (mail-header-set-xref headers xref)))))))
6025 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6026 "Find article ID and insert the summary line for that article.
6027 OLD-HEADER can either be a header or a line number to insert
6028 the subject line on."
6029 (let* ((line (and (numberp old-header) old-header))
6030 (old-header (and (vectorp old-header) old-header))
6031 (header (cond ((and old-header use-old-header)
6034 (gnus-number-to-header id))
6035 (gnus-number-to-header id))
6037 (gnus-read-header id))))
6038 (number (and (numberp id) id))
6041 ;; Rebuild the thread that this article is part of and go to the
6042 ;; article we have fetched.
6043 (when (and (not gnus-show-threads)
6046 (setq d (gnus-data-find (mail-header-number old-header))))
6047 (goto-char (gnus-data-pos d))
6053 (gnus-delete-line))))))
6055 (mail-header-set-number header (mail-header-number old-header)))
6056 (setq gnus-newsgroup-sparse
6057 (delq (setq number (mail-header-number header))
6058 gnus-newsgroup-sparse))
6059 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6060 (push number gnus-newsgroup-limit)
6061 (gnus-rebuild-thread (mail-header-id header) line)
6062 (gnus-summary-goto-subject number nil t))
6063 (when (and (numberp number)
6065 ;; We have to update the boundaries even if we can't fetch the
6066 ;; article if ID is a number -- so that the next `P' or `N'
6067 ;; command will fetch the previous (or next) article even
6068 ;; if the one we tried to fetch this time has been canceled.
6069 (when (> number gnus-newsgroup-end)
6070 (setq gnus-newsgroup-end number))
6071 (when (< number gnus-newsgroup-begin)
6072 (setq gnus-newsgroup-begin number))
6073 (setq gnus-newsgroup-unselected
6074 (delq number gnus-newsgroup-unselected)))
6075 ;; Report back a success?
6076 (and header (mail-header-number header))))
6078 ;;; Process/prefix in the summary buffer
6080 (defun gnus-summary-work-articles (n)
6081 "Return a list of articles to be worked upon.
6082 The prefix argument, the list of process marked articles, and the
6083 current article will be taken into consideration."
6085 (set-buffer gnus-summary-buffer)
6088 ;; A numerical prefix has been given.
6089 (setq n (prefix-numeric-value n))
6090 (let ((backward (< n 0))
6091 (n (abs (prefix-numeric-value n)))
6096 (push (setq article (gnus-summary-article-number))
6099 (gnus-summary-find-prev nil article)
6100 (gnus-summary-find-next nil article)))
6102 (nreverse articles)))
6103 ((and (gnus-region-active-p) (mark))
6104 (message "region active")
6105 ;; Work on the region between point and mark.
6106 (let ((max (max (point) (mark)))
6109 (goto-char (min (min (point) (mark))))
6112 (push (setq article (gnus-summary-article-number)) articles)
6113 (gnus-summary-find-next nil article)
6115 (nreverse articles))))
6116 (gnus-newsgroup-processable
6117 ;; There are process-marked articles present.
6118 ;; Save current state.
6119 (gnus-summary-save-process-mark)
6121 (reverse gnus-newsgroup-processable))
6123 ;; Just return the current article.
6124 (list (gnus-summary-article-number))))))
6126 (defmacro gnus-summary-iterate (arg &rest forms)
6127 "Iterate over the process/prefixed articles and do FORMS.
6128 ARG is the interactive prefix given to the command. FORMS will be
6129 executed with point over the summary line of the articles."
6130 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6131 `(let ((,articles (gnus-summary-work-articles ,arg)))
6133 (gnus-summary-goto-subject (car ,articles))
6137 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6138 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6140 (defun gnus-summary-save-process-mark ()
6141 "Push the current set of process marked articles on the stack."
6143 (push (copy-sequence gnus-newsgroup-processable)
6144 gnus-newsgroup-process-stack))
6146 (defun gnus-summary-kill-process-mark ()
6147 "Push the current set of process marked articles on the stack and unmark."
6149 (gnus-summary-save-process-mark)
6150 (gnus-summary-unmark-all-processable))
6152 (defun gnus-summary-yank-process-mark ()
6153 "Pop the last process mark state off the stack and restore it."
6155 (unless gnus-newsgroup-process-stack
6156 (error "Empty mark stack"))
6157 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6159 (defun gnus-summary-process-mark-set (set)
6160 "Make SET into the current process marked articles."
6161 (gnus-summary-unmark-all-processable)
6163 (gnus-summary-set-process-mark (pop set))))
6165 ;;; Searching and stuff
6167 (defun gnus-summary-search-group (&optional backward use-level)
6168 "Search for next unread newsgroup.
6169 If optional argument BACKWARD is non-nil, search backward instead."
6171 (set-buffer gnus-group-buffer)
6172 (when (gnus-group-search-forward
6173 backward nil (if use-level (gnus-group-group-level) nil))
6174 (gnus-group-group-name))))
6176 (defun gnus-summary-best-group (&optional exclude-group)
6177 "Find the name of the best unread group.
6178 If EXCLUDE-GROUP, do not go to this group."
6179 (with-current-buffer gnus-group-buffer
6181 (gnus-group-best-unread-group exclude-group))))
6183 (defun gnus-summary-find-next (&optional unread article backward)
6185 (gnus-summary-find-prev unread article)
6186 (let* ((dummy (gnus-summary-article-intangible-p))
6187 (article (or article (gnus-summary-article-number)))
6188 (data (gnus-data-find-list article))
6190 (when (and (not dummy)
6191 (or (not gnus-summary-check-current)
6193 (not (gnus-data-unread-p (car data)))))
6194 (setq data (cdr data)))
6199 (unless (memq (gnus-data-number (car data))
6201 ((eq gnus-auto-goto-ignores
6202 'always-undownloaded)
6203 gnus-newsgroup-undownloaded)
6206 ((eq gnus-auto-goto-ignores
6208 gnus-newsgroup-unfetched)
6209 ((eq gnus-auto-goto-ignores
6211 gnus-newsgroup-undownloaded)))
6212 (when (gnus-data-unread-p (car data))
6213 (setq result (car data)
6215 (setq data (cdr data)))
6218 (goto-char (gnus-data-pos result))
6219 (gnus-data-number result)))))
6221 (defun gnus-summary-find-prev (&optional unread article)
6222 (let* ((eobp (eobp))
6223 (article (or article (gnus-summary-article-number)))
6224 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6226 (when (and (not eobp)
6227 (or (not gnus-summary-check-current)
6229 (not (gnus-data-unread-p (car data)))))
6230 (setq data (cdr data)))
6235 (unless (memq (gnus-data-number (car data))
6237 ((eq gnus-auto-goto-ignores
6238 'always-undownloaded)
6239 gnus-newsgroup-undownloaded)
6242 ((eq gnus-auto-goto-ignores
6244 gnus-newsgroup-unfetched)
6245 ((eq gnus-auto-goto-ignores
6247 gnus-newsgroup-undownloaded)))
6248 (when (gnus-data-unread-p (car data))
6249 (setq result (car data)
6251 (setq data (cdr data)))
6254 (goto-char (gnus-data-pos result))
6255 (gnus-data-number result))))
6257 (defun gnus-summary-find-subject (subject &optional unread backward article)
6258 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6259 (article (or article (gnus-summary-article-number)))
6260 (articles (gnus-data-list backward))
6261 (arts (gnus-data-find-list article articles))
6263 (when (or (not gnus-summary-check-current)
6265 (not (gnus-data-unread-p (car arts))))
6266 (setq arts (cdr arts)))
6268 (and (or (not unread)
6269 (gnus-data-unread-p (car arts)))
6270 (vectorp (gnus-data-header (car arts)))
6272 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6273 (setq result (car arts)
6275 (setq arts (cdr arts)))
6277 (goto-char (gnus-data-pos result))
6278 (gnus-data-number result))))
6280 (defun gnus-summary-search-forward (&optional unread subject backward)
6281 "Search forward for an article.
6282 If UNREAD, look for unread articles. If SUBJECT, look for
6283 articles with that subject. If BACKWARD, search backward instead."
6284 (cond (subject (gnus-summary-find-subject subject unread backward))
6285 (backward (gnus-summary-find-prev unread))
6286 (t (gnus-summary-find-next unread))))
6288 (defun gnus-recenter (&optional n)
6289 "Center point in window and redisplay frame.
6290 Also do horizontal recentering."
6292 (when (and gnus-auto-center-summary
6293 (not (eq gnus-auto-center-summary 'vertical)))
6294 (gnus-horizontal-recenter))
6297 (defun gnus-summary-recenter ()
6298 "Center point in the summary window.
6299 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6300 displayed, no centering will be performed."
6301 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6302 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6304 ;; The user has to want it.
6305 (when gnus-auto-center-summary
6306 (let* ((top (cond ((< (window-height) 4) 0)
6307 ((< (window-height) 7) 1)
6308 (t (if (numberp gnus-auto-center-summary)
6309 gnus-auto-center-summary
6310 (/ (1- (window-height)) 2))
6312 (height (1- (window-height)))
6313 (bottom (save-excursion (goto-char (point-max))
6314 (forward-line (- height))
6316 (window (get-buffer-window (current-buffer))))
6317 (when (get-buffer-window gnus-article-buffer)
6318 ;; Only do recentering when the article buffer is displayed,
6319 ;; Set the window start to either `bottom', which is the biggest
6320 ;; possible valid number, or the second line from the top,
6321 ;; whichever is the least.
6322 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6323 (if (> bottom top-pos)
6324 ;; Keep the second line from the top visible
6325 (set-window-start window top-pos t)
6326 ;; Try to keep the bottom line visible; if it's partially
6327 ;; obscured, either scroll one more line to make it fully
6328 ;; visible, or revert to using TOP-POS.
6330 (goto-char (point-max))
6332 (let ((last-line-start (point)))
6334 (set-window-start window (point) t)
6335 (when (not (pos-visible-in-window-p last-line-start window))
6337 (set-window-start window (min (point) top-pos) t)))))))
6338 ;; Do horizontal recentering while we're at it.
6339 (when (and (get-buffer-window (current-buffer) t)
6340 (not (eq gnus-auto-center-summary 'vertical)))
6341 (let ((selected (selected-window)))
6342 (select-window (get-buffer-window (current-buffer) t))
6343 (gnus-summary-position-point)
6344 (gnus-horizontal-recenter)
6345 (select-window selected))))))
6347 (defun gnus-summary-jump-to-group (newsgroup)
6348 "Move point to NEWSGROUP in group mode buffer."
6349 ;; Keep update point of group mode buffer if visible.
6350 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6351 (save-window-excursion
6352 ;; Take care of tree window mode.
6353 (when (get-buffer-window gnus-group-buffer)
6354 (pop-to-buffer gnus-group-buffer))
6355 (gnus-group-jump-to-group newsgroup))
6357 ;; Take care of tree window mode.
6358 (if (get-buffer-window gnus-group-buffer)
6359 (pop-to-buffer gnus-group-buffer)
6360 (set-buffer gnus-group-buffer))
6361 (gnus-group-jump-to-group newsgroup))))
6363 ;; This function returns a list of article numbers based on the
6364 ;; difference between the ranges of read articles in this group and
6365 ;; the range of active articles.
6366 (defun gnus-list-of-unread-articles (group)
6367 (let* ((read (gnus-info-read (gnus-get-info group)))
6368 (active (or (gnus-active group) (gnus-activate-group group)))
6371 ;; If none are read, then all are unread.
6373 (setq first (car active))
6374 ;; If the range of read articles is a single range, then the
6375 ;; first unread article is the article after the last read
6376 ;; article. Sounds logical, doesn't it?
6377 (if (and (not (listp (cdr read)))
6378 (or (< (car read) (car active))
6379 (progn (setq read (list read))
6381 (setq first (max (car active) (1+ (cdr read))))
6382 ;; `read' is a list of ranges.
6383 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6386 (setq first (car active)))
6389 (while (< first nlast)
6390 (setq unread (cons first unread)
6392 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6393 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6394 (setq read (cdr read)))))
6395 ;; And add the last unread articles.
6396 (while (<= first last)
6397 (setq unread (cons first unread)
6399 ;; Return the list of unread articles.
6400 (delq 0 (nreverse unread))))
6402 (defun gnus-list-of-read-articles (group)
6403 "Return a list of unread, unticked and non-dormant articles."
6404 (let* ((info (gnus-get-info group))
6405 (marked (gnus-info-marks info))
6406 (active (gnus-active group)))
6408 (gnus-list-range-difference
6409 (gnus-list-range-difference
6410 (gnus-sorted-complement
6411 (gnus-uncompress-range active)
6412 (gnus-list-of-unread-articles group))
6413 (cdr (assq 'dormant marked)))
6414 (cdr (assq 'tick marked))))))
6416 ;; This function returns a sequence of article numbers based on the
6417 ;; difference between the ranges of read articles in this group and
6418 ;; the range of active articles.
6419 (defun gnus-sequence-of-unread-articles (group)
6420 (let* ((read (gnus-info-read (gnus-get-info group)))
6421 (active (or (gnus-active group) (gnus-activate-group group)))
6424 ;; If none are read, then all are unread.
6426 (setq first (car active))
6427 ;; If the range of read articles is a single range, then the
6428 ;; first unread article is the article after the last read
6429 ;; article. Sounds logical, doesn't it?
6430 (if (and (not (listp (cdr read)))
6431 (or (< (car read) (car active))
6432 (progn (setq read (list read))
6434 (setq first (max (car active) (1+ (cdr read))))
6435 ;; `read' is a list of ranges.
6436 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6439 (setq first (car active)))
6442 (push (cons first nlast) unread))
6443 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6444 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6445 (setq read (cdr read)))))
6446 ;; And add the last unread articles.
6447 (cond ((< first last)
6448 (push (cons first last) unread))
6450 (push first unread)))
6451 ;; Return the sequence of unread articles.
6452 (delq 0 (nreverse unread))))
6454 ;; Various summary commands
6456 (defun gnus-summary-select-article-buffer ()
6457 "Reconfigure windows to show article buffer."
6459 (if (not (gnus-buffer-live-p gnus-article-buffer))
6460 (error "There is no article buffer for this summary buffer")
6461 (gnus-configure-windows 'article)
6462 (select-window (get-buffer-window gnus-article-buffer))))
6464 (defun gnus-summary-universal-argument (arg)
6465 "Perform any operation on all articles that are process/prefixed."
6467 (let ((articles (gnus-summary-work-articles arg))
6474 (substitute-command-keys
6475 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6477 (gnus-error 1 "Undefined key")
6480 (gnus-summary-goto-subject (setq article (pop articles)))
6481 (let (gnus-newsgroup-processable)
6482 (command-execute func))
6483 (gnus-summary-remove-process-mark article)))))
6484 (gnus-summary-position-point))
6486 (defun gnus-summary-toggle-truncation (&optional arg)
6487 "Toggle truncation of summary lines.
6488 With ARG, turn line truncation on if ARG is positive."
6490 (setq truncate-lines
6491 (if (null arg) (not truncate-lines)
6492 (> (prefix-numeric-value arg) 0)))
6495 (defun gnus-summary-find-for-reselect ()
6496 "Return the number of an article to stay on across a reselect.
6497 The current article is considered, then following articles, then previous
6498 articles. An article is sought which is not cancelled and isn't a temporary
6499 insertion from another group. If there's no such then return a dummy 0."
6501 (dolist (rev '(nil t))
6502 (unless found ; don't demand the reverse list if we don't need it
6503 (let ((data (gnus-data-find-list
6504 (gnus-summary-article-number) (gnus-data-list rev))))
6505 (while (and data (not found))
6506 (if (and (< 0 (gnus-data-number (car data)))
6507 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6508 (setq found (gnus-data-number (car data))))
6509 (setq data (cdr data))))))
6512 (defun gnus-summary-reselect-current-group (&optional all rescan)
6513 "Exit and then reselect the current newsgroup.
6514 The prefix argument ALL means to select all articles."
6516 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6517 (error "Ephemeral groups can't be reselected"))
6518 (let ((current-subject (gnus-summary-find-for-reselect))
6519 (group gnus-newsgroup-name))
6520 (setq gnus-newsgroup-begin nil)
6521 (gnus-summary-exit nil 'leave-hidden)
6522 ;; We have to adjust the point of group mode buffer because
6523 ;; point was moved to the next unread newsgroup by exiting.
6524 (gnus-summary-jump-to-group group)
6527 (gnus-group-get-new-news-this-group 1)))
6528 (gnus-group-read-group all t)
6529 (gnus-summary-goto-subject current-subject nil t)))
6531 (defun gnus-summary-rescan-group (&optional all)
6532 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6534 (gnus-summary-reselect-current-group all t))
6536 (defun gnus-summary-update-info (&optional non-destructive)
6538 (let ((group gnus-newsgroup-name))
6540 (when gnus-newsgroup-kill-headers
6541 (setq gnus-newsgroup-killed
6542 (gnus-compress-sequence
6544 (gnus-list-range-intersection
6545 gnus-newsgroup-unselected gnus-newsgroup-killed)
6546 gnus-newsgroup-unreads)
6548 (unless (listp (cdr gnus-newsgroup-killed))
6549 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6550 (let ((headers gnus-newsgroup-headers))
6551 ;; Set the new ranges of read articles.
6552 (with-current-buffer gnus-group-buffer
6553 (gnus-undo-force-boundary))
6554 (gnus-update-read-articles
6555 group (gnus-sorted-union
6556 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6557 ;; Set the current article marks.
6558 (let ((gnus-newsgroup-scored
6559 (if (and (not gnus-save-score)
6560 (not non-destructive))
6562 gnus-newsgroup-scored)))
6564 (gnus-update-marks)))
6565 ;; Do the cross-ref thing.
6566 (when gnus-use-cross-reference
6567 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6568 ;; Do not switch windows but change the buffer to work.
6569 (set-buffer gnus-group-buffer)
6570 (unless (gnus-ephemeral-group-p group)
6571 (gnus-group-update-group group)))))))
6573 (defun gnus-summary-save-newsrc (&optional force)
6574 "Save the current number of read/marked articles in the dribble buffer.
6575 The dribble buffer will then be saved.
6576 If FORCE (the prefix), also save the .newsrc file(s)."
6578 (gnus-summary-update-info t)
6580 (gnus-save-newsrc-file)
6581 (gnus-dribble-save)))
6583 (defun gnus-summary-exit (&optional temporary leave-hidden)
6584 "Exit reading current newsgroup, and then return to group selection mode.
6585 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6587 (gnus-set-global-variables)
6588 (when (gnus-buffer-live-p gnus-article-buffer)
6590 (set-buffer gnus-article-buffer)
6591 (mm-destroy-parts gnus-article-mime-handles)
6592 ;; Set it to nil for safety reason.
6593 (setq gnus-article-mime-handle-alist nil)
6594 (setq gnus-article-mime-handles nil)))
6595 (gnus-kill-save-kill-buffer)
6596 (gnus-async-halt-prefetch)
6597 (let* ((group gnus-newsgroup-name)
6598 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6599 (gnus-group-is-exiting-p t)
6602 (buf (current-buffer)))
6604 ;; Do adaptive scoring, and possibly save score files.
6605 (when gnus-newsgroup-adaptive
6606 (gnus-score-adaptive))
6607 (when gnus-use-scoring
6609 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6610 ;; If we have several article buffers, we kill them at exit.
6611 (unless gnus-single-article-buffer
6612 (gnus-kill-buffer gnus-original-article-buffer)
6613 (setq gnus-article-current nil))
6614 (when gnus-use-cache
6615 (gnus-cache-possibly-remove-articles)
6616 (gnus-cache-save-buffers))
6617 (gnus-async-prefetch-remove-group group)
6618 (when gnus-suppress-duplicates
6619 (gnus-dup-enter-articles))
6620 (when gnus-use-trees
6621 (gnus-tree-close group))
6622 (when gnus-use-cache
6623 (gnus-cache-write-active))
6624 ;; Remove entries for this group.
6625 (nnmail-purge-split-history (gnus-group-real-name group))
6626 ;; Make all changes in this group permanent.
6628 (gnus-run-hooks 'gnus-exit-group-hook)
6629 (gnus-summary-update-info))
6630 (gnus-close-group group)
6631 ;; Make sure where we were, and go to next newsgroup.
6632 (set-buffer gnus-group-buffer)
6634 (gnus-group-jump-to-group group))
6635 (gnus-run-hooks 'gnus-summary-exit-hook)
6636 (unless (or quit-config
6637 ;; If this group has disappeared from the summary
6638 ;; buffer, don't skip forwards.
6639 (not (string= group (gnus-group-group-name))))
6640 (gnus-group-next-unread-group 1))
6641 (setq group-point (point))
6644 ;; If we have several article buffers, we kill them at exit.
6645 (unless gnus-single-article-buffer
6646 (gnus-kill-buffer gnus-article-buffer)
6647 (gnus-kill-buffer gnus-original-article-buffer)
6648 (setq gnus-article-current nil))
6650 (if (not gnus-kill-summary-on-exit)
6652 (gnus-deaden-summary)
6654 ;; We set all buffer-local variables to nil. It is unclear why
6655 ;; this is needed, but if we don't, buffer-local variables are
6656 ;; not garbage-collected, it seems. This would the lead to en
6657 ;; ever-growing Emacs.
6658 (gnus-summary-clear-local-variables)
6659 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6660 (gnus-summary-clear-local-variables))
6661 (when (get-buffer gnus-article-buffer)
6662 (bury-buffer gnus-article-buffer))
6663 ;; We clear the global counterparts of the buffer-local
6664 ;; variables as well, just to be on the safe side.
6665 (set-buffer gnus-group-buffer)
6666 (gnus-summary-clear-local-variables)
6667 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6668 (gnus-summary-clear-local-variables))
6669 ;; Return to group mode buffer.
6670 (when (eq mode 'gnus-summary-mode)
6671 (gnus-kill-buffer buf)))
6672 (setq gnus-current-select-method gnus-select-method)
6674 (set-buffer gnus-group-buffer)
6675 (pop-to-buffer gnus-group-buffer))
6676 (if (not quit-config)
6678 (goto-char group-point)
6679 (unless leave-hidden
6680 (gnus-configure-windows 'group 'force)))
6681 (gnus-handle-ephemeral-exit quit-config))
6682 ;; Clear the current group name.
6684 (setq gnus-newsgroup-name nil)))))
6686 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6687 (defun gnus-summary-exit-no-update (&optional no-questions)
6688 "Quit reading current newsgroup without updating read article info."
6690 (let* ((group gnus-newsgroup-name)
6691 (gnus-group-is-exiting-p t)
6692 (gnus-group-is-exiting-without-update-p t)
6693 (quit-config (gnus-group-quit-config group)))
6694 (when (or no-questions
6696 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6697 (gnus-async-halt-prefetch)
6698 (run-hooks 'gnus-summary-prepare-exit-hook)
6699 (when (gnus-buffer-live-p gnus-article-buffer)
6701 (set-buffer gnus-article-buffer)
6702 (mm-destroy-parts gnus-article-mime-handles)
6703 ;; Set it to nil for safety reason.
6704 (setq gnus-article-mime-handle-alist nil)
6705 (setq gnus-article-mime-handles nil)))
6706 ;; If we have several article buffers, we kill them at exit.
6707 (unless gnus-single-article-buffer
6708 (gnus-kill-buffer gnus-article-buffer)
6709 (gnus-kill-buffer gnus-original-article-buffer)
6710 (setq gnus-article-current nil))
6711 (if (not gnus-kill-summary-on-exit)
6712 (gnus-deaden-summary)
6713 (gnus-close-group group)
6714 (gnus-summary-clear-local-variables)
6715 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6716 (gnus-summary-clear-local-variables))
6717 (set-buffer gnus-group-buffer)
6718 (gnus-summary-clear-local-variables)
6719 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6720 (gnus-summary-clear-local-variables))
6721 (gnus-kill-buffer gnus-summary-buffer))
6722 (unless gnus-single-article-buffer
6723 (setq gnus-article-current nil))
6724 (when gnus-use-trees
6725 (gnus-tree-close group))
6726 (gnus-async-prefetch-remove-group group)
6727 (when (get-buffer gnus-article-buffer)
6728 (bury-buffer gnus-article-buffer))
6729 ;; Return to the group buffer.
6730 (gnus-configure-windows 'group 'force)
6731 ;; Clear the current group name.
6732 (setq gnus-newsgroup-name nil)
6733 (unless (gnus-ephemeral-group-p group)
6734 (gnus-group-update-group group))
6735 (when (equal (gnus-group-group-name) group)
6736 (gnus-group-next-unread-group 1))
6738 (gnus-handle-ephemeral-exit quit-config)))))
6740 (defun gnus-handle-ephemeral-exit (quit-config)
6741 "Handle movement when leaving an ephemeral group.
6742 The state which existed when entering the ephemeral is reset."
6743 (if (not (buffer-name (car quit-config)))
6744 (gnus-configure-windows 'group 'force)
6745 (set-buffer (car quit-config))
6746 (cond ((eq major-mode 'gnus-summary-mode)
6747 (gnus-set-global-variables))
6748 ((eq major-mode 'gnus-article-mode)
6750 ;; The `gnus-summary-buffer' variable may point
6751 ;; to the old summary buffer when using a single
6753 (unless (gnus-buffer-live-p gnus-summary-buffer)
6754 (set-buffer gnus-group-buffer))
6755 (set-buffer gnus-summary-buffer)
6756 (gnus-set-global-variables))))
6757 (if (or (eq (cdr quit-config) 'article)
6758 (eq (cdr quit-config) 'pick))
6760 ;; The current article may be from the ephemeral group
6761 ;; thus it is best that we reload this article
6763 ;; If we're exiting from a large digest, this can be
6764 ;; extremely slow. So, it's better not to reload it. -- jh.
6765 ;;(gnus-summary-show-article)
6766 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6767 (gnus-configure-windows 'pick 'force)
6768 (gnus-configure-windows (cdr quit-config) 'force)))
6769 (gnus-configure-windows (cdr quit-config) 'force))
6770 (when (eq major-mode 'gnus-summary-mode)
6771 (gnus-summary-next-subject 1 nil t)
6772 (gnus-summary-recenter)
6773 (gnus-summary-position-point))))
6777 (defvar gnus-dead-summary-mode-map nil)
6779 (unless gnus-dead-summary-mode-map
6780 (setq gnus-dead-summary-mode-map (make-keymap))
6781 (suppress-keymap gnus-dead-summary-mode-map)
6782 (substitute-key-definition
6783 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6784 (dolist (key '("\C-d" "\r" "\177" [delete]))
6785 (define-key gnus-dead-summary-mode-map
6786 key 'gnus-summary-wake-up-the-dead))
6787 (dolist (key '("q" "Q"))
6788 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6790 (defvar gnus-dead-summary-mode nil
6791 "Minor mode for Gnus summary buffers.")
6793 (defun gnus-dead-summary-mode (&optional arg)
6794 "Minor mode for Gnus summary buffers."
6796 (when (eq major-mode 'gnus-summary-mode)
6797 (make-local-variable 'gnus-dead-summary-mode)
6798 (setq gnus-dead-summary-mode
6799 (if (null arg) (not gnus-dead-summary-mode)
6800 (> (prefix-numeric-value arg) 0)))
6801 (when gnus-dead-summary-mode
6803 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
6805 (defun gnus-deaden-summary ()
6806 "Make the current summary buffer into a dead summary buffer."
6807 ;; Kill any previous dead summary buffer.
6808 (when (and gnus-dead-summary
6809 (buffer-name gnus-dead-summary))
6810 (with-current-buffer gnus-dead-summary
6811 (when gnus-dead-summary-mode
6812 (kill-buffer (current-buffer)))))
6813 ;; Make this the current dead summary.
6814 (setq gnus-dead-summary (current-buffer))
6815 (gnus-dead-summary-mode 1)
6816 (let ((name (buffer-name)))
6817 (when (string-match "Summary" name)
6819 (concat (substring name 0 (match-beginning 0)) "Dead "
6820 (substring name (match-beginning 0)))
6824 (defun gnus-kill-or-deaden-summary (buffer)
6825 "Kill or deaden the summary BUFFER."
6827 (when (and (buffer-name buffer)
6828 (not gnus-single-article-buffer))
6829 (with-current-buffer buffer
6830 (gnus-kill-buffer gnus-article-buffer)
6831 (gnus-kill-buffer gnus-original-article-buffer)))
6834 (gnus-kill-summary-on-exit
6835 (when (and gnus-use-trees
6836 (gnus-buffer-exists-p buffer))
6839 (gnus-tree-close gnus-newsgroup-name)))
6840 (gnus-kill-buffer buffer))
6841 ;; Deaden the buffer.
6842 ((gnus-buffer-exists-p buffer)
6845 (gnus-deaden-summary))))))
6847 (defun gnus-summary-wake-up-the-dead (&rest args)
6848 "Wake up the dead summary buffer."
6850 (gnus-dead-summary-mode -1)
6851 (let ((name (buffer-name)))
6852 (when (string-match "Dead " name)
6854 (concat (substring name 0 (match-beginning 0))
6855 (substring name (match-end 0)))
6857 (gnus-message 3 "This dead summary is now alive again"))
6859 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
6860 (defun gnus-summary-fetch-faq (&optional faq-dir)
6861 "Fetch the FAQ for the current group.
6862 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
6866 (when current-prefix-arg
6868 "FAQ dir: " (and (listp gnus-group-faq-directory)
6870 gnus-group-faq-directory))))))
6871 (let (gnus-faq-buffer)
6872 (when (setq gnus-faq-buffer
6873 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
6874 (gnus-configure-windows 'summary-faq))))
6876 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
6877 (defun gnus-summary-describe-group (&optional force)
6878 "Describe the current newsgroup."
6880 (gnus-group-describe-group force gnus-newsgroup-name))
6882 (defun gnus-summary-describe-briefly ()
6883 "Describe summary mode commands briefly."
6885 (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")))
6887 ;; Walking around group mode buffer from summary mode.
6889 (defun gnus-summary-next-group (&optional no-article target-group backward)
6890 "Exit current newsgroup and then select next unread newsgroup.
6891 If prefix argument NO-ARTICLE is non-nil, no article is selected
6892 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
6893 previous group instead."
6895 ;; Stop pre-fetching.
6896 (gnus-async-halt-prefetch)
6897 (let ((current-group gnus-newsgroup-name)
6898 (current-buffer (current-buffer))
6900 ;; First we semi-exit this group to update Xrefs and all variables.
6901 ;; We can't do a real exit, because the window conf must remain
6902 ;; the same in case the user is prompted for info, and we don't
6903 ;; want the window conf to change before that...
6904 (gnus-summary-exit t)
6905 (while (not entered)
6906 ;; Then we find what group we are supposed to enter.
6907 (set-buffer gnus-group-buffer)
6908 (gnus-group-jump-to-group current-group)
6911 (if (eq gnus-keep-same-level 'best)
6912 (gnus-summary-best-group gnus-newsgroup-name)
6913 (gnus-summary-search-group backward gnus-keep-same-level))))
6914 (if (not target-group)
6915 ;; There are no further groups, so we return to the group
6918 (gnus-message 5 "Returning to the group buffer")
6920 (when (gnus-buffer-live-p current-buffer)
6921 (set-buffer current-buffer)
6922 (gnus-summary-exit))
6923 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
6924 ;; We try to enter the target group.
6925 (gnus-group-jump-to-group target-group)
6926 (let ((unreads (gnus-group-group-unread)))
6927 (if (and (or (eq t unreads)
6928 (and unreads (not (zerop unreads))))
6929 (gnus-summary-read-group
6930 target-group nil no-article
6931 (and (buffer-name current-buffer) current-buffer)
6934 (setq current-group target-group
6935 target-group nil)))))))
6937 (defun gnus-summary-prev-group (&optional no-article)
6938 "Exit current newsgroup and then select previous unread newsgroup.
6939 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
6941 (gnus-summary-next-group no-article nil t))
6943 ;; Walking around summary lines.
6945 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
6946 "Go to the first subject satisfying any non-nil constraint.
6947 If UNREAD is non-nil, the article should be unread.
6948 If UNDOWNLOADED is non-nil, the article should be undownloaded.
6949 If UNSEEN is non-nil, the article should be unseen.
6950 Returns the article selected or nil if there are no matching articles."
6954 ((null gnus-newsgroup-data)
6955 (gnus-message 3 "No articles in the group")
6957 ;; Pick the first article.
6958 ((not (or unread undownloaded unseen))
6959 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
6960 (gnus-data-number (car gnus-newsgroup-data)))
6961 ;; Find the first unread article.
6963 (let ((data gnus-newsgroup-data))
6965 (let ((num (gnus-data-number (car data))))
6966 (or (memq num gnus-newsgroup-unfetched)
6967 (not (or (and unread
6968 (memq num gnus-newsgroup-unreads))
6970 (memq num gnus-newsgroup-undownloaded))
6972 (memq num gnus-newsgroup-unseen)))))))
6973 (setq data (cdr data)))
6977 (goto-char (gnus-data-pos (car data)))
6978 (gnus-data-number (car data)))
6979 (gnus-message 3 "No more%s articles"
6980 (let* ((r (when unread " unread"))
6981 (d (when undownloaded " undownloaded"))
6982 (s (when unseen " unseen"))
6983 (l (delq nil (list r d s))))
6984 (cond ((= 3 (length l))
6985 (concat r "," d ", or" s))
6987 (concat (car l) ", or" (cadr l)))
6994 (gnus-summary-position-point))))))
6996 (defun gnus-summary-next-subject (n &optional unread dont-display)
6997 "Go to next N'th summary line.
6998 If N is negative, go to the previous N'th subject line.
6999 If UNREAD is non-nil, only unread articles are selected.
7000 The difference between N and the actual number of steps taken is
7003 (let ((backward (< n 0))
7007 (gnus-summary-find-prev unread)
7008 (gnus-summary-find-next unread)))
7009 (unless (zerop (setq n (1- n)))
7010 (gnus-summary-show-thread)))
7012 (gnus-message 7 "No more%s articles"
7013 (if unread " unread" "")))
7014 (unless dont-display
7015 (gnus-summary-recenter)
7016 (gnus-summary-position-point))
7019 (defun gnus-summary-next-unread-subject (n)
7020 "Go to next N'th unread summary line."
7022 (gnus-summary-next-subject n t))
7024 (defun gnus-summary-prev-subject (n &optional unread)
7025 "Go to previous N'th summary line.
7026 If optional argument UNREAD is non-nil, only unread article is selected."
7028 (gnus-summary-next-subject (- n) unread))
7030 (defun gnus-summary-prev-unread-subject (n)
7031 "Go to previous N'th unread summary line."
7033 (gnus-summary-next-subject (- n) t))
7035 (defun gnus-summary-goto-subjects (articles)
7036 "Insert the subject header for ARTICLES in the current buffer."
7038 (dolist (article articles)
7039 (gnus-summary-goto-subject article t)))
7040 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7041 (gnus-summary-position-point))
7043 (defun gnus-summary-goto-subject (article &optional force silent)
7044 "Go the subject line of ARTICLE.
7045 If FORCE, also allow jumping to articles not currently shown."
7046 (interactive "nArticle number: ")
7047 (unless (numberp article)
7048 (error "Article %s is not a number" article))
7050 (data (gnus-data-find article)))
7051 ;; We read in the article if we have to.
7054 (gnus-summary-insert-subject
7056 (if (or (numberp force) (vectorp force)) force)
7058 (setq data (gnus-data-find article)))
7063 (gnus-message 3 "Can't find article %d" article))
7065 (let ((pt (gnus-data-pos data)))
7067 (gnus-summary-set-article-display-arrow pt))
7068 (gnus-summary-position-point)
7071 ;; Walking around summary lines with displaying articles.
7073 (defun gnus-summary-expand-window (&optional arg)
7074 "Make the summary buffer take up the entire Emacs frame.
7075 Given a prefix, will force an `article' buffer configuration."
7078 (gnus-configure-windows 'article 'force)
7079 (gnus-configure-windows 'summary 'force)))
7081 (defun gnus-summary-display-article (article &optional all-header)
7082 "Display ARTICLE in article buffer."
7083 (when (gnus-buffer-live-p gnus-article-buffer)
7084 (with-current-buffer gnus-article-buffer
7085 (mm-enable-multibyte)))
7086 (gnus-set-global-variables)
7087 (when (gnus-buffer-live-p gnus-article-buffer)
7088 (with-current-buffer gnus-article-buffer
7089 (setq gnus-article-charset gnus-newsgroup-charset)
7090 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7091 (mm-enable-multibyte)))
7095 (if gnus-summary-display-article-function
7096 (funcall gnus-summary-display-article-function article all-header)
7097 (gnus-article-prepare article all-header))
7098 (gnus-run-hooks 'gnus-select-article-hook)
7099 (when (and gnus-current-article
7100 (not (zerop gnus-current-article)))
7101 (gnus-summary-goto-subject gnus-current-article))
7102 (gnus-summary-recenter)
7103 (when (and gnus-use-trees gnus-show-threads)
7104 (gnus-possibly-generate-tree article)
7105 (gnus-highlight-selected-tree article))
7106 ;; Successfully display article.
7107 (gnus-article-set-window-start
7108 (cdr (assq article gnus-newsgroup-bookmarks))))))
7110 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7111 "Select the current article.
7112 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7113 non-nil, the article will be re-fetched even if it already present in
7114 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7116 ;; Make sure we are in the summary buffer to work around bbdb bug.
7117 (unless (eq major-mode 'gnus-summary-mode)
7118 (set-buffer gnus-summary-buffer))
7119 (let ((article (or article (gnus-summary-article-number)))
7120 (all-headers (not (not all-headers))) ;Must be t or nil.
7121 gnus-summary-display-article-function)
7123 (gnus-summary-article-pseudo-p article)
7124 (error "This is a pseudo-article"))
7126 (set-buffer gnus-summary-buffer)
7127 (if (or (and gnus-single-article-buffer
7128 (or (null gnus-current-article)
7129 (null gnus-article-current)
7130 (null (get-buffer gnus-article-buffer))
7131 (not (eq article (cdr gnus-article-current)))
7132 (not (equal (car gnus-article-current)
7133 gnus-newsgroup-name))))
7134 (and (not gnus-single-article-buffer)
7135 (or (null gnus-current-article)
7136 (not (eq gnus-current-article article))))
7138 ;; The requested article is different from the current article.
7140 (gnus-summary-display-article article all-headers)
7141 (when (gnus-buffer-live-p gnus-article-buffer)
7142 (with-current-buffer gnus-article-buffer
7143 (if (not gnus-article-decoded-p) ;; a local variable
7144 (mm-disable-multibyte))))
7145 (gnus-article-set-window-start
7146 (cdr (assq article gnus-newsgroup-bookmarks)))
7150 (defun gnus-summary-force-verify-and-decrypt ()
7151 "Display buttons for signed/encrypted parts and verify/decrypt them."
7153 (let ((mm-verify-option 'known)
7154 (mm-decrypt-option 'known)
7155 (gnus-article-emulate-mime t)
7156 (gnus-buttonized-mime-types (append (list "multipart/signed"
7157 "multipart/encrypted")
7158 gnus-buttonized-mime-types)))
7159 (gnus-summary-select-article nil 'force)))
7161 (defun gnus-summary-set-current-mark (&optional current-mark)
7162 "Obsolete function."
7165 (defun gnus-summary-next-article (&optional unread subject backward push)
7166 "Select the next article.
7167 If UNREAD, only unread articles are selected.
7168 If SUBJECT, only articles with SUBJECT are selected.
7169 If BACKWARD, the previous article is selected instead of the next."
7172 ;; Is there such an article?
7173 ((and (gnus-summary-search-forward unread subject backward)
7174 (or (gnus-summary-display-article (gnus-summary-article-number))
7175 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7176 (gnus-summary-position-point))
7177 ;; If not, we try the first unread, if that is wanted.
7179 gnus-auto-select-same
7180 (gnus-summary-first-unread-article))
7181 (gnus-summary-position-point)
7182 (gnus-message 6 "Wrapped"))
7183 ;; Try to get next/previous article not displayed in this group.
7184 ((and gnus-auto-extend-newsgroup
7185 (not unread) (not subject))
7186 (gnus-summary-goto-article
7187 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7188 nil (count-lines (point-min) (point))))
7189 ;; Go to next/previous group.
7191 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7192 (gnus-summary-jump-to-group gnus-newsgroup-name))
7193 (let ((cmd last-command-char)
7195 (with-current-buffer gnus-group-buffer
7198 (if (eq gnus-keep-same-level 'best)
7199 (gnus-summary-best-group gnus-newsgroup-name)
7200 (gnus-summary-search-group backward gnus-keep-same-level))))
7201 ;; For some reason, the group window gets selected. We change
7203 (select-window (get-buffer-window (current-buffer)))
7204 ;; Select next unread newsgroup automagically.
7206 ((or (not gnus-auto-select-next)
7208 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7209 ((or (eq gnus-auto-select-next 'quietly)
7210 (and (eq gnus-auto-select-next 'slightly-quietly)
7212 (and (eq gnus-auto-select-next 'almost-quietly)
7213 (gnus-summary-last-article-p)))
7215 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7217 (gnus-message 7 "No more%s articles (%s)..."
7218 (if unread " unread" "")
7219 (if group (concat "selecting " group)
7221 (gnus-summary-next-group nil group backward)))
7223 (when (gnus-key-press-event-p last-input-event)
7224 (gnus-summary-walk-group-buffer
7225 gnus-newsgroup-name cmd unread backward point))))))))
7227 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7228 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7229 (?\C-p (gnus-group-prev-unread-group 1))))
7230 (cursor-in-echo-area t)
7231 keve key group ended prompt)
7233 (set-buffer gnus-group-buffer)
7236 (if (eq gnus-keep-same-level 'best)
7237 (gnus-summary-best-group gnus-newsgroup-name)
7238 (gnus-summary-search-group backward gnus-keep-same-level))))
7242 "No more%s articles%s " (if unread " unread" "")
7244 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7245 (format " (Type %s for %s [%s])"
7246 (single-key-description cmd) group
7247 (gnus-group-unread group))
7248 (format " (Type %s to exit %s)"
7249 (single-key-description cmd)
7250 gnus-newsgroup-name))))
7251 ;; Confirm auto selection.
7252 (setq key (car (setq keve (gnus-read-event-char prompt)))
7255 ((assq key keystrokes)
7256 (let ((obuf (current-buffer)))
7257 (switch-to-buffer gnus-group-buffer)
7259 (gnus-group-jump-to-group group))
7260 (eval (cadr (assq key keystrokes)))
7261 (setq group (gnus-group-group-name))
7262 (switch-to-buffer obuf))
7266 (gnus-ephemeral-group-p gnus-newsgroup-name))
7268 (gnus-summary-next-group nil group backward)))
7270 (push (cdr keve) unread-command-events))))))
7272 (defun gnus-summary-next-unread-article ()
7273 "Select unread article after current one."
7275 (gnus-summary-next-article
7276 (or (not (eq gnus-summary-goto-unread 'never))
7277 (gnus-summary-last-article-p (gnus-summary-article-number)))
7278 (and gnus-auto-select-same
7279 (gnus-summary-article-subject))))
7281 (defun gnus-summary-prev-article (&optional unread subject)
7282 "Select the article after the current one.
7283 If UNREAD is non-nil, only unread articles are selected."
7285 (gnus-summary-next-article unread subject t))
7287 (defun gnus-summary-prev-unread-article ()
7288 "Select unread article before current one."
7290 (gnus-summary-prev-article
7291 (or (not (eq gnus-summary-goto-unread 'never))
7292 (gnus-summary-first-article-p (gnus-summary-article-number)))
7293 (and gnus-auto-select-same
7294 (gnus-summary-article-subject))))
7296 (defun gnus-summary-next-page (&optional lines circular stop)
7297 "Show next page of the selected article.
7298 If at the end of the current article, select the next article.
7299 LINES says how many lines should be scrolled up.
7301 If CIRCULAR is non-nil, go to the start of the article instead of
7302 selecting the next article when reaching the end of the current
7305 If STOP is non-nil, just stop when reaching the end of the message.
7307 Also see the variable `gnus-article-skip-boring'."
7309 (setq gnus-summary-buffer (current-buffer))
7310 (gnus-set-global-variables)
7311 (let ((article (gnus-summary-article-number))
7312 (article-window (get-buffer-window gnus-article-buffer t))
7314 ;; If the buffer is empty, we have no article.
7316 (error "No article to select"))
7317 (gnus-configure-windows 'article)
7318 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7319 (if (and (eq gnus-summary-goto-unread 'never)
7320 (not (gnus-summary-last-article-p article)))
7321 (gnus-summary-next-article)
7322 (gnus-summary-next-unread-article))
7323 (if (or (null gnus-current-article)
7324 (null gnus-article-current)
7325 (/= article (cdr gnus-article-current))
7326 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7327 ;; Selected subject is different from current article's.
7328 (gnus-summary-display-article article)
7329 (when article-window
7330 (gnus-eval-in-buffer-window gnus-article-buffer
7331 (setq endp (or (gnus-article-next-page lines)
7332 (gnus-article-only-boring-p))))
7335 (gnus-message 3 "End of message"))
7337 (gnus-summary-beginning-of-article))
7339 (gnus-message 3 "End of message"))
7341 (if (and (eq gnus-summary-goto-unread 'never)
7342 (not (gnus-summary-last-article-p article)))
7343 (gnus-summary-next-article)
7344 (gnus-summary-next-unread-article))))))))
7345 (gnus-summary-recenter)
7346 (gnus-summary-position-point)))
7348 (defun gnus-summary-prev-page (&optional lines move)
7349 "Show previous page of selected article.
7350 Argument LINES specifies lines to be scrolled down.
7351 If MOVE, move to the previous unread article if point is at
7352 the beginning of the buffer."
7354 (let ((article (gnus-summary-article-number))
7355 (article-window (get-buffer-window gnus-article-buffer t))
7357 (gnus-configure-windows 'article)
7358 (if (or (null gnus-current-article)
7359 (null gnus-article-current)
7360 (/= article (cdr gnus-article-current))
7361 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7362 ;; Selected subject is different from current article's.
7363 (gnus-summary-display-article article)
7364 (gnus-summary-recenter)
7365 (when article-window
7366 (gnus-eval-in-buffer-window gnus-article-buffer
7367 (setq endp (gnus-article-prev-page lines)))
7368 (when (and move endp)
7370 (gnus-message 3 "Beginning of message"))
7372 (if (and (eq gnus-summary-goto-unread 'never)
7373 (not (gnus-summary-first-article-p article)))
7374 (gnus-summary-prev-article)
7375 (gnus-summary-prev-unread-article))))))))
7376 (gnus-summary-position-point))
7378 (defun gnus-summary-prev-page-or-article (&optional lines)
7379 "Show previous page of selected article.
7380 Argument LINES specifies lines to be scrolled down.
7381 If at the beginning of the article, go to the next article."
7383 (gnus-summary-prev-page lines t))
7385 (defun gnus-summary-scroll-up (lines)
7386 "Scroll up (or down) one line current article.
7387 Argument LINES specifies lines to be scrolled up (or down if negative)."
7389 (gnus-configure-windows 'article)
7390 (gnus-summary-show-thread)
7391 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7392 (gnus-eval-in-buffer-window gnus-article-buffer
7394 (when (gnus-article-next-page lines)
7395 (gnus-message 3 "End of message")))
7397 (gnus-article-prev-page (- lines))))))
7398 (gnus-summary-recenter)
7399 (gnus-summary-position-point))
7401 (defun gnus-summary-scroll-down (lines)
7402 "Scroll down (or up) one line current article.
7403 Argument LINES specifies lines to be scrolled down (or up if negative)."
7405 (gnus-summary-scroll-up (- lines)))
7407 (defun gnus-summary-next-same-subject ()
7408 "Select next article which has the same subject as current one."
7410 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7412 (defun gnus-summary-prev-same-subject ()
7413 "Select previous article which has the same subject as current one."
7415 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7417 (defun gnus-summary-next-unread-same-subject ()
7418 "Select next unread article which has the same subject as current one."
7420 (gnus-summary-next-article t (gnus-summary-article-subject)))
7422 (defun gnus-summary-prev-unread-same-subject ()
7423 "Select previous unread article which has the same subject as current one."
7425 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7427 (defun gnus-summary-first-unread-article ()
7428 "Select the first unread article.
7429 Return nil if there are no unread articles."
7432 (when (gnus-summary-first-subject t)
7433 (gnus-summary-show-thread)
7434 (gnus-summary-first-subject t)
7435 (gnus-summary-display-article (gnus-summary-article-number)))
7436 (gnus-summary-position-point)))
7438 (defun gnus-summary-first-unread-subject ()
7439 "Place the point on the subject line of the first unread article.
7440 Return nil if there are no unread articles."
7443 (when (gnus-summary-first-subject t)
7444 (gnus-summary-show-thread)
7445 (gnus-summary-first-subject t))
7446 (gnus-summary-position-point)))
7448 (defun gnus-summary-first-unseen-subject ()
7449 "Place the point on the subject line of the first unseen article.
7450 Return nil if there are no unseen articles."
7453 (when (gnus-summary-first-subject nil nil t)
7454 (gnus-summary-show-thread)
7455 (gnus-summary-first-subject nil nil t))
7456 (gnus-summary-position-point)))
7458 (defun gnus-summary-first-unseen-or-unread-subject ()
7459 "Place the point on the subject line of the first unseen article or,
7460 if all article have been seen, on the subject line of the first unread
7464 (unless (when (gnus-summary-first-subject nil nil t)
7465 (gnus-summary-show-thread)
7466 (gnus-summary-first-subject nil nil t))
7467 (when (gnus-summary-first-subject t)
7468 (gnus-summary-show-thread)
7469 (gnus-summary-first-subject t)))
7470 (gnus-summary-position-point)))
7472 (defun gnus-summary-first-article ()
7473 "Select the first article.
7474 Return nil if there are no articles."
7477 (when (gnus-summary-first-subject)
7478 (gnus-summary-show-thread)
7479 (gnus-summary-first-subject)
7480 (gnus-summary-display-article (gnus-summary-article-number)))
7481 (gnus-summary-position-point)))
7483 (defun gnus-summary-best-unread-article (&optional arg)
7484 "Select the unread article with the highest score.
7485 If given a prefix argument, select the next unread article that has a
7486 score higher than the default score."
7488 (let ((article (if arg
7489 (gnus-summary-better-unread-subject)
7490 (gnus-summary-best-unread-subject))))
7492 (gnus-summary-goto-article article)
7493 (error "No unread articles"))))
7495 (defun gnus-summary-best-unread-subject ()
7496 "Select the unread subject with the highest score."
7498 (let ((best -1000000)
7499 (data gnus-newsgroup-data)
7502 (and (gnus-data-unread-p (car data))
7504 (gnus-summary-article-score (gnus-data-number (car data))))
7507 article (gnus-data-number (car data))))
7508 (setq data (cdr data)))
7510 (gnus-summary-goto-subject article))
7511 (gnus-summary-position-point)
7514 (defun gnus-summary-better-unread-subject ()
7515 "Select the first unread subject that has a score over the default score."
7517 (let ((data gnus-newsgroup-data)
7519 (while (and (setq article (gnus-data-number (car data)))
7520 (or (gnus-data-read-p (car data))
7521 (not (> (gnus-summary-article-score article)
7522 gnus-summary-default-score))))
7523 (setq data (cdr data)))
7525 (gnus-summary-goto-subject article))
7526 (gnus-summary-position-point)
7529 (defun gnus-summary-last-subject ()
7530 "Go to the last displayed subject line in the group."
7531 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7533 (gnus-summary-goto-subject article))))
7535 (defun gnus-summary-goto-article (article &optional all-headers force)
7536 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7537 If ALL-HEADERS is non-nil, no header lines are hidden.
7538 If FORCE, go to the article even if it isn't displayed. If FORCE
7539 is a number, it is the line the article is to be displayed on."
7543 "Article number or Message-ID: "
7544 (mapcar (lambda (number) (list (int-to-string number)))
7545 gnus-newsgroup-limit))
7549 (if (and (stringp article)
7550 (string-match "@\\|%40" article))
7551 (gnus-summary-refer-article article)
7552 (when (stringp article)
7553 (setq article (string-to-number article)))
7554 (if (gnus-summary-goto-subject article force)
7555 (gnus-summary-display-article article all-headers)
7556 (gnus-message 4 "Couldn't go to article %s" article) nil))
7557 (gnus-summary-position-point)))
7559 (defun gnus-summary-goto-last-article ()
7560 "Go to the previously read article."
7563 (when gnus-last-article
7564 (gnus-summary-goto-article gnus-last-article nil t))
7565 (gnus-summary-position-point)))
7567 (defun gnus-summary-pop-article (number)
7568 "Pop one article off the history and go to the previous.
7569 NUMBER articles will be popped off."
7572 (setq gnus-newsgroup-history
7573 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7575 (gnus-summary-goto-article (car to) nil t)
7576 (error "Article history empty")))
7577 (gnus-summary-position-point))
7579 ;; Summary commands and functions for limiting the summary buffer.
7581 (defun gnus-summary-limit-to-articles (n)
7582 "Limit the summary buffer to the next N articles.
7583 If not given a prefix, use the process marked articles instead."
7586 (let ((articles (gnus-summary-work-articles n)))
7587 (setq gnus-newsgroup-processable nil)
7588 (gnus-summary-limit articles))
7589 (gnus-summary-position-point)))
7591 (defun gnus-summary-pop-limit (&optional total)
7592 "Restore the previous limit.
7593 If given a prefix, remove all limits."
7596 (setq gnus-newsgroup-limits
7597 (list (mapcar (lambda (h) (mail-header-number h))
7598 gnus-newsgroup-headers))))
7599 (unless gnus-newsgroup-limits
7600 (error "No limit to pop"))
7602 (gnus-summary-limit nil 'pop)
7603 (gnus-summary-position-point)))
7605 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7606 "Limit the summary buffer to articles that have subjects that match a regexp.
7607 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7609 (list (read-string (if current-prefix-arg
7610 "Exclude subject (regexp): "
7611 "Limit to subject (regexp): "))
7612 nil current-prefix-arg))
7614 (setq header "subject"))
7615 (when (not (equal "" subject))
7617 (let ((articles (gnus-summary-find-matching
7618 (or header "subject") subject 'all nil nil
7621 (error "Found no matches for \"%s\"" subject))
7622 (gnus-summary-limit articles))
7623 (gnus-summary-position-point))))
7625 (defun gnus-summary-limit-to-author (from &optional not-matching)
7626 "Limit the summary buffer to articles that have authors that match a regexp.
7627 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7629 (list (read-string (if current-prefix-arg
7630 "Exclude author (regexp): "
7631 "Limit to author (regexp): "))
7632 current-prefix-arg))
7633 (gnus-summary-limit-to-subject from "from" not-matching))
7635 (defun gnus-summary-limit-to-age (age &optional younger-p)
7636 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7637 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7638 articles that are younger than AGE days."
7640 (let ((younger current-prefix-arg)
7643 (while (not days-got)
7644 (setq days (if younger
7645 (read-string "Limit to articles younger than (in days, older when negative): ")
7647 "Limit to articles older than (in days, younger when negative): ")))
7648 (when (> (length days) 0)
7649 (setq days (read days)))
7654 (setq younger (not younger))
7655 (setq days (* days -1))))
7656 (message "Please enter a number.")
7658 (list days younger)))
7660 (let ((data gnus-newsgroup-data)
7661 (cutoff (days-to-time age))
7662 articles d date is-younger)
7663 (while (setq d (pop data))
7664 (when (and (vectorp (gnus-data-header d))
7665 (setq date (mail-header-date (gnus-data-header d))))
7666 (setq is-younger (time-less-p
7667 (time-since (condition-case ()
7674 (push (gnus-data-number d) articles))))
7675 (gnus-summary-limit (nreverse articles)))
7676 (gnus-summary-position-point)))
7678 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7679 "Limit the summary buffer to articles that match an 'extra' header."
7683 (gnus-completing-read-with-default
7684 (symbol-name (car gnus-extra-headers))
7685 (if current-prefix-arg
7686 "Exclude extra header:"
7687 "Limit extra header:")
7689 (cons (symbol-name x) x))
7694 (read-string (format "%s header %s (regexp): "
7695 (if current-prefix-arg "Exclude" "Limit to")
7697 current-prefix-arg)))
7698 (when (not (equal "" regexp))
7700 (let ((articles (gnus-summary-find-matching
7701 (cons 'extra header) regexp 'all nil nil
7704 (error "Found no matches for \"%s\"" regexp))
7705 (gnus-summary-limit articles))
7706 (gnus-summary-position-point))))
7708 (defun gnus-summary-limit-to-display-predicate ()
7709 "Limit the summary buffer to the predicated in the `display' group parameter."
7711 (unless gnus-newsgroup-display
7712 (error "There is no `display' group parameter"))
7714 (dolist (number gnus-newsgroup-articles)
7715 (when (funcall gnus-newsgroup-display)
7716 (push number articles)))
7717 (gnus-summary-limit articles))
7718 (gnus-summary-position-point))
7720 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7722 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7724 (defun gnus-summary-limit-to-unread (&optional all)
7725 "Limit the summary buffer to articles that are not marked as read.
7726 If ALL is non-nil, limit strictly to unread articles."
7729 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7730 (gnus-summary-limit-to-marks
7731 ;; Concat all the marks that say that an article is read and have
7733 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7734 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7735 gnus-low-score-mark gnus-expirable-mark
7736 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7737 gnus-duplicate-mark gnus-souped-mark)
7740 (defun gnus-summary-limit-to-replied (&optional unreplied)
7741 "Limit the summary buffer to replied articles.
7742 If UNREPLIED (the prefix), limit to unreplied articles."
7746 (gnus-set-difference gnus-newsgroup-articles
7747 gnus-newsgroup-replied))
7748 (gnus-summary-limit gnus-newsgroup-replied))
7749 (gnus-summary-position-point))
7751 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7752 (make-obsolete 'gnus-summary-delete-marked-with
7753 'gnus-summary-limit-exclude-marks)
7755 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7756 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7757 If REVERSE, limit the summary buffer to articles that are marked
7758 with MARKS. MARKS can either be a string of marks or a list of marks.
7759 Returns how many articles were removed."
7760 (interactive "sMarks: ")
7761 (gnus-summary-limit-to-marks marks t))
7763 (defun gnus-summary-limit-to-marks (marks &optional reverse)
7764 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
7765 If REVERSE (the prefix), limit the summary buffer to articles that are
7766 not marked with MARKS. MARKS can either be a string of marks or a
7768 Returns how many articles were removed."
7769 (interactive "sMarks: \nP")
7771 (let ((data gnus-newsgroup-data)
7772 (marks (if (listp marks) marks
7773 (append marks nil))) ; Transform to list.
7776 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
7777 (memq (gnus-data-mark (car data)) marks))
7778 (push (gnus-data-number (car data)) articles))
7779 (setq data (cdr data)))
7780 (gnus-summary-limit articles))
7781 (gnus-summary-position-point)))
7783 (defun gnus-summary-limit-to-score (score)
7784 "Limit to articles with score at or above SCORE."
7785 (interactive "NLimit to articles with score of at least: ")
7786 (let ((data gnus-newsgroup-data)
7789 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
7791 (push (gnus-data-number (car data)) articles))
7792 (setq data (cdr data)))
7794 (gnus-summary-limit articles)
7795 (gnus-summary-position-point))))
7797 (defun gnus-summary-limit-to-unseen ()
7798 "Limit to unseen articles."
7801 (gnus-summary-limit gnus-newsgroup-unseen)
7802 (gnus-summary-position-point)))
7804 (defun gnus-summary-limit-include-thread (id)
7805 "Display all the hidden articles that is in the thread with ID in it.
7806 When called interactively, ID is the Message-ID of the current
7808 (interactive (list (mail-header-id (gnus-summary-article-header))))
7809 (let ((articles (gnus-articles-in-thread
7810 (gnus-id-to-thread (gnus-root-id id)))))
7812 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7813 (gnus-summary-limit-include-matching-articles
7815 (regexp-quote (gnus-simplify-subject-re
7816 (mail-header-subject (gnus-id-to-header id)))))
7817 (gnus-summary-position-point))))
7819 (defun gnus-summary-limit-include-matching-articles (header regexp)
7820 "Display all the hidden articles that have HEADERs that match REGEXP."
7821 (interactive (list (read-string "Match on header: ")
7822 (read-string "Regexp: ")))
7823 (let ((articles (gnus-find-matching-articles header regexp)))
7825 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
7826 (gnus-summary-position-point))))
7828 (defun gnus-summary-insert-dormant-articles ()
7829 "Insert all the dormant articles for this group into the current buffer."
7831 (let ((gnus-verbose (max 6 gnus-verbose)))
7832 (if (not gnus-newsgroup-dormant)
7833 (gnus-message 3 "No cached articles for this group")
7834 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
7836 (defun gnus-summary-limit-include-dormant ()
7837 "Display all the hidden articles that are marked as dormant.
7838 Note that this command only works on a subset of the articles currently
7839 fetched for this group."
7841 (unless gnus-newsgroup-dormant
7842 (error "There are no dormant articles in this group"))
7844 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
7845 (gnus-summary-position-point)))
7847 (defun gnus-summary-limit-exclude-dormant ()
7848 "Hide all dormant articles."
7851 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
7852 (gnus-summary-position-point)))
7854 (defun gnus-summary-limit-exclude-childless-dormant ()
7855 "Hide all dormant articles that have no children."
7857 (let ((data (gnus-data-list t))
7858 articles d children)
7859 ;; Find all articles that are either not dormant or have
7861 (while (setq d (pop data))
7862 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
7864 (gnus-article-children (gnus-data-number d)))
7867 (when (memq (car children) articles)
7872 (push (gnus-data-number d) articles)))
7875 (gnus-summary-limit articles)
7876 (gnus-summary-position-point))))
7878 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
7879 "Mark all unread excluded articles as read.
7880 If ALL, mark even excluded ticked and dormants as read."
7882 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
7883 (let ((articles (gnus-sorted-ndifference
7885 (mapcar (lambda (h) (mail-header-number h))
7886 gnus-newsgroup-headers)
7888 gnus-newsgroup-limit))
7890 (setq gnus-newsgroup-unreads
7891 (gnus-sorted-intersection gnus-newsgroup-unreads
7892 gnus-newsgroup-limit))
7894 (setq gnus-newsgroup-dormant nil
7895 gnus-newsgroup-marked nil
7896 gnus-newsgroup-reads
7898 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
7899 gnus-newsgroup-reads))
7900 (while (setq article (pop articles))
7901 (unless (or (memq article gnus-newsgroup-dormant)
7902 (memq article gnus-newsgroup-marked))
7903 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
7905 (defun gnus-summary-limit (articles &optional pop)
7907 ;; We pop the previous limit off the stack and use that.
7908 (setq articles (car gnus-newsgroup-limits)
7909 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
7910 ;; We use the new limit, so we push the old limit on the stack.
7911 (push gnus-newsgroup-limit gnus-newsgroup-limits))
7913 (setq gnus-newsgroup-limit articles)
7914 (let ((total (length gnus-newsgroup-data))
7915 (data (gnus-data-find-list (gnus-summary-article-number)))
7916 (gnus-summary-mark-below nil) ; Inhibit this.
7918 ;; This will do all the work of generating the new summary buffer
7919 ;; according to the new limit.
7920 (gnus-summary-prepare)
7921 ;; Hide any threads, possibly.
7922 (gnus-summary-maybe-hide-threads)
7923 ;; Try to return to the article you were at, or one in the
7926 ;; We try to find some article after the current one.
7928 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
7931 (setq data (cdr data))))
7933 ;; If there is no data, that means that we were after the last
7934 ;; article. The same goes when we can't find any articles
7935 ;; after the current one.
7936 (goto-char (point-max))
7937 (gnus-summary-find-prev))
7938 (gnus-set-mode-line 'summary)
7939 ;; We return how many articles were removed from the summary
7940 ;; buffer as a result of the new limit.
7941 (- total (length gnus-newsgroup-data))))
7943 (defsubst gnus-invisible-cut-children (threads)
7946 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
7951 (defsubst gnus-cut-thread (thread)
7952 "Go forwards in the thread until we find an article that we want to display."
7953 (when (or (eq gnus-fetch-old-headers 'some)
7954 (eq gnus-fetch-old-headers 'invisible)
7955 (numberp gnus-fetch-old-headers)
7956 (eq gnus-build-sparse-threads 'some)
7957 (eq gnus-build-sparse-threads 'more))
7958 ;; Deal with old-fetched headers and sparse threads.
7962 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
7963 (gnus-summary-article-ancient-p
7964 (mail-header-number (car thread))))
7965 (if (or (<= (length (cdr thread)) 1)
7966 (eq gnus-fetch-old-headers 'invisible))
7967 (setq gnus-newsgroup-limit
7968 (delq (mail-header-number (car thread))
7969 gnus-newsgroup-limit)
7970 thread (cadr thread))
7971 (when (gnus-invisible-cut-children (cdr thread))
7972 (let ((th (cdr thread)))
7974 (if (memq (mail-header-number (caar th))
7975 gnus-newsgroup-limit)
7976 (setq thread (car th)
7978 (setq th (cdr th))))))))))
7981 (defun gnus-cut-threads (threads)
7982 "Cut off all uninteresting articles from the beginning of THREADS."
7983 (when (or (eq gnus-fetch-old-headers 'some)
7984 (eq gnus-fetch-old-headers 'invisible)
7985 (numberp gnus-fetch-old-headers)
7986 (eq gnus-build-sparse-threads 'some)
7987 (eq gnus-build-sparse-threads 'more))
7990 (setcar th (gnus-cut-thread (car th)))
7991 (setq th (cdr th)))))
7992 ;; Remove nixed out threads.
7995 (defun gnus-summary-initial-limit (&optional show-if-empty)
7996 "Figure out what the initial limit is supposed to be on group entry.
7997 This entails weeding out unwanted dormants, low-scored articles,
7998 fetch-old-headers verbiage, and so on."
7999 ;; Most groups have nothing to remove.
8000 (if (or gnus-inhibit-limiting
8001 (and (null gnus-newsgroup-dormant)
8002 (eq gnus-newsgroup-display 'gnus-not-ignore)
8003 (not (eq gnus-fetch-old-headers 'some))
8004 (not (numberp gnus-fetch-old-headers))
8005 (not (eq gnus-fetch-old-headers 'invisible))
8006 (null gnus-summary-expunge-below)
8007 (not (eq gnus-build-sparse-threads 'some))
8008 (not (eq gnus-build-sparse-threads 'more))
8009 (null gnus-thread-expunge-below)
8010 (not gnus-use-nocem)))
8012 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8013 (setq gnus-newsgroup-limit nil)
8016 (unless (car (symbol-value node))
8017 ;; These threads have no parents -- they are roots.
8018 (let ((nodes (cdr (symbol-value node)))
8021 (if (and gnus-thread-expunge-below
8022 (< (gnus-thread-total-score (car nodes))
8023 gnus-thread-expunge-below))
8024 (gnus-expunge-thread (pop nodes))
8025 (setq thread (pop nodes))
8026 (gnus-summary-limit-children thread))))))
8027 gnus-newsgroup-dependencies)
8028 ;; If this limitation resulted in an empty group, we might
8029 ;; pop the previous limit and use it instead.
8030 (when (and (not gnus-newsgroup-limit)
8032 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8033 gnus-newsgroup-limit))
8035 (defun gnus-summary-limit-children (thread)
8036 "Return 1 if this subthread is visible and 0 if it is not."
8037 ;; First we get the number of visible children to this thread. This
8038 ;; is done by recursing down the thread using this function, so this
8039 ;; will really go down to a leaf article first, before slowly
8040 ;; working its way up towards the root.
8042 (let* ((max-lisp-eval-depth 5000)
8045 (apply '+ (mapcar 'gnus-summary-limit-children
8048 (number (mail-header-number (car thread)))
8051 (not (memq number gnus-newsgroup-marked))
8053 ;; If this article is dormant and has absolutely no visible
8054 ;; children, then this article isn't visible.
8055 (and (memq number gnus-newsgroup-dormant)
8057 ;; If this is "fetch-old-headered" and there is no
8058 ;; visible children, then we don't want this article.
8059 (and (or (eq gnus-fetch-old-headers 'some)
8060 (numberp gnus-fetch-old-headers))
8061 (gnus-summary-article-ancient-p number)
8063 ;; If this is "fetch-old-headered" and `invisible', then
8064 ;; we don't want this article.
8065 (and (eq gnus-fetch-old-headers 'invisible)
8066 (gnus-summary-article-ancient-p number))
8067 ;; If this is a sparsely inserted article with no children,
8068 ;; we don't want it.
8069 (and (eq gnus-build-sparse-threads 'some)
8070 (gnus-summary-article-sparse-p number)
8072 ;; If we use expunging, and this article is really
8073 ;; low-scored, then we don't want this article.
8074 (when (and gnus-summary-expunge-below
8076 (or (cdr (assq number gnus-newsgroup-scored))
8077 gnus-summary-default-score))
8078 gnus-summary-expunge-below))
8079 ;; We increase the expunge-tally here, but that has
8080 ;; nothing to do with the limits, really.
8081 (incf gnus-newsgroup-expunged-tally)
8082 ;; We also mark as read here, if that's wanted.
8083 (when (and gnus-summary-mark-below
8084 (< score gnus-summary-mark-below))
8085 (setq gnus-newsgroup-unreads
8086 (delq number gnus-newsgroup-unreads))
8087 (if gnus-newsgroup-auto-expire
8088 (push number gnus-newsgroup-expirable)
8089 (push (cons number gnus-low-score-mark)
8090 gnus-newsgroup-reads)))
8092 ;; Do the `display' group parameter.
8093 (and gnus-newsgroup-display
8094 (not (funcall gnus-newsgroup-display)))
8095 ;; Check NoCeM things.
8096 (when (and gnus-use-nocem
8097 (gnus-nocem-unwanted-article-p
8098 (mail-header-id (car thread))))
8099 (setq gnus-newsgroup-unreads
8100 (delq number gnus-newsgroup-unreads))
8102 ;; Nope, invisible article.
8104 ;; Ok, this article is to be visible, so we add it to the limit
8106 (push number gnus-newsgroup-limit)
8109 (defun gnus-expunge-thread (thread)
8110 "Mark all articles in THREAD as read."
8111 (let* ((number (mail-header-number (car thread))))
8112 (incf gnus-newsgroup-expunged-tally)
8113 ;; We also mark as read here, if that's wanted.
8114 (setq gnus-newsgroup-unreads
8115 (delq number gnus-newsgroup-unreads))
8116 (if gnus-newsgroup-auto-expire
8117 (push number gnus-newsgroup-expirable)
8118 (push (cons number gnus-low-score-mark)
8119 gnus-newsgroup-reads)))
8120 ;; Go recursively through all subthreads.
8121 (mapcar 'gnus-expunge-thread (cdr thread)))
8123 ;; Summary article oriented commands
8125 (defun gnus-summary-refer-parent-article (n)
8126 "Refer parent article N times.
8127 If N is negative, go to ancestor -N instead.
8128 The difference between N and the number of articles fetched is returned."
8132 (when (not (natnump n))
8137 (setq header (gnus-summary-article-header))
8138 (if (and (eq (mail-header-number header)
8139 (cdr gnus-article-current))
8140 (equal gnus-newsgroup-name
8141 (car gnus-article-current)))
8142 ;; If we try to find the parent of the currently
8143 ;; displayed article, then we take a look at the actual
8144 ;; References header, since this is slightly more
8145 ;; reliable than the References field we got from the
8148 (set-buffer gnus-original-article-buffer)
8149 (nnheader-narrow-to-headers)
8150 (unless (setq ref (message-fetch-field "references"))
8151 (when (setq ref (message-fetch-field "in-reply-to"))
8152 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8155 ;; It's not the current article, so we take a bet on
8156 ;; the value we got from the server.
8157 (mail-header-references header)))
8159 (not (equal ref "")))
8160 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8161 (gnus-message 1 "Couldn't find parent"))
8162 (gnus-message 1 "No references in article %d"
8163 (gnus-summary-article-number))
8166 (gnus-summary-position-point)
8169 (defun gnus-summary-refer-references ()
8170 "Fetch all articles mentioned in the References header.
8171 Return the number of articles fetched."
8173 (let ((ref (mail-header-references (gnus-summary-article-header)))
8174 (current (gnus-summary-article-number))
8178 (error "No References in the current article")
8179 ;; For each Message-ID in the References header...
8180 (while (string-match "<[^>]*>" ref)
8182 ;; ... fetch that article.
8183 (gnus-summary-refer-article
8184 (prog1 (match-string 0 ref)
8185 (setq ref (substring ref (match-end 0))))))
8186 (gnus-summary-goto-subject current)
8187 (gnus-summary-position-point)
8190 (defun gnus-summary-refer-thread (&optional limit)
8191 "Fetch all articles in the current thread.
8192 If LIMIT (the numerical prefix), fetch that many old headers instead
8193 of what's specified by the `gnus-refer-thread-limit' variable."
8195 (let ((id (mail-header-id (gnus-summary-article-header)))
8196 (limit (if limit (prefix-numeric-value limit)
8197 gnus-refer-thread-limit)))
8198 (unless (eq gnus-fetch-old-headers 'invisible)
8199 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8200 ;; Retrieve the headers and read them in.
8201 (if (eq (if (numberp limit)
8202 (gnus-retrieve-headers
8204 (+ (mail-header-number
8205 (gnus-summary-article-header))
8207 gnus-newsgroup-end))
8208 gnus-newsgroup-name (* limit 2))
8209 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8211 (gnus-retrieve-headers (list gnus-newsgroup-end)
8212 gnus-newsgroup-name limit))
8214 (gnus-build-all-threads)
8215 (error "Can't fetch thread from back ends that don't support NOV"))
8216 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8217 (gnus-summary-limit-include-thread id)))
8219 (defun gnus-summary-refer-article (message-id)
8220 "Fetch an article specified by MESSAGE-ID."
8221 (interactive "sMessage-ID: ")
8222 (when (and (stringp message-id)
8223 (not (zerop (length message-id))))
8224 (setq message-id (gnus-replace-in-string message-id " " ""))
8225 ;; Construct the correct Message-ID if necessary.
8226 ;; Suggested by tale@pawl.rpi.edu.
8227 (unless (string-match "^<" message-id)
8228 (setq message-id (concat "<" message-id)))
8229 (unless (string-match ">$" message-id)
8230 (setq message-id (concat message-id ">")))
8231 ;; People often post MIDs from URLs, so unhex it:
8232 (unless (string-match "@" message-id)
8233 (setq message-id (gnus-url-unhex-string message-id)))
8234 (let* ((header (gnus-id-to-header message-id))
8236 (gnus-summary-article-sparse-p
8237 (mail-header-number header))
8238 (memq (mail-header-number header)
8239 gnus-newsgroup-limit)))
8242 ;; If the article is present in the buffer we just go to it.
8244 (or (not (gnus-summary-article-sparse-p
8245 (mail-header-number header)))
8248 (gnus-summary-goto-article
8249 (mail-header-number header) nil t)
8251 (gnus-summary-update-article (mail-header-number header)))))
8253 ;; We fetch the article.
8255 (dolist (gnus-override-method (gnus-refer-article-methods))
8256 (when (and (gnus-check-server gnus-override-method)
8257 ;; Fetch the header,
8258 (setq number (gnus-summary-insert-subject message-id)))
8259 ;; and display the article.
8260 (gnus-summary-select-article nil nil nil number)
8262 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8264 (defun gnus-refer-article-methods ()
8265 "Return a list of referable methods."
8267 ;; No method, so we default to current and native.
8268 ((null gnus-refer-article-method)
8269 (list gnus-current-select-method gnus-select-method))
8271 ((eq 'current gnus-refer-article-method)
8272 (list gnus-current-select-method))
8273 ;; List of select methods.
8274 ((not (and (symbolp (car gnus-refer-article-method))
8275 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8277 (dolist (method gnus-refer-article-method)
8278 (push (if (eq 'current method)
8279 gnus-current-select-method
8283 ;; One single select method.
8285 (list gnus-refer-article-method))))
8287 (defun gnus-summary-edit-parameters ()
8288 "Edit the group parameters of the current group."
8290 (gnus-group-edit-group gnus-newsgroup-name 'params))
8292 (defun gnus-summary-customize-parameters ()
8293 "Customize the group parameters of the current group."
8295 (gnus-group-customize gnus-newsgroup-name))
8297 (defun gnus-summary-enter-digest-group (&optional force)
8298 "Enter an nndoc group based on the current article.
8299 If FORCE, force a digest interpretation. If not, try
8300 to guess what the document format is."
8302 (let ((conf gnus-current-window-configuration))
8303 (save-window-excursion
8305 (let (gnus-article-prepare-hook
8306 gnus-display-mime-function
8308 (gnus-summary-select-article))))
8309 (setq gnus-current-window-configuration conf)
8310 (let* ((name (format "%s-%d"
8311 (gnus-group-prefixed-name
8312 gnus-newsgroup-name (list 'nndoc ""))
8313 (with-current-buffer gnus-summary-buffer
8314 gnus-current-article)))
8315 (ogroup gnus-newsgroup-name)
8316 (params (append (gnus-info-params (gnus-get-info ogroup))
8317 (list (cons 'to-group ogroup))
8318 (list (cons 'parent-group ogroup))
8319 (list (cons 'save-article-group ogroup))))
8320 (case-fold-search t)
8321 (buf (current-buffer))
8324 (set-buffer gnus-original-article-buffer)
8325 ;; Have the digest group inherit the main mail address of
8326 ;; the parent article.
8327 (when (setq to-address (or (gnus-fetch-field "reply-to")
8328 (gnus-fetch-field "from")))
8329 (setq params (append
8330 (list (cons 'to-address
8331 (funcall gnus-decode-encoded-word-function
8333 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8334 (insert-buffer-substring gnus-original-article-buffer)
8335 ;; Remove lines that may lead nndoc to misinterpret the
8338 (goto-char (point-min))
8339 (or (search-forward "\n\n" nil t) (point)))
8340 (goto-char (point-min))
8341 (delete-matching-lines "^Path:\\|^From ")
8344 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8345 (gnus-newsgroup-ephemeral-ignored-charsets
8346 gnus-newsgroup-ignored-charsets))
8347 (gnus-group-read-ephemeral-group
8348 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8350 ,(if force 'mbox 'guess)))
8352 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8354 ;; Make all postings to this group go to the parent group.
8355 (nconc (gnus-info-params (gnus-get-info name))
8357 ;; Couldn't select this doc group.
8358 (switch-to-buffer buf)
8359 (gnus-set-global-variables)
8360 (gnus-configure-windows 'summary)
8361 (gnus-message 3 "Article couldn't be entered?"))
8362 (kill-buffer dig)))))
8364 (defun gnus-summary-read-document (n)
8365 "Open a new group based on the current article(s).
8366 This will allow you to read digests and other similar
8367 documents as newsgroups.
8368 Obeys the standard process/prefix convention."
8370 (let* ((articles (gnus-summary-work-articles n))
8371 (ogroup gnus-newsgroup-name)
8372 (params (append (gnus-info-params (gnus-get-info ogroup))
8373 (list (cons 'to-group ogroup))))
8374 article group egroup groups vgroup)
8375 (while (setq article (pop articles))
8376 (setq group (format "%s-%d" gnus-newsgroup-name article))
8377 (gnus-summary-remove-process-mark article)
8378 (when (gnus-summary-display-article article)
8381 (insert-buffer-substring gnus-original-article-buffer)
8382 ;; Remove some headers that may lead nndoc to make
8384 (message-narrow-to-head)
8385 (goto-char (point-min))
8386 (delete-matching-lines "^Path:\\|^From ")
8389 (gnus-group-read-ephemeral-group
8390 group `(nndoc ,group (nndoc-address ,(current-buffer))
8391 (nndoc-article-type guess))
8394 ;; Make all postings to this group go to the parent group.
8395 (nconc (gnus-info-params (gnus-get-info egroup))
8397 (push egroup groups))
8398 ;; Couldn't select this doc group.
8399 (gnus-error 3 "Article couldn't be entered"))))))
8400 ;; Now we have selected all the documents.
8403 (error "None of the articles could be interpreted as documents"))
8404 ((gnus-group-read-ephemeral-group
8405 (setq vgroup (format
8406 "nnvirtual:%s-%s" gnus-newsgroup-name
8407 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8408 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8410 (cons (current-buffer) 'summary)))
8412 (error "Couldn't select virtual nndoc group")))))
8414 (defun gnus-summary-isearch-article (&optional regexp-p)
8415 "Do incremental search forward on the current article.
8416 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8418 (gnus-summary-select-article)
8419 (gnus-configure-windows 'article)
8420 (gnus-eval-in-buffer-window gnus-article-buffer
8423 (isearch-forward regexp-p))))
8425 (defun gnus-summary-search-article-forward (regexp &optional backward)
8426 "Search for an article containing REGEXP forward.
8427 If BACKWARD, search backward instead."
8430 (format "Search article %s (regexp%s): "
8431 (if current-prefix-arg "backward" "forward")
8432 (if gnus-last-search-regexp
8433 (concat ", default " gnus-last-search-regexp)
8435 current-prefix-arg))
8436 (if (string-equal regexp "")
8437 (setq regexp (or gnus-last-search-regexp ""))
8438 (setq gnus-last-search-regexp regexp)
8439 (setq gnus-article-before-search gnus-current-article))
8440 ;; Intentionally set gnus-last-article.
8441 (setq gnus-last-article gnus-article-before-search)
8442 (let ((gnus-last-article gnus-last-article))
8443 (if (gnus-summary-search-article regexp backward)
8444 (gnus-summary-show-thread)
8445 (error "Search failed: \"%s\"" regexp))))
8447 (defun gnus-summary-search-article-backward (regexp)
8448 "Search for an article containing REGEXP backward."
8451 (format "Search article backward (regexp%s): "
8452 (if gnus-last-search-regexp
8453 (concat ", default " gnus-last-search-regexp)
8455 (gnus-summary-search-article-forward regexp 'backward))
8457 (defun gnus-summary-search-article (regexp &optional backward)
8458 "Search for an article containing REGEXP.
8459 Optional argument BACKWARD means do search for backward.
8460 `gnus-select-article-hook' is not called during the search."
8461 ;; We have to require this here to make sure that the following
8462 ;; dynamic binding isn't shadowed by autoloading.
8463 (require 'gnus-async)
8465 (let ((gnus-select-article-hook nil) ;Disable hook.
8466 (gnus-article-prepare-hook nil)
8467 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8468 (gnus-use-article-prefetch nil)
8469 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8470 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8472 (gnus-keep-backlog nil)
8473 (gnus-break-pages nil)
8474 (gnus-summary-display-arrow nil)
8475 (gnus-updated-mode-lines nil)
8476 (gnus-auto-center-summary nil)
8477 (sum (current-buffer))
8478 (gnus-display-mime-function nil)
8481 (gnus-save-hidden-threads
8482 (gnus-summary-select-article)
8483 (set-buffer gnus-article-buffer)
8484 (goto-char (window-point (get-buffer-window (current-buffer))))
8488 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8490 (re-search-backward regexp nil t)
8491 (re-search-forward regexp nil t))
8492 ;; We found the regexp.
8497 (get-buffer-window (current-buffer))
8501 (get-buffer-window (current-buffer))
8504 (setq point (point)))
8505 ;; We didn't find it, so we go to the next article.
8508 (while (eq found 'not)
8509 (if (not (if backward (gnus-summary-find-prev)
8510 (gnus-summary-find-next)))
8511 ;; No more articles.
8513 ;; Select the next article and adjust point.
8514 (unless (gnus-summary-article-sparse-p
8515 (gnus-summary-article-number))
8517 (gnus-summary-select-article)
8518 (set-buffer gnus-article-buffer)
8520 (goto-char (if backward (point-max) (point-min))))))))
8521 (gnus-message 7 ""))
8522 ;; Return whether we found the regexp.
8523 (when (eq found 'found)
8525 (gnus-summary-show-thread)
8526 (gnus-summary-goto-subject gnus-current-article)
8527 (gnus-summary-position-point)
8530 (defun gnus-find-matching-articles (header regexp)
8531 "Return a list of all articles that match REGEXP on HEADER.
8532 This search includes all articles in the current group that Gnus has
8533 fetched headers for, whether they are displayed or not."
8534 (let ((articles nil)
8535 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8536 (case-fold-search t))
8537 (dolist (header gnus-newsgroup-headers)
8538 (when (string-match regexp (funcall func header))
8539 (push (mail-header-number header) articles)))
8540 (nreverse articles)))
8542 (defun gnus-summary-find-matching (header regexp &optional backward unread
8543 not-case-fold not-matching)
8544 "Return a list of all articles that match REGEXP on HEADER.
8545 The search stars on the current article and goes forwards unless
8546 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8547 If UNREAD is non-nil, only unread articles will
8548 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8549 in the comparisons. If NOT-MATCHING, return a list of all articles that
8550 not match REGEXP on HEADER."
8551 (let ((case-fold-search (not not-case-fold))
8554 (if (eq (car header) 'extra)
8557 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8559 (error "%s is an invalid header" header))
8560 (unless (fboundp (intern (concat "mail-header-" header)))
8561 (error "%s is not a valid header" header))
8562 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8563 (dolist (d (if (eq backward 'all)
8565 (gnus-data-find-list
8566 (gnus-summary-article-number)
8567 (gnus-data-list backward))))
8568 (when (and (or (not unread) ; We want all articles...
8569 (gnus-data-unread-p d)) ; Or just unreads.
8570 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8574 (funcall func (gnus-data-header d))))
8575 (string-match regexp
8576 (funcall func (gnus-data-header d)))))
8577 (push (gnus-data-number d) articles))) ; Success!
8578 (nreverse articles)))
8580 (defun gnus-summary-execute-command (header regexp command &optional backward)
8581 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8582 If HEADER is an empty string (or nil), the match is done on the entire
8583 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8585 (list (let ((completion-ignore-case t))
8588 (mapcar (lambda (header) (list (format "%s" header)))
8590 '("Number" "Subject" "From" "Lines" "Date"
8591 "Message-ID" "Xref" "References" "Body")
8592 gnus-extra-headers))
8593 nil 'require-match))
8594 (read-string "Regexp: ")
8595 (read-key-sequence "Command: ")
8596 current-prefix-arg))
8597 (when (equal header "Body")
8599 ;; Hidden thread subtrees must be searched as well.
8600 (gnus-summary-show-all-threads)
8601 ;; We don't want to change current point nor window configuration.
8603 (save-window-excursion
8605 gnus-treat-strip-trailing-blank-lines
8606 gnus-treat-strip-leading-blank-lines
8607 gnus-treat-strip-multiple-blank-lines
8608 gnus-treat-hide-boring-headers
8609 gnus-treat-fold-newsgroups
8610 gnus-article-prepare-hook)
8611 (gnus-message 6 "Executing %s..." (key-description command))
8612 ;; We'd like to execute COMMAND interactively so as to give arguments.
8613 (gnus-execute header regexp
8614 `(call-interactively ',(key-binding command))
8616 (gnus-message 6 "Executing %s...done" (key-description command))))))
8618 (defun gnus-summary-beginning-of-article ()
8619 "Scroll the article back to the beginning."
8621 (gnus-summary-select-article)
8622 (gnus-configure-windows 'article)
8623 (gnus-eval-in-buffer-window gnus-article-buffer
8625 (goto-char (point-min))
8626 (when gnus-break-pages
8627 (gnus-narrow-to-page))))
8629 (defun gnus-summary-end-of-article ()
8630 "Scroll to the end of the article."
8632 (gnus-summary-select-article)
8633 (gnus-configure-windows 'article)
8634 (gnus-eval-in-buffer-window gnus-article-buffer
8636 (goto-char (point-max))
8638 (when gnus-break-pages
8639 (when (re-search-backward page-delimiter nil t)
8640 (narrow-to-region (match-end 0) (point-max)))
8641 (gnus-narrow-to-page))))
8643 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8644 "Truncate to LEN and quote all \"(\"'s in STRING."
8645 (gnus-replace-in-string (if (and len (> (length string) len))
8646 (substring string 0 len)
8650 (defun gnus-summary-print-article (&optional filename n)
8651 "Generate and print a PostScript image of the process-marked (mail) articles.
8653 If used interactively, print the current article if none are
8654 process-marked. With prefix arg, prompt the user for the name of the
8657 When used from Lisp, accept two optional args FILENAME and N. N means
8658 to print the next N articles. If N is negative, print the N previous
8659 articles. If N is nil and articles have been marked with the process
8660 mark, print these instead.
8662 If the optional first argument FILENAME is nil, send the image to the
8663 printer. If FILENAME is a string, save the PostScript image in a file with
8664 that name. If FILENAME is a number, prompt the user for the name of the file
8666 (interactive (list (ps-print-preprint current-prefix-arg)))
8667 (dolist (article (gnus-summary-work-articles n))
8668 (gnus-summary-select-article nil nil 'pseudo article)
8669 (gnus-eval-in-buffer-window gnus-article-buffer
8670 (gnus-print-buffer))
8671 (gnus-summary-remove-process-mark article))
8672 (ps-despool filename))
8674 (defun gnus-print-buffer ()
8675 (let ((buffer (generate-new-buffer " *print*")))
8678 (copy-to-buffer buffer (point-min) (point-max))
8680 (gnus-remove-text-with-property 'gnus-decoration)
8681 (when (gnus-visual-p 'article-highlight 'highlight)
8682 ;; Copy-to-buffer doesn't copy overlay. So redo
8684 (let ((gnus-article-buffer buffer))
8685 (gnus-article-highlight-citation t)
8686 (gnus-article-highlight-signature)
8687 (gnus-article-emphasize)
8688 (gnus-article-delete-invisible-text)))
8689 (let ((ps-left-header
8692 (gnus-summary-print-truncate-and-quote
8693 (mail-header-subject gnus-current-headers)
8696 (gnus-summary-print-truncate-and-quote
8697 (mail-header-from gnus-current-headers)
8701 "/pagenumberstring load"
8703 (mail-header-date gnus-current-headers) ")"))))
8704 (gnus-run-hooks 'gnus-ps-print-hook)
8707 (ps-spool-buffer-with-faces)
8708 (ps-spool-buffer)))))
8709 (kill-buffer buffer))))
8711 (defun gnus-summary-show-article (&optional arg)
8712 "Force redisplaying of the current article.
8713 If ARG (the prefix) is a number, show the article with the charset
8714 defined in `gnus-summary-show-article-charset-alist', or the charset
8716 If ARG (the prefix) is non-nil and not a number, show the raw article
8717 without any article massaging functions being run. Normally, the key
8718 strokes are `C-u g'."
8722 (gnus-summary-show-article t)
8723 (let ((gnus-newsgroup-charset
8724 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
8725 (mm-read-coding-system
8726 "View as charset: " ;; actually it is coding system.
8728 (set-buffer gnus-article-buffer)
8729 (mm-detect-coding-region (point) (point-max))))))
8730 (gnus-newsgroup-ignored-charsets 'gnus-all))
8731 (gnus-summary-select-article nil 'force)
8732 (let ((deps gnus-newsgroup-dependencies)
8735 (set-buffer gnus-original-article-buffer)
8737 (message-narrow-to-head)
8738 (setq head (buffer-string))
8739 (goto-char (point-min))
8740 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
8741 (goto-char (point-max))
8743 (setq lines (1- (count-lines (point) (point-max))))))
8745 (insert (format "211 %d Article retrieved.\n"
8746 (cdr gnus-article-current)))
8748 (if lines (insert (format "Lines: %d\n" lines)))
8750 (let ((nntp-server-buffer (current-buffer)))
8751 (setq header (car (gnus-get-newsgroup-headers deps t))))))
8752 (gnus-data-set-header
8753 (gnus-data-find (cdr gnus-article-current))
8755 (gnus-summary-update-article-line
8756 (cdr gnus-article-current) header)
8757 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
8758 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
8760 ;; Select the article the normal way.
8761 (gnus-summary-select-article nil 'force))
8763 ;; We have to require this here to make sure that the following
8764 ;; dynamic binding isn't shadowed by autoloading.
8765 (require 'gnus-async)
8767 ;; Bind the article treatment functions to nil.
8768 (let ((gnus-have-all-headers t)
8769 gnus-article-prepare-hook
8770 gnus-article-decode-hook
8771 gnus-display-mime-function
8773 ;; Destroy any MIME parts.
8774 (when (gnus-buffer-live-p gnus-article-buffer)
8776 (set-buffer gnus-article-buffer)
8777 (mm-destroy-parts gnus-article-mime-handles)
8778 ;; Set it to nil for safety reason.
8779 (setq gnus-article-mime-handle-alist nil)
8780 (setq gnus-article-mime-handles nil)))
8781 (gnus-summary-select-article nil 'force))))
8782 (gnus-summary-goto-subject gnus-current-article)
8783 (gnus-summary-position-point))
8785 (defun gnus-summary-show-raw-article ()
8786 "Show the raw article without any article massaging functions being run."
8788 (gnus-summary-show-article t))
8790 (defun gnus-summary-verbose-headers (&optional arg)
8791 "Toggle permanent full header display.
8792 If ARG is a positive number, turn header display on.
8793 If ARG is a negative number, turn header display off."
8795 (setq gnus-show-all-headers
8796 (cond ((or (not (numberp arg))
8798 (not gnus-show-all-headers))
8801 (gnus-summary-show-article))
8803 (defun gnus-summary-toggle-header (&optional arg)
8804 "Show the headers if they are hidden, or hide them if they are shown.
8805 If ARG is a positive number, show the entire header.
8806 If ARG is a negative number, hide the unwanted header lines."
8808 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
8809 (get-buffer-window gnus-article-buffer t))))
8810 (with-current-buffer gnus-article-buffer
8812 (article-narrow-to-head)
8813 (let* ((buffer-read-only nil)
8814 (inhibit-point-motion-hooks t)
8815 (hidden (if (numberp arg)
8817 (gnus-article-hidden-text-p 'headers)))
8819 (delete-region (point-min) (point-max))
8820 (with-current-buffer gnus-original-article-buffer
8821 (goto-char (setq s (point-min)))
8822 (setq e (if (search-forward "\n\n" nil t)
8825 (insert-buffer-substring gnus-original-article-buffer s e)
8826 (run-hooks 'gnus-article-decode-hook)
8828 (let ((gnus-treat-hide-headers nil)
8829 (gnus-treat-hide-boring-headers nil))
8830 (gnus-delete-wash-type 'headers)
8831 (gnus-treat-article 'head))
8832 (gnus-treat-article 'head))
8835 (set-window-start window (goto-char (point-min))))
8836 (if gnus-break-pages
8837 (gnus-narrow-to-page)
8838 (when (gnus-visual-p 'page-marker)
8839 (let ((buffer-read-only nil))
8840 (gnus-remove-text-with-property 'gnus-prev)
8841 (gnus-remove-text-with-property 'gnus-next))))
8842 (gnus-set-mode-line 'article)))))
8844 (defun gnus-summary-show-all-headers ()
8845 "Make all header lines visible."
8847 (gnus-summary-toggle-header 1))
8849 (defun gnus-summary-caesar-message (&optional arg)
8850 "Caesar rotate the current article by 13.
8851 The numerical prefix specifies how many places to rotate each letter
8854 (gnus-summary-select-article)
8855 (let ((mail-header-separator ""))
8856 (gnus-eval-in-buffer-window gnus-article-buffer
8859 (let ((start (window-start))
8861 (message-caesar-buffer-body arg)
8862 (set-window-start (get-buffer-window (current-buffer)) start))))))
8864 (autoload 'unmorse-region "morse"
8865 "Convert morse coded text in region to ordinary ASCII text."
8868 (defun gnus-summary-morse-message (&optional arg)
8869 "Morse decode the current article."
8871 (gnus-summary-select-article)
8872 (let ((mail-header-separator ""))
8873 (gnus-eval-in-buffer-window gnus-article-buffer
8877 (let ((pos (window-start))
8879 (goto-char (point-min))
8880 (when (message-goto-body)
8881 (gnus-narrow-to-body))
8882 (goto-char (point-min))
8883 (while (re-search-forward "·" (point-max) t)
8884 (replace-match "."))
8885 (unmorse-region (point-min) (point-max))
8887 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
8889 (defun gnus-summary-stop-page-breaking ()
8890 "Stop page breaking in the current article."
8892 (gnus-summary-select-article)
8893 (gnus-eval-in-buffer-window gnus-article-buffer
8895 (when (gnus-visual-p 'page-marker)
8896 (let ((buffer-read-only nil))
8897 (gnus-remove-text-with-property 'gnus-prev)
8898 (gnus-remove-text-with-property 'gnus-next))
8899 (setq gnus-page-broken nil))))
8901 (defun gnus-summary-move-article (&optional n to-newsgroup
8902 select-method action)
8903 "Move the current article to a different newsgroup.
8904 If N is a positive number, move the N next articles.
8905 If N is a negative number, move the N previous articles.
8906 If N is nil and any articles have been marked with the process mark,
8907 move those articles instead.
8908 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
8909 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
8910 re-spool using this method.
8912 When called interactively with TO-NEWSGROUP being nil, the value of
8913 the variable `gnus-move-split-methods' is used for finding a default
8914 for the target newsgroup.
8916 For this function to work, both the current newsgroup and the
8917 newsgroup that you want to move to have to support the `request-move'
8918 and `request-accept' functions.
8920 ACTION can be either `move' (the default), `crosspost' or `copy'."
8923 (setq action 'move))
8924 ;; Check whether the source group supports the required functions.
8925 (cond ((and (eq action 'move)
8926 (not (gnus-check-backend-function
8927 'request-move-article gnus-newsgroup-name)))
8928 (error "The current group does not support article moving"))
8929 ((and (eq action 'crosspost)
8930 (not (gnus-check-backend-function
8931 'request-replace-article gnus-newsgroup-name)))
8932 (error "The current group does not support article editing")))
8933 (let ((articles (gnus-summary-work-articles n))
8934 (prefix (if (gnus-check-backend-function
8935 'request-move-article gnus-newsgroup-name)
8936 (funcall gnus-move-group-prefix-function
8937 gnus-newsgroup-name)
8939 (names '((move "Move" "Moving")
8940 (copy "Copy" "Copying")
8941 (crosspost "Crosspost" "Crossposting")))
8942 (copy-buf (save-excursion
8943 (nnheader-set-temp-buffer " *copy article*")))
8944 art-group to-method new-xref article to-groups)
8945 (unless (assq action names)
8946 (error "Unknown action %s" action))
8947 ;; Read the newsgroup name.
8948 (when (and (not to-newsgroup)
8949 (not select-method))
8950 (if (and gnus-move-split-methods
8952 (and (memq gnus-current-article articles)
8953 (gnus-buffer-live-p gnus-original-article-buffer))))
8954 ;; When `gnus-move-split-methods' is non-nil, we have to
8955 ;; select an article to give `gnus-read-move-group-name' an
8956 ;; opportunity to suggest an appropriate default. However,
8957 ;; we needn't render or mark the article.
8958 (let ((gnus-display-mime-function nil)
8959 (gnus-article-prepare-hook nil)
8960 (gnus-mark-article-hook nil))
8961 (gnus-summary-select-article nil nil nil (car articles))))
8963 (gnus-read-move-group-name
8964 (cadr (assq action names))
8965 (symbol-value (intern (format "gnus-current-%s-group" action)))
8967 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
8968 (setq to-method (or select-method
8969 (gnus-server-to-method
8970 (gnus-group-method to-newsgroup))))
8971 ;; Check the method we are to move this article to...
8972 (unless (gnus-check-backend-function
8973 'request-accept-article (car to-method))
8974 (error "%s does not support article copying" (car to-method)))
8975 (unless (gnus-check-server to-method)
8976 (error "Can't open server %s" (car to-method)))
8977 (gnus-message 6 "%s to %s: %s..."
8978 (caddr (assq action names))
8979 (or (car select-method) to-newsgroup) articles)
8981 (setq article (pop articles))
8985 ;; Move the article.
8987 ;; Remove this article from future suppression.
8988 (gnus-dup-unsuppress-article article)
8989 (gnus-request-move-article
8990 article ; Article to move
8991 gnus-newsgroup-name ; From newsgroup
8992 (nth 1 (gnus-find-method-for-group
8993 gnus-newsgroup-name)) ; Server
8994 (list 'gnus-request-accept-article
8995 to-newsgroup (list 'quote select-method)
8996 (not articles) t) ; Accept form
8997 (not articles))) ; Only save nov last time
8998 ;; Copy the article.
9001 (set-buffer copy-buf)
9002 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9003 (gnus-request-accept-article
9004 to-newsgroup select-method (not articles) t))))
9005 ;; Crosspost the article.
9006 ((eq action 'crosspost)
9007 (let ((xref (message-tokenize-header
9008 (mail-header-xref (gnus-summary-article-header article))
9010 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9011 ":" (number-to-string article)))
9013 (setq xref (list (system-name))))
9016 (mapconcat 'identity
9017 (delete "Xref:" (delete new-xref xref))
9021 (set-buffer copy-buf)
9022 ;; First put the article in the destination group.
9023 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9024 (when (consp (setq art-group
9025 (gnus-request-accept-article
9026 to-newsgroup select-method (not articles))))
9027 (setq new-xref (concat new-xref " " (car art-group)
9029 (number-to-string (cdr art-group))))
9030 ;; Now we have the new Xrefs header, so we insert
9031 ;; it and replace the new article.
9032 (nnheader-replace-header "Xref" new-xref)
9033 (gnus-request-replace-article
9034 (cdr art-group) to-newsgroup (current-buffer))
9038 (gnus-message 1 "Couldn't %s article %s: %s"
9039 (cadr (assq action names)) article
9040 (nnheader-get-report (car to-method))))
9041 ((eq art-group 'junk)
9042 (when (eq action 'move)
9043 (gnus-summary-mark-article article gnus-canceled-mark)
9044 (gnus-message 4 "Deleted article %s" article)
9045 ;; run the delete hook
9046 (run-hook-with-args 'gnus-summary-article-delete-hook
9049 (assoc article (gnus-data-list nil)))
9050 gnus-newsgroup-name nil
9053 (let* ((pto-group (gnus-group-prefixed-name
9054 (car art-group) to-method))
9055 (info (gnus-get-info pto-group))
9056 (to-group (gnus-info-group info))
9058 ;; Update the group that has been moved to.
9060 (memq action '(move copy)))
9061 (unless (member to-group to-groups)
9062 (push to-group to-groups))
9064 (unless (memq article gnus-newsgroup-unreads)
9065 (push 'read to-marks)
9067 info (gnus-add-to-range (gnus-info-read info)
9068 (list (cdr art-group)))))
9070 ;; See whether the article is to be put in the cache.
9071 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9072 gnus-article-mark-lists
9073 (delete '(expirable . expire)
9074 (copy-sequence gnus-article-mark-lists))))
9075 (to-article (cdr art-group)))
9077 ;; Enter the article into the cache in the new group,
9078 ;; if that is required.
9079 (when gnus-use-cache
9080 (gnus-cache-possibly-enter-article
9082 (memq article gnus-newsgroup-marked)
9083 (memq article gnus-newsgroup-dormant)
9084 (memq article gnus-newsgroup-unreads)))
9086 (when gnus-preserve-marks
9087 ;; Copy any marks over to the new group.
9088 (when (and (equal to-group gnus-newsgroup-name)
9089 (not (memq article gnus-newsgroup-unreads)))
9090 ;; Mark this article as read in this group.
9091 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9092 (setcdr (gnus-active to-group) to-article)
9093 (setcdr gnus-newsgroup-active to-article))
9096 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9097 (when (memq article (symbol-value
9098 (intern (format "gnus-newsgroup-%s"
9100 (push (cdar marks) to-marks)
9101 ;; If the other group is the same as this group,
9102 ;; then we have to add the mark to the list.
9103 (when (equal to-group gnus-newsgroup-name)
9104 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9107 (intern (format "gnus-newsgroup-%s"
9109 ;; Copy the marks to other group.
9110 (gnus-add-marked-articles
9111 to-group (cdar marks) (list to-article) info)))
9112 (setq marks (cdr marks)))
9114 (gnus-request-set-mark
9115 to-group (list (list (list to-article) 'add to-marks))))
9118 (concat "(gnus-group-set-info '"
9119 (gnus-prin1-to-string (gnus-get-info to-group))
9122 ;; Update the Xref header in this article to point to
9123 ;; the new crossposted article we have just created.
9124 (when (eq action 'crosspost)
9126 (set-buffer copy-buf)
9127 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9128 (nnheader-replace-header "Xref" new-xref)
9129 (gnus-request-replace-article
9130 article gnus-newsgroup-name (current-buffer))))
9132 ;; run the move/copy/crosspost/respool hook
9133 (run-hook-with-args 'gnus-summary-article-move-hook
9136 (assoc article (gnus-data-list nil)))
9141 ;;;!!!Why is this necessary?
9142 (set-buffer gnus-summary-buffer)
9144 (gnus-summary-goto-subject article)
9145 (when (eq action 'move)
9146 (gnus-summary-mark-article article gnus-canceled-mark))))
9147 (gnus-summary-remove-process-mark article))
9148 ;; Re-activate all groups that have been moved to.
9150 (set-buffer gnus-group-buffer)
9151 (let ((gnus-group-marked to-groups))
9152 (gnus-group-get-new-news-this-group nil t)))
9154 (gnus-kill-buffer copy-buf)
9155 (gnus-summary-position-point)
9156 (gnus-set-mode-line 'summary)))
9158 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9159 "Move the current article to a different newsgroup.
9160 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9161 When called interactively, if TO-NEWSGROUP is nil, use the value of
9162 the variable `gnus-move-split-methods' for finding a default target
9164 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9165 re-spool using this method."
9167 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9169 (defun gnus-summary-crosspost-article (&optional n)
9170 "Crosspost the current article to some other group."
9172 (gnus-summary-move-article n nil nil 'crosspost))
9174 (defcustom gnus-summary-respool-default-method nil
9175 "Default method type for respooling an article.
9176 If nil, use to the current newsgroup method."
9178 :group 'gnus-summary-mail)
9180 (defcustom gnus-summary-display-while-building nil
9181 "If non-nil, show and update the summary buffer as it's being built.
9182 If the value is t, update the buffer after every line is inserted. If
9183 the value is an integer (N), update the display every N lines."
9185 :type '(choice (const :tag "off" nil)
9187 (const :tag "frequently" t)))
9189 (defun gnus-summary-respool-article (&optional n method)
9190 "Respool the current article.
9191 The article will be squeezed through the mail spooling process again,
9192 which means that it will be put in some mail newsgroup or other
9193 depending on `nnmail-split-methods'.
9194 If N is a positive number, respool the N next articles.
9195 If N is a negative number, respool the N previous articles.
9196 If N is nil and any articles have been marked with the process mark,
9197 respool those articles instead.
9199 Respooling can be done both from mail groups and \"real\" newsgroups.
9200 In the former case, the articles in question will be moved from the
9201 current group into whatever groups they are destined to. In the
9202 latter case, they will be copied into the relevant groups."
9204 (list current-prefix-arg
9205 (let* ((methods (gnus-methods-using 'respool))
9207 (symbol-name (or gnus-summary-respool-default-method
9208 (car (gnus-find-method-for-group
9209 gnus-newsgroup-name)))))
9211 (gnus-completing-read-with-default
9212 methname "What backend do you want to use when respooling?"
9213 methods nil t nil 'gnus-mail-method-history))
9216 ((zerop (length (setq ms (gnus-servers-using-backend
9218 (list (intern method) ""))
9222 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9223 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9226 (error "No method given for respooling"))
9227 (if (assoc (symbol-name
9228 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9229 (gnus-methods-using 'respool))
9230 (gnus-summary-move-article n nil method)
9231 (gnus-summary-copy-article n nil method)))
9233 (defun gnus-summary-import-article (file &optional edit)
9234 "Import an arbitrary file into a mail newsgroup."
9235 (interactive "fImport file: \nP")
9236 (let ((group gnus-newsgroup-name)
9237 (now (current-time))
9238 atts lines group-art)
9239 (unless (gnus-check-backend-function 'request-accept-article group)
9240 (error "%s does not support article importing" group))
9241 (or (file-readable-p file)
9242 (not (file-regular-p file))
9243 (error "Can't read %s" file))
9245 (set-buffer (gnus-get-buffer-create " *import file*"))
9247 (nnheader-insert-file-contents file)
9248 (goto-char (point-min))
9249 (if (nnheader-article-p)
9251 (goto-char (point-min))
9252 (search-forward "\n\n" nil t)
9253 (narrow-to-region (point-min) (1- (point)))
9254 (goto-char (point-min))
9255 (unless (re-search-forward "^date:" nil t)
9256 (goto-char (point-max))
9257 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9258 ;; This doesn't look like an article, so we fudge some headers.
9259 (setq atts (file-attributes file)
9260 lines (count-lines (point-min) (point-max)))
9261 (insert "From: " (read-string "From: ") "\n"
9262 "Subject: " (read-string "Subject: ") "\n"
9263 "Date: " (message-make-date (nth 5 atts)) "\n"
9264 "Message-ID: " (message-make-message-id) "\n"
9265 "Lines: " (int-to-string lines) "\n"
9266 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9267 (setq group-art (gnus-request-accept-article group nil t))
9268 (kill-buffer (current-buffer)))
9269 (setq gnus-newsgroup-active (gnus-activate-group group))
9271 (gnus-summary-goto-article (cdr group-art) nil t)
9273 (gnus-summary-edit-article))))
9275 (defun gnus-summary-create-article ()
9276 "Create an article in a mail newsgroup."
9278 (let ((group gnus-newsgroup-name)
9279 (now (current-time))
9281 (unless (gnus-check-backend-function 'request-accept-article group)
9282 (error "%s does not support article importing" group))
9284 (set-buffer (gnus-get-buffer-create " *import file*"))
9286 (goto-char (point-min))
9287 ;; This doesn't look like an article, so we fudge some headers.
9288 (insert "From: " (read-string "From: ") "\n"
9289 "Subject: " (read-string "Subject: ") "\n"
9290 "Date: " (message-make-date now) "\n"
9291 "Message-ID: " (message-make-message-id) "\n")
9292 (setq group-art (gnus-request-accept-article group nil t))
9293 (kill-buffer (current-buffer)))
9294 (setq gnus-newsgroup-active (gnus-activate-group group))
9296 (gnus-summary-goto-article (cdr group-art) nil t)
9297 (gnus-summary-edit-article)))
9299 (defun gnus-summary-article-posted-p ()
9300 "Say whether the current (mail) article is available from news as well.
9301 This will be the case if the article has both been mailed and posted."
9303 (let ((id (mail-header-references (gnus-summary-article-header)))
9304 (gnus-override-method (car (gnus-refer-article-methods))))
9305 (if (gnus-request-head id "")
9306 (gnus-message 2 "The current message was found on %s"
9307 gnus-override-method)
9308 (gnus-message 2 "The current message couldn't be found on %s"
9309 gnus-override-method)
9312 (defun gnus-summary-expire-articles (&optional now)
9313 "Expire all articles that are marked as expirable in the current group."
9315 (when (and (not gnus-group-is-exiting-without-update-p)
9316 (gnus-check-backend-function
9317 'request-expire-articles gnus-newsgroup-name))
9318 ;; This backend supports expiry.
9319 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9320 (expirable (if total
9322 ;; We need to update the info for
9323 ;; this group for `gnus-list-of-read-articles'
9324 ;; to give us the right answer.
9325 (gnus-run-hooks 'gnus-exit-group-hook)
9326 (gnus-summary-update-info)
9327 (gnus-list-of-read-articles gnus-newsgroup-name))
9328 (setq gnus-newsgroup-expirable
9329 (sort gnus-newsgroup-expirable '<))))
9330 (expiry-wait (if now 'immediate
9331 (gnus-group-find-parameter
9332 gnus-newsgroup-name 'expiry-wait)))
9333 (nnmail-expiry-target
9334 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9335 nnmail-expiry-target))
9338 ;; There are expirable articles in this group, so we run them
9339 ;; through the expiry process.
9340 (gnus-message 6 "Expiring articles...")
9341 (unless (gnus-check-group gnus-newsgroup-name)
9342 (error "Can't open server for %s" gnus-newsgroup-name))
9343 ;; The list of articles that weren't expired is returned.
9346 (let ((nnmail-expiry-wait-function nil)
9347 (nnmail-expiry-wait expiry-wait))
9348 (setq es (gnus-request-expire-articles
9349 expirable gnus-newsgroup-name)))
9350 (setq es (gnus-request-expire-articles
9351 expirable gnus-newsgroup-name)))
9353 (setq gnus-newsgroup-expirable es))
9354 ;; We go through the old list of expirable, and mark all
9355 ;; really expired articles as nonexistent.
9356 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9357 (let ((gnus-use-cache nil))
9358 (dolist (article expirable)
9359 (when (and (not (memq article es))
9360 (gnus-data-find article))
9361 (gnus-summary-mark-article article gnus-canceled-mark)
9362 (run-hook-with-args 'gnus-summary-article-expire-hook
9365 (assoc article (gnus-data-list nil)))
9369 (gnus-message 6 "Expiring articles...done")))))
9371 (defun gnus-summary-expire-articles-now ()
9372 "Expunge all expirable articles in the current group.
9373 This means that *all* articles that are marked as expirable will be
9374 deleted forever, right now."
9376 (or gnus-expert-user
9378 "Are you really, really, really sure you want to delete all these messages? ")
9380 (gnus-summary-expire-articles t))
9382 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9383 (defun gnus-summary-delete-article (&optional n)
9384 "Delete the N next (mail) articles.
9385 This command actually deletes articles. This is not a marking
9386 command. The article will disappear forever from your life, never to
9389 If N is negative, delete backwards.
9390 If N is nil and articles have been marked with the process mark,
9391 delete these instead.
9393 If `gnus-novice-user' is non-nil you will be asked for
9394 confirmation before the articles are deleted."
9396 (unless (gnus-check-backend-function 'request-expire-articles
9397 gnus-newsgroup-name)
9398 (error "The current newsgroup does not support article deletion"))
9399 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9400 (error "Couldn't open server"))
9401 ;; Compute the list of articles to delete.
9402 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9403 (nnmail-expiry-target 'delete)
9405 (if (and gnus-novice-user
9406 (not (gnus-yes-or-no-p
9407 (format "Do you really want to delete %s forever? "
9408 (if (> (length articles) 1)
9409 (format "these %s articles" (length articles))
9412 ;; Delete the articles.
9413 (setq not-deleted (gnus-request-expire-articles
9414 articles gnus-newsgroup-name 'force))
9416 (gnus-summary-remove-process-mark (car articles))
9417 ;; The backend might not have been able to delete the article
9419 (unless (memq (car articles) not-deleted)
9420 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9421 (let* ((article (car articles))
9422 (id (mail-header-id (gnus-data-header
9423 (assoc article (gnus-data-list nil))))))
9424 (run-hook-with-args 'gnus-summary-article-delete-hook
9425 'delete id gnus-newsgroup-name nil
9427 (setq articles (cdr articles)))
9429 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9430 (gnus-summary-position-point)
9431 (gnus-set-mode-line 'summary)
9434 (defun gnus-summary-edit-article (&optional arg)
9435 "Edit the current article.
9436 This will have permanent effect only in mail groups.
9437 If ARG is nil, edit the decoded articles.
9438 If ARG is 1, edit the raw articles.
9439 If ARG is 2, edit the raw articles even in read-only groups.
9440 If ARG is 3, edit the articles with the current handles.
9441 Otherwise, allow editing of articles even in read-only
9444 (let (force raw current-handles)
9453 (setq current-handles
9454 (and (gnus-buffer-live-p gnus-article-buffer)
9455 (with-current-buffer gnus-article-buffer
9457 gnus-article-mime-handles
9458 (setq gnus-article-mime-handles nil))))))
9461 (when (and raw (not force)
9462 (member gnus-newsgroup-name '("nndraft:delayed"
9465 (error "Can't edit the raw article in group %s"
9466 gnus-newsgroup-name))
9468 (set-buffer gnus-summary-buffer)
9469 (let ((mail-parse-charset gnus-newsgroup-charset)
9470 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9471 (gnus-set-global-variables)
9472 (when (and (not force)
9473 (gnus-group-read-only-p))
9474 (error "The current newsgroup does not support article editing"))
9475 (gnus-summary-show-article t)
9476 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9477 (with-current-buffer gnus-article-buffer
9478 (mm-enable-multibyte)))
9479 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9481 (gnus-article-edit-article
9484 (let ((mbl mml-buffer-list))
9485 (setq mml-buffer-list nil)
9486 (mime-to-mml ,'current-handles)
9487 (let ((mbl1 mml-buffer-list))
9488 (setq mml-buffer-list mbl)
9489 (set (make-local-variable 'mml-buffer-list) mbl1))
9490 (gnus-make-local-hook 'kill-buffer-hook)
9491 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9492 `(lambda (no-highlight)
9493 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9494 (message-options message-options)
9495 (message-options-set-recipient)
9496 (mail-parse-ignored-charsets
9497 ',gnus-newsgroup-ignored-charsets))
9498 ,(if (not raw) '(progn
9500 (mml-destroy-buffers)
9501 (remove-hook 'kill-buffer-hook
9502 'mml-destroy-buffers t)
9503 (kill-local-variable 'mml-buffer-list)))
9504 (gnus-summary-edit-article-done
9505 ,(or (mail-header-references gnus-current-headers) "")
9506 ,(gnus-group-read-only-p)
9507 ,gnus-summary-buffer no-highlight))))))))
9509 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9511 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9513 "Make edits to the current article permanent."
9516 ;; The buffer restriction contains the entire article if it exists.
9517 (when (article-goto-body)
9518 (let ((lines (count-lines (point) (point-max)))
9519 (length (- (point-max) (point)))
9520 (case-fold-search t)
9521 (body (copy-marker (point))))
9522 (goto-char (point-min))
9523 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9524 (delete-region (match-beginning 1) (match-end 1))
9525 (insert (number-to-string length)))
9526 (goto-char (point-min))
9527 (when (re-search-forward
9528 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9529 (delete-region (match-beginning 1) (match-end 1))
9530 (insert (number-to-string length)))
9531 (goto-char (point-min))
9532 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9533 (delete-region (match-beginning 1) (match-end 1))
9534 (insert (number-to-string lines))))))
9535 ;; Replace the article.
9536 (let ((buf (current-buffer)))
9538 (insert-buffer-substring buf)
9540 (if (and (not read-only)
9541 (not (gnus-request-replace-article
9542 (cdr gnus-article-current) (car gnus-article-current)
9543 (current-buffer) t)))
9544 (error "Couldn't replace article")
9545 ;; Update the summary buffer.
9547 (equal (message-tokenize-header references " ")
9548 (message-tokenize-header
9549 (or (message-fetch-field "references") "") " ")))
9550 ;; We only have to update this line.
9553 (message-narrow-to-head)
9554 (let ((head (buffer-string))
9557 (insert (format "211 %d Article retrieved.\n"
9558 (cdr gnus-article-current)))
9561 (let ((nntp-server-buffer (current-buffer)))
9562 (setq header (car (gnus-get-newsgroup-headers
9565 (set-buffer gnus-summary-buffer)
9566 (gnus-data-set-header
9567 (gnus-data-find (cdr gnus-article-current))
9569 (gnus-summary-update-article-line
9570 (cdr gnus-article-current) header)
9571 (if (gnus-summary-goto-subject
9572 (cdr gnus-article-current) nil t)
9573 (gnus-summary-update-secondary-mark
9574 (cdr gnus-article-current))))))))
9576 (set-buffer (or buffer gnus-summary-buffer))
9577 (gnus-summary-update-article (cdr gnus-article-current))
9578 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9579 (gnus-summary-update-secondary-mark
9580 (cdr gnus-article-current))))
9581 ;; Prettify the article buffer again.
9582 (unless no-highlight
9584 (set-buffer gnus-article-buffer)
9585 ;;;!!! Fix this -- article should be rehighlighted.
9586 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9587 (set-buffer gnus-original-article-buffer)
9588 (gnus-request-article
9589 (cdr gnus-article-current)
9590 (car gnus-article-current) (current-buffer))))
9591 ;; Prettify the summary buffer line.
9592 (when (gnus-visual-p 'summary-highlight 'highlight)
9593 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9595 (defun gnus-summary-edit-wash (key)
9596 "Perform editing command KEY in the article buffer."
9600 (message "%s" (concat (this-command-keys) "- "))
9603 (gnus-summary-edit-article)
9604 (execute-kbd-macro (concat (this-command-keys) key))
9605 (gnus-article-edit-done))
9609 (defun gnus-summary-respool-query (&optional silent trace)
9610 "Query where the respool algorithm would put this article."
9612 (let (gnus-mark-article-hook)
9613 (gnus-summary-select-article)
9615 (set-buffer gnus-original-article-buffer)
9616 (let ((groups (nnmail-article-group 'identity trace)))
9619 (message "This message would go to %s"
9620 (mapconcat 'car groups ", "))
9621 (message "This message would go to no groups"))
9624 (defun gnus-summary-respool-trace ()
9625 "Trace where the respool algorithm would put this article.
9626 Display a buffer showing all fancy splitting patterns which matched."
9628 (gnus-summary-respool-query nil t))
9630 ;; Summary marking commands.
9632 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9633 "Mark articles which has the same subject as read, and then select the next.
9634 If UNMARK is positive, remove any kind of mark.
9635 If UNMARK is negative, tick articles."
9638 (setq unmark (prefix-numeric-value unmark)))
9640 (gnus-summary-mark-same-subject
9641 (gnus-summary-article-subject) unmark)))
9642 ;; Select next unread article. If auto-select-same mode, should
9643 ;; select the first unread article.
9644 (gnus-summary-next-article t (and gnus-auto-select-same
9645 (gnus-summary-article-subject)))
9646 (gnus-message 7 "%d article%s marked as %s"
9647 count (if (= count 1) " is" "s are")
9648 (if unmark "unread" "read"))))
9650 (defun gnus-summary-kill-same-subject (&optional unmark)
9651 "Mark articles which has the same subject as read.
9652 If UNMARK is positive, remove any kind of mark.
9653 If UNMARK is negative, tick articles."
9656 (setq unmark (prefix-numeric-value unmark)))
9658 (gnus-summary-mark-same-subject
9659 (gnus-summary-article-subject) unmark)))
9660 ;; If marked as read, go to next unread subject.
9662 ;; Go to next unread subject.
9663 (gnus-summary-next-subject 1 t))
9664 (gnus-message 7 "%d articles are marked as %s"
9665 count (if unmark "unread" "read"))))
9667 (defun gnus-summary-mark-same-subject (subject &optional unmark)
9668 "Mark articles with same SUBJECT as read, and return marked number.
9669 If optional argument UNMARK is positive, remove any kinds of marks.
9670 If optional argument UNMARK is negative, mark articles as unread instead."
9674 ((null unmark) ; Mark as read.
9677 (gnus-summary-mark-article-as-read gnus-killed-mark)
9678 (gnus-summary-show-thread) t)
9679 (gnus-summary-find-subject subject))
9680 (setq count (1+ count))))
9681 ((> unmark 0) ; Tick.
9684 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
9685 (gnus-summary-show-thread) t)
9686 (gnus-summary-find-subject subject))
9687 (setq count (1+ count))))
9688 (t ; Mark as unread.
9691 (gnus-summary-mark-article-as-unread gnus-unread-mark)
9692 (gnus-summary-show-thread) t)
9693 (gnus-summary-find-subject subject))
9694 (setq count (1+ count)))))
9695 (gnus-set-mode-line 'summary)
9696 ;; Return the number of marked articles.
9699 (defun gnus-summary-mark-as-processable (n &optional unmark)
9700 "Set the process mark on the next N articles.
9701 If N is negative, mark backward instead. If UNMARK is non-nil, remove
9702 the process mark instead. The difference between N and the actual
9703 number of articles marked is returned."
9705 (if (and (null n) (gnus-region-active-p))
9706 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
9707 (setq n (prefix-numeric-value n))
9708 (let ((backward (< n 0))
9713 (gnus-summary-remove-process-mark
9714 (gnus-summary-article-number))
9715 (gnus-summary-set-process-mark (gnus-summary-article-number)))
9716 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
9719 (gnus-message 7 "No more articles"))
9720 (gnus-summary-recenter)
9721 (gnus-summary-position-point)
9724 (defun gnus-summary-unmark-as-processable (n)
9725 "Remove the process mark from the next N articles.
9726 If N is negative, unmark backward instead. The difference between N and
9727 the actual number of articles unmarked is returned."
9729 (gnus-summary-mark-as-processable n t))
9731 (defun gnus-summary-unmark-all-processable ()
9732 "Remove the process mark from all articles."
9735 (while gnus-newsgroup-processable
9736 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
9737 (gnus-summary-position-point))
9739 (defun gnus-summary-add-mark (article type)
9740 "Mark ARTICLE with a mark of TYPE."
9741 (let ((vtype (car (assq type gnus-article-mark-lists)))
9744 (error "No such mark type: %s" type)
9745 (setq var (intern (format "gnus-newsgroup-%s" type)))
9746 (set var (cons article (symbol-value var)))
9747 (if (memq type '(processable cached replied forwarded recent saved))
9748 (gnus-summary-update-secondary-mark article)
9749 ;;; !!! This is bogus. We should find out what primary
9750 ;;; !!! mark we want to set.
9751 (gnus-summary-update-mark gnus-del-mark 'unread)))))
9753 (defun gnus-summary-mark-as-expirable (n)
9754 "Mark N articles forward as expirable.
9755 If N is negative, mark backward instead. The difference between N and
9756 the actual number of articles marked is returned."
9758 (gnus-summary-mark-forward n gnus-expirable-mark))
9760 (defun gnus-summary-mark-as-spam (n)
9761 "Mark N articles forward as spam.
9762 If N is negative, mark backward instead. The difference between N and
9763 the actual number of articles marked is returned."
9765 (gnus-summary-mark-forward n gnus-spam-mark))
9767 (defun gnus-summary-mark-article-as-replied (article)
9768 "Mark ARTICLE as replied to and update the summary line.
9769 ARTICLE can also be a list of articles."
9770 (interactive (list (gnus-summary-article-number)))
9771 (let ((articles (if (listp article) article (list article))))
9772 (dolist (article articles)
9773 (unless (numberp article)
9774 (error "%s is not a number" article))
9775 (push article gnus-newsgroup-replied)
9776 (let ((buffer-read-only nil))
9777 (when (gnus-summary-goto-subject article nil t)
9778 (gnus-summary-update-secondary-mark article))))))
9780 (defun gnus-summary-mark-article-as-forwarded (article)
9781 "Mark ARTICLE as forwarded and update the summary line.
9782 ARTICLE can also be a list of articles."
9783 (let ((articles (if (listp article) article (list article))))
9784 (dolist (article articles)
9785 (push article gnus-newsgroup-forwarded)
9786 (let ((buffer-read-only nil))
9787 (when (gnus-summary-goto-subject article nil t)
9788 (gnus-summary-update-secondary-mark article))))))
9790 (defun gnus-summary-set-bookmark (article)
9791 "Set a bookmark in current article."
9792 (interactive (list (gnus-summary-article-number)))
9793 (when (or (not (get-buffer gnus-article-buffer))
9794 (not gnus-current-article)
9795 (not gnus-article-current)
9796 (not (equal gnus-newsgroup-name (car gnus-article-current))))
9797 (error "No current article selected"))
9798 ;; Remove old bookmark, if one exists.
9799 (gnus-pull article gnus-newsgroup-bookmarks)
9800 ;; Set the new bookmark, which is on the form
9801 ;; (article-number . line-number-in-body).
9804 (with-current-buffer gnus-article-buffer
9811 gnus-newsgroup-bookmarks)
9812 (gnus-message 6 "A bookmark has been added to the current article."))
9814 (defun gnus-summary-remove-bookmark (article)
9815 "Remove the bookmark from the current article."
9816 (interactive (list (gnus-summary-article-number)))
9817 ;; Remove old bookmark, if one exists.
9818 (if (not (assq article gnus-newsgroup-bookmarks))
9819 (gnus-message 6 "No bookmark in current article.")
9820 (gnus-pull article gnus-newsgroup-bookmarks)
9821 (gnus-message 6 "Removed bookmark.")))
9823 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
9824 (defun gnus-summary-mark-as-dormant (n)
9825 "Mark N articles forward as dormant.
9826 If N is negative, mark backward instead. The difference between N and
9827 the actual number of articles marked is returned."
9829 (gnus-summary-mark-forward n gnus-dormant-mark))
9831 (defun gnus-summary-set-process-mark (article)
9832 "Set the process mark on ARTICLE and update the summary line."
9833 (setq gnus-newsgroup-processable
9835 (delq article gnus-newsgroup-processable)))
9836 (when (gnus-summary-goto-subject article)
9837 (gnus-summary-show-thread)
9838 (gnus-summary-goto-subject article)
9839 (gnus-summary-update-secondary-mark article)))
9841 (defun gnus-summary-remove-process-mark (article)
9842 "Remove the process mark from ARTICLE and update the summary line."
9843 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
9844 (when (gnus-summary-goto-subject article)
9845 (gnus-summary-show-thread)
9846 (gnus-summary-goto-subject article)
9847 (gnus-summary-update-secondary-mark article)))
9849 (defun gnus-summary-set-saved-mark (article)
9850 "Set the process mark on ARTICLE and update the summary line."
9851 (push article gnus-newsgroup-saved)
9852 (when (gnus-summary-goto-subject article)
9853 (gnus-summary-update-secondary-mark article)))
9855 (defun gnus-summary-mark-forward (n &optional mark no-expire)
9856 "Mark N articles as read forwards.
9857 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
9858 The difference between N and the actual number of articles marked is
9860 If NO-EXPIRE, auto-expiry will be inhibited."
9862 (gnus-summary-show-thread)
9863 (let ((backward (< n 0))
9864 (gnus-summary-goto-unread
9865 (and gnus-summary-goto-unread
9866 (not (eq gnus-summary-goto-unread 'never))
9867 (not (memq mark (list gnus-unread-mark gnus-spam-mark
9868 gnus-ticked-mark gnus-dormant-mark)))))
9870 (mark (or mark gnus-del-mark)))
9872 (gnus-summary-mark-article nil mark no-expire)
9873 (zerop (gnus-summary-next-subject
9875 (and gnus-summary-goto-unread
9876 (not (eq gnus-summary-goto-unread 'never)))
9880 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9881 (gnus-summary-recenter)
9882 (gnus-summary-position-point)
9883 (gnus-set-mode-line 'summary)
9886 (defun gnus-summary-mark-article-as-read (mark)
9887 "Mark the current article quickly as read with MARK."
9888 (let ((article (gnus-summary-article-number)))
9889 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
9890 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9891 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
9892 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9893 (push (cons article mark) gnus-newsgroup-reads)
9894 ;; Possibly remove from cache, if that is used.
9895 (when gnus-use-cache
9896 (gnus-cache-enter-remove-article article))
9897 ;; Allow the backend to change the mark.
9898 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9899 ;; Check for auto-expiry.
9900 (when (and gnus-newsgroup-auto-expire
9901 (memq mark gnus-auto-expirable-marks))
9902 (setq mark gnus-expirable-mark)
9903 ;; Let the backend know about the mark change.
9904 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9905 (push article gnus-newsgroup-expirable))
9906 ;; Set the mark in the buffer.
9907 (gnus-summary-update-mark mark 'unread)
9910 (defun gnus-summary-mark-article-as-unread (mark)
9911 "Mark the current article quickly as unread with MARK."
9912 (let* ((article (gnus-summary-article-number))
9913 (old-mark (gnus-summary-article-mark article)))
9914 ;; Allow the backend to change the mark.
9915 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9916 (if (eq mark old-mark)
9920 (gnus-error 1 "Can't mark negative article numbers")
9922 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
9923 (setq gnus-newsgroup-spam-marked
9924 (delq article gnus-newsgroup-spam-marked))
9925 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
9926 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
9927 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
9928 (cond ((= mark gnus-ticked-mark)
9929 (setq gnus-newsgroup-marked
9930 (gnus-add-to-sorted-list gnus-newsgroup-marked
9932 ((= mark gnus-spam-mark)
9933 (setq gnus-newsgroup-spam-marked
9934 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
9936 ((= mark gnus-dormant-mark)
9937 (setq gnus-newsgroup-dormant
9938 (gnus-add-to-sorted-list gnus-newsgroup-dormant
9941 (setq gnus-newsgroup-unreads
9942 (gnus-add-to-sorted-list gnus-newsgroup-unreads
9944 (gnus-pull article gnus-newsgroup-reads)
9946 ;; See whether the article is to be put in the cache.
9948 (vectorp (gnus-summary-article-header article))
9950 (gnus-cache-possibly-enter-article
9951 gnus-newsgroup-name article
9952 (= mark gnus-ticked-mark)
9953 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
9956 (gnus-summary-update-mark mark 'unread)
9959 (defun gnus-summary-mark-article (&optional article mark no-expire)
9960 "Mark ARTICLE with MARK. MARK can be any character.
9961 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
9962 `??' (dormant) and `?E' (expirable).
9963 If MARK is nil, then the default character `?r' is used.
9964 If ARTICLE is nil, then the article on the current line will be
9966 If NO-EXPIRE, auto-expiry will be inhibited."
9967 ;; The mark might be a string.
9968 (when (stringp mark)
9969 (setq mark (aref mark 0)))
9970 ;; If no mark is given, then we check auto-expiring.
9972 (setq mark gnus-del-mark))
9973 (when (and (not no-expire)
9974 gnus-newsgroup-auto-expire
9975 (memq mark gnus-auto-expirable-marks))
9976 (setq mark gnus-expirable-mark))
9977 (let ((article (or article (gnus-summary-article-number)))
9978 (old-mark (gnus-summary-article-mark article)))
9979 ;; Allow the backend to change the mark.
9980 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
9981 (if (eq mark old-mark)
9984 (error "No article on current line"))
9985 (if (not (if (or (= mark gnus-unread-mark)
9986 (= mark gnus-ticked-mark)
9987 (= mark gnus-spam-mark)
9988 (= mark gnus-dormant-mark))
9989 (gnus-mark-article-as-unread article mark)
9990 (gnus-mark-article-as-read article mark)))
9992 ;; See whether the article is to be put in the cache.
9994 (not (= mark gnus-canceled-mark))
9995 (vectorp (gnus-summary-article-header article))
9997 (gnus-cache-possibly-enter-article
9998 gnus-newsgroup-name article
9999 (= mark gnus-ticked-mark)
10000 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10002 (when (gnus-summary-goto-subject article nil t)
10003 (let ((buffer-read-only nil))
10004 (gnus-summary-show-thread)
10006 (gnus-summary-update-mark mark 'unread)
10009 (defun gnus-summary-update-secondary-mark (article)
10010 "Update the secondary (read, process, cache) mark."
10011 (gnus-summary-update-mark
10012 (cond ((memq article gnus-newsgroup-processable)
10014 ((memq article gnus-newsgroup-cached)
10016 ((memq article gnus-newsgroup-replied)
10018 ((memq article gnus-newsgroup-forwarded)
10019 gnus-forwarded-mark)
10020 ((memq article gnus-newsgroup-saved)
10022 ((memq article gnus-newsgroup-recent)
10024 ((memq article gnus-newsgroup-unseen)
10028 (when (gnus-visual-p 'summary-highlight 'highlight)
10029 (gnus-run-hooks 'gnus-summary-update-hook))
10032 (defun gnus-summary-update-download-mark (article)
10033 "Update the download mark."
10034 (gnus-summary-update-mark
10035 (cond ((memq article gnus-newsgroup-undownloaded)
10036 gnus-undownloaded-mark)
10037 (gnus-newsgroup-agentized
10038 gnus-downloaded-mark)
10042 (gnus-summary-update-line t)
10045 (defun gnus-summary-update-mark (mark type)
10046 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10047 (buffer-read-only nil))
10048 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10050 (when (looking-at "\r")
10052 (when (<= (+ forward (point)) (point-max))
10053 ;; Go to the right position on the line.
10054 (goto-char (+ forward (point)))
10055 ;; Replace the old mark with the new mark.
10056 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10057 ;; Optionally update the marks by some user rule.
10058 (when (eq type 'unread)
10059 (gnus-data-set-mark
10060 (gnus-data-find (gnus-summary-article-number)) mark)
10061 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10063 (defun gnus-mark-article-as-read (article &optional mark)
10064 "Enter ARTICLE in the pertinent lists and remove it from others."
10065 ;; Make the article expirable.
10066 (let ((mark (or mark gnus-del-mark)))
10067 (setq gnus-newsgroup-expirable
10068 (if (= mark gnus-expirable-mark)
10069 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10070 (delq article gnus-newsgroup-expirable)))
10071 ;; Remove from unread and marked lists.
10072 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10073 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10074 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10075 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10076 (push (cons article mark) gnus-newsgroup-reads)
10077 ;; Possibly remove from cache, if that is used.
10078 (when gnus-use-cache
10079 (gnus-cache-enter-remove-article article))
10082 (defun gnus-mark-article-as-unread (article &optional mark)
10083 "Enter ARTICLE in the pertinent lists and remove it from others."
10084 (let ((mark (or mark gnus-ticked-mark)))
10087 (gnus-error 1 "Can't mark negative article numbers")
10089 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10090 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10091 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10092 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10093 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10095 ;; Unsuppress duplicates?
10096 (when gnus-suppress-duplicates
10097 (gnus-dup-unsuppress-article article))
10099 (cond ((= mark gnus-ticked-mark)
10100 (setq gnus-newsgroup-marked
10101 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10102 ((= mark gnus-spam-mark)
10103 (setq gnus-newsgroup-spam-marked
10104 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10106 ((= mark gnus-dormant-mark)
10107 (setq gnus-newsgroup-dormant
10108 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10110 (setq gnus-newsgroup-unreads
10111 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10112 (gnus-pull article gnus-newsgroup-reads)
10115 (defalias 'gnus-summary-mark-as-unread-forward
10116 'gnus-summary-tick-article-forward)
10117 (make-obsolete 'gnus-summary-mark-as-unread-forward
10118 'gnus-summary-tick-article-forward)
10119 (defun gnus-summary-tick-article-forward (n)
10120 "Tick N articles forwards.
10121 If N is negative, tick backwards instead.
10122 The difference between N and the number of articles ticked is returned."
10124 (gnus-summary-mark-forward n gnus-ticked-mark))
10126 (defalias 'gnus-summary-mark-as-unread-backward
10127 'gnus-summary-tick-article-backward)
10128 (make-obsolete 'gnus-summary-mark-as-unread-backward
10129 'gnus-summary-tick-article-backward)
10130 (defun gnus-summary-tick-article-backward (n)
10131 "Tick N articles backwards.
10132 The difference between N and the number of articles ticked is returned."
10134 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10136 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10137 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10138 (defun gnus-summary-tick-article (&optional article clear-mark)
10139 "Mark current article as unread.
10140 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10141 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10143 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10144 gnus-ticked-mark)))
10146 (defun gnus-summary-mark-as-read-forward (n)
10147 "Mark N articles as read forwards.
10148 If N is negative, mark backwards instead.
10149 The difference between N and the actual number of articles marked is
10152 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10154 (defun gnus-summary-mark-as-read-backward (n)
10155 "Mark the N articles as read backwards.
10156 The difference between N and the actual number of articles marked is
10159 (gnus-summary-mark-forward
10160 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10162 (defun gnus-summary-mark-as-read (&optional article mark)
10163 "Mark current article as read.
10164 ARTICLE specifies the article to be marked as read.
10165 MARK specifies a string to be inserted at the beginning of the line."
10166 (gnus-summary-mark-article article mark))
10168 (defun gnus-summary-clear-mark-forward (n)
10169 "Clear marks from N articles forward.
10170 If N is negative, clear backward instead.
10171 The difference between N and the number of marks cleared is returned."
10173 (gnus-summary-mark-forward n gnus-unread-mark))
10175 (defun gnus-summary-clear-mark-backward (n)
10176 "Clear marks from N articles backward.
10177 The difference between N and the number of marks cleared is returned."
10179 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10181 (defun gnus-summary-mark-unread-as-read ()
10182 "Intended to be used by `gnus-summary-mark-article-hook'."
10183 (when (memq gnus-current-article gnus-newsgroup-unreads)
10184 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10186 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10187 "Intended to be used by `gnus-summary-mark-article-hook'."
10188 (let ((mark (gnus-summary-article-mark)))
10189 (when (or (gnus-unread-mark-p mark)
10190 (gnus-read-mark-p mark))
10191 (gnus-summary-mark-article gnus-current-article
10192 (or new-mark gnus-read-mark)))))
10194 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10195 "Intended to be used by `gnus-summary-mark-article-hook'."
10196 (let ((mark (gnus-summary-article-mark)))
10197 (when (or (gnus-unread-mark-p mark)
10198 (gnus-read-mark-p mark))
10199 (gnus-summary-mark-article (gnus-summary-article-number)
10200 (or new-mark gnus-read-mark)))))
10202 (defun gnus-summary-mark-unread-as-ticked ()
10203 "Intended to be used by `gnus-summary-mark-article-hook'."
10204 (when (memq gnus-current-article gnus-newsgroup-unreads)
10205 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10207 (defun gnus-summary-mark-region-as-read (point mark all)
10208 "Mark all unread articles between point and mark as read.
10209 If given a prefix, mark all articles between point and mark as read,
10210 even ticked and dormant ones."
10211 (interactive "r\nP")
10215 (beginning-of-line)
10220 (memq (setq article (gnus-summary-article-number))
10221 gnus-newsgroup-unreads))
10222 (gnus-summary-mark-article article gnus-del-mark))
10224 (gnus-summary-find-next))))))
10226 (defun gnus-summary-mark-below (score mark)
10227 "Mark articles with score less than SCORE with MARK."
10228 (interactive "P\ncMark: ")
10229 (setq score (if score
10230 (prefix-numeric-value score)
10231 (or gnus-summary-default-score 0)))
10233 (set-buffer gnus-summary-buffer)
10234 (goto-char (point-min))
10237 (and (< (gnus-summary-article-score) score)
10238 (gnus-summary-mark-article nil mark))
10239 (gnus-summary-find-next)))))
10241 (defun gnus-summary-kill-below (&optional score)
10242 "Mark articles with score below SCORE as read."
10244 (gnus-summary-mark-below score gnus-killed-mark))
10246 (defun gnus-summary-clear-above (&optional score)
10247 "Clear all marks from articles with score above SCORE."
10249 (gnus-summary-mark-above score gnus-unread-mark))
10251 (defun gnus-summary-tick-above (&optional score)
10252 "Tick all articles with score above SCORE."
10254 (gnus-summary-mark-above score gnus-ticked-mark))
10256 (defun gnus-summary-mark-above (score mark)
10257 "Mark articles with score over SCORE with MARK."
10258 (interactive "P\ncMark: ")
10259 (setq score (if score
10260 (prefix-numeric-value score)
10261 (or gnus-summary-default-score 0)))
10263 (set-buffer gnus-summary-buffer)
10264 (goto-char (point-min))
10266 (when (> (gnus-summary-article-score) score)
10267 (gnus-summary-mark-article nil mark))
10269 (gnus-summary-find-next)))))
10271 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10272 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10273 (defun gnus-summary-limit-include-expunged (&optional no-error)
10274 "Display all the hidden articles that were expunged for low scores."
10276 (let ((buffer-read-only nil))
10277 (let ((scored gnus-newsgroup-scored)
10280 (unless (gnus-summary-article-header (caar scored))
10281 (and (setq h (gnus-number-to-header (caar scored)))
10282 (< (cdar scored) gnus-summary-expunge-below)
10284 (setq scored (cdr scored)))
10286 (when (not no-error)
10287 (error "No expunged articles hidden"))
10288 (goto-char (point-min))
10289 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10290 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10291 (mapcar (lambda (x) (push (mail-header-number x)
10292 gnus-newsgroup-limit))
10294 (gnus-summary-prepare-unthreaded (nreverse headers))
10295 (goto-char (point-min))
10296 (gnus-summary-position-point)
10299 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10300 "Mark all unread articles in this newsgroup as read.
10301 If prefix argument ALL is non-nil, ticked and dormant articles will
10302 also be marked as read.
10303 If QUIETLY is non-nil, no questions will be asked.
10305 If TO-HERE is non-nil, it should be a point in the buffer. All
10306 articles before (after, if REVERSE is set) this point will be marked
10309 Note that this function will only catch up the unread article
10310 in the current summary buffer limitation.
10312 The number of articles marked as read is returned."
10317 (not gnus-interactive-catchup) ;Without confirmation?
10321 "Mark absolutely all articles as read? "
10322 "Mark all unread articles as read? ")))
10324 (not gnus-newsgroup-adaptive)
10325 (not gnus-newsgroup-auto-expire)
10326 (not gnus-suppress-duplicates)
10327 (or (not gnus-use-cache)
10328 (eq gnus-use-cache 'passive)))
10331 (setq gnus-newsgroup-marked nil
10332 gnus-newsgroup-spam-marked nil
10333 gnus-newsgroup-dormant nil))
10334 (setq gnus-newsgroup-unreads
10335 (gnus-sorted-nunion
10336 (gnus-intersection gnus-newsgroup-unreads
10337 gnus-newsgroup-downloadable)
10338 gnus-newsgroup-unfetched)))
10339 ;; We actually mark all articles as canceled, which we
10340 ;; have to do when using auto-expiry or adaptive scoring.
10341 (gnus-summary-show-all-threads)
10342 (if (and to-here reverse)
10344 (goto-char to-here)
10345 (gnus-summary-mark-current-read-and-unread-as-read
10347 (while (gnus-summary-find-next (not all))
10348 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10349 (when (gnus-summary-first-subject (not all))
10351 (if to-here (< (point) to-here) t)
10352 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10353 (gnus-summary-find-next (not all))))))
10354 (gnus-set-mode-line 'summary))
10356 (gnus-summary-position-point)))
10358 (defun gnus-summary-catchup-to-here (&optional all)
10359 "Mark all unticked articles before the current one as read.
10360 If ALL is non-nil, also mark ticked and dormant articles as read."
10363 (gnus-save-hidden-threads
10364 (let ((beg (point)))
10365 ;; We check that there are unread articles.
10366 (when (or all (gnus-summary-find-prev))
10367 (gnus-summary-catchup all t beg)))))
10368 (gnus-summary-position-point))
10370 (defun gnus-summary-catchup-from-here (&optional all)
10371 "Mark all unticked articles after (and including) the current one as read.
10372 If ALL is non-nil, also mark ticked and dormant articles as read."
10375 (gnus-save-hidden-threads
10376 (let ((beg (point)))
10377 ;; We check that there are unread articles.
10378 (when (or all (gnus-summary-find-next))
10379 (gnus-summary-catchup all t beg nil t)))))
10380 (gnus-summary-position-point))
10382 (defun gnus-summary-catchup-all (&optional quietly)
10383 "Mark all articles in this newsgroup as read.
10384 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10385 instead, which marks only unread articles as read."
10387 (gnus-summary-catchup t quietly))
10389 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10390 "Mark all unread articles in this group as read, then exit.
10391 If prefix argument ALL is non-nil, all articles are marked as read.
10392 If QUIETLY is non-nil, no questions will be asked."
10394 (when (gnus-summary-catchup all quietly nil 'fast)
10395 ;; Select next newsgroup or exit.
10396 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10397 (eq gnus-auto-select-next 'quietly))
10398 (gnus-summary-next-group nil)
10399 (gnus-summary-exit))))
10401 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10402 "Mark all articles in this newsgroup as read, and then exit.
10403 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10404 instead, which marks only unread articles as read."
10406 (gnus-summary-catchup-and-exit t quietly))
10408 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10409 "Mark all articles in this group as read and select the next group.
10410 If given a prefix, mark all articles, unread as well as ticked, as
10414 (gnus-summary-catchup all))
10415 (gnus-summary-next-group))
10421 (defmacro gnus-with-article (article &rest forms)
10422 "Select ARTICLE and perform FORMS in the original article buffer.
10423 Then replace the article with the result."
10425 ;; We don't want the article to be marked as read.
10426 (let (gnus-mark-article-hook)
10427 (gnus-summary-select-article t t nil ,article))
10428 (set-buffer gnus-original-article-buffer)
10430 (if (not (gnus-check-backend-function
10431 'request-replace-article (car gnus-article-current)))
10432 (gnus-message 5 "Read-only group; not replacing")
10433 (unless (gnus-request-replace-article
10434 ,article (car gnus-article-current)
10435 (current-buffer) t)
10436 (error "Couldn't replace article")))
10437 ;; The cache and backlog have to be flushed somewhat.
10438 (when gnus-keep-backlog
10439 (gnus-backlog-remove-article
10440 (car gnus-article-current) (cdr gnus-article-current)))
10441 (when gnus-use-cache
10442 (gnus-cache-update-article
10443 (car gnus-article-current) (cdr gnus-article-current)))))
10445 (put 'gnus-with-article 'lisp-indent-function 1)
10446 (put 'gnus-with-article 'edebug-form-spec '(form body))
10448 ;; Thread-based commands.
10450 (defun gnus-summary-articles-in-thread (&optional article)
10451 "Return a list of all articles in the current thread.
10452 If ARTICLE is non-nil, return all articles in the thread that starts
10453 with that article."
10454 (let* ((article (or article (gnus-summary-article-number)))
10455 (data (gnus-data-find-list article))
10456 (top-level (gnus-data-level (car data)))
10458 (cond ((null gnus-thread-operation-ignore-subject)
10459 (gnus-simplify-subject-re
10460 (mail-header-subject (gnus-data-header (car data)))))
10461 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10462 (gnus-simplify-subject-fuzzy
10463 (mail-header-subject (gnus-data-header (car data)))))
10465 (end-point (save-excursion
10466 (if (gnus-summary-go-to-next-thread)
10467 (point) (point-max))))
10470 (< (gnus-data-pos (car data)) end-point))
10471 (when (or (not top-subject)
10472 (string= top-subject
10473 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10474 (gnus-simplify-subject-fuzzy
10475 (mail-header-subject
10476 (gnus-data-header (car data))))
10477 (gnus-simplify-subject-re
10478 (mail-header-subject
10479 (gnus-data-header (car data)))))))
10480 (push (gnus-data-number (car data)) articles))
10481 (unless (and (setq data (cdr data))
10482 (> (gnus-data-level (car data)) top-level))
10484 ;; Return the list of articles.
10485 (nreverse articles)))
10487 (defun gnus-summary-rethread-current ()
10488 "Rethread the thread the current article is part of."
10490 (let* ((gnus-show-threads t)
10491 (article (gnus-summary-article-number))
10492 (id (mail-header-id (gnus-summary-article-header)))
10493 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10495 (error "No article on the current line"))
10496 (gnus-rebuild-thread id)
10497 (gnus-summary-goto-subject article)))
10499 (defun gnus-summary-reparent-thread ()
10500 "Make the current article child of the marked (or previous) article.
10502 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10503 is non-nil or the Subject: of both articles are the same."
10505 (unless (not (gnus-group-read-only-p))
10506 (error "The current newsgroup does not support article editing"))
10507 (unless (<= (length gnus-newsgroup-processable) 1)
10508 (error "No more than one article may be marked"))
10509 (save-window-excursion
10510 (let ((gnus-article-buffer " *reparent*")
10511 (current-article (gnus-summary-article-number))
10512 ;; First grab the marked article, otherwise one line up.
10513 (parent-article (if (not (null gnus-newsgroup-processable))
10514 (car gnus-newsgroup-processable)
10516 (if (eq (forward-line -1) 0)
10517 (gnus-summary-article-number)
10518 (error "Beginning of summary buffer"))))))
10519 (unless (not (eq current-article parent-article))
10520 (error "An article may not be self-referential"))
10521 (let ((message-id (mail-header-id
10522 (gnus-summary-article-header parent-article))))
10523 (unless (and message-id (not (equal message-id "")))
10524 (error "No message-id in desired parent"))
10525 (gnus-with-article current-article
10527 (goto-char (point-min))
10528 (message-narrow-to-head)
10529 (if (re-search-forward "^References: " nil t)
10531 (re-search-forward "^[^ \t]" nil t)
10534 (insert " " message-id))
10535 (insert "References: " message-id "\n"))))
10536 (set-buffer gnus-summary-buffer)
10537 (gnus-summary-unmark-all-processable)
10538 (gnus-summary-update-article current-article)
10539 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10540 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10541 (gnus-summary-rethread-current)
10542 (gnus-message 3 "Article %d is now the child of article %d"
10543 current-article parent-article)))))
10545 (defun gnus-summary-toggle-threads (&optional arg)
10546 "Toggle showing conversation threads.
10547 If ARG is positive number, turn showing conversation threads on."
10549 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10550 (setq gnus-show-threads
10551 (if (null arg) (not gnus-show-threads)
10552 (> (prefix-numeric-value arg) 0)))
10553 (gnus-summary-prepare)
10554 (gnus-summary-goto-subject current)
10555 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10556 (gnus-summary-position-point)))
10558 (defun gnus-summary-show-all-threads ()
10559 "Show all threads."
10562 (let ((buffer-read-only nil))
10563 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10564 (gnus-summary-position-point))
10566 (defun gnus-summary-show-thread ()
10567 "Show thread subtrees.
10568 Returns nil if no thread was there to be shown."
10570 (let ((buffer-read-only nil)
10572 (end (point-at-eol))
10573 ;; Leave point at bol
10574 (beg (progn (beginning-of-line) (point))))
10576 ;; Any hidden lines here?
10577 (search-forward "\r" end t)
10578 (subst-char-in-region beg end ?\^M ?\n t)
10580 (gnus-summary-position-point))))
10582 (defun gnus-summary-maybe-hide-threads ()
10583 "If requested, hide the threads that should be hidden."
10584 (when (and gnus-show-threads
10585 gnus-thread-hide-subtree)
10586 (gnus-summary-hide-all-threads
10587 (if (or (consp gnus-thread-hide-subtree)
10588 (functionp gnus-thread-hide-subtree))
10589 (gnus-make-predicate gnus-thread-hide-subtree)
10592 ;;; Hiding predicates.
10594 (defun gnus-article-unread-p (header)
10595 (memq (mail-header-number header) gnus-newsgroup-unreads))
10597 (defun gnus-article-unseen-p (header)
10598 (memq (mail-header-number header) gnus-newsgroup-unseen))
10600 (defun gnus-map-articles (predicate articles)
10601 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10602 (apply 'gnus-or (mapcar predicate
10603 (mapcar 'gnus-summary-article-header articles))))
10605 (defun gnus-summary-hide-all-threads (&optional predicate)
10606 "Hide all thread subtrees.
10607 If PREDICATE is supplied, threads that satisfy this predicate
10608 will not be hidden."
10611 (goto-char (point-min))
10614 (when (or (not predicate)
10616 predicate (gnus-summary-article-children)))
10617 (gnus-summary-hide-thread))
10618 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10619 (gnus-summary-position-point))
10621 (defun gnus-summary-hide-thread ()
10622 "Hide thread subtrees.
10623 If PREDICATE is supplied, threads that satisfy this predicate
10624 will not be hidden.
10625 Returns nil if no threads were there to be hidden."
10627 (let ((buffer-read-only nil)
10629 (article (gnus-summary-article-number)))
10631 ;; Go forward until either the buffer ends or the subthread
10633 (when (and (not (eobp))
10634 (or (zerop (gnus-summary-next-thread 1 t))
10635 (goto-char (point-max))))
10637 (if (and (> (point) start)
10638 (search-backward "\n" start t))
10640 (subst-char-in-region start (point) ?\n ?\^M)
10641 (gnus-summary-goto-subject article))
10645 (defun gnus-summary-go-to-next-thread (&optional previous)
10646 "Go to the same level (or less) next thread.
10647 If PREVIOUS is non-nil, go to previous thread instead.
10648 Return the article number moved to, or nil if moving was impossible."
10649 (let ((level (gnus-summary-thread-level))
10650 (way (if previous -1 1))
10653 (while (and (not (eobp))
10654 (< level (gnus-summary-thread-level)))
10655 (forward-line way))
10662 (gnus-summary-article-number)
10663 (goto-char beg)))))
10665 (defun gnus-summary-next-thread (n &optional silent)
10666 "Go to the same level next N'th thread.
10667 If N is negative, search backward instead.
10668 Returns the difference between N and the number of skips actually
10671 If SILENT, don't output messages."
10673 (let ((backward (< n 0))
10675 (while (and (> n 0)
10676 (gnus-summary-go-to-next-thread backward))
10679 (gnus-summary-position-point))
10680 (when (and (not silent) (/= 0 n))
10681 (gnus-message 7 "No more threads"))
10684 (defun gnus-summary-prev-thread (n)
10685 "Go to the same level previous N'th thread.
10686 Returns the difference between N and the number of skips actually
10689 (gnus-summary-next-thread (- n)))
10691 (defun gnus-summary-go-down-thread ()
10692 "Go down one level in the current thread."
10693 (let ((children (gnus-summary-article-children)))
10695 (gnus-summary-goto-subject (car children)))))
10697 (defun gnus-summary-go-up-thread ()
10698 "Go up one level in the current thread."
10699 (let ((parent (gnus-summary-article-parent)))
10701 (gnus-summary-goto-subject parent))))
10703 (defun gnus-summary-down-thread (n)
10704 "Go down thread N steps.
10705 If N is negative, go up instead.
10706 Returns the difference between N and how many steps down that were
10711 (while (and (> n 0)
10712 (if up (gnus-summary-go-up-thread)
10713 (gnus-summary-go-down-thread)))
10715 (gnus-summary-position-point)
10717 (gnus-message 7 "Can't go further"))
10720 (defun gnus-summary-up-thread (n)
10721 "Go up thread N steps.
10722 If N is negative, go down instead.
10723 Returns the difference between N and how many steps down that were
10726 (gnus-summary-down-thread (- n)))
10728 (defun gnus-summary-top-thread ()
10729 "Go to the top of the thread."
10731 (while (gnus-summary-go-up-thread))
10732 (gnus-summary-article-number))
10734 (defun gnus-summary-kill-thread (&optional unmark)
10735 "Mark articles under current thread as read.
10736 If the prefix argument is positive, remove any kinds of marks.
10737 If the prefix argument is negative, tick articles instead."
10740 (setq unmark (prefix-numeric-value unmark)))
10741 (let ((articles (gnus-summary-articles-in-thread)))
10743 ;; Expand the thread.
10744 (gnus-summary-show-thread)
10745 ;; Mark all the articles.
10747 (gnus-summary-goto-subject (car articles))
10748 (cond ((null unmark)
10749 (gnus-summary-mark-article-as-read gnus-killed-mark))
10751 (gnus-summary-mark-article-as-unread gnus-unread-mark))
10753 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
10754 (setq articles (cdr articles))))
10755 ;; Hide killed subtrees.
10757 gnus-thread-hide-killed
10758 (gnus-summary-hide-thread))
10759 ;; If marked as read, go to next unread subject.
10760 (when (null unmark)
10761 ;; Go to next unread subject.
10762 (gnus-summary-next-subject 1 t)))
10763 (gnus-set-mode-line 'summary))
10765 ;; Summary sorting commands
10767 (defun gnus-summary-sort-by-number (&optional reverse)
10768 "Sort the summary buffer by article number.
10769 Argument REVERSE means reverse order."
10771 (gnus-summary-sort 'number reverse))
10773 (defun gnus-summary-sort-by-random (&optional reverse)
10774 "Randomize the order in the summary buffer.
10775 Argument REVERSE means to randomize in reverse order."
10777 (gnus-summary-sort 'random reverse))
10779 (defun gnus-summary-sort-by-author (&optional reverse)
10780 "Sort the summary buffer by author name alphabetically.
10781 If `case-fold-search' is non-nil, case of letters is ignored.
10782 Argument REVERSE means reverse order."
10784 (gnus-summary-sort 'author reverse))
10786 (defun gnus-summary-sort-by-subject (&optional reverse)
10787 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
10788 If `case-fold-search' is non-nil, case of letters is ignored.
10789 Argument REVERSE means reverse order."
10791 (gnus-summary-sort 'subject reverse))
10793 (defun gnus-summary-sort-by-date (&optional reverse)
10794 "Sort the summary buffer by date.
10795 Argument REVERSE means reverse order."
10797 (gnus-summary-sort 'date reverse))
10799 (defun gnus-summary-sort-by-score (&optional reverse)
10800 "Sort the summary buffer by score.
10801 Argument REVERSE means reverse order."
10803 (gnus-summary-sort 'score reverse))
10805 (defun gnus-summary-sort-by-lines (&optional reverse)
10806 "Sort the summary buffer by the number of lines.
10807 Argument REVERSE means reverse order."
10809 (gnus-summary-sort 'lines reverse))
10811 (defun gnus-summary-sort-by-chars (&optional reverse)
10812 "Sort the summary buffer by article length.
10813 Argument REVERSE means reverse order."
10815 (gnus-summary-sort 'chars reverse))
10817 (defun gnus-summary-sort-by-original (&optional reverse)
10818 "Sort the summary buffer using the default sorting method.
10819 Argument REVERSE means reverse order."
10821 (let* ((buffer-read-only)
10822 (gnus-summary-prepare-hook nil))
10823 ;; We do the sorting by regenerating the threads.
10824 (gnus-summary-prepare)
10825 ;; Hide subthreads if needed.
10826 (gnus-summary-maybe-hide-threads)))
10828 (defun gnus-summary-sort (predicate reverse)
10829 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
10830 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
10831 (article (intern (format "gnus-article-sort-by-%s" predicate)))
10832 (gnus-thread-sort-functions
10837 (gnus-sort-gathered-threads-function
10838 gnus-thread-sort-functions)
10839 (gnus-article-sort-functions
10843 (,article t2 t1))))
10845 (gnus-summary-prepare-hook nil))
10846 ;; We do the sorting by regenerating the threads.
10847 (gnus-summary-prepare)
10848 ;; Hide subthreads if needed.
10849 (gnus-summary-maybe-hide-threads)))
10851 ;; Summary saving commands.
10853 (defun gnus-summary-save-article (&optional n not-saved)
10854 "Save the current article using the default saver function.
10855 If N is a positive number, save the N next articles.
10856 If N is a negative number, save the N previous articles.
10857 If N is nil and any articles have been marked with the process mark,
10858 save those articles instead.
10859 The variable `gnus-default-article-saver' specifies the saver function."
10861 (let* ((articles (gnus-summary-work-articles n))
10862 (save-buffer (save-excursion
10863 (nnheader-set-temp-buffer " *Gnus Save*")))
10864 (num (length articles))
10866 (dolist (article articles)
10867 (setq header (gnus-summary-article-header article))
10868 (if (not (vectorp header))
10869 ;; This is a pseudo-article.
10870 (if (assq 'name header)
10871 (gnus-copy-file (cdr (assq 'name header)))
10872 (gnus-message 1 "Article %d is unsaveable" article))
10873 ;; This is a real article.
10874 (save-window-excursion
10875 (let ((gnus-display-mime-function nil)
10876 (gnus-article-prepare-hook nil))
10877 (gnus-summary-select-article t nil nil article)))
10879 (set-buffer save-buffer)
10881 (insert-buffer-substring gnus-original-article-buffer))
10882 (setq file (gnus-article-save save-buffer file num))
10883 (gnus-summary-remove-process-mark article)
10885 (gnus-summary-set-saved-mark article))))
10886 (gnus-kill-buffer save-buffer)
10887 (gnus-summary-position-point)
10888 (gnus-set-mode-line 'summary)
10891 (defun gnus-summary-pipe-output (&optional arg headers)
10892 "Pipe the current article to a subprocess.
10893 If N is a positive number, pipe the N next articles.
10894 If N is a negative number, pipe the N previous articles.
10895 If N is nil and any articles have been marked with the process mark,
10896 pipe those articles instead.
10897 If HEADERS (the symbolic prefix), include the headers, too."
10898 (interactive (gnus-interactive "P\ny"))
10899 (require 'gnus-art)
10900 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
10901 (gnus-save-all-headers (or headers gnus-save-all-headers)))
10902 (gnus-summary-save-article arg t))
10903 (let ((buffer (get-buffer "*Shell Command Output*")))
10905 (not (zerop (buffer-size buffer))))
10906 (gnus-configure-windows 'pipe))))
10908 (defun gnus-summary-save-article-mail (&optional arg)
10909 "Append the current article to an mail file.
10910 If N is a positive number, save the N next articles.
10911 If N is a negative number, save the N previous articles.
10912 If N is nil and any articles have been marked with the process mark,
10913 save those articles instead."
10915 (require 'gnus-art)
10916 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
10917 (gnus-summary-save-article arg)))
10919 (defun gnus-summary-save-article-rmail (&optional arg)
10920 "Append the current article to an rmail file.
10921 If N is a positive number, save the N next articles.
10922 If N is a negative number, save the N previous articles.
10923 If N is nil and any articles have been marked with the process mark,
10924 save those articles instead."
10926 (require 'gnus-art)
10927 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
10928 (gnus-summary-save-article arg)))
10930 (defun gnus-summary-save-article-file (&optional arg)
10931 "Append the current article to a file.
10932 If N is a positive number, save the N next articles.
10933 If N is a negative number, save the N previous articles.
10934 If N is nil and any articles have been marked with the process mark,
10935 save those articles instead."
10937 (require 'gnus-art)
10938 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
10939 (gnus-summary-save-article arg)))
10941 (defun gnus-summary-write-article-file (&optional arg)
10942 "Write the current article to a file, deleting the previous file.
10943 If N is a positive number, save the N next articles.
10944 If N is a negative number, save the N previous articles.
10945 If N is nil and any articles have been marked with the process mark,
10946 save those articles instead."
10948 (require 'gnus-art)
10949 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
10950 (gnus-summary-save-article arg)))
10952 (defun gnus-summary-save-article-body-file (&optional arg)
10953 "Append the current article body to a file.
10954 If N is a positive number, save the N next articles.
10955 If N is a negative number, save the N previous articles.
10956 If N is nil and any articles have been marked with the process mark,
10957 save those articles instead."
10959 (require 'gnus-art)
10960 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
10961 (gnus-summary-save-article arg)))
10963 (defun gnus-summary-muttprint (&optional arg)
10964 "Print the current article using Muttprint.
10965 If N is a positive number, save the N next articles.
10966 If N is a negative number, save the N previous articles.
10967 If N is nil and any articles have been marked with the process mark,
10968 save those articles instead."
10970 (require 'gnus-art)
10971 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
10972 (gnus-summary-save-article arg t)))
10974 (defun gnus-summary-pipe-message (program)
10975 "Pipe the current article through PROGRAM."
10976 (interactive "sProgram: ")
10977 (gnus-summary-select-article)
10978 (let ((mail-header-separator ""))
10979 (gnus-eval-in-buffer-window gnus-article-buffer
10982 (let ((start (window-start))
10984 (message-pipe-buffer-body program)
10985 (set-window-start (get-buffer-window (current-buffer)) start))))))
10987 (defun gnus-get-split-value (methods)
10988 "Return a value based on the split METHODS."
10989 (let (split-name method result match)
10992 (set-buffer gnus-original-article-buffer)
10994 (nnheader-narrow-to-headers)
10995 (while (and methods (not split-name))
10996 (goto-char (point-min))
10997 (setq method (pop methods))
10998 (setq match (car method))
11001 ;; Regular expression.
11003 (re-search-forward match nil t)))
11008 (setq result (funcall match gnus-newsgroup-name))))
11013 (setq result (eval match)))))
11014 (setq split-name (cdr method))
11015 (cond ((stringp result)
11016 (push (expand-file-name
11017 result gnus-article-save-directory)
11020 (setq split-name (append result split-name)))))))))
11021 (nreverse split-name)))
11023 (defun gnus-valid-move-group-p (group)
11024 (and (boundp group)
11025 (symbol-name group)
11026 (symbol-value group)
11027 (gnus-get-function (gnus-find-method-for-group
11028 (symbol-name group)) 'request-accept-article t)))
11030 (defun gnus-read-move-group-name (prompt default articles prefix)
11031 "Read a group name."
11032 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11033 (minibuffer-confirm-incomplete nil) ; XEmacs
11035 (format "%s %s to:"
11037 (if (> (length articles) 1)
11038 (format "these %d articles" (length articles))
11043 (gnus-completing-read-with-default
11046 'gnus-valid-move-group-p
11048 'gnus-group-history))
11049 ((= 1 (length split-name))
11050 (gnus-completing-read-with-default
11051 (car split-name) prom
11053 'gnus-valid-move-group-p
11055 'gnus-group-history))
11057 (gnus-completing-read-with-default
11059 (mapcar 'list (nreverse split-name))
11061 'gnus-group-history))))
11062 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11064 (if (or (string= to-newsgroup "")
11065 (string= to-newsgroup prefix))
11066 (setq to-newsgroup default))
11067 (unless to-newsgroup
11068 (error "No group name entered"))
11069 (or (gnus-active to-newsgroup)
11070 (gnus-activate-group to-newsgroup nil nil to-method)
11071 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11073 (or (and (gnus-request-create-group to-newsgroup to-method)
11074 (gnus-activate-group
11075 to-newsgroup nil nil to-method)
11076 (gnus-subscribe-group to-newsgroup))
11077 (error "Couldn't create group %s" to-newsgroup)))
11078 (error "No such group: %s" to-newsgroup)))
11081 (defun gnus-summary-save-parts (type dir n &optional reverse)
11082 "Save parts matching TYPE to DIR.
11083 If REVERSE, save parts that do not match TYPE."
11085 (list (read-string "Save parts of type: "
11086 (or (car gnus-summary-save-parts-type-history)
11087 gnus-summary-save-parts-default-mime)
11088 'gnus-summary-save-parts-type-history)
11089 (setq gnus-summary-save-parts-last-directory
11090 (read-file-name "Save to directory: "
11091 gnus-summary-save-parts-last-directory
11093 current-prefix-arg))
11094 (gnus-summary-iterate n
11095 (let ((gnus-display-mime-function nil)
11096 (gnus-inhibit-treatment t))
11097 (gnus-summary-select-article))
11099 (set-buffer gnus-article-buffer)
11100 (let ((handles (or gnus-article-mime-handles
11101 (mm-dissect-buffer nil gnus-article-loose-mime)
11102 (and gnus-article-emulate-mime
11103 (mm-uu-dissect)))))
11105 (gnus-summary-save-parts-1 type dir handles reverse)
11106 (unless gnus-article-mime-handles ;; Don't destroy this case.
11107 (mm-destroy-parts handles)))))))
11109 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11110 (if (stringp (car handle))
11111 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11114 (not (string-match type (mm-handle-media-type handle)))
11115 (string-match type (mm-handle-media-type handle)))
11116 (let ((file (expand-file-name
11118 mm-file-name-rewrite-functions
11119 (file-name-nondirectory
11121 (mail-content-type-get
11122 (mm-handle-disposition handle) 'filename)
11123 (mail-content-type-get
11124 (mm-handle-type handle) 'name)
11125 (concat gnus-newsgroup-name
11126 "." (number-to-string
11127 (cdr gnus-article-current))))))
11129 (unless (file-exists-p file)
11130 (mm-save-part-to-file handle file))))))
11132 ;; Summary extract commands
11134 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11135 (let ((buffer-read-only nil)
11136 (article (gnus-summary-article-number))
11138 (unless (gnus-summary-goto-subject article)
11139 (error "No such article: %d" article))
11140 (gnus-summary-position-point)
11141 ;; If all commands are to be bunched up on one line, we collect
11143 (unless gnus-view-pseudos-separately
11144 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11147 (setq action (cdr (assq 'action (car ps))))
11148 (setq files (list (cdr (assq 'name (car ps)))))
11149 (while (and ps (cdr ps)
11150 (string= (or action "1")
11151 (or (cdr (assq 'action (cadr ps))) "2")))
11152 (push (cdr (assq 'name (cadr ps))) files)
11153 (setcdr ps (cddr ps)))
11155 (when (not (string-match "%s" action))
11158 (when (assq 'execute (car ps))
11159 (setcdr (assq 'execute (car ps))
11160 (funcall (if (string-match "%s" action)
11167 (shell-quote-argument f)))
11169 (setq ps (cdr ps)))))
11170 (if (and gnus-view-pseudos (not not-view))
11172 (when (assq 'execute (car pslist))
11173 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11174 (eq gnus-view-pseudos 'not-confirm)))
11175 (setq pslist (cdr pslist)))
11178 (setq after-article (or (cdr (assq 'article (car pslist)))
11179 (gnus-summary-article-number)))
11180 (gnus-summary-goto-subject after-article)
11183 (insert " " (file-name-nondirectory
11184 (cdr (assq 'name (car pslist))))
11185 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11187 (forward-line -1) ; back to `b'
11188 (gnus-add-text-properties
11189 b (1- e) (list 'gnus-number gnus-reffed-article-number
11190 gnus-mouse-face-prop gnus-mouse-face))
11192 after-article gnus-reffed-article-number
11193 gnus-unread-mark b (car pslist) 0 (- e b))
11194 (setq gnus-newsgroup-unreads
11195 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11196 gnus-reffed-article-number))
11197 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11198 (setq pslist (cdr pslist)))))))
11200 (defun gnus-pseudos< (p1 p2)
11201 (let ((c1 (cdr (assq 'action p1)))
11202 (c2 (cdr (assq 'action p2))))
11203 (and c1 c2 (string< c1 c2))))
11205 (defun gnus-request-pseudo-article (props)
11206 (cond ((assq 'execute props)
11207 (gnus-execute-command (cdr (assq 'execute props)))))
11208 (let ((gnus-current-article (gnus-summary-article-number)))
11209 (gnus-run-hooks 'gnus-mark-article-hook)))
11211 (defun gnus-execute-command (command &optional automatic)
11213 (gnus-article-setup-buffer)
11214 (set-buffer gnus-article-buffer)
11215 (setq buffer-read-only nil)
11216 (let ((command (if automatic command
11217 (read-string "Command: " (cons command 0)))))
11219 (insert "$ " command "\n\n")
11220 (if gnus-view-pseudo-asynchronously
11221 (start-process "gnus-execute" (current-buffer) shell-file-name
11222 shell-command-switch command)
11223 (call-process shell-file-name nil t nil
11224 shell-command-switch command)))))
11226 ;; Summary kill commands.
11228 (defun gnus-summary-edit-global-kill (article)
11229 "Edit the \"global\" kill file."
11230 (interactive (list (gnus-summary-article-number)))
11231 (gnus-group-edit-global-kill article))
11233 (defun gnus-summary-edit-local-kill ()
11234 "Edit a local kill file applied to the current newsgroup."
11236 (setq gnus-current-headers (gnus-summary-article-header))
11237 (gnus-group-edit-local-kill
11238 (gnus-summary-article-number) gnus-newsgroup-name))
11240 ;;; Header reading.
11242 (defun gnus-read-header (id &optional header)
11243 "Read the headers of article ID and enter them into the Gnus system."
11244 (let ((group gnus-newsgroup-name)
11245 (gnus-override-method
11247 gnus-override-method
11248 (and (gnus-news-group-p gnus-newsgroup-name)
11249 (car (gnus-refer-article-methods)))))
11251 ;; First we check to see whether the header in question is already
11254 ;; This is a Message-ID.
11255 (setq header (or header (gnus-id-to-header id)))
11256 ;; This is an article number.
11257 (setq header (or header (gnus-summary-article-header id))))
11259 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11260 ;; We have found the header.
11262 ;; We have to really fetch the header to this article.
11264 (set-buffer nntp-server-buffer)
11265 (when (setq where (gnus-request-head id group))
11266 (nnheader-fold-continuation-lines)
11267 (goto-char (point-max))
11269 (goto-char (point-min))
11273 ((cdr where) (cdr where))
11274 (header (mail-header-number header))
11275 (t gnus-reffed-article-number))
11277 (insert " Article retrieved.\n"))
11278 (if (or (not where)
11279 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11280 () ; Malformed head.
11281 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11282 (when (and (stringp id)
11283 (not (string= (gnus-group-real-name group)
11285 ;; If we fetched by Message-ID and the article came
11286 ;; from a different group, we fudge some bogus article
11287 ;; numbers for this article.
11288 (mail-header-set-number header gnus-reffed-article-number))
11290 (set-buffer gnus-summary-buffer)
11291 (decf gnus-reffed-article-number)
11292 (gnus-remove-header (mail-header-number header))
11293 (push header gnus-newsgroup-headers)
11294 (setq gnus-current-headers header)
11295 (push (mail-header-number header) gnus-newsgroup-limit)))
11298 (defun gnus-remove-header (number)
11299 "Remove header NUMBER from `gnus-newsgroup-headers'."
11300 (if (and gnus-newsgroup-headers
11301 (= number (mail-header-number (car gnus-newsgroup-headers))))
11302 (pop gnus-newsgroup-headers)
11303 (let ((headers gnus-newsgroup-headers))
11304 (while (and (cdr headers)
11305 (not (= number (mail-header-number (cadr headers)))))
11307 (when (cdr headers)
11308 (setcdr headers (cddr headers))))))
11311 ;;; summary highlights
11314 (defun gnus-highlight-selected-summary ()
11315 "Highlight selected article in summary buffer."
11316 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11317 (when gnus-summary-selected-face
11319 (let* ((beg (point-at-bol))
11320 (end (point-at-eol))
11321 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11322 (from (if (get-text-property beg gnus-mouse-face-prop)
11324 (or (next-single-property-change
11325 beg gnus-mouse-face-prop nil end)
11330 (or (next-single-property-change
11331 from gnus-mouse-face-prop nil end)
11333 ;; If no mouse-face prop on line we will have to = from = end,
11334 ;; so we highlight the entire line instead.
11335 (when (= (+ to 2) from)
11338 (if gnus-newsgroup-selected-overlay
11339 ;; Move old overlay.
11341 gnus-newsgroup-selected-overlay from to (current-buffer))
11342 ;; Create new overlay.
11344 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11345 'face gnus-summary-selected-face))))))
11347 (defvar gnus-summary-highlight-line-cached nil)
11348 (defvar gnus-summary-highlight-line-trigger nil)
11350 (defun gnus-summary-highlight-line-0 ()
11351 (if (and (eq gnus-summary-highlight-line-trigger
11352 gnus-summary-highlight)
11353 gnus-summary-highlight-line-cached)
11354 gnus-summary-highlight-line-cached
11355 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11356 gnus-summary-highlight-line-cached
11357 (let* ((cond (list 'cond))
11359 (list gnus-summary-highlight))
11361 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11365 (gnus-byte-compile (list 'lambda nil cond))))))
11367 (defun gnus-summary-highlight-line ()
11368 "Highlight current line according to `gnus-summary-highlight'."
11369 (let* ((beg (point-at-bol))
11370 (article (or (gnus-summary-article-number) gnus-current-article))
11371 (score (or (cdr (assq article
11372 gnus-newsgroup-scored))
11373 gnus-summary-default-score 0))
11374 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11375 (inhibit-read-only t)
11376 (default gnus-summary-default-score)
11377 (default-high gnus-summary-default-high-score)
11378 (default-low gnus-summary-default-low-score)
11379 (uncached (and gnus-summary-use-undownloaded-faces
11380 (memq article gnus-newsgroup-undownloaded)
11381 (not (memq article gnus-newsgroup-cached)))))
11382 (let ((face (funcall (gnus-summary-highlight-line-0))))
11383 (unless (eq face (get-text-property beg 'face))
11384 (gnus-put-text-property-excluding-characters-with-faces
11385 beg (point-at-eol) 'face
11386 (setq face (if (boundp face) (symbol-value face) face)))
11387 (when gnus-summary-highlight-line-function
11388 (funcall gnus-summary-highlight-line-function article face))))))
11390 (defun gnus-update-read-articles (group unread &optional compute)
11391 "Update the list of read articles in GROUP.
11392 UNREAD is a sorted list."
11393 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11394 (info (gnus-get-info group))
11397 (if (or (not info) (not active))
11398 ;; There is no info on this group if it was, in fact,
11399 ;; killed. Gnus stores no information on killed groups, so
11400 ;; there's nothing to be done.
11401 ;; One could store the information somewhere temporarily,
11402 ;; perhaps... Hmmm...
11404 ;; Remove any negative articles numbers.
11405 (while (and unread (< (car unread) 0))
11406 (setq unread (cdr unread)))
11407 ;; Remove any expired article numbers
11408 (while (and unread (< (car unread) (car active)))
11409 (setq unread (cdr unread)))
11410 ;; Compute the ranges of read articles by looking at the list of
11411 ;; unread articles.
11413 (when (/= (car unread) prev)
11414 (push (if (= prev (1- (car unread))) prev
11415 (cons prev (1- (car unread))))
11417 (setq prev (1+ (car unread)))
11418 (setq unread (cdr unread)))
11419 (when (<= prev (cdr active))
11420 (push (cons prev (cdr active)) read))
11421 (setq read (if (> (length read) 1) (nreverse read) read))
11426 ;; Propagate the read marks to the backend.
11427 (when (gnus-check-backend-function 'request-set-mark group)
11428 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11429 (add (gnus-remove-from-range read (gnus-info-read info))))
11431 (unless (gnus-check-group group)
11432 (error "Can't open server for %s" group))
11433 (gnus-request-set-mark
11434 group (delq nil (list (if add (list add 'add '(read)))
11435 (if del (list del 'del '(read))))))
11437 `(gnus-request-set-mark
11440 (if del (list del 'add '(read)))
11441 (if add (list add 'del '(read))))))))))
11442 (set-buffer gnus-group-buffer)
11443 (gnus-undo-register
11445 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11446 (gnus-info-set-read ',info ',(gnus-info-read info))
11447 (gnus-get-unread-articles-in-group ',info
11448 (gnus-active ,group))
11449 (gnus-group-update-group ,group t)
11451 ;; Enter this list into the group info.
11452 (gnus-info-set-read info read)
11453 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11454 (gnus-get-unread-articles-in-group info (gnus-active group))
11457 (defun gnus-offer-save-summaries ()
11458 "Offer to save all active summary buffers."
11460 ;; Go through all buffers and find all summaries.
11461 (dolist (buffer (buffer-list))
11462 (when (and (setq buffer (buffer-name buffer))
11463 (string-match "Summary" buffer)
11464 (with-current-buffer buffer
11465 ;; We check that this is, indeed, a summary buffer.
11466 (and (eq major-mode 'gnus-summary-mode)
11467 ;; Also make sure this isn't bogus.
11468 gnus-newsgroup-prepared
11469 ;; Also make sure that this isn't a
11470 ;; dead summary buffer.
11471 (not gnus-dead-summary-mode))))
11472 (push buffer buffers)))
11473 ;; Go through all these summary buffers and offer to save them.
11477 "Update summary buffer %s? "
11479 (switch-to-buffer buf)
11480 (gnus-summary-exit))
11483 (defun gnus-summary-setup-default-charset ()
11484 "Setup newsgroup default charset."
11485 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11486 (setq gnus-newsgroup-charset nil)
11487 (let* ((ignored-charsets
11488 (or gnus-newsgroup-ephemeral-ignored-charsets
11490 (and gnus-newsgroup-name
11491 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11492 gnus-newsgroup-ignored-charsets))))
11493 (setq gnus-newsgroup-charset
11494 (or gnus-newsgroup-ephemeral-charset
11495 (and gnus-newsgroup-name
11496 (gnus-parameter-charset gnus-newsgroup-name))
11497 gnus-default-charset))
11498 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11499 ignored-charsets))))
11505 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11506 "Display the current article buffer fully MIME-buttonized.
11507 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11508 treated as multipart/mixed."
11510 (require 'gnus-art)
11511 (let ((gnus-unbuttonized-mime-types nil)
11512 (gnus-mime-display-multipart-as-mixed show-all-parts))
11513 (gnus-summary-show-article)))
11515 (defun gnus-summary-repair-multipart (article)
11516 "Add a Content-Type header to a multipart article without one."
11517 (interactive (list (gnus-summary-article-number)))
11518 (gnus-with-article article
11519 (message-narrow-to-head)
11520 (message-remove-header "Mime-Version")
11521 (goto-char (point-max))
11522 (insert "Mime-Version: 1.0\n")
11524 (when (search-forward "\n--" nil t)
11525 (let ((separator (buffer-substring (point) (point-at-eol))))
11526 (message-narrow-to-head)
11527 (message-remove-header "Content-Type")
11528 (goto-char (point-max))
11529 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11532 (let (gnus-mark-article-hook)
11533 (gnus-summary-select-article t t nil article)))
11535 (defun gnus-summary-toggle-display-buttonized ()
11536 "Toggle the buttonizing of the article buffer."
11538 (require 'gnus-art)
11539 (if (setq gnus-inhibit-mime-unbuttonizing
11540 (not gnus-inhibit-mime-unbuttonizing))
11541 (let ((gnus-unbuttonized-mime-types nil))
11542 (gnus-summary-show-article))
11543 (gnus-summary-show-article)))
11546 ;;; Generic summary marking commands
11549 (defvar gnus-summary-marking-alist
11550 '((read gnus-del-mark "d")
11551 (unread gnus-unread-mark "u")
11552 (ticked gnus-ticked-mark "!")
11553 (dormant gnus-dormant-mark "?")
11554 (expirable gnus-expirable-mark "e"))
11555 "An alist of names/marks/keystrokes.")
11557 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11558 (defvar gnus-summary-mark-map)
11560 (defun gnus-summary-make-all-marking-commands ()
11561 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11562 (dolist (elem gnus-summary-marking-alist)
11563 (apply 'gnus-summary-make-marking-command elem)))
11565 (defun gnus-summary-make-marking-command (name mark keystroke)
11566 (let ((map (make-sparse-keymap)))
11567 (define-key gnus-summary-generic-mark-map keystroke map)
11568 (dolist (lway `((next "next" next nil "n")
11569 (next-unread "next unread" next t "N")
11570 (prev "previous" prev nil "p")
11571 (prev-unread "previous unread" prev t "P")
11572 (nomove "" nil nil ,keystroke)))
11573 (let ((func (gnus-summary-make-marking-command-1
11574 mark (car lway) lway name)))
11575 (setq func (eval func))
11576 (define-key map (nth 4 lway) func)))))
11578 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11580 (format "gnus-summary-put-mark-as-%s%s"
11581 name (if (eq way 'nomove)
11583 (concat "-" (symbol-name way)))))
11586 "Mark the current article as %s%s.
11587 If N, the prefix, then repeat N times.
11588 If N is negative, move in reverse order.
11589 The difference between N and the actual number of articles marked is
11593 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
11595 (defun gnus-summary-generic-mark (n mark move unread)
11596 "Mark N articles with MARK."
11597 (unless (eq major-mode 'gnus-summary-mode)
11598 (error "This command can only be used in the summary buffer"))
11599 (gnus-summary-show-thread)
11602 ((eq move 'next) 1)
11603 ((eq move 'prev) -1)
11605 (if (zerop nummove)
11609 nummove (* -1 nummove))))
11610 (while (and (> n 0)
11611 (gnus-summary-mark-article nil mark)
11612 (zerop (gnus-summary-next-subject nummove unread t)))
11615 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
11616 (gnus-summary-recenter)
11617 (gnus-summary-position-point)
11618 (gnus-set-mode-line 'summary)
11621 (defun gnus-summary-insert-articles (articles)
11622 (when (setq articles
11623 (gnus-sorted-difference articles
11624 (mapcar (lambda (h)
11625 (mail-header-number h))
11626 gnus-newsgroup-headers)))
11627 (setq gnus-newsgroup-headers
11629 gnus-newsgroup-headers
11630 (gnus-fetch-headers articles)
11631 'gnus-article-sort-by-number))
11632 ;; Suppress duplicates?
11633 (when gnus-suppress-duplicates
11634 (gnus-dup-suppress-articles))
11636 ;; We might want to build some more threads first.
11637 (when (and gnus-fetch-old-headers
11638 (eq gnus-headers-retrieved-by 'nov))
11639 (if (eq gnus-fetch-old-headers 'invisible)
11640 (gnus-build-all-threads)
11641 (gnus-build-old-threads)))
11642 ;; Let the Gnus agent mark articles as read.
11644 (gnus-agent-get-undownloaded-list))
11645 ;; Remove list identifiers from subject
11646 (when gnus-list-identifiers
11647 (gnus-summary-remove-list-identifiers))
11648 ;; First and last article in this newsgroup.
11649 (when gnus-newsgroup-headers
11650 (setq gnus-newsgroup-begin
11651 (mail-header-number (car gnus-newsgroup-headers))
11653 (mail-header-number
11654 (gnus-last-element gnus-newsgroup-headers))))
11655 (when gnus-use-scoring
11656 (gnus-possibly-score-headers))))
11658 (defun gnus-summary-insert-old-articles (&optional all)
11659 "Insert all old articles in this group.
11660 If ALL is non-nil, already read articles become readable.
11661 If ALL is a number, fetch this number of articles."
11664 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11667 ;; Some nntp servers lie about their active range. When
11668 ;; this happens, the active range can be in the millions.
11669 ;; Use a compressed range to avoid creating a huge list.
11670 (gnus-range-difference (list gnus-newsgroup-active) old))
11671 (setq len (gnus-range-length older))
11676 (let ((older-range (nreverse older)))
11680 (let* ((r (pop older-range))
11681 (min (if (numberp r) r (car r)))
11682 (max (if (numberp r) r (cdr r))))
11683 (while (and (<= min max)
11688 (setq older (gnus-uncompress-range older))))
11690 (setq older (gnus-uncompress-range older)))
11692 (when (and (numberp gnus-large-newsgroup)
11693 (> len gnus-large-newsgroup))
11694 (let* ((cursor-in-echo-area nil)
11695 (initial (gnus-parameter-large-newsgroup-initial
11696 gnus-newsgroup-name))
11700 "How many articles from %s (%s %d): "
11702 (gnus-group-decoded-name gnus-newsgroup-name) 35)
11703 (if initial "max" "default")
11706 (cons (number-to-string initial)
11708 (unless (string-match "^[ \t]*$" input)
11709 (setq all (string-to-number input))
11711 (let ((older-range (nreverse older)))
11715 (let* ((r (pop older-range))
11716 (min (if (numberp r) r (car r)))
11717 (max (if (numberp r) r (cdr r))))
11718 (while (and (<= min max)
11722 max (1- max))))))))))
11723 (setq older (gnus-uncompress-range older))))
11725 (message "No old news.")
11726 (gnus-summary-insert-articles older)
11727 (gnus-summary-limit (gnus-sorted-nunion old older))))
11728 (gnus-summary-position-point)))
11730 (defun gnus-summary-insert-new-articles ()
11731 "Insert all new articles in this group."
11734 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
11735 (old-active gnus-newsgroup-active)
11736 (nnmail-fetched-sources (list t))
11738 (setq gnus-newsgroup-active
11739 (gnus-activate-group gnus-newsgroup-name 'scan))
11740 (setq i (cdr gnus-newsgroup-active))
11741 (while (> i (cdr old-active))
11745 (message "No gnus is bad news")
11746 (gnus-summary-insert-articles new)
11747 (setq gnus-newsgroup-unreads
11748 (gnus-sorted-nunion gnus-newsgroup-unreads new))
11749 (gnus-summary-limit (gnus-sorted-nunion old new))))
11750 (gnus-summary-position-point)))
11752 (gnus-summary-make-all-marking-commands)
11754 (gnus-ems-redefine)
11756 (provide 'gnus-sum)
11758 (run-hooks 'gnus-sum-load-hook)
11760 ;; Local Variables:
11761 ;; coding: iso-8859-1
11764 ;;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
11765 ;;; gnus-sum.el ends here