1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
28 (eval-when-compile (require 'cl))
38 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
40 (defcustom gnus-kill-summary-on-exit t
41 "*If non-nil, kill the summary buffer when you exit from it.
42 If nil, the summary will become a \"*Dead Summary*\" buffer, and
43 it will be killed sometime later."
44 :group 'gnus-summary-exit
47 (defcustom gnus-fetch-old-headers nil
48 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
49 If an unread article in the group refers to an older, already read (or
50 just marked as read) article, the old article will not normally be
51 displayed in the Summary buffer. If this variable is non-nil, Gnus
52 will attempt to grab the headers to the old articles, and thereby
53 build complete threads. If it has the value `some', only enough
54 headers to connect otherwise loose threads will be displayed. This
55 variable can also be a number. In that case, no more than that number
56 of old headers will be fetched. If it has the value `invisible', all
57 old headers will be fetched, but none will be displayed.
59 The server has to support NOV for any of this to work."
61 :type '(choice (const :tag "off" nil)
64 (sexp :menu-tag "other" t)))
66 (defcustom gnus-refer-thread-limit 200
67 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
68 If t, fetch all the available old headers."
71 (sexp :menu-tag "other" t)))
73 (defcustom gnus-summary-make-false-root 'adopt
74 "*nil means that Gnus won't gather loose threads.
75 If the root of a thread has expired or been read in a previous
76 session, the information necessary to build a complete thread has been
77 lost. Instead of having many small sub-threads from this original thread
78 scattered all over the summary buffer, Gnus can gather them.
80 If non-nil, Gnus will try to gather all loose sub-threads from an
81 original thread into one large thread.
83 If this variable is non-nil, it should be one of `none', `adopt',
86 If this variable is `none', Gnus will not make a false root, but just
87 present the sub-threads after another.
88 If this variable is `dummy', Gnus will create a dummy root that will
89 have all the sub-threads as children.
90 If this variable is `adopt', Gnus will make one of the \"children\"
91 the parent and mark all the step-children as such.
92 If this variable is `empty', the \"children\" are printed with empty
93 subject fields. (Or rather, they will be printed with a string
94 given by the `gnus-summary-same-subject' variable.)"
96 :type '(choice (const :tag "off" nil)
102 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
103 "*A regexp to match subjects to be excluded from loose thread gathering.
104 As loose thread gathering is done on subjects only, that means that
105 there can be many false gatherings performed. By rooting out certain
106 common subjects, gathering might become saner."
110 (defcustom gnus-summary-gather-subject-limit nil
111 "*Maximum length of subject comparisons when gathering loose threads.
112 Use nil to compare full subjects. Setting this variable to a low
113 number will help gather threads that have been corrupted by
114 newsreaders chopping off subject lines, but it might also mean that
115 unrelated articles that have subject that happen to begin with the
116 same few characters will be incorrectly gathered.
118 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
121 :type '(choice (const :tag "off" nil)
123 (sexp :menu-tag "on" t)))
125 (defcustom gnus-simplify-subject-functions nil
126 "List of functions taking a string argument that simplify subjects.
127 The functions are applied recursively.
129 Useful functions to put in this list include: `gnus-simplify-subject-re',
130 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
132 :type '(repeat function))
134 (defcustom gnus-simplify-ignored-prefixes nil
135 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
137 :type '(choice (const :tag "off" nil)
140 (defcustom gnus-build-sparse-threads nil
141 "*If non-nil, fill in the gaps in threads.
142 If `some', only fill in the gaps that are needed to tie loose threads
143 together. If `more', fill in all leaf nodes that Gnus can find. If
144 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
146 :type '(choice (const :tag "off" nil)
149 (sexp :menu-tag "all" t)))
151 (defcustom gnus-summary-thread-gathering-function
152 'gnus-gather-threads-by-subject
153 "*Function used for gathering loose threads.
154 There are two pre-defined functions: `gnus-gather-threads-by-subject',
155 which only takes Subjects into consideration; and
156 `gnus-gather-threads-by-references', which compared the References
157 headers of the articles to find matches."
159 :type '(radio (function-item gnus-gather-threads-by-subject)
160 (function-item gnus-gather-threads-by-references)
161 (function :tag "other")))
163 (defcustom gnus-summary-same-subject ""
164 "*String indicating that the current article has the same subject as the previous.
165 This variable will only be used if the value of
166 `gnus-summary-make-false-root' is `empty'."
167 :group 'gnus-summary-format
170 (defcustom gnus-summary-goto-unread t
171 "*If t, marking commands will go to the next unread article.
172 If `never', commands that usually go to the next unread article, will
173 go to the next article, whether it is read or not.
174 If nil, only the marking commands will go to the next (un)read article."
175 :group 'gnus-summary-marks
176 :link '(custom-manual "(gnus)Setting Marks")
177 :type '(choice (const :tag "off" nil)
179 (sexp :menu-tag "on" t)))
181 (defcustom gnus-summary-default-score 0
182 "*Default article score level.
183 All scores generated by the score files will be added to this score.
184 If this variable is nil, scoring will be disabled."
185 :group 'gnus-score-default
186 :type '(choice (const :tag "disable")
189 (defcustom gnus-summary-zcore-fuzz 0
190 "*Fuzziness factor for the zcore in the summary buffer.
191 Articles with scores closer than this to `gnus-summary-default-score'
193 :group 'gnus-summary-format
196 (defcustom gnus-simplify-subject-fuzzy-regexp nil
197 "*Strings to be removed when doing fuzzy matches.
198 This can either be a regular expression or list of regular expressions
199 that will be removed from subject strings if fuzzy subject
200 simplification is selected."
202 :type '(repeat regexp))
204 (defcustom gnus-show-threads t
205 "*If non-nil, display threads in summary mode."
209 (defcustom gnus-thread-hide-subtree nil
210 "*If non-nil, hide all threads initially.
211 If threads are hidden, you have to run the command
212 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
213 to expose hidden threads."
217 (defcustom gnus-thread-hide-killed t
218 "*If non-nil, hide killed threads automatically."
222 (defcustom gnus-thread-ignore-subject t
223 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
224 If nil, articles that have different subjects from their parents will
225 start separate threads."
229 (defcustom gnus-thread-operation-ignore-subject t
230 "*If non-nil, subjects will be ignored when doing thread commands.
231 This affects commands like `gnus-summary-kill-thread' and
232 `gnus-summary-lower-thread'.
234 If this variable is nil, articles in the same thread with different
235 subjects will not be included in the operation in question. If this
236 variable is `fuzzy', only articles that have subjects that are fuzzily
237 equal will be included."
239 :type '(choice (const :tag "off" nil)
243 (defcustom gnus-thread-indent-level 4
244 "*Number that says how much each sub-thread should be indented."
248 (defcustom gnus-auto-extend-newsgroup t
249 "*If non-nil, extend newsgroup forward and backward when requested."
250 :group 'gnus-summary-choose
253 (defcustom gnus-auto-select-first t
254 "*If nil, don't select the first unread article when entering a group.
255 If this variable is `best', select the highest-scored unread article
256 in the group. If t, select the first unread article.
258 This variable can also be a function to place point on a likely
259 subject line. Useful values include `gnus-summary-first-unread-subject',
260 `gnus-summary-first-unread-article' and
261 `gnus-summary-best-unread-article'.
263 If you want to prevent automatic selection of the first unread article
264 in some newsgroups, set the variable to nil in
265 `gnus-select-group-hook'."
266 :group 'gnus-group-select
267 :type '(choice (const :tag "none" nil)
269 (sexp :menu-tag "first" t)
270 (function-item gnus-summary-first-unread-subject)
271 (function-item gnus-summary-first-unread-article)
272 (function-item gnus-summary-best-unread-article)))
274 (defcustom gnus-auto-select-next t
275 "*If non-nil, offer to go to the next group from the end of the previous.
276 If the value is t and the next newsgroup is empty, Gnus will exit
277 summary mode and go back to group mode. If the value is neither nil
278 nor t, Gnus will select the following unread newsgroup. In
279 particular, if the value is the symbol `quietly', the next unread
280 newsgroup will be selected without any confirmation, and if it is
281 `almost-quietly', the next group will be selected without any
282 confirmation if you are located on the last article in the group.
283 Finally, if this variable is `slightly-quietly', the `Z n' command
284 will go to the next group without confirmation."
285 :group 'gnus-summary-maneuvering
286 :type '(choice (const :tag "off" nil)
288 (const almost-quietly)
289 (const slightly-quietly)
290 (sexp :menu-tag "on" t)))
292 (defcustom gnus-auto-select-same nil
293 "*If non-nil, select the next article with the same subject.
294 If there are no more articles with the same subject, go to
295 the first unread article."
296 :group 'gnus-summary-maneuvering
299 (defcustom gnus-summary-check-current nil
300 "*If non-nil, consider the current article when moving.
301 The \"unread\" movement commands will stay on the same line if the
302 current article is unread."
303 :group 'gnus-summary-maneuvering
306 (defcustom gnus-auto-center-summary t
307 "*If non-nil, always center the current summary buffer.
308 In particular, if `vertical' do only vertical recentering. If non-nil
309 and non-`vertical', do both horizontal and vertical recentering."
310 :group 'gnus-summary-maneuvering
311 :type '(choice (const :tag "none" nil)
313 (integer :tag "height")
314 (sexp :menu-tag "both" t)))
316 (defcustom gnus-show-all-headers nil
317 "*If non-nil, don't hide any headers."
318 :group 'gnus-article-hiding
319 :group 'gnus-article-headers
322 (defcustom gnus-summary-ignore-duplicates nil
323 "*If non-nil, ignore articles with identical Message-ID headers."
327 (defcustom gnus-single-article-buffer t
328 "*If non-nil, display all articles in the same buffer.
329 If nil, each group will get its own article buffer."
330 :group 'gnus-article-various
333 (defcustom gnus-break-pages t
334 "*If non-nil, do page breaking on articles.
335 The page delimiter is specified by the `gnus-page-delimiter'
337 :group 'gnus-article-various
340 (defcustom gnus-move-split-methods nil
341 "*Variable used to suggest where articles are to be moved to.
342 It uses the same syntax as the `gnus-split-methods' variable."
343 :group 'gnus-summary-mail
344 :type '(repeat (choice (list :value (fun) function)
345 (cons :value ("" "") regexp (repeat string))
348 (defcustom gnus-unread-mark ? ;Whitespace
349 "*Mark used for unread articles."
350 :group 'gnus-summary-marks
353 (defcustom gnus-ticked-mark ?!
354 "*Mark used for ticked articles."
355 :group 'gnus-summary-marks
358 (defcustom gnus-dormant-mark ??
359 "*Mark used for dormant articles."
360 :group 'gnus-summary-marks
363 (defcustom gnus-del-mark ?r
364 "*Mark used for del'd articles."
365 :group 'gnus-summary-marks
368 (defcustom gnus-read-mark ?R
369 "*Mark used for read articles."
370 :group 'gnus-summary-marks
373 (defcustom gnus-expirable-mark ?E
374 "*Mark used for expirable articles."
375 :group 'gnus-summary-marks
378 (defcustom gnus-killed-mark ?K
379 "*Mark used for killed articles."
380 :group 'gnus-summary-marks
383 (defcustom gnus-souped-mark ?F
384 "*Mark used for killed articles."
385 :group 'gnus-summary-marks
388 (defcustom gnus-kill-file-mark ?X
389 "*Mark used for articles killed by kill files."
390 :group 'gnus-summary-marks
393 (defcustom gnus-low-score-mark ?Y
394 "*Mark used for articles with a low score."
395 :group 'gnus-summary-marks
398 (defcustom gnus-catchup-mark ?C
399 "*Mark used for articles that are caught up."
400 :group 'gnus-summary-marks
403 (defcustom gnus-replied-mark ?A
404 "*Mark used for articles that have been replied to."
405 :group 'gnus-summary-marks
408 (defcustom gnus-cached-mark ?*
409 "*Mark used for articles that are in the cache."
410 :group 'gnus-summary-marks
413 (defcustom gnus-saved-mark ?S
414 "*Mark used for articles that have been saved to."
415 :group 'gnus-summary-marks
418 (defcustom gnus-ancient-mark ?O
419 "*Mark used for ancient articles."
420 :group 'gnus-summary-marks
423 (defcustom gnus-sparse-mark ?Q
424 "*Mark used for sparsely reffed articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-canceled-mark ?G
429 "*Mark used for canceled articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-duplicate-mark ?M
434 "*Mark used for duplicate articles."
435 :group 'gnus-summary-marks
438 (defcustom gnus-undownloaded-mark ?@
439 "*Mark used for articles that weren't downloaded."
440 :group 'gnus-summary-marks
443 (defcustom gnus-downloadable-mark ?%
444 "*Mark used for articles that are to be downloaded."
445 :group 'gnus-summary-marks
448 (defcustom gnus-unsendable-mark ?=
449 "*Mark used for articles that won't be sent."
450 :group 'gnus-summary-marks
453 (defcustom gnus-score-over-mark ?+
454 "*Score mark used for articles with high scores."
455 :group 'gnus-summary-marks
458 (defcustom gnus-score-below-mark ?-
459 "*Score mark used for articles with low scores."
460 :group 'gnus-summary-marks
463 (defcustom gnus-empty-thread-mark ? ;Whitespace
464 "*There is no thread under the article."
465 :group 'gnus-summary-marks
468 (defcustom gnus-not-empty-thread-mark ?=
469 "*There is a thread under the article."
470 :group 'gnus-summary-marks
473 (defcustom gnus-view-pseudo-asynchronously nil
474 "*If non-nil, Gnus will view pseudo-articles asynchronously."
475 :group 'gnus-extract-view
478 (defcustom gnus-auto-expirable-marks
479 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
480 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
481 gnus-souped-mark gnus-duplicate-mark)
482 "*The list of marks converted into expiration if a group is auto-expirable."
484 :type '(repeat character))
486 (defcustom gnus-inhibit-user-auto-expire t
487 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
491 (defcustom gnus-view-pseudos nil
492 "*If `automatic', pseudo-articles will be viewed automatically.
493 If `not-confirm', pseudos will be viewed automatically, and the user
494 will not be asked to confirm the command."
495 :group 'gnus-extract-view
496 :type '(choice (const :tag "off" nil)
498 (const not-confirm)))
500 (defcustom gnus-view-pseudos-separately t
501 "*If non-nil, one pseudo-article will be created for each file to be viewed.
502 If nil, all files that use the same viewing command will be given as a
503 list of parameters to that command."
504 :group 'gnus-extract-view
507 (defcustom gnus-insert-pseudo-articles t
508 "*If non-nil, insert pseudo-articles when decoding articles."
509 :group 'gnus-extract-view
512 (defcustom gnus-summary-dummy-line-format
514 "*The format specification for the dummy roots in the summary buffer.
515 It works along the same lines as a normal formatting string,
516 with some simple extensions.
519 :group 'gnus-threading
522 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
523 "*The format specification for the summary mode line.
524 It works along the same lines as a normal formatting string,
525 with some simple extensions:
528 %p Unprefixed group name
529 %A Current article number
530 %z Current article score
532 %U Number of unread articles in the group
533 %e Number of unselected articles in the group
534 %Z A string with unread/unselected article counts
535 %g Shortish group name
536 %S Subject of the current article
538 %s Current score file name
539 %d Number of dormant articles
540 %r Number of articles that have been marked as read in this session
541 %E Number of articles expunged by the score files"
542 :group 'gnus-summary-format
545 (defcustom gnus-summary-mark-below 0
546 "*Mark all articles with a score below this variable as read.
547 This variable is local to each summary buffer and usually set by the
549 :group 'gnus-score-default
552 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
553 "*List of functions used for sorting articles in the summary buffer.
554 This variable is only used when not using a threaded display."
555 :group 'gnus-summary-sort
556 :type '(repeat (choice (function-item gnus-article-sort-by-number)
557 (function-item gnus-article-sort-by-author)
558 (function-item gnus-article-sort-by-subject)
559 (function-item gnus-article-sort-by-date)
560 (function-item gnus-article-sort-by-score)
561 (function :tag "other"))))
563 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
564 "*List of functions used for sorting threads in the summary buffer.
565 By default, threads are sorted by article number.
567 Each function takes two threads and return non-nil if the first thread
568 should be sorted before the other. If you use more than one function,
569 the primary sort function should be the last. You should probably
570 always include `gnus-thread-sort-by-number' in the list of sorting
571 functions -- preferably first.
573 Ready-made functions include `gnus-thread-sort-by-number',
574 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
575 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
576 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
577 :group 'gnus-summary-sort
578 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
579 (function-item gnus-thread-sort-by-author)
580 (function-item gnus-thread-sort-by-subject)
581 (function-item gnus-thread-sort-by-date)
582 (function-item gnus-thread-sort-by-score)
583 (function-item gnus-thread-sort-by-total-score)
584 (function :tag "other"))))
586 (defcustom gnus-thread-score-function '+
587 "*Function used for calculating the total score of a thread.
589 The function is called with the scores of the article and each
590 subthread and should then return the score of the thread.
592 Some functions you can use are `+', `max', or `min'."
593 :group 'gnus-summary-sort
596 (defcustom gnus-summary-expunge-below nil
597 "All articles that have a score less than this variable will be expunged.
598 This variable is local to the summary buffers."
599 :group 'gnus-score-default
600 :type '(choice (const :tag "off" nil)
603 (defcustom gnus-thread-expunge-below nil
604 "All threads that have a total score less than this variable will be expunged.
605 See `gnus-thread-score-function' for en explanation of what a
608 This variable is local to the summary buffers."
609 :group 'gnus-threading
610 :group 'gnus-score-default
611 :type '(choice (const :tag "off" nil)
614 (defcustom gnus-summary-mode-hook nil
615 "*A hook for Gnus summary mode.
616 This hook is run before any variables are set in the summary buffer."
617 :group 'gnus-summary-various
620 (defcustom gnus-summary-menu-hook nil
621 "*Hook run after the creation of the summary mode menu."
622 :group 'gnus-summary-visual
625 (defcustom gnus-summary-exit-hook nil
626 "*A hook called on exit from the summary buffer.
627 It will be called with point in the group buffer."
628 :group 'gnus-summary-exit
631 (defcustom gnus-summary-prepare-hook nil
632 "*A hook called after the summary buffer has been generated.
633 If you want to modify the summary buffer, you can use this hook."
634 :group 'gnus-summary-various
637 (defcustom gnus-summary-prepared-hook nil
638 "*A hook called as the last thing after the summary buffer has been generated."
639 :group 'gnus-summary-various
642 (defcustom gnus-summary-generate-hook nil
643 "*A hook run just before generating the summary buffer.
644 This hook is commonly used to customize threading variables and the
646 :group 'gnus-summary-various
649 (defcustom gnus-select-group-hook nil
650 "*A hook called when a newsgroup is selected.
652 If you'd like to simplify subjects like the
653 `gnus-summary-next-same-subject' command does, you can use the
656 (setq gnus-select-group-hook
659 (mapcar (lambda (header)
660 (mail-header-set-subject
662 (gnus-simplify-subject
663 (mail-header-subject header) 're-only)))
664 gnus-newsgroup-headers))))"
665 :group 'gnus-group-select
668 (defcustom gnus-select-article-hook nil
669 "*A hook called when an article is selected."
670 :group 'gnus-summary-choose
673 (defcustom gnus-visual-mark-article-hook
674 (list 'gnus-highlight-selected-summary)
675 "*Hook run after selecting an article in the summary buffer.
676 It is meant to be used for highlighting the article in some way. It
677 is not run if `gnus-visual' is nil."
678 :group 'gnus-summary-visual
681 (defcustom gnus-parse-headers-hook nil
682 "*A hook called before parsing the headers."
686 (defcustom gnus-exit-group-hook nil
687 "*A hook called when exiting (not quitting) summary mode."
691 (defcustom gnus-summary-update-hook
692 (list 'gnus-summary-highlight-line)
693 "*A hook called when a summary line is changed.
694 The hook will not be called if `gnus-visual' is nil.
696 The default function `gnus-summary-highlight-line' will
697 highlight the line according to the `gnus-summary-highlight'
699 :group 'gnus-summary-visual
702 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
703 "*A hook called when an article is selected for the first time.
704 The hook is intended to mark an article as read (or unread)
705 automatically when it is selected."
706 :group 'gnus-summary-choose
709 (defcustom gnus-group-no-more-groups-hook nil
710 "*A hook run when returning to group mode having no more (unread) groups."
711 :group 'gnus-group-select
714 (defcustom gnus-ps-print-hook nil
715 "*A hook run before ps-printing something from Gnus."
719 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
720 "Face used for highlighting the current article in the summary buffer."
721 :group 'gnus-summary-visual
724 (defcustom gnus-summary-highlight
725 '(((= mark gnus-canceled-mark)
726 . gnus-summary-cancelled-face)
727 ((and (> score default)
728 (or (= mark gnus-dormant-mark)
729 (= mark gnus-ticked-mark)))
730 . gnus-summary-high-ticked-face)
731 ((and (< score default)
732 (or (= mark gnus-dormant-mark)
733 (= mark gnus-ticked-mark)))
734 . gnus-summary-low-ticked-face)
735 ((or (= mark gnus-dormant-mark)
736 (= mark gnus-ticked-mark))
737 . gnus-summary-normal-ticked-face)
738 ((and (> score default) (= mark gnus-ancient-mark))
739 . gnus-summary-high-ancient-face)
740 ((and (< score default) (= mark gnus-ancient-mark))
741 . gnus-summary-low-ancient-face)
742 ((= mark gnus-ancient-mark)
743 . gnus-summary-normal-ancient-face)
744 ((and (> score default) (= mark gnus-unread-mark))
745 . gnus-summary-high-unread-face)
746 ((and (< score default) (= mark gnus-unread-mark))
747 . gnus-summary-low-unread-face)
748 ((= mark gnus-unread-mark)
749 . gnus-summary-normal-unread-face)
750 ((and (> score default) (memq mark (list gnus-downloadable-mark
751 gnus-undownloaded-mark)))
752 . gnus-summary-high-unread-face)
753 ((and (< score default) (memq mark (list gnus-downloadable-mark
754 gnus-undownloaded-mark)))
755 . gnus-summary-low-unread-face)
756 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
757 . gnus-summary-normal-unread-face)
759 . gnus-summary-high-read-face)
761 . gnus-summary-low-read-face)
763 . gnus-summary-normal-read-face))
764 "*Controls the highlighting of summary buffer lines.
766 A list of (FORM . FACE) pairs. When deciding how a a particular
767 summary line should be displayed, each form is evaluated. The content
768 of the face field after the first true form is used. You can change
769 how those summary lines are displayed, by editing the face field.
771 You can use the following variables in the FORM field.
773 score: The articles score
774 default: The default article score.
775 below: The score below which articles are automatically marked as read.
776 mark: The articles mark."
777 :group 'gnus-summary-visual
778 :type '(repeat (cons (sexp :tag "Form" nil)
781 (defcustom gnus-alter-header-function nil
782 "Function called to allow alteration of article header structures.
783 The function is called with one parameter, the article header vector,
784 which it may alter in any way.")
786 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
787 "Variable that says which function should be used to decode a string with encoded words.")
789 (defcustom gnus-extra-headers nil
790 "*Extra headers to parse."
792 :type '(repeat symbol))
794 (defcustom gnus-ignored-from-addresses
795 (and user-mail-address (regexp-quote user-mail-address))
796 "*Regexp of From headers that may be suppressed in favor of To headers."
800 (defcustom gnus-group-charset-alist
801 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
802 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
803 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
804 ("^relcom\\>" koi8-r)
805 ("^\\(cz\\|hun\\|pl\\|sk\\)\\>" iso-8859-2)
806 ("^israel\\>" iso-8859-1)
808 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
810 "Alist of regexps (to match group names) and default charsets to be used when reading."
811 :type '(repeat (list (regexp :tag "Group")
812 (symbol :tag "Charset")))
813 :group 'gnus-charset)
815 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit)
816 "List of charsets that should be ignored.
817 When these charsets are used in the \"charset\" parameter, the
818 default charset will be used instead."
819 :type '(repeat symbol)
820 :group 'gnus-charset)
822 ;;; Internal variables
824 (defvar gnus-article-mime-handles nil)
825 (defvar gnus-article-decoded-p nil)
826 (defvar gnus-scores-exclude-files nil)
827 (defvar gnus-page-broken nil)
828 (defvar gnus-inhibit-mime-unbuttonizing nil)
830 (defvar gnus-original-article nil)
831 (defvar gnus-article-internal-prepare-hook nil)
832 (defvar gnus-newsgroup-process-stack nil)
834 (defvar gnus-thread-indent-array nil)
835 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
837 ;; Avoid highlighting in kill files.
838 (defvar gnus-summary-inhibit-highlight nil)
839 (defvar gnus-newsgroup-selected-overlay nil)
840 (defvar gnus-inhibit-limiting nil)
841 (defvar gnus-newsgroup-adaptive-score-file nil)
842 (defvar gnus-current-score-file nil)
843 (defvar gnus-current-move-group nil)
844 (defvar gnus-current-copy-group nil)
845 (defvar gnus-current-crosspost-group nil)
847 (defvar gnus-newsgroup-dependencies nil)
848 (defvar gnus-newsgroup-adaptive nil)
849 (defvar gnus-summary-display-article-function nil)
850 (defvar gnus-summary-highlight-line-function nil
851 "Function called after highlighting a summary line.")
853 (defvar gnus-summary-line-format-alist
854 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
855 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
856 (?s gnus-tmp-subject-or-nil ?s)
857 (?n gnus-tmp-name ?s)
858 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
860 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
862 (?F gnus-tmp-from ?s)
863 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
864 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
865 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
866 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
867 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
868 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
869 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
870 (?L gnus-tmp-lines ?d)
871 (?I gnus-tmp-indentation ?s)
872 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
873 (?R gnus-tmp-replied ?c)
874 (?\[ gnus-tmp-opening-bracket ?c)
875 (?\] gnus-tmp-closing-bracket ?c)
876 (?\> (make-string gnus-tmp-level ? ) ?s)
877 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
878 (?i gnus-tmp-score ?d)
879 (?z gnus-tmp-score-char ?c)
880 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
881 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
882 (?U gnus-tmp-unread ?c)
883 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
884 (?t (gnus-summary-number-of-articles-in-thread
885 (and (boundp 'thread) (car thread)) gnus-tmp-level)
887 (?e (gnus-summary-number-of-articles-in-thread
888 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
890 (?u gnus-tmp-user-defined ?s)
891 (?P (gnus-pick-line-number) ?d))
892 "An alist of format specifications that can appear in summary lines,
893 and what variables they correspond with, along with the type of the
894 variable (string, integer, character, etc).")
896 (defvar gnus-summary-dummy-line-format-alist
897 `((?S gnus-tmp-subject ?s)
898 (?N gnus-tmp-number ?d)
899 (?u gnus-tmp-user-defined ?s)))
901 (defvar gnus-summary-mode-line-format-alist
902 `((?G gnus-tmp-group-name ?s)
903 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
904 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
905 (?A gnus-tmp-article-number ?d)
906 (?Z gnus-tmp-unread-and-unselected ?s)
908 (?U gnus-tmp-unread-and-unticked ?d)
909 (?S gnus-tmp-subject ?s)
910 (?e gnus-tmp-unselected ?d)
911 (?u gnus-tmp-user-defined ?s)
912 (?d (length gnus-newsgroup-dormant) ?d)
913 (?t (length gnus-newsgroup-marked) ?d)
914 (?r (length gnus-newsgroup-reads) ?d)
915 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
916 (?E gnus-newsgroup-expunged-tally ?d)
917 (?s (gnus-current-score-file-nondirectory) ?s)))
919 (defvar gnus-last-search-regexp nil
920 "Default regexp for article search command.")
922 (defvar gnus-last-shell-command nil
923 "Default shell command on article.")
925 (defvar gnus-newsgroup-begin nil)
926 (defvar gnus-newsgroup-end nil)
927 (defvar gnus-newsgroup-last-rmail nil)
928 (defvar gnus-newsgroup-last-mail nil)
929 (defvar gnus-newsgroup-last-folder nil)
930 (defvar gnus-newsgroup-last-file nil)
931 (defvar gnus-newsgroup-auto-expire nil)
932 (defvar gnus-newsgroup-active nil)
934 (defvar gnus-newsgroup-data nil)
935 (defvar gnus-newsgroup-data-reverse nil)
936 (defvar gnus-newsgroup-limit nil)
937 (defvar gnus-newsgroup-limits nil)
939 (defvar gnus-newsgroup-unreads nil
940 "List of unread articles in the current newsgroup.")
942 (defvar gnus-newsgroup-unselected nil
943 "List of unselected unread articles in the current newsgroup.")
945 (defvar gnus-newsgroup-reads nil
946 "Alist of read articles and article marks in the current newsgroup.")
948 (defvar gnus-newsgroup-expunged-tally nil)
950 (defvar gnus-newsgroup-marked nil
951 "List of ticked articles in the current newsgroup (a subset of unread art).")
953 (defvar gnus-newsgroup-killed nil
954 "List of ranges of articles that have been through the scoring process.")
956 (defvar gnus-newsgroup-cached nil
957 "List of articles that come from the article cache.")
959 (defvar gnus-newsgroup-saved nil
960 "List of articles that have been saved.")
962 (defvar gnus-newsgroup-kill-headers nil)
964 (defvar gnus-newsgroup-replied nil
965 "List of articles that have been replied to in the current newsgroup.")
967 (defvar gnus-newsgroup-expirable nil
968 "List of articles in the current newsgroup that can be expired.")
970 (defvar gnus-newsgroup-processable nil
971 "List of articles in the current newsgroup that can be processed.")
973 (defvar gnus-newsgroup-downloadable nil
974 "List of articles in the current newsgroup that can be processed.")
976 (defvar gnus-newsgroup-undownloaded nil
977 "List of articles in the current newsgroup that haven't been downloaded..")
979 (defvar gnus-newsgroup-unsendable nil
980 "List of articles in the current newsgroup that won't be sent.")
982 (defvar gnus-newsgroup-bookmarks nil
983 "List of articles in the current newsgroup that have bookmarks.")
985 (defvar gnus-newsgroup-dormant nil
986 "List of dormant articles in the current newsgroup.")
988 (defvar gnus-newsgroup-scored nil
989 "List of scored articles in the current newsgroup.")
991 (defvar gnus-newsgroup-headers nil
992 "List of article headers in the current newsgroup.")
994 (defvar gnus-newsgroup-threads nil)
996 (defvar gnus-newsgroup-prepared nil
997 "Whether the current group has been prepared properly.")
999 (defvar gnus-newsgroup-ancient nil
1000 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1002 (defvar gnus-newsgroup-sparse nil)
1004 (defvar gnus-current-article nil)
1005 (defvar gnus-article-current nil)
1006 (defvar gnus-current-headers nil)
1007 (defvar gnus-have-all-headers nil)
1008 (defvar gnus-last-article nil)
1009 (defvar gnus-newsgroup-history nil)
1010 (defvar gnus-newsgroup-charset nil)
1012 (defconst gnus-summary-local-variables
1013 '(gnus-newsgroup-name
1014 gnus-newsgroup-begin gnus-newsgroup-end
1015 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1016 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1017 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1018 gnus-newsgroup-unselected gnus-newsgroup-marked
1019 gnus-newsgroup-reads gnus-newsgroup-saved
1020 gnus-newsgroup-replied gnus-newsgroup-expirable
1021 gnus-newsgroup-processable gnus-newsgroup-killed
1022 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1023 gnus-newsgroup-unsendable
1024 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1025 gnus-newsgroup-headers gnus-newsgroup-threads
1026 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1027 gnus-current-article gnus-current-headers gnus-have-all-headers
1028 gnus-last-article gnus-article-internal-prepare-hook
1029 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1030 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1031 gnus-thread-expunge-below
1032 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1033 (gnus-summary-mark-below . global)
1034 gnus-newsgroup-active gnus-scores-exclude-files
1035 gnus-newsgroup-history gnus-newsgroup-ancient
1036 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1037 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1038 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1039 (gnus-newsgroup-expunged-tally . 0)
1040 gnus-cache-removable-articles gnus-newsgroup-cached
1041 gnus-newsgroup-data gnus-newsgroup-data-reverse
1042 gnus-newsgroup-limit gnus-newsgroup-limits
1043 gnus-newsgroup-charset)
1044 "Variables that are buffer-local to the summary buffers.")
1046 ;; Byte-compiler warning.
1047 (defvar gnus-article-mode-map)
1051 (defvar gnus-decode-encoded-word-methods
1052 '(mail-decode-encoded-word-string)
1053 "List of methods used to decode encoded words.
1055 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1056 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1057 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1058 whose names match REGEXP.
1061 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1062 mail-decode-encoded-word-string
1063 (\"chinese\" . rfc1843-decode-string))
1066 (defvar gnus-decode-encoded-word-methods-cache nil)
1068 (defun gnus-multi-decode-encoded-word-string (string)
1069 "Apply the functions from `gnus-encoded-word-methods' that match."
1070 (unless (and gnus-decode-encoded-word-methods-cache
1071 (eq gnus-newsgroup-name
1072 (car gnus-decode-encoded-word-methods-cache)))
1073 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1076 (nconc gnus-decode-encoded-word-methods-cache (list x))
1077 (if (and gnus-newsgroup-name
1078 (string-match (car x) gnus-newsgroup-name))
1079 (nconc gnus-decode-encoded-word-methods-cache
1081 gnus-decode-encoded-word-methods))
1082 (let ((xlist gnus-decode-encoded-word-methods-cache))
1085 (setq string (funcall (pop xlist) string))))
1088 ;; Subject simplification.
1090 (defun gnus-simplify-whitespace (str)
1091 "Remove excessive whitespace."
1094 (while (string-match "[ \t][ \t]+" mystr)
1095 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1097 (substring mystr (match-end 0)))))
1099 (when (string-match "^[ \t]+" mystr)
1100 (setq mystr (substring mystr (match-end 0))))
1102 (when (string-match "[ \t]+$" mystr)
1103 (setq mystr (substring mystr 0 (match-beginning 0))))
1106 (defsubst gnus-simplify-subject-re (subject)
1107 "Remove \"Re:\" from subject lines."
1108 (if (string-match "^[Rr][Ee]: *" subject)
1109 (substring subject (match-end 0))
1112 (defun gnus-simplify-subject (subject &optional re-only)
1113 "Remove `Re:' and words in parentheses.
1114 If RE-ONLY is non-nil, strip leading `Re:'s only."
1115 (let ((case-fold-search t)) ;Ignore case.
1116 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1117 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1118 (setq subject (substring subject (match-end 0))))
1119 ;; Remove uninteresting prefixes.
1120 (when (and (not re-only)
1121 gnus-simplify-ignored-prefixes
1122 (string-match gnus-simplify-ignored-prefixes subject))
1123 (setq subject (substring subject (match-end 0))))
1124 ;; Remove words in parentheses from end.
1126 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1127 (setq subject (substring subject 0 (match-beginning 0)))))
1128 ;; Return subject string.
1131 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1133 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1134 (goto-char (point-min))
1135 (while (re-search-forward regexp nil t)
1136 (replace-match (or newtext ""))))
1138 (defun gnus-simplify-buffer-fuzzy ()
1139 "Simplify string in the buffer fuzzily.
1140 The string in the accessible portion of the current buffer is simplified.
1141 It is assumed to be a single-line subject.
1142 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1143 matter is removed. Additional things can be deleted by setting
1144 gnus-simplify-subject-fuzzy-regexp."
1145 (let ((case-fold-search t)
1147 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1149 (while (not (eq modified-tick (buffer-modified-tick)))
1150 (setq modified-tick (buffer-modified-tick))
1152 ((listp gnus-simplify-subject-fuzzy-regexp)
1153 (mapcar 'gnus-simplify-buffer-fuzzy-step
1154 gnus-simplify-subject-fuzzy-regexp))
1155 (gnus-simplify-subject-fuzzy-regexp
1156 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1157 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1158 (gnus-simplify-buffer-fuzzy-step
1159 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1160 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1162 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1163 (gnus-simplify-buffer-fuzzy-step " +" " ")
1164 (gnus-simplify-buffer-fuzzy-step " $")
1165 (gnus-simplify-buffer-fuzzy-step "^ +")))
1167 (defun gnus-simplify-subject-fuzzy (subject)
1168 "Simplify a subject string fuzzily.
1169 See `gnus-simplify-buffer-fuzzy' for details."
1171 (gnus-set-work-buffer)
1172 (let ((case-fold-search t))
1173 ;; Remove uninteresting prefixes.
1174 (when (and gnus-simplify-ignored-prefixes
1175 (string-match gnus-simplify-ignored-prefixes subject))
1176 (setq subject (substring subject (match-end 0))))
1178 (inline (gnus-simplify-buffer-fuzzy))
1181 (defsubst gnus-simplify-subject-fully (subject)
1182 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1184 (gnus-simplify-subject-functions
1185 (gnus-map-function gnus-simplify-subject-functions subject))
1186 ((null gnus-summary-gather-subject-limit)
1187 (gnus-simplify-subject-re subject))
1188 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1189 (gnus-simplify-subject-fuzzy subject))
1190 ((numberp gnus-summary-gather-subject-limit)
1191 (gnus-limit-string (gnus-simplify-subject-re subject)
1192 gnus-summary-gather-subject-limit))
1196 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1197 "Check whether two subjects are equal.
1198 If optional argument simple-first is t, first argument is already
1201 ((null simple-first)
1202 (equal (gnus-simplify-subject-fully s1)
1203 (gnus-simplify-subject-fully s2)))
1206 (gnus-simplify-subject-fully s2)))))
1208 (defun gnus-summary-bubble-group ()
1209 "Increase the score of the current group.
1210 This is a handy function to add to `gnus-summary-exit-hook' to
1211 increase the score of each group you read."
1212 (gnus-group-add-score gnus-newsgroup-name))
1216 ;;; Gnus summary mode
1219 (put 'gnus-summary-mode 'mode-class 'special)
1222 ;; Non-orthogonal keys
1224 (gnus-define-keys gnus-summary-mode-map
1225 " " gnus-summary-next-page
1226 "\177" gnus-summary-prev-page
1227 [delete] gnus-summary-prev-page
1228 [backspace] gnus-summary-prev-page
1229 "\r" gnus-summary-scroll-up
1230 "\M-\r" gnus-summary-scroll-down
1231 "n" gnus-summary-next-unread-article
1232 "p" gnus-summary-prev-unread-article
1233 "N" gnus-summary-next-article
1234 "P" gnus-summary-prev-article
1235 "\M-\C-n" gnus-summary-next-same-subject
1236 "\M-\C-p" gnus-summary-prev-same-subject
1237 "\M-n" gnus-summary-next-unread-subject
1238 "\M-p" gnus-summary-prev-unread-subject
1239 "." gnus-summary-first-unread-article
1240 "," gnus-summary-best-unread-article
1241 "\M-s" gnus-summary-search-article-forward
1242 "\M-r" gnus-summary-search-article-backward
1243 "<" gnus-summary-beginning-of-article
1244 ">" gnus-summary-end-of-article
1245 "j" gnus-summary-goto-article
1246 "^" gnus-summary-refer-parent-article
1247 "\M-^" gnus-summary-refer-article
1248 "u" gnus-summary-tick-article-forward
1249 "!" gnus-summary-tick-article-forward
1250 "U" gnus-summary-tick-article-backward
1251 "d" gnus-summary-mark-as-read-forward
1252 "D" gnus-summary-mark-as-read-backward
1253 "E" gnus-summary-mark-as-expirable
1254 "\M-u" gnus-summary-clear-mark-forward
1255 "\M-U" gnus-summary-clear-mark-backward
1256 "k" gnus-summary-kill-same-subject-and-select
1257 "\C-k" gnus-summary-kill-same-subject
1258 "\M-\C-k" gnus-summary-kill-thread
1259 "\M-\C-l" gnus-summary-lower-thread
1260 "e" gnus-summary-edit-article
1261 "#" gnus-summary-mark-as-processable
1262 "\M-#" gnus-summary-unmark-as-processable
1263 "\M-\C-t" gnus-summary-toggle-threads
1264 "\M-\C-s" gnus-summary-show-thread
1265 "\M-\C-h" gnus-summary-hide-thread
1266 "\M-\C-f" gnus-summary-next-thread
1267 "\M-\C-b" gnus-summary-prev-thread
1268 "\M-\C-u" gnus-summary-up-thread
1269 "\M-\C-d" gnus-summary-down-thread
1270 "&" gnus-summary-execute-command
1271 "c" gnus-summary-catchup-and-exit
1272 "\C-w" gnus-summary-mark-region-as-read
1273 "\C-t" gnus-summary-toggle-truncation
1274 "?" gnus-summary-mark-as-dormant
1275 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1276 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1277 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1278 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1279 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1280 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1281 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1282 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1283 "=" gnus-summary-expand-window
1284 "\C-x\C-s" gnus-summary-reselect-current-group
1285 "\M-g" gnus-summary-rescan-group
1286 "w" gnus-summary-stop-page-breaking
1287 "\C-c\C-r" gnus-summary-caesar-message
1288 "f" gnus-summary-followup
1289 "F" gnus-summary-followup-with-original
1290 "C" gnus-summary-cancel-article
1291 "r" gnus-summary-reply
1292 "R" gnus-summary-reply-with-original
1293 "\C-c\C-f" gnus-summary-mail-forward
1294 "o" gnus-summary-save-article
1295 "\C-o" gnus-summary-save-article-mail
1296 "|" gnus-summary-pipe-output
1297 "\M-k" gnus-summary-edit-local-kill
1298 "\M-K" gnus-summary-edit-global-kill
1300 "\C-c\C-d" gnus-summary-describe-group
1301 "q" gnus-summary-exit
1302 "Q" gnus-summary-exit-no-update
1303 "\C-c\C-i" gnus-info-find-node
1304 gnus-mouse-2 gnus-mouse-pick-article
1305 "m" gnus-summary-mail-other-window
1306 "a" gnus-summary-post-news
1307 "x" gnus-summary-limit-to-unread
1308 "s" gnus-summary-isearch-article
1309 "t" gnus-summary-toggle-header
1310 "g" gnus-summary-show-article
1311 "l" gnus-summary-goto-last-article
1312 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1313 "\C-d" gnus-summary-enter-digest-group
1314 "\M-\C-d" gnus-summary-read-document
1315 "\M-\C-e" gnus-summary-edit-parameters
1316 "\M-\C-g" gnus-summary-customize-parameters
1318 "*" gnus-cache-enter-article
1319 "\M-*" gnus-cache-remove-article
1320 "\M-&" gnus-summary-universal-argument
1321 "\C-l" gnus-recenter
1322 "I" gnus-summary-increase-score
1323 "L" gnus-summary-lower-score
1324 "\M-i" gnus-symbolic-argument
1325 "h" gnus-summary-select-article-buffer
1327 "b" gnus-article-view-part
1328 "\M-t" gnus-summary-toggle-display-buttonized
1330 "V" gnus-summary-score-map
1331 "X" gnus-uu-extract-map
1332 "S" gnus-summary-send-map)
1334 ;; Sort of orthogonal keymap
1335 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1336 "t" gnus-summary-tick-article-forward
1337 "!" gnus-summary-tick-article-forward
1338 "d" gnus-summary-mark-as-read-forward
1339 "r" gnus-summary-mark-as-read-forward
1340 "c" gnus-summary-clear-mark-forward
1341 " " gnus-summary-clear-mark-forward
1342 "e" gnus-summary-mark-as-expirable
1343 "x" gnus-summary-mark-as-expirable
1344 "?" gnus-summary-mark-as-dormant
1345 "b" gnus-summary-set-bookmark
1346 "B" gnus-summary-remove-bookmark
1347 "#" gnus-summary-mark-as-processable
1348 "\M-#" gnus-summary-unmark-as-processable
1349 "S" gnus-summary-limit-include-expunged
1350 "C" gnus-summary-catchup
1351 "H" gnus-summary-catchup-to-here
1352 "\C-c" gnus-summary-catchup-all
1353 "k" gnus-summary-kill-same-subject-and-select
1354 "K" gnus-summary-kill-same-subject
1355 "P" gnus-uu-mark-map)
1357 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1358 "c" gnus-summary-clear-above
1359 "u" gnus-summary-tick-above
1360 "m" gnus-summary-mark-above
1361 "k" gnus-summary-kill-below)
1363 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1364 "/" gnus-summary-limit-to-subject
1365 "n" gnus-summary-limit-to-articles
1366 "w" gnus-summary-pop-limit
1367 "s" gnus-summary-limit-to-subject
1368 "a" gnus-summary-limit-to-author
1369 "u" gnus-summary-limit-to-unread
1370 "m" gnus-summary-limit-to-marks
1371 "M" gnus-summary-limit-exclude-marks
1372 "v" gnus-summary-limit-to-score
1373 "*" gnus-summary-limit-include-cached
1374 "D" gnus-summary-limit-include-dormant
1375 "T" gnus-summary-limit-include-thread
1376 "d" gnus-summary-limit-exclude-dormant
1377 "t" gnus-summary-limit-to-age
1378 "E" gnus-summary-limit-include-expunged
1379 "c" gnus-summary-limit-exclude-childless-dormant
1380 "C" gnus-summary-limit-mark-excluded-as-read)
1382 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1383 "n" gnus-summary-next-unread-article
1384 "p" gnus-summary-prev-unread-article
1385 "N" gnus-summary-next-article
1386 "P" gnus-summary-prev-article
1387 "\C-n" gnus-summary-next-same-subject
1388 "\C-p" gnus-summary-prev-same-subject
1389 "\M-n" gnus-summary-next-unread-subject
1390 "\M-p" gnus-summary-prev-unread-subject
1391 "f" gnus-summary-first-unread-article
1392 "b" gnus-summary-best-unread-article
1393 "j" gnus-summary-goto-article
1394 "g" gnus-summary-goto-subject
1395 "l" gnus-summary-goto-last-article
1396 "o" gnus-summary-pop-article)
1398 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1399 "k" gnus-summary-kill-thread
1400 "l" gnus-summary-lower-thread
1401 "i" gnus-summary-raise-thread
1402 "T" gnus-summary-toggle-threads
1403 "t" gnus-summary-rethread-current
1404 "^" gnus-summary-reparent-thread
1405 "s" gnus-summary-show-thread
1406 "S" gnus-summary-show-all-threads
1407 "h" gnus-summary-hide-thread
1408 "H" gnus-summary-hide-all-threads
1409 "n" gnus-summary-next-thread
1410 "p" gnus-summary-prev-thread
1411 "u" gnus-summary-up-thread
1412 "o" gnus-summary-top-thread
1413 "d" gnus-summary-down-thread
1414 "#" gnus-uu-mark-thread
1415 "\M-#" gnus-uu-unmark-thread)
1417 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1418 "g" gnus-summary-prepare
1419 "c" gnus-summary-insert-cached-articles)
1421 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1422 "c" gnus-summary-catchup-and-exit
1423 "C" gnus-summary-catchup-all-and-exit
1424 "E" gnus-summary-exit-no-update
1425 "Q" gnus-summary-exit
1426 "Z" gnus-summary-exit
1427 "n" gnus-summary-catchup-and-goto-next-group
1428 "R" gnus-summary-reselect-current-group
1429 "G" gnus-summary-rescan-group
1430 "N" gnus-summary-next-group
1431 "s" gnus-summary-save-newsrc
1432 "P" gnus-summary-prev-group)
1434 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1435 " " gnus-summary-next-page
1436 "n" gnus-summary-next-page
1437 "\177" gnus-summary-prev-page
1438 [delete] gnus-summary-prev-page
1439 "p" gnus-summary-prev-page
1440 "\r" gnus-summary-scroll-up
1441 "\M-\r" gnus-summary-scroll-down
1442 "<" gnus-summary-beginning-of-article
1443 ">" gnus-summary-end-of-article
1444 "b" gnus-summary-beginning-of-article
1445 "e" gnus-summary-end-of-article
1446 "^" gnus-summary-refer-parent-article
1447 "r" gnus-summary-refer-parent-article
1448 "R" gnus-summary-refer-references
1449 "T" gnus-summary-refer-thread
1450 "g" gnus-summary-show-article
1451 "s" gnus-summary-isearch-article
1452 "P" gnus-summary-print-article)
1454 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1455 "b" gnus-article-add-buttons
1456 "B" gnus-article-add-buttons-to-head
1457 "o" gnus-article-treat-overstrike
1458 "e" gnus-article-emphasize
1459 "w" gnus-article-fill-cited-article
1460 "Q" gnus-article-fill-long-lines
1461 "C" gnus-article-capitalize-sentences
1462 "c" gnus-article-remove-cr
1463 "q" gnus-article-de-quoted-unreadable
1464 "f" gnus-article-display-x-face
1465 "l" gnus-summary-stop-page-breaking
1466 "r" gnus-summary-caesar-message
1467 "t" gnus-article-hide-headers
1468 "v" gnus-summary-verbose-headers
1469 "h" gnus-article-treat-html
1470 "d" gnus-article-treat-dumbquotes)
1472 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1473 "a" gnus-article-hide
1474 "h" gnus-article-hide-headers
1475 "b" gnus-article-hide-boring-headers
1476 "s" gnus-article-hide-signature
1477 "c" gnus-article-hide-citation
1478 "C" gnus-article-hide-citation-in-followups
1479 "p" gnus-article-hide-pgp
1480 "B" gnus-article-strip-banner
1481 "P" gnus-article-hide-pem
1482 "\C-c" gnus-article-hide-citation-maybe)
1484 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1485 "a" gnus-article-highlight
1486 "h" gnus-article-highlight-headers
1487 "c" gnus-article-highlight-citation
1488 "s" gnus-article-highlight-signature)
1490 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1491 "w" gnus-article-decode-mime-words
1492 "c" gnus-article-decode-charset
1493 "v" gnus-mime-view-all-parts
1494 "b" gnus-article-view-part)
1496 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1497 "z" gnus-article-date-ut
1498 "u" gnus-article-date-ut
1499 "l" gnus-article-date-local
1500 "e" gnus-article-date-lapsed
1501 "o" gnus-article-date-original
1502 "i" gnus-article-date-iso8601
1503 "s" gnus-article-date-user)
1505 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1506 "t" gnus-article-remove-trailing-blank-lines
1507 "l" gnus-article-strip-leading-blank-lines
1508 "m" gnus-article-strip-multiple-blank-lines
1509 "a" gnus-article-strip-blank-lines
1510 "A" gnus-article-strip-all-blank-lines
1511 "s" gnus-article-strip-leading-space
1512 "e" gnus-article-strip-trailing-space)
1514 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1516 "f" gnus-summary-fetch-faq
1517 "d" gnus-summary-describe-group
1518 "h" gnus-summary-describe-briefly
1519 "i" gnus-info-find-node)
1521 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1522 "e" gnus-summary-expire-articles
1523 "\M-\C-e" gnus-summary-expire-articles-now
1524 "\177" gnus-summary-delete-article
1525 [delete] gnus-summary-delete-article
1526 "m" gnus-summary-move-article
1527 "r" gnus-summary-respool-article
1528 "w" gnus-summary-edit-article
1529 "c" gnus-summary-copy-article
1530 "B" gnus-summary-crosspost-article
1531 "q" gnus-summary-respool-query
1532 "t" gnus-summary-respool-trace
1533 "i" gnus-summary-import-article
1534 "p" gnus-summary-article-posted-p)
1536 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1537 "o" gnus-summary-save-article
1538 "m" gnus-summary-save-article-mail
1539 "F" gnus-summary-write-article-file
1540 "r" gnus-summary-save-article-rmail
1541 "f" gnus-summary-save-article-file
1542 "b" gnus-summary-save-article-body-file
1543 "h" gnus-summary-save-article-folder
1544 "v" gnus-summary-save-article-vm
1545 "p" gnus-summary-pipe-output
1546 "s" gnus-soup-add-article)
1548 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1549 "b" gnus-summary-display-buttonized
1550 "m" gnus-summary-repair-multipart
1551 "v" gnus-article-view-part
1552 "o" gnus-article-save-part
1553 "c" gnus-article-copy-part
1554 "e" gnus-article-externalize-part
1555 "i" gnus-article-inline-part
1556 "|" gnus-article-pipe-part)
1559 (defun gnus-summary-make-menu-bar ()
1560 (gnus-turn-off-edit-menu 'summary)
1562 (unless (boundp 'gnus-summary-misc-menu)
1565 gnus-summary-kill-menu gnus-summary-mode-map ""
1570 ["Enter score..." gnus-summary-score-entry t]
1571 ["Customize" gnus-score-customize t])
1572 (gnus-make-score-map 'increase)
1573 (gnus-make-score-map 'lower)
1575 ["Kill below" gnus-summary-kill-below t]
1576 ["Mark above" gnus-summary-mark-above t]
1577 ["Tick above" gnus-summary-tick-above t]
1578 ["Clear above" gnus-summary-clear-above t])
1579 ["Current score" gnus-summary-current-score t]
1580 ["Set score" gnus-summary-set-score t]
1581 ["Switch current score file..." gnus-score-change-score-file t]
1582 ["Set mark below..." gnus-score-set-mark-below t]
1583 ["Set expunge below..." gnus-score-set-expunge-below t]
1584 ["Edit current score file" gnus-score-edit-current-scores t]
1585 ["Edit score file" gnus-score-edit-file t]
1586 ["Trace score" gnus-score-find-trace t]
1587 ["Find words" gnus-score-find-favourite-words t]
1588 ["Rescore buffer" gnus-summary-rescore t]
1589 ["Increase score..." gnus-summary-increase-score t]
1590 ["Lower score..." gnus-summary-lower-score t]))))
1592 ;; Define both the Article menu in the summary buffer and the equivalent
1593 ;; Commands menu in the article buffer here for consistency.
1596 ["All" gnus-article-hide t]
1597 ["Headers" gnus-article-hide-headers t]
1598 ["Signature" gnus-article-hide-signature t]
1599 ["Citation" gnus-article-hide-citation t]
1600 ["PGP" gnus-article-hide-pgp t]
1601 ["Banner" gnus-article-strip-banner t]
1602 ["Boring headers" gnus-article-hide-boring-headers t])
1604 ["All" gnus-article-highlight t]
1605 ["Headers" gnus-article-highlight-headers t]
1606 ["Signature" gnus-article-highlight-signature t]
1607 ["Citation" gnus-article-highlight-citation t])
1609 ["Words" gnus-article-decode-mime-words t]
1610 ["Charset" gnus-article-decode-charset t]
1611 ["QP" gnus-article-de-quoted-unreadable t]
1612 ["View all" gnus-mime-view-all-parts t])
1614 ["Local" gnus-article-date-local t]
1615 ["ISO8601" gnus-article-date-iso8601 t]
1616 ["UT" gnus-article-date-ut t]
1617 ["Original" gnus-article-date-original t]
1618 ["Lapsed" gnus-article-date-lapsed t]
1619 ["User-defined" gnus-article-date-user t])
1622 ["Leading" gnus-article-strip-leading-blank-lines t]
1623 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1624 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1625 ["All of the above" gnus-article-strip-blank-lines t]
1626 ["All" gnus-article-strip-all-blank-lines t]
1627 ["Leading space" gnus-article-strip-leading-space t]
1628 ["Trailing space" gnus-article-strip-trailing-space t])
1629 ["Overstrike" gnus-article-treat-overstrike t]
1630 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1631 ["Emphasis" gnus-article-emphasize t]
1632 ["Word wrap" gnus-article-fill-cited-article t]
1633 ["Fill long lines" gnus-article-fill-long-lines t]
1634 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1635 ["CR" gnus-article-remove-cr t]
1636 ["Show X-Face" gnus-article-display-x-face t]
1637 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1638 ["UnHTMLize" gnus-article-treat-html t]
1639 ["Rot 13" gnus-summary-caesar-message t]
1640 ["Unix pipe" gnus-summary-pipe-message t]
1641 ["Add buttons" gnus-article-add-buttons t]
1642 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1643 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1644 ["Verbose header" gnus-summary-verbose-headers t]
1645 ["Toggle header" gnus-summary-toggle-header t])
1647 ["Save in default format" gnus-summary-save-article t]
1648 ["Save in file" gnus-summary-save-article-file t]
1649 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1650 ["Save in MH folder" gnus-summary-save-article-folder t]
1651 ["Save in VM folder" gnus-summary-save-article-vm t]
1652 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1653 ["Save body in file" gnus-summary-save-article-body-file t]
1654 ["Pipe through a filter" gnus-summary-pipe-output t]
1655 ["Add to SOUP packet" gnus-soup-add-article t]
1656 ["Print" gnus-summary-print-article t])
1658 ["Respool article..." gnus-summary-respool-article t]
1659 ["Move article..." gnus-summary-move-article
1660 (gnus-check-backend-function
1661 'request-move-article gnus-newsgroup-name)]
1662 ["Copy article..." gnus-summary-copy-article t]
1663 ["Crosspost article..." gnus-summary-crosspost-article
1664 (gnus-check-backend-function
1665 'request-replace-article gnus-newsgroup-name)]
1666 ["Import file..." gnus-summary-import-article t]
1667 ["Check if posted" gnus-summary-article-posted-p t]
1668 ["Edit article" gnus-summary-edit-article
1669 (not (gnus-group-read-only-p))]
1670 ["Delete article" gnus-summary-delete-article
1671 (gnus-check-backend-function
1672 'request-expire-articles gnus-newsgroup-name)]
1673 ["Query respool" gnus-summary-respool-query t]
1674 ["Trace respool" gnus-summary-respool-trace t]
1675 ["Delete expirable articles" gnus-summary-expire-articles-now
1676 (gnus-check-backend-function
1677 'request-expire-articles gnus-newsgroup-name)])
1679 ["Uudecode" gnus-uu-decode-uu t]
1680 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1681 ["Unshar" gnus-uu-decode-unshar t]
1682 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1683 ["Save" gnus-uu-decode-save t]
1684 ["Binhex" gnus-uu-decode-binhex t]
1685 ["Postscript" gnus-uu-decode-postscript t])
1687 ["Enter article" gnus-cache-enter-article t]
1688 ["Remove article" gnus-cache-remove-article t])
1689 ["Select article buffer" gnus-summary-select-article-buffer t]
1690 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1691 ["Isearch article..." gnus-summary-isearch-article t]
1692 ["Beginning of the article" gnus-summary-beginning-of-article t]
1693 ["End of the article" gnus-summary-end-of-article t]
1694 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1695 ["Fetch referenced articles" gnus-summary-refer-references t]
1696 ["Fetch current thread" gnus-summary-refer-thread t]
1697 ["Fetch article with id..." gnus-summary-refer-article t]
1698 ["Redisplay" gnus-summary-show-article t])))
1700 gnus-summary-article-menu gnus-summary-mode-map ""
1701 (cons "Article" innards))
1704 gnus-article-commands-menu gnus-article-mode-map ""
1705 (cons "Commands" innards)))
1708 gnus-summary-thread-menu gnus-summary-mode-map ""
1710 ["Toggle threading" gnus-summary-toggle-threads t]
1711 ["Hide threads" gnus-summary-hide-all-threads t]
1712 ["Show threads" gnus-summary-show-all-threads t]
1713 ["Hide thread" gnus-summary-hide-thread t]
1714 ["Show thread" gnus-summary-show-thread t]
1715 ["Go to next thread" gnus-summary-next-thread t]
1716 ["Go to previous thread" gnus-summary-prev-thread t]
1717 ["Go down thread" gnus-summary-down-thread t]
1718 ["Go up thread" gnus-summary-up-thread t]
1719 ["Top of thread" gnus-summary-top-thread t]
1720 ["Mark thread as read" gnus-summary-kill-thread t]
1721 ["Lower thread score" gnus-summary-lower-thread t]
1722 ["Raise thread score" gnus-summary-raise-thread t]
1723 ["Rethread current" gnus-summary-rethread-current t]
1727 gnus-summary-post-menu gnus-summary-mode-map ""
1729 ["Post an article" gnus-summary-post-news t]
1730 ["Followup" gnus-summary-followup t]
1731 ["Followup and yank" gnus-summary-followup-with-original t]
1732 ["Supersede article" gnus-summary-supersede-article t]
1733 ["Cancel article" gnus-summary-cancel-article t]
1734 ["Reply" gnus-summary-reply t]
1735 ["Reply and yank" gnus-summary-reply-with-original t]
1736 ["Wide reply" gnus-summary-wide-reply t]
1737 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1738 ["Mail forward" gnus-summary-mail-forward t]
1739 ["Post forward" gnus-summary-post-forward t]
1740 ["Digest and mail" gnus-uu-digest-mail-forward t]
1741 ["Digest and post" gnus-uu-digest-post-forward t]
1742 ["Resend message" gnus-summary-resend-message t]
1743 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1744 ["Send a mail" gnus-summary-mail-other-window t]
1745 ["Uuencode and post" gnus-uu-post-news t]
1746 ["Followup via news" gnus-summary-followup-to-mail t]
1747 ["Followup via news and yank"
1748 gnus-summary-followup-to-mail-with-original t]
1750 ;;["Send" gnus-summary-send-draft t]
1751 ;;["Send bounced" gnus-resend-bounced-mail t])
1755 gnus-summary-misc-menu gnus-summary-mode-map ""
1758 ["Mark as read" gnus-summary-mark-as-read-forward t]
1759 ["Mark same subject and select"
1760 gnus-summary-kill-same-subject-and-select t]
1761 ["Mark same subject" gnus-summary-kill-same-subject t]
1762 ["Catchup" gnus-summary-catchup t]
1763 ["Catchup all" gnus-summary-catchup-all t]
1764 ["Catchup to here" gnus-summary-catchup-to-here t]
1765 ["Catchup region" gnus-summary-mark-region-as-read t]
1766 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1768 ["Tick" gnus-summary-tick-article-forward t]
1769 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1770 ["Remove marks" gnus-summary-clear-mark-forward t]
1771 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1772 ["Set bookmark" gnus-summary-set-bookmark t]
1773 ["Remove bookmark" gnus-summary-remove-bookmark t])
1775 ["Marks..." gnus-summary-limit-to-marks t]
1776 ["Subject..." gnus-summary-limit-to-subject t]
1777 ["Author..." gnus-summary-limit-to-author t]
1778 ["Age..." gnus-summary-limit-to-age t]
1779 ["Score" gnus-summary-limit-to-score t]
1780 ["Unread" gnus-summary-limit-to-unread t]
1781 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1782 ["Articles" gnus-summary-limit-to-articles t]
1783 ["Pop limit" gnus-summary-pop-limit t]
1784 ["Show dormant" gnus-summary-limit-include-dormant t]
1785 ["Hide childless dormant"
1786 gnus-summary-limit-exclude-childless-dormant t]
1787 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1788 ["Hide marked" gnus-summary-limit-exclude-marks t]
1789 ["Show expunged" gnus-summary-show-all-expunged t])
1791 ["Set mark" gnus-summary-mark-as-processable t]
1792 ["Remove mark" gnus-summary-unmark-as-processable t]
1793 ["Remove all marks" gnus-summary-unmark-all-processable t]
1794 ["Mark above" gnus-uu-mark-over t]
1795 ["Mark series" gnus-uu-mark-series t]
1796 ["Mark region" gnus-uu-mark-region t]
1797 ["Unmark region" gnus-uu-unmark-region t]
1798 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1799 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1800 ["Mark all" gnus-uu-mark-all t]
1801 ["Mark buffer" gnus-uu-mark-buffer t]
1802 ["Mark sparse" gnus-uu-mark-sparse t]
1803 ["Mark thread" gnus-uu-mark-thread t]
1804 ["Unmark thread" gnus-uu-unmark-thread t]
1805 ("Process Mark Sets"
1806 ["Kill" gnus-summary-kill-process-mark t]
1807 ["Yank" gnus-summary-yank-process-mark
1808 gnus-newsgroup-process-stack]
1809 ["Save" gnus-summary-save-process-mark t]))
1811 ["Page forward" gnus-summary-next-page t]
1812 ["Page backward" gnus-summary-prev-page t]
1813 ["Line forward" gnus-summary-scroll-up t])
1815 ["Next unread article" gnus-summary-next-unread-article t]
1816 ["Previous unread article" gnus-summary-prev-unread-article t]
1817 ["Next article" gnus-summary-next-article t]
1818 ["Previous article" gnus-summary-prev-article t]
1819 ["Next unread subject" gnus-summary-next-unread-subject t]
1820 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1821 ["Next article same subject" gnus-summary-next-same-subject t]
1822 ["Previous article same subject" gnus-summary-prev-same-subject t]
1823 ["First unread article" gnus-summary-first-unread-article t]
1824 ["Best unread article" gnus-summary-best-unread-article t]
1825 ["Go to subject number..." gnus-summary-goto-subject t]
1826 ["Go to article number..." gnus-summary-goto-article t]
1827 ["Go to the last article" gnus-summary-goto-last-article t]
1828 ["Pop article off history" gnus-summary-pop-article t])
1830 ["Sort by number" gnus-summary-sort-by-number t]
1831 ["Sort by author" gnus-summary-sort-by-author t]
1832 ["Sort by subject" gnus-summary-sort-by-subject t]
1833 ["Sort by date" gnus-summary-sort-by-date t]
1834 ["Sort by score" gnus-summary-sort-by-score t]
1835 ["Sort by lines" gnus-summary-sort-by-lines t]
1836 ["Sort by characters" gnus-summary-sort-by-chars t])
1838 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1839 ["Describe group" gnus-summary-describe-group t]
1840 ["Read manual" gnus-info-find-node t])
1842 ["Pick and read" gnus-pick-mode t]
1843 ["Binary" gnus-binary-mode t])
1845 ["Regenerate" gnus-summary-prepare t]
1846 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1847 ["Toggle threading" gnus-summary-toggle-threads t])
1848 ["Filter articles..." gnus-summary-execute-command t]
1849 ["Run command on subjects..." gnus-summary-universal-argument t]
1850 ["Search articles forward..." gnus-summary-search-article-forward t]
1851 ["Search articles backward..." gnus-summary-search-article-backward t]
1852 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1853 ["Expand window" gnus-summary-expand-window t]
1854 ["Expire expirable articles" gnus-summary-expire-articles
1855 (gnus-check-backend-function
1856 'request-expire-articles gnus-newsgroup-name)]
1857 ["Edit local kill file" gnus-summary-edit-local-kill t]
1858 ["Edit main kill file" gnus-summary-edit-global-kill t]
1859 ["Edit group parameters" gnus-summary-edit-parameters t]
1860 ["Customize group parameters" gnus-summary-customize-parameters t]
1861 ["Send a bug report" gnus-bug t]
1863 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1864 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1865 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1866 ["Exit group" gnus-summary-exit t]
1867 ["Exit group without updating" gnus-summary-exit-no-update t]
1868 ["Exit and goto next group" gnus-summary-next-group t]
1869 ["Exit and goto prev group" gnus-summary-prev-group t]
1870 ["Reselect group" gnus-summary-reselect-current-group t]
1871 ["Rescan group" gnus-summary-rescan-group t]
1872 ["Update dribble" gnus-summary-save-newsrc t])))
1874 (gnus-run-hooks 'gnus-summary-menu-hook)))
1876 (defun gnus-score-set-default (var value)
1877 "A version of set that updates the GNU Emacs menu-bar."
1879 ;; It is the message that forces the active status to be updated.
1882 (defun gnus-make-score-map (type)
1883 "Make a summary score map of type TYPE."
1886 (let ((headers '(("author" "from" string)
1887 ("subject" "subject" string)
1888 ("article body" "body" string)
1889 ("article head" "head" string)
1890 ("xref" "xref" string)
1891 ("extra header" "extra" string)
1892 ("lines" "lines" number)
1893 ("followups to author" "followup" string)))
1894 (types '((number ("less than" <)
1897 (string ("substring" s)
1901 (perms '(("temporary" (current-time-string))
1909 (if (eq type 'lower)
1914 (setq header (car headers))
1920 (let ((ts (cdr (assoc (nth 2 header) types)))
1936 'gnus-summary-score-entry
1938 (if (or (string= (nth 1 header)
1940 (string= (nth 1 header)
1943 (list 'gnus-summary-header
1945 (list 'quote (nth 1 (car ts)))
1946 (list 'gnus-score-default nil)
1952 (list (nreverse outp))))
1955 (list (nreverse outt))))
1957 (setq headers (cdr headers)))
1958 (list (nreverse outh))))))))
1962 (defun gnus-summary-mode (&optional group)
1963 "Major mode for reading articles.
1965 All normal editing commands are switched off.
1966 \\<gnus-summary-mode-map>
1967 Each line in this buffer represents one article. To read an
1968 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1969 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1972 You can also post articles and send mail from this buffer. To
1973 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1974 of an article, type `\\[gnus-summary-reply]'.
1976 There are approx. one gazillion commands you can execute in this
1977 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1979 The following commands are available:
1981 \\{gnus-summary-mode-map}"
1983 (when (gnus-visual-p 'summary-menu 'menu)
1984 (gnus-summary-make-menu-bar))
1985 (kill-all-local-variables)
1986 (gnus-summary-make-local-variables)
1987 (gnus-make-thread-indent-array)
1988 (gnus-simplify-mode-line)
1989 (setq major-mode 'gnus-summary-mode)
1990 (setq mode-name "Summary")
1991 (make-local-variable 'minor-mode-alist)
1992 (use-local-map gnus-summary-mode-map)
1993 (buffer-disable-undo)
1994 (setq buffer-read-only t) ;Disable modification
1995 (setq truncate-lines t)
1996 (setq selective-display t)
1997 (setq selective-display-ellipses t) ;Display `...'
1998 (gnus-summary-set-display-table)
1999 (gnus-set-default-directory)
2000 (setq gnus-newsgroup-name group)
2001 (make-local-variable 'gnus-summary-line-format)
2002 (make-local-variable 'gnus-summary-line-format-spec)
2003 (make-local-variable 'gnus-summary-dummy-line-format)
2004 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2005 (make-local-variable 'gnus-summary-mark-positions)
2006 (make-local-hook 'pre-command-hook)
2007 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2008 (gnus-run-hooks 'gnus-summary-mode-hook)
2009 (mm-enable-multibyte)
2010 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2011 (gnus-update-summary-mark-positions))
2013 (defun gnus-summary-make-local-variables ()
2014 "Make all the local summary buffer variables."
2016 (dolist (local gnus-summary-local-variables)
2019 (if (eq (cdr local) 'global)
2020 ;; Copy the global value of the variable.
2021 (setq global (symbol-value (car local)))
2022 ;; Use the value from the list.
2023 (setq global (eval (cdr local))))
2024 (set (make-local-variable (car local)) global))
2025 ;; Simple nil-valued local variable.
2026 (set (make-local-variable local) nil)))))
2028 (defun gnus-summary-clear-local-variables ()
2029 (let ((locals gnus-summary-local-variables))
2031 (if (consp (car locals))
2032 (and (vectorp (caar locals))
2033 (set (caar locals) nil))
2034 (and (vectorp (car locals))
2035 (set (car locals) nil)))
2036 (setq locals (cdr locals)))))
2038 ;; Summary data functions.
2040 (defmacro gnus-data-number (data)
2043 (defmacro gnus-data-set-number (data number)
2044 `(setcar ,data ,number))
2046 (defmacro gnus-data-mark (data)
2049 (defmacro gnus-data-set-mark (data mark)
2050 `(setcar (nthcdr 1 ,data) ,mark))
2052 (defmacro gnus-data-pos (data)
2055 (defmacro gnus-data-set-pos (data pos)
2056 `(setcar (nthcdr 2 ,data) ,pos))
2058 (defmacro gnus-data-header (data)
2061 (defmacro gnus-data-set-header (data header)
2062 `(setf (nth 3 ,data) ,header))
2064 (defmacro gnus-data-level (data)
2067 (defmacro gnus-data-unread-p (data)
2068 `(= (nth 1 ,data) gnus-unread-mark))
2070 (defmacro gnus-data-read-p (data)
2071 `(/= (nth 1 ,data) gnus-unread-mark))
2073 (defmacro gnus-data-pseudo-p (data)
2074 `(consp (nth 3 ,data)))
2076 (defmacro gnus-data-find (number)
2077 `(assq ,number gnus-newsgroup-data))
2079 (defmacro gnus-data-find-list (number &optional data)
2080 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2081 (memq (assq ,number bdata)
2084 (defmacro gnus-data-make (number mark pos header level)
2085 `(list ,number ,mark ,pos ,header ,level))
2087 (defun gnus-data-enter (after-article number mark pos header level offset)
2088 (let ((data (gnus-data-find-list after-article)))
2090 (error "No such article: %d" after-article))
2091 (setcdr data (cons (gnus-data-make number mark pos header level)
2093 (setq gnus-newsgroup-data-reverse nil)
2094 (gnus-data-update-list (cddr data) offset)))
2096 (defun gnus-data-enter-list (after-article list &optional offset)
2098 (let ((data (and after-article (gnus-data-find-list after-article)))
2102 (let ((odata gnus-newsgroup-data))
2103 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2105 (gnus-data-update-list odata offset)))
2106 ;; Find the last element in the list to be spliced into the main
2109 (setq list (cdr list)))
2112 (setcdr list gnus-newsgroup-data)
2113 (setq gnus-newsgroup-data ilist)
2115 (gnus-data-update-list (cdr list) offset)))
2116 (setcdr list (cdr data))
2119 (gnus-data-update-list (cdr list) offset))))
2120 (setq gnus-newsgroup-data-reverse nil))))
2122 (defun gnus-data-remove (article &optional offset)
2123 (let ((data gnus-newsgroup-data))
2124 (if (= (gnus-data-number (car data)) article)
2126 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2127 gnus-newsgroup-data-reverse nil)
2129 (gnus-data-update-list gnus-newsgroup-data offset)))
2131 (when (= (gnus-data-number (cadr data)) article)
2132 (setcdr data (cddr data))
2134 (gnus-data-update-list (cdr data) offset))
2136 gnus-newsgroup-data-reverse nil))
2137 (setq data (cdr data))))))
2139 (defmacro gnus-data-list (backward)
2141 (or gnus-newsgroup-data-reverse
2142 (setq gnus-newsgroup-data-reverse
2143 (reverse gnus-newsgroup-data)))
2144 gnus-newsgroup-data))
2146 (defun gnus-data-update-list (data offset)
2147 "Add OFFSET to the POS of all data entries in DATA."
2148 (setq gnus-newsgroup-data-reverse nil)
2150 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2151 (setq data (cdr data))))
2153 (defun gnus-summary-article-pseudo-p (article)
2154 "Say whether this article is a pseudo article or not."
2155 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2157 (defmacro gnus-summary-article-sparse-p (article)
2158 "Say whether this article is a sparse article or not."
2159 `(memq ,article gnus-newsgroup-sparse))
2161 (defmacro gnus-summary-article-ancient-p (article)
2162 "Say whether this article is a sparse article or not."
2163 `(memq ,article gnus-newsgroup-ancient))
2165 (defun gnus-article-parent-p (number)
2166 "Say whether this article is a parent or not."
2167 (let ((data (gnus-data-find-list number)))
2168 (and (cdr data) ; There has to be an article after...
2169 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2170 (gnus-data-level (nth 1 data))))))
2172 (defun gnus-article-children (number)
2173 "Return a list of all children to NUMBER."
2174 (let* ((data (gnus-data-find-list number))
2175 (level (gnus-data-level (car data)))
2177 (setq data (cdr data))
2179 (= (gnus-data-level (car data)) (1+ level)))
2180 (push (gnus-data-number (car data)) children)
2181 (setq data (cdr data)))
2184 (defmacro gnus-summary-skip-intangible ()
2185 "If the current article is intangible, then jump to a different article."
2186 '(let ((to (get-text-property (point) 'gnus-intangible)))
2187 (and to (gnus-summary-goto-subject to))))
2189 (defmacro gnus-summary-article-intangible-p ()
2190 "Say whether this article is intangible or not."
2191 '(get-text-property (point) 'gnus-intangible))
2193 (defun gnus-article-read-p (article)
2194 "Say whether ARTICLE is read or not."
2195 (not (or (memq article gnus-newsgroup-marked)
2196 (memq article gnus-newsgroup-unreads)
2197 (memq article gnus-newsgroup-unselected)
2198 (memq article gnus-newsgroup-dormant))))
2200 ;; Some summary mode macros.
2202 (defmacro gnus-summary-article-number ()
2203 "The article number of the article on the current line.
2204 If there isn's an article number here, then we return the current
2207 (gnus-summary-skip-intangible)
2208 (or (get-text-property (point) 'gnus-number)
2209 (gnus-summary-last-subject))))
2211 (defmacro gnus-summary-article-header (&optional number)
2212 "Return the header of article NUMBER."
2213 `(gnus-data-header (gnus-data-find
2214 ,(or number '(gnus-summary-article-number)))))
2216 (defmacro gnus-summary-thread-level (&optional number)
2217 "Return the level of thread that starts with article NUMBER."
2218 `(if (and (eq gnus-summary-make-false-root 'dummy)
2219 (get-text-property (point) 'gnus-intangible))
2221 (gnus-data-level (gnus-data-find
2222 ,(or number '(gnus-summary-article-number))))))
2224 (defmacro gnus-summary-article-mark (&optional number)
2225 "Return the mark of article NUMBER."
2226 `(gnus-data-mark (gnus-data-find
2227 ,(or number '(gnus-summary-article-number)))))
2229 (defmacro gnus-summary-article-pos (&optional number)
2230 "Return the position of the line of article NUMBER."
2231 `(gnus-data-pos (gnus-data-find
2232 ,(or number '(gnus-summary-article-number)))))
2234 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2235 (defmacro gnus-summary-article-subject (&optional number)
2236 "Return current subject string or nil if nothing."
2239 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2240 '(gnus-data-header (assq (gnus-summary-article-number)
2241 gnus-newsgroup-data)))))
2244 (mail-header-subject headers))))
2246 (defmacro gnus-summary-article-score (&optional number)
2247 "Return current article score."
2248 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2249 gnus-newsgroup-scored))
2250 gnus-summary-default-score 0))
2252 (defun gnus-summary-article-children (&optional number)
2253 "Return a list of article numbers that are children of article NUMBER."
2254 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2255 (level (gnus-data-level (car data)))
2257 (while (and (setq data (cdr data))
2258 (> (setq l (gnus-data-level (car data))) level))
2259 (and (= (1+ level) l)
2260 (push (gnus-data-number (car data))
2262 (nreverse children)))
2264 (defun gnus-summary-article-parent (&optional number)
2265 "Return the article number of the parent of article NUMBER."
2266 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2267 (gnus-data-list t)))
2268 (level (gnus-data-level (car data))))
2270 () ; This is a root.
2271 ;; We search until we find an article with a level less than
2272 ;; this one. That function has to be the parent.
2273 (while (and (setq data (cdr data))
2274 (not (< (gnus-data-level (car data)) level))))
2275 (and data (gnus-data-number (car data))))))
2277 (defun gnus-unread-mark-p (mark)
2278 "Say whether MARK is the unread mark."
2279 (= mark gnus-unread-mark))
2281 (defun gnus-read-mark-p (mark)
2282 "Say whether MARK is one of the marks that mark as read.
2283 This is all marks except unread, ticked, dormant, and expirable."
2284 (not (or (= mark gnus-unread-mark)
2285 (= mark gnus-ticked-mark)
2286 (= mark gnus-dormant-mark)
2287 (= mark gnus-expirable-mark))))
2289 (defmacro gnus-article-mark (number)
2290 "Return the MARK of article NUMBER.
2291 This macro should only be used when computing the mark the \"first\"
2292 time; i.e., when generating the summary lines. After that,
2293 `gnus-summary-article-mark' should be used to examine the
2296 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2297 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2298 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2299 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2300 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2301 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2302 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2303 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2304 gnus-ancient-mark))))
2306 ;; Saving hidden threads.
2308 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2309 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2311 (defmacro gnus-save-hidden-threads (&rest forms)
2312 "Save hidden threads, eval FORMS, and restore the hidden threads."
2313 (let ((config (make-symbol "config")))
2314 `(let ((,config (gnus-hidden-threads-configuration)))
2318 (gnus-restore-hidden-threads-configuration ,config)))))
2320 (defun gnus-data-compute-positions ()
2321 "Compute the positions of all articles."
2322 (setq gnus-newsgroup-data-reverse nil)
2323 (let ((data gnus-newsgroup-data))
2325 (gnus-save-hidden-threads
2326 (gnus-summary-show-all-threads)
2327 (goto-char (point-min))
2329 (while (get-text-property (point) 'gnus-intangible)
2331 (gnus-data-set-pos (car data) (+ (point) 3))
2332 (setq data (cdr data))
2333 (forward-line 1))))))
2335 (defun gnus-hidden-threads-configuration ()
2336 "Return the current hidden threads configuration."
2339 (goto-char (point-min))
2340 (while (search-forward "\r" nil t)
2341 (push (1- (point)) config))
2344 (defun gnus-restore-hidden-threads-configuration (config)
2345 "Restore hidden threads configuration from CONFIG."
2346 (let (point buffer-read-only)
2347 (while (setq point (pop config))
2348 (when (and (< point (point-max))
2350 (eq (char-after) ?\n))
2351 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2353 ;; Various summary mode internalish functions.
2355 (defun gnus-mouse-pick-article (e)
2358 (gnus-summary-next-page nil t))
2360 (defun gnus-summary-set-display-table ()
2361 ;; Change the display table. Odd characters have a tendency to mess
2362 ;; up nicely formatted displays - we make all possible glyphs
2363 ;; display only a single character.
2365 ;; We start from the standard display table, if any.
2366 (let ((table (or (copy-sequence standard-display-table)
2367 (make-display-table)))
2369 ;; Nix out all the control chars...
2370 (while (>= (setq i (1- i)) 0)
2371 (aset table i [??]))
2372 ;; ... but not newline and cr, of course. (cr is necessary for the
2373 ;; selective display).
2374 (aset table ?\n nil)
2375 (aset table ?\r nil)
2376 ;; We keep TAB as well.
2377 (aset table ?\t nil)
2378 ;; We nix out any glyphs over 126 that are not set already.
2380 (while (>= (setq i (1- i)) 127)
2381 ;; Only modify if the entry is nil.
2382 (unless (aref table i)
2383 (aset table i [??]))))
2384 (setq buffer-display-table table)))
2386 (defun gnus-summary-setup-buffer (group)
2387 "Initialize summary buffer."
2388 (let ((buffer (concat "*Summary " group "*")))
2389 (if (get-buffer buffer)
2392 (setq gnus-summary-buffer (current-buffer))
2393 (not gnus-newsgroup-prepared))
2394 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2395 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2396 (gnus-summary-mode group)
2398 (gnus-carpal-setup-buffer 'summary))
2399 (unless gnus-single-article-buffer
2400 (make-local-variable 'gnus-article-buffer)
2401 (make-local-variable 'gnus-article-current)
2402 (make-local-variable 'gnus-original-article-buffer))
2403 (setq gnus-newsgroup-name group)
2406 (defun gnus-set-global-variables ()
2407 ;; Set the global equivalents of the summary buffer-local variables
2408 ;; to the latest values they had. These reflect the summary buffer
2409 ;; that was in action when the last article was fetched.
2410 (when (eq major-mode 'gnus-summary-mode)
2411 (setq gnus-summary-buffer (current-buffer))
2412 (let ((name gnus-newsgroup-name)
2413 (marked gnus-newsgroup-marked)
2414 (unread gnus-newsgroup-unreads)
2415 (headers gnus-current-headers)
2416 (data gnus-newsgroup-data)
2417 (summary gnus-summary-buffer)
2418 (article-buffer gnus-article-buffer)
2419 (original gnus-original-article-buffer)
2420 (gac gnus-article-current)
2421 (reffed gnus-reffed-article-number)
2422 (score-file gnus-current-score-file)
2423 (default-charset gnus-newsgroup-charset))
2425 (set-buffer gnus-group-buffer)
2426 (setq gnus-newsgroup-name name
2427 gnus-newsgroup-marked marked
2428 gnus-newsgroup-unreads unread
2429 gnus-current-headers headers
2430 gnus-newsgroup-data data
2431 gnus-article-current gac
2432 gnus-summary-buffer summary
2433 gnus-article-buffer article-buffer
2434 gnus-original-article-buffer original
2435 gnus-reffed-article-number reffed
2436 gnus-current-score-file score-file
2437 gnus-newsgroup-charset default-charset)
2438 ;; The article buffer also has local variables.
2439 (when (gnus-buffer-live-p gnus-article-buffer)
2440 (set-buffer gnus-article-buffer)
2441 (setq gnus-summary-buffer summary))))))
2443 (defun gnus-summary-article-unread-p (article)
2444 "Say whether ARTICLE is unread or not."
2445 (memq article gnus-newsgroup-unreads))
2447 (defun gnus-summary-first-article-p (&optional article)
2448 "Return whether ARTICLE is the first article in the buffer."
2449 (if (not (setq article (or article (gnus-summary-article-number))))
2451 (eq article (caar gnus-newsgroup-data))))
2453 (defun gnus-summary-last-article-p (&optional article)
2454 "Return whether ARTICLE is the last article in the buffer."
2455 (if (not (setq article (or article (gnus-summary-article-number))))
2456 ;; All non-existent numbers are the last article. :-)
2458 (not (cdr (gnus-data-find-list article)))))
2460 (defun gnus-make-thread-indent-array ()
2462 (unless (and gnus-thread-indent-array
2463 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2464 (setq gnus-thread-indent-array (make-vector 201 "")
2465 gnus-thread-indent-array-level gnus-thread-indent-level)
2467 (aset gnus-thread-indent-array n
2468 (make-string (* n gnus-thread-indent-level) ? ))
2471 (defun gnus-update-summary-mark-positions ()
2472 "Compute where the summary marks are to go."
2474 (when (gnus-buffer-exists-p gnus-summary-buffer)
2475 (set-buffer gnus-summary-buffer))
2476 (let ((gnus-replied-mark 129)
2477 (gnus-score-below-mark 130)
2478 (gnus-score-over-mark 130)
2479 (gnus-download-mark 131)
2480 (spec gnus-summary-line-format-spec)
2483 (gnus-set-work-buffer)
2484 (let ((gnus-summary-line-format-spec spec)
2485 (gnus-newsgroup-downloadable '((0 . t))))
2486 (gnus-summary-insert-line
2487 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2488 (goto-char (point-min))
2489 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2491 (goto-char (point-min))
2492 (push (cons 'replied (and (search-forward "\201" nil t)
2495 (goto-char (point-min))
2496 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2498 (goto-char (point-min))
2499 (push (cons 'download
2500 (and (search-forward "\203" nil t) (- (point) 2)))
2502 (setq gnus-summary-mark-positions pos))))
2504 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2505 "Insert a dummy root in the summary buffer."
2507 (gnus-add-text-properties
2508 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2509 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2511 (defun gnus-summary-from-or-to-or-newsgroups (header)
2512 (let ((to (cdr (assq 'To (mail-header-extra header))))
2513 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2514 (mail-parse-charset gnus-newsgroup-charset))
2517 gnus-ignored-from-addresses
2518 (string-match gnus-ignored-from-addresses
2519 (mail-header-from header)))
2521 (or (car (funcall gnus-extract-address-components
2523 gnus-decode-encoded-word-function to)))
2524 (funcall gnus-decode-encoded-word-function to))))
2526 gnus-ignored-from-addresses
2527 (string-match gnus-ignored-from-addresses
2528 (mail-header-from header)))
2529 (concat "=> " newsgroups))
2531 (or (car (funcall gnus-extract-address-components
2532 (mail-header-from header)))
2533 (mail-header-from header))))))
2535 (defun gnus-summary-insert-line (gnus-tmp-header
2536 gnus-tmp-level gnus-tmp-current
2537 gnus-tmp-unread gnus-tmp-replied
2538 gnus-tmp-expirable gnus-tmp-subject-or-nil
2539 &optional gnus-tmp-dummy gnus-tmp-score
2541 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2542 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2543 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2544 (gnus-tmp-score-char
2545 (if (or (null gnus-summary-default-score)
2546 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2547 gnus-summary-zcore-fuzz))
2549 (if (< gnus-tmp-score gnus-summary-default-score)
2550 gnus-score-below-mark gnus-score-over-mark)))
2552 (cond (gnus-tmp-process gnus-process-mark)
2553 ((memq gnus-tmp-current gnus-newsgroup-cached)
2555 (gnus-tmp-replied gnus-replied-mark)
2556 ((memq gnus-tmp-current gnus-newsgroup-saved)
2558 (t gnus-unread-mark)))
2559 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2562 ((string-match "<[^>]+> *$" gnus-tmp-from)
2563 (let ((beg (match-beginning 0)))
2564 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2565 (substring gnus-tmp-from (1+ (match-beginning 0))
2566 (1- (match-end 0))))
2567 (substring gnus-tmp-from 0 beg))))
2568 ((string-match "(.+)" gnus-tmp-from)
2569 (substring gnus-tmp-from
2570 (1+ (match-beginning 0)) (1- (match-end 0))))
2572 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2573 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2574 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2575 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2576 (buffer-read-only nil))
2577 (when (string= gnus-tmp-name "")
2578 (setq gnus-tmp-name gnus-tmp-from))
2579 (unless (numberp gnus-tmp-lines)
2580 (setq gnus-tmp-lines 0))
2581 (gnus-put-text-property
2583 (progn (eval gnus-summary-line-format-spec) (point))
2584 'gnus-number gnus-tmp-number)
2585 (when (gnus-visual-p 'summary-highlight 'highlight)
2587 (gnus-run-hooks 'gnus-summary-update-hook)
2590 (defun gnus-summary-update-line (&optional dont-update)
2591 ;; Update summary line after change.
2592 (when (and gnus-summary-default-score
2593 (not gnus-summary-inhibit-highlight))
2594 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2595 (article (gnus-summary-article-number))
2596 (score (gnus-summary-article-score article)))
2598 (if (and gnus-summary-mark-below
2599 (< (gnus-summary-article-score)
2600 gnus-summary-mark-below))
2601 ;; This article has a low score, so we mark it as read.
2602 (when (memq article gnus-newsgroup-unreads)
2603 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2604 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2605 ;; This article was previously marked as read on account
2606 ;; of a low score, but now it has risen, so we mark it as
2608 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2609 (gnus-summary-update-mark
2610 (if (or (null gnus-summary-default-score)
2611 (<= (abs (- score gnus-summary-default-score))
2612 gnus-summary-zcore-fuzz))
2614 (if (< score gnus-summary-default-score)
2615 gnus-score-below-mark gnus-score-over-mark))
2617 ;; Do visual highlighting.
2618 (when (gnus-visual-p 'summary-highlight 'highlight)
2619 (gnus-run-hooks 'gnus-summary-update-hook)))))
2621 (defvar gnus-tmp-new-adopts nil)
2623 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2624 "Return the number of articles in THREAD.
2625 This may be 0 in some cases -- if none of the articles in
2626 the thread are to be displayed."
2628 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2630 ((not (listp thread))
2632 ((and (consp thread) (cdr thread))
2635 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2638 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2641 (when (and level (zerop level) gnus-tmp-new-adopts)
2644 'gnus-summary-number-of-articles-in-thread
2645 gnus-tmp-new-adopts))))
2647 (if (> number 1) gnus-not-empty-thread-mark
2648 gnus-empty-thread-mark)
2651 (defun gnus-summary-set-local-parameters (group)
2652 "Go through the local params of GROUP and set all variable specs in that list."
2653 (let ((params (gnus-group-find-parameter group))
2656 (setq elem (car params)
2657 params (cdr params))
2658 (and (consp elem) ; Has to be a cons.
2659 (consp (cdr elem)) ; The cdr has to be a list.
2660 (symbolp (car elem)) ; Has to be a symbol in there.
2661 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2662 (ignore-errors ; So we set it.
2663 (make-local-variable (car elem))
2664 (set (car elem) (eval (nth 1 elem))))))))
2666 (defun gnus-summary-read-group (group &optional show-all no-article
2667 kill-buffer no-display backward
2669 "Start reading news in newsgroup GROUP.
2670 If SHOW-ALL is non-nil, already read articles are also listed.
2671 If NO-ARTICLE is non-nil, no article is selected initially.
2672 If NO-DISPLAY, don't generate a summary buffer."
2676 (let ((gnus-auto-select-next nil))
2677 (or (gnus-summary-read-group-1
2678 group show-all no-article
2679 kill-buffer no-display
2682 select-articles nil)))))
2683 (eq gnus-auto-select-next 'quietly))
2684 (set-buffer gnus-group-buffer)
2685 ;; The entry function called above goes to the next
2686 ;; group automatically, so we go two groups back
2687 ;; if we are searching for the previous group.
2689 (gnus-group-prev-unread-group 2))
2690 (if (not (equal group (gnus-group-group-name)))
2691 (setq group (gnus-group-group-name))
2695 (defun gnus-summary-read-group-1 (group show-all no-article
2696 kill-buffer no-display
2697 &optional select-articles)
2698 ;; Killed foreign groups can't be entered.
2699 (when (and (not (gnus-group-native-p group))
2700 (not (gnus-gethash group gnus-newsrc-hashtb)))
2701 (error "Dead non-native groups can't be entered"))
2702 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2703 (let* ((new-group (gnus-summary-setup-buffer group))
2704 (quit-config (gnus-group-quit-config group))
2705 (did-select (and new-group (gnus-select-newsgroup
2706 group show-all select-articles))))
2708 ;; This summary buffer exists already, so we just select it.
2710 (gnus-set-global-variables)
2712 (gnus-kill-or-deaden-summary kill-buffer))
2713 (gnus-configure-windows 'summary 'force)
2714 (gnus-set-mode-line 'summary)
2715 (gnus-summary-position-point)
2718 ;; We couldn't select this group.
2720 (when (and (eq major-mode 'gnus-summary-mode)
2721 (not (equal (current-buffer) kill-buffer)))
2722 (kill-buffer (current-buffer))
2723 (if (not quit-config)
2725 ;; Update the info -- marks might need to be removed,
2727 (gnus-summary-update-info)
2728 (set-buffer gnus-group-buffer)
2729 (gnus-group-jump-to-group group)
2730 (gnus-group-next-unread-group 1))
2731 (gnus-handle-ephemeral-exit quit-config)))
2732 (gnus-message 3 "Can't select group")
2734 ;; The user did a `C-g' while prompting for number of articles,
2735 ;; so we exit this group.
2736 ((eq did-select 'quit)
2737 (and (eq major-mode 'gnus-summary-mode)
2738 (not (equal (current-buffer) kill-buffer))
2739 (kill-buffer (current-buffer)))
2741 (gnus-kill-or-deaden-summary kill-buffer))
2742 (if (not quit-config)
2744 (set-buffer gnus-group-buffer)
2745 (gnus-group-jump-to-group group)
2746 (gnus-group-next-unread-group 1)
2747 (gnus-configure-windows 'group 'force))
2748 (gnus-handle-ephemeral-exit quit-config))
2749 ;; Finally signal the quit.
2751 ;; The group was successfully selected.
2753 (gnus-set-global-variables)
2754 ;; Save the active value in effect when the group was entered.
2755 (setq gnus-newsgroup-active
2757 (gnus-active gnus-newsgroup-name)))
2758 ;; You can change the summary buffer in some way with this hook.
2759 (gnus-run-hooks 'gnus-select-group-hook)
2760 ;; Set any local variables in the group parameters.
2761 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2762 (gnus-update-format-specifications
2763 nil 'summary 'summary-mode 'summary-dummy)
2764 ;; Do score processing.
2765 (when gnus-use-scoring
2766 (gnus-possibly-score-headers))
2767 ;; Check whether to fill in the gaps in the threads.
2768 (when gnus-build-sparse-threads
2769 (gnus-build-sparse-threads))
2770 ;; Find the initial limit.
2771 (if gnus-show-threads
2773 (let ((gnus-newsgroup-dormant nil))
2774 (gnus-summary-initial-limit show-all))
2775 (gnus-summary-initial-limit show-all))
2776 (setq gnus-newsgroup-limit
2778 (lambda (header) (mail-header-number header))
2779 gnus-newsgroup-headers)))
2780 ;; Generate the summary buffer.
2782 (gnus-summary-prepare))
2783 (when gnus-use-trees
2784 (gnus-tree-open group)
2785 (setq gnus-summary-highlight-line-function
2786 'gnus-tree-highlight-article))
2787 ;; If the summary buffer is empty, but there are some low-scored
2788 ;; articles or some excluded dormants, we include these in the
2790 (when (and (zerop (buffer-size))
2792 (cond (gnus-newsgroup-dormant
2793 (gnus-summary-limit-include-dormant))
2794 ((and gnus-newsgroup-scored show-all)
2795 (gnus-summary-limit-include-expunged t))))
2796 ;; Function `gnus-apply-kill-file' must be called in this hook.
2797 (gnus-run-hooks 'gnus-apply-kill-hook)
2798 (if (and (zerop (buffer-size))
2801 ;; This newsgroup is empty.
2802 (gnus-summary-catchup-and-exit nil t)
2803 (gnus-message 6 "No unread news")
2805 (gnus-kill-or-deaden-summary kill-buffer))
2806 ;; Return nil from this function.
2808 ;; Hide conversation thread subtrees. We cannot do this in
2809 ;; gnus-summary-prepare-hook since kill processing may not
2810 ;; work with hidden articles.
2811 (and gnus-show-threads
2812 gnus-thread-hide-subtree
2813 (gnus-summary-hide-all-threads))
2815 (gnus-kill-or-deaden-summary kill-buffer))
2816 ;; Show first unread article if requested.
2817 (if (and (not no-article)
2819 gnus-newsgroup-unreads
2820 gnus-auto-select-first)
2822 (gnus-configure-windows 'summary)
2824 ((eq gnus-auto-select-first 'best)
2825 (gnus-summary-best-unread-article))
2826 ((eq gnus-auto-select-first t)
2827 (gnus-summary-first-unread-article))
2828 ((gnus-functionp gnus-auto-select-first)
2829 (funcall gnus-auto-select-first))))
2830 ;; Don't select any articles, just move point to the first
2831 ;; article in the group.
2832 (goto-char (point-min))
2833 (gnus-summary-position-point)
2834 (gnus-configure-windows 'summary 'force)
2835 (gnus-set-mode-line 'summary))
2836 (when (get-buffer-window gnus-group-buffer t)
2837 ;; Gotta use windows, because recenter does weird stuff if
2838 ;; the current buffer ain't the displayed window.
2839 (let ((owin (selected-window)))
2840 (select-window (get-buffer-window gnus-group-buffer t))
2841 (when (gnus-group-goto-group group)
2843 (select-window owin)))
2844 ;; Mark this buffer as "prepared".
2845 (setq gnus-newsgroup-prepared t)
2846 (gnus-run-hooks 'gnus-summary-prepared-hook)
2849 (defun gnus-summary-prepare ()
2850 "Generate the summary buffer."
2852 (let ((buffer-read-only nil))
2854 (setq gnus-newsgroup-data nil
2855 gnus-newsgroup-data-reverse nil)
2856 (gnus-run-hooks 'gnus-summary-generate-hook)
2857 ;; Generate the buffer, either with threads or without.
2858 (when gnus-newsgroup-headers
2859 (gnus-summary-prepare-threads
2860 (if gnus-show-threads
2861 (gnus-sort-gathered-threads
2862 (funcall gnus-summary-thread-gathering-function
2864 (gnus-cut-threads (gnus-make-threads)))))
2865 ;; Unthreaded display.
2866 (gnus-sort-articles gnus-newsgroup-headers))))
2867 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2868 ;; Call hooks for modifying summary buffer.
2869 (goto-char (point-min))
2870 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2872 (defsubst gnus-general-simplify-subject (subject)
2873 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2876 ;; Truncate the subject.
2877 (gnus-simplify-subject-functions
2878 (gnus-map-function gnus-simplify-subject-functions subject))
2879 ((numberp gnus-summary-gather-subject-limit)
2880 (setq subject (gnus-simplify-subject-re subject))
2881 (if (> (length subject) gnus-summary-gather-subject-limit)
2882 (substring subject 0 gnus-summary-gather-subject-limit)
2884 ;; Fuzzily simplify it.
2885 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2886 (gnus-simplify-subject-fuzzy subject))
2887 ;; Just remove the leading "Re:".
2889 (gnus-simplify-subject-re subject))))
2891 (if (and gnus-summary-gather-exclude-subject
2892 (string-match gnus-summary-gather-exclude-subject subject))
2893 nil ; This article shouldn't be gathered
2896 (defun gnus-summary-simplify-subject-query ()
2897 "Query where the respool algorithm would put this article."
2899 (gnus-summary-select-article)
2900 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2902 (defun gnus-gather-threads-by-subject (threads)
2903 "Gather threads by looking at Subject headers."
2904 (if (not gnus-summary-make-false-root)
2906 (let ((hashtb (gnus-make-hashtable 1024))
2909 subject hthread whole-subject)
2911 (setq subject (gnus-general-simplify-subject
2912 (setq whole-subject (mail-header-subject
2915 (if (setq hthread (gnus-gethash subject hashtb))
2917 ;; We enter a dummy root into the thread, if we
2918 ;; haven't done that already.
2919 (unless (stringp (caar hthread))
2920 (setcar hthread (list whole-subject (car hthread))))
2921 ;; We add this new gathered thread to this gathered
2923 (setcdr (car hthread)
2924 (nconc (cdar hthread) (list (car threads))))
2925 ;; Remove it from the list of threads.
2926 (setcdr prev (cdr threads))
2927 (setq threads prev))
2928 ;; Enter this thread into the hash table.
2929 (gnus-sethash subject threads hashtb)))
2931 (setq threads (cdr threads)))
2934 (defun gnus-gather-threads-by-references (threads)
2935 "Gather threads by looking at References headers."
2936 (let ((idhashtb (gnus-make-hashtable 1024))
2937 (thhashtb (gnus-make-hashtable 1024))
2940 ids references id gthread gid entered ref)
2942 (when (setq references (mail-header-references (caar threads)))
2943 (setq id (mail-header-id (caar threads))
2944 ids (gnus-split-references references)
2946 (while (setq ref (pop ids))
2947 (setq ids (delete ref ids))
2948 (if (not (setq gid (gnus-gethash ref idhashtb)))
2950 (gnus-sethash ref id idhashtb)
2951 (gnus-sethash id threads thhashtb))
2952 (setq gthread (gnus-gethash gid thhashtb))
2954 ;; We enter a dummy root into the thread, if we
2955 ;; haven't done that already.
2956 (unless (stringp (caar gthread))
2957 (setcar gthread (list (mail-header-subject (caar gthread))
2959 ;; We add this new gathered thread to this gathered
2961 (setcdr (car gthread)
2962 (nconc (cdar gthread) (list (car threads)))))
2963 ;; Add it into the thread hash table.
2964 (gnus-sethash id gthread thhashtb)
2966 ;; Remove it from the list of threads.
2967 (setcdr prev (cdr threads))
2968 (setq threads prev))))
2970 (setq threads (cdr threads)))
2973 (defun gnus-sort-gathered-threads (threads)
2974 "Sort subtreads inside each gathered thread by article number."
2975 (let ((result threads))
2977 (when (stringp (caar threads))
2978 (setcdr (car threads)
2979 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2980 (setq threads (cdr threads)))
2983 (defun gnus-thread-loop-p (root thread)
2984 "Say whether ROOT is in THREAD."
2985 (let ((stack (list thread))
2988 (while (setq thread (pop stack))
2989 (setq th (cdr thread))
2991 (not (eq (caar th) root)))
2994 ;; We have found a loop.
2996 (setcdr thread (delq (car th) (cdr thread)))
2997 (if (boundp (setq ref-dep (intern "none"
2998 gnus-newsgroup-dependencies)))
2999 (setcdr (symbol-value ref-dep)
3000 (nconc (cdr (symbol-value ref-dep))
3002 (set ref-dep (list nil (car th))))
3005 ;; Push all the subthreads onto the stack.
3006 (push (cdr thread) stack)))
3009 (defun gnus-make-threads ()
3010 "Go through the dependency hashtb and find the roots. Return all threads."
3012 (while (catch 'infloop
3015 ;; Deal with self-referencing References loops.
3016 (when (and (car (symbol-value refs))
3023 (car (symbol-value refs)) thread))
3024 (cdr (symbol-value refs)))))))
3027 (unless (car (symbol-value refs))
3028 ;; These threads do not refer back to any other articles,
3029 ;; so they're roots.
3030 (setq threads (append (cdr (symbol-value refs)) threads))))
3031 gnus-newsgroup-dependencies)))
3034 ;; Build the thread tree.
3035 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3036 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3038 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3039 if it was already present.
3041 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3042 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3043 Message-IDs will be renamed be renamed to a unique Message-ID before
3046 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3047 (let* ((id (mail-header-id header))
3048 (id-dep (and id (intern id dependencies)))
3049 ref ref-dep ref-header)
3050 ;; Enter this `header' in the `dependencies' table.
3054 ;; The first two cases do the normal part: enter a new `header'
3055 ;; in the `dependencies' table.
3056 ((not (boundp id-dep))
3057 (set id-dep (list header)))
3058 ((null (car (symbol-value id-dep)))
3059 (setcar (symbol-value id-dep) header))
3061 ;; From here the `header' was already present in the
3062 ;; `dependencies' table.
3064 ;; Overrides an existing entry;
3065 ;; just set the header part of the entry.
3066 (setcar (symbol-value id-dep) header))
3068 ;; Renames the existing `header' to a unique Message-ID.
3069 ((not gnus-summary-ignore-duplicates)
3070 ;; An article with this Message-ID has already been seen.
3071 ;; We rename the Message-ID.
3072 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3074 (mail-header-set-id header id))
3076 ;; The last case ignores an existing entry, except it adds any
3077 ;; additional Xrefs (in case the two articles came from different
3079 ;; Also sets `header' to `nil' meaning that the `dependencies'
3080 ;; table was *not* modified.
3082 (mail-header-set-xref
3083 (car (symbol-value id-dep))
3084 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3086 (or (mail-header-xref header) "")))
3090 ;; First check if that we are not creating a References loop.
3091 (setq ref (gnus-parent-id (mail-header-references header)))
3093 (setq ref-dep (intern-soft ref dependencies))
3095 (setq ref-header (car (symbol-value ref-dep))))
3096 (if (string= id ref)
3097 ;; Yuk! This is a reference loop. Make the article be a
3100 (mail-header-set-references (car (symbol-value id-dep)) "none")
3102 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3103 (setq ref (gnus-parent-id (mail-header-references header)))
3104 (setq ref-dep (intern (or ref "none") dependencies))
3105 (if (boundp ref-dep)
3106 (setcdr (symbol-value ref-dep)
3107 (nconc (cdr (symbol-value ref-dep))
3108 (list (symbol-value id-dep))))
3109 (set ref-dep (list nil (symbol-value id-dep)))))
3112 (defun gnus-build-sparse-threads ()
3113 (let ((headers gnus-newsgroup-headers)
3114 (gnus-summary-ignore-duplicates t)
3115 header references generation relations
3116 subject child end new-child date)
3117 ;; First we create an alist of generations/relations, where
3118 ;; generations is how much we trust the relation, and the relation
3120 (gnus-message 7 "Making sparse threads...")
3122 (nnheader-set-temp-buffer " *gnus sparse threads*")
3123 (while (setq header (pop headers))
3124 (when (and (setq references (mail-header-references header))
3125 (not (string= references "")))
3127 (setq child (mail-header-id header)
3128 subject (mail-header-subject header)
3129 date (mail-header-date header)
3131 (while (search-backward ">" nil t)
3132 (setq end (1+ (point)))
3133 (when (search-backward "<" nil t)
3134 (setq new-child (buffer-substring (point) end))
3135 (push (list (incf generation)
3136 child (setq child new-child)
3140 (push (list (1+ generation) child nil subject) relations))
3142 (kill-buffer (current-buffer)))
3143 ;; Sort over trustworthiness.
3146 (when (gnus-dependencies-add-header
3147 (make-full-mail-header
3148 gnus-reffed-article-number
3149 (nth 3 relation) "" (or (nth 4 relation) "")
3151 (or (nth 2 relation) "") 0 0 "")
3152 gnus-newsgroup-dependencies nil)
3153 (push gnus-reffed-article-number gnus-newsgroup-limit)
3154 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3155 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3156 gnus-newsgroup-reads)
3157 (decf gnus-reffed-article-number)))
3158 (sort relations 'car-less-than-car))
3159 (gnus-message 7 "Making sparse threads...done")))
3161 (defun gnus-build-old-threads ()
3162 ;; Look at all the articles that refer back to old articles, and
3163 ;; fetch the headers for the articles that aren't there. This will
3164 ;; build complete threads - if the roots haven't been expired by the
3169 (when (not (car (symbol-value refs)))
3170 (setq heads (cdr (symbol-value refs)))
3172 (if (memq (mail-header-number (caar heads))
3173 gnus-newsgroup-dormant)
3174 (setq heads (cdr heads))
3175 (setq id (symbol-name refs))
3176 (while (and (setq id (gnus-build-get-header id))
3177 (not (car (gnus-id-to-thread id)))))
3178 (setq heads nil)))))
3179 gnus-newsgroup-dependencies)))
3181 ;; This function has to be called with point after the article number
3182 ;; on the beginning of the line.
3183 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3184 (let ((eol (gnus-point-at-eol))
3185 (buffer (current-buffer))
3188 ;; overview: [num subject from date id refs chars lines misc]
3191 (narrow-to-region (point) eol)
3196 (make-full-mail-header
3198 (funcall gnus-decode-encoded-word-function
3199 (nnheader-nov-field)) ; subject
3200 (funcall gnus-decode-encoded-word-function
3201 (nnheader-nov-field)) ; from
3202 (nnheader-nov-field) ; date
3203 (nnheader-nov-read-message-id) ; id
3204 (nnheader-nov-field) ; refs
3205 (nnheader-nov-read-integer) ; chars
3206 (nnheader-nov-read-integer) ; lines
3208 (nnheader-nov-field)) ; misc
3209 (nnheader-nov-parse-extra)))) ; extra
3213 (when gnus-alter-header-function
3214 (funcall gnus-alter-header-function header))
3215 (gnus-dependencies-add-header header dependencies force-new)))
3217 (defun gnus-build-get-header (id)
3218 ;; Look through the buffer of NOV lines and find the header to
3219 ;; ID. Enter this line into the dependencies hash table, and return
3220 ;; the id of the parent article (if any).
3221 (let ((deps gnus-newsgroup-dependencies)
3225 (set-buffer nntp-server-buffer)
3226 (let ((case-fold-search nil))
3227 (goto-char (point-min))
3228 (while (and (not found)
3229 (search-forward id nil t))
3231 (setq found (looking-at
3232 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3233 (regexp-quote id))))
3234 (or found (beginning-of-line 2)))
3238 (setq header (gnus-nov-parse-line
3239 (read (current-buffer)) deps))
3240 (gnus-parent-id (mail-header-references header))))))
3242 (let ((number (mail-header-number header)))
3243 (push number gnus-newsgroup-limit)
3244 (push header gnus-newsgroup-headers)
3245 (if (memq number gnus-newsgroup-unselected)
3247 (push number gnus-newsgroup-unreads)
3248 (setq gnus-newsgroup-unselected
3249 (delq number gnus-newsgroup-unselected)))
3250 (push number gnus-newsgroup-ancient)))))))
3252 (defun gnus-build-all-threads ()
3253 "Read all the headers."
3254 (let ((gnus-summary-ignore-duplicates t)
3255 (dependencies gnus-newsgroup-dependencies)
3258 (set-buffer nntp-server-buffer)
3259 (let ((case-fold-search nil))
3260 (goto-char (point-min))
3263 (setq article (read (current-buffer))
3264 header (gnus-nov-parse-line
3265 article dependencies)))
3268 (set-buffer gnus-summary-buffer)
3269 (push header gnus-newsgroup-headers)
3270 (if (memq (setq article (mail-header-number header))
3271 gnus-newsgroup-unselected)
3273 (push article gnus-newsgroup-unreads)
3274 (setq gnus-newsgroup-unselected
3275 (delq article gnus-newsgroup-unselected)))
3276 (push article gnus-newsgroup-ancient)))
3277 (forward-line 1)))))))
3279 (defun gnus-summary-update-article-line (article header)
3280 "Update the line for ARTICLE using HEADERS."
3281 (let* ((id (mail-header-id header))
3282 (thread (gnus-id-to-thread id)))
3284 (error "Article in no thread"))
3285 ;; Update the thread.
3286 (setcar thread header)
3287 (gnus-summary-goto-subject article)
3288 (let* ((datal (gnus-data-find-list article))
3290 (length (when (cdr datal)
3291 (- (gnus-data-pos data)
3292 (gnus-data-pos (cadr datal)))))
3293 (buffer-read-only nil)
3294 (level (gnus-summary-thread-level)))
3296 (gnus-summary-insert-line
3297 header level nil (gnus-article-mark article)
3298 (memq article gnus-newsgroup-replied)
3299 (memq article gnus-newsgroup-expirable)
3300 ;; Only insert the Subject string when it's different
3301 ;; from the previous Subject string.
3302 (if (gnus-subject-equal
3304 (mail-header-subject
3307 (gnus-data-find-list
3309 (gnus-data-list t)))))
3310 ;; Error on the side of excessive subjects.
3312 (mail-header-subject header))
3314 (mail-header-subject header))
3315 nil (cdr (assq article gnus-newsgroup-scored))
3316 (memq article gnus-newsgroup-processable))
3318 (gnus-data-update-list
3319 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3321 (defun gnus-summary-update-article (article &optional iheader)
3322 "Update ARTICLE in the summary buffer."
3323 (set-buffer gnus-summary-buffer)
3324 (let* ((header (gnus-summary-article-header article))
3325 (id (mail-header-id header))
3326 (data (gnus-data-find article))
3327 (thread (gnus-id-to-thread id))
3328 (references (mail-header-references header))
3332 (when (and references
3333 (not (equal "" references)))
3336 (buffer-read-only nil)
3342 (delq thread parent)))
3343 (if (gnus-summary-insert-subject id header)
3344 ;; Set the (possibly) new article number in the data structure.
3345 (gnus-data-set-number data (gnus-id-to-article id))
3349 (defun gnus-rebuild-thread (id &optional line)
3350 "Rebuild the thread containing ID.
3351 If LINE, insert the rebuilt thread starting on line LINE."
3352 (let ((buffer-read-only nil)
3353 old-pos current thread data)
3354 (if (not gnus-show-threads)
3355 (setq thread (list (car (gnus-id-to-thread id))))
3356 ;; Get the thread this article is part of.
3357 (setq thread (gnus-remove-thread id)))
3358 (setq old-pos (gnus-point-at-bol))
3359 (setq current (save-excursion
3360 (and (zerop (forward-line -1))
3361 (gnus-summary-article-number))))
3362 ;; If this is a gathered thread, we have to go some re-gathering.
3363 (when (stringp (car thread))
3364 (let ((subject (car thread))
3366 (setq thread (cdr thread))
3368 (unless (memq (setq thr (gnus-id-to-thread
3370 (mail-header-id (caar thread)))))
3373 (setq thread (cdr thread)))
3374 ;; We now have all (unique) roots.
3375 (if (= (length roots) 1)
3376 ;; All the loose roots are now one solid root.
3377 (setq thread (car roots))
3378 (setq thread (cons subject (gnus-sort-threads roots))))))
3380 ;; We then insert this thread into the summary buffer.
3382 (goto-char (point-min))
3383 (forward-line (1- line)))
3384 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3385 (if gnus-show-threads
3386 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3387 (gnus-summary-prepare-unthreaded thread))
3388 (setq data (nreverse gnus-newsgroup-data))
3389 (setq threads gnus-newsgroup-threads))
3390 ;; We splice the new data into the data structure.
3391 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3392 ;;!!! then we want to insert at the beginning of the buffer.
3393 ;;!!! That happens to be true with Gnus now, but that may
3394 ;;!!! change in the future. Perhaps.
3395 (gnus-data-enter-list
3396 (if line nil current) data (- (point) old-pos))
3397 (setq gnus-newsgroup-threads
3398 (nconc threads gnus-newsgroup-threads))
3399 (gnus-data-compute-positions))))
3401 (defun gnus-number-to-header (number)
3402 "Return the header for article NUMBER."
3403 (let ((headers gnus-newsgroup-headers))
3405 (not (= number (mail-header-number (car headers)))))
3410 (defun gnus-parent-headers (in-headers &optional generation)
3411 "Return the headers of the GENERATIONeth parent of HEADERS."
3413 (setq generation 1))
3415 (headers in-headers)
3418 (not (zerop generation))
3419 (setq references (mail-header-references headers)))
3420 (setq headers (if (and references
3421 (setq parent (gnus-parent-id references)))
3422 (car (gnus-id-to-thread parent))
3425 (and (not (eq headers in-headers))
3428 (defun gnus-id-to-thread (id)
3429 "Return the (sub-)thread where ID appears."
3430 (gnus-gethash id gnus-newsgroup-dependencies))
3432 (defun gnus-id-to-article (id)
3433 "Return the article number of ID."
3434 (let ((thread (gnus-id-to-thread id)))
3437 (mail-header-number (car thread)))))
3439 (defun gnus-id-to-header (id)
3440 "Return the article headers of ID."
3441 (car (gnus-id-to-thread id)))
3443 (defun gnus-article-displayed-root-p (article)
3444 "Say whether ARTICLE is a root(ish) article."
3445 (let ((level (gnus-summary-thread-level article))
3446 (refs (mail-header-references (gnus-summary-article-header article)))
3452 ((null (gnus-parent-id refs)) t)
3454 (null (setq particle (gnus-id-to-article
3455 (gnus-parent-id refs))))
3456 (null (gnus-summary-thread-level particle)))))))
3458 (defun gnus-root-id (id)
3459 "Return the id of the root of the thread where ID appears."
3461 (while (and id (setq prev (car (gnus-id-to-thread id))))
3463 id (gnus-parent-id (mail-header-references prev))))
3466 (defun gnus-articles-in-thread (thread)
3467 "Return the list of articles in THREAD."
3468 (cons (mail-header-number (car thread))
3469 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3471 (defun gnus-remove-thread (id &optional dont-remove)
3472 "Remove the thread that has ID in it."
3473 (let (headers thread last-id)
3474 ;; First go up in this thread until we find the root.
3475 (setq last-id (gnus-root-id id)
3476 headers (message-flatten-list (gnus-id-to-thread last-id)))
3477 ;; We have now found the real root of this thread. It might have
3478 ;; been gathered into some loose thread, so we have to search
3479 ;; through the threads to find the thread we wanted.
3480 (let ((threads gnus-newsgroup-threads)
3483 (setq sub (car threads))
3484 (if (stringp (car sub))
3485 ;; This is a gathered thread, so we look at the roots
3486 ;; below it to find whether this article is in this
3489 (setq sub (cdr sub))
3491 (when (member (caar sub) headers)
3492 (setq thread (car threads)
3495 (setq sub (cdr sub))))
3496 ;; It's an ordinary thread, so we check it.
3497 (when (eq (car sub) (car headers))
3500 (setq threads (cdr threads)))
3501 ;; If this article is in no thread, then it's a root.
3504 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3505 (setq thread (gnus-id-to-thread last-id)))
3508 thread ; We return this thread.
3510 (if (stringp (car thread))
3512 ;; If we use dummy roots, then we have to remove the
3513 ;; dummy root as well.
3514 (when (eq gnus-summary-make-false-root 'dummy)
3515 ;; We go to the dummy root by going to
3516 ;; the first sub-"thread", and then one line up.
3517 (gnus-summary-goto-article
3518 (mail-header-number (caadr thread)))
3521 (gnus-data-compute-positions))
3522 (setq thread (cdr thread))
3524 (gnus-remove-thread-1 (car thread))
3525 (setq thread (cdr thread))))
3526 (gnus-summary-show-all-threads)
3527 (gnus-remove-thread-1 thread))))))))
3529 (defun gnus-remove-thread-1 (thread)
3530 "Remove the thread THREAD recursively."
3531 (let ((number (mail-header-number (pop thread)))
3533 (setq thread (reverse thread))
3535 (gnus-remove-thread-1 (pop thread)))
3536 (when (setq d (gnus-data-find number))
3537 (goto-char (gnus-data-pos d))
3540 (- (gnus-point-at-bol)
3542 (1+ (gnus-point-at-eol))
3543 (gnus-delete-line)))))))
3545 (defun gnus-sort-threads (threads)
3547 (if (not gnus-thread-sort-functions)
3549 (gnus-message 8 "Sorting threads...")
3551 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3552 (gnus-message 8 "Sorting threads...done"))))
3554 (defun gnus-sort-articles (articles)
3556 (when gnus-article-sort-functions
3557 (gnus-message 7 "Sorting articles...")
3559 (setq gnus-newsgroup-headers
3560 (sort articles (gnus-make-sort-function
3561 gnus-article-sort-functions)))
3562 (gnus-message 7 "Sorting articles...done"))))
3564 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3565 (defmacro gnus-thread-header (thread)
3566 ;; Return header of first article in THREAD.
3567 ;; Note that THREAD must never, ever be anything else than a variable -
3568 ;; using some other form will lead to serious barfage.
3569 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3570 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3571 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3574 (defsubst gnus-article-sort-by-number (h1 h2)
3575 "Sort articles by article number."
3576 (< (mail-header-number h1)
3577 (mail-header-number h2)))
3579 (defun gnus-thread-sort-by-number (h1 h2)
3580 "Sort threads by root article number."
3581 (gnus-article-sort-by-number
3582 (gnus-thread-header h1) (gnus-thread-header h2)))
3584 (defsubst gnus-article-sort-by-lines (h1 h2)
3585 "Sort articles by article Lines header."
3586 (< (mail-header-lines h1)
3587 (mail-header-lines h2)))
3589 (defun gnus-thread-sort-by-lines (h1 h2)
3590 "Sort threads by root article Lines header."
3591 (gnus-article-sort-by-lines
3592 (gnus-thread-header h1) (gnus-thread-header h2)))
3594 (defsubst gnus-article-sort-by-chars (h1 h2)
3595 "Sort articles by octet length."
3596 (< (mail-header-chars h1)
3597 (mail-header-chars h2)))
3599 (defun gnus-thread-sort-by-chars (h1 h2)
3600 "Sort threads by root article octet length."
3601 (gnus-article-sort-by-chars
3602 (gnus-thread-header h1) (gnus-thread-header h2)))
3604 (defsubst gnus-article-sort-by-author (h1 h2)
3605 "Sort articles by root author."
3607 (let ((extract (funcall
3608 gnus-extract-address-components
3609 (mail-header-from h1))))
3610 (or (car extract) (cadr extract) ""))
3611 (let ((extract (funcall
3612 gnus-extract-address-components
3613 (mail-header-from h2))))
3614 (or (car extract) (cadr extract) ""))))
3616 (defun gnus-thread-sort-by-author (h1 h2)
3617 "Sort threads by root author."
3618 (gnus-article-sort-by-author
3619 (gnus-thread-header h1) (gnus-thread-header h2)))
3621 (defsubst gnus-article-sort-by-subject (h1 h2)
3622 "Sort articles by root subject."
3624 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3625 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3627 (defun gnus-thread-sort-by-subject (h1 h2)
3628 "Sort threads by root subject."
3629 (gnus-article-sort-by-subject
3630 (gnus-thread-header h1) (gnus-thread-header h2)))
3632 (defsubst gnus-article-sort-by-date (h1 h2)
3633 "Sort articles by root article date."
3635 (gnus-date-get-time (mail-header-date h1))
3636 (gnus-date-get-time (mail-header-date h2))))
3638 (defun gnus-thread-sort-by-date (h1 h2)
3639 "Sort threads by root article date."
3640 (gnus-article-sort-by-date
3641 (gnus-thread-header h1) (gnus-thread-header h2)))
3643 (defsubst gnus-article-sort-by-score (h1 h2)
3644 "Sort articles by root article score.
3645 Unscored articles will be counted as having a score of zero."
3646 (> (or (cdr (assq (mail-header-number h1)
3647 gnus-newsgroup-scored))
3648 gnus-summary-default-score 0)
3649 (or (cdr (assq (mail-header-number h2)
3650 gnus-newsgroup-scored))
3651 gnus-summary-default-score 0)))
3653 (defun gnus-thread-sort-by-score (h1 h2)
3654 "Sort threads by root article score."
3655 (gnus-article-sort-by-score
3656 (gnus-thread-header h1) (gnus-thread-header h2)))
3658 (defun gnus-thread-sort-by-total-score (h1 h2)
3659 "Sort threads by the sum of all scores in the thread.
3660 Unscored articles will be counted as having a score of zero."
3661 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3663 (defun gnus-thread-total-score (thread)
3664 ;; This function find the total score of THREAD.
3665 (cond ((null thread)
3668 (if (stringp (car thread))
3669 (apply gnus-thread-score-function 0
3670 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3671 (gnus-thread-total-score-1 thread)))
3673 (gnus-thread-total-score-1 (list thread)))))
3675 (defun gnus-thread-total-score-1 (root)
3676 ;; This function find the total score of the thread below ROOT.
3677 (setq root (car root))
3678 (apply gnus-thread-score-function
3680 (mapcar 'gnus-thread-total-score
3681 (cdr (gnus-id-to-thread (mail-header-id root))))
3682 (when (> (mail-header-number root) 0)
3683 (list (or (cdr (assq (mail-header-number root)
3684 gnus-newsgroup-scored))
3685 gnus-summary-default-score 0))))
3686 (list gnus-summary-default-score)
3689 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3690 (defvar gnus-tmp-prev-subject nil)
3691 (defvar gnus-tmp-false-parent nil)
3692 (defvar gnus-tmp-root-expunged nil)
3693 (defvar gnus-tmp-dummy-line nil)
3695 (defvar gnus-tmp-header)
3696 (defun gnus-extra-header (type &optional header)
3697 "Return the extra header of TYPE."
3698 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3701 (defun gnus-summary-prepare-threads (threads)
3702 "Prepare summary buffer from THREADS and indentation LEVEL.
3703 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3704 or a straight list of headers."
3705 (gnus-message 7 "Generating summary...")
3707 (setq gnus-newsgroup-threads threads)
3710 (let ((gnus-tmp-level 0)
3711 (default-score (or gnus-summary-default-score 0))
3712 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3713 thread number subject stack state gnus-tmp-gathered beg-match
3714 new-roots gnus-tmp-new-adopts thread-end
3715 gnus-tmp-header gnus-tmp-unread
3716 gnus-tmp-replied gnus-tmp-subject-or-nil
3717 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3718 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3719 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3721 (setq gnus-tmp-prev-subject nil)
3723 (if (vectorp (car threads))
3724 ;; If this is a straight (sic) list of headers, then a
3725 ;; threaded summary display isn't required, so we just create
3726 ;; an unthreaded one.
3727 (gnus-summary-prepare-unthreaded threads)
3729 ;; Do the threaded display.
3731 (while (or threads stack gnus-tmp-new-adopts new-roots)
3733 (if (and (= gnus-tmp-level 0)
3736 (not gnus-tmp-false-parent)
3737 (or gnus-tmp-new-adopts new-roots))
3738 (if gnus-tmp-new-adopts
3739 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3740 thread (list (car gnus-tmp-new-adopts))
3741 gnus-tmp-header (caar thread)
3742 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3744 (setq thread (list (car new-roots))
3745 gnus-tmp-header (caar thread)
3746 new-roots (cdr new-roots))))
3749 ;; If there are some threads, we do them before the
3750 ;; threads on the stack.
3751 (setq thread threads
3752 gnus-tmp-header (caar thread))
3753 ;; There were no current threads, so we pop something off
3755 (setq state (car stack)
3756 gnus-tmp-level (car state)
3759 gnus-tmp-header (caar thread))))
3761 (setq gnus-tmp-false-parent nil)
3762 (setq gnus-tmp-root-expunged nil)
3763 (setq thread-end nil)
3765 (if (stringp gnus-tmp-header)
3766 ;; The header is a dummy root.
3768 ((eq gnus-summary-make-false-root 'adopt)
3769 ;; We let the first article adopt the rest.
3770 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3772 (setq gnus-tmp-gathered
3774 (lambda (h) (mail-header-number (car h)))
3777 (setq thread (cons (list (caar thread)
3780 (setq gnus-tmp-level -1
3781 gnus-tmp-false-parent t))
3782 ((eq gnus-summary-make-false-root 'empty)
3783 ;; We print adopted articles with empty subject fields.
3784 (setq gnus-tmp-gathered
3786 (lambda (h) (mail-header-number (car h)))
3789 (setq gnus-tmp-level -1))
3790 ((eq gnus-summary-make-false-root 'dummy)
3791 ;; We remember that we probably want to output a dummy
3793 (setq gnus-tmp-dummy-line gnus-tmp-header)
3794 (setq gnus-tmp-prev-subject gnus-tmp-header))
3796 ;; We do not make a root for the gathered
3797 ;; sub-threads at all.
3798 (setq gnus-tmp-level -1)))
3800 (setq number (mail-header-number gnus-tmp-header)
3801 subject (mail-header-subject gnus-tmp-header))
3804 ;; If the thread has changed subject, we might want to make
3805 ;; this subthread into a root.
3806 ((and (null gnus-thread-ignore-subject)
3807 (not (zerop gnus-tmp-level))
3808 gnus-tmp-prev-subject
3810 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3811 (setq new-roots (nconc new-roots (list (car thread)))
3813 gnus-tmp-header nil))
3814 ;; If the article lies outside the current limit,
3815 ;; then we do not display it.
3816 ((not (memq number gnus-newsgroup-limit))
3817 (setq gnus-tmp-gathered
3819 (lambda (h) (mail-header-number (car h)))
3822 (setq gnus-tmp-new-adopts (if (cdar thread)
3823 (append gnus-tmp-new-adopts
3825 gnus-tmp-new-adopts)
3827 gnus-tmp-header nil)
3828 (when (zerop gnus-tmp-level)
3829 (setq gnus-tmp-root-expunged t)))
3830 ;; Perhaps this article is to be marked as read?
3831 ((and gnus-summary-mark-below
3832 (< (or (cdr (assq number gnus-newsgroup-scored))
3834 gnus-summary-mark-below)
3835 ;; Don't touch sparse articles.
3836 (not (gnus-summary-article-sparse-p number))
3837 (not (gnus-summary-article-ancient-p number)))
3838 (setq gnus-newsgroup-unreads
3839 (delq number gnus-newsgroup-unreads))
3840 (if gnus-newsgroup-auto-expire
3841 (push number gnus-newsgroup-expirable)
3842 (push (cons number gnus-low-score-mark)
3843 gnus-newsgroup-reads))))
3845 (when gnus-tmp-header
3846 ;; We may have an old dummy line to output before this
3848 (when (and gnus-tmp-dummy-line
3851 (mail-header-subject gnus-tmp-header)))
3852 (gnus-summary-insert-dummy-line
3853 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3854 (setq gnus-tmp-dummy-line nil))
3856 ;; Compute the mark.
3857 (setq gnus-tmp-unread (gnus-article-mark number))
3859 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3860 gnus-tmp-header gnus-tmp-level)
3861 gnus-newsgroup-data)
3863 ;; Actually insert the line.
3865 gnus-tmp-subject-or-nil
3867 ((and gnus-thread-ignore-subject
3868 gnus-tmp-prev-subject
3869 (not (inline (gnus-subject-equal
3870 gnus-tmp-prev-subject subject))))
3872 ((zerop gnus-tmp-level)
3873 (if (and (eq gnus-summary-make-false-root 'empty)
3874 (memq number gnus-tmp-gathered)
3875 gnus-tmp-prev-subject
3876 (inline (gnus-subject-equal
3877 gnus-tmp-prev-subject subject)))
3878 gnus-summary-same-subject
3880 (t gnus-summary-same-subject)))
3881 (if (and (eq gnus-summary-make-false-root 'adopt)
3882 (= gnus-tmp-level 1)
3883 (memq number gnus-tmp-gathered))
3884 (setq gnus-tmp-opening-bracket ?\<
3885 gnus-tmp-closing-bracket ?\>)
3886 (setq gnus-tmp-opening-bracket ?\[
3887 gnus-tmp-closing-bracket ?\]))
3889 gnus-tmp-indentation
3890 (aref gnus-thread-indent-array gnus-tmp-level)
3891 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3892 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3893 gnus-summary-default-score 0)
3895 (if (or (null gnus-summary-default-score)
3896 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3897 gnus-summary-zcore-fuzz))
3899 (if (< gnus-tmp-score gnus-summary-default-score)
3900 gnus-score-below-mark gnus-score-over-mark))
3902 (cond ((memq number gnus-newsgroup-processable)
3904 ((memq number gnus-newsgroup-cached)
3906 ((memq number gnus-newsgroup-replied)
3908 ((memq number gnus-newsgroup-saved)
3910 (t gnus-unread-mark))
3911 gnus-tmp-from (mail-header-from gnus-tmp-header)
3914 ((string-match "<[^>]+> *$" gnus-tmp-from)
3915 (setq beg-match (match-beginning 0))
3916 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3917 (substring gnus-tmp-from (1+ (match-beginning 0))
3918 (1- (match-end 0))))
3919 (substring gnus-tmp-from 0 beg-match)))
3920 ((string-match "(.+)" gnus-tmp-from)
3921 (substring gnus-tmp-from
3922 (1+ (match-beginning 0)) (1- (match-end 0))))
3924 (when (string= gnus-tmp-name "")
3925 (setq gnus-tmp-name gnus-tmp-from))
3926 (unless (numberp gnus-tmp-lines)
3927 (setq gnus-tmp-lines 0))
3928 (gnus-put-text-property
3930 (progn (eval gnus-summary-line-format-spec) (point))
3931 'gnus-number number)
3934 (gnus-run-hooks 'gnus-summary-update-hook)
3937 (setq gnus-tmp-prev-subject subject)))
3939 (when (nth 1 thread)
3940 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3941 (incf gnus-tmp-level)
3942 (setq threads (if thread-end nil (cdar thread)))
3944 (setq gnus-tmp-level 0)))))
3945 (gnus-message 7 "Generating summary...done"))
3947 (defun gnus-summary-prepare-unthreaded (headers)
3948 "Generate an unthreaded summary buffer based on HEADERS."
3949 (let (header number mark)
3954 ;; We may have to root out some bad articles...
3955 (when (memq (setq number (mail-header-number
3956 (setq header (pop headers))))
3957 gnus-newsgroup-limit)
3958 ;; Mark article as read when it has a low score.
3959 (when (and gnus-summary-mark-below
3960 (< (or (cdr (assq number gnus-newsgroup-scored))
3961 gnus-summary-default-score 0)
3962 gnus-summary-mark-below)
3963 (not (gnus-summary-article-ancient-p number)))
3964 (setq gnus-newsgroup-unreads
3965 (delq number gnus-newsgroup-unreads))
3966 (if gnus-newsgroup-auto-expire
3967 (push number gnus-newsgroup-expirable)
3968 (push (cons number gnus-low-score-mark)
3969 gnus-newsgroup-reads)))
3971 (setq mark (gnus-article-mark number))
3972 (push (gnus-data-make number mark (1+ (point)) header 0)
3973 gnus-newsgroup-data)
3974 (gnus-summary-insert-line
3976 mark (memq number gnus-newsgroup-replied)
3977 (memq number gnus-newsgroup-expirable)
3978 (mail-header-subject header) nil
3979 (cdr (assq number gnus-newsgroup-scored))
3980 (memq number gnus-newsgroup-processable))))))
3982 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3983 "Select newsgroup GROUP.
3984 If READ-ALL is non-nil, all articles in the group are selected.
3985 If SELECT-ARTICLES, only select those articles from GROUP."
3986 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3987 ;;!!! Dirty hack; should be removed.
3988 (gnus-summary-ignore-duplicates
3989 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3991 gnus-summary-ignore-duplicates))
3992 (info (nth 2 entry))
3993 articles fetched-articles cached)
3995 (unless (gnus-check-server
3996 (setq gnus-current-select-method
3997 (gnus-find-method-for-group group)))
3998 (error "Couldn't open server"))
4000 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4001 (gnus-activate-group group) ; Or we can activate it...
4002 (progn ; Or we bug out.
4003 (when (equal major-mode 'gnus-summary-mode)
4004 (kill-buffer (current-buffer)))
4005 (error "Couldn't request group %s: %s"
4006 group (gnus-status-message group))))
4008 (unless (gnus-request-group group t)
4009 (when (equal major-mode 'gnus-summary-mode)
4010 (kill-buffer (current-buffer)))
4011 (error "Couldn't request group %s: %s"
4012 group (gnus-status-message group)))
4014 (setq gnus-newsgroup-name group)
4015 (setq gnus-newsgroup-unselected nil)
4016 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4017 (gnus-summary-setup-default-charset)
4019 ;; Adjust and set lists of article marks.
4021 (gnus-adjust-marked-articles info))
4023 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4024 (when (gnus-virtual-group-p group)
4025 (setq cached gnus-newsgroup-cached))
4027 (setq gnus-newsgroup-unreads
4028 (gnus-set-difference
4029 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4030 gnus-newsgroup-dormant))
4032 (setq gnus-newsgroup-processable nil)
4034 (gnus-update-read-articles group gnus-newsgroup-unreads)
4036 (if (setq articles select-articles)
4037 (setq gnus-newsgroup-unselected
4038 (gnus-sorted-intersection
4039 gnus-newsgroup-unreads
4040 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4041 (setq articles (gnus-articles-to-read group read-all)))
4045 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4047 ((eq articles 0) nil)
4049 ;; Init the dependencies hash table.
4050 (setq gnus-newsgroup-dependencies
4051 (gnus-make-hashtable (length articles)))
4052 (gnus-set-global-variables)
4053 ;; Retrieve the headers and read them in.
4054 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4055 (setq gnus-newsgroup-headers
4057 (setq gnus-headers-retrieved-by
4058 (gnus-retrieve-headers
4059 articles gnus-newsgroup-name
4060 ;; We might want to fetch old headers, but
4061 ;; not if there is only 1 article.
4063 (not (eq gnus-fetch-old-headers 'some))
4064 (not (numberp gnus-fetch-old-headers)))
4065 (> (length articles) 1))
4066 gnus-fetch-old-headers))))
4067 (gnus-get-newsgroup-headers-xover
4068 articles nil nil gnus-newsgroup-name t)
4069 (gnus-get-newsgroup-headers)))
4070 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4072 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4074 (setq gnus-newsgroup-cached cached))
4076 ;; Suppress duplicates?
4077 (when gnus-suppress-duplicates
4078 (gnus-dup-suppress-articles))
4080 ;; Set the initial limit.
4081 (setq gnus-newsgroup-limit (copy-sequence articles))
4082 ;; Remove canceled articles from the list of unread articles.
4083 (setq gnus-newsgroup-unreads
4084 (gnus-set-sorted-intersection
4085 gnus-newsgroup-unreads
4086 (setq fetched-articles
4087 (mapcar (lambda (headers) (mail-header-number headers))
4088 gnus-newsgroup-headers))))
4089 ;; Removed marked articles that do not exist.
4090 (gnus-update-missing-marks
4091 (gnus-sorted-complement fetched-articles articles))
4092 ;; We might want to build some more threads first.
4093 (when (and gnus-fetch-old-headers
4094 (eq gnus-headers-retrieved-by 'nov))
4095 (if (eq gnus-fetch-old-headers 'invisible)
4096 (gnus-build-all-threads)
4097 (gnus-build-old-threads)))
4098 ;; Let the Gnus agent mark articles as read.
4100 (gnus-agent-get-undownloaded-list))
4101 ;; Check whether auto-expire is to be done in this group.
4102 (setq gnus-newsgroup-auto-expire
4103 (gnus-group-auto-expirable-p group))
4104 ;; Set up the article buffer now, if necessary.
4105 (unless gnus-single-article-buffer
4106 (gnus-article-setup-buffer))
4107 ;; First and last article in this newsgroup.
4108 (when gnus-newsgroup-headers
4109 (setq gnus-newsgroup-begin
4110 (mail-header-number (car gnus-newsgroup-headers))
4113 (gnus-last-element gnus-newsgroup-headers))))
4114 ;; GROUP is successfully selected.
4115 (or gnus-newsgroup-headers t)))))
4117 (defun gnus-articles-to-read (group &optional read-all)
4118 ;; Find out what articles the user wants to read.
4120 ;; Select all articles if `read-all' is non-nil, or if there
4121 ;; are no unread articles.
4123 (and (zerop (length gnus-newsgroup-marked))
4124 (zerop (length gnus-newsgroup-unreads)))
4125 (eq (gnus-group-find-parameter group 'display)
4127 (gnus-uncompress-range (gnus-active group))
4128 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4129 (copy-sequence gnus-newsgroup-unreads))
4131 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4132 (scored (length scored-list))
4133 (number (length articles))
4134 (marked (+ (length gnus-newsgroup-marked)
4135 (length gnus-newsgroup-dormant)))
4143 ((and (or (<= scored marked) (= scored number))
4144 (numberp gnus-large-newsgroup)
4145 (> number gnus-large-newsgroup))
4149 "How many articles from %s (default %d): "
4150 (gnus-limit-string gnus-newsgroup-name 35)
4152 (if (string-match "^[ \t]*$" input) number input)))
4153 ((and (> scored marked) (< scored number)
4154 (> (- scored number) 20))
4157 (format "%s %s (%d scored, %d total): "
4158 "How many articles from"
4159 group scored number))))
4160 (if (string-match "^[ \t]*$" input)
4164 (setq select (if (stringp select) (string-to-number select) select))
4165 (if (or (null select) (zerop select))
4167 (if (and (not (zerop scored)) (<= (abs select) scored))
4169 (setq articles (sort scored-list '<))
4170 (setq number (length articles)))
4171 (setq articles (copy-sequence articles)))
4173 (when (< (abs select) number)
4175 ;; Select the N oldest articles.
4176 (setcdr (nthcdr (1- (abs select)) articles) nil)
4177 ;; Select the N most recent articles.
4178 (setq articles (nthcdr (- number select) articles))))
4179 (setq gnus-newsgroup-unselected
4180 (gnus-sorted-intersection
4181 gnus-newsgroup-unreads
4182 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4185 (defun gnus-killed-articles (killed articles)
4188 (when (inline (gnus-member-of-range (car articles) killed))
4189 (push (car articles) out))
4190 (setq articles (cdr articles)))
4193 (defun gnus-uncompress-marks (marks)
4194 "Uncompress the mark ranges in MARKS."
4195 (let ((uncompressed '(score bookmark))
4198 (if (memq (caar marks) uncompressed)
4199 (push (car marks) out)
4200 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4201 (setq marks (cdr marks)))
4204 (defun gnus-adjust-marked-articles (info)
4205 "Set all article lists and remove all marks that are no longer valid."
4206 (let* ((marked-lists (gnus-info-marks info))
4207 (active (gnus-active (gnus-info-group info)))
4210 (types gnus-article-mark-lists)
4211 (uncompressed '(score bookmark killed))
4212 marks var articles article mark)
4215 (setq marks (pop marked-lists))
4216 (set (setq var (intern (format "gnus-newsgroup-%s"
4217 (car (rassq (setq mark (car marks))
4219 (if (memq (car marks) uncompressed) (cdr marks)
4220 (gnus-uncompress-range (cdr marks))))
4222 (setq articles (symbol-value var))
4224 ;; All articles have to be subsets of the active articles.
4226 ;; Adjust "simple" lists.
4227 ((memq mark '(tick dormant expire reply save))
4229 (when (or (< (setq article (pop articles)) min) (> article max))
4230 (set var (delq article (symbol-value var))))))
4232 ((memq mark uncompressed)
4233 (when (not (listp (cdr (symbol-value var))))
4234 (set var (list (symbol-value var))))
4235 (when (not (listp (cdr articles)))
4236 (setq articles (list articles)))
4238 (when (or (not (consp (setq article (pop articles))))
4239 (< (car article) min)
4240 (> (car article) max))
4241 (set var (delq article (symbol-value var))))))))))
4243 (defun gnus-update-missing-marks (missing)
4244 "Go through the list of MISSING articles and remove them from the mark lists."
4246 (let ((types gnus-article-mark-lists)
4248 ;; Go through all types.
4250 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4251 (when (symbol-value var)
4252 ;; This list has articles. So we delete all missing articles
4256 (set var (delq (pop m) (symbol-value var)))))))))
4258 (defun gnus-update-marks ()
4259 "Enter the various lists of marked articles into the newsgroup info list."
4260 (let ((types gnus-article-mark-lists)
4261 (info (gnus-get-info gnus-newsgroup-name))
4262 (uncompressed '(score bookmark killed))
4263 type list newmarked symbol delta-marks)
4265 ;; Add all marks lists that are non-nil to the list of marks lists.
4266 (while (setq type (pop types))
4267 (when (setq list (symbol-value
4269 (intern (format "gnus-newsgroup-%s"
4272 ;; Get rid of the entries of the articles that have the
4274 (when (and (eq (cdr type) 'score)
4278 (prev (cons nil list))
4281 (if (or (not (consp (car arts)))
4282 (= (cdar arts) gnus-summary-default-score))
4283 (setcdr prev (cdr arts))
4285 (setq arts (cdr arts)))
4286 (setq list (cdr all))))
4288 (when (gnus-check-backend-function 'request-set-mark
4289 gnus-newsgroup-name)
4290 ;; score & bookmark are not proper flags (they are cons cells)
4291 ;; cache is a internal gnus flag
4292 (unless (memq (cdr type) '(cache score bookmark))
4293 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4294 (del (gnus-remove-from-range old list))
4295 (add (gnus-remove-from-range list old)))
4297 (push (list add 'add (list (cdr type))) delta-marks))
4299 (push (list del 'del (list (cdr type))) delta-marks)))))
4301 (push (cons (cdr type)
4302 (if (memq (cdr type) uncompressed) list
4303 (gnus-compress-sequence
4304 (set symbol (sort list '<)) t)))
4308 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4310 ;; Enter these new marks into the info of the group.
4312 (setcar (nthcdr 3 info) newmarked)
4313 ;; Add the marks lists to the end of the info.
4315 (setcdr (nthcdr 2 info) (list newmarked))))
4317 ;; Cut off the end of the info if there's nothing else there.
4321 (when (nthcdr (decf i) info)
4322 (setcdr (nthcdr i info) nil)))))))
4324 (defun gnus-set-mode-line (where)
4325 "This function sets the mode line of the article or summary buffers.
4326 If WHERE is `summary', the summary mode line format will be used."
4327 ;; Is this mode line one we keep updated?
4328 (when (and (memq where gnus-updated-mode-lines)
4330 (intern (format "gnus-%s-mode-line-format-spec" where))))
4333 ;; We evaluate this in the summary buffer since these
4334 ;; variables are buffer-local to that buffer.
4335 (set-buffer gnus-summary-buffer)
4336 ;; We bind all these variables that are used in the `eval' form
4338 (let* ((mformat (symbol-value
4340 (format "gnus-%s-mode-line-format-spec" where))))
4341 (gnus-tmp-group-name gnus-newsgroup-name)
4342 (gnus-tmp-article-number (or gnus-current-article 0))
4343 (gnus-tmp-unread gnus-newsgroup-unreads)
4344 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4345 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4346 (gnus-tmp-unread-and-unselected
4347 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4348 (zerop gnus-tmp-unselected))
4350 ((zerop gnus-tmp-unselected)
4351 (format "{%d more}" gnus-tmp-unread-and-unticked))
4352 (t (format "{%d(+%d) more}"
4353 gnus-tmp-unread-and-unticked
4354 gnus-tmp-unselected))))
4356 (if (and gnus-current-headers
4357 (vectorp gnus-current-headers))
4358 (gnus-mode-string-quote
4359 (mail-header-subject gnus-current-headers))
4361 bufname-length max-len
4362 gnus-tmp-header);; passed as argument to any user-format-funcs
4363 (setq mode-string (eval mformat))
4364 (setq bufname-length (if (string-match "%b" mode-string)
4367 (if (eq where 'summary)
4369 (get-buffer gnus-article-buffer))))
4372 (setq max-len (max 4 (if gnus-mode-non-string-length
4374 gnus-mode-non-string-length
4376 (length mode-string))))
4377 ;; We might have to chop a bit of the string off...
4378 (when (> (length mode-string) max-len)
4380 (concat (truncate-string-to-width mode-string (- max-len 3))
4382 ;; Pad the mode string a bit.
4383 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4384 ;; Update the mode line.
4385 (setq mode-line-buffer-identification
4386 (gnus-mode-line-buffer-identification (list mode-string)))
4387 (set-buffer-modified-p t))))
4389 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4390 "Go through the HEADERS list and add all Xrefs to a hash table.
4391 The resulting hash table is returned, or nil if no Xrefs were found."
4392 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4393 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4394 (xref-hashtb (gnus-make-hashtable))
4395 start group entry number xrefs header)
4397 (setq header (pop headers))
4398 (when (and (setq xrefs (mail-header-xref header))
4399 (not (memq (setq number (mail-header-number header))
4402 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4403 (setq start (match-end 0))
4404 (setq group (if prefix
4405 (concat prefix (substring xrefs (match-beginning 1)
4407 (substring xrefs (match-beginning 1) (match-end 1))))
4409 (string-to-int (substring xrefs (match-beginning 2)
4411 (if (setq entry (gnus-gethash group xref-hashtb))
4412 (setcdr entry (cons number (cdr entry)))
4413 (gnus-sethash group (cons number nil) xref-hashtb)))))
4414 (and start xref-hashtb)))
4416 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4417 "Look through all the headers and mark the Xrefs as read."
4418 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4419 name entry info xref-hashtb idlist method nth4)
4421 (set-buffer gnus-group-buffer)
4422 (when (setq xref-hashtb
4423 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4426 (unless (string= from-newsgroup (setq name (symbol-name group)))
4427 (setq idlist (symbol-value group))
4428 ;; Dead groups are not updated.
4430 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4432 (when (stringp (setq nth4 (gnus-info-method info)))
4433 (setq nth4 (gnus-server-to-method nth4))))
4434 ;; Only do the xrefs if the group has the same
4435 ;; select method as the group we have just read.
4436 (or (gnus-methods-equal-p
4437 nth4 (gnus-find-method-for-group from-newsgroup))
4439 (equal nth4 (setq method (gnus-find-method-for-group
4441 (and (equal (car nth4) (car method))
4442 (equal (nth 1 nth4) (nth 1 method))))
4443 gnus-use-cross-reference
4444 (or (not (eq gnus-use-cross-reference t))
4446 ;; Only do cross-references on subscribed
4447 ;; groups, if that is what is wanted.
4448 (<= (gnus-info-level info) gnus-level-subscribed))
4449 (gnus-group-make-articles-read name idlist))))
4452 (defun gnus-compute-read-articles (group articles)
4453 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4454 (info (nth 2 entry))
4455 (active (gnus-active group))
4458 ;; First peel off all invalid article numbers.
4460 (let ((ids articles)
4462 (while (setq id (pop ids))
4463 (when (and first (> id (cdr active)))
4464 ;; We'll end up in this situation in one particular
4465 ;; obscure situation. If you re-scan a group and get
4466 ;; a new article that is cross-posted to a different
4467 ;; group that has not been re-scanned, you might get
4468 ;; crossposted article that has a higher number than
4469 ;; Gnus believes possible. So we re-activate this
4470 ;; group as well. This might mean doing the
4471 ;; crossposting thingy will *increase* the number
4472 ;; of articles in some groups. Tsk, tsk.
4473 (setq active (or (gnus-activate-group group) active)))
4474 (when (or (> id (cdr active))
4475 (< id (car active)))
4476 (setq articles (delq id articles))))))
4477 ;; If the read list is nil, we init it.
4479 (null (gnus-info-read info))
4481 (setq ninfo (cons 1 (1- (car active))))
4482 (setq ninfo (gnus-info-read info)))
4483 ;; Then we add the read articles to the range.
4485 ninfo (setq articles (sort articles '<))))))
4487 (defun gnus-group-make-articles-read (group articles)
4488 "Update the info of GROUP to say that ARTICLES are read."
4490 (entry (gnus-gethash group gnus-newsrc-hashtb))
4491 (info (nth 2 entry))
4492 (active (gnus-active group))
4495 (setq range (gnus-compute-read-articles group articles))
4497 (set-buffer gnus-group-buffer)
4500 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4501 (gnus-info-set-read ',info ',(gnus-info-read info))
4502 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4503 (gnus-group-update-group ,group t))))
4504 ;; Add the read articles to the range.
4505 (gnus-info-set-read info range)
4506 ;; Then we have to re-compute how many unread
4507 ;; articles there are in this group.
4511 (setq num (- (1+ (cdr active)) (car active))))
4512 ((not (listp (cdr range)))
4513 (setq num (- (cdr active) (- (1+ (cdr range))
4517 (if (numberp (car range))
4519 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4520 (setq range (cdr range)))
4521 (setq num (- (cdr active) num))))
4522 ;; Update the number of unread articles.
4524 ;; Update the group buffer.
4525 (gnus-group-update-group group t)))))
4527 (defun gnus-methods-equal-p (m1 m2)
4528 (let ((m1 (or m1 gnus-select-method))
4529 (m2 (or m2 gnus-select-method)))
4531 (and (eq (car m1) (car m2))
4532 (or (not (memq 'address (assoc (symbol-name (car m1))
4533 gnus-valid-select-methods)))
4534 (equal (nth 1 m1) (nth 1 m2)))))))
4536 (defvar gnus-newsgroup-none-id 0)
4538 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4539 (let ((cur nntp-server-buffer)
4542 (save-excursion (set-buffer gnus-summary-buffer)
4543 gnus-newsgroup-dependencies)))
4545 (mail-parse-charset gnus-newsgroup-charset))
4547 (set-buffer nntp-server-buffer)
4548 ;; Translate all TAB characters into SPACE characters.
4549 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4550 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4551 (gnus-run-hooks 'gnus-parse-headers-hook)
4552 (let ((case-fold-search t)
4553 in-reply-to header p lines chars)
4554 (goto-char (point-min))
4555 ;; Search to the beginning of the next header. Error messages
4556 ;; do not begin with 2 or 3.
4557 (while (re-search-forward "^[23][0-9]+ " nil t)
4560 ;; This implementation of this function, with nine
4561 ;; search-forwards instead of the one re-search-forward and
4562 ;; a case (which basically was the old function) is actually
4563 ;; about twice as fast, even though it looks messier. You
4564 ;; can't have everything, I guess. Speed and elegance
4565 ;; doesn't always go hand in hand.
4574 (narrow-to-region (point)
4575 (or (and (search-forward "\n.\n" nil t)
4581 (if (search-forward "\nsubject: " nil t)
4582 (funcall gnus-decode-encoded-word-function
4583 (nnheader-header-value))
4588 (if (search-forward "\nfrom: " nil t)
4589 (funcall gnus-decode-encoded-word-function
4590 (nnheader-header-value))
4595 (if (search-forward "\ndate: " nil t)
4596 (nnheader-header-value) ""))
4600 (setq id (if (re-search-forward
4601 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4602 ;; We do it this way to make sure the Message-ID
4603 ;; is (somewhat) syntactically valid.
4604 (buffer-substring (match-beginning 1)
4606 ;; If there was no message-id, we just fake one
4607 ;; to make subsequent routines simpler.
4608 (nnheader-generate-fake-message-id))))
4612 (if (search-forward "\nreferences: " nil t)
4616 (nnheader-header-value)
4621 (search-backward ">" end t)
4624 (search-backward "<" end t)
4626 ;; Get the references from the in-reply-to header if there
4627 ;; were no references and the in-reply-to header looks
4629 (if (and (search-forward "\nin-reply-to: " nil t)
4630 (setq in-reply-to (nnheader-header-value))
4631 (string-match "<[^>]+>" in-reply-to))
4633 (setq ref (substring in-reply-to (match-beginning 0)
4635 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4636 (setq ref2 (substring in-reply-to (match-beginning 0)
4638 (when (> (length ref2) (length ref))
4645 (if (search-forward "\nchars: " nil t)
4646 (if (numberp (setq chars (ignore-errors (read cur))))
4652 (if (search-forward "\nlines: " nil t)
4653 (if (numberp (setq lines (ignore-errors (read cur))))
4659 (and (search-forward "\nxref: " nil t)
4660 (nnheader-header-value)))
4662 (when gnus-extra-headers
4663 (let ((extra gnus-extra-headers)
4667 (when (search-forward
4668 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4669 (push (cons (car extra) (nnheader-header-value))
4673 (when (equal id ref)
4676 (when gnus-alter-header-function
4677 (funcall gnus-alter-header-function header)
4678 (setq id (mail-header-id header)
4679 ref (gnus-parent-id (mail-header-references header))))
4682 (gnus-dependencies-add-header
4683 header dependencies force-new))
4684 (push header headers))
4685 (goto-char (point-max))
4687 (nreverse headers)))))
4689 ;; Goes through the xover lines and returns a list of vectors
4690 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4691 force-new dependencies
4692 group also-fetch-heads)
4693 "Parse the news overview data in the server buffer, and return a
4694 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4695 ;; Get the Xref when the users reads the articles since most/some
4696 ;; NNTP servers do not include Xrefs when using XOVER.
4697 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4698 (let ((mail-parse-charset gnus-newsgroup-charset)
4699 (cur nntp-server-buffer)
4700 (dependencies (or dependencies gnus-newsgroup-dependencies))
4701 number headers header)
4703 (set-buffer nntp-server-buffer)
4704 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4705 ;; Allow the user to mangle the headers before parsing them.
4706 (gnus-run-hooks 'gnus-parse-headers-hook)
4707 (goto-char (point-min))
4710 (while (and sequence (not (eobp)))
4711 (setq number (read cur))
4712 (while (and sequence
4713 (< (car sequence) number))
4714 (setq sequence (cdr sequence)))
4716 (eq number (car sequence))
4718 (setq sequence (cdr sequence))
4719 (setq header (inline
4720 (gnus-nov-parse-line
4721 number dependencies force-new))))
4722 (push header headers))
4725 (gnus-error 4 "Strange nov line (%d)"
4726 (count-lines (point-min) (point)))))
4728 ;; A common bug in inn is that if you have posted an article and
4729 ;; then retrieves the active file, it will answer correctly --
4730 ;; the new article is included. However, a NOV entry for the
4731 ;; article may not have been generated yet, so this may fail.
4732 ;; We work around this problem by retrieving the last few
4733 ;; headers using HEAD.
4734 (if (or (not also-fetch-heads)
4736 ;; We (probably) got all the headers.
4738 (let ((gnus-nov-is-evil t))
4741 (when (gnus-retrieve-headers sequence group)
4742 (gnus-get-newsgroup-headers))))))))
4744 (defun gnus-article-get-xrefs ()
4745 "Fill in the Xref value in `gnus-current-headers', if necessary.
4746 This is meant to be called in `gnus-article-internal-prepare-hook'."
4747 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4748 gnus-current-headers)))
4749 (or (not gnus-use-cross-reference)
4751 (and (mail-header-xref headers)
4752 (not (string= (mail-header-xref headers) "")))
4753 (let ((case-fold-search t)
4756 (nnheader-narrow-to-headers)
4757 (goto-char (point-min))
4758 (when (or (and (eq (downcase (char-after)) ?x)
4759 (looking-at "Xref:"))
4760 (search-forward "\nXref:" nil t))
4761 (goto-char (1+ (match-end 0)))
4762 (setq xref (buffer-substring (point)
4763 (progn (end-of-line) (point))))
4764 (mail-header-set-xref headers xref)))))))
4766 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4767 "Find article ID and insert the summary line for that article.
4768 OLD-HEADER can either be a header or a line number to insert
4769 the subject line on."
4770 (let* ((line (and (numberp old-header) old-header))
4771 (old-header (and (vectorp old-header) old-header))
4772 (header (cond ((and old-header use-old-header)
4775 (gnus-number-to-header id))
4776 (gnus-number-to-header id))
4778 (gnus-read-header id))))
4779 (number (and (numberp id) id))
4782 ;; Rebuild the thread that this article is part of and go to the
4783 ;; article we have fetched.
4784 (when (and (not gnus-show-threads)
4787 (setq d (gnus-data-find (mail-header-number old-header))))
4788 (goto-char (gnus-data-pos d))
4791 (- (gnus-point-at-bol)
4793 (1+ (gnus-point-at-eol))
4794 (gnus-delete-line))))))
4796 (mail-header-set-number header (mail-header-number old-header)))
4797 (setq gnus-newsgroup-sparse
4798 (delq (setq number (mail-header-number header))
4799 gnus-newsgroup-sparse))
4800 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4801 (push number gnus-newsgroup-limit)
4802 (gnus-rebuild-thread (mail-header-id header) line)
4803 (gnus-summary-goto-subject number nil t))
4804 (when (and (numberp number)
4806 ;; We have to update the boundaries even if we can't fetch the
4807 ;; article if ID is a number -- so that the next `P' or `N'
4808 ;; command will fetch the previous (or next) article even
4809 ;; if the one we tried to fetch this time has been canceled.
4810 (when (> number gnus-newsgroup-end)
4811 (setq gnus-newsgroup-end number))
4812 (when (< number gnus-newsgroup-begin)
4813 (setq gnus-newsgroup-begin number))
4814 (setq gnus-newsgroup-unselected
4815 (delq number gnus-newsgroup-unselected)))
4816 ;; Report back a success?
4817 (and header (mail-header-number header))))
4819 ;;; Process/prefix in the summary buffer
4821 (defun gnus-summary-work-articles (n)
4822 "Return a list of articles to be worked upon.
4823 The prefix argument, the list of process marked articles, and the
4824 current article will be taken into consideration."
4826 (set-buffer gnus-summary-buffer)
4829 ;; A numerical prefix has been given.
4830 (setq n (prefix-numeric-value n))
4831 (let ((backward (< n 0))
4832 (n (abs (prefix-numeric-value n)))
4837 (push (setq article (gnus-summary-article-number))
4840 (gnus-summary-find-prev nil article)
4841 (gnus-summary-find-next nil article)))
4843 (nreverse articles)))
4844 ((and (gnus-region-active-p) (mark))
4845 (message "region active")
4846 ;; Work on the region between point and mark.
4847 (let ((max (max (point) (mark)))
4850 (goto-char (min (min (point) (mark))))
4853 (push (setq article (gnus-summary-article-number)) articles)
4854 (gnus-summary-find-next nil article)
4856 (nreverse articles))))
4857 (gnus-newsgroup-processable
4858 ;; There are process-marked articles present.
4859 ;; Save current state.
4860 (gnus-summary-save-process-mark)
4862 (reverse gnus-newsgroup-processable))
4864 ;; Just return the current article.
4865 (list (gnus-summary-article-number))))))
4867 (defmacro gnus-summary-iterate (arg &rest forms)
4868 "Iterate over the process/prefixed articles and do FORMS.
4869 ARG is the interactive prefix given to the command. FORMS will be
4870 executed with point over the summary line of the articles."
4871 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4872 `(let ((,articles (gnus-summary-work-articles ,arg)))
4874 (gnus-summary-goto-subject (car ,articles))
4877 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4878 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4880 (defun gnus-summary-save-process-mark ()
4881 "Push the current set of process marked articles on the stack."
4883 (push (copy-sequence gnus-newsgroup-processable)
4884 gnus-newsgroup-process-stack))
4886 (defun gnus-summary-kill-process-mark ()
4887 "Push the current set of process marked articles on the stack and unmark."
4889 (gnus-summary-save-process-mark)
4890 (gnus-summary-unmark-all-processable))
4892 (defun gnus-summary-yank-process-mark ()
4893 "Pop the last process mark state off the stack and restore it."
4895 (unless gnus-newsgroup-process-stack
4896 (error "Empty mark stack"))
4897 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4899 (defun gnus-summary-process-mark-set (set)
4900 "Make SET into the current process marked articles."
4901 (gnus-summary-unmark-all-processable)
4903 (gnus-summary-set-process-mark (pop set))))
4905 ;;; Searching and stuff
4907 (defun gnus-summary-search-group (&optional backward use-level)
4908 "Search for next unread newsgroup.
4909 If optional argument BACKWARD is non-nil, search backward instead."
4911 (set-buffer gnus-group-buffer)
4912 (when (gnus-group-search-forward
4913 backward nil (if use-level (gnus-group-group-level) nil))
4914 (gnus-group-group-name))))
4916 (defun gnus-summary-best-group (&optional exclude-group)
4917 "Find the name of the best unread group.
4918 If EXCLUDE-GROUP, do not go to this group."
4920 (set-buffer gnus-group-buffer)
4922 (gnus-group-best-unread-group exclude-group))))
4924 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4925 (if backward (gnus-summary-find-prev)
4926 (let* ((dummy (gnus-summary-article-intangible-p))
4927 (article (or article (gnus-summary-article-number)))
4928 (arts (gnus-data-find-list article))
4930 (when (and (not dummy)
4931 (or (not gnus-summary-check-current)
4933 (not (gnus-data-unread-p (car arts)))))
4934 (setq arts (cdr arts)))
4939 (when (or (and undownloaded
4940 (eq gnus-undownloaded-mark
4941 (gnus-data-mark (car arts))))
4942 (gnus-data-unread-p (car arts)))
4943 (setq result (car arts)
4945 (setq arts (cdr arts)))
4948 (goto-char (gnus-data-pos result))
4949 (gnus-data-number result)))))
4951 (defun gnus-summary-find-prev (&optional unread article)
4952 (let* ((eobp (eobp))
4953 (article (or article (gnus-summary-article-number)))
4954 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4956 (when (and (not eobp)
4957 (or (not gnus-summary-check-current)
4959 (not (gnus-data-unread-p (car arts)))))
4960 (setq arts (cdr arts)))
4965 (when (gnus-data-unread-p (car arts))
4966 (setq result (car arts)
4968 (setq arts (cdr arts)))
4971 (goto-char (gnus-data-pos result))
4972 (gnus-data-number result))))
4974 (defun gnus-summary-find-subject (subject &optional unread backward article)
4975 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4976 (article (or article (gnus-summary-article-number)))
4977 (articles (gnus-data-list backward))
4978 (arts (gnus-data-find-list article articles))
4980 (when (or (not gnus-summary-check-current)
4982 (not (gnus-data-unread-p (car arts))))
4983 (setq arts (cdr arts)))
4985 (and (or (not unread)
4986 (gnus-data-unread-p (car arts)))
4987 (vectorp (gnus-data-header (car arts)))
4989 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4990 (setq result (car arts)
4992 (setq arts (cdr arts)))
4994 (goto-char (gnus-data-pos result))
4995 (gnus-data-number result))))
4997 (defun gnus-summary-search-forward (&optional unread subject backward)
4998 "Search forward for an article.
4999 If UNREAD, look for unread articles. If SUBJECT, look for
5000 articles with that subject. If BACKWARD, search backward instead."
5001 (cond (subject (gnus-summary-find-subject subject unread backward))
5002 (backward (gnus-summary-find-prev unread))
5003 (t (gnus-summary-find-next unread))))
5005 (defun gnus-recenter (&optional n)
5006 "Center point in window and redisplay frame.
5007 Also do horizontal recentering."
5009 (when (and gnus-auto-center-summary
5010 (not (eq gnus-auto-center-summary 'vertical)))
5011 (gnus-horizontal-recenter))
5014 (defun gnus-summary-recenter ()
5015 "Center point in the summary window.
5016 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5017 displayed, no centering will be performed."
5018 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5019 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5020 (let* ((top (cond ((< (window-height) 4) 0)
5021 ((< (window-height) 7) 1)
5022 (t (if (numberp gnus-auto-center-summary)
5023 gnus-auto-center-summary
5025 (height (1- (window-height)))
5026 (bottom (save-excursion (goto-char (point-max))
5027 (forward-line (- height))
5029 (window (get-buffer-window (current-buffer))))
5030 ;; The user has to want it.
5031 (when gnus-auto-center-summary
5032 (when (get-buffer-window gnus-article-buffer)
5033 ;; Only do recentering when the article buffer is displayed,
5034 ;; Set the window start to either `bottom', which is the biggest
5035 ;; possible valid number, or the second line from the top,
5036 ;; whichever is the least.
5038 window (min bottom (save-excursion
5039 (forward-line (- top)) (point)))))
5040 ;; Do horizontal recentering while we're at it.
5041 (when (and (get-buffer-window (current-buffer) t)
5042 (not (eq gnus-auto-center-summary 'vertical)))
5043 (let ((selected (selected-window)))
5044 (select-window (get-buffer-window (current-buffer) t))
5045 (gnus-summary-position-point)
5046 (gnus-horizontal-recenter)
5047 (select-window selected))))))
5049 (defun gnus-summary-jump-to-group (newsgroup)
5050 "Move point to NEWSGROUP in group mode buffer."
5051 ;; Keep update point of group mode buffer if visible.
5052 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5053 (save-window-excursion
5054 ;; Take care of tree window mode.
5055 (when (get-buffer-window gnus-group-buffer)
5056 (pop-to-buffer gnus-group-buffer))
5057 (gnus-group-jump-to-group newsgroup))
5059 ;; Take care of tree window mode.
5060 (if (get-buffer-window gnus-group-buffer)
5061 (pop-to-buffer gnus-group-buffer)
5062 (set-buffer gnus-group-buffer))
5063 (gnus-group-jump-to-group newsgroup))))
5065 ;; This function returns a list of article numbers based on the
5066 ;; difference between the ranges of read articles in this group and
5067 ;; the range of active articles.
5068 (defun gnus-list-of-unread-articles (group)
5069 (let* ((read (gnus-info-read (gnus-get-info group)))
5070 (active (or (gnus-active group) (gnus-activate-group group)))
5073 ;; If none are read, then all are unread.
5075 (setq first (car active))
5076 ;; If the range of read articles is a single range, then the
5077 ;; first unread article is the article after the last read
5078 ;; article. Sounds logical, doesn't it?
5079 (if (not (listp (cdr read)))
5080 (setq first (max (car active) (1+ (cdr read))))
5081 ;; `read' is a list of ranges.
5082 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5085 (setq first (car active)))
5088 (while (< first nlast)
5090 (setq first (1+ first))))
5091 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5092 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5093 (setq read (cdr read)))))
5094 ;; And add the last unread articles.
5095 (while (<= first last)
5097 (setq first (1+ first)))
5098 ;; Return the list of unread articles.
5099 (delq 0 (nreverse unread))))
5101 (defun gnus-list-of-read-articles (group)
5102 "Return a list of unread, unticked and non-dormant articles."
5103 (let* ((info (gnus-get-info group))
5104 (marked (gnus-info-marks info))
5105 (active (gnus-active group)))
5107 (gnus-set-difference
5108 (gnus-sorted-complement
5109 (gnus-uncompress-range active)
5110 (gnus-list-of-unread-articles group))
5112 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5113 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5115 ;; Various summary commands
5117 (defun gnus-summary-select-article-buffer ()
5118 "Reconfigure windows to show article buffer."
5120 (if (not (gnus-buffer-live-p gnus-article-buffer))
5121 (error "There is no article buffer for this summary buffer")
5122 (gnus-configure-windows 'article)
5123 (select-window (get-buffer-window gnus-article-buffer))))
5125 (defun gnus-summary-universal-argument (arg)
5126 "Perform any operation on all articles that are process/prefixed."
5128 (let ((articles (gnus-summary-work-articles arg))
5135 (substitute-command-keys
5136 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5139 (gnus-error 1 "Undefined key")
5142 (gnus-summary-goto-subject (setq article (pop articles)))
5143 (let (gnus-newsgroup-processable)
5144 (command-execute func))
5145 (gnus-summary-remove-process-mark article)))))
5146 (gnus-summary-position-point))
5148 (defun gnus-summary-toggle-truncation (&optional arg)
5149 "Toggle truncation of summary lines.
5150 With arg, turn line truncation on iff arg is positive."
5152 (setq truncate-lines
5153 (if (null arg) (not truncate-lines)
5154 (> (prefix-numeric-value arg) 0)))
5157 (defun gnus-summary-reselect-current-group (&optional all rescan)
5158 "Exit and then reselect the current newsgroup.
5159 The prefix argument ALL means to select all articles."
5161 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5162 (error "Ephemeral groups can't be reselected"))
5163 (let ((current-subject (gnus-summary-article-number))
5164 (group gnus-newsgroup-name))
5165 (setq gnus-newsgroup-begin nil)
5167 ;; We have to adjust the point of group mode buffer because
5168 ;; point was moved to the next unread newsgroup by exiting.
5169 (gnus-summary-jump-to-group group)
5172 (gnus-group-get-new-news-this-group 1)))
5173 (gnus-group-read-group all t)
5174 (gnus-summary-goto-subject current-subject nil t)))
5176 (defun gnus-summary-rescan-group (&optional all)
5177 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5179 (gnus-summary-reselect-current-group all t))
5181 (defun gnus-summary-update-info (&optional non-destructive)
5183 (let ((group gnus-newsgroup-name))
5185 (when gnus-newsgroup-kill-headers
5186 (setq gnus-newsgroup-killed
5187 (gnus-compress-sequence
5189 (gnus-set-sorted-intersection
5190 (gnus-uncompress-range gnus-newsgroup-killed)
5191 (setq gnus-newsgroup-unselected
5192 (sort gnus-newsgroup-unselected '<)))
5193 (setq gnus-newsgroup-unreads
5194 (sort gnus-newsgroup-unreads '<)))
5196 (unless (listp (cdr gnus-newsgroup-killed))
5197 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5198 (let ((headers gnus-newsgroup-headers))
5199 ;; Set the new ranges of read articles.
5201 (set-buffer gnus-group-buffer)
5202 (gnus-undo-force-boundary))
5203 (gnus-update-read-articles
5204 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5205 ;; Set the current article marks.
5206 (let ((gnus-newsgroup-scored
5207 (if (and (not gnus-save-score)
5208 (not non-destructive))
5210 gnus-newsgroup-scored)))
5212 (gnus-update-marks)))
5213 ;; Do the cross-ref thing.
5214 (when gnus-use-cross-reference
5215 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5216 ;; Do not switch windows but change the buffer to work.
5217 (set-buffer gnus-group-buffer)
5218 (unless (gnus-ephemeral-group-p group)
5219 (gnus-group-update-group group)))))))
5221 (defun gnus-summary-save-newsrc (&optional force)
5222 "Save the current number of read/marked articles in the dribble buffer.
5223 The dribble buffer will then be saved.
5224 If FORCE (the prefix), also save the .newsrc file(s)."
5226 (gnus-summary-update-info t)
5228 (gnus-save-newsrc-file)
5229 (gnus-dribble-save)))
5231 (defun gnus-summary-exit (&optional temporary)
5232 "Exit reading current newsgroup, and then return to group selection mode.
5233 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5235 (gnus-set-global-variables)
5236 (when (gnus-buffer-live-p gnus-article-buffer)
5238 (set-buffer gnus-article-buffer)
5239 (mm-destroy-parts gnus-article-mime-handles)))
5240 (gnus-kill-save-kill-buffer)
5241 (gnus-async-halt-prefetch)
5242 (let* ((group gnus-newsgroup-name)
5243 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5246 (buf (current-buffer)))
5248 ;; Do adaptive scoring, and possibly save score files.
5249 (when gnus-newsgroup-adaptive
5250 (gnus-score-adaptive))
5251 (when gnus-use-scoring
5253 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5254 ;; If we have several article buffers, we kill them at exit.
5255 (unless gnus-single-article-buffer
5256 (gnus-kill-buffer gnus-original-article-buffer)
5257 (setq gnus-article-current nil))
5258 (when gnus-use-cache
5259 (gnus-cache-possibly-remove-articles)
5260 (gnus-cache-save-buffers))
5261 (gnus-async-prefetch-remove-group group)
5262 (when gnus-suppress-duplicates
5263 (gnus-dup-enter-articles))
5264 (when gnus-use-trees
5265 (gnus-tree-close group))
5266 ;; Remove entries for this group.
5267 (nnmail-purge-split-history (gnus-group-real-name group))
5268 ;; Make all changes in this group permanent.
5270 (gnus-run-hooks 'gnus-exit-group-hook)
5271 (gnus-summary-update-info))
5272 (gnus-close-group group)
5273 ;; Make sure where we were, and go to next newsgroup.
5274 (set-buffer gnus-group-buffer)
5276 (gnus-group-jump-to-group group))
5277 (gnus-run-hooks 'gnus-summary-exit-hook)
5278 (unless (or quit-config
5279 ;; If this group has disappeared from the summary
5280 ;; buffer, don't skip forwards.
5281 (not (string= group (gnus-group-group-name))))
5282 (gnus-group-next-unread-group 1))
5283 (setq group-point (point))
5286 ;; If we have several article buffers, we kill them at exit.
5287 (unless gnus-single-article-buffer
5288 (gnus-kill-buffer gnus-article-buffer)
5289 (gnus-kill-buffer gnus-original-article-buffer)
5290 (setq gnus-article-current nil))
5292 (if (not gnus-kill-summary-on-exit)
5293 (gnus-deaden-summary)
5294 ;; We set all buffer-local variables to nil. It is unclear why
5295 ;; this is needed, but if we don't, buffer-local variables are
5296 ;; not garbage-collected, it seems. This would the lead to en
5297 ;; ever-growing Emacs.
5298 (gnus-summary-clear-local-variables)
5299 (when (get-buffer gnus-article-buffer)
5300 (bury-buffer gnus-article-buffer))
5301 ;; We clear the global counterparts of the buffer-local
5302 ;; variables as well, just to be on the safe side.
5303 (set-buffer gnus-group-buffer)
5304 (gnus-summary-clear-local-variables)
5305 ;; Return to group mode buffer.
5306 (when (eq mode 'gnus-summary-mode)
5307 (gnus-kill-buffer buf)))
5308 (setq gnus-current-select-method gnus-select-method)
5309 (pop-to-buffer gnus-group-buffer)
5310 (if (not quit-config)
5312 (goto-char group-point)
5313 (gnus-configure-windows 'group 'force))
5314 (gnus-handle-ephemeral-exit quit-config))
5315 ;; Clear the current group name.
5317 (setq gnus-newsgroup-name nil)))))
5319 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5320 (defun gnus-summary-exit-no-update (&optional no-questions)
5321 "Quit reading current newsgroup without updating read article info."
5323 (let* ((group gnus-newsgroup-name)
5324 (quit-config (gnus-group-quit-config group)))
5325 (when (or no-questions
5327 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5328 (gnus-async-halt-prefetch)
5330 (delq 'gnus-summary-expire-articles
5331 (copy-list gnus-summary-prepare-exit-hook)))
5332 (when (gnus-buffer-live-p gnus-article-buffer)
5334 (set-buffer gnus-article-buffer)
5335 (mm-destroy-parts gnus-article-mime-handles)))
5336 ;; If we have several article buffers, we kill them at exit.
5337 (unless gnus-single-article-buffer
5338 (gnus-kill-buffer gnus-article-buffer)
5339 (gnus-kill-buffer gnus-original-article-buffer)
5340 (setq gnus-article-current nil))
5341 (if (not gnus-kill-summary-on-exit)
5342 (gnus-deaden-summary)
5343 (gnus-close-group group)
5344 (gnus-summary-clear-local-variables)
5345 (set-buffer gnus-group-buffer)
5346 (gnus-summary-clear-local-variables)
5347 (when (get-buffer gnus-summary-buffer)
5348 (kill-buffer gnus-summary-buffer)))
5349 (unless gnus-single-article-buffer
5350 (setq gnus-article-current nil))
5351 (when gnus-use-trees
5352 (gnus-tree-close group))
5353 (gnus-async-prefetch-remove-group group)
5354 (when (get-buffer gnus-article-buffer)
5355 (bury-buffer gnus-article-buffer))
5356 ;; Return to the group buffer.
5357 (gnus-configure-windows 'group 'force)
5358 ;; Clear the current group name.
5359 (setq gnus-newsgroup-name nil)
5360 (when (equal (gnus-group-group-name) group)
5361 (gnus-group-next-unread-group 1))
5363 (gnus-handle-ephemeral-exit quit-config)))))
5365 (defun gnus-handle-ephemeral-exit (quit-config)
5366 "Handle movement when leaving an ephemeral group.
5367 The state which existed when entering the ephemeral is reset."
5368 (if (not (buffer-name (car quit-config)))
5369 (gnus-configure-windows 'group 'force)
5370 (set-buffer (car quit-config))
5371 (cond ((eq major-mode 'gnus-summary-mode)
5372 (gnus-set-global-variables))
5373 ((eq major-mode 'gnus-article-mode)
5375 ;; The `gnus-summary-buffer' variable may point
5376 ;; to the old summary buffer when using a single
5378 (unless (gnus-buffer-live-p gnus-summary-buffer)
5379 (set-buffer gnus-group-buffer))
5380 (set-buffer gnus-summary-buffer)
5381 (gnus-set-global-variables))))
5382 (if (or (eq (cdr quit-config) 'article)
5383 (eq (cdr quit-config) 'pick))
5385 ;; The current article may be from the ephemeral group
5386 ;; thus it is best that we reload this article
5387 (gnus-summary-show-article)
5388 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5389 (gnus-configure-windows 'pick 'force)
5390 (gnus-configure-windows (cdr quit-config) 'force)))
5391 (gnus-configure-windows (cdr quit-config) 'force))
5392 (when (eq major-mode 'gnus-summary-mode)
5393 (gnus-summary-next-subject 1 nil t)
5394 (gnus-summary-recenter)
5395 (gnus-summary-position-point))))
5399 (defvar gnus-dead-summary-mode-map nil)
5401 (unless gnus-dead-summary-mode-map
5402 (setq gnus-dead-summary-mode-map (make-keymap))
5403 (suppress-keymap gnus-dead-summary-mode-map)
5404 (substitute-key-definition
5405 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5406 (let ((keys '("\C-d" "\r" "\177" [delete])))
5408 (define-key gnus-dead-summary-mode-map
5409 (pop keys) 'gnus-summary-wake-up-the-dead))))
5411 (defvar gnus-dead-summary-mode nil
5412 "Minor mode for Gnus summary buffers.")
5414 (defun gnus-dead-summary-mode (&optional arg)
5415 "Minor mode for Gnus summary buffers."
5417 (when (eq major-mode 'gnus-summary-mode)
5418 (make-local-variable 'gnus-dead-summary-mode)
5419 (setq gnus-dead-summary-mode
5420 (if (null arg) (not gnus-dead-summary-mode)
5421 (> (prefix-numeric-value arg) 0)))
5422 (when gnus-dead-summary-mode
5423 (gnus-add-minor-mode
5424 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5426 (defun gnus-deaden-summary ()
5427 "Make the current summary buffer into a dead summary buffer."
5428 ;; Kill any previous dead summary buffer.
5429 (when (and gnus-dead-summary
5430 (buffer-name gnus-dead-summary))
5432 (set-buffer gnus-dead-summary)
5433 (when gnus-dead-summary-mode
5434 (kill-buffer (current-buffer)))))
5435 ;; Make this the current dead summary.
5436 (setq gnus-dead-summary (current-buffer))
5437 (gnus-dead-summary-mode 1)
5438 (let ((name (buffer-name)))
5439 (when (string-match "Summary" name)
5441 (concat (substring name 0 (match-beginning 0)) "Dead "
5442 (substring name (match-beginning 0)))
5445 (defun gnus-kill-or-deaden-summary (buffer)
5446 "Kill or deaden the summary BUFFER."
5448 (when (and (buffer-name buffer)
5449 (not gnus-single-article-buffer))
5452 (gnus-kill-buffer gnus-article-buffer)
5453 (gnus-kill-buffer gnus-original-article-buffer)))
5454 (cond (gnus-kill-summary-on-exit
5455 (when (and gnus-use-trees
5456 (gnus-buffer-exists-p buffer))
5459 (gnus-tree-close gnus-newsgroup-name)))
5460 (gnus-kill-buffer buffer))
5461 ((gnus-buffer-exists-p buffer)
5464 (gnus-deaden-summary))))))
5466 (defun gnus-summary-wake-up-the-dead (&rest args)
5467 "Wake up the dead summary buffer."
5469 (gnus-dead-summary-mode -1)
5470 (let ((name (buffer-name)))
5471 (when (string-match "Dead " name)
5473 (concat (substring name 0 (match-beginning 0))
5474 (substring name (match-end 0)))
5476 (gnus-message 3 "This dead summary is now alive again"))
5478 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5479 (defun gnus-summary-fetch-faq (&optional faq-dir)
5480 "Fetch the FAQ for the current group.
5481 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5485 (when current-prefix-arg
5487 "Faq dir: " (and (listp gnus-group-faq-directory)
5488 (mapcar (lambda (file) (list file))
5489 gnus-group-faq-directory))))))
5490 (let (gnus-faq-buffer)
5491 (when (setq gnus-faq-buffer
5492 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5493 (gnus-configure-windows 'summary-faq))))
5495 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5496 (defun gnus-summary-describe-group (&optional force)
5497 "Describe the current newsgroup."
5499 (gnus-group-describe-group force gnus-newsgroup-name))
5501 (defun gnus-summary-describe-briefly ()
5502 "Describe summary mode commands briefly."
5504 (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")))
5506 ;; Walking around group mode buffer from summary mode.
5508 (defun gnus-summary-next-group (&optional no-article target-group backward)
5509 "Exit current newsgroup and then select next unread newsgroup.
5510 If prefix argument NO-ARTICLE is non-nil, no article is selected
5511 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5512 previous group instead."
5514 ;; Stop pre-fetching.
5515 (gnus-async-halt-prefetch)
5516 (let ((current-group gnus-newsgroup-name)
5517 (current-buffer (current-buffer))
5519 ;; First we semi-exit this group to update Xrefs and all variables.
5520 ;; We can't do a real exit, because the window conf must remain
5521 ;; the same in case the user is prompted for info, and we don't
5522 ;; want the window conf to change before that...
5523 (gnus-summary-exit t)
5524 (while (not entered)
5525 ;; Then we find what group we are supposed to enter.
5526 (set-buffer gnus-group-buffer)
5527 (gnus-group-jump-to-group current-group)
5530 (if (eq gnus-keep-same-level 'best)
5531 (gnus-summary-best-group gnus-newsgroup-name)
5532 (gnus-summary-search-group backward gnus-keep-same-level))))
5533 (if (not target-group)
5534 ;; There are no further groups, so we return to the group
5537 (gnus-message 5 "Returning to the group buffer")
5539 (when (gnus-buffer-live-p current-buffer)
5540 (set-buffer current-buffer)
5541 (gnus-summary-exit))
5542 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5543 ;; We try to enter the target group.
5544 (gnus-group-jump-to-group target-group)
5545 (let ((unreads (gnus-group-group-unread)))
5546 (if (and (or (eq t unreads)
5547 (and unreads (not (zerop unreads))))
5548 (gnus-summary-read-group
5549 target-group nil no-article
5550 (and (buffer-name current-buffer) current-buffer)
5553 (setq current-group target-group
5554 target-group nil)))))))
5556 (defun gnus-summary-prev-group (&optional no-article)
5557 "Exit current newsgroup and then select previous unread newsgroup.
5558 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5560 (gnus-summary-next-group no-article nil t))
5562 ;; Walking around summary lines.
5564 (defun gnus-summary-first-subject (&optional unread undownloaded)
5565 "Go to the first unread subject.
5566 If UNREAD is non-nil, go to the first unread article.
5567 Returns the article selected or nil if there are no unread articles."
5572 ((null gnus-newsgroup-data)
5573 (gnus-message 3 "No articles in the group")
5575 ;; Pick the first article.
5577 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5578 (gnus-data-number (car gnus-newsgroup-data)))
5579 ;; No unread articles.
5580 ((null gnus-newsgroup-unreads)
5581 (gnus-message 3 "No more unread articles")
5583 ;; Find the first unread article.
5585 (let ((data gnus-newsgroup-data))
5587 (and (not (and undownloaded
5588 (eq gnus-undownloaded-mark
5589 (gnus-data-mark (car data)))))
5590 (not (gnus-data-unread-p (car data)))))
5591 (setq data (cdr data)))
5593 (goto-char (gnus-data-pos (car data)))
5594 (gnus-data-number (car data))))))
5595 (gnus-summary-position-point)))
5597 (defun gnus-summary-next-subject (n &optional unread dont-display)
5598 "Go to next N'th summary line.
5599 If N is negative, go to the previous N'th subject line.
5600 If UNREAD is non-nil, only unread articles are selected.
5601 The difference between N and the actual number of steps taken is
5604 (let ((backward (< n 0))
5608 (gnus-summary-find-prev unread)
5609 (gnus-summary-find-next unread)))
5610 (gnus-summary-show-thread)
5613 (gnus-message 7 "No more%s articles"
5614 (if unread " unread" "")))
5615 (unless dont-display
5616 (gnus-summary-recenter)
5617 (gnus-summary-position-point))
5620 (defun gnus-summary-next-unread-subject (n)
5621 "Go to next N'th unread summary line."
5623 (gnus-summary-next-subject n t))
5625 (defun gnus-summary-prev-subject (n &optional unread)
5626 "Go to previous N'th summary line.
5627 If optional argument UNREAD is non-nil, only unread article is selected."
5629 (gnus-summary-next-subject (- n) unread))
5631 (defun gnus-summary-prev-unread-subject (n)
5632 "Go to previous N'th unread summary line."
5634 (gnus-summary-next-subject (- n) t))
5636 (defun gnus-summary-goto-subject (article &optional force silent)
5637 "Go the subject line of ARTICLE.
5638 If FORCE, also allow jumping to articles not currently shown."
5639 (interactive "nArticle number: ")
5641 (data (gnus-data-find article)))
5642 ;; We read in the article if we have to.
5645 (gnus-summary-insert-subject
5647 (if (or (numberp force) (vectorp force)) force)
5649 (setq data (gnus-data-find article)))
5654 (gnus-message 3 "Can't find article %d" article))
5656 (goto-char (gnus-data-pos data))
5657 (gnus-summary-position-point)
5660 ;; Walking around summary lines with displaying articles.
5662 (defun gnus-summary-expand-window (&optional arg)
5663 "Make the summary buffer take up the entire Emacs frame.
5664 Given a prefix, will force an `article' buffer configuration."
5667 (gnus-configure-windows 'article 'force)
5668 (gnus-configure-windows 'summary 'force)))
5670 (defun gnus-summary-display-article (article &optional all-header)
5671 "Display ARTICLE in article buffer."
5672 (gnus-set-global-variables)
5676 (if gnus-summary-display-article-function
5677 (funcall gnus-summary-display-article-function article all-header)
5678 (gnus-article-prepare article all-header))
5679 (gnus-run-hooks 'gnus-select-article-hook)
5680 (when (and gnus-current-article
5681 (not (zerop gnus-current-article)))
5682 (gnus-summary-goto-subject gnus-current-article))
5683 (gnus-summary-recenter)
5684 (when (and gnus-use-trees gnus-show-threads)
5685 (gnus-possibly-generate-tree article)
5686 (gnus-highlight-selected-tree article))
5687 ;; Successfully display article.
5688 (gnus-article-set-window-start
5689 (cdr (assq article gnus-newsgroup-bookmarks))))))
5691 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5692 "Select the current article.
5693 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5694 non-nil, the article will be re-fetched even if it already present in
5695 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5697 ;; Make sure we are in the summary buffer to work around bbdb bug.
5698 (unless (eq major-mode 'gnus-summary-mode)
5699 (set-buffer gnus-summary-buffer))
5700 (let ((article (or article (gnus-summary-article-number)))
5701 (all-headers (not (not all-headers))) ;Must be T or NIL.
5702 gnus-summary-display-article-function
5705 (gnus-summary-article-pseudo-p article)
5706 (error "This is a pseudo-article"))
5709 (set-buffer gnus-summary-buffer)
5710 (if (or (and gnus-single-article-buffer
5711 (or (null gnus-current-article)
5712 (null gnus-article-current)
5713 (null (get-buffer gnus-article-buffer))
5714 (not (eq article (cdr gnus-article-current)))
5715 (not (equal (car gnus-article-current)
5716 gnus-newsgroup-name))))
5717 (and (not gnus-single-article-buffer)
5718 (or (null gnus-current-article)
5719 (not (eq gnus-current-article article))))
5721 ;; The requested article is different from the current article.
5723 (gnus-summary-display-article article all-headers)
5725 (when (or all-headers gnus-show-all-headers)
5726 (gnus-article-show-all-headers)))
5727 (when (or all-headers gnus-show-all-headers)
5728 (gnus-article-show-all-headers))
5731 (gnus-article-set-window-start
5732 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5734 (defun gnus-summary-set-current-mark (&optional current-mark)
5735 "Obsolete function."
5738 (defun gnus-summary-next-article (&optional unread subject backward push)
5739 "Select the next article.
5740 If UNREAD, only unread articles are selected.
5741 If SUBJECT, only articles with SUBJECT are selected.
5742 If BACKWARD, the previous article is selected instead of the next."
5745 ;; Is there such an article?
5746 ((and (gnus-summary-search-forward unread subject backward)
5747 (or (gnus-summary-display-article (gnus-summary-article-number))
5748 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5749 (gnus-summary-position-point))
5750 ;; If not, we try the first unread, if that is wanted.
5752 gnus-auto-select-same
5753 (gnus-summary-first-unread-article))
5754 (gnus-summary-position-point)
5755 (gnus-message 6 "Wrapped"))
5756 ;; Try to get next/previous article not displayed in this group.
5757 ((and gnus-auto-extend-newsgroup
5758 (not unread) (not subject))
5759 (gnus-summary-goto-article
5760 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5761 nil (count-lines (point-min) (point))))
5762 ;; Go to next/previous group.
5764 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5765 (gnus-summary-jump-to-group gnus-newsgroup-name))
5766 (let ((cmd last-command-char)
5769 (set-buffer gnus-group-buffer)
5772 (if (eq gnus-keep-same-level 'best)
5773 (gnus-summary-best-group gnus-newsgroup-name)
5774 (gnus-summary-search-group backward gnus-keep-same-level))))
5775 ;; For some reason, the group window gets selected. We change
5777 (select-window (get-buffer-window (current-buffer)))
5778 ;; Select next unread newsgroup automagically.
5780 ((or (not gnus-auto-select-next)
5782 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5783 ((or (eq gnus-auto-select-next 'quietly)
5784 (and (eq gnus-auto-select-next 'slightly-quietly)
5786 (and (eq gnus-auto-select-next 'almost-quietly)
5787 (gnus-summary-last-article-p)))
5789 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5791 (gnus-message 7 "No more%s articles (%s)..."
5792 (if unread " unread" "")
5793 (if group (concat "selecting " group)
5795 (gnus-summary-next-group nil group backward)))
5797 (when (gnus-key-press-event-p last-input-event)
5798 (gnus-summary-walk-group-buffer
5799 gnus-newsgroup-name cmd unread backward point))))))))
5801 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5802 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5803 (?\C-p (gnus-group-prev-unread-group 1))))
5804 (cursor-in-echo-area t)
5805 keve key group ended)
5807 (set-buffer gnus-group-buffer)
5810 (if (eq gnus-keep-same-level 'best)
5811 (gnus-summary-best-group gnus-newsgroup-name)
5812 (gnus-summary-search-group backward gnus-keep-same-level))))
5815 5 "No more%s articles%s" (if unread " unread" "")
5817 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5818 (format " (Type %s for %s [%s])"
5819 (single-key-description cmd) group
5820 (car (gnus-gethash group gnus-newsrc-hashtb)))
5821 (format " (Type %s to exit %s)"
5822 (single-key-description cmd)
5823 gnus-newsgroup-name)))
5824 ;; Confirm auto selection.
5825 (setq key (car (setq keve (gnus-read-event-char))))
5828 ((assq key keystrokes)
5829 (let ((obuf (current-buffer)))
5830 (switch-to-buffer gnus-group-buffer)
5832 (gnus-group-jump-to-group group))
5833 (eval (cadr (assq key keystrokes)))
5834 (setq group (gnus-group-group-name))
5835 (switch-to-buffer obuf))
5839 (gnus-ephemeral-group-p gnus-newsgroup-name))
5841 (gnus-summary-next-group nil group backward)))
5843 (push (cdr keve) unread-command-events))))))
5845 (defun gnus-summary-next-unread-article ()
5846 "Select unread article after current one."
5848 (gnus-summary-next-article
5849 (or (not (eq gnus-summary-goto-unread 'never))
5850 (gnus-summary-last-article-p (gnus-summary-article-number)))
5851 (and gnus-auto-select-same
5852 (gnus-summary-article-subject))))
5854 (defun gnus-summary-prev-article (&optional unread subject)
5855 "Select the article after the current one.
5856 If UNREAD is non-nil, only unread articles are selected."
5858 (gnus-summary-next-article unread subject t))
5860 (defun gnus-summary-prev-unread-article ()
5861 "Select unread article before current one."
5863 (gnus-summary-prev-article
5864 (or (not (eq gnus-summary-goto-unread 'never))
5865 (gnus-summary-first-article-p (gnus-summary-article-number)))
5866 (and gnus-auto-select-same
5867 (gnus-summary-article-subject))))
5869 (defun gnus-summary-next-page (&optional lines circular)
5870 "Show next page of the selected article.
5871 If at the end of the current article, select the next article.
5872 LINES says how many lines should be scrolled up.
5874 If CIRCULAR is non-nil, go to the start of the article instead of
5875 selecting the next article when reaching the end of the current
5878 (setq gnus-summary-buffer (current-buffer))
5879 (gnus-set-global-variables)
5880 (let ((article (gnus-summary-article-number))
5881 (article-window (get-buffer-window gnus-article-buffer t))
5883 ;; If the buffer is empty, we have no article.
5885 (error "No article to select"))
5886 (gnus-configure-windows 'article)
5887 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5888 (if (and (eq gnus-summary-goto-unread 'never)
5889 (not (gnus-summary-last-article-p article)))
5890 (gnus-summary-next-article)
5891 (gnus-summary-next-unread-article))
5892 (if (or (null gnus-current-article)
5893 (null gnus-article-current)
5894 (/= article (cdr gnus-article-current))
5895 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5896 ;; Selected subject is different from current article's.
5897 (gnus-summary-display-article article)
5898 (when article-window
5899 (gnus-eval-in-buffer-window gnus-article-buffer
5900 (setq endp (gnus-article-next-page lines)))
5903 (gnus-summary-beginning-of-article))
5905 (gnus-message 3 "End of message"))
5907 (if (and (eq gnus-summary-goto-unread 'never)
5908 (not (gnus-summary-last-article-p article)))
5909 (gnus-summary-next-article)
5910 (gnus-summary-next-unread-article))))))))
5911 (gnus-summary-recenter)
5912 (gnus-summary-position-point)))
5914 (defun gnus-summary-prev-page (&optional lines move)
5915 "Show previous page of selected article.
5916 Argument LINES specifies lines to be scrolled down.
5917 If MOVE, move to the previous unread article if point is at
5918 the beginning of the buffer."
5920 (let ((article (gnus-summary-article-number))
5921 (article-window (get-buffer-window gnus-article-buffer t))
5923 (gnus-configure-windows 'article)
5924 (if (or (null gnus-current-article)
5925 (null gnus-article-current)
5926 (/= article (cdr gnus-article-current))
5927 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5928 ;; Selected subject is different from current article's.
5929 (gnus-summary-display-article article)
5930 (gnus-summary-recenter)
5931 (when article-window
5932 (gnus-eval-in-buffer-window gnus-article-buffer
5933 (setq endp (gnus-article-prev-page lines)))
5934 (when (and move endp)
5936 (gnus-message 3 "Beginning of message"))
5938 (if (and (eq gnus-summary-goto-unread 'never)
5939 (not (gnus-summary-first-article-p article)))
5940 (gnus-summary-prev-article)
5941 (gnus-summary-prev-unread-article))))))))
5942 (gnus-summary-position-point))
5944 (defun gnus-summary-prev-page-or-article (&optional lines)
5945 "Show previous page of selected article.
5946 Argument LINES specifies lines to be scrolled down.
5947 If at the beginning of the article, go to the next article."
5949 (gnus-summary-prev-page lines t))
5951 (defun gnus-summary-scroll-up (lines)
5952 "Scroll up (or down) one line current article.
5953 Argument LINES specifies lines to be scrolled up (or down if negative)."
5955 (gnus-configure-windows 'article)
5956 (gnus-summary-show-thread)
5957 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5958 (gnus-eval-in-buffer-window gnus-article-buffer
5960 (when (gnus-article-next-page lines)
5961 (gnus-message 3 "End of message")))
5963 (gnus-article-prev-page (- lines))))))
5964 (gnus-summary-recenter)
5965 (gnus-summary-position-point))
5967 (defun gnus-summary-scroll-down (lines)
5968 "Scroll down (or up) one line current article.
5969 Argument LINES specifies lines to be scrolled down (or up if negative)."
5971 (gnus-summary-scroll-up (- lines)))
5973 (defun gnus-summary-next-same-subject ()
5974 "Select next article which has the same subject as current one."
5976 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5978 (defun gnus-summary-prev-same-subject ()
5979 "Select previous article which has the same subject as current one."
5981 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5983 (defun gnus-summary-next-unread-same-subject ()
5984 "Select next unread article which has the same subject as current one."
5986 (gnus-summary-next-article t (gnus-summary-article-subject)))
5988 (defun gnus-summary-prev-unread-same-subject ()
5989 "Select previous unread article which has the same subject as current one."
5991 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5993 (defun gnus-summary-first-unread-article ()
5994 "Select the first unread article.
5995 Return nil if there are no unread articles."
5998 (when (gnus-summary-first-subject t)
5999 (gnus-summary-show-thread)
6000 (gnus-summary-first-subject t)
6001 (gnus-summary-display-article (gnus-summary-article-number)))
6002 (gnus-summary-position-point)))
6004 (defun gnus-summary-first-unread-subject ()
6005 "Place the point on the subject line of the first unread article.
6006 Return nil if there are no unread articles."
6009 (when (gnus-summary-first-subject t)
6010 (gnus-summary-show-thread)
6011 (gnus-summary-first-subject t))
6012 (gnus-summary-position-point)))
6014 (defun gnus-summary-first-article ()
6015 "Select the first article.
6016 Return nil if there are no articles."
6019 (when (gnus-summary-first-subject)
6020 (gnus-summary-show-thread)
6021 (gnus-summary-first-subject)
6022 (gnus-summary-display-article (gnus-summary-article-number)))
6023 (gnus-summary-position-point)))
6025 (defun gnus-summary-best-unread-article ()
6026 "Select the unread article with the highest score."
6028 (let ((best -1000000)
6029 (data gnus-newsgroup-data)
6032 (and (gnus-data-unread-p (car data))
6034 (gnus-summary-article-score (gnus-data-number (car data))))
6037 article (gnus-data-number (car data))))
6038 (setq data (cdr data)))
6041 (gnus-summary-goto-article article)
6042 (error "No unread articles"))
6043 (gnus-summary-position-point))))
6045 (defun gnus-summary-last-subject ()
6046 "Go to the last displayed subject line in the group."
6047 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6049 (gnus-summary-goto-subject article))))
6051 (defun gnus-summary-goto-article (article &optional all-headers force)
6052 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6053 If ALL-HEADERS is non-nil, no header lines are hidden.
6054 If FORCE, go to the article even if it isn't displayed. If FORCE
6055 is a number, it is the line the article is to be displayed on."
6059 "Article number or Message-ID: "
6060 (mapcar (lambda (number) (list (int-to-string number)))
6061 gnus-newsgroup-limit))
6065 (if (and (stringp article)
6066 (string-match "@" article))
6067 (gnus-summary-refer-article article)
6068 (when (stringp article)
6069 (setq article (string-to-number article)))
6070 (if (gnus-summary-goto-subject article force)
6071 (gnus-summary-display-article article all-headers)
6072 (gnus-message 4 "Couldn't go to article %s" article) nil))
6073 (gnus-summary-position-point)))
6075 (defun gnus-summary-goto-last-article ()
6076 "Go to the previously read article."
6079 (when gnus-last-article
6080 (gnus-summary-goto-article gnus-last-article nil t))
6081 (gnus-summary-position-point)))
6083 (defun gnus-summary-pop-article (number)
6084 "Pop one article off the history and go to the previous.
6085 NUMBER articles will be popped off."
6088 (setq gnus-newsgroup-history
6089 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6091 (gnus-summary-goto-article (car to) nil t)
6092 (error "Article history empty")))
6093 (gnus-summary-position-point))
6095 ;; Summary commands and functions for limiting the summary buffer.
6097 (defun gnus-summary-limit-to-articles (n)
6098 "Limit the summary buffer to the next N articles.
6099 If not given a prefix, use the process marked articles instead."
6102 (let ((articles (gnus-summary-work-articles n)))
6103 (setq gnus-newsgroup-processable nil)
6104 (gnus-summary-limit articles))
6105 (gnus-summary-position-point)))
6107 (defun gnus-summary-pop-limit (&optional total)
6108 "Restore the previous limit.
6109 If given a prefix, remove all limits."
6112 (setq gnus-newsgroup-limits
6113 (list (mapcar (lambda (h) (mail-header-number h))
6114 gnus-newsgroup-headers))))
6115 (unless gnus-newsgroup-limits
6116 (error "No limit to pop"))
6118 (gnus-summary-limit nil 'pop)
6119 (gnus-summary-position-point)))
6121 (defun gnus-summary-limit-to-subject (subject &optional header)
6122 "Limit the summary buffer to articles that have subjects that match a regexp."
6123 (interactive "sLimit to subject (regexp): ")
6125 (setq header "subject"))
6126 (when (not (equal "" subject))
6128 (let ((articles (gnus-summary-find-matching
6129 (or header "subject") subject 'all)))
6131 (error "Found no matches for \"%s\"" subject))
6132 (gnus-summary-limit articles))
6133 (gnus-summary-position-point))))
6135 (defun gnus-summary-limit-to-author (from)
6136 "Limit the summary buffer to articles that have authors that match a regexp."
6137 (interactive "sLimit to author (regexp): ")
6138 (gnus-summary-limit-to-subject from "from"))
6140 (defun gnus-summary-limit-to-age (age &optional younger-p)
6141 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6142 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6143 articles that are younger than AGE days."
6144 (interactive "nTime in days: \nP")
6146 (let ((data gnus-newsgroup-data)
6147 (cutoff (days-to-time age))
6148 articles d date is-younger)
6149 (while (setq d (pop data))
6150 (when (and (vectorp (gnus-data-header d))
6151 (setq date (mail-header-date (gnus-data-header d))))
6152 (setq is-younger (time-less-p
6153 (time-since (date-to-time date))
6158 (push (gnus-data-number d) articles))))
6159 (gnus-summary-limit (nreverse articles)))
6160 (gnus-summary-position-point)))
6162 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6164 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6166 (defun gnus-summary-limit-to-unread (&optional all)
6167 "Limit the summary buffer to articles that are not marked as read.
6168 If ALL is non-nil, limit strictly to unread articles."
6171 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6172 (gnus-summary-limit-to-marks
6173 ;; Concat all the marks that say that an article is read and have
6175 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6176 gnus-killed-mark gnus-kill-file-mark
6177 gnus-low-score-mark gnus-expirable-mark
6178 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6179 gnus-duplicate-mark gnus-souped-mark)
6182 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6183 (make-obsolete 'gnus-summary-delete-marked-with
6184 'gnus-summary-limit-exlude-marks)
6186 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6187 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6188 If REVERSE, limit the summary buffer to articles that are marked
6189 with MARKS. MARKS can either be a string of marks or a list of marks.
6190 Returns how many articles were removed."
6191 (interactive "sMarks: ")
6192 (gnus-summary-limit-to-marks marks t))
6194 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6195 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6196 If REVERSE (the prefix), limit the summary buffer to articles that are
6197 not marked with MARKS. MARKS can either be a string of marks or a
6199 Returns how many articles were removed."
6200 (interactive "sMarks: \nP")
6202 (let ((data gnus-newsgroup-data)
6203 (marks (if (listp marks) marks
6204 (append marks nil))) ; Transform to list.
6207 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6208 (memq (gnus-data-mark (car data)) marks))
6209 (push (gnus-data-number (car data)) articles))
6210 (setq data (cdr data)))
6211 (gnus-summary-limit articles))
6212 (gnus-summary-position-point)))
6214 (defun gnus-summary-limit-to-score (&optional score)
6215 "Limit to articles with score at or above SCORE."
6217 (setq score (if score
6218 (prefix-numeric-value score)
6219 (or gnus-summary-default-score 0)))
6220 (let ((data gnus-newsgroup-data)
6223 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6225 (push (gnus-data-number (car data)) articles))
6226 (setq data (cdr data)))
6228 (gnus-summary-limit articles)
6229 (gnus-summary-position-point))))
6231 (defun gnus-summary-limit-include-thread (id)
6232 "Display all the hidden articles that in the current thread."
6233 (interactive (list (mail-header-id (gnus-summary-article-header))))
6234 (let ((articles (gnus-articles-in-thread
6235 (gnus-id-to-thread (gnus-root-id id)))))
6237 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6238 (gnus-summary-position-point))))
6240 (defun gnus-summary-limit-include-dormant ()
6241 "Display all the hidden articles that are marked as dormant.
6242 Note that this command only works on a subset of the articles currently
6243 fetched for this group."
6245 (unless gnus-newsgroup-dormant
6246 (error "There are no dormant articles in this group"))
6248 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6249 (gnus-summary-position-point)))
6251 (defun gnus-summary-limit-exclude-dormant ()
6252 "Hide all dormant articles."
6255 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6256 (gnus-summary-position-point)))
6258 (defun gnus-summary-limit-exclude-childless-dormant ()
6259 "Hide all dormant articles that have no children."
6261 (let ((data (gnus-data-list t))
6262 articles d children)
6263 ;; Find all articles that are either not dormant or have
6265 (while (setq d (pop data))
6266 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6268 (gnus-article-children (gnus-data-number d)))
6271 (when (memq (car children) articles)
6276 (push (gnus-data-number d) articles)))
6279 (gnus-summary-limit articles)
6280 (gnus-summary-position-point))))
6282 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6283 "Mark all unread excluded articles as read.
6284 If ALL, mark even excluded ticked and dormants as read."
6286 (let ((articles (gnus-sorted-complement
6288 (mapcar (lambda (h) (mail-header-number h))
6289 gnus-newsgroup-headers)
6291 (sort gnus-newsgroup-limit '<)))
6293 (setq gnus-newsgroup-unreads
6294 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6296 (setq gnus-newsgroup-dormant nil
6297 gnus-newsgroup-marked nil
6298 gnus-newsgroup-reads
6300 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6301 gnus-newsgroup-reads))
6302 (while (setq article (pop articles))
6303 (unless (or (memq article gnus-newsgroup-dormant)
6304 (memq article gnus-newsgroup-marked))
6305 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6307 (defun gnus-summary-limit (articles &optional pop)
6309 ;; We pop the previous limit off the stack and use that.
6310 (setq articles (car gnus-newsgroup-limits)
6311 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6312 ;; We use the new limit, so we push the old limit on the stack.
6313 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6315 (setq gnus-newsgroup-limit articles)
6316 (let ((total (length gnus-newsgroup-data))
6317 (data (gnus-data-find-list (gnus-summary-article-number)))
6318 (gnus-summary-mark-below nil) ; Inhibit this.
6320 ;; This will do all the work of generating the new summary buffer
6321 ;; according to the new limit.
6322 (gnus-summary-prepare)
6323 ;; Hide any threads, possibly.
6324 (and gnus-show-threads
6325 gnus-thread-hide-subtree
6326 (gnus-summary-hide-all-threads))
6327 ;; Try to return to the article you were at, or one in the
6330 ;; We try to find some article after the current one.
6332 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6335 (setq data (cdr data))))
6337 ;; If there is no data, that means that we were after the last
6338 ;; article. The same goes when we can't find any articles
6339 ;; after the current one.
6340 (goto-char (point-max))
6341 (gnus-summary-find-prev))
6342 (gnus-set-mode-line 'summary)
6343 ;; We return how many articles were removed from the summary
6344 ;; buffer as a result of the new limit.
6345 (- total (length gnus-newsgroup-data))))
6347 (defsubst gnus-invisible-cut-children (threads)
6350 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6355 (defsubst gnus-cut-thread (thread)
6356 "Go forwards in the thread until we find an article that we want to display."
6357 (when (or (eq gnus-fetch-old-headers 'some)
6358 (eq gnus-fetch-old-headers 'invisible)
6359 (eq gnus-build-sparse-threads 'some)
6360 (eq gnus-build-sparse-threads 'more))
6361 ;; Deal with old-fetched headers and sparse threads.
6365 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6366 (gnus-summary-article-ancient-p
6367 (mail-header-number (car thread))))
6368 (if (or (<= (length (cdr thread)) 1)
6369 (eq gnus-fetch-old-headers 'invisible))
6370 (setq gnus-newsgroup-limit
6371 (delq (mail-header-number (car thread))
6372 gnus-newsgroup-limit)
6373 thread (cadr thread))
6374 (when (gnus-invisible-cut-children (cdr thread))
6375 (let ((th (cdr thread)))
6377 (if (memq (mail-header-number (caar th))
6378 gnus-newsgroup-limit)
6379 (setq thread (car th)
6381 (setq th (cdr th))))))))))
6384 (defun gnus-cut-threads (threads)
6385 "Cut off all uninteresting articles from the beginning of threads."
6386 (when (or (eq gnus-fetch-old-headers 'some)
6387 (eq gnus-fetch-old-headers 'invisible)
6388 (eq gnus-build-sparse-threads 'some)
6389 (eq gnus-build-sparse-threads 'more))
6392 (setcar th (gnus-cut-thread (car th)))
6393 (setq th (cdr th)))))
6394 ;; Remove nixed out threads.
6397 (defun gnus-summary-initial-limit (&optional show-if-empty)
6398 "Figure out what the initial limit is supposed to be on group entry.
6399 This entails weeding out unwanted dormants, low-scored articles,
6400 fetch-old-headers verbiage, and so on."
6401 ;; Most groups have nothing to remove.
6402 (if (or gnus-inhibit-limiting
6403 (and (null gnus-newsgroup-dormant)
6404 (not (eq gnus-fetch-old-headers 'some))
6405 (not (eq gnus-fetch-old-headers 'invisible))
6406 (null gnus-summary-expunge-below)
6407 (not (eq gnus-build-sparse-threads 'some))
6408 (not (eq gnus-build-sparse-threads 'more))
6409 (null gnus-thread-expunge-below)
6410 (not gnus-use-nocem)))
6412 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6413 (setq gnus-newsgroup-limit nil)
6416 (unless (car (symbol-value node))
6417 ;; These threads have no parents -- they are roots.
6418 (let ((nodes (cdr (symbol-value node)))
6421 (if (and gnus-thread-expunge-below
6422 (< (gnus-thread-total-score (car nodes))
6423 gnus-thread-expunge-below))
6424 (gnus-expunge-thread (pop nodes))
6425 (setq thread (pop nodes))
6426 (gnus-summary-limit-children thread))))))
6427 gnus-newsgroup-dependencies)
6428 ;; If this limitation resulted in an empty group, we might
6429 ;; pop the previous limit and use it instead.
6430 (when (and (not gnus-newsgroup-limit)
6432 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6433 gnus-newsgroup-limit))
6435 (defun gnus-summary-limit-children (thread)
6436 "Return 1 if this subthread is visible and 0 if it is not."
6437 ;; First we get the number of visible children to this thread. This
6438 ;; is done by recursing down the thread using this function, so this
6439 ;; will really go down to a leaf article first, before slowly
6440 ;; working its way up towards the root.
6444 (apply '+ (mapcar 'gnus-summary-limit-children
6447 (number (mail-header-number (car thread)))
6450 (not (memq number gnus-newsgroup-marked))
6452 ;; If this article is dormant and has absolutely no visible
6453 ;; children, then this article isn't visible.
6454 (and (memq number gnus-newsgroup-dormant)
6456 ;; If this is "fetch-old-headered" and there is no
6457 ;; visible children, then we don't want this article.
6458 (and (eq gnus-fetch-old-headers 'some)
6459 (gnus-summary-article-ancient-p number)
6461 ;; If this is "fetch-old-headered" and `invisible', then
6462 ;; we don't want this article.
6463 (and (eq gnus-fetch-old-headers 'invisible)
6464 (gnus-summary-article-ancient-p number))
6465 ;; If this is a sparsely inserted article with no children,
6466 ;; we don't want it.
6467 (and (eq gnus-build-sparse-threads 'some)
6468 (gnus-summary-article-sparse-p number)
6470 ;; If we use expunging, and this article is really
6471 ;; low-scored, then we don't want this article.
6472 (when (and gnus-summary-expunge-below
6474 (or (cdr (assq number gnus-newsgroup-scored))
6475 gnus-summary-default-score))
6476 gnus-summary-expunge-below))
6477 ;; We increase the expunge-tally here, but that has
6478 ;; nothing to do with the limits, really.
6479 (incf gnus-newsgroup-expunged-tally)
6480 ;; We also mark as read here, if that's wanted.
6481 (when (and gnus-summary-mark-below
6482 (< score gnus-summary-mark-below))
6483 (setq gnus-newsgroup-unreads
6484 (delq number gnus-newsgroup-unreads))
6485 (if gnus-newsgroup-auto-expire
6486 (push number gnus-newsgroup-expirable)
6487 (push (cons number gnus-low-score-mark)
6488 gnus-newsgroup-reads)))
6490 ;; Check NoCeM things.
6491 (if (and gnus-use-nocem
6492 (gnus-nocem-unwanted-article-p
6493 (mail-header-id (car thread))))
6495 (setq gnus-newsgroup-unreads
6496 (delq number gnus-newsgroup-unreads))
6498 ;; Nope, invisible article.
6500 ;; Ok, this article is to be visible, so we add it to the limit
6502 (push number gnus-newsgroup-limit)
6505 (defun gnus-expunge-thread (thread)
6506 "Mark all articles in THREAD as read."
6507 (let* ((number (mail-header-number (car thread))))
6508 (incf gnus-newsgroup-expunged-tally)
6509 ;; We also mark as read here, if that's wanted.
6510 (setq gnus-newsgroup-unreads
6511 (delq number gnus-newsgroup-unreads))
6512 (if gnus-newsgroup-auto-expire
6513 (push number gnus-newsgroup-expirable)
6514 (push (cons number gnus-low-score-mark)
6515 gnus-newsgroup-reads)))
6516 ;; Go recursively through all subthreads.
6517 (mapcar 'gnus-expunge-thread (cdr thread)))
6519 ;; Summary article oriented commands
6521 (defun gnus-summary-refer-parent-article (n)
6522 "Refer parent article N times.
6523 If N is negative, go to ancestor -N instead.
6524 The difference between N and the number of articles fetched is returned."
6528 (when (not (natnump n))
6533 (setq header (gnus-summary-article-header))
6534 (if (and (eq (mail-header-number header)
6535 (cdr gnus-article-current))
6536 (equal gnus-newsgroup-name
6537 (car gnus-article-current)))
6538 ;; If we try to find the parent of the currently
6539 ;; displayed article, then we take a look at the actual
6540 ;; References header, since this is slightly more
6541 ;; reliable than the References field we got from the
6544 (set-buffer gnus-original-article-buffer)
6545 (nnheader-narrow-to-headers)
6546 (unless (setq ref (message-fetch-field "references"))
6547 (setq ref (message-fetch-field "in-reply-to")))
6550 ;; It's not the current article, so we take a bet on
6551 ;; the value we got from the server.
6552 (mail-header-references header)))
6554 (not (equal ref "")))
6555 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6556 (gnus-message 1 "Couldn't find parent"))
6557 (gnus-message 1 "No references in article %d"
6558 (gnus-summary-article-number))
6561 (gnus-summary-position-point)
6564 (defun gnus-summary-refer-references ()
6565 "Fetch all articles mentioned in the References header.
6566 Return the number of articles fetched."
6568 (let ((ref (mail-header-references (gnus-summary-article-header)))
6569 (current (gnus-summary-article-number))
6573 (error "No References in the current article")
6574 ;; For each Message-ID in the References header...
6575 (while (string-match "<[^>]*>" ref)
6577 ;; ... fetch that article.
6578 (gnus-summary-refer-article
6579 (prog1 (match-string 0 ref)
6580 (setq ref (substring ref (match-end 0))))))
6581 (gnus-summary-goto-subject current)
6582 (gnus-summary-position-point)
6585 (defun gnus-summary-refer-thread (&optional limit)
6586 "Fetch all articles in the current thread.
6587 If LIMIT (the numerical prefix), fetch that many old headers instead
6588 of what's specified by the `gnus-refer-thread-limit' variable."
6590 (let ((id (mail-header-id (gnus-summary-article-header)))
6591 (limit (if limit (prefix-numeric-value limit)
6592 gnus-refer-thread-limit)))
6593 ;; We want to fetch LIMIT *old* headers, but we also have to
6594 ;; re-fetch all the headers in the current buffer, because many of
6595 ;; them may be undisplayed. So we adjust LIMIT.
6596 (when (numberp limit)
6597 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6598 (unless (eq gnus-fetch-old-headers 'invisible)
6599 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6600 ;; Retrieve the headers and read them in.
6601 (if (eq (gnus-retrieve-headers
6602 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6604 (gnus-build-all-threads)
6605 (error "Can't fetch thread from backends that don't support NOV"))
6606 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6607 (gnus-summary-limit-include-thread id)))
6609 (defun gnus-summary-refer-article (message-id &optional arg)
6610 "Fetch an article specified by MESSAGE-ID.
6611 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6612 or `gnus-select-method', no matter what backend the article comes from."
6613 (interactive "sMessage-ID: \nP")
6614 (when (and (stringp message-id)
6615 (not (zerop (length message-id))))
6616 ;; Construct the correct Message-ID if necessary.
6617 ;; Suggested by tale@pawl.rpi.edu.
6618 (unless (string-match "^<" message-id)
6619 (setq message-id (concat "<" message-id)))
6620 (unless (string-match ">$" message-id)
6621 (setq message-id (concat message-id ">")))
6622 (let* ((header (gnus-id-to-header message-id))
6624 (gnus-summary-article-sparse-p
6625 (mail-header-number header))
6626 (memq (mail-header-number header)
6627 gnus-newsgroup-limit))))
6629 ;; If the article is present in the buffer we just go to it.
6631 (or (not (gnus-summary-article-sparse-p
6632 (mail-header-number header)))
6635 (gnus-summary-goto-article
6636 (mail-header-number header) nil t)
6638 (gnus-summary-update-article (mail-header-number header)))))
6640 ;; We fetch the article
6641 (let ((gnus-override-method
6642 (cond ((gnus-news-group-p gnus-newsgroup-name)
6643 gnus-refer-article-method)
6645 (or gnus-refer-article-method gnus-select-method))
6648 ;; Start the special refer-article method, if necessary.
6649 (when (and gnus-refer-article-method
6650 (gnus-news-group-p gnus-newsgroup-name))
6651 (gnus-check-server gnus-refer-article-method))
6652 ;; Fetch the header, and display the article.
6653 (if (setq number (gnus-summary-insert-subject message-id))
6654 (gnus-summary-select-article nil nil nil number)
6655 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6657 (defun gnus-summary-edit-parameters ()
6658 "Edit the group parameters of the current group."
6660 (gnus-group-edit-group gnus-newsgroup-name 'params))
6662 (defun gnus-summary-customize-parameters ()
6663 "Customize the group parameters of the current group."
6665 (gnus-group-customize gnus-newsgroup-name))
6667 (defun gnus-summary-enter-digest-group (&optional force)
6668 "Enter an nndoc group based on the current article.
6669 If FORCE, force a digest interpretation. If not, try
6670 to guess what the document format is."
6672 (let ((conf gnus-current-window-configuration))
6674 (gnus-summary-select-article))
6675 (setq gnus-current-window-configuration conf)
6676 (let* ((name (format "%s-%d"
6677 (gnus-group-prefixed-name
6678 gnus-newsgroup-name (list 'nndoc ""))
6680 (set-buffer gnus-summary-buffer)
6681 gnus-current-article)))
6682 (ogroup gnus-newsgroup-name)
6683 (params (append (gnus-info-params (gnus-get-info ogroup))
6684 (list (cons 'to-group ogroup))
6685 (list (cons 'save-article-group ogroup))))
6686 (case-fold-search t)
6687 (buf (current-buffer))
6690 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6691 (insert-buffer-substring gnus-original-article-buffer)
6692 ;; Remove lines that may lead nndoc to misinterpret the
6695 (goto-char (point-min))
6696 (or (search-forward "\n\n" nil t) (point)))
6697 (goto-char (point-min))
6698 (delete-matching-lines "^\\(Path\\):\\|^From ")
6701 (if (gnus-group-read-ephemeral-group
6702 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6704 ,(if force 'digest 'guess))) t)
6705 ;; Make all postings to this group go to the parent group.
6706 (nconc (gnus-info-params (gnus-get-info name))
6708 ;; Couldn't select this doc group.
6709 (switch-to-buffer buf)
6710 (gnus-set-global-variables)
6711 (gnus-configure-windows 'summary)
6712 (gnus-message 3 "Article couldn't be entered?"))
6713 (kill-buffer dig)))))
6715 (defun gnus-summary-read-document (n)
6716 "Open a new group based on the current article(s).
6717 This will allow you to read digests and other similar
6718 documents as newsgroups.
6719 Obeys the standard process/prefix convention."
6721 (let* ((articles (gnus-summary-work-articles n))
6722 (ogroup gnus-newsgroup-name)
6723 (params (append (gnus-info-params (gnus-get-info ogroup))
6724 (list (cons 'to-group ogroup))))
6725 article group egroup groups vgroup)
6726 (while (setq article (pop articles))
6727 (setq group (format "%s-%d" gnus-newsgroup-name article))
6728 (gnus-summary-remove-process-mark article)
6729 (when (gnus-summary-display-article article)
6732 (insert-buffer-substring gnus-original-article-buffer)
6733 ;; Remove some headers that may lead nndoc to make
6735 (message-narrow-to-head)
6736 (goto-char (point-min))
6737 (delete-matching-lines "^\\(Path\\):\\|^From ")
6740 (gnus-group-read-ephemeral-group
6741 group `(nndoc ,group (nndoc-address ,(current-buffer))
6742 (nndoc-article-type guess))
6745 ;; Make all postings to this group go to the parent group.
6746 (nconc (gnus-info-params (gnus-get-info egroup))
6748 (push egroup groups))
6749 ;; Couldn't select this doc group.
6750 (gnus-error 3 "Article couldn't be entered"))))))
6751 ;; Now we have selected all the documents.
6754 (error "None of the articles could be interpreted as documents"))
6755 ((gnus-group-read-ephemeral-group
6756 (setq vgroup (format
6757 "nnvirtual:%s-%s" gnus-newsgroup-name
6758 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6759 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6761 (cons (current-buffer) 'summary)))
6763 (error "Couldn't select virtual nndoc group")))))
6765 (defun gnus-summary-isearch-article (&optional regexp-p)
6766 "Do incremental search forward on the current article.
6767 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6769 (gnus-summary-select-article)
6770 (gnus-configure-windows 'article)
6771 (gnus-eval-in-buffer-window gnus-article-buffer
6774 (isearch-forward regexp-p))))
6776 (defun gnus-summary-search-article-forward (regexp &optional backward)
6777 "Search for an article containing REGEXP forward.
6778 If BACKWARD, search backward instead."
6781 (format "Search article %s (regexp%s): "
6782 (if current-prefix-arg "backward" "forward")
6783 (if gnus-last-search-regexp
6784 (concat ", default " gnus-last-search-regexp)
6786 current-prefix-arg))
6787 (if (string-equal regexp "")
6788 (setq regexp (or gnus-last-search-regexp ""))
6789 (setq gnus-last-search-regexp regexp))
6790 (if (gnus-summary-search-article regexp backward)
6791 (gnus-summary-show-thread)
6792 (error "Search failed: \"%s\"" regexp)))
6794 (defun gnus-summary-search-article-backward (regexp)
6795 "Search for an article containing REGEXP backward."
6798 (format "Search article backward (regexp%s): "
6799 (if gnus-last-search-regexp
6800 (concat ", default " gnus-last-search-regexp)
6802 (gnus-summary-search-article-forward regexp 'backward))
6804 (defun gnus-summary-search-article (regexp &optional backward)
6805 "Search for an article containing REGEXP.
6806 Optional argument BACKWARD means do search for backward.
6807 `gnus-select-article-hook' is not called during the search."
6808 ;; We have to require this here to make sure that the following
6809 ;; dynamic binding isn't shadowed by autoloading.
6810 (require 'gnus-async)
6812 (let ((gnus-select-article-hook nil) ;Disable hook.
6813 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6814 (gnus-use-article-prefetch nil)
6815 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6816 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6817 (sum (current-buffer))
6818 (gnus-display-mime-function nil)
6821 (gnus-save-hidden-threads
6822 (gnus-summary-select-article)
6823 (set-buffer gnus-article-buffer)
6827 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6829 (re-search-backward regexp nil t)
6830 (re-search-forward regexp nil t))
6831 ;; We found the regexp.
6836 (get-buffer-window (current-buffer))
6840 (setq point (point)))
6841 ;; We didn't find it, so we go to the next article.
6844 (while (eq found 'not)
6845 (if (not (if backward (gnus-summary-find-prev)
6846 (gnus-summary-find-next)))
6847 ;; No more articles.
6849 ;; Select the next article and adjust point.
6850 (unless (gnus-summary-article-sparse-p
6851 (gnus-summary-article-number))
6853 (gnus-summary-select-article)
6854 (set-buffer gnus-article-buffer)
6856 (goto-char (if backward (point-max) (point-min))))))))
6857 (gnus-message 7 ""))
6858 ;; Return whether we found the regexp.
6859 (when (eq found 'found)
6861 (gnus-summary-show-thread)
6862 (gnus-summary-goto-subject gnus-current-article)
6863 (gnus-summary-position-point)
6866 (defun gnus-summary-find-matching (header regexp &optional backward unread
6868 "Return a list of all articles that match REGEXP on HEADER.
6869 The search stars on the current article and goes forwards unless
6870 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6871 If UNREAD is non-nil, only unread articles will
6872 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6873 in the comparisons."
6874 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6875 (gnus-data-find-list
6876 (gnus-summary-article-number) (gnus-data-list backward))))
6877 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6878 (case-fold-search (not not-case-fold))
6880 (unless (fboundp (intern (concat "mail-header-" header)))
6881 (error "%s is not a valid header" header))
6884 (and (or (not unread) ; We want all articles...
6885 (gnus-data-unread-p d)) ; Or just unreads.
6886 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6887 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6888 (push (gnus-data-number d) articles)) ; Success!
6889 (setq data (cdr data)))
6890 (nreverse articles)))
6892 (defun gnus-summary-execute-command (header regexp command &optional backward)
6893 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6894 If HEADER is an empty string (or nil), the match is done on the entire
6895 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6897 (list (let ((completion-ignore-case t))
6900 (mapcar (lambda (string) (list string))
6901 '("Number" "Subject" "From" "Lines" "Date"
6902 "Message-ID" "Xref" "References" "Body"))
6903 nil 'require-match))
6904 (read-string "Regexp: ")
6905 (read-key-sequence "Command: ")
6906 current-prefix-arg))
6907 (when (equal header "Body")
6909 ;; Hidden thread subtrees must be searched as well.
6910 (gnus-summary-show-all-threads)
6911 ;; We don't want to change current point nor window configuration.
6913 (save-window-excursion
6914 (gnus-message 6 "Executing %s..." (key-description command))
6915 ;; We'd like to execute COMMAND interactively so as to give arguments.
6916 (gnus-execute header regexp
6917 `(call-interactively ',(key-binding command))
6919 (gnus-message 6 "Executing %s...done" (key-description command)))))
6921 (defun gnus-summary-beginning-of-article ()
6922 "Scroll the article back to the beginning."
6924 (gnus-summary-select-article)
6925 (gnus-configure-windows 'article)
6926 (gnus-eval-in-buffer-window gnus-article-buffer
6928 (goto-char (point-min))
6929 (when gnus-page-broken
6930 (gnus-narrow-to-page))))
6932 (defun gnus-summary-end-of-article ()
6933 "Scroll to the end of the article."
6935 (gnus-summary-select-article)
6936 (gnus-configure-windows 'article)
6937 (gnus-eval-in-buffer-window gnus-article-buffer
6939 (goto-char (point-max))
6941 (when gnus-page-broken
6942 (gnus-narrow-to-page))))
6944 (defun gnus-summary-print-article (&optional filename n)
6945 "Generate and print a PostScript image of the N next (mail) articles.
6947 If N is negative, print the N previous articles. If N is nil and articles
6948 have been marked with the process mark, print these instead.
6950 If the optional first argument FILENAME is nil, send the image to the
6951 printer. If FILENAME is a string, save the PostScript image in a file with
6952 that name. If FILENAME is a number, prompt the user for the name of the file
6954 (interactive (list (ps-print-preprint current-prefix-arg)
6955 current-prefix-arg))
6956 (dolist (article (gnus-summary-work-articles n))
6957 (gnus-summary-select-article nil nil 'pseudo article)
6958 (gnus-eval-in-buffer-window gnus-article-buffer
6959 (let ((buffer (generate-new-buffer " *print*")))
6962 (copy-to-buffer buffer (point-min) (point-max))
6964 (gnus-article-delete-invisible-text)
6965 (let ((ps-left-header
6968 (mail-header-subject gnus-current-headers) ")")
6970 (mail-header-from gnus-current-headers) ")")))
6973 "/pagenumberstring load"
6975 (mail-header-date gnus-current-headers) ")"))))
6976 (gnus-run-hooks 'gnus-ps-print-hook)
6978 (ps-print-buffer-with-faces filename))))
6979 (kill-buffer buffer))))))
6981 (defun gnus-summary-show-article (&optional arg)
6982 "Force re-fetching of the current article.
6983 If ARG (the prefix) is non-nil, show the raw article without any
6984 article massaging functions being run."
6987 ;; Select the article the normal way.
6988 (gnus-summary-select-article nil 'force)
6989 ;; We have to require this here to make sure that the following
6990 ;; dynamic binding isn't shadowed by autoloading.
6991 (require 'gnus-async)
6993 ;; Bind the article treatment functions to nil.
6994 (let ((gnus-have-all-headers t)
6995 gnus-article-prepare-hook
6996 gnus-article-decode-hook
6997 gnus-display-mime-function
7000 ;; Destroy any MIME parts.
7001 (when (gnus-buffer-live-p gnus-article-buffer)
7003 (set-buffer gnus-article-buffer)
7004 (mm-destroy-parts gnus-article-mime-handles)))
7005 (gnus-summary-select-article nil 'force)))
7006 (gnus-summary-goto-subject gnus-current-article)
7007 (gnus-summary-position-point))
7009 (defun gnus-summary-verbose-headers (&optional arg)
7010 "Toggle permanent full header display.
7011 If ARG is a positive number, turn header display on.
7012 If ARG is a negative number, turn header display off."
7014 (setq gnus-show-all-headers
7015 (cond ((or (not (numberp arg))
7017 (not gnus-show-all-headers))
7020 (gnus-summary-show-article))
7022 (defun gnus-summary-toggle-header (&optional arg)
7023 "Show the headers if they are hidden, or hide them if they are shown.
7024 If ARG is a positive number, show the entire header.
7025 If ARG is a negative number, hide the unwanted header lines."
7028 (set-buffer gnus-article-buffer)
7030 (let* ((buffer-read-only nil)
7031 (inhibit-point-motion-hooks t)
7032 (hidden (gnus-article-hidden-text-p 'headers))
7034 (goto-char (point-min))
7035 (when (search-forward "\n\n" nil t)
7036 (delete-region (point-min) (1- (point))))
7037 (goto-char (point-min))
7039 (set-buffer gnus-original-article-buffer)
7040 (goto-char (point-min))
7041 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7042 (insert-buffer-substring gnus-original-article-buffer 1 e)
7044 (narrow-to-region (point-min) (point))
7046 (and (numberp arg) (< arg 0)))
7047 (let ((gnus-treat-hide-headers nil)
7048 (gnus-treat-hide-boring-headers nil))
7049 (gnus-treat-article 'head))
7050 (gnus-treat-article 'head)))))))
7052 (defun gnus-summary-show-all-headers ()
7053 "Make all header lines visible."
7055 (gnus-article-show-all-headers))
7057 (defun gnus-summary-caesar-message (&optional arg)
7058 "Caesar rotate the current article by 13.
7059 The numerical prefix specifies how many places to rotate each letter
7062 (gnus-summary-select-article)
7063 (let ((mail-header-separator ""))
7064 (gnus-eval-in-buffer-window gnus-article-buffer
7067 (let ((start (window-start))
7069 (message-caesar-buffer-body arg)
7070 (set-window-start (get-buffer-window (current-buffer)) start))))))
7072 (defun gnus-summary-stop-page-breaking ()
7073 "Stop page breaking in the current article."
7075 (gnus-summary-select-article)
7076 (gnus-eval-in-buffer-window gnus-article-buffer
7078 (when (gnus-visual-p 'page-marker)
7079 (let ((buffer-read-only nil))
7080 (gnus-remove-text-with-property 'gnus-prev)
7081 (gnus-remove-text-with-property 'gnus-next))
7082 (setq gnus-page-broken nil))))
7084 (defun gnus-summary-move-article (&optional n to-newsgroup
7085 select-method action)
7086 "Move the current article to a different newsgroup.
7087 If N is a positive number, move the N next articles.
7088 If N is a negative number, move the N previous articles.
7089 If N is nil and any articles have been marked with the process mark,
7090 move those articles instead.
7091 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7092 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7093 re-spool using this method.
7095 For this function to work, both the current newsgroup and the
7096 newsgroup that you want to move to have to support the `request-move'
7097 and `request-accept' functions."
7100 (setq action 'move))
7101 ;; Disable marking as read.
7102 (let (gnus-mark-article-hook)
7103 (save-window-excursion
7104 (gnus-summary-select-article)))
7105 ;; Check whether the source group supports the required functions.
7106 (cond ((and (eq action 'move)
7107 (not (gnus-check-backend-function
7108 'request-move-article gnus-newsgroup-name)))
7109 (error "The current group does not support article moving"))
7110 ((and (eq action 'crosspost)
7111 (not (gnus-check-backend-function
7112 'request-replace-article gnus-newsgroup-name)))
7113 (error "The current group does not support article editing")))
7114 (let ((articles (gnus-summary-work-articles n))
7115 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7116 (names '((move "Move" "Moving")
7117 (copy "Copy" "Copying")
7118 (crosspost "Crosspost" "Crossposting")))
7119 (copy-buf (save-excursion
7120 (nnheader-set-temp-buffer " *copy article*")))
7121 art-group to-method new-xref article to-groups)
7122 (unless (assq action names)
7123 (error "Unknown action %s" action))
7124 ;; Read the newsgroup name.
7125 (when (and (not to-newsgroup)
7126 (not select-method))
7128 (gnus-read-move-group-name
7129 (cadr (assq action names))
7130 (symbol-value (intern (format "gnus-current-%s-group" action)))
7132 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7133 (setq to-method (or select-method
7134 (gnus-group-name-to-method to-newsgroup)))
7135 ;; Check the method we are to move this article to...
7136 (unless (gnus-check-backend-function
7137 'request-accept-article (car to-method))
7138 (error "%s does not support article copying" (car to-method)))
7139 (unless (gnus-check-server to-method)
7140 (error "Can't open server %s" (car to-method)))
7141 (gnus-message 6 "%s to %s: %s..."
7142 (caddr (assq action names))
7143 (or (car select-method) to-newsgroup) articles)
7145 (setq article (pop articles))
7149 ;; Move the article.
7151 ;; Remove this article from future suppression.
7152 (gnus-dup-unsuppress-article article)
7153 (gnus-request-move-article
7154 article ; Article to move
7155 gnus-newsgroup-name ; From newsgroup
7156 (nth 1 (gnus-find-method-for-group
7157 gnus-newsgroup-name)) ; Server
7158 (list 'gnus-request-accept-article
7159 to-newsgroup (list 'quote select-method)
7160 (not articles) t) ; Accept form
7161 (not articles))) ; Only save nov last time
7162 ;; Copy the article.
7165 (set-buffer copy-buf)
7166 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7167 (gnus-request-accept-article
7168 to-newsgroup select-method (not articles) t))))
7169 ;; Crosspost the article.
7170 ((eq action 'crosspost)
7171 (let ((xref (message-tokenize-header
7172 (mail-header-xref (gnus-summary-article-header article))
7174 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7177 (setq xref (list (system-name))))
7180 (mapconcat 'identity
7181 (delete "Xref:" (delete new-xref xref))
7185 (set-buffer copy-buf)
7186 ;; First put the article in the destination group.
7187 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7188 (when (consp (setq art-group
7189 (gnus-request-accept-article
7190 to-newsgroup select-method (not articles))))
7191 (setq new-xref (concat new-xref " " (car art-group)
7192 ":" (cdr art-group)))
7193 ;; Now we have the new Xrefs header, so we insert
7194 ;; it and replace the new article.
7195 (nnheader-replace-header "Xref" new-xref)
7196 (gnus-request-replace-article
7197 (cdr art-group) to-newsgroup (current-buffer))
7201 (gnus-message 1 "Couldn't %s article %s"
7202 (cadr (assq action names)) article))
7203 ((and (eq art-group 'junk)
7205 (gnus-summary-mark-article article gnus-canceled-mark)
7206 (gnus-message 4 "Deleted article %s" article))
7208 (let* ((pto-group (gnus-group-prefixed-name
7209 (car art-group) to-method))
7211 (gnus-gethash pto-group gnus-newsrc-hashtb))
7212 (info (nth 2 entry))
7213 (to-group (gnus-info-group info)))
7214 ;; Update the group that has been moved to.
7216 (memq action '(move copy)))
7217 (unless (member to-group to-groups)
7218 (push to-group to-groups))
7220 (unless (memq article gnus-newsgroup-unreads)
7222 info (gnus-add-to-range (gnus-info-read info)
7223 (list (cdr art-group)))))
7225 ;; Copy any marks over to the new group.
7226 (let ((marks gnus-article-mark-lists)
7227 (to-article (cdr art-group)))
7229 ;; See whether the article is to be put in the cache.
7230 (when gnus-use-cache
7231 (gnus-cache-possibly-enter-article
7233 (let ((header (copy-sequence
7234 (gnus-summary-article-header article))))
7235 (mail-header-set-number header to-article)
7237 (memq article gnus-newsgroup-marked)
7238 (memq article gnus-newsgroup-dormant)
7239 (memq article gnus-newsgroup-unreads)))
7241 (when (and (equal to-group gnus-newsgroup-name)
7242 (not (memq article gnus-newsgroup-unreads)))
7243 ;; Mark this article as read in this group.
7244 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7245 (setcdr (gnus-active to-group) to-article)
7246 (setcdr gnus-newsgroup-active to-article))
7249 (when (memq article (symbol-value
7250 (intern (format "gnus-newsgroup-%s"
7252 ;; If the other group is the same as this group,
7253 ;; then we have to add the mark to the list.
7254 (when (equal to-group gnus-newsgroup-name)
7255 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7258 (intern (format "gnus-newsgroup-%s"
7260 ;; Copy the marks to other group.
7261 (gnus-add-marked-articles
7262 to-group (cdar marks) (list to-article) info))
7263 (setq marks (cdr marks)))
7266 (concat "(gnus-group-set-info '"
7267 (gnus-prin1-to-string (gnus-get-info to-group))
7270 ;; Update the Xref header in this article to point to
7271 ;; the new crossposted article we have just created.
7272 (when (eq action 'crosspost)
7274 (set-buffer copy-buf)
7275 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7276 (nnheader-replace-header "Xref" new-xref)
7277 (gnus-request-replace-article
7278 article gnus-newsgroup-name (current-buffer)))))
7280 ;;;!!!Why is this necessary?
7281 (set-buffer gnus-summary-buffer)
7283 (gnus-summary-goto-subject article)
7284 (when (eq action 'move)
7285 (gnus-summary-mark-article article gnus-canceled-mark))))
7286 (gnus-summary-remove-process-mark article))
7287 ;; Re-activate all groups that have been moved to.
7290 (set-buffer gnus-group-buffer)
7291 (when (gnus-group-goto-group (car to-groups) t)
7292 (gnus-group-get-new-news-this-group 1 t))
7295 (gnus-kill-buffer copy-buf)
7296 (gnus-summary-position-point)
7297 (gnus-set-mode-line 'summary)))
7299 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7300 "Move the current article to a different newsgroup.
7301 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7302 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7303 re-spool using this method."
7305 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7307 (defun gnus-summary-crosspost-article (&optional n)
7308 "Crosspost the current article to some other group."
7310 (gnus-summary-move-article n nil nil 'crosspost))
7312 (defcustom gnus-summary-respool-default-method nil
7313 "Default method for respooling an article.
7314 If nil, use to the current newsgroup method."
7315 :type '(choice (gnus-select-method :value (nnml ""))
7317 :group 'gnus-summary-mail)
7319 (defun gnus-summary-respool-article (&optional n method)
7320 "Respool the current article.
7321 The article will be squeezed through the mail spooling process again,
7322 which means that it will be put in some mail newsgroup or other
7323 depending on `nnmail-split-methods'.
7324 If N is a positive number, respool the N next articles.
7325 If N is a negative number, respool the N previous articles.
7326 If N is nil and any articles have been marked with the process mark,
7327 respool those articles instead.
7329 Respooling can be done both from mail groups and \"real\" newsgroups.
7330 In the former case, the articles in question will be moved from the
7331 current group into whatever groups they are destined to. In the
7332 latter case, they will be copied into the relevant groups."
7334 (list current-prefix-arg
7335 (let* ((methods (gnus-methods-using 'respool))
7337 (symbol-name (or gnus-summary-respool-default-method
7338 (car (gnus-find-method-for-group
7339 gnus-newsgroup-name)))))
7341 (gnus-completing-read
7342 methname "What backend do you want to use when respooling?"
7343 methods nil t nil 'gnus-mail-method-history))
7346 ((zerop (length (setq ms (gnus-servers-using-backend
7348 (list (intern method) ""))
7352 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7353 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7356 (error "No method given for respooling"))
7357 (if (assoc (symbol-name
7358 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7359 (gnus-methods-using 'respool))
7360 (gnus-summary-move-article n nil method)
7361 (gnus-summary-copy-article n nil method)))
7363 (defun gnus-summary-import-article (file)
7364 "Import an arbitrary file into a mail newsgroup."
7365 (interactive "fImport file: ")
7366 (let ((group gnus-newsgroup-name)
7367 (now (current-time))
7369 (unless (gnus-check-backend-function 'request-accept-article group)
7370 (error "%s does not support article importing" group))
7371 (or (file-readable-p file)
7372 (not (file-regular-p file))
7373 (error "Can't read %s" file))
7375 (set-buffer (gnus-get-buffer-create " *import file*"))
7377 (insert-file-contents file)
7378 (goto-char (point-min))
7379 (unless (nnheader-article-p)
7380 ;; This doesn't look like an article, so we fudge some headers.
7381 (setq atts (file-attributes file)
7382 lines (count-lines (point-min) (point-max)))
7383 (insert "From: " (read-string "From: ") "\n"
7384 "Subject: " (read-string "Subject: ") "\n"
7385 "Date: " (message-make-date (nth 5 atts))
7387 "Message-ID: " (message-make-message-id) "\n"
7388 "Lines: " (int-to-string lines) "\n"
7389 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7390 (gnus-request-accept-article group nil t)
7391 (kill-buffer (current-buffer)))))
7393 (defun gnus-summary-article-posted-p ()
7394 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7395 This will be the case if the article has both been mailed and posted."
7397 (let ((id (mail-header-references (gnus-summary-article-header)))
7398 (gnus-override-method
7399 (or gnus-refer-article-method gnus-select-method)))
7400 (if (gnus-request-head id "")
7401 (gnus-message 2 "The current message was found on %s"
7402 gnus-override-method)
7403 (gnus-message 2 "The current message couldn't be found on %s"
7404 gnus-override-method)
7407 (defun gnus-summary-expire-articles (&optional now)
7408 "Expire all articles that are marked as expirable in the current group."
7410 (when (gnus-check-backend-function
7411 'request-expire-articles gnus-newsgroup-name)
7412 ;; This backend supports expiry.
7413 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7414 (expirable (if total
7416 ;; We need to update the info for
7417 ;; this group for `gnus-list-of-read-articles'
7418 ;; to give us the right answer.
7419 (gnus-run-hooks 'gnus-exit-group-hook)
7420 (gnus-summary-update-info)
7421 (gnus-list-of-read-articles gnus-newsgroup-name))
7422 (setq gnus-newsgroup-expirable
7423 (sort gnus-newsgroup-expirable '<))))
7424 (expiry-wait (if now 'immediate
7425 (gnus-group-find-parameter
7426 gnus-newsgroup-name 'expiry-wait)))
7429 ;; There are expirable articles in this group, so we run them
7430 ;; through the expiry process.
7431 (gnus-message 6 "Expiring articles...")
7432 ;; The list of articles that weren't expired is returned.
7435 (let ((nnmail-expiry-wait-function nil)
7436 (nnmail-expiry-wait expiry-wait))
7437 (setq es (gnus-request-expire-articles
7438 expirable gnus-newsgroup-name)))
7439 (setq es (gnus-request-expire-articles
7440 expirable gnus-newsgroup-name))))
7442 (setq gnus-newsgroup-expirable es))
7443 ;; We go through the old list of expirable, and mark all
7444 ;; really expired articles as nonexistent.
7445 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7446 (let ((gnus-use-cache nil))
7448 (unless (memq (car expirable) es)
7449 (when (gnus-data-find (car expirable))
7450 (gnus-summary-mark-article
7451 (car expirable) gnus-canceled-mark)))
7452 (setq expirable (cdr expirable)))))
7453 (gnus-message 6 "Expiring articles...done")))))
7455 (defun gnus-summary-expire-articles-now ()
7456 "Expunge all expirable articles in the current group.
7457 This means that *all* articles that are marked as expirable will be
7458 deleted forever, right now."
7460 (or gnus-expert-user
7462 "Are you really, really, really sure you want to delete all these messages? ")
7464 (gnus-summary-expire-articles t))
7466 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7467 (defun gnus-summary-delete-article (&optional n)
7468 "Delete the N next (mail) articles.
7469 This command actually deletes articles. This is not a marking
7470 command. The article will disappear forever from your life, never to
7472 If N is negative, delete backwards.
7473 If N is nil and articles have been marked with the process mark,
7474 delete these instead."
7476 (unless (gnus-check-backend-function 'request-expire-articles
7477 gnus-newsgroup-name)
7478 (error "The current newsgroup does not support article deletion"))
7479 ;; Compute the list of articles to delete.
7480 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7482 (if (and gnus-novice-user
7483 (not (gnus-yes-or-no-p
7484 (format "Do you really want to delete %s forever? "
7485 (if (> (length articles) 1)
7486 (format "these %s articles" (length articles))
7489 ;; Delete the articles.
7490 (setq not-deleted (gnus-request-expire-articles
7491 articles gnus-newsgroup-name 'force))
7493 (gnus-summary-remove-process-mark (car articles))
7494 ;; The backend might not have been able to delete the article
7496 (unless (memq (car articles) not-deleted)
7497 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7498 (setq articles (cdr articles)))
7500 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7501 (gnus-summary-position-point)
7502 (gnus-set-mode-line 'summary)
7505 (defun gnus-summary-edit-article (&optional force)
7506 "Edit the current article.
7507 This will have permanent effect only in mail groups.
7508 If FORCE is non-nil, allow editing of articles even in read-only
7511 (let ((mail-parse-charset gnus-newsgroup-charset))
7513 (set-buffer gnus-summary-buffer)
7514 (gnus-set-global-variables)
7515 (when (and (not force)
7516 (gnus-group-read-only-p))
7517 (error "The current newsgroup does not support article editing"))
7518 (gnus-summary-show-article t)
7519 (gnus-article-edit-article
7521 `(lambda (no-highlight)
7522 (let ((mail-parse-charset ',gnus-newsgroup-charset))
7524 (gnus-summary-edit-article-done
7525 ,(or (mail-header-references gnus-current-headers) "")
7526 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
7528 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7530 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7532 "Make edits to the current article permanent."
7534 ;; Replace the article.
7535 (let ((buf (current-buffer)))
7537 (insert-buffer-substring buf)
7538 (if (and (not read-only)
7539 (not (gnus-request-replace-article
7540 (cdr gnus-article-current) (car gnus-article-current)
7541 (current-buffer) t)))
7542 (error "Couldn't replace article")
7543 ;; Update the summary buffer.
7545 (equal (message-tokenize-header references " ")
7546 (message-tokenize-header
7547 (or (message-fetch-field "references") "") " ")))
7548 ;; We only have to update this line.
7551 (message-narrow-to-head)
7552 (let ((head (buffer-string))
7555 (insert (format "211 %d Article retrieved.\n"
7556 (cdr gnus-article-current)))
7559 (let ((nntp-server-buffer (current-buffer)))
7560 (setq header (car (gnus-get-newsgroup-headers
7562 (set-buffer gnus-summary-buffer)
7563 gnus-newsgroup-dependencies)
7566 (set-buffer gnus-summary-buffer)
7567 (gnus-data-set-header
7568 (gnus-data-find (cdr gnus-article-current))
7570 (gnus-summary-update-article-line
7571 (cdr gnus-article-current) header))))))
7573 (set-buffer (or buffer gnus-summary-buffer))
7574 (gnus-summary-update-article (cdr gnus-article-current)))
7575 ;; Prettify the article buffer again.
7576 (unless no-highlight
7578 (set-buffer gnus-article-buffer)
7579 ;;;!!! Fix this -- article should be rehighlighted.
7580 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7581 (set-buffer gnus-original-article-buffer)
7582 (gnus-request-article
7583 (cdr gnus-article-current)
7584 (car gnus-article-current) (current-buffer))))
7585 ;; Prettify the summary buffer line.
7586 (when (gnus-visual-p 'summary-highlight 'highlight)
7587 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7589 (defun gnus-summary-edit-wash (key)
7590 "Perform editing command KEY in the article buffer."
7594 (message "%s" (concat (this-command-keys) "- "))
7597 (gnus-summary-edit-article)
7598 (execute-kbd-macro (concat (this-command-keys) key))
7599 (gnus-article-edit-done))
7603 (defun gnus-summary-respool-query (&optional silent trace)
7604 "Query where the respool algorithm would put this article."
7606 (let (gnus-mark-article-hook)
7607 (gnus-summary-select-article)
7609 (set-buffer gnus-original-article-buffer)
7611 (message-narrow-to-head)
7612 (let ((groups (nnmail-article-group 'identity trace)))
7615 (message "This message would go to %s"
7616 (mapconcat 'car groups ", "))
7617 (message "This message would go to no groups"))
7620 (defun gnus-summary-respool-trace ()
7621 "Trace where the respool algorithm would put this article.
7622 Display a buffer showing all fancy splitting patterns which matched."
7624 (gnus-summary-respool-query nil t))
7626 ;; Summary marking commands.
7628 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7629 "Mark articles which has the same subject as read, and then select the next.
7630 If UNMARK is positive, remove any kind of mark.
7631 If UNMARK is negative, tick articles."
7634 (setq unmark (prefix-numeric-value unmark)))
7636 (gnus-summary-mark-same-subject
7637 (gnus-summary-article-subject) unmark)))
7638 ;; Select next unread article. If auto-select-same mode, should
7639 ;; select the first unread article.
7640 (gnus-summary-next-article t (and gnus-auto-select-same
7641 (gnus-summary-article-subject)))
7642 (gnus-message 7 "%d article%s marked as %s"
7643 count (if (= count 1) " is" "s are")
7644 (if unmark "unread" "read"))))
7646 (defun gnus-summary-kill-same-subject (&optional unmark)
7647 "Mark articles which has the same subject as read.
7648 If UNMARK is positive, remove any kind of mark.
7649 If UNMARK is negative, tick articles."
7652 (setq unmark (prefix-numeric-value unmark)))
7654 (gnus-summary-mark-same-subject
7655 (gnus-summary-article-subject) unmark)))
7656 ;; If marked as read, go to next unread subject.
7658 ;; Go to next unread subject.
7659 (gnus-summary-next-subject 1 t))
7660 (gnus-message 7 "%d articles are marked as %s"
7661 count (if unmark "unread" "read"))))
7663 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7664 "Mark articles with same SUBJECT as read, and return marked number.
7665 If optional argument UNMARK is positive, remove any kinds of marks.
7666 If optional argument UNMARK is negative, mark articles as unread instead."
7670 ((null unmark) ; Mark as read.
7673 (gnus-summary-mark-article-as-read gnus-killed-mark)
7674 (gnus-summary-show-thread) t)
7675 (gnus-summary-find-subject subject))
7676 (setq count (1+ count))))
7677 ((> unmark 0) ; Tick.
7680 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7681 (gnus-summary-show-thread) t)
7682 (gnus-summary-find-subject subject))
7683 (setq count (1+ count))))
7684 (t ; Mark as unread.
7687 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7688 (gnus-summary-show-thread) t)
7689 (gnus-summary-find-subject subject))
7690 (setq count (1+ count)))))
7691 (gnus-set-mode-line 'summary)
7692 ;; Return the number of marked articles.
7695 (defun gnus-summary-mark-as-processable (n &optional unmark)
7696 "Set the process mark on the next N articles.
7697 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7698 the process mark instead. The difference between N and the actual
7699 number of articles marked is returned."
7701 (let ((backward (< n 0))
7706 (gnus-summary-remove-process-mark
7707 (gnus-summary-article-number))
7708 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7709 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7712 (gnus-message 7 "No more articles"))
7713 (gnus-summary-recenter)
7714 (gnus-summary-position-point)
7717 (defun gnus-summary-unmark-as-processable (n)
7718 "Remove the process mark from the next N articles.
7719 If N is negative, unmark backward instead. The difference between N and
7720 the actual number of articles unmarked is returned."
7722 (gnus-summary-mark-as-processable n t))
7724 (defun gnus-summary-unmark-all-processable ()
7725 "Remove the process mark from all articles."
7728 (while gnus-newsgroup-processable
7729 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7730 (gnus-summary-position-point))
7732 (defun gnus-summary-mark-as-expirable (n)
7733 "Mark N articles forward as expirable.
7734 If N is negative, mark backward instead. The difference between N and
7735 the actual number of articles marked is returned."
7737 (gnus-summary-mark-forward n gnus-expirable-mark))
7739 (defun gnus-summary-mark-article-as-replied (article)
7740 "Mark ARTICLE replied and update the summary line."
7741 (push article gnus-newsgroup-replied)
7742 (let ((buffer-read-only nil))
7743 (when (gnus-summary-goto-subject article nil t)
7744 (gnus-summary-update-secondary-mark article))))
7746 (defun gnus-summary-set-bookmark (article)
7747 "Set a bookmark in current article."
7748 (interactive (list (gnus-summary-article-number)))
7749 (when (or (not (get-buffer gnus-article-buffer))
7750 (not gnus-current-article)
7751 (not gnus-article-current)
7752 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7753 (error "No current article selected"))
7754 ;; Remove old bookmark, if one exists.
7755 (let ((old (assq article gnus-newsgroup-bookmarks)))
7757 (setq gnus-newsgroup-bookmarks
7758 (delq old gnus-newsgroup-bookmarks))))
7759 ;; Set the new bookmark, which is on the form
7760 ;; (article-number . line-number-in-body).
7764 (set-buffer gnus-article-buffer)
7768 (goto-char (point-min))
7769 (search-forward "\n\n" nil t)
7772 gnus-newsgroup-bookmarks)
7773 (gnus-message 6 "A bookmark has been added to the current article."))
7775 (defun gnus-summary-remove-bookmark (article)
7776 "Remove the bookmark from the current article."
7777 (interactive (list (gnus-summary-article-number)))
7778 ;; Remove old bookmark, if one exists.
7779 (let ((old (assq article gnus-newsgroup-bookmarks)))
7782 (setq gnus-newsgroup-bookmarks
7783 (delq old gnus-newsgroup-bookmarks))
7784 (gnus-message 6 "Removed bookmark."))
7785 (gnus-message 6 "No bookmark in current article."))))
7787 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7788 (defun gnus-summary-mark-as-dormant (n)
7789 "Mark N articles forward as dormant.
7790 If N is negative, mark backward instead. The difference between N and
7791 the actual number of articles marked is returned."
7793 (gnus-summary-mark-forward n gnus-dormant-mark))
7795 (defun gnus-summary-set-process-mark (article)
7796 "Set the process mark on ARTICLE and update the summary line."
7797 (setq gnus-newsgroup-processable
7799 (delq article gnus-newsgroup-processable)))
7800 (when (gnus-summary-goto-subject article)
7801 (gnus-summary-show-thread)
7802 (gnus-summary-goto-subject article)
7803 (gnus-summary-update-secondary-mark article)))
7805 (defun gnus-summary-remove-process-mark (article)
7806 "Remove the process mark from ARTICLE and update the summary line."
7807 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7808 (when (gnus-summary-goto-subject article)
7809 (gnus-summary-show-thread)
7810 (gnus-summary-goto-subject article)
7811 (gnus-summary-update-secondary-mark article)))
7813 (defun gnus-summary-set-saved-mark (article)
7814 "Set the process mark on ARTICLE and update the summary line."
7815 (push article gnus-newsgroup-saved)
7816 (when (gnus-summary-goto-subject article)
7817 (gnus-summary-update-secondary-mark article)))
7819 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7820 "Mark N articles as read forwards.
7821 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7822 The difference between N and the actual number of articles marked is
7825 (gnus-summary-show-thread)
7826 (let ((backward (< n 0))
7827 (gnus-summary-goto-unread
7828 (and gnus-summary-goto-unread
7829 (not (eq gnus-summary-goto-unread 'never))
7830 (not (memq mark (list gnus-unread-mark
7831 gnus-ticked-mark gnus-dormant-mark)))))
7833 (mark (or mark gnus-del-mark)))
7835 (gnus-summary-mark-article nil mark no-expire)
7836 (zerop (gnus-summary-next-subject
7838 (and gnus-summary-goto-unread
7839 (not (eq gnus-summary-goto-unread 'never)))
7843 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7844 (gnus-summary-recenter)
7845 (gnus-summary-position-point)
7846 (gnus-set-mode-line 'summary)
7849 (defun gnus-summary-mark-article-as-read (mark)
7850 "Mark the current article quickly as read with MARK."
7851 (let ((article (gnus-summary-article-number)))
7852 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7853 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7854 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7855 (push (cons article mark) gnus-newsgroup-reads)
7856 ;; Possibly remove from cache, if that is used.
7857 (when gnus-use-cache
7858 (gnus-cache-enter-remove-article article))
7859 ;; Allow the backend to change the mark.
7860 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7861 ;; Check for auto-expiry.
7862 (when (and gnus-newsgroup-auto-expire
7863 (memq mark gnus-auto-expirable-marks))
7864 (setq mark gnus-expirable-mark)
7865 ;; Let the backend know about the mark change.
7866 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7867 (push article gnus-newsgroup-expirable))
7868 ;; Set the mark in the buffer.
7869 (gnus-summary-update-mark mark 'unread)
7872 (defun gnus-summary-mark-article-as-unread (mark)
7873 "Mark the current article quickly as unread with MARK."
7874 (let* ((article (gnus-summary-article-number))
7875 (old-mark (gnus-summary-article-mark article)))
7876 ;; Allow the backend to change the mark.
7877 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7878 (if (eq mark old-mark)
7882 (gnus-error 1 "Can't mark negative article numbers")
7884 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7885 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7886 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7887 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7888 (cond ((= mark gnus-ticked-mark)
7889 (push article gnus-newsgroup-marked))
7890 ((= mark gnus-dormant-mark)
7891 (push article gnus-newsgroup-dormant))
7893 (push article gnus-newsgroup-unreads)))
7894 (gnus-pull article gnus-newsgroup-reads)
7896 ;; See whether the article is to be put in the cache.
7898 (vectorp (gnus-summary-article-header article))
7900 (gnus-cache-possibly-enter-article
7901 gnus-newsgroup-name article
7902 (gnus-summary-article-header article)
7903 (= mark gnus-ticked-mark)
7904 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7907 (gnus-summary-update-mark mark 'unread)
7910 (defun gnus-summary-mark-article (&optional article mark no-expire)
7911 "Mark ARTICLE with MARK. MARK can be any character.
7912 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7913 `??' (dormant) and `?E' (expirable).
7914 If MARK is nil, then the default character `?r' is used.
7915 If ARTICLE is nil, then the article on the current line will be
7917 ;; The mark might be a string.
7918 (when (stringp mark)
7919 (setq mark (aref mark 0)))
7920 ;; If no mark is given, then we check auto-expiring.
7922 (setq mark gnus-del-mark))
7923 (when (and (not no-expire)
7924 gnus-newsgroup-auto-expire
7925 (memq mark gnus-auto-expirable-marks))
7926 (setq mark gnus-expirable-mark))
7927 (let ((article (or article (gnus-summary-article-number)))
7928 (old-mark (gnus-summary-article-mark article)))
7929 ;; Allow the backend to change the mark.
7930 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7931 (if (eq mark old-mark)
7934 (error "No article on current line"))
7935 (if (not (if (or (= mark gnus-unread-mark)
7936 (= mark gnus-ticked-mark)
7937 (= mark gnus-dormant-mark))
7938 (gnus-mark-article-as-unread article mark)
7939 (gnus-mark-article-as-read article mark)))
7941 ;; See whether the article is to be put in the cache.
7943 (not (= mark gnus-canceled-mark))
7944 (vectorp (gnus-summary-article-header article))
7946 (gnus-cache-possibly-enter-article
7947 gnus-newsgroup-name article
7948 (gnus-summary-article-header article)
7949 (= mark gnus-ticked-mark)
7950 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7952 (when (gnus-summary-goto-subject article nil t)
7953 (let ((buffer-read-only nil))
7954 (gnus-summary-show-thread)
7956 (gnus-summary-update-mark mark 'unread)
7959 (defun gnus-summary-update-secondary-mark (article)
7960 "Update the secondary (read, process, cache) mark."
7961 (gnus-summary-update-mark
7962 (cond ((memq article gnus-newsgroup-processable)
7964 ((memq article gnus-newsgroup-cached)
7966 ((memq article gnus-newsgroup-replied)
7968 ((memq article gnus-newsgroup-saved)
7970 (t gnus-unread-mark))
7972 (when (gnus-visual-p 'summary-highlight 'highlight)
7973 (gnus-run-hooks 'gnus-summary-update-hook))
7976 (defun gnus-summary-update-mark (mark type)
7977 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7978 (buffer-read-only nil))
7979 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7981 (when (looking-at "\r")
7983 (when (<= (+ forward (point)) (point-max))
7984 ;; Go to the right position on the line.
7985 (goto-char (+ forward (point)))
7986 ;; Replace the old mark with the new mark.
7987 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7988 ;; Optionally update the marks by some user rule.
7989 (when (eq type 'unread)
7991 (gnus-data-find (gnus-summary-article-number)) mark)
7992 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
7994 (defun gnus-mark-article-as-read (article &optional mark)
7995 "Enter ARTICLE in the pertinent lists and remove it from others."
7996 ;; Make the article expirable.
7997 (let ((mark (or mark gnus-del-mark)))
7998 (if (= mark gnus-expirable-mark)
7999 (push article gnus-newsgroup-expirable)
8000 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
8001 ;; Remove from unread and marked lists.
8002 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8003 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8004 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8005 (push (cons article mark) gnus-newsgroup-reads)
8006 ;; Possibly remove from cache, if that is used.
8007 (when gnus-use-cache
8008 (gnus-cache-enter-remove-article article))
8011 (defun gnus-mark-article-as-unread (article &optional mark)
8012 "Enter ARTICLE in the pertinent lists and remove it from others."
8013 (let ((mark (or mark gnus-ticked-mark)))
8016 (gnus-error 1 "Can't mark negative article numbers")
8018 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8019 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8020 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8021 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8023 ;; Unsuppress duplicates?
8024 (when gnus-suppress-duplicates
8025 (gnus-dup-unsuppress-article article))
8027 (cond ((= mark gnus-ticked-mark)
8028 (push article gnus-newsgroup-marked))
8029 ((= mark gnus-dormant-mark)
8030 (push article gnus-newsgroup-dormant))
8032 (push article gnus-newsgroup-unreads)))
8033 (gnus-pull article gnus-newsgroup-reads)
8036 (defalias 'gnus-summary-mark-as-unread-forward
8037 'gnus-summary-tick-article-forward)
8038 (make-obsolete 'gnus-summary-mark-as-unread-forward
8039 'gnus-summary-tick-article-forward)
8040 (defun gnus-summary-tick-article-forward (n)
8041 "Tick N articles forwards.
8042 If N is negative, tick backwards instead.
8043 The difference between N and the number of articles ticked is returned."
8045 (gnus-summary-mark-forward n gnus-ticked-mark))
8047 (defalias 'gnus-summary-mark-as-unread-backward
8048 'gnus-summary-tick-article-backward)
8049 (make-obsolete 'gnus-summary-mark-as-unread-backward
8050 'gnus-summary-tick-article-backward)
8051 (defun gnus-summary-tick-article-backward (n)
8052 "Tick N articles backwards.
8053 The difference between N and the number of articles ticked is returned."
8055 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8057 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8058 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8059 (defun gnus-summary-tick-article (&optional article clear-mark)
8060 "Mark current article as unread.
8061 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8062 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8064 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8067 (defun gnus-summary-mark-as-read-forward (n)
8068 "Mark N articles as read forwards.
8069 If N is negative, mark backwards instead.
8070 The difference between N and the actual number of articles marked is
8073 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8075 (defun gnus-summary-mark-as-read-backward (n)
8076 "Mark the N articles as read backwards.
8077 The difference between N and the actual number of articles marked is
8080 (gnus-summary-mark-forward
8081 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8083 (defun gnus-summary-mark-as-read (&optional article mark)
8084 "Mark current article as read.
8085 ARTICLE specifies the article to be marked as read.
8086 MARK specifies a string to be inserted at the beginning of the line."
8087 (gnus-summary-mark-article article mark))
8089 (defun gnus-summary-clear-mark-forward (n)
8090 "Clear marks from N articles forward.
8091 If N is negative, clear backward instead.
8092 The difference between N and the number of marks cleared is returned."
8094 (gnus-summary-mark-forward n gnus-unread-mark))
8096 (defun gnus-summary-clear-mark-backward (n)
8097 "Clear marks from N articles backward.
8098 The difference between N and the number of marks cleared is returned."
8100 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8102 (defun gnus-summary-mark-unread-as-read ()
8103 "Intended to be used by `gnus-summary-mark-article-hook'."
8104 (when (memq gnus-current-article gnus-newsgroup-unreads)
8105 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8107 (defun gnus-summary-mark-read-and-unread-as-read ()
8108 "Intended to be used by `gnus-summary-mark-article-hook'."
8109 (let ((mark (gnus-summary-article-mark)))
8110 (when (or (gnus-unread-mark-p mark)
8111 (gnus-read-mark-p mark))
8112 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8114 (defun gnus-summary-mark-region-as-read (point mark all)
8115 "Mark all unread articles between point and mark as read.
8116 If given a prefix, mark all articles between point and mark as read,
8117 even ticked and dormant ones."
8118 (interactive "r\nP")
8127 (memq (setq article (gnus-summary-article-number))
8128 gnus-newsgroup-unreads))
8129 (gnus-summary-mark-article article gnus-del-mark))
8131 (gnus-summary-find-next))))))
8133 (defun gnus-summary-mark-below (score mark)
8134 "Mark articles with score less than SCORE with MARK."
8135 (interactive "P\ncMark: ")
8136 (setq score (if score
8137 (prefix-numeric-value score)
8138 (or gnus-summary-default-score 0)))
8140 (set-buffer gnus-summary-buffer)
8141 (goto-char (point-min))
8144 (and (< (gnus-summary-article-score) score)
8145 (gnus-summary-mark-article nil mark))
8146 (gnus-summary-find-next)))))
8148 (defun gnus-summary-kill-below (&optional score)
8149 "Mark articles with score below SCORE as read."
8151 (gnus-summary-mark-below score gnus-killed-mark))
8153 (defun gnus-summary-clear-above (&optional score)
8154 "Clear all marks from articles with score above SCORE."
8156 (gnus-summary-mark-above score gnus-unread-mark))
8158 (defun gnus-summary-tick-above (&optional score)
8159 "Tick all articles with score above SCORE."
8161 (gnus-summary-mark-above score gnus-ticked-mark))
8163 (defun gnus-summary-mark-above (score mark)
8164 "Mark articles with score over SCORE with MARK."
8165 (interactive "P\ncMark: ")
8166 (setq score (if score
8167 (prefix-numeric-value score)
8168 (or gnus-summary-default-score 0)))
8170 (set-buffer gnus-summary-buffer)
8171 (goto-char (point-min))
8173 (when (> (gnus-summary-article-score) score)
8174 (gnus-summary-mark-article nil mark))
8176 (gnus-summary-find-next)))))
8178 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8179 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8180 (defun gnus-summary-limit-include-expunged (&optional no-error)
8181 "Display all the hidden articles that were expunged for low scores."
8183 (let ((buffer-read-only nil))
8184 (let ((scored gnus-newsgroup-scored)
8187 (unless (gnus-summary-goto-subject (caar scored))
8188 (and (setq h (gnus-summary-article-header (caar scored)))
8189 (< (cdar scored) gnus-summary-expunge-below)
8191 (setq scored (cdr scored)))
8193 (when (not no-error)
8194 (error "No expunged articles hidden"))
8195 (goto-char (point-min))
8196 (gnus-summary-prepare-unthreaded (nreverse headers))
8197 (goto-char (point-min))
8198 (gnus-summary-position-point)
8201 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8202 "Mark all unread articles in this newsgroup as read.
8203 If prefix argument ALL is non-nil, ticked and dormant articles will
8204 also be marked as read.
8205 If QUIETLY is non-nil, no questions will be asked.
8206 If TO-HERE is non-nil, it should be a point in the buffer. All
8207 articles before this point will be marked as read.
8208 Note that this function will only catch up the unread article
8209 in the current summary buffer limitation.
8210 The number of articles marked as read is returned."
8215 (not gnus-interactive-catchup) ;Without confirmation?
8219 "Mark absolutely all articles as read? "
8220 "Mark all unread articles as read? ")))
8222 (not gnus-newsgroup-adaptive)
8223 (not gnus-newsgroup-auto-expire)
8224 (not gnus-suppress-duplicates)
8225 (or (not gnus-use-cache)
8226 (eq gnus-use-cache 'passive)))
8229 (setq gnus-newsgroup-marked nil
8230 gnus-newsgroup-dormant nil))
8231 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8232 ;; We actually mark all articles as canceled, which we
8233 ;; have to do when using auto-expiry or adaptive scoring.
8234 (gnus-summary-show-all-threads)
8235 (when (gnus-summary-first-subject (not all) t)
8237 (if to-here (< (point) to-here) t)
8238 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8239 (gnus-summary-find-next (not all) nil nil t))))
8240 (gnus-set-mode-line 'summary))
8242 (gnus-summary-position-point)))
8244 (defun gnus-summary-catchup-to-here (&optional all)
8245 "Mark all unticked articles before the current one as read.
8246 If ALL is non-nil, also mark ticked and dormant articles as read."
8249 (gnus-save-hidden-threads
8250 (let ((beg (point)))
8251 ;; We check that there are unread articles.
8252 (when (or all (gnus-summary-find-prev))
8253 (gnus-summary-catchup all t beg)))))
8254 (gnus-summary-position-point))
8256 (defun gnus-summary-catchup-all (&optional quietly)
8257 "Mark all articles in this newsgroup as read."
8259 (gnus-summary-catchup t quietly))
8261 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8262 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8263 If prefix argument ALL is non-nil, all articles are marked as read."
8265 (when (gnus-summary-catchup all quietly nil 'fast)
8266 ;; Select next newsgroup or exit.
8267 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8268 (eq gnus-auto-select-next 'quietly))
8269 (gnus-summary-next-group nil)
8270 (gnus-summary-exit))))
8272 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8273 "Mark all articles in this newsgroup as read, and then exit."
8275 (gnus-summary-catchup-and-exit t quietly))
8277 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8278 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8279 "Mark all articles in this group as read and select the next group.
8280 If given a prefix, mark all articles, unread as well as ticked, as
8284 (gnus-summary-catchup all))
8285 (gnus-summary-next-article t nil nil t))
8287 ;; Thread-based commands.
8289 (defun gnus-summary-articles-in-thread (&optional article)
8290 "Return a list of all articles in the current thread.
8291 If ARTICLE is non-nil, return all articles in the thread that starts
8293 (let* ((article (or article (gnus-summary-article-number)))
8294 (data (gnus-data-find-list article))
8295 (top-level (gnus-data-level (car data)))
8297 (cond ((null gnus-thread-operation-ignore-subject)
8298 (gnus-simplify-subject-re
8299 (mail-header-subject (gnus-data-header (car data)))))
8300 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8301 (gnus-simplify-subject-fuzzy
8302 (mail-header-subject (gnus-data-header (car data)))))
8304 (end-point (save-excursion
8305 (if (gnus-summary-go-to-next-thread)
8306 (point) (point-max))))
8309 (< (gnus-data-pos (car data)) end-point))
8310 (when (or (not top-subject)
8311 (string= top-subject
8312 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8313 (gnus-simplify-subject-fuzzy
8314 (mail-header-subject
8315 (gnus-data-header (car data))))
8316 (gnus-simplify-subject-re
8317 (mail-header-subject
8318 (gnus-data-header (car data)))))))
8319 (push (gnus-data-number (car data)) articles))
8320 (unless (and (setq data (cdr data))
8321 (> (gnus-data-level (car data)) top-level))
8323 ;; Return the list of articles.
8324 (nreverse articles)))
8326 (defun gnus-summary-rethread-current ()
8327 "Rethread the thread the current article is part of."
8329 (let* ((gnus-show-threads t)
8330 (article (gnus-summary-article-number))
8331 (id (mail-header-id (gnus-summary-article-header)))
8332 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8334 (error "No article on the current line"))
8335 (gnus-rebuild-thread id)
8336 (gnus-summary-goto-subject article)))
8338 (defun gnus-summary-reparent-thread ()
8339 "Make the current article child of the marked (or previous) article.
8341 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8342 is non-nil or the Subject: of both articles are the same."
8344 (unless (not (gnus-group-read-only-p))
8345 (error "The current newsgroup does not support article editing"))
8346 (unless (<= (length gnus-newsgroup-processable) 1)
8347 (error "No more than one article may be marked"))
8348 (save-window-excursion
8349 (let ((gnus-article-buffer " *reparent*")
8350 (current-article (gnus-summary-article-number))
8351 ;; First grab the marked article, otherwise one line up.
8352 (parent-article (if (not (null gnus-newsgroup-processable))
8353 (car gnus-newsgroup-processable)
8355 (if (eq (forward-line -1) 0)
8356 (gnus-summary-article-number)
8357 (error "Beginning of summary buffer"))))))
8358 (unless (not (eq current-article parent-article))
8359 (error "An article may not be self-referential"))
8360 (let ((message-id (mail-header-id
8361 (gnus-summary-article-header parent-article))))
8362 (unless (and message-id (not (equal message-id "")))
8363 (error "No message-id in desired parent"))
8364 (gnus-with-article current-article
8365 (goto-char (point-min))
8366 (if (re-search-forward "^References: " nil t)
8368 (re-search-forward "^[^ \t]" nil t)
8371 (insert " " message-id))
8372 (insert "References: " message-id "\n")))
8373 (set-buffer gnus-summary-buffer)
8374 (gnus-summary-unmark-all-processable)
8375 (gnus-summary-update-article current-article)
8376 (gnus-summary-rethread-current)
8377 (gnus-message 3 "Article %d is now the child of article %d"
8378 current-article parent-article)))))
8380 (defun gnus-summary-toggle-threads (&optional arg)
8381 "Toggle showing conversation threads.
8382 If ARG is positive number, turn showing conversation threads on."
8384 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8385 (setq gnus-show-threads
8386 (if (null arg) (not gnus-show-threads)
8387 (> (prefix-numeric-value arg) 0)))
8388 (gnus-summary-prepare)
8389 (gnus-summary-goto-subject current)
8390 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8391 (gnus-summary-position-point)))
8393 (defun gnus-summary-show-all-threads ()
8397 (let ((buffer-read-only nil))
8398 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8399 (gnus-summary-position-point))
8401 (defun gnus-summary-show-thread ()
8402 "Show thread subtrees.
8403 Returns nil if no thread was there to be shown."
8405 (let ((buffer-read-only nil)
8407 ;; first goto end then to beg, to have point at beg after let
8408 (end (progn (end-of-line) (point)))
8409 (beg (progn (beginning-of-line) (point))))
8411 ;; Any hidden lines here?
8412 (search-forward "\r" end t)
8413 (subst-char-in-region beg end ?\^M ?\n t)
8415 (gnus-summary-position-point))))
8417 (defun gnus-summary-hide-all-threads ()
8418 "Hide all thread subtrees."
8421 (goto-char (point-min))
8422 (gnus-summary-hide-thread)
8423 (while (zerop (gnus-summary-next-thread 1 t))
8424 (gnus-summary-hide-thread)))
8425 (gnus-summary-position-point))
8427 (defun gnus-summary-hide-thread ()
8428 "Hide thread subtrees.
8429 Returns nil if no threads were there to be hidden."
8431 (let ((buffer-read-only nil)
8433 (article (gnus-summary-article-number)))
8435 ;; Go forward until either the buffer ends or the subthread
8437 (when (and (not (eobp))
8438 (or (zerop (gnus-summary-next-thread 1 t))
8439 (goto-char (point-max))))
8441 (if (and (> (point) start)
8442 (search-backward "\n" start t))
8444 (subst-char-in-region start (point) ?\n ?\^M)
8445 (gnus-summary-goto-subject article))
8448 ;;(gnus-summary-position-point)
8451 (defun gnus-summary-go-to-next-thread (&optional previous)
8452 "Go to the same level (or less) next thread.
8453 If PREVIOUS is non-nil, go to previous thread instead.
8454 Return the article number moved to, or nil if moving was impossible."
8455 (let ((level (gnus-summary-thread-level))
8456 (way (if previous -1 1))
8459 (while (and (not (eobp))
8460 (< level (gnus-summary-thread-level)))
8468 (gnus-summary-article-number)
8471 (defun gnus-summary-next-thread (n &optional silent)
8472 "Go to the same level next N'th thread.
8473 If N is negative, search backward instead.
8474 Returns the difference between N and the number of skips actually
8477 If SILENT, don't output messages."
8479 (let ((backward (< n 0))
8482 (gnus-summary-go-to-next-thread backward))
8485 (gnus-summary-position-point))
8486 (when (and (not silent) (/= 0 n))
8487 (gnus-message 7 "No more threads"))
8490 (defun gnus-summary-prev-thread (n)
8491 "Go to the same level previous N'th thread.
8492 Returns the difference between N and the number of skips actually
8495 (gnus-summary-next-thread (- n)))
8497 (defun gnus-summary-go-down-thread ()
8498 "Go down one level in the current thread."
8499 (let ((children (gnus-summary-article-children)))
8501 (gnus-summary-goto-subject (car children)))))
8503 (defun gnus-summary-go-up-thread ()
8504 "Go up one level in the current thread."
8505 (let ((parent (gnus-summary-article-parent)))
8507 (gnus-summary-goto-subject parent))))
8509 (defun gnus-summary-down-thread (n)
8510 "Go down thread N steps.
8511 If N is negative, go up instead.
8512 Returns the difference between N and how many steps down that were
8518 (if up (gnus-summary-go-up-thread)
8519 (gnus-summary-go-down-thread)))
8521 (gnus-summary-position-point)
8523 (gnus-message 7 "Can't go further"))
8526 (defun gnus-summary-up-thread (n)
8527 "Go up thread N steps.
8528 If N is negative, go up instead.
8529 Returns the difference between N and how many steps down that were
8532 (gnus-summary-down-thread (- n)))
8534 (defun gnus-summary-top-thread ()
8535 "Go to the top of the thread."
8537 (while (gnus-summary-go-up-thread))
8538 (gnus-summary-article-number))
8540 (defun gnus-summary-kill-thread (&optional unmark)
8541 "Mark articles under current thread as read.
8542 If the prefix argument is positive, remove any kinds of marks.
8543 If the prefix argument is negative, tick articles instead."
8546 (setq unmark (prefix-numeric-value unmark)))
8547 (let ((articles (gnus-summary-articles-in-thread)))
8549 ;; Expand the thread.
8550 (gnus-summary-show-thread)
8551 ;; Mark all the articles.
8553 (gnus-summary-goto-subject (car articles))
8554 (cond ((null unmark)
8555 (gnus-summary-mark-article-as-read gnus-killed-mark))
8557 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8559 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8560 (setq articles (cdr articles))))
8561 ;; Hide killed subtrees.
8563 gnus-thread-hide-killed
8564 (gnus-summary-hide-thread))
8565 ;; If marked as read, go to next unread subject.
8567 ;; Go to next unread subject.
8568 (gnus-summary-next-subject 1 t)))
8569 (gnus-set-mode-line 'summary))
8571 ;; Summary sorting commands
8573 (defun gnus-summary-sort-by-number (&optional reverse)
8574 "Sort the summary buffer by article number.
8575 Argument REVERSE means reverse order."
8577 (gnus-summary-sort 'number reverse))
8579 (defun gnus-summary-sort-by-author (&optional reverse)
8580 "Sort the summary buffer by author name alphabetically.
8581 If case-fold-search is non-nil, case of letters is ignored.
8582 Argument REVERSE means reverse order."
8584 (gnus-summary-sort 'author reverse))
8586 (defun gnus-summary-sort-by-subject (&optional reverse)
8587 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8588 If case-fold-search is non-nil, case of letters is ignored.
8589 Argument REVERSE means reverse order."
8591 (gnus-summary-sort 'subject reverse))
8593 (defun gnus-summary-sort-by-date (&optional reverse)
8594 "Sort the summary buffer by date.
8595 Argument REVERSE means reverse order."
8597 (gnus-summary-sort 'date reverse))
8599 (defun gnus-summary-sort-by-score (&optional reverse)
8600 "Sort the summary buffer by score.
8601 Argument REVERSE means reverse order."
8603 (gnus-summary-sort 'score reverse))
8605 (defun gnus-summary-sort-by-lines (&optional reverse)
8606 "Sort the summary buffer by the number of lines.
8607 Argument REVERSE means reverse order."
8609 (gnus-summary-sort 'lines reverse))
8611 (defun gnus-summary-sort-by-chars (&optional reverse)
8612 "Sort the summary buffer by article length.
8613 Argument REVERSE means reverse order."
8615 (gnus-summary-sort 'chars reverse))
8617 (defun gnus-summary-sort (predicate reverse)
8618 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8619 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8620 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8621 (gnus-thread-sort-functions
8626 (gnus-article-sort-functions
8632 (gnus-summary-prepare-hook nil))
8633 ;; We do the sorting by regenerating the threads.
8634 (gnus-summary-prepare)
8635 ;; Hide subthreads if needed.
8636 (when (and gnus-show-threads gnus-thread-hide-subtree)
8637 (gnus-summary-hide-all-threads))))
8639 ;; Summary saving commands.
8641 (defun gnus-summary-save-article (&optional n not-saved)
8642 "Save the current article using the default saver function.
8643 If N is a positive number, save the N next articles.
8644 If N is a negative number, save the N previous articles.
8645 If N is nil and any articles have been marked with the process mark,
8646 save those articles instead.
8647 The variable `gnus-default-article-saver' specifies the saver function."
8649 (let* ((articles (gnus-summary-work-articles n))
8650 (save-buffer (save-excursion
8651 (nnheader-set-temp-buffer " *Gnus Save*")))
8652 (num (length articles))
8654 (dolist (article articles)
8655 (setq header (gnus-summary-article-header article))
8656 (if (not (vectorp header))
8657 ;; This is a pseudo-article.
8658 (if (assq 'name header)
8659 (gnus-copy-file (cdr (assq 'name header)))
8660 (gnus-message 1 "Article %d is unsaveable" article))
8661 ;; This is a real article.
8662 (save-window-excursion
8663 (gnus-summary-select-article t nil nil article))
8665 (set-buffer save-buffer)
8667 (insert-buffer-substring gnus-original-article-buffer))
8668 (setq file (gnus-article-save save-buffer file num))
8669 (gnus-summary-remove-process-mark article)
8671 (gnus-summary-set-saved-mark article))))
8672 (gnus-kill-buffer save-buffer)
8673 (gnus-summary-position-point)
8674 (gnus-set-mode-line 'summary)
8677 (defun gnus-summary-pipe-output (&optional arg)
8678 "Pipe the current article to a subprocess.
8679 If N is a positive number, pipe the N next articles.
8680 If N is a negative number, pipe the N previous articles.
8681 If N is nil and any articles have been marked with the process mark,
8682 pipe those articles instead."
8684 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8685 (gnus-summary-save-article arg t))
8686 (gnus-configure-windows 'pipe))
8688 (defun gnus-summary-save-article-mail (&optional arg)
8689 "Append the current article to an mail file.
8690 If N is a positive number, save the N next articles.
8691 If N is a negative number, save the N previous articles.
8692 If N is nil and any articles have been marked with the process mark,
8693 save those articles instead."
8695 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8696 (gnus-summary-save-article arg)))
8698 (defun gnus-summary-save-article-rmail (&optional arg)
8699 "Append the current article to an rmail file.
8700 If N is a positive number, save the N next articles.
8701 If N is a negative number, save the N previous articles.
8702 If N is nil and any articles have been marked with the process mark,
8703 save those articles instead."
8705 (let ((gnus-default-article-saver 'rmail-output-to-rmail-file))
8706 (gnus-summary-save-article arg)))
8708 (defun gnus-summary-save-article-file (&optional arg)
8709 "Append the current article to a file.
8710 If N is a positive number, save the N next articles.
8711 If N is a negative number, save the N previous articles.
8712 If N is nil and any articles have been marked with the process mark,
8713 save those articles instead."
8715 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8716 (gnus-summary-save-article arg)))
8718 (defun gnus-summary-write-article-file (&optional arg)
8719 "Write the current article to a file, deleting the previous file.
8720 If N is a positive number, save the N next articles.
8721 If N is a negative number, save the N previous articles.
8722 If N is nil and any articles have been marked with the process mark,
8723 save those articles instead."
8725 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8726 (gnus-summary-save-article arg)))
8728 (defun gnus-summary-save-article-body-file (&optional arg)
8729 "Append the current article body to a file.
8730 If N is a positive number, save the N next articles.
8731 If N is a negative number, save the N previous articles.
8732 If N is nil and any articles have been marked with the process mark,
8733 save those articles instead."
8735 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8736 (gnus-summary-save-article arg)))
8738 (defun gnus-summary-pipe-message (program)
8739 "Pipe the current article through PROGRAM."
8740 (interactive "sProgram: ")
8741 (gnus-summary-select-article)
8742 (let ((mail-header-separator ""))
8743 (gnus-eval-in-buffer-window gnus-article-buffer
8746 (let ((start (window-start))
8748 (message-pipe-buffer-body program)
8749 (set-window-start (get-buffer-window (current-buffer)) start))))))
8751 (defun gnus-get-split-value (methods)
8752 "Return a value based on the split METHODS."
8753 (let (split-name method result match)
8756 (set-buffer gnus-original-article-buffer)
8758 (nnheader-narrow-to-headers)
8760 (goto-char (point-min))
8761 (setq method (pop methods))
8762 (setq match (car method))
8765 ;; Regular expression.
8767 (re-search-forward match nil t)))
8768 ((gnus-functionp match)
8772 (setq result (funcall match gnus-newsgroup-name))))
8777 (setq result (eval match)))))
8778 (setq split-name (append (cdr method) split-name))
8779 (cond ((stringp result)
8780 (push (expand-file-name
8781 result gnus-article-save-directory)
8784 (setq split-name (append result split-name)))))))))
8787 (defun gnus-valid-move-group-p (group)
8790 (symbol-value group)
8793 (car (gnus-find-method-for-group
8794 (symbol-name group))))
8795 gnus-valid-select-methods))))
8797 (defun gnus-read-move-group-name (prompt default articles prefix)
8798 "Read a group name."
8799 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8800 (minibuffer-confirm-incomplete nil) ; XEmacs
8804 (if (> (length articles) 1)
8805 (format "these %d articles" (length articles))
8810 (gnus-completing-read default prom
8812 'gnus-valid-move-group-p
8814 'gnus-group-history))
8815 ((= 1 (length split-name))
8816 (gnus-completing-read (car split-name) prom
8818 'gnus-valid-move-group-p
8820 'gnus-group-history))
8822 (gnus-completing-read nil prom
8823 (mapcar (lambda (el) (list el))
8824 (nreverse split-name))
8826 'gnus-group-history)))))
8828 (if (or (string= to-newsgroup "")
8829 (string= to-newsgroup prefix))
8830 (setq to-newsgroup default))
8831 (unless to-newsgroup
8832 (error "No group name entered"))
8833 (or (gnus-active to-newsgroup)
8834 (gnus-activate-group to-newsgroup)
8835 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8837 (or (and (gnus-request-create-group
8838 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8839 (gnus-activate-group to-newsgroup nil nil
8840 (gnus-group-name-to-method
8842 (error "Couldn't create group %s" to-newsgroup)))
8843 (error "No such group: %s" to-newsgroup)))
8846 ;; Summary extract commands
8848 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8849 (let ((buffer-read-only nil)
8850 (article (gnus-summary-article-number))
8852 (unless (gnus-summary-goto-subject article)
8853 (error "No such article: %d" article))
8854 (gnus-summary-position-point)
8855 ;; If all commands are to be bunched up on one line, we collect
8857 (unless gnus-view-pseudos-separately
8858 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8861 (setq action (cdr (assq 'action (car ps))))
8862 (setq files (list (cdr (assq 'name (car ps)))))
8863 (while (and ps (cdr ps)
8864 (string= (or action "1")
8865 (or (cdr (assq 'action (cadr ps))) "2")))
8866 (push (cdr (assq 'name (cadr ps))) files)
8867 (setcdr ps (cddr ps)))
8869 (when (not (string-match "%s" action))
8872 (when (assq 'execute (car ps))
8873 (setcdr (assq 'execute (car ps))
8874 (funcall (if (string-match "%s" action)
8883 (setq ps (cdr ps)))))
8884 (if (and gnus-view-pseudos (not not-view))
8886 (when (assq 'execute (car pslist))
8887 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8888 (eq gnus-view-pseudos 'not-confirm)))
8889 (setq pslist (cdr pslist)))
8892 (setq after-article (or (cdr (assq 'article (car pslist)))
8893 (gnus-summary-article-number)))
8894 (gnus-summary-goto-subject after-article)
8897 (insert " " (file-name-nondirectory
8898 (cdr (assq 'name (car pslist))))
8899 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8901 (forward-line -1) ; back to `b'
8902 (gnus-add-text-properties
8903 b (1- e) (list 'gnus-number gnus-reffed-article-number
8904 gnus-mouse-face-prop gnus-mouse-face))
8906 after-article gnus-reffed-article-number
8907 gnus-unread-mark b (car pslist) 0 (- e b))
8908 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8909 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8910 (setq pslist (cdr pslist)))))))
8912 (defun gnus-pseudos< (p1 p2)
8913 (let ((c1 (cdr (assq 'action p1)))
8914 (c2 (cdr (assq 'action p2))))
8915 (and c1 c2 (string< c1 c2))))
8917 (defun gnus-request-pseudo-article (props)
8918 (cond ((assq 'execute props)
8919 (gnus-execute-command (cdr (assq 'execute props)))))
8920 (let ((gnus-current-article (gnus-summary-article-number)))
8921 (gnus-run-hooks 'gnus-mark-article-hook)))
8923 (defun gnus-execute-command (command &optional automatic)
8925 (gnus-article-setup-buffer)
8926 (set-buffer gnus-article-buffer)
8927 (setq buffer-read-only nil)
8928 (let ((command (if automatic command
8929 (read-string "Command: " (cons command 0)))))
8931 (insert "$ " command "\n\n")
8932 (if gnus-view-pseudo-asynchronously
8933 (start-process "gnus-execute" (current-buffer) shell-file-name
8934 shell-command-switch command)
8935 (call-process shell-file-name nil t nil
8936 shell-command-switch command)))))
8938 ;; Summary kill commands.
8940 (defun gnus-summary-edit-global-kill (article)
8941 "Edit the \"global\" kill file."
8942 (interactive (list (gnus-summary-article-number)))
8943 (gnus-group-edit-global-kill article))
8945 (defun gnus-summary-edit-local-kill ()
8946 "Edit a local kill file applied to the current newsgroup."
8948 (setq gnus-current-headers (gnus-summary-article-header))
8949 (gnus-group-edit-local-kill
8950 (gnus-summary-article-number) gnus-newsgroup-name))
8954 (defun gnus-read-header (id &optional header)
8955 "Read the headers of article ID and enter them into the Gnus system."
8956 (let ((group gnus-newsgroup-name)
8957 (gnus-override-method
8958 (and (gnus-news-group-p gnus-newsgroup-name)
8959 gnus-refer-article-method))
8961 ;; First we check to see whether the header in question is already
8964 ;; This is a Message-ID.
8965 (setq header (or header (gnus-id-to-header id)))
8966 ;; This is an article number.
8967 (setq header (or header (gnus-summary-article-header id))))
8969 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8970 ;; We have found the header.
8972 ;; If this is a sparse article, we have to nix out its
8973 ;; previous entry in the thread hashtb.
8975 (gnus-summary-article-sparse-p (mail-header-number header)))
8976 (let* ((parent (gnus-parent-id (mail-header-references header)))
8977 (thread (and parent (gnus-id-to-thread parent))))
8979 (delq (assq header thread) thread))))
8980 ;; We have to really fetch the header to this article.
8982 (set-buffer nntp-server-buffer)
8983 (when (setq where (gnus-request-head id group))
8984 (nnheader-fold-continuation-lines)
8985 (goto-char (point-max))
8987 (goto-char (point-min))
8991 ((cdr where) (cdr where))
8992 (header (mail-header-number header))
8993 (t gnus-reffed-article-number))
8995 (insert " Article retrieved.\n"))
8997 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8998 () ; Malformed head.
8999 (unless (gnus-summary-article-sparse-p (mail-header-number header))
9000 (when (and (stringp id)
9001 (not (string= (gnus-group-real-name group)
9003 ;; If we fetched by Message-ID and the article came
9004 ;; from a different group, we fudge some bogus article
9005 ;; numbers for this article.
9006 (mail-header-set-number header gnus-reffed-article-number))
9008 (set-buffer gnus-summary-buffer)
9009 (decf gnus-reffed-article-number)
9010 (gnus-remove-header (mail-header-number header))
9011 (push header gnus-newsgroup-headers)
9012 (setq gnus-current-headers header)
9013 (push (mail-header-number header) gnus-newsgroup-limit)))
9016 (defun gnus-remove-header (number)
9017 "Remove header NUMBER from `gnus-newsgroup-headers'."
9018 (if (and gnus-newsgroup-headers
9019 (= number (mail-header-number (car gnus-newsgroup-headers))))
9020 (pop gnus-newsgroup-headers)
9021 (let ((headers gnus-newsgroup-headers))
9022 (while (and (cdr headers)
9023 (not (= number (mail-header-number (cadr headers)))))
9026 (setcdr headers (cddr headers))))))
9029 ;;; summary highlights
9032 (defun gnus-highlight-selected-summary ()
9033 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9034 ;; Highlight selected article in summary buffer
9035 (when gnus-summary-selected-face
9037 (let* ((beg (progn (beginning-of-line) (point)))
9038 (end (progn (end-of-line) (point)))
9039 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9040 (from (if (get-text-property beg gnus-mouse-face-prop)
9042 (or (next-single-property-change
9043 beg gnus-mouse-face-prop nil end)
9048 (or (next-single-property-change
9049 from gnus-mouse-face-prop nil end)
9051 ;; If no mouse-face prop on line we will have to = from = end,
9052 ;; so we highlight the entire line instead.
9053 (when (= (+ to 2) from)
9056 (if gnus-newsgroup-selected-overlay
9057 ;; Move old overlay.
9059 gnus-newsgroup-selected-overlay from to (current-buffer))
9060 ;; Create new overlay.
9062 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9063 'face gnus-summary-selected-face))))))
9065 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9066 (defun gnus-summary-highlight-line ()
9067 "Highlight current line according to `gnus-summary-highlight'."
9068 (let* ((list gnus-summary-highlight)
9070 (end (progn (end-of-line) (point)))
9071 ;; now find out where the line starts and leave point there.
9072 (beg (progn (beginning-of-line) (point)))
9073 (article (gnus-summary-article-number))
9074 (score (or (cdr (assq (or article gnus-current-article)
9075 gnus-newsgroup-scored))
9076 gnus-summary-default-score 0))
9077 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9078 (inhibit-read-only t))
9079 ;; Eval the cars of the lists until we find a match.
9080 (let ((default gnus-summary-default-score))
9082 (not (eval (caar list))))
9083 (setq list (cdr list))))
9084 (let ((face (cdar list)))
9085 (unless (eq face (get-text-property beg 'face))
9086 (gnus-put-text-property-excluding-characters-with-faces
9088 (setq face (if (boundp face) (symbol-value face) face)))
9089 (when gnus-summary-highlight-line-function
9090 (funcall gnus-summary-highlight-line-function article face))))
9093 (defun gnus-update-read-articles (group unread &optional compute)
9094 "Update the list of read articles in GROUP."
9095 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9096 (entry (gnus-gethash group gnus-newsrc-hashtb))
9097 (info (nth 2 entry))
9099 (unread (sort (copy-sequence unread) '<))
9101 (if (or (not info) (not active))
9102 ;; There is no info on this group if it was, in fact,
9103 ;; killed. Gnus stores no information on killed groups, so
9104 ;; there's nothing to be done.
9105 ;; One could store the information somewhere temporarily,
9106 ;; perhaps... Hmmm...
9108 ;; Remove any negative articles numbers.
9109 (while (and unread (< (car unread) 0))
9110 (setq unread (cdr unread)))
9111 ;; Remove any expired article numbers
9112 (while (and unread (< (car unread) (car active)))
9113 (setq unread (cdr unread)))
9114 ;; Compute the ranges of read articles by looking at the list of
9117 (when (/= (car unread) prev)
9118 (push (if (= prev (1- (car unread))) prev
9119 (cons prev (1- (car unread))))
9121 (setq prev (1+ (car unread)))
9122 (setq unread (cdr unread)))
9123 (when (<= prev (cdr active))
9124 (push (cons prev (cdr active)) read))
9125 (setq read (if (> (length read) 1) (nreverse read) read))
9129 (set-buffer gnus-group-buffer)
9132 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9133 (gnus-info-set-read ',info ',(gnus-info-read info))
9134 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9135 (gnus-group-update-group ,group t))))
9136 ;; Propagate the read marks to the backend.
9137 (if (gnus-check-backend-function 'request-set-mark group)
9138 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9139 (add (gnus-remove-from-range read (gnus-info-read info))))
9141 (gnus-request-set-mark
9142 group (delq nil (list (if add (list add 'add '(read)))
9143 (if del (list del 'del '(read)))))))))
9144 ;; Enter this list into the group info.
9145 (gnus-info-set-read info read)
9146 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9147 (gnus-get-unread-articles-in-group info (gnus-active group))
9150 (defun gnus-offer-save-summaries ()
9151 "Offer to save all active summary buffers."
9153 (let ((buflist (buffer-list))
9155 ;; Go through all buffers and find all summaries.
9157 (and (setq bufname (buffer-name (car buflist)))
9158 (string-match "Summary" bufname)
9160 (set-buffer bufname)
9161 ;; We check that this is, indeed, a summary buffer.
9162 (and (eq major-mode 'gnus-summary-mode)
9163 ;; Also make sure this isn't bogus.
9164 gnus-newsgroup-prepared
9165 ;; Also make sure that this isn't a dead summary buffer.
9166 (not gnus-dead-summary-mode)))
9167 (push bufname buffers))
9168 (setq buflist (cdr buflist)))
9169 ;; Go through all these summary buffers and offer to save them.
9172 "Update summary buffer %s? "
9174 (switch-to-buffer buf)
9175 (gnus-summary-exit))
9178 (defun gnus-summary-setup-default-charset ()
9179 "Setup newsgroup default charset."
9180 (let ((name (and gnus-newsgroup-name
9181 (gnus-group-real-name gnus-newsgroup-name))))
9182 (setq gnus-newsgroup-charset
9183 (or (and gnus-newsgroup-name
9184 (or (gnus-group-find-parameter gnus-newsgroup-name
9186 (let ((alist gnus-group-charset-alist)
9188 (while (setq elem (pop alist))
9190 (string-match (car elem) name))
9192 charset (cadr elem))))
9194 gnus-default-charset))))
9200 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9201 "Display the current article buffer fully MIME-buttonized.
9202 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9203 treated as multipart/mixed."
9206 (let ((gnus-unbuttonized-mime-types nil)
9207 (gnus-mime-display-multipart-as-mixed show-all-parts))
9208 (gnus-summary-show-article)))
9210 (defun gnus-summary-repair-multipart (article)
9211 "Add a Content-Type header to a multipart article without one."
9212 (interactive (list (gnus-summary-article-number)))
9213 (gnus-with-article article
9214 (message-narrow-to-head)
9215 (goto-char (point-max))
9217 (when (search-forward "\n--" nil t)
9218 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9219 (message-narrow-to-head)
9220 (message-remove-header "Mime-Version")
9221 (message-remove-header "Content-Type")
9222 (goto-char (point-max))
9223 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9225 (insert "Mime-Version: 1.0\n")
9227 (let (gnus-mark-article-hook)
9228 (gnus-summary-select-article t t nil article)))
9230 (defun gnus-summary-toggle-display-buttonized ()
9231 "Toggle the buttonizing of the article buffer."
9234 (if (setq gnus-inhibit-mime-unbuttonizing
9235 (not gnus-inhibit-mime-unbuttonizing))
9236 (let ((gnus-unbuttonized-mime-types nil))
9237 (gnus-summary-show-article))
9238 (gnus-summary-show-article)))
9244 (run-hooks 'gnus-sum-load-hook)
9246 ;;; gnus-sum.el ends here