1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
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.
35 (defcustom gnus-kill-summary-on-exit t
36 "*If non-nil, kill the summary buffer when you exit from it.
37 If nil, the summary will become a \"*Dead Summary*\" buffer, and
38 it will be killed sometime later."
39 :group 'gnus-summary-exit
42 (defcustom gnus-fetch-old-headers nil
43 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
44 If an unread article in the group refers to an older, already read (or
45 just marked as read) article, the old article will not normally be
46 displayed in the Summary buffer. If this variable is non-nil, Gnus
47 will attempt to grab the headers to the old articles, and thereby
48 build complete threads. If it has the value `some', only enough
49 headers to connect otherwise loose threads will be displayed.
50 This variable can also be a number. In that case, no more than that
51 number of old headers will be fetched.
53 The server has to support NOV for any of this to work."
55 :type '(choice (const :tag "off" nil)
58 (sexp :menu-tag "other" t)))
60 (defcustom gnus-summary-make-false-root 'adopt
61 "*nil means that Gnus won't gather loose threads.
62 If the root of a thread has expired or been read in a previous
63 session, the information necessary to build a complete thread has been
64 lost. Instead of having many small sub-threads from this original thread
65 scattered all over the summary buffer, Gnus can gather them.
67 If non-nil, Gnus will try to gather all loose sub-threads from an
68 original thread into one large thread.
70 If this variable is non-nil, it should be one of `none', `adopt',
73 If this variable is `none', Gnus will not make a false root, but just
74 present the sub-threads after another.
75 If this variable is `dummy', Gnus will create a dummy root that will
76 have all the sub-threads as children.
77 If this variable is `adopt', Gnus will make one of the \"children\"
78 the parent and mark all the step-children as such.
79 If this variable is `empty', the \"children\" are printed with empty
80 subject fields. (Or rather, they will be printed with a string
81 given by the `gnus-summary-same-subject' variable.)"
83 :type '(choice (const :tag "off" nil)
89 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
90 "*A regexp to match subjects to be excluded from loose thread gathering.
91 As loose thread gathering is done on subjects only, that means that
92 there can be many false gatherings performed. By rooting out certain
93 common subjects, gathering might become saner."
97 (defcustom gnus-summary-gather-subject-limit nil
98 "*Maximum length of subject comparisons when gathering loose threads.
99 Use nil to compare full subjects. Setting this variable to a low
100 number will help gather threads that have been corrupted by
101 newsreaders chopping off subject lines, but it might also mean that
102 unrelated articles that have subject that happen to begin with the
103 same few characters will be incorrectly gathered.
105 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
108 :type '(choice (const :tag "off" nil)
110 (sexp :menu-tag "on" t)))
112 (defcustom gnus-simplify-ignored-prefixes nil
113 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
115 :type '(choice (const :tag "off" nil)
118 (defcustom gnus-build-sparse-threads nil
119 "*If non-nil, fill in the gaps in threads.
120 If `some', only fill in the gaps that are needed to tie loose threads
121 together. If `more', fill in all leaf nodes that Gnus can find. If
122 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
124 :type '(choice (const :tag "off" nil)
127 (sexp :menu-tag "all" t)))
129 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
130 "Function used for gathering loose threads.
131 There are two pre-defined functions: `gnus-gather-threads-by-subject',
132 which only takes Subjects into consideration; and
133 `gnus-gather-threads-by-references', which compared the References
134 headers of the articles to find matches."
136 :type '(set (function-item gnus-gather-threads-by-subject)
137 (function-item gnus-gather-threads-by-references)
138 (function :tag "other")))
140 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
141 (defcustom gnus-summary-same-subject ""
142 "*String indicating that the current article has the same subject as the previous.
143 This variable will only be used if the value of
144 `gnus-summary-make-false-root' is `empty'."
145 :group 'gnus-summary-format
148 (defcustom gnus-summary-goto-unread t
149 "*If t, marking commands will go to the next unread article.
150 If `never', commands that usually go to the next unread article, will
151 go to the next article, whether it is read or not.
152 If nil, only the marking commands will go to the next (un)read article."
153 :group 'gnus-summary-marks
154 :link '(custom-manual "(gnus)Setting Marks")
155 :type '(choice (const :tag "off" nil)
157 (sexp :menu-tag "on" t)))
159 (defcustom gnus-summary-default-score 0
160 "*Default article score level.
161 All scores generated by the score files will be added to this score.
162 If this variable is nil, scoring will be disabled."
163 :group 'gnus-score-default
164 :type '(choice (const :tag "disable")
167 (defcustom gnus-summary-zcore-fuzz 0
168 "*Fuzziness factor for the zcore in the summary buffer.
169 Articles with scores closer than this to `gnus-summary-default-score'
171 :group 'gnus-summary-format
174 (defcustom gnus-simplify-subject-fuzzy-regexp nil
175 "*Strings to be removed when doing fuzzy matches.
176 This can either be a regular expression or list of regular expressions
177 that will be removed from subject strings if fuzzy subject
178 simplification is selected."
180 :type '(repeat regexp))
182 (defcustom gnus-show-threads t
183 "*If non-nil, display threads in summary mode."
187 (defcustom gnus-thread-hide-subtree nil
188 "*If non-nil, hide all threads initially.
189 If threads are hidden, you have to run the command
190 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
191 to expose hidden threads."
195 (defcustom gnus-thread-hide-killed t
196 "*If non-nil, hide killed threads automatically."
200 (defcustom gnus-thread-ignore-subject nil
201 "*If non-nil, ignore subjects and do all threading based on the Reference header.
202 If nil, which is the default, articles that have different subjects
203 from their parents will start separate threads."
207 (defcustom gnus-thread-operation-ignore-subject t
208 "*If non-nil, subjects will be ignored when doing thread commands.
209 This affects commands like `gnus-summary-kill-thread' and
210 `gnus-summary-lower-thread'.
212 If this variable is nil, articles in the same thread with different
213 subjects will not be included in the operation in question. If this
214 variable is `fuzzy', only articles that have subjects that are fuzzily
215 equal will be included."
217 :type '(choice (const :tag "off" nil)
221 (defcustom gnus-thread-indent-level 4
222 "*Number that says how much each sub-thread should be indented."
226 (defcustom gnus-auto-extend-newsgroup t
227 "*If non-nil, extend newsgroup forward and backward when requested."
228 :group 'gnus-summary-choose
231 (defcustom gnus-auto-select-first t
232 "*If nil, don't select the first unread article when entering a group.
233 If this variable is `best', select the highest-scored unread article
234 in the group. If neither nil nor `best', select the first unread
237 If you want to prevent automatic selection of the first unread article
238 in some newsgroups, set the variable to nil in
239 `gnus-select-group-hook'."
240 :group 'gnus-group-select
241 :type '(choice (const :tag "none" nil)
243 (sexp :menu-tag "first" t)))
245 (defcustom gnus-auto-select-next t
246 "*If non-nil, offer to go to the next group from the end of the previous.
247 If the value is t and the next newsgroup is empty, Gnus will exit
248 summary mode and go back to group mode. If the value is neither nil
249 nor t, Gnus will select the following unread newsgroup. In
250 particular, if the value is the symbol `quietly', the next unread
251 newsgroup will be selected without any confirmation, and if it is
252 `almost-quietly', the next group will be selected without any
253 confirmation if you are located on the last article in the group.
254 Finally, if this variable is `slightly-quietly', the `Z n' command
255 will go to the next group without confirmation."
256 :group 'gnus-summary-maneuvering
257 :type '(choice (const :tag "off" nil)
259 (const almost-quietly)
260 (const slightly-quietly)
261 (sexp :menu-tag "on" t)))
263 (defcustom gnus-auto-select-same nil
264 "*If non-nil, select the next article with the same subject."
265 :group 'gnus-summary-maneuvering
268 (defcustom gnus-summary-check-current nil
269 "*If non-nil, consider the current article when moving.
270 The \"unread\" movement commands will stay on the same line if the
271 current article is unread."
272 :group 'gnus-summary-maneuvering
275 (defcustom gnus-auto-center-summary t
276 "*If non-nil, always center the current summary buffer.
277 In particular, if `vertical' do only vertical recentering. If non-nil
278 and non-`vertical', do both horizontal and vertical recentering."
279 :group 'gnus-summary-maneuvering
280 :type '(choice (const :tag "none" nil)
282 (sexp :menu-tag "both" t)))
284 (defcustom gnus-show-all-headers nil
285 "*If non-nil, don't hide any headers."
286 :group 'gnus-article-hiding
287 :group 'gnus-article-headers
290 (defcustom gnus-single-article-buffer t
291 "*If non-nil, display all articles in the same buffer.
292 If nil, each group will get its own article buffer."
293 :group 'gnus-article-various
296 (defcustom gnus-break-pages t
297 "*If non-nil, do page breaking on articles.
298 The page delimiter is specified by the `gnus-page-delimiter'
300 :group 'gnus-article-various
303 (defcustom gnus-show-mime nil
304 "*If non-nil, do mime processing of articles.
305 The articles will simply be fed to the function given by
306 `gnus-show-mime-method'."
307 :group 'gnus-article-mime
310 (defcustom gnus-move-split-methods nil
311 "*Variable used to suggest where articles are to be moved to.
312 It uses the same syntax as the `gnus-split-methods' variable."
313 :group 'gnus-summary-mail
314 :type '(repeat (choice (list function)
315 (cons regexp (repeat string))
318 (defcustom gnus-unread-mark ?
319 "*Mark used for unread articles."
320 :group 'gnus-summary-marks
323 (defcustom gnus-ticked-mark ?!
324 "*Mark used for ticked articles."
325 :group 'gnus-summary-marks
328 (defcustom gnus-dormant-mark ??
329 "*Mark used for dormant articles."
330 :group 'gnus-summary-marks
333 (defcustom gnus-del-mark ?r
334 "*Mark used for del'd articles."
335 :group 'gnus-summary-marks
338 (defcustom gnus-read-mark ?R
339 "*Mark used for read articles."
340 :group 'gnus-summary-marks
343 (defcustom gnus-expirable-mark ?E
344 "*Mark used for expirable articles."
345 :group 'gnus-summary-marks
348 (defcustom gnus-killed-mark ?K
349 "*Mark used for killed articles."
350 :group 'gnus-summary-marks
353 (defcustom gnus-souped-mark ?F
354 "*Mark used for killed articles."
355 :group 'gnus-summary-marks
358 (defcustom gnus-kill-file-mark ?X
359 "*Mark used for articles killed by kill files."
360 :group 'gnus-summary-marks
363 (defcustom gnus-low-score-mark ?Y
364 "*Mark used for articles with a low score."
365 :group 'gnus-summary-marks
368 (defcustom gnus-catchup-mark ?C
369 "*Mark used for articles that are caught up."
370 :group 'gnus-summary-marks
373 (defcustom gnus-replied-mark ?A
374 "*Mark used for articles that have been replied to."
375 :group 'gnus-summary-marks
378 (defcustom gnus-cached-mark ?*
379 "*Mark used for articles that are in the cache."
380 :group 'gnus-summary-marks
383 (defcustom gnus-saved-mark ?S
384 "*Mark used for articles that have been saved to."
385 :group 'gnus-summary-marks
388 (defcustom gnus-ancient-mark ?O
389 "*Mark used for ancient articles."
390 :group 'gnus-summary-marks
393 (defcustom gnus-sparse-mark ?Q
394 "*Mark used for sparsely reffed articles."
395 :group 'gnus-summary-marks
398 (defcustom gnus-canceled-mark ?G
399 "*Mark used for canceled articles."
400 :group 'gnus-summary-marks
403 (defcustom gnus-duplicate-mark ?M
404 "*Mark used for duplicate articles."
405 :group 'gnus-summary-marks
408 (defcustom gnus-score-over-mark ?+
409 "*Score mark used for articles with high scores."
410 :group 'gnus-summary-marks
413 (defcustom gnus-score-below-mark ?-
414 "*Score mark used for articles with low scores."
415 :group 'gnus-summary-marks
418 (defcustom gnus-empty-thread-mark ?
419 "*There is no thread under the article."
420 :group 'gnus-summary-marks
423 (defcustom gnus-not-empty-thread-mark ?=
424 "*There is a thread under the article."
425 :group 'gnus-summary-marks
428 (defcustom gnus-view-pseudo-asynchronously nil
429 "*If non-nil, Gnus will view pseudo-articles asynchronously."
430 :group 'gnus-extract-view
433 (defcustom gnus-view-pseudos nil
434 "*If `automatic', pseudo-articles will be viewed automatically.
435 If `not-confirm', pseudos will be viewed automatically, and the user
436 will not be asked to confirm the command."
437 :group 'gnus-extract-view
438 :type '(choice (const :tag "off" nil)
440 (const not-confirm)))
442 (defcustom gnus-view-pseudos-separately t
443 "*If non-nil, one pseudo-article will be created for each file to be viewed.
444 If nil, all files that use the same viewing command will be given as a
445 list of parameters to that command."
446 :group 'gnus-extract-view
449 (defcustom gnus-insert-pseudo-articles t
450 "*If non-nil, insert pseudo-articles when decoding articles."
451 :group 'gnus-extract-view
454 (defcustom gnus-summary-dummy-line-format
456 "*The format specification for the dummy roots in the summary buffer.
457 It works along the same lines as a normal formatting string,
458 with some simple extensions.
461 :group 'gnus-threading
464 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
465 "*The format specification for the summary mode line.
466 It works along the same lines as a normal formatting string,
467 with some simple extensions:
470 %p Unprefixed group name
471 %A Current article number
473 %U Number of unread articles in the group
474 %e Number of unselected articles in the group
475 %Z A string with unread/unselected article counts
476 %g Shortish group name
477 %S Subject of the current article
479 %s Current score file name
480 %d Number of dormant articles
481 %r Number of articles that have been marked as read in this session
482 %E Number of articles expunged by the score files"
483 :group 'gnus-summary-format
486 (defcustom gnus-summary-mark-below 0
487 "*Mark all articles with a score below this variable as read.
488 This variable is local to each summary buffer and usually set by the
490 :group 'gnus-score-default
493 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
494 "*List of functions used for sorting articles in the summary buffer.
495 This variable is only used when not using a threaded display."
496 :group 'gnus-summary-sort
497 :type '(repeat (choice (function-item gnus-article-sort-by-number)
498 (function-item gnus-article-sort-by-author)
499 (function-item gnus-article-sort-by-subject)
500 (function-item gnus-article-sort-by-date)
501 (function-item gnus-article-sort-by-score)
502 (function :tag "other"))))
504 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
505 "*List of functions used for sorting threads in the summary buffer.
506 By default, threads are sorted by article number.
508 Each function takes two threads and return non-nil if the first thread
509 should be sorted before the other. If you use more than one function,
510 the primary sort function should be the last. You should probably
511 always include `gnus-thread-sort-by-number' in the list of sorting
512 functions -- preferably first.
514 Ready-made functions include `gnus-thread-sort-by-number',
515 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
516 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
517 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
518 :group 'gnus-summary-sort
519 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
520 (function-item gnus-thread-sort-by-author)
521 (function-item gnus-thread-sort-by-subject)
522 (function-item gnus-thread-sort-by-date)
523 (function-item gnus-thread-sort-by-score)
524 (function-item gnus-thread-sort-by-total-score)
525 (function :tag "other"))))
527 (defcustom gnus-thread-score-function '+
528 "*Function used for calculating the total score of a thread.
530 The function is called with the scores of the article and each
531 subthread and should then return the score of the thread.
533 Some functions you can use are `+', `max', or `min'."
534 :group 'gnus-summary-sort
537 (defcustom gnus-summary-expunge-below nil
538 "All articles that have a score less than this variable will be expunged."
539 :group 'gnus-score-default
540 :type '(choice (const :tag "off" nil)
543 (defcustom gnus-thread-expunge-below nil
544 "All threads that have a total score less than this variable will be expunged.
545 See `gnus-thread-score-function' for en explanation of what a
546 \"thread score\" is."
547 :group 'gnus-treading
548 :group 'gnus-score-default
549 :type '(choice (const :tag "off" nil)
552 (defcustom gnus-summary-mode-hook nil
553 "*A hook for Gnus summary mode.
554 This hook is run before any variables are set in the summary buffer."
555 :group 'gnus-summary-various
558 (defcustom gnus-summary-menu-hook nil
559 "*Hook run after the creation of the summary mode menu."
560 :group 'gnus-summary-visual
563 (defcustom gnus-summary-exit-hook nil
564 "*A hook called on exit from the summary buffer.
565 It will be called with point in the group buffer."
566 :group 'gnus-summary-exit
569 (defcustom gnus-summary-prepare-hook nil
570 "*A hook called after the summary buffer has been generated.
571 If you want to modify the summary buffer, you can use this hook."
572 :group 'gnus-summary-various
575 (defcustom gnus-summary-generate-hook nil
576 "*A hook run just before generating the summary buffer.
577 This hook is commonly used to customize threading variables and the
579 :group 'gnus-summary-various
582 (defcustom gnus-select-group-hook nil
583 "*A hook called when a newsgroup is selected.
585 If you'd like to simplify subjects like the
586 `gnus-summary-next-same-subject' command does, you can use the
589 (setq gnus-select-group-hook
592 (mapcar (lambda (header)
593 (mail-header-set-subject
595 (gnus-simplify-subject
596 (mail-header-subject header) 're-only)))
597 gnus-newsgroup-headers))))"
598 :group 'gnus-group-select
601 (defcustom gnus-select-article-hook nil
602 "*A hook called when an article is selected."
603 :group 'gnus-summary-choose
606 (defcustom gnus-visual-mark-article-hook
607 (list 'gnus-highlight-selected-summary)
608 "*Hook run after selecting an article in the summary buffer.
609 It is meant to be used for highlighting the article in some way. It
610 is not run if `gnus-visual' is nil."
611 :group 'gnus-summary-visual
614 (defcustom gnus-parse-headers-hook
615 (list 'gnus-decode-rfc1522)
616 "*A hook called before parsing the headers."
620 (defcustom gnus-exit-group-hook nil
621 "*A hook called when exiting (not quitting) summary mode."
625 (defcustom gnus-summary-update-hook
626 (list 'gnus-summary-highlight-line)
627 "*A hook called when a summary line is changed.
628 The hook will not be called if `gnus-visual' is nil.
630 The default function `gnus-summary-highlight-line' will
631 highlight the line according to the `gnus-summary-highlight'
633 :group 'gnus-summary-visual
636 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
637 "*A hook called when an article is selected for the first time.
638 The hook is intended to mark an article as read (or unread)
639 automatically when it is selected."
640 :group 'gnus-summary-choose
643 (defcustom gnus-group-no-more-groups-hook nil
644 "*A hook run when returning to group mode having no more (unread) groups."
645 :group 'gnus-group-select
648 (defcustom gnus-ps-print-hook nil
649 "*A hook run before ps-printing something from Gnus."
653 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
654 "Face used for highlighting the current article in the summary buffer."
655 :group 'gnus-summary-visual
658 (defcustom gnus-summary-highlight
659 '(((= mark gnus-canceled-mark)
660 . gnus-summary-cancelled-face)
661 ((and (> score default)
662 (or (= mark gnus-dormant-mark)
663 (= mark gnus-ticked-mark)))
664 . gnus-summary-high-ticked-face)
665 ((and (< score default)
666 (or (= mark gnus-dormant-mark)
667 (= mark gnus-ticked-mark)))
668 . gnus-summary-low-ticked-face)
669 ((or (= mark gnus-dormant-mark)
670 (= mark gnus-ticked-mark))
671 . gnus-summary-normal-ticked-face)
672 ((and (> score default) (= mark gnus-ancient-mark))
673 . gnus-summary-high-ancient-face)
674 ((and (< score default) (= mark gnus-ancient-mark))
675 . gnus-summary-low-ancient-face)
676 ((= mark gnus-ancient-mark)
677 . gnus-summary-normal-ancient-face)
678 ((and (> score default) (= mark gnus-unread-mark))
679 . gnus-summary-high-unread-face)
680 ((and (< score default) (= mark gnus-unread-mark))
681 . gnus-summary-low-unread-face)
682 ((and (= mark gnus-unread-mark))
683 . gnus-summary-normal-unread-face)
685 . gnus-summary-high-read-face)
687 . gnus-summary-low-read-face)
689 . gnus-summary-normal-read-face))
690 "Controls the highlighting of summary buffer lines.
692 A list of (FORM . FACE) pairs. When deciding how a a particular
693 summary line should be displayed, each form is evaluated. The content
694 of the face field after the first true form is used. You can change
695 how those summary lines are displayed, by editing the face field.
697 You can use the following variables in the FORM field.
699 score: The articles score
700 default: The default article score.
701 below: The score below which articles are automatically marked as read.
702 mark: The articles mark."
703 :group 'gnus-summary-visual
704 :type '(repeat (cons (sexp :tag "Form" nil)
708 ;;; Internal variables
710 (defvar gnus-scores-exclude-files nil)
712 (defvar gnus-summary-display-table
713 ;; Change the display table. Odd characters have a tendency to mess
714 ;; up nicely formatted displays - we make all possible glyphs
715 ;; display only a single character.
717 ;; We start from the standard display table, if any.
718 (let ((table (or (copy-sequence standard-display-table)
719 (make-display-table)))
720 ;; Nix out all the control chars...
722 (while (>= (setq i (1- i)) 0)
724 ;; ... but not newline and cr, of course. (cr is necessary for the
725 ;; selective display).
728 ;; We nix out any glyphs over 126 that are not set already.
730 (while (>= (setq i (1- i)) 127)
731 ;; Only modify if the entry is nil.
733 (aset table i [??]))))
735 "Display table used in summary mode buffers.")
737 (defvar gnus-original-article nil)
738 (defvar gnus-article-internal-prepare-hook nil)
739 (defvar gnus-newsgroup-process-stack nil)
741 (defvar gnus-thread-indent-array nil)
742 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
744 ;; Avoid highlighting in kill files.
745 (defvar gnus-summary-inhibit-highlight nil)
746 (defvar gnus-newsgroup-selected-overlay nil)
747 (defvar gnus-inhibit-limiting nil)
748 (defvar gnus-newsgroup-adaptive-score-file nil)
749 (defvar gnus-current-score-file nil)
750 (defvar gnus-current-move-group nil)
751 (defvar gnus-current-copy-group nil)
752 (defvar gnus-current-crosspost-group nil)
754 (defvar gnus-newsgroup-dependencies nil)
755 (defvar gnus-newsgroup-adaptive nil)
756 (defvar gnus-summary-display-article-function nil)
757 (defvar gnus-summary-highlight-line-function nil
758 "Function called after highlighting a summary line.")
760 (defvar gnus-summary-line-format-alist
761 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
762 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
763 (?s gnus-tmp-subject-or-nil ?s)
764 (?n gnus-tmp-name ?s)
765 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
767 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
769 (?F gnus-tmp-from ?s)
770 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
771 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
772 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
773 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
774 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
775 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
776 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
777 (?L gnus-tmp-lines ?d)
778 (?I gnus-tmp-indentation ?s)
779 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
780 (?R gnus-tmp-replied ?c)
781 (?\[ gnus-tmp-opening-bracket ?c)
782 (?\] gnus-tmp-closing-bracket ?c)
783 (?\> (make-string gnus-tmp-level ? ) ?s)
784 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
785 (?i gnus-tmp-score ?d)
786 (?z gnus-tmp-score-char ?c)
787 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
788 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
789 (?U gnus-tmp-unread ?c)
790 (?t (gnus-summary-number-of-articles-in-thread
791 (and (boundp 'thread) (car thread)) gnus-tmp-level)
793 (?e (gnus-summary-number-of-articles-in-thread
794 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
796 (?u gnus-tmp-user-defined ?s)
797 (?P (gnus-pick-line-number) ?d))
798 "An alist of format specifications that can appear in summary lines,
799 and what variables they correspond with, along with the type of the
800 variable (string, integer, character, etc).")
802 (defvar gnus-summary-dummy-line-format-alist
803 `((?S gnus-tmp-subject ?s)
804 (?N gnus-tmp-number ?d)
805 (?u gnus-tmp-user-defined ?s)))
807 (defvar gnus-summary-mode-line-format-alist
808 `((?G gnus-tmp-group-name ?s)
809 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
810 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
811 (?A gnus-tmp-article-number ?d)
812 (?Z gnus-tmp-unread-and-unselected ?s)
814 (?U gnus-tmp-unread-and-unticked ?d)
815 (?S gnus-tmp-subject ?s)
816 (?e gnus-tmp-unselected ?d)
817 (?u gnus-tmp-user-defined ?s)
818 (?d (length gnus-newsgroup-dormant) ?d)
819 (?t (length gnus-newsgroup-marked) ?d)
820 (?r (length gnus-newsgroup-reads) ?d)
821 (?E gnus-newsgroup-expunged-tally ?d)
822 (?s (gnus-current-score-file-nondirectory) ?s)))
824 (defvar gnus-last-search-regexp nil
825 "Default regexp for article search command.")
827 (defvar gnus-last-shell-command nil
828 "Default shell command on article.")
830 (defvar gnus-newsgroup-begin nil)
831 (defvar gnus-newsgroup-end nil)
832 (defvar gnus-newsgroup-last-rmail nil)
833 (defvar gnus-newsgroup-last-mail nil)
834 (defvar gnus-newsgroup-last-folder nil)
835 (defvar gnus-newsgroup-last-file nil)
836 (defvar gnus-newsgroup-auto-expire nil)
837 (defvar gnus-newsgroup-active nil)
839 (defvar gnus-newsgroup-data nil)
840 (defvar gnus-newsgroup-data-reverse nil)
841 (defvar gnus-newsgroup-limit nil)
842 (defvar gnus-newsgroup-limits nil)
844 (defvar gnus-newsgroup-unreads nil
845 "List of unread articles in the current newsgroup.")
847 (defvar gnus-newsgroup-unselected nil
848 "List of unselected unread articles in the current newsgroup.")
850 (defvar gnus-newsgroup-reads nil
851 "Alist of read articles and article marks in the current newsgroup.")
853 (defvar gnus-newsgroup-expunged-tally nil)
855 (defvar gnus-newsgroup-marked nil
856 "List of ticked articles in the current newsgroup (a subset of unread art).")
858 (defvar gnus-newsgroup-killed nil
859 "List of ranges of articles that have been through the scoring process.")
861 (defvar gnus-newsgroup-cached nil
862 "List of articles that come from the article cache.")
864 (defvar gnus-newsgroup-saved nil
865 "List of articles that have been saved.")
867 (defvar gnus-newsgroup-kill-headers nil)
869 (defvar gnus-newsgroup-replied nil
870 "List of articles that have been replied to in the current newsgroup.")
872 (defvar gnus-newsgroup-expirable nil
873 "List of articles in the current newsgroup that can be expired.")
875 (defvar gnus-newsgroup-processable nil
876 "List of articles in the current newsgroup that can be processed.")
878 (defvar gnus-newsgroup-bookmarks nil
879 "List of articles in the current newsgroup that have bookmarks.")
881 (defvar gnus-newsgroup-dormant nil
882 "List of dormant articles in the current newsgroup.")
884 (defvar gnus-newsgroup-scored nil
885 "List of scored articles in the current newsgroup.")
887 (defvar gnus-newsgroup-headers nil
888 "List of article headers in the current newsgroup.")
890 (defvar gnus-newsgroup-threads nil)
892 (defvar gnus-newsgroup-prepared nil
893 "Whether the current group has been prepared properly.")
895 (defvar gnus-newsgroup-ancient nil
896 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
898 (defvar gnus-newsgroup-sparse nil)
900 (defvar gnus-current-article nil)
901 (defvar gnus-article-current nil)
902 (defvar gnus-current-headers nil)
903 (defvar gnus-have-all-headers nil)
904 (defvar gnus-last-article nil)
905 (defvar gnus-newsgroup-history nil)
907 (defconst gnus-summary-local-variables
908 '(gnus-newsgroup-name
909 gnus-newsgroup-begin gnus-newsgroup-end
910 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
911 gnus-newsgroup-last-folder gnus-newsgroup-last-file
912 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
913 gnus-newsgroup-unselected gnus-newsgroup-marked
914 gnus-newsgroup-reads gnus-newsgroup-saved
915 gnus-newsgroup-replied gnus-newsgroup-expirable
916 gnus-newsgroup-processable gnus-newsgroup-killed
917 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
918 gnus-newsgroup-headers gnus-newsgroup-threads
919 gnus-newsgroup-prepared gnus-summary-highlight-line-function
920 gnus-current-article gnus-current-headers gnus-have-all-headers
921 gnus-last-article gnus-article-internal-prepare-hook
922 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
923 gnus-newsgroup-scored gnus-newsgroup-kill-headers
924 gnus-thread-expunge-below
925 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
926 (gnus-summary-mark-below . global)
927 gnus-newsgroup-active gnus-scores-exclude-files
928 gnus-newsgroup-history gnus-newsgroup-ancient
929 gnus-newsgroup-sparse gnus-newsgroup-process-stack
930 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
931 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
932 (gnus-newsgroup-expunged-tally . 0)
933 gnus-cache-removable-articles gnus-newsgroup-cached
934 gnus-newsgroup-data gnus-newsgroup-data-reverse
935 gnus-newsgroup-limit gnus-newsgroup-limits)
936 "Variables that are buffer-local to the summary buffers.")
938 ;; Byte-compiler warning.
939 (defvar gnus-article-mode-map)
941 ;; Subject simplification.
943 (defsubst gnus-simplify-subject-re (subject)
944 "Remove \"Re:\" from subject lines."
945 (if (string-match "^[Rr][Ee]: *" subject)
946 (substring subject (match-end 0))
949 (defun gnus-simplify-subject (subject &optional re-only)
950 "Remove `Re:' and words in parentheses.
951 If RE-ONLY is non-nil, strip leading `Re:'s only."
952 (let ((case-fold-search t)) ;Ignore case.
953 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
954 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
955 (setq subject (substring subject (match-end 0))))
956 ;; Remove uninteresting prefixes.
957 (when (and (not re-only)
958 gnus-simplify-ignored-prefixes
959 (string-match gnus-simplify-ignored-prefixes subject))
960 (setq subject (substring subject (match-end 0))))
961 ;; Remove words in parentheses from end.
963 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
964 (setq subject (substring subject 0 (match-beginning 0)))))
965 ;; Return subject string.
968 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
970 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
971 (goto-char (point-min))
972 (while (re-search-forward regexp nil t)
973 (replace-match (or newtext ""))))
975 (defun gnus-simplify-buffer-fuzzy ()
976 "Simplify string in the buffer fuzzily.
977 The string in the accessible portion of the current buffer is simplified.
978 It is assumed to be a single-line subject.
979 Whitespace is generally cleaned up, and miscellaneous leading/trailing
980 matter is removed. Additional things can be deleted by setting
981 gnus-simplify-subject-fuzzy-regexp."
982 (let ((case-fold-search t)
984 (gnus-simplify-buffer-fuzzy-step "\t" " ")
986 (while (not (eq modified-tick (buffer-modified-tick)))
987 (setq modified-tick (buffer-modified-tick))
989 ((listp gnus-simplify-subject-fuzzy-regexp)
990 (mapcar 'gnus-simplify-buffer-fuzzy-step
991 gnus-simplify-subject-fuzzy-regexp))
992 (gnus-simplify-subject-fuzzy-regexp
993 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
994 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
995 (gnus-simplify-buffer-fuzzy-step
996 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
997 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
999 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1000 (gnus-simplify-buffer-fuzzy-step " +" " ")
1001 (gnus-simplify-buffer-fuzzy-step " $")
1002 (gnus-simplify-buffer-fuzzy-step "^ +")))
1004 (defun gnus-simplify-subject-fuzzy (subject)
1005 "Simplify a subject string fuzzily.
1006 See gnus-simplify-buffer-fuzzy for details."
1008 (gnus-set-work-buffer)
1009 (let ((case-fold-search t))
1011 (inline (gnus-simplify-buffer-fuzzy))
1014 (defsubst gnus-simplify-subject-fully (subject)
1015 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1017 ((null gnus-summary-gather-subject-limit)
1018 (gnus-simplify-subject-re subject))
1019 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1020 (gnus-simplify-subject-fuzzy subject))
1021 ((numberp gnus-summary-gather-subject-limit)
1022 (gnus-limit-string (gnus-simplify-subject-re subject)
1023 gnus-summary-gather-subject-limit))
1027 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1028 "Check whether two subjects are equal. If optional argument
1029 simple-first is t, first argument is already simplified."
1031 ((null simple-first)
1032 (equal (gnus-simplify-subject-fully s1)
1033 (gnus-simplify-subject-fully s2)))
1036 (gnus-simplify-subject-fully s2)))))
1038 (defun gnus-summary-bubble-group ()
1039 "Increase the score of the current group.
1040 This is a handy function to add to `gnus-summary-exit-hook' to
1041 increase the score of each group you read."
1042 (gnus-group-add-score gnus-newsgroup-name))
1046 ;;; Gnus summary mode
1049 (put 'gnus-summary-mode 'mode-class 'special)
1052 ;; Non-orthogonal keys
1054 (gnus-define-keys gnus-summary-mode-map
1055 " " gnus-summary-next-page
1056 "\177" gnus-summary-prev-page
1057 [delete] gnus-summary-prev-page
1058 "\r" gnus-summary-scroll-up
1059 "n" gnus-summary-next-unread-article
1060 "p" gnus-summary-prev-unread-article
1061 "N" gnus-summary-next-article
1062 "P" gnus-summary-prev-article
1063 "\M-\C-n" gnus-summary-next-same-subject
1064 "\M-\C-p" gnus-summary-prev-same-subject
1065 "\M-n" gnus-summary-next-unread-subject
1066 "\M-p" gnus-summary-prev-unread-subject
1067 "." gnus-summary-first-unread-article
1068 "," gnus-summary-best-unread-article
1069 "\M-s" gnus-summary-search-article-forward
1070 "\M-r" gnus-summary-search-article-backward
1071 "<" gnus-summary-beginning-of-article
1072 ">" gnus-summary-end-of-article
1073 "j" gnus-summary-goto-article
1074 "^" gnus-summary-refer-parent-article
1075 "\M-^" gnus-summary-refer-article
1076 "u" gnus-summary-tick-article-forward
1077 "!" gnus-summary-tick-article-forward
1078 "U" gnus-summary-tick-article-backward
1079 "d" gnus-summary-mark-as-read-forward
1080 "D" gnus-summary-mark-as-read-backward
1081 "E" gnus-summary-mark-as-expirable
1082 "\M-u" gnus-summary-clear-mark-forward
1083 "\M-U" gnus-summary-clear-mark-backward
1084 "k" gnus-summary-kill-same-subject-and-select
1085 "\C-k" gnus-summary-kill-same-subject
1086 "\M-\C-k" gnus-summary-kill-thread
1087 "\M-\C-l" gnus-summary-lower-thread
1088 "e" gnus-summary-edit-article
1089 "#" gnus-summary-mark-as-processable
1090 "\M-#" gnus-summary-unmark-as-processable
1091 "\M-\C-t" gnus-summary-toggle-threads
1092 "\M-\C-s" gnus-summary-show-thread
1093 "\M-\C-h" gnus-summary-hide-thread
1094 "\M-\C-f" gnus-summary-next-thread
1095 "\M-\C-b" gnus-summary-prev-thread
1096 "\M-\C-u" gnus-summary-up-thread
1097 "\M-\C-d" gnus-summary-down-thread
1098 "&" gnus-summary-execute-command
1099 "c" gnus-summary-catchup-and-exit
1100 "\C-w" gnus-summary-mark-region-as-read
1101 "\C-t" gnus-summary-toggle-truncation
1102 "?" gnus-summary-mark-as-dormant
1103 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1104 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1105 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1106 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1107 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1108 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1109 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1110 "=" gnus-summary-expand-window
1111 "\C-x\C-s" gnus-summary-reselect-current-group
1112 "\M-g" gnus-summary-rescan-group
1113 "w" gnus-summary-stop-page-breaking
1114 "\C-c\C-r" gnus-summary-caesar-message
1115 "\M-t" gnus-summary-toggle-mime
1116 "f" gnus-summary-followup
1117 "F" gnus-summary-followup-with-original
1118 "C" gnus-summary-cancel-article
1119 "r" gnus-summary-reply
1120 "R" gnus-summary-reply-with-original
1121 "\C-c\C-f" gnus-summary-mail-forward
1122 "o" gnus-summary-save-article
1123 "\C-o" gnus-summary-save-article-mail
1124 "|" gnus-summary-pipe-output
1125 "\M-k" gnus-summary-edit-local-kill
1126 "\M-K" gnus-summary-edit-global-kill
1128 "\C-c\C-d" gnus-summary-describe-group
1129 "q" gnus-summary-exit
1130 "Q" gnus-summary-exit-no-update
1131 "\C-c\C-i" gnus-info-find-node
1132 gnus-mouse-2 gnus-mouse-pick-article
1133 "m" gnus-summary-mail-other-window
1134 "a" gnus-summary-post-news
1135 "x" gnus-summary-limit-to-unread
1136 "s" gnus-summary-isearch-article
1137 "t" gnus-article-hide-headers
1138 "g" gnus-summary-show-article
1139 "l" gnus-summary-goto-last-article
1140 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1141 "\C-d" gnus-summary-enter-digest-group
1142 "\M-\C-d" gnus-summary-read-document
1144 "*" gnus-cache-enter-article
1145 "\M-*" gnus-cache-remove-article
1146 "\M-&" gnus-summary-universal-argument
1147 "\C-l" gnus-recenter
1148 "I" gnus-summary-increase-score
1149 "L" gnus-summary-lower-score
1151 "V" gnus-summary-score-map
1152 "X" gnus-uu-extract-map
1153 "S" gnus-summary-send-map)
1155 ;; Sort of orthogonal keymap
1156 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1157 "t" gnus-summary-tick-article-forward
1158 "!" gnus-summary-tick-article-forward
1159 "d" gnus-summary-mark-as-read-forward
1160 "r" gnus-summary-mark-as-read-forward
1161 "c" gnus-summary-clear-mark-forward
1162 " " gnus-summary-clear-mark-forward
1163 "e" gnus-summary-mark-as-expirable
1164 "x" gnus-summary-mark-as-expirable
1165 "?" gnus-summary-mark-as-dormant
1166 "b" gnus-summary-set-bookmark
1167 "B" gnus-summary-remove-bookmark
1168 "#" gnus-summary-mark-as-processable
1169 "\M-#" gnus-summary-unmark-as-processable
1170 "S" gnus-summary-limit-include-expunged
1171 "C" gnus-summary-catchup
1172 "H" gnus-summary-catchup-to-here
1173 "\C-c" gnus-summary-catchup-all
1174 "k" gnus-summary-kill-same-subject-and-select
1175 "K" gnus-summary-kill-same-subject
1176 "P" gnus-uu-mark-map)
1178 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1179 "c" gnus-summary-clear-above
1180 "u" gnus-summary-tick-above
1181 "m" gnus-summary-mark-above
1182 "k" gnus-summary-kill-below)
1184 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1185 "/" gnus-summary-limit-to-subject
1186 "n" gnus-summary-limit-to-articles
1187 "w" gnus-summary-pop-limit
1188 "s" gnus-summary-limit-to-subject
1189 "a" gnus-summary-limit-to-author
1190 "u" gnus-summary-limit-to-unread
1191 "m" gnus-summary-limit-to-marks
1192 "v" gnus-summary-limit-to-score
1193 "D" gnus-summary-limit-include-dormant
1194 "d" gnus-summary-limit-exclude-dormant
1195 "t" gnus-summary-limit-to-age
1196 "E" gnus-summary-limit-include-expunged
1197 "c" gnus-summary-limit-exclude-childless-dormant
1198 "C" gnus-summary-limit-mark-excluded-as-read)
1200 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1201 "n" gnus-summary-next-unread-article
1202 "p" gnus-summary-prev-unread-article
1203 "N" gnus-summary-next-article
1204 "P" gnus-summary-prev-article
1205 "\C-n" gnus-summary-next-same-subject
1206 "\C-p" gnus-summary-prev-same-subject
1207 "\M-n" gnus-summary-next-unread-subject
1208 "\M-p" gnus-summary-prev-unread-subject
1209 "f" gnus-summary-first-unread-article
1210 "b" gnus-summary-best-unread-article
1211 "j" gnus-summary-goto-article
1212 "g" gnus-summary-goto-subject
1213 "l" gnus-summary-goto-last-article
1214 "p" gnus-summary-pop-article)
1216 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1217 "k" gnus-summary-kill-thread
1218 "l" gnus-summary-lower-thread
1219 "i" gnus-summary-raise-thread
1220 "T" gnus-summary-toggle-threads
1221 "t" gnus-summary-rethread-current
1222 "^" gnus-summary-reparent-thread
1223 "s" gnus-summary-show-thread
1224 "S" gnus-summary-show-all-threads
1225 "h" gnus-summary-hide-thread
1226 "H" gnus-summary-hide-all-threads
1227 "n" gnus-summary-next-thread
1228 "p" gnus-summary-prev-thread
1229 "u" gnus-summary-up-thread
1230 "o" gnus-summary-top-thread
1231 "d" gnus-summary-down-thread
1232 "#" gnus-uu-mark-thread
1233 "\M-#" gnus-uu-unmark-thread)
1235 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1236 "g" gnus-summary-prepare
1237 "c" gnus-summary-insert-cached-articles)
1239 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1240 "c" gnus-summary-catchup-and-exit
1241 "C" gnus-summary-catchup-all-and-exit
1242 "E" gnus-summary-exit-no-update
1243 "Q" gnus-summary-exit
1244 "Z" gnus-summary-exit
1245 "n" gnus-summary-catchup-and-goto-next-group
1246 "R" gnus-summary-reselect-current-group
1247 "G" gnus-summary-rescan-group
1248 "N" gnus-summary-next-group
1249 "s" gnus-summary-save-newsrc
1250 "P" gnus-summary-prev-group)
1252 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1253 " " gnus-summary-next-page
1254 "n" gnus-summary-next-page
1255 "\177" gnus-summary-prev-page
1256 [delete] gnus-summary-prev-page
1257 "p" gnus-summary-prev-page
1258 "\r" gnus-summary-scroll-up
1259 "<" gnus-summary-beginning-of-article
1260 ">" gnus-summary-end-of-article
1261 "b" gnus-summary-beginning-of-article
1262 "e" gnus-summary-end-of-article
1263 "^" gnus-summary-refer-parent-article
1264 "r" gnus-summary-refer-parent-article
1265 "R" gnus-summary-refer-references
1266 "g" gnus-summary-show-article
1267 "s" gnus-summary-isearch-article
1268 "P" gnus-summary-print-article)
1270 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1271 "b" gnus-article-add-buttons
1272 "B" gnus-article-add-buttons-to-head
1273 "o" gnus-article-treat-overstrike
1274 "e" gnus-article-emphasize
1275 "w" gnus-article-fill-cited-article
1276 "c" gnus-article-remove-cr
1277 "q" gnus-article-de-quoted-unreadable
1278 "f" gnus-article-display-x-face
1279 "l" gnus-summary-stop-page-breaking
1280 "r" gnus-summary-caesar-message
1281 "t" gnus-article-hide-headers
1282 "v" gnus-summary-verbose-headers
1283 "m" gnus-summary-toggle-mime
1284 "h" gnus-article-treat-html)
1286 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1287 "a" gnus-article-hide
1288 "h" gnus-article-hide-headers
1289 "b" gnus-article-hide-boring-headers
1290 "s" gnus-article-hide-signature
1291 "c" gnus-article-hide-citation
1292 "p" gnus-article-hide-pgp
1293 "P" gnus-article-hide-pem
1294 "\C-c" gnus-article-hide-citation-maybe)
1296 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1297 "a" gnus-article-highlight
1298 "h" gnus-article-highlight-headers
1299 "c" gnus-article-highlight-citation
1300 "s" gnus-article-highlight-signature)
1302 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1303 "z" gnus-article-date-ut
1304 "u" gnus-article-date-ut
1305 "l" gnus-article-date-local
1306 "e" gnus-article-date-lapsed
1307 "o" gnus-article-date-original
1308 "s" gnus-article-date-user)
1310 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1311 "t" gnus-article-remove-trailing-blank-lines
1312 "l" gnus-article-strip-leading-blank-lines
1313 "m" gnus-article-strip-multiple-blank-lines
1314 "a" gnus-article-strip-blank-lines)
1316 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1318 "f" gnus-summary-fetch-faq
1319 "d" gnus-summary-describe-group
1320 "h" gnus-summary-describe-briefly
1321 "i" gnus-info-find-node)
1323 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1324 "e" gnus-summary-expire-articles
1325 "\M-\C-e" gnus-summary-expire-articles-now
1326 "\177" gnus-summary-delete-article
1327 [delete] gnus-summary-delete-article
1328 "m" gnus-summary-move-article
1329 "r" gnus-summary-respool-article
1330 "w" gnus-summary-edit-article
1331 "c" gnus-summary-copy-article
1332 "B" gnus-summary-crosspost-article
1333 "q" gnus-summary-respool-query
1334 "i" gnus-summary-import-article
1335 "p" gnus-summary-article-posted-p)
1337 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1338 "o" gnus-summary-save-article
1339 "m" gnus-summary-save-article-mail
1340 "F" gnus-summary-write-article-file
1341 "r" gnus-summary-save-article-rmail
1342 "f" gnus-summary-save-article-file
1343 "b" gnus-summary-save-article-body-file
1344 "h" gnus-summary-save-article-folder
1345 "v" gnus-summary-save-article-vm
1346 "p" gnus-summary-pipe-output
1347 "s" gnus-soup-add-article))
1349 (defun gnus-summary-make-menu-bar ()
1350 (gnus-turn-off-edit-menu 'summary)
1352 (unless (boundp 'gnus-summary-misc-menu)
1355 gnus-summary-kill-menu gnus-summary-mode-map ""
1360 ["Enter score..." gnus-summary-score-entry t]
1361 ["Customize" gnus-score-customize t])
1362 (gnus-make-score-map 'increase)
1363 (gnus-make-score-map 'lower)
1365 ["Kill below" gnus-summary-kill-below t]
1366 ["Mark above" gnus-summary-mark-above t]
1367 ["Tick above" gnus-summary-tick-above t]
1368 ["Clear above" gnus-summary-clear-above t])
1369 ["Current score" gnus-summary-current-score t]
1370 ["Set score" gnus-summary-set-score t]
1371 ["Switch current score file..." gnus-score-change-score-file t]
1372 ["Set mark below..." gnus-score-set-mark-below t]
1373 ["Set expunge below..." gnus-score-set-expunge-below t]
1374 ["Edit current score file" gnus-score-edit-current-scores t]
1375 ["Edit score file" gnus-score-edit-file t]
1376 ["Trace score" gnus-score-find-trace t]
1377 ["Find words" gnus-score-find-favourite-words t]
1378 ["Rescore buffer" gnus-summary-rescore t]
1379 ["Increase score..." gnus-summary-increase-score t]
1380 ["Lower score..." gnus-summary-lower-score t]))))
1383 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1385 :selected (null gnus-score-default-header)]
1386 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1388 :selected (eq gnus-score-default-header 'a)]
1389 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1391 :selected (eq gnus-score-default-header 's)]
1393 (gnus-score-set-default 'gnus-score-default-header 'b)
1395 :selected (eq gnus-score-default-header 'b )]
1397 (gnus-score-set-default 'gnus-score-default-header 'h)
1399 :selected (eq gnus-score-default-header 'h )]
1400 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1402 :selected (eq gnus-score-default-header 'i )]
1403 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1405 :selected (eq gnus-score-default-header 't )]
1407 (gnus-score-set-default 'gnus-score-default-header 'x)
1409 :selected (eq gnus-score-default-header 'x )]
1410 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1412 :selected (eq gnus-score-default-header 'l )]
1413 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1415 :selected (eq gnus-score-default-header 'd )]
1416 ["Followups to author"
1417 (gnus-score-set-default 'gnus-score-default-header 'f)
1419 :selected (eq gnus-score-default-header 'f )])
1421 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1423 :selected (null gnus-score-default-type)]
1424 ;; The `:active' key is commented out in the following,
1425 ;; because the GNU Emacs hack to support radio buttons use
1426 ;; active to indicate which button is selected.
1427 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1429 ;; :active (not (memq gnus-score-default-header '(l d)))
1430 :selected (eq gnus-score-default-type 's)]
1431 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1433 ;; :active (not (memq gnus-score-default-header '(l d)))
1434 :selected (eq gnus-score-default-type 'r)]
1435 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1437 ;; :active (not (memq gnus-score-default-header '(l d)))
1438 :selected (eq gnus-score-default-type 'e)]
1439 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1441 ;; :active (not (memq gnus-score-default-header '(l d)))
1442 :selected (eq gnus-score-default-type 'f)]
1443 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1445 ;; :active (eq (gnus-score-default-header 'd))
1446 :selected (eq gnus-score-default-type 'b)]
1447 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1449 ;; :active (eq (gnus-score-default-header 'd))
1450 :selected (eq gnus-score-default-type 'n)]
1451 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1453 ;; :active (eq (gnus-score-default-header 'd))
1454 :selected (eq gnus-score-default-type 'a)]
1456 (gnus-score-set-default 'gnus-score-default-type '<)
1458 ;; :active (eq (gnus-score-default-header 'l))
1459 :selected (eq gnus-score-default-type '<)]
1461 (gnus-score-set-default 'gnus-score-default-type '=)
1463 ;; :active (eq (gnus-score-default-header 'l))
1464 :selected (eq gnus-score-default-type '=)]
1465 ["Greater than number"
1466 (gnus-score-set-default 'gnus-score-default-type '>)
1468 ;; :active (eq (gnus-score-default-header 'l))
1469 :selected (eq gnus-score-default-type '>)])
1470 ["Default fold" gnus-score-default-fold-toggle
1472 :selected gnus-score-default-fold]
1474 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1476 :selected (null gnus-score-default-duration)]
1478 (gnus-score-set-default 'gnus-score-default-duration 'p)
1480 :selected (eq gnus-score-default-duration 'p)]
1482 (gnus-score-set-default 'gnus-score-default-duration 't)
1484 :selected (eq gnus-score-default-duration 't)]
1486 (gnus-score-set-default 'gnus-score-default-duration 'i)
1488 :selected (eq gnus-score-default-duration 'i)]))
1491 gnus-summary-article-menu gnus-summary-mode-map ""
1494 ["All" gnus-article-hide t]
1495 ["Headers" gnus-article-hide-headers t]
1496 ["Signature" gnus-article-hide-signature t]
1497 ["Citation" gnus-article-hide-citation t]
1498 ["PGP" gnus-article-hide-pgp t]
1499 ["Boring headers" gnus-article-hide-boring-headers t])
1501 ["All" gnus-article-highlight t]
1502 ["Headers" gnus-article-highlight-headers t]
1503 ["Signature" gnus-article-highlight-signature t]
1504 ["Citation" gnus-article-highlight-citation t])
1506 ["Local" gnus-article-date-local t]
1507 ["UT" gnus-article-date-ut t]
1508 ["Original" gnus-article-date-original t]
1509 ["Lapsed" gnus-article-date-lapsed t]
1510 ["User-defined" gnus-article-date-user t])
1513 ["Leading" gnus-article-strip-leading-blank-lines t]
1514 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1515 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1516 ["All of the above" gnus-article-strip-blank-lines t])
1517 ["Overstrike" gnus-article-treat-overstrike t]
1518 ["Emphasis" gnus-article-emphasize t]
1519 ["Word wrap" gnus-article-fill-cited-article t]
1520 ["CR" gnus-article-remove-cr t]
1521 ["Show X-Face" gnus-article-display-x-face t]
1522 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1523 ["UnHTMLize" gnus-article-treat-html t]
1524 ["Rot 13" gnus-summary-caesar-message t]
1525 ["Unix pipe" gnus-summary-pipe-message t]
1526 ["Add buttons" gnus-article-add-buttons t]
1527 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1528 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1529 ["Toggle MIME" gnus-summary-toggle-mime t]
1530 ["Verbose header" gnus-summary-verbose-headers t]
1531 ["Toggle header" gnus-summary-toggle-header t])
1533 ["Save in default format" gnus-summary-save-article t]
1534 ["Save in file" gnus-summary-save-article-file t]
1535 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1536 ["Write to file" gnus-summary-write-article-mail t]
1537 ["Save in MH folder" gnus-summary-save-article-folder t]
1538 ["Save in VM folder" gnus-summary-save-article-vm t]
1539 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1540 ["Save body in file" gnus-summary-save-article-body-file t]
1541 ["Pipe through a filter" gnus-summary-pipe-output t]
1542 ["Add to SOUP packet" gnus-soup-add-article t]
1543 ["Print" gnus-summary-print-article t])
1545 ["Respool article..." gnus-summary-respool-article t]
1546 ["Move article..." gnus-summary-move-article
1547 (gnus-check-backend-function
1548 'request-move-article gnus-newsgroup-name)]
1549 ["Copy article..." gnus-summary-copy-article t]
1550 ["Crosspost article..." gnus-summary-crosspost-article
1551 (gnus-check-backend-function
1552 'request-replace-article gnus-newsgroup-name)]
1553 ["Import file..." gnus-summary-import-article t]
1554 ["Check if posted" gnus-summary-article-posted-p t]
1555 ["Edit article" gnus-summary-edit-article
1556 (not (gnus-group-read-only-p))]
1557 ["Delete article" gnus-summary-delete-article
1558 (gnus-check-backend-function
1559 'request-expire-articles gnus-newsgroup-name)]
1560 ["Query respool" gnus-summary-respool-query t]
1561 ["Delete expirable articles" gnus-summary-expire-articles-now
1562 (gnus-check-backend-function
1563 'request-expire-articles gnus-newsgroup-name)])
1565 ["Uudecode" gnus-uu-decode-uu t]
1566 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1567 ["Unshar" gnus-uu-decode-unshar t]
1568 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1569 ["Save" gnus-uu-decode-save t]
1570 ["Binhex" gnus-uu-decode-binhex t]
1571 ["Postscript" gnus-uu-decode-postscript t])
1573 ["Enter article" gnus-cache-enter-article t]
1574 ["Remove article" gnus-cache-remove-article t])
1575 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1576 ["Isearch article..." gnus-summary-isearch-article t]
1577 ["Beginning of the article" gnus-summary-beginning-of-article t]
1578 ["End of the article" gnus-summary-end-of-article t]
1579 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1580 ["Fetch referenced articles" gnus-summary-refer-references t]
1581 ["Fetch article with id..." gnus-summary-refer-article t]
1582 ["Redisplay" gnus-summary-show-article t]))
1585 gnus-summary-thread-menu gnus-summary-mode-map ""
1587 ["Toggle threading" gnus-summary-toggle-threads t]
1588 ["Hide threads" gnus-summary-hide-all-threads t]
1589 ["Show threads" gnus-summary-show-all-threads t]
1590 ["Hide thread" gnus-summary-hide-thread t]
1591 ["Show thread" gnus-summary-show-thread t]
1592 ["Go to next thread" gnus-summary-next-thread t]
1593 ["Go to previous thread" gnus-summary-prev-thread t]
1594 ["Go down thread" gnus-summary-down-thread t]
1595 ["Go up thread" gnus-summary-up-thread t]
1596 ["Top of thread" gnus-summary-top-thread t]
1597 ["Mark thread as read" gnus-summary-kill-thread t]
1598 ["Lower thread score" gnus-summary-lower-thread t]
1599 ["Raise thread score" gnus-summary-raise-thread t]
1600 ["Rethread current" gnus-summary-rethread-current t]
1604 gnus-summary-post-menu gnus-summary-mode-map ""
1606 ["Post an article" gnus-summary-post-news t]
1607 ["Followup" gnus-summary-followup t]
1608 ["Followup and yank" gnus-summary-followup-with-original t]
1609 ["Supersede article" gnus-summary-supersede-article t]
1610 ["Cancel article" gnus-summary-cancel-article t]
1611 ["Reply" gnus-summary-reply t]
1612 ["Reply and yank" gnus-summary-reply-with-original t]
1613 ["Wide reply" gnus-summary-wide-reply t]
1614 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1615 ["Mail forward" gnus-summary-mail-forward t]
1616 ["Post forward" gnus-summary-post-forward t]
1617 ["Digest and mail" gnus-uu-digest-mail-forward t]
1618 ["Digest and post" gnus-uu-digest-post-forward t]
1619 ["Resend message" gnus-summary-resend-message t]
1620 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1621 ["Send a mail" gnus-summary-mail-other-window t]
1622 ["Uuencode and post" gnus-uu-post-news t]
1623 ["Followup via news" gnus-summary-followup-to-mail t]
1624 ["Followup via news and yank"
1625 gnus-summary-followup-to-mail-with-original t]
1627 ;;["Send" gnus-summary-send-draft t]
1628 ;;["Send bounced" gnus-resend-bounced-mail t])
1632 gnus-summary-misc-menu gnus-summary-mode-map ""
1635 ["Mark as read" gnus-summary-mark-as-read-forward t]
1636 ["Mark same subject and select"
1637 gnus-summary-kill-same-subject-and-select t]
1638 ["Mark same subject" gnus-summary-kill-same-subject t]
1639 ["Catchup" gnus-summary-catchup t]
1640 ["Catchup all" gnus-summary-catchup-all t]
1641 ["Catchup to here" gnus-summary-catchup-to-here t]
1642 ["Catchup region" gnus-summary-mark-region-as-read t]
1643 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1645 ["Tick" gnus-summary-tick-article-forward t]
1646 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1647 ["Remove marks" gnus-summary-clear-mark-forward t]
1648 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1649 ["Set bookmark" gnus-summary-set-bookmark t]
1650 ["Remove bookmark" gnus-summary-remove-bookmark t])
1652 ["Marks..." gnus-summary-limit-to-marks t]
1653 ["Subject..." gnus-summary-limit-to-subject t]
1654 ["Author..." gnus-summary-limit-to-author t]
1655 ["Age..." gnus-summary-limit-to-age t]
1656 ["Score" gnus-summary-limit-to-score t]
1657 ["Unread" gnus-summary-limit-to-unread t]
1658 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1659 ["Articles" gnus-summary-limit-to-articles t]
1660 ["Pop limit" gnus-summary-pop-limit t]
1661 ["Show dormant" gnus-summary-limit-include-dormant t]
1662 ["Hide childless dormant"
1663 gnus-summary-limit-exclude-childless-dormant t]
1664 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1665 ["Show expunged" gnus-summary-show-all-expunged t])
1667 ["Set mark" gnus-summary-mark-as-processable t]
1668 ["Remove mark" gnus-summary-unmark-as-processable t]
1669 ["Remove all marks" gnus-summary-unmark-all-processable t]
1670 ["Mark above" gnus-uu-mark-over t]
1671 ["Mark series" gnus-uu-mark-series t]
1672 ["Mark region" gnus-uu-mark-region t]
1673 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1674 ["Mark all" gnus-uu-mark-all t]
1675 ["Mark buffer" gnus-uu-mark-buffer t]
1676 ["Mark sparse" gnus-uu-mark-sparse t]
1677 ["Mark thread" gnus-uu-mark-thread t]
1678 ["Unmark thread" gnus-uu-unmark-thread t]
1679 ("Process Mark Sets"
1680 ["Kill" gnus-summary-kill-process-mark t]
1681 ["Yank" gnus-summary-yank-process-mark
1682 gnus-newsgroup-process-stack]
1683 ["Save" gnus-summary-save-process-mark t]))
1685 ["Page forward" gnus-summary-next-page t]
1686 ["Page backward" gnus-summary-prev-page t]
1687 ["Line forward" gnus-summary-scroll-up t])
1689 ["Next unread article" gnus-summary-next-unread-article t]
1690 ["Previous unread article" gnus-summary-prev-unread-article t]
1691 ["Next article" gnus-summary-next-article t]
1692 ["Previous article" gnus-summary-prev-article t]
1693 ["Next unread subject" gnus-summary-next-unread-subject t]
1694 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1695 ["Next article same subject" gnus-summary-next-same-subject t]
1696 ["Previous article same subject" gnus-summary-prev-same-subject t]
1697 ["First unread article" gnus-summary-first-unread-article t]
1698 ["Best unread article" gnus-summary-best-unread-article t]
1699 ["Go to subject number..." gnus-summary-goto-subject t]
1700 ["Go to article number..." gnus-summary-goto-article t]
1701 ["Go to the last article" gnus-summary-goto-last-article t]
1702 ["Pop article off history" gnus-summary-pop-article t])
1704 ["Sort by number" gnus-summary-sort-by-number t]
1705 ["Sort by author" gnus-summary-sort-by-author t]
1706 ["Sort by subject" gnus-summary-sort-by-subject t]
1707 ["Sort by date" gnus-summary-sort-by-date t]
1708 ["Sort by score" gnus-summary-sort-by-score t]
1709 ["Sort by lines" gnus-summary-sort-by-lines t])
1711 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1712 ["Describe group" gnus-summary-describe-group t]
1713 ["Read manual" gnus-info-find-node t])
1715 ["Pick and read" gnus-pick-mode t]
1716 ["Binary" gnus-binary-mode t])
1718 ["Regenerate" gnus-summary-prepare t]
1719 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1720 ["Toggle threading" gnus-summary-toggle-threads t])
1721 ["Filter articles..." gnus-summary-execute-command t]
1722 ["Run command on subjects..." gnus-summary-universal-argument t]
1723 ["Search articles forward..." gnus-summary-search-article-forward t]
1724 ["Search articles backward..." gnus-summary-search-article-backward t]
1725 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1726 ["Expand window" gnus-summary-expand-window t]
1727 ["Expire expirable articles" gnus-summary-expire-articles
1728 (gnus-check-backend-function
1729 'request-expire-articles gnus-newsgroup-name)]
1730 ["Edit local kill file" gnus-summary-edit-local-kill t]
1731 ["Edit main kill file" gnus-summary-edit-global-kill t]
1733 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1734 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1735 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1736 ["Exit group" gnus-summary-exit t]
1737 ["Exit group without updating" gnus-summary-exit-no-update t]
1738 ["Exit and goto next group" gnus-summary-next-group t]
1739 ["Exit and goto prev group" gnus-summary-prev-group t]
1740 ["Reselect group" gnus-summary-reselect-current-group t]
1741 ["Rescan group" gnus-summary-rescan-group t]
1742 ["Update dribble" gnus-summary-save-newsrc t])))
1744 (run-hooks 'gnus-summary-menu-hook)))
1746 (defun gnus-score-set-default (var value)
1747 "A version of set that updates the GNU Emacs menu-bar."
1749 ;; It is the message that forces the active status to be updated.
1752 (defun gnus-make-score-map (type)
1753 "Make a summary score map of type TYPE."
1756 (let ((headers '(("author" "from" string)
1757 ("subject" "subject" string)
1758 ("article body" "body" string)
1759 ("article head" "head" string)
1760 ("xref" "xref" string)
1761 ("lines" "lines" number)
1762 ("followups to author" "followup" string)))
1763 (types '((number ("less than" <)
1766 (string ("substring" s)
1770 (perms '(("temporary" (current-time-string))
1778 (if (eq type 'lower)
1783 (setq header (car headers))
1789 (let ((ts (cdr (assoc (nth 2 header) types)))
1805 'gnus-summary-score-entry
1807 (if (or (string= (nth 1 header)
1809 (string= (nth 1 header)
1812 (list 'gnus-summary-header
1814 (list 'quote (nth 1 (car ts)))
1815 (list 'gnus-score-default nil)
1821 (list (nreverse outp))))
1824 (list (nreverse outt))))
1826 (setq headers (cdr headers)))
1827 (list (nreverse outh))))))))
1831 (defun gnus-summary-mode (&optional group)
1832 "Major mode for reading articles.
1834 All normal editing commands are switched off.
1835 \\<gnus-summary-mode-map>
1836 Each line in this buffer represents one article. To read an
1837 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1838 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1841 You can also post articles and send mail from this buffer. To
1842 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1843 of an article, type `\\[gnus-summary-reply]'.
1845 There are approx. one gazillion commands you can execute in this
1846 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1848 The following commands are available:
1850 \\{gnus-summary-mode-map}"
1852 (when (gnus-visual-p 'summary-menu 'menu)
1853 (gnus-summary-make-menu-bar))
1854 (kill-all-local-variables)
1855 (gnus-summary-make-local-variables)
1856 (gnus-make-thread-indent-array)
1857 (gnus-simplify-mode-line)
1858 (setq major-mode 'gnus-summary-mode)
1859 (setq mode-name "Summary")
1860 (make-local-variable 'minor-mode-alist)
1861 (use-local-map gnus-summary-mode-map)
1862 (buffer-disable-undo (current-buffer))
1863 (setq buffer-read-only t) ;Disable modification
1864 (setq truncate-lines t)
1865 (setq selective-display t)
1866 (setq selective-display-ellipses t) ;Display `...'
1867 (setq buffer-display-table gnus-summary-display-table)
1868 (gnus-set-default-directory)
1869 (setq gnus-newsgroup-name group)
1870 (make-local-variable 'gnus-summary-line-format)
1871 (make-local-variable 'gnus-summary-line-format-spec)
1872 (make-local-variable 'gnus-summary-mark-positions)
1873 (make-local-hook 'post-command-hook)
1874 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1875 (run-hooks 'gnus-summary-mode-hook)
1876 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1877 (gnus-update-summary-mark-positions))
1879 (defun gnus-summary-make-local-variables ()
1880 "Make all the local summary buffer variables."
1881 (let ((locals gnus-summary-local-variables)
1883 (while (setq local (pop locals))
1886 (if (eq (cdr local) 'global)
1887 ;; Copy the global value of the variable.
1888 (setq global (symbol-value (car local)))
1889 ;; Use the value from the list.
1890 (setq global (eval (cdr local))))
1891 (make-local-variable (car local))
1892 (set (car local) global))
1893 ;; Simple nil-valued local variable.
1894 (make-local-variable local)
1897 (defun gnus-summary-clear-local-variables ()
1898 (let ((locals gnus-summary-local-variables))
1900 (if (consp (car locals))
1901 (and (vectorp (caar locals))
1902 (set (caar locals) nil))
1903 (and (vectorp (car locals))
1904 (set (car locals) nil)))
1905 (setq locals (cdr locals)))))
1907 ;; Summary data functions.
1909 (defmacro gnus-data-number (data)
1912 (defmacro gnus-data-set-number (data number)
1913 `(setcar ,data ,number))
1915 (defmacro gnus-data-mark (data)
1918 (defmacro gnus-data-set-mark (data mark)
1919 `(setcar (nthcdr 1 ,data) ,mark))
1921 (defmacro gnus-data-pos (data)
1924 (defmacro gnus-data-set-pos (data pos)
1925 `(setcar (nthcdr 2 ,data) ,pos))
1927 (defmacro gnus-data-header (data)
1930 (defmacro gnus-data-set-header (data header)
1931 `(setf (nth 3 ,data) ,header))
1933 (defmacro gnus-data-level (data)
1936 (defmacro gnus-data-unread-p (data)
1937 `(= (nth 1 ,data) gnus-unread-mark))
1939 (defmacro gnus-data-read-p (data)
1940 `(/= (nth 1 ,data) gnus-unread-mark))
1942 (defmacro gnus-data-pseudo-p (data)
1943 `(consp (nth 3 ,data)))
1945 (defmacro gnus-data-find (number)
1946 `(assq ,number gnus-newsgroup-data))
1948 (defmacro gnus-data-find-list (number &optional data)
1949 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1950 (memq (assq ,number bdata)
1953 (defmacro gnus-data-make (number mark pos header level)
1954 `(list ,number ,mark ,pos ,header ,level))
1956 (defun gnus-data-enter (after-article number mark pos header level offset)
1957 (let ((data (gnus-data-find-list after-article)))
1959 (error "No such article: %d" after-article))
1960 (setcdr data (cons (gnus-data-make number mark pos header level)
1962 (setq gnus-newsgroup-data-reverse nil)
1963 (gnus-data-update-list (cddr data) offset)))
1965 (defun gnus-data-enter-list (after-article list &optional offset)
1967 (let ((data (and after-article (gnus-data-find-list after-article)))
1969 (or data (not after-article) (error "No such article: %d" after-article))
1970 ;; Find the last element in the list to be spliced into the main
1973 (setq list (cdr list)))
1976 (setcdr list gnus-newsgroup-data)
1977 (setq gnus-newsgroup-data ilist)
1979 (gnus-data-update-list (cdr list) offset)))
1980 (setcdr list (cdr data))
1983 (gnus-data-update-list (cdr list) offset)))
1984 (setq gnus-newsgroup-data-reverse nil))))
1986 (defun gnus-data-remove (article &optional offset)
1987 (let ((data gnus-newsgroup-data))
1988 (if (= (gnus-data-number (car data)) article)
1990 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
1991 gnus-newsgroup-data-reverse nil)
1993 (gnus-data-update-list gnus-newsgroup-data offset)))
1995 (when (= (gnus-data-number (cadr data)) article)
1996 (setcdr data (cddr data))
1998 (gnus-data-update-list (cdr data) offset))
2000 gnus-newsgroup-data-reverse nil))
2001 (setq data (cdr data))))))
2003 (defmacro gnus-data-list (backward)
2005 (or gnus-newsgroup-data-reverse
2006 (setq gnus-newsgroup-data-reverse
2007 (reverse gnus-newsgroup-data)))
2008 gnus-newsgroup-data))
2010 (defun gnus-data-update-list (data offset)
2011 "Add OFFSET to the POS of all data entries in DATA."
2013 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2014 (setq data (cdr data))))
2016 (defun gnus-data-compute-positions ()
2017 "Compute the positions of all articles."
2018 (let ((data gnus-newsgroup-data)
2021 (when (setq pos (text-property-any
2022 (point-min) (point-max)
2023 'gnus-number (gnus-data-number (car data))))
2024 (gnus-data-set-pos (car data) (+ pos 3)))
2025 (setq data (cdr data)))))
2027 (defun gnus-summary-article-pseudo-p (article)
2028 "Say whether this article is a pseudo article or not."
2029 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2031 (defmacro gnus-summary-article-sparse-p (article)
2032 "Say whether this article is a sparse article or not."
2033 ` (memq ,article gnus-newsgroup-sparse))
2035 (defmacro gnus-summary-article-ancient-p (article)
2036 "Say whether this article is a sparse article or not."
2037 `(memq ,article gnus-newsgroup-ancient))
2039 (defun gnus-article-parent-p (number)
2040 "Say whether this article is a parent or not."
2041 (let ((data (gnus-data-find-list number)))
2042 (and (cdr data) ; There has to be an article after...
2043 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2044 (gnus-data-level (nth 1 data))))))
2046 (defun gnus-article-children (number)
2047 "Return a list of all children to NUMBER."
2048 (let* ((data (gnus-data-find-list number))
2049 (level (gnus-data-level (car data)))
2051 (setq data (cdr data))
2053 (= (gnus-data-level (car data)) (1+ level)))
2054 (push (gnus-data-number (car data)) children)
2055 (setq data (cdr data)))
2058 (defmacro gnus-summary-skip-intangible ()
2059 "If the current article is intangible, then jump to a different article."
2060 '(let ((to (get-text-property (point) 'gnus-intangible)))
2061 (and to (gnus-summary-goto-subject to))))
2063 (defmacro gnus-summary-article-intangible-p ()
2064 "Say whether this article is intangible or not."
2065 '(get-text-property (point) 'gnus-intangible))
2067 (defun gnus-article-read-p (article)
2068 "Say whether ARTICLE is read or not."
2069 (not (or (memq article gnus-newsgroup-marked)
2070 (memq article gnus-newsgroup-unreads)
2071 (memq article gnus-newsgroup-unselected)
2072 (memq article gnus-newsgroup-dormant))))
2074 ;; Some summary mode macros.
2076 (defmacro gnus-summary-article-number ()
2077 "The article number of the article on the current line.
2078 If there isn's an article number here, then we return the current
2081 (gnus-summary-skip-intangible)
2082 (or (get-text-property (point) 'gnus-number)
2083 (gnus-summary-last-subject))))
2085 (defmacro gnus-summary-article-header (&optional number)
2086 `(gnus-data-header (gnus-data-find
2087 ,(or number '(gnus-summary-article-number)))))
2089 (defmacro gnus-summary-thread-level (&optional number)
2090 `(if (and (eq gnus-summary-make-false-root 'dummy)
2091 (get-text-property (point) 'gnus-intangible))
2093 (gnus-data-level (gnus-data-find
2094 ,(or number '(gnus-summary-article-number))))))
2096 (defmacro gnus-summary-article-mark (&optional number)
2097 `(gnus-data-mark (gnus-data-find
2098 ,(or number '(gnus-summary-article-number)))))
2100 (defmacro gnus-summary-article-pos (&optional number)
2101 `(gnus-data-pos (gnus-data-find
2102 ,(or number '(gnus-summary-article-number)))))
2104 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2105 (defmacro gnus-summary-article-subject (&optional number)
2106 "Return current subject string or nil if nothing."
2109 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2110 '(gnus-data-header (assq (gnus-summary-article-number)
2111 gnus-newsgroup-data)))))
2114 (mail-header-subject headers))))
2116 (defmacro gnus-summary-article-score (&optional number)
2117 "Return current article score."
2118 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2119 gnus-newsgroup-scored))
2120 gnus-summary-default-score 0))
2122 (defun gnus-summary-article-children (&optional number)
2123 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2124 (level (gnus-data-level (car data)))
2126 (while (and (setq data (cdr data))
2127 (> (setq l (gnus-data-level (car data))) level))
2128 (and (= (1+ level) l)
2129 (push (gnus-data-number (car data))
2131 (nreverse children)))
2133 (defun gnus-summary-article-parent (&optional number)
2134 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2135 (gnus-data-list t)))
2136 (level (gnus-data-level (car data))))
2138 () ; This is a root.
2139 ;; We search until we find an article with a level less than
2140 ;; this one. That function has to be the parent.
2141 (while (and (setq data (cdr data))
2142 (not (< (gnus-data-level (car data)) level))))
2143 (and data (gnus-data-number (car data))))))
2145 (defun gnus-unread-mark-p (mark)
2146 "Say whether MARK is the unread mark."
2147 (= mark gnus-unread-mark))
2149 (defun gnus-read-mark-p (mark)
2150 "Say whether MARK is one of the marks that mark as read.
2151 This is all marks except unread, ticked, dormant, and expirable."
2152 (not (or (= mark gnus-unread-mark)
2153 (= mark gnus-ticked-mark)
2154 (= mark gnus-dormant-mark)
2155 (= mark gnus-expirable-mark))))
2157 (defmacro gnus-article-mark (number)
2159 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2160 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2161 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2162 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2163 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2164 gnus-ancient-mark))))
2166 ;; Saving hidden threads.
2168 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2169 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2171 (defmacro gnus-save-hidden-threads (&rest forms)
2172 "Save hidden threads, eval FORMS, and restore the hidden threads."
2173 (let ((config (make-symbol "config")))
2174 `(let ((,config (gnus-hidden-threads-configuration)))
2178 (gnus-restore-hidden-threads-configuration ,config)))))
2180 (defun gnus-hidden-threads-configuration ()
2181 "Return the current hidden threads configuration."
2184 (goto-char (point-min))
2185 (while (search-forward "\r" nil t)
2186 (push (1- (point)) config))
2189 (defun gnus-restore-hidden-threads-configuration (config)
2190 "Restore hidden threads configuration from CONFIG."
2191 (let (point buffer-read-only)
2192 (while (setq point (pop config))
2193 (when (and (< point (point-max))
2195 (= (following-char) ?\n))
2196 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2198 ;; Various summary mode internalish functions.
2200 (defun gnus-mouse-pick-article (e)
2203 (gnus-summary-next-page nil t))
2205 (defun gnus-summary-setup-buffer (group)
2206 "Initialize summary buffer."
2207 (let ((buffer (concat "*Summary " group "*")))
2208 (if (get-buffer buffer)
2211 (setq gnus-summary-buffer (current-buffer))
2212 (not gnus-newsgroup-prepared))
2213 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2214 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2215 (gnus-add-current-to-buffer-list)
2216 (gnus-summary-mode group)
2218 (gnus-carpal-setup-buffer 'summary))
2219 (unless gnus-single-article-buffer
2220 (make-local-variable 'gnus-article-buffer)
2221 (make-local-variable 'gnus-article-current)
2222 (make-local-variable 'gnus-original-article-buffer))
2223 (setq gnus-newsgroup-name group)
2226 (defun gnus-set-global-variables ()
2227 ;; Set the global equivalents of the summary buffer-local variables
2228 ;; to the latest values they had. These reflect the summary buffer
2229 ;; that was in action when the last article was fetched.
2230 (when (eq major-mode 'gnus-summary-mode)
2231 (setq gnus-summary-buffer (current-buffer))
2232 (let ((name gnus-newsgroup-name)
2233 (marked gnus-newsgroup-marked)
2234 (unread gnus-newsgroup-unreads)
2235 (headers gnus-current-headers)
2236 (data gnus-newsgroup-data)
2237 (summary gnus-summary-buffer)
2238 (article-buffer gnus-article-buffer)
2239 (original gnus-original-article-buffer)
2240 (gac gnus-article-current)
2241 (reffed gnus-reffed-article-number)
2242 (score-file gnus-current-score-file))
2244 (set-buffer gnus-group-buffer)
2245 (setq gnus-newsgroup-name name)
2246 (setq gnus-newsgroup-marked marked)
2247 (setq gnus-newsgroup-unreads unread)
2248 (setq gnus-current-headers headers)
2249 (setq gnus-newsgroup-data data)
2250 (setq gnus-article-current gac)
2251 (setq gnus-summary-buffer summary)
2252 (setq gnus-article-buffer article-buffer)
2253 (setq gnus-original-article-buffer original)
2254 (setq gnus-reffed-article-number reffed)
2255 (setq gnus-current-score-file score-file)
2256 ;; The article buffer also has local variables.
2257 (when (gnus-buffer-live-p gnus-article-buffer)
2258 (set-buffer gnus-article-buffer)
2259 (setq gnus-summary-buffer summary))))))
2261 (defun gnus-summary-article-unread-p (article)
2262 "Say whether ARTICLE is unread or not."
2263 (memq article gnus-newsgroup-unreads))
2265 (defun gnus-summary-first-article-p (&optional article)
2266 "Return whether ARTICLE is the first article in the buffer."
2267 (if (not (setq article (or article (gnus-summary-article-number))))
2269 (eq article (caar gnus-newsgroup-data))))
2271 (defun gnus-summary-last-article-p (&optional article)
2272 "Return whether ARTICLE is the last article in the buffer."
2273 (if (not (setq article (or article (gnus-summary-article-number))))
2274 t ; All non-existent numbers are the last article. :-)
2275 (not (cdr (gnus-data-find-list article)))))
2277 (defun gnus-make-thread-indent-array ()
2279 (unless (and gnus-thread-indent-array
2280 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2281 (setq gnus-thread-indent-array (make-vector 201 "")
2282 gnus-thread-indent-array-level gnus-thread-indent-level)
2284 (aset gnus-thread-indent-array n
2285 (make-string (* n gnus-thread-indent-level) ? ))
2288 (defun gnus-update-summary-mark-positions ()
2289 "Compute where the summary marks are to go."
2291 (when (and gnus-summary-buffer
2292 (get-buffer gnus-summary-buffer)
2293 (buffer-name (get-buffer gnus-summary-buffer)))
2294 (set-buffer gnus-summary-buffer))
2295 (let ((gnus-replied-mark 129)
2296 (gnus-score-below-mark 130)
2297 (gnus-score-over-mark 130)
2298 (spec gnus-summary-line-format-spec)
2299 thread gnus-visual pos)
2301 (gnus-set-work-buffer)
2302 (let ((gnus-summary-line-format-spec spec))
2303 (gnus-summary-insert-line
2304 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2305 (goto-char (point-min))
2306 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2308 (goto-char (point-min))
2309 (push (cons 'replied (and (search-forward "\201" nil t)
2312 (goto-char (point-min))
2313 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2315 (setq gnus-summary-mark-positions pos))))
2317 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2318 "Insert a dummy root in the summary buffer."
2320 (gnus-add-text-properties
2321 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2322 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2324 (defun gnus-summary-insert-line (gnus-tmp-header
2325 gnus-tmp-level gnus-tmp-current
2326 gnus-tmp-unread gnus-tmp-replied
2327 gnus-tmp-expirable gnus-tmp-subject-or-nil
2328 &optional gnus-tmp-dummy gnus-tmp-score
2330 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2331 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2332 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2333 (gnus-tmp-score-char
2334 (if (or (null gnus-summary-default-score)
2335 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2336 gnus-summary-zcore-fuzz))
2338 (if (< gnus-tmp-score gnus-summary-default-score)
2339 gnus-score-below-mark gnus-score-over-mark)))
2341 (cond (gnus-tmp-process gnus-process-mark)
2342 ((memq gnus-tmp-current gnus-newsgroup-cached)
2344 (gnus-tmp-replied gnus-replied-mark)
2345 ((memq gnus-tmp-current gnus-newsgroup-saved)
2347 (t gnus-unread-mark)))
2348 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2351 ((string-match "<[^>]+> *$" gnus-tmp-from)
2352 (let ((beg (match-beginning 0)))
2353 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2354 (substring gnus-tmp-from (1+ (match-beginning 0))
2355 (1- (match-end 0))))
2356 (substring gnus-tmp-from 0 beg))))
2357 ((string-match "(.+)" gnus-tmp-from)
2358 (substring gnus-tmp-from
2359 (1+ (match-beginning 0)) (1- (match-end 0))))
2361 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2362 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2363 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2364 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2365 (buffer-read-only nil))
2366 (when (string= gnus-tmp-name "")
2367 (setq gnus-tmp-name gnus-tmp-from))
2368 (unless (numberp gnus-tmp-lines)
2369 (setq gnus-tmp-lines 0))
2370 (gnus-put-text-property
2372 (progn (eval gnus-summary-line-format-spec) (point))
2373 'gnus-number gnus-tmp-number)
2374 (when (gnus-visual-p 'summary-highlight 'highlight)
2376 (run-hooks 'gnus-summary-update-hook)
2379 (defun gnus-summary-update-line (&optional dont-update)
2380 ;; Update summary line after change.
2381 (when (and gnus-summary-default-score
2382 (not gnus-summary-inhibit-highlight))
2383 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2384 (article (gnus-summary-article-number))
2385 (score (gnus-summary-article-score article)))
2387 (if (and gnus-summary-mark-below
2388 (< (gnus-summary-article-score)
2389 gnus-summary-mark-below))
2390 ;; This article has a low score, so we mark it as read.
2391 (when (memq article gnus-newsgroup-unreads)
2392 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2393 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2394 ;; This article was previously marked as read on account
2395 ;; of a low score, but now it has risen, so we mark it as
2397 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2398 (gnus-summary-update-mark
2399 (if (or (null gnus-summary-default-score)
2400 (<= (abs (- score gnus-summary-default-score))
2401 gnus-summary-zcore-fuzz))
2403 (if (< score gnus-summary-default-score)
2404 gnus-score-below-mark gnus-score-over-mark))
2406 ;; Do visual highlighting.
2407 (when (gnus-visual-p 'summary-highlight 'highlight)
2408 (run-hooks 'gnus-summary-update-hook)))))
2410 (defvar gnus-tmp-new-adopts nil)
2412 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2413 "Return the number of articles in THREAD.
2414 This may be 0 in some cases -- if none of the articles in
2415 the thread are to be displayed."
2417 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2419 ((not (listp thread))
2421 ((and (consp thread) (cdr thread))
2424 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2427 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2430 (when (and level (zerop level) gnus-tmp-new-adopts)
2433 'gnus-summary-number-of-articles-in-thread
2434 gnus-tmp-new-adopts))))
2436 (if (> number 1) gnus-not-empty-thread-mark
2437 gnus-empty-thread-mark)
2440 (defun gnus-summary-set-local-parameters (group)
2441 "Go through the local params of GROUP and set all variable specs in that list."
2442 (let ((params (gnus-group-find-parameter group))
2445 (setq elem (car params)
2446 params (cdr params))
2447 (and (consp elem) ; Has to be a cons.
2448 (consp (cdr elem)) ; The cdr has to be a list.
2449 (symbolp (car elem)) ; Has to be a symbol in there.
2450 (not (memq (car elem)
2451 '(quit-config to-address to-list to-group)))
2452 (progn ; So we set it.
2453 (make-local-variable (car elem))
2454 (set (car elem) (eval (nth 1 elem))))))))
2456 (defun gnus-summary-read-group (group &optional show-all no-article
2457 kill-buffer no-display)
2458 "Start reading news in newsgroup GROUP.
2459 If SHOW-ALL is non-nil, already read articles are also listed.
2460 If NO-ARTICLE is non-nil, no article is selected initially.
2461 If NO-DISPLAY, don't generate a summary buffer."
2462 ;; Killed foreign groups can't be entered.
2463 (when (and (not (gnus-group-native-p group))
2464 (not (gnus-gethash group gnus-newsrc-hashtb)))
2465 (error "Dead non-native groups can't be entered"))
2466 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2467 (let* ((new-group (gnus-summary-setup-buffer group))
2468 (quit-config (gnus-group-quit-config group))
2469 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2471 ;; This summary buffer exists already, so we just select it.
2473 (gnus-set-global-variables)
2475 (gnus-kill-or-deaden-summary kill-buffer))
2476 (gnus-configure-windows 'summary 'force)
2477 (gnus-set-mode-line 'summary)
2478 (gnus-summary-position-point)
2481 ;; We couldn't select this group.
2483 (when (and (eq major-mode 'gnus-summary-mode)
2484 (not (equal (current-buffer) kill-buffer)))
2485 (kill-buffer (current-buffer))
2486 (if (not quit-config)
2488 (set-buffer gnus-group-buffer)
2489 (gnus-group-jump-to-group group)
2490 (gnus-group-next-unread-group 1))
2491 (gnus-handle-ephemeral-exit quit-config)))
2492 (gnus-message 3 "Can't select group")
2494 ;; The user did a `C-g' while prompting for number of articles,
2495 ;; so we exit this group.
2496 ((eq did-select 'quit)
2497 (and (eq major-mode 'gnus-summary-mode)
2498 (not (equal (current-buffer) kill-buffer))
2499 (kill-buffer (current-buffer)))
2501 (gnus-kill-or-deaden-summary kill-buffer))
2502 (if (not quit-config)
2504 (set-buffer gnus-group-buffer)
2505 (gnus-group-jump-to-group group)
2506 (gnus-group-next-unread-group 1)
2507 (gnus-configure-windows 'group 'force))
2508 (gnus-handle-ephemeral-exit quit-config))
2509 ;; Finally signal the quit.
2511 ;; The group was successfully selected.
2513 (gnus-set-global-variables)
2514 ;; Save the active value in effect when the group was entered.
2515 (setq gnus-newsgroup-active
2517 (gnus-active gnus-newsgroup-name)))
2518 ;; You can change the summary buffer in some way with this hook.
2519 (run-hooks 'gnus-select-group-hook)
2520 ;; Set any local variables in the group parameters.
2521 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2522 (gnus-update-format-specifications
2523 nil 'summary 'summary-mode 'summary-dummy)
2524 ;; Do score processing.
2525 (when gnus-use-scoring
2526 (gnus-possibly-score-headers))
2527 ;; Check whether to fill in the gaps in the threads.
2528 (when gnus-build-sparse-threads
2529 (gnus-build-sparse-threads))
2530 ;; Find the initial limit.
2531 (if gnus-show-threads
2533 (let ((gnus-newsgroup-dormant nil))
2534 (gnus-summary-initial-limit show-all))
2535 (gnus-summary-initial-limit show-all))
2536 (setq gnus-newsgroup-limit
2538 (lambda (header) (mail-header-number header))
2539 gnus-newsgroup-headers)))
2540 ;; Generate the summary buffer.
2542 (gnus-summary-prepare))
2543 (when gnus-use-trees
2544 (gnus-tree-open group)
2545 (setq gnus-summary-highlight-line-function
2546 'gnus-tree-highlight-article))
2547 ;; If the summary buffer is empty, but there are some low-scored
2548 ;; articles or some excluded dormants, we include these in the
2550 (when (and (zerop (buffer-size))
2552 (cond (gnus-newsgroup-dormant
2553 (gnus-summary-limit-include-dormant))
2554 ((and gnus-newsgroup-scored show-all)
2555 (gnus-summary-limit-include-expunged t))))
2556 ;; Function `gnus-apply-kill-file' must be called in this hook.
2557 (run-hooks 'gnus-apply-kill-hook)
2558 (if (and (zerop (buffer-size))
2561 ;; This newsgroup is empty.
2562 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2563 (gnus-message 6 "No unread news")
2565 (gnus-kill-or-deaden-summary kill-buffer))
2566 ;; Return nil from this function.
2568 ;; Hide conversation thread subtrees. We cannot do this in
2569 ;; gnus-summary-prepare-hook since kill processing may not
2570 ;; work with hidden articles.
2571 (and gnus-show-threads
2572 gnus-thread-hide-subtree
2573 (gnus-summary-hide-all-threads))
2574 ;; Show first unread article if requested.
2575 (if (and (not no-article)
2577 gnus-newsgroup-unreads
2578 gnus-auto-select-first)
2579 (unless (if (eq gnus-auto-select-first 'best)
2580 (gnus-summary-best-unread-article)
2581 (gnus-summary-first-unread-article))
2582 (gnus-configure-windows 'summary))
2583 ;; Don't select any articles, just move point to the first
2584 ;; article in the group.
2585 (goto-char (point-min))
2586 (gnus-summary-position-point)
2587 (gnus-set-mode-line 'summary)
2588 (gnus-configure-windows 'summary 'force))
2590 (gnus-kill-or-deaden-summary kill-buffer))
2591 (when (get-buffer-window gnus-group-buffer t)
2592 ;; Gotta use windows, because recenter does weird stuff if
2593 ;; the current buffer ain't the displayed window.
2594 (let ((owin (selected-window)))
2595 (select-window (get-buffer-window gnus-group-buffer t))
2596 (when (gnus-group-goto-group group)
2598 (select-window owin))))
2599 ;; Mark this buffer as "prepared".
2600 (setq gnus-newsgroup-prepared t)
2603 (defun gnus-summary-prepare ()
2604 "Generate the summary buffer."
2606 (let ((buffer-read-only nil))
2608 (setq gnus-newsgroup-data nil
2609 gnus-newsgroup-data-reverse nil)
2610 (run-hooks 'gnus-summary-generate-hook)
2611 ;; Generate the buffer, either with threads or without.
2612 (when gnus-newsgroup-headers
2613 (gnus-summary-prepare-threads
2614 (if gnus-show-threads
2615 (gnus-sort-gathered-threads
2616 (funcall gnus-summary-thread-gathering-function
2618 (gnus-cut-threads (gnus-make-threads)))))
2619 ;; Unthreaded display.
2620 (gnus-sort-articles gnus-newsgroup-headers))))
2621 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2622 ;; Call hooks for modifying summary buffer.
2623 (goto-char (point-min))
2624 (run-hooks 'gnus-summary-prepare-hook)))
2626 (defsubst gnus-general-simplify-subject (subject)
2627 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2630 ;; Truncate the subject.
2631 ((numberp gnus-summary-gather-subject-limit)
2632 (setq subject (gnus-simplify-subject-re subject))
2633 (if (> (length subject) gnus-summary-gather-subject-limit)
2634 (substring subject 0 gnus-summary-gather-subject-limit)
2636 ;; Fuzzily simplify it.
2637 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2638 (gnus-simplify-subject-fuzzy subject))
2639 ;; Just remove the leading "Re:".
2641 (gnus-simplify-subject-re subject))))
2643 (if (and gnus-summary-gather-exclude-subject
2644 (string-match gnus-summary-gather-exclude-subject subject))
2645 nil ; This article shouldn't be gathered
2648 (defun gnus-summary-simplify-subject-query ()
2649 "Query where the respool algorithm would put this article."
2651 (gnus-set-global-variables)
2652 (gnus-summary-select-article)
2653 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2655 (defun gnus-gather-threads-by-subject (threads)
2656 "Gather threads by looking at Subject headers."
2657 (if (not gnus-summary-make-false-root)
2659 (let ((hashtb (gnus-make-hashtable 1024))
2662 subject hthread whole-subject)
2664 (setq subject (gnus-general-simplify-subject
2665 (setq whole-subject (mail-header-subject
2668 (if (setq hthread (gnus-gethash subject hashtb))
2670 ;; We enter a dummy root into the thread, if we
2671 ;; haven't done that already.
2672 (unless (stringp (caar hthread))
2673 (setcar hthread (list whole-subject (car hthread))))
2674 ;; We add this new gathered thread to this gathered
2676 (setcdr (car hthread)
2677 (nconc (cdar hthread) (list (car threads))))
2678 ;; Remove it from the list of threads.
2679 (setcdr prev (cdr threads))
2680 (setq threads prev))
2681 ;; Enter this thread into the hash table.
2682 (gnus-sethash subject threads hashtb)))
2684 (setq threads (cdr threads)))
2687 (defun gnus-gather-threads-by-references (threads)
2688 "Gather threads by looking at References headers."
2689 (let ((idhashtb (gnus-make-hashtable 1024))
2690 (thhashtb (gnus-make-hashtable 1024))
2693 ids references id gthread gid entered ref)
2695 (when (setq references (mail-header-references (caar threads)))
2696 (setq id (mail-header-id (caar threads))
2697 ids (gnus-split-references references)
2699 (while (setq ref (pop ids))
2700 (setq ids (delete ref ids))
2701 (if (not (setq gid (gnus-gethash ref idhashtb)))
2703 (gnus-sethash ref id idhashtb)
2704 (gnus-sethash id threads thhashtb))
2705 (setq gthread (gnus-gethash gid thhashtb))
2707 ;; We enter a dummy root into the thread, if we
2708 ;; haven't done that already.
2709 (unless (stringp (caar gthread))
2710 (setcar gthread (list (mail-header-subject (caar gthread))
2712 ;; We add this new gathered thread to this gathered
2714 (setcdr (car gthread)
2715 (nconc (cdar gthread) (list (car threads)))))
2716 ;; Add it into the thread hash table.
2717 (gnus-sethash id gthread thhashtb)
2719 ;; Remove it from the list of threads.
2720 (setcdr prev (cdr threads))
2721 (setq threads prev))))
2723 (setq threads (cdr threads)))
2726 (defun gnus-sort-gathered-threads (threads)
2727 "Sort subtreads inside each gathered thread by article number."
2728 (let ((result threads))
2730 (when (stringp (caar threads))
2731 (setcdr (car threads)
2732 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2733 (setq threads (cdr threads)))
2736 (defun gnus-thread-loop-p (root thread)
2737 "Say whether ROOT is in THREAD."
2738 (let ((th (cdr thread)))
2740 (not (eq (caar th) root)))
2743 ;; We have found a loop.
2745 (setcdr thread (delq (car th) (cdr thread)))
2746 (if (boundp (setq ref-dep (intern "none"
2747 gnus-newsgroup-dependencies)))
2748 (setcdr (symbol-value ref-dep)
2749 (nconc (cdr (symbol-value ref-dep))
2751 (set ref-dep (list nil (car th))))
2753 ;; Recurse down into the sub-threads and look for loops.
2756 (lambda (thread) (gnus-thread-loop-p root thread))
2759 (defun gnus-make-threads ()
2760 "Go through the dependency hashtb and find the roots. Return all threads."
2762 (while (catch 'infloop
2765 ;; Deal with self-referencing References loops.
2766 (when (and (car (symbol-value refs))
2773 (car (symbol-value refs)) thread))
2774 (cdr (symbol-value refs)))))))
2777 (unless (car (symbol-value refs))
2778 ;; These threads do not refer back to any other articles,
2779 ;; so they're roots.
2780 (setq threads (append (cdr (symbol-value refs)) threads))))
2781 gnus-newsgroup-dependencies)))
2784 (defun gnus-build-sparse-threads ()
2785 (let ((headers gnus-newsgroup-headers)
2786 (deps gnus-newsgroup-dependencies)
2787 header references generation relations
2788 cthread subject child end pthread relation)
2789 ;; First we create an alist of generations/relations, where
2790 ;; generations is how much we trust the relation, and the relation
2792 (gnus-message 7 "Making sparse threads...")
2794 (nnheader-set-temp-buffer " *gnus sparse threads*")
2795 (while (setq header (pop headers))
2796 (when (and (setq references (mail-header-references header))
2797 (not (string= references "")))
2799 (setq child (mail-header-id header)
2800 subject (mail-header-subject header))
2802 (while (search-backward ">" nil t)
2803 (setq end (1+ (point)))
2804 (when (search-backward "<" nil t)
2805 (push (list (incf generation)
2806 child (setq child (buffer-substring (point) end))
2809 (push (list (1+ generation) child nil subject) relations)
2811 (kill-buffer (current-buffer)))
2812 ;; Sort over trustworthiness.
2813 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2814 (while (setq relation (pop relations))
2815 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2816 (unless (car (symbol-value cthread))
2817 ;; Make this article the parent of these threads.
2818 (setcar (symbol-value cthread)
2819 (vector gnus-reffed-article-number
2823 (or (caddr relation) "") 0 0 "")))
2824 (set cthread (list (vector gnus-reffed-article-number
2826 "" "" (cadr relation)
2827 (or (caddr relation) "") 0 0 ""))))
2828 (push gnus-reffed-article-number gnus-newsgroup-limit)
2829 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2830 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2831 gnus-newsgroup-reads)
2832 (decf gnus-reffed-article-number)
2833 ;; Make this new thread the child of its parent.
2834 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2835 (setcdr (symbol-value pthread)
2836 (nconc (cdr (symbol-value pthread))
2837 (list (symbol-value cthread))))
2838 (set pthread (list nil (symbol-value cthread))))))
2839 (gnus-message 7 "Making sparse threads...done")))
2841 (defun gnus-build-old-threads ()
2842 ;; Look at all the articles that refer back to old articles, and
2843 ;; fetch the headers for the articles that aren't there. This will
2844 ;; build complete threads - if the roots haven't been expired by the
2849 (when (not (car (symbol-value refs)))
2850 (setq heads (cdr (symbol-value refs)))
2852 (if (memq (mail-header-number (caar heads))
2853 gnus-newsgroup-dormant)
2854 (setq heads (cdr heads))
2855 (setq id (symbol-name refs))
2856 (while (and (setq id (gnus-build-get-header id))
2857 (not (car (gnus-gethash
2858 id gnus-newsgroup-dependencies)))))
2859 (setq heads nil)))))
2860 gnus-newsgroup-dependencies)))
2862 (defun gnus-build-get-header (id)
2863 ;; Look through the buffer of NOV lines and find the header to
2864 ;; ID. Enter this line into the dependencies hash table, and return
2865 ;; the id of the parent article (if any).
2866 (let ((deps gnus-newsgroup-dependencies)
2870 (set-buffer nntp-server-buffer)
2871 (goto-char (point-min))
2872 (while (and (not found) (search-forward id nil t))
2874 (setq found (looking-at
2875 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2876 (regexp-quote id))))
2877 (or found (beginning-of-line 2)))
2881 (setq header (gnus-nov-parse-line
2882 (read (current-buffer)) deps))
2883 (gnus-parent-id (mail-header-references header)))))
2885 (let ((number (mail-header-number header)))
2886 (push number gnus-newsgroup-limit)
2887 (push header gnus-newsgroup-headers)
2888 (if (memq number gnus-newsgroup-unselected)
2890 (push number gnus-newsgroup-unreads)
2891 (setq gnus-newsgroup-unselected
2892 (delq number gnus-newsgroup-unselected)))
2893 (push number gnus-newsgroup-ancient)))))))
2895 (defun gnus-summary-update-article-line (article header)
2896 "Update the line for ARTICLE using HEADERS."
2897 (let* ((id (mail-header-id header))
2898 (thread (gnus-id-to-thread id)))
2900 (error "Article in no thread"))
2901 ;; Update the thread.
2902 (setcar thread header)
2903 (gnus-summary-goto-subject article)
2904 (let* ((datal (gnus-data-find-list article))
2906 (length (when (cdr datal)
2907 (- (gnus-data-pos data)
2908 (gnus-data-pos (cadr datal)))))
2909 (buffer-read-only nil)
2910 (level (gnus-summary-thread-level)))
2912 (gnus-summary-insert-line
2913 header level nil (gnus-article-mark article)
2914 (memq article gnus-newsgroup-replied)
2915 (memq article gnus-newsgroup-expirable)
2916 ;; Only insert the Subject string when it's different
2917 ;; from the previous Subject string.
2918 (unless (gnus-subject-equal
2920 (mail-header-subject
2923 (gnus-data-find-list
2925 (gnus-data-list t)))))
2927 (mail-header-subject header))
2928 (mail-header-subject header))
2929 nil (cdr (assq article gnus-newsgroup-scored))
2930 (memq article gnus-newsgroup-processable))
2932 (gnus-data-update-list
2933 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
2935 (defun gnus-summary-update-article (article &optional iheader)
2936 "Update ARTICLE in the summary buffer."
2937 (set-buffer gnus-summary-buffer)
2938 (let* ((header (or iheader (gnus-summary-article-header article)))
2939 (id (mail-header-id header))
2940 (data (gnus-data-find article))
2941 (thread (gnus-id-to-thread id))
2942 (references (mail-header-references header))
2946 (when (and references
2947 (not (equal "" references)))
2950 (buffer-read-only nil)
2952 (number (mail-header-number header))
2955 ;; !!! Should this be in or not?
2957 (setcar thread nil))
2959 (delq thread parent))
2960 (if (gnus-summary-insert-subject id header iheader)
2961 ;; Set the (possibly) new article number in the data structure.
2962 (gnus-data-set-number data (gnus-id-to-article id))
2966 (defun gnus-rebuild-thread (id)
2967 "Rebuild the thread containing ID."
2968 (let ((buffer-read-only nil)
2969 old-pos current thread data)
2970 (if (not gnus-show-threads)
2971 (setq thread (list (car (gnus-id-to-thread id))))
2972 ;; Get the thread this article is part of.
2973 (setq thread (gnus-remove-thread id)))
2974 (setq old-pos (gnus-point-at-bol))
2975 (setq current (save-excursion
2976 (and (zerop (forward-line -1))
2977 (gnus-summary-article-number))))
2978 ;; If this is a gathered thread, we have to go some re-gathering.
2979 (when (stringp (car thread))
2980 (let ((subject (car thread))
2982 (setq thread (cdr thread))
2984 (unless (memq (setq thr (gnus-id-to-thread
2986 (mail-header-id (caar thread)))))
2989 (setq thread (cdr thread)))
2990 ;; We now have all (unique) roots.
2991 (if (= (length roots) 1)
2992 ;; All the loose roots are now one solid root.
2993 (setq thread (car roots))
2994 (setq thread (cons subject (gnus-sort-threads roots))))))
2996 ;; We then insert this thread into the summary buffer.
2997 (let (gnus-newsgroup-data gnus-newsgroup-threads)
2998 (if gnus-show-threads
2999 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3000 (gnus-summary-prepare-unthreaded thread))
3001 (setq data (nreverse gnus-newsgroup-data))
3002 (setq threads gnus-newsgroup-threads))
3003 ;; We splice the new data into the data structure.
3004 (gnus-data-enter-list current data (- (point) old-pos))
3005 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3007 (defun gnus-number-to-header (number)
3008 "Return the header for article NUMBER."
3009 (let ((headers gnus-newsgroup-headers))
3011 (not (= number (mail-header-number (car headers)))))
3016 (defun gnus-parent-headers (headers &optional generation)
3017 "Return the headers of the GENERATIONeth parent of HEADERS."
3019 (setq generation 1))
3020 (let (references parent)
3021 (while (and headers (not (zerop generation)))
3022 (setq references (mail-header-references headers))
3023 (when (and references
3024 (setq parent (gnus-parent-id references))
3025 (setq headers (car (gnus-id-to-thread parent))))
3029 (defun gnus-id-to-thread (id)
3030 "Return the (sub-)thread where ID appears."
3031 (gnus-gethash id gnus-newsgroup-dependencies))
3033 (defun gnus-id-to-article (id)
3034 "Return the article number of ID."
3035 (let ((thread (gnus-id-to-thread id)))
3038 (mail-header-number (car thread)))))
3040 (defun gnus-id-to-header (id)
3041 "Return the article headers of ID."
3042 (car (gnus-id-to-thread id)))
3044 (defun gnus-article-displayed-root-p (article)
3045 "Say whether ARTICLE is a root(ish) article."
3046 (let ((level (gnus-summary-thread-level article))
3047 (refs (mail-header-references (gnus-summary-article-header article)))
3053 ((null (gnus-parent-id refs)) t)
3055 (null (setq particle (gnus-id-to-article
3056 (gnus-parent-id refs))))
3057 (null (gnus-summary-thread-level particle)))))))
3059 (defun gnus-root-id (id)
3060 "Return the id of the root of the thread where ID appears."
3062 (while (and id (setq prev (car (gnus-gethash
3063 id gnus-newsgroup-dependencies))))
3065 id (gnus-parent-id (mail-header-references prev))))
3068 (defun gnus-remove-thread (id &optional dont-remove)
3069 "Remove the thread that has ID in it."
3070 (let ((dep gnus-newsgroup-dependencies)
3071 headers thread last-id)
3072 ;; First go up in this thread until we find the root.
3073 (setq last-id (gnus-root-id id))
3074 (setq headers (list (car (gnus-id-to-thread last-id))
3075 (caadr (gnus-id-to-thread last-id))))
3076 ;; We have now found the real root of this thread. It might have
3077 ;; been gathered into some loose thread, so we have to search
3078 ;; through the threads to find the thread we wanted.
3079 (let ((threads gnus-newsgroup-threads)
3082 (setq sub (car threads))
3083 (if (stringp (car sub))
3084 ;; This is a gathered thread, so we look at the roots
3085 ;; below it to find whether this article is in this
3088 (setq sub (cdr sub))
3090 (when (member (caar sub) headers)
3091 (setq thread (car threads)
3094 (setq sub (cdr sub))))
3095 ;; It's an ordinary thread, so we check it.
3096 (when (eq (car sub) (car headers))
3099 (setq threads (cdr threads)))
3100 ;; If this article is in no thread, then it's a root.
3103 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3104 (setq thread (gnus-gethash last-id dep)))
3107 thread ; We return this thread.
3109 (if (stringp (car thread))
3111 ;; If we use dummy roots, then we have to remove the
3112 ;; dummy root as well.
3113 (when (eq gnus-summary-make-false-root 'dummy)
3115 (gnus-data-compute-positions))
3116 (setq thread (cdr thread))
3118 (gnus-remove-thread-1 (car thread))
3119 (setq thread (cdr thread))))
3120 (gnus-remove-thread-1 thread))))))))
3122 (defun gnus-remove-thread-1 (thread)
3123 "Remove the thread THREAD recursively."
3124 (let ((number (mail-header-number (pop thread)))
3126 (setq thread (reverse thread))
3128 (gnus-remove-thread-1 (pop thread)))
3129 (when (setq d (gnus-data-find number))
3130 (goto-char (gnus-data-pos d))
3133 (- (gnus-point-at-bol)
3135 (1+ (gnus-point-at-eol))
3136 (gnus-delete-line)))))))
3138 (defun gnus-sort-threads (threads)
3140 (if (not gnus-thread-sort-functions)
3142 (gnus-message 7 "Sorting threads...")
3144 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3145 (gnus-message 7 "Sorting threads...done"))))
3147 (defun gnus-sort-articles (articles)
3149 (when gnus-article-sort-functions
3150 (gnus-message 7 "Sorting articles...")
3152 (setq gnus-newsgroup-headers
3153 (sort articles (gnus-make-sort-function
3154 gnus-article-sort-functions)))
3155 (gnus-message 7 "Sorting articles...done"))))
3157 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3158 (defmacro gnus-thread-header (thread)
3159 ;; Return header of first article in THREAD.
3160 ;; Note that THREAD must never, ever be anything else than a variable -
3161 ;; using some other form will lead to serious barfage.
3162 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3163 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3164 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3167 (defsubst gnus-article-sort-by-number (h1 h2)
3168 "Sort articles by article number."
3169 (< (mail-header-number h1)
3170 (mail-header-number h2)))
3172 (defun gnus-thread-sort-by-number (h1 h2)
3173 "Sort threads by root article number."
3174 (gnus-article-sort-by-number
3175 (gnus-thread-header h1) (gnus-thread-header h2)))
3177 (defsubst gnus-article-sort-by-lines (h1 h2)
3178 "Sort articles by article Lines header."
3179 (< (mail-header-lines h1)
3180 (mail-header-lines h2)))
3182 (defun gnus-thread-sort-by-lines (h1 h2)
3183 "Sort threads by root article Lines header."
3184 (gnus-article-sort-by-lines
3185 (gnus-thread-header h1) (gnus-thread-header h2)))
3187 (defsubst gnus-article-sort-by-author (h1 h2)
3188 "Sort articles by root author."
3190 (let ((extract (funcall
3191 gnus-extract-address-components
3192 (mail-header-from h1))))
3193 (or (car extract) (cdr extract)))
3194 (let ((extract (funcall
3195 gnus-extract-address-components
3196 (mail-header-from h2))))
3197 (or (car extract) (cdr extract)))))
3199 (defun gnus-thread-sort-by-author (h1 h2)
3200 "Sort threads by root author."
3201 (gnus-article-sort-by-author
3202 (gnus-thread-header h1) (gnus-thread-header h2)))
3204 (defsubst gnus-article-sort-by-subject (h1 h2)
3205 "Sort articles by root subject."
3207 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3208 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3210 (defun gnus-thread-sort-by-subject (h1 h2)
3211 "Sort threads by root subject."
3212 (gnus-article-sort-by-subject
3213 (gnus-thread-header h1) (gnus-thread-header h2)))
3215 (defsubst gnus-article-sort-by-date (h1 h2)
3216 "Sort articles by root article date."
3218 (gnus-date-get-time (mail-header-date h1))
3219 (gnus-date-get-time (mail-header-date h2))))
3221 (defun gnus-thread-sort-by-date (h1 h2)
3222 "Sort threads by root article date."
3223 (gnus-article-sort-by-date
3224 (gnus-thread-header h1) (gnus-thread-header h2)))
3226 (defsubst gnus-article-sort-by-score (h1 h2)
3227 "Sort articles by root article score.
3228 Unscored articles will be counted as having a score of zero."
3229 (> (or (cdr (assq (mail-header-number h1)
3230 gnus-newsgroup-scored))
3231 gnus-summary-default-score 0)
3232 (or (cdr (assq (mail-header-number h2)
3233 gnus-newsgroup-scored))
3234 gnus-summary-default-score 0)))
3236 (defun gnus-thread-sort-by-score (h1 h2)
3237 "Sort threads by root article score."
3238 (gnus-article-sort-by-score
3239 (gnus-thread-header h1) (gnus-thread-header h2)))
3241 (defun gnus-thread-sort-by-total-score (h1 h2)
3242 "Sort threads by the sum of all scores in the thread.
3243 Unscored articles will be counted as having a score of zero."
3244 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3246 (defun gnus-thread-total-score (thread)
3247 ;; This function find the total score of THREAD.
3248 (cond ((null thread)
3251 (if (stringp (car thread))
3252 (apply gnus-thread-score-function 0
3253 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3254 (gnus-thread-total-score-1 thread)))
3256 (gnus-thread-total-score-1 (list thread)))))
3258 (defun gnus-thread-total-score-1 (root)
3259 ;; This function find the total score of the thread below ROOT.
3260 (setq root (car root))
3261 (apply gnus-thread-score-function
3263 (mapcar 'gnus-thread-total-score
3264 (cdr (gnus-gethash (mail-header-id root)
3265 gnus-newsgroup-dependencies)))
3266 (when (> (mail-header-number root) 0)
3267 (list (or (cdr (assq (mail-header-number root)
3268 gnus-newsgroup-scored))
3269 gnus-summary-default-score 0))))
3270 (list gnus-summary-default-score)
3273 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3274 (defvar gnus-tmp-prev-subject nil)
3275 (defvar gnus-tmp-false-parent nil)
3276 (defvar gnus-tmp-root-expunged nil)
3277 (defvar gnus-tmp-dummy-line nil)
3279 (defun gnus-summary-prepare-threads (threads)
3280 "Prepare summary buffer from THREADS and indentation LEVEL.
3281 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3282 or a straight list of headers."
3283 (gnus-message 7 "Generating summary...")
3285 (setq gnus-newsgroup-threads threads)
3288 (let ((gnus-tmp-level 0)
3289 (default-score (or gnus-summary-default-score 0))
3290 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3291 thread number subject stack state gnus-tmp-gathered beg-match
3292 new-roots gnus-tmp-new-adopts thread-end
3293 gnus-tmp-header gnus-tmp-unread
3294 gnus-tmp-replied gnus-tmp-subject-or-nil
3295 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3296 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3297 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3299 (setq gnus-tmp-prev-subject nil)
3301 (if (vectorp (car threads))
3302 ;; If this is a straight (sic) list of headers, then a
3303 ;; threaded summary display isn't required, so we just create
3304 ;; an unthreaded one.
3305 (gnus-summary-prepare-unthreaded threads)
3307 ;; Do the threaded display.
3309 (while (or threads stack gnus-tmp-new-adopts new-roots)
3311 (if (and (= gnus-tmp-level 0)
3312 (not (setq gnus-tmp-dummy-line nil))
3315 (not gnus-tmp-false-parent)
3316 (or gnus-tmp-new-adopts new-roots))
3317 (if gnus-tmp-new-adopts
3318 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3319 thread (list (car gnus-tmp-new-adopts))
3320 gnus-tmp-header (caar thread)
3321 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3323 (setq thread (list (car new-roots))
3324 gnus-tmp-header (caar thread)
3325 new-roots (cdr new-roots))))
3328 ;; If there are some threads, we do them before the
3329 ;; threads on the stack.
3330 (setq thread threads
3331 gnus-tmp-header (caar thread))
3332 ;; There were no current threads, so we pop something off
3334 (setq state (car stack)
3335 gnus-tmp-level (car state)
3338 gnus-tmp-header (caar thread))))
3340 (setq gnus-tmp-false-parent nil)
3341 (setq gnus-tmp-root-expunged nil)
3342 (setq thread-end nil)
3344 (if (stringp gnus-tmp-header)
3345 ;; The header is a dummy root.
3347 ((eq gnus-summary-make-false-root 'adopt)
3348 ;; We let the first article adopt the rest.
3349 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3351 (setq gnus-tmp-gathered
3353 (lambda (h) (mail-header-number (car h)))
3356 (setq thread (cons (list (caar thread)
3359 (setq gnus-tmp-level -1
3360 gnus-tmp-false-parent t))
3361 ((eq gnus-summary-make-false-root 'empty)
3362 ;; We print adopted articles with empty subject fields.
3363 (setq gnus-tmp-gathered
3365 (lambda (h) (mail-header-number (car h)))
3368 (setq gnus-tmp-level -1))
3369 ((eq gnus-summary-make-false-root 'dummy)
3370 ;; We remember that we probably want to output a dummy
3372 (setq gnus-tmp-dummy-line gnus-tmp-header)
3373 (setq gnus-tmp-prev-subject gnus-tmp-header))
3375 ;; We do not make a root for the gathered
3376 ;; sub-threads at all.
3377 (setq gnus-tmp-level -1)))
3379 (setq number (mail-header-number gnus-tmp-header)
3380 subject (mail-header-subject gnus-tmp-header))
3383 ;; If the thread has changed subject, we might want to make
3384 ;; this subthread into a root.
3385 ((and (null gnus-thread-ignore-subject)
3386 (not (zerop gnus-tmp-level))
3387 gnus-tmp-prev-subject
3389 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3390 (setq new-roots (nconc new-roots (list (car thread)))
3392 gnus-tmp-header nil))
3393 ;; If the article lies outside the current limit,
3394 ;; then we do not display it.
3395 ((not (memq number gnus-newsgroup-limit))
3396 (setq gnus-tmp-gathered
3398 (lambda (h) (mail-header-number (car h)))
3401 (setq gnus-tmp-new-adopts (if (cdar thread)
3402 (append gnus-tmp-new-adopts
3404 gnus-tmp-new-adopts)
3406 gnus-tmp-header nil)
3407 (when (zerop gnus-tmp-level)
3408 (setq gnus-tmp-root-expunged t)))
3409 ;; Perhaps this article is to be marked as read?
3410 ((and gnus-summary-mark-below
3411 (< (or (cdr (assq number gnus-newsgroup-scored))
3413 gnus-summary-mark-below)
3414 ;; Don't touch sparse articles.
3415 (not (gnus-summary-article-sparse-p number))
3416 (not (gnus-summary-article-ancient-p number)))
3417 (setq gnus-newsgroup-unreads
3418 (delq number gnus-newsgroup-unreads))
3419 (if gnus-newsgroup-auto-expire
3420 (push number gnus-newsgroup-expirable)
3421 (push (cons number gnus-low-score-mark)
3422 gnus-newsgroup-reads))))
3424 (when gnus-tmp-header
3425 ;; We may have an old dummy line to output before this
3427 (when gnus-tmp-dummy-line
3428 (gnus-summary-insert-dummy-line
3429 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3430 (setq gnus-tmp-dummy-line nil))
3432 ;; Compute the mark.
3433 (setq gnus-tmp-unread (gnus-article-mark number))
3435 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3436 gnus-tmp-header gnus-tmp-level)
3437 gnus-newsgroup-data)
3439 ;; Actually insert the line.
3441 gnus-tmp-subject-or-nil
3443 ((and gnus-thread-ignore-subject
3444 gnus-tmp-prev-subject
3445 (not (inline (gnus-subject-equal
3446 gnus-tmp-prev-subject subject))))
3448 ((zerop gnus-tmp-level)
3449 (if (and (eq gnus-summary-make-false-root 'empty)
3450 (memq number gnus-tmp-gathered)
3451 gnus-tmp-prev-subject
3452 (inline (gnus-subject-equal
3453 gnus-tmp-prev-subject subject)))
3454 gnus-summary-same-subject
3456 (t gnus-summary-same-subject)))
3457 (if (and (eq gnus-summary-make-false-root 'adopt)
3458 (= gnus-tmp-level 1)
3459 (memq number gnus-tmp-gathered))
3460 (setq gnus-tmp-opening-bracket ?\<
3461 gnus-tmp-closing-bracket ?\>)
3462 (setq gnus-tmp-opening-bracket ?\[
3463 gnus-tmp-closing-bracket ?\]))
3465 gnus-tmp-indentation
3466 (aref gnus-thread-indent-array gnus-tmp-level)
3467 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3468 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3469 gnus-summary-default-score 0)
3471 (if (or (null gnus-summary-default-score)
3472 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3473 gnus-summary-zcore-fuzz))
3475 (if (< gnus-tmp-score gnus-summary-default-score)
3476 gnus-score-below-mark gnus-score-over-mark))
3478 (cond ((memq number gnus-newsgroup-processable)
3480 ((memq number gnus-newsgroup-cached)
3482 ((memq number gnus-newsgroup-replied)
3484 ((memq number gnus-newsgroup-saved)
3486 (t gnus-unread-mark))
3487 gnus-tmp-from (mail-header-from gnus-tmp-header)
3490 ((string-match "<[^>]+> *$" gnus-tmp-from)
3491 (setq beg-match (match-beginning 0))
3492 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3493 (substring gnus-tmp-from (1+ (match-beginning 0))
3494 (1- (match-end 0))))
3495 (substring gnus-tmp-from 0 beg-match)))
3496 ((string-match "(.+)" gnus-tmp-from)
3497 (substring gnus-tmp-from
3498 (1+ (match-beginning 0)) (1- (match-end 0))))
3500 (when (string= gnus-tmp-name "")
3501 (setq gnus-tmp-name gnus-tmp-from))
3502 (unless (numberp gnus-tmp-lines)
3503 (setq gnus-tmp-lines 0))
3504 (gnus-put-text-property
3506 (progn (eval gnus-summary-line-format-spec) (point))
3507 'gnus-number number)
3510 (run-hooks 'gnus-summary-update-hook)
3513 (setq gnus-tmp-prev-subject subject)))
3515 (when (nth 1 thread)
3516 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3517 (incf gnus-tmp-level)
3518 (setq threads (if thread-end nil (cdar thread)))
3520 (setq gnus-tmp-level 0)))))
3521 (gnus-message 7 "Generating summary...done"))
3523 (defun gnus-summary-prepare-unthreaded (headers)
3524 "Generate an unthreaded summary buffer based on HEADERS."
3525 (let (header number mark)
3530 ;; We may have to root out some bad articles...
3531 (when (memq (setq number (mail-header-number
3532 (setq header (pop headers))))
3533 gnus-newsgroup-limit)
3534 ;; Mark article as read when it has a low score.
3535 (when (and gnus-summary-mark-below
3536 (< (or (cdr (assq number gnus-newsgroup-scored))
3537 gnus-summary-default-score 0)
3538 gnus-summary-mark-below)
3539 (not (gnus-summary-article-ancient-p number)))
3540 (setq gnus-newsgroup-unreads
3541 (delq number gnus-newsgroup-unreads))
3542 (if gnus-newsgroup-auto-expire
3543 (push number gnus-newsgroup-expirable)
3544 (push (cons number gnus-low-score-mark)
3545 gnus-newsgroup-reads)))
3547 (setq mark (gnus-article-mark number))
3548 (push (gnus-data-make number mark (1+ (point)) header 0)
3549 gnus-newsgroup-data)
3550 (gnus-summary-insert-line
3552 mark (memq number gnus-newsgroup-replied)
3553 (memq number gnus-newsgroup-expirable)
3554 (mail-header-subject header) nil
3555 (cdr (assq number gnus-newsgroup-scored))
3556 (memq number gnus-newsgroup-processable))))))
3558 (defun gnus-select-newsgroup (group &optional read-all)
3559 "Select newsgroup GROUP.
3560 If READ-ALL is non-nil, all articles in the group are selected."
3561 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3562 (info (nth 2 entry))
3563 articles fetched-articles cached)
3565 (unless (gnus-check-server
3566 (setq gnus-current-select-method
3567 (gnus-find-method-for-group group)))
3568 (error "Couldn't open server"))
3570 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3571 (gnus-activate-group group) ; Or we can activate it...
3572 (progn ; Or we bug out.
3573 (when (equal major-mode 'gnus-summary-mode)
3574 (kill-buffer (current-buffer)))
3575 (error "Couldn't request group %s: %s"
3576 group (gnus-status-message group))))
3578 (unless (gnus-request-group group t)
3579 (when (equal major-mode 'gnus-summary-mode)
3580 (kill-buffer (current-buffer)))
3581 (error "Couldn't request group %s: %s"
3582 group (gnus-status-message group)))
3584 (setq gnus-newsgroup-name group)
3585 (setq gnus-newsgroup-unselected nil)
3586 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3588 ;; Adjust and set lists of article marks.
3590 (gnus-adjust-marked-articles info))
3592 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3593 (when (gnus-virtual-group-p group)
3594 (setq cached gnus-newsgroup-cached))
3596 (setq gnus-newsgroup-unreads
3597 (gnus-set-difference
3598 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3599 gnus-newsgroup-dormant))
3601 (setq gnus-newsgroup-processable nil)
3603 (gnus-update-read-articles group gnus-newsgroup-unreads)
3604 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3605 (gnus-group-update-group group))
3607 (setq articles (gnus-articles-to-read group read-all))
3611 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3613 ((eq articles 0) nil)
3615 ;; Init the dependencies hash table.
3616 (setq gnus-newsgroup-dependencies
3617 (gnus-make-hashtable (length articles)))
3618 ;; Retrieve the headers and read them in.
3619 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3620 (setq gnus-newsgroup-headers
3622 (setq gnus-headers-retrieved-by
3623 (gnus-retrieve-headers
3624 articles gnus-newsgroup-name
3625 ;; We might want to fetch old headers, but
3626 ;; not if there is only 1 article.
3627 (and gnus-fetch-old-headers
3629 (not (eq gnus-fetch-old-headers 'some))
3630 (not (numberp gnus-fetch-old-headers)))
3631 (> (length articles) 1))))))
3632 (gnus-get-newsgroup-headers-xover
3633 articles nil nil gnus-newsgroup-name t)
3634 (gnus-get-newsgroup-headers)))
3635 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3637 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3639 (setq gnus-newsgroup-cached cached))
3641 ;; Suppress duplicates?
3642 (when gnus-suppress-duplicates
3643 (gnus-dup-suppress-articles))
3645 ;; Set the initial limit.
3646 (setq gnus-newsgroup-limit (copy-sequence articles))
3647 ;; Remove canceled articles from the list of unread articles.
3648 (setq gnus-newsgroup-unreads
3649 (gnus-set-sorted-intersection
3650 gnus-newsgroup-unreads
3651 (setq fetched-articles
3652 (mapcar (lambda (headers) (mail-header-number headers))
3653 gnus-newsgroup-headers))))
3654 ;; Removed marked articles that do not exist.
3655 (gnus-update-missing-marks
3656 (gnus-sorted-complement fetched-articles articles))
3657 ;; We might want to build some more threads first.
3658 (and gnus-fetch-old-headers
3659 (eq gnus-headers-retrieved-by 'nov)
3660 (gnus-build-old-threads))
3661 ;; Check whether auto-expire is to be done in this group.
3662 (setq gnus-newsgroup-auto-expire
3663 (gnus-group-auto-expirable-p group))
3664 ;; Set up the article buffer now, if necessary.
3665 (unless gnus-single-article-buffer
3666 (gnus-article-setup-buffer))
3667 ;; First and last article in this newsgroup.
3668 (when gnus-newsgroup-headers
3669 (setq gnus-newsgroup-begin
3670 (mail-header-number (car gnus-newsgroup-headers))
3673 (gnus-last-element gnus-newsgroup-headers))))
3674 ;; GROUP is successfully selected.
3675 (or gnus-newsgroup-headers t)))))
3677 (defun gnus-articles-to-read (group &optional read-all)
3678 ;; Find out what articles the user wants to read.
3680 ;; Select all articles if `read-all' is non-nil, or if there
3681 ;; are no unread articles.
3683 (and (zerop (length gnus-newsgroup-marked))
3684 (zerop (length gnus-newsgroup-unreads)))
3685 (eq (gnus-group-find-parameter group 'display)
3687 (gnus-uncompress-range (gnus-active group))
3688 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3689 (copy-sequence gnus-newsgroup-unreads))
3691 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3692 (scored (length scored-list))
3693 (number (length articles))
3694 (marked (+ (length gnus-newsgroup-marked)
3695 (length gnus-newsgroup-dormant)))
3703 ((and (or (<= scored marked) (= scored number))
3704 (numberp gnus-large-newsgroup)
3705 (> number gnus-large-newsgroup))
3709 "How many articles from %s (default %d): "
3710 (gnus-limit-string gnus-newsgroup-name 35)
3712 (if (string-match "^[ \t]*$" input) number input)))
3713 ((and (> scored marked) (< scored number)
3714 (> (- scored number) 20))
3717 (format "%s %s (%d scored, %d total): "
3718 "How many articles from"
3719 group scored number))))
3720 (if (string-match "^[ \t]*$" input)
3724 (setq select (if (stringp select) (string-to-number select) select))
3725 (if (or (null select) (zerop select))
3727 (if (and (not (zerop scored)) (<= (abs select) scored))
3729 (setq articles (sort scored-list '<))
3730 (setq number (length articles)))
3731 (setq articles (copy-sequence articles)))
3733 (when (< (abs select) number)
3735 ;; Select the N oldest articles.
3736 (setcdr (nthcdr (1- (abs select)) articles) nil)
3737 ;; Select the N most recent articles.
3738 (setq articles (nthcdr (- number select) articles))))
3739 (setq gnus-newsgroup-unselected
3740 (gnus-sorted-intersection
3741 gnus-newsgroup-unreads
3742 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3745 (defun gnus-killed-articles (killed articles)
3748 (when (inline (gnus-member-of-range (car articles) killed))
3749 (push (car articles) out))
3750 (setq articles (cdr articles)))
3753 (defun gnus-uncompress-marks (marks)
3754 "Uncompress the mark ranges in MARKS."
3755 (let ((uncompressed '(score bookmark))
3758 (if (memq (caar marks) uncompressed)
3759 (push (car marks) out)
3760 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3761 (setq marks (cdr marks)))
3764 (defun gnus-adjust-marked-articles (info)
3765 "Set all article lists and remove all marks that are no longer legal."
3766 (let* ((marked-lists (gnus-info-marks info))
3767 (active (gnus-active (gnus-info-group info)))
3770 (types gnus-article-mark-lists)
3771 (uncompressed '(score bookmark killed))
3772 marks var articles article mark)
3775 (setq marks (pop marked-lists))
3776 (set (setq var (intern (format "gnus-newsgroup-%s"
3777 (car (rassq (setq mark (car marks))
3779 (if (memq (car marks) uncompressed) (cdr marks)
3780 (gnus-uncompress-range (cdr marks))))
3782 (setq articles (symbol-value var))
3784 ;; All articles have to be subsets of the active articles.
3786 ;; Adjust "simple" lists.
3787 ((memq mark '(tick dormant expirable reply save))
3789 (when (or (< (setq article (pop articles)) min) (> article max))
3790 (set var (delq article (symbol-value var))))))
3792 ((memq mark uncompressed)
3794 (when (or (not (consp (setq article (pop articles))))
3795 (< (car article) min)
3796 (> (car article) max))
3797 (set var (delq article (symbol-value var))))))))))
3799 (defun gnus-update-missing-marks (missing)
3800 "Go through the list of MISSING articles and remove them mark lists."
3802 (let ((types gnus-article-mark-lists)
3804 ;; Go through all types.
3806 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3807 (when (symbol-value var)
3808 ;; This list has articles. So we delete all missing articles
3812 (set var (delq (pop m) (symbol-value var)))))))))
3814 (defun gnus-update-marks ()
3815 "Enter the various lists of marked articles into the newsgroup info list."
3816 (let ((types gnus-article-mark-lists)
3817 (info (gnus-get-info gnus-newsgroup-name))
3818 (uncompressed '(score bookmark killed))
3819 type list newmarked symbol)
3821 ;; Add all marks lists that are non-nil to the list of marks lists.
3823 (setq type (pop types))
3824 (when (setq list (symbol-value
3826 (intern (format "gnus-newsgroup-%s"
3828 (push (cons (cdr type)
3829 (if (memq (cdr type) uncompressed) list
3830 (gnus-compress-sequence
3831 (set symbol (sort list '<)) t)))
3834 ;; Enter these new marks into the info of the group.
3836 (setcar (nthcdr 3 info) newmarked)
3837 ;; Add the marks lists to the end of the info.
3839 (setcdr (nthcdr 2 info) (list newmarked))))
3841 ;; Cut off the end of the info if there's nothing else there.
3845 (when (nthcdr (decf i) info)
3846 (setcdr (nthcdr i info) nil)))))))
3848 (defun gnus-set-mode-line (where)
3849 "This function sets the mode line of the article or summary buffers.
3850 If WHERE is `summary', the summary mode line format will be used."
3851 ;; Is this mode line one we keep updated?
3852 (when (memq where gnus-updated-mode-lines)
3855 ;; We evaluate this in the summary buffer since these
3856 ;; variables are buffer-local to that buffer.
3857 (set-buffer gnus-summary-buffer)
3858 ;; We bind all these variables that are used in the `eval' form
3860 (let* ((mformat (symbol-value
3862 (format "gnus-%s-mode-line-format-spec" where))))
3863 (gnus-tmp-group-name gnus-newsgroup-name)
3864 (gnus-tmp-article-number (or gnus-current-article 0))
3865 (gnus-tmp-unread gnus-newsgroup-unreads)
3866 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3867 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3868 (gnus-tmp-unread-and-unselected
3869 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3870 (zerop gnus-tmp-unselected))
3872 ((zerop gnus-tmp-unselected)
3873 (format "{%d more}" gnus-tmp-unread-and-unticked))
3874 (t (format "{%d(+%d) more}"
3875 gnus-tmp-unread-and-unticked
3876 gnus-tmp-unselected))))
3878 (if (and gnus-current-headers
3879 (vectorp gnus-current-headers))
3880 (gnus-mode-string-quote
3881 (mail-header-subject gnus-current-headers))
3883 bufname-length max-len
3884 gnus-tmp-header);; passed as argument to any user-format-funcs
3885 (setq mode-string (eval mformat))
3886 (setq bufname-length (if (string-match "%b" mode-string)
3889 (if (eq where 'summary)
3891 (get-buffer gnus-article-buffer))))
3894 (setq max-len (max 4 (if gnus-mode-non-string-length
3896 gnus-mode-non-string-length
3898 (length mode-string))))
3899 ;; We might have to chop a bit of the string off...
3900 (when (> (length mode-string) max-len)
3902 (concat (gnus-truncate-string mode-string (- max-len 3))
3904 ;; Pad the mode string a bit.
3905 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
3906 ;; Update the mode line.
3907 (setq mode-line-buffer-identification
3908 (gnus-mode-line-buffer-identification (list mode-string)))
3909 (set-buffer-modified-p t))))
3911 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
3912 "Go through the HEADERS list and add all Xrefs to a hash table.
3913 The resulting hash table is returned, or nil if no Xrefs were found."
3914 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
3915 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
3916 (xref-hashtb (gnus-make-hashtable))
3917 start group entry number xrefs header)
3919 (setq header (pop headers))
3920 (when (and (setq xrefs (mail-header-xref header))
3921 (not (memq (setq number (mail-header-number header))
3924 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
3925 (setq start (match-end 0))
3926 (setq group (if prefix
3927 (concat prefix (substring xrefs (match-beginning 1)
3929 (substring xrefs (match-beginning 1) (match-end 1))))
3931 (string-to-int (substring xrefs (match-beginning 2)
3933 (if (setq entry (gnus-gethash group xref-hashtb))
3934 (setcdr entry (cons number (cdr entry)))
3935 (gnus-sethash group (cons number nil) xref-hashtb)))))
3936 (and start xref-hashtb)))
3938 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
3939 "Look through all the headers and mark the Xrefs as read."
3940 (let ((virtual (gnus-virtual-group-p from-newsgroup))
3941 name entry info xref-hashtb idlist method nth4)
3943 (set-buffer gnus-group-buffer)
3944 (when (setq xref-hashtb
3945 (gnus-create-xref-hashtb from-newsgroup headers unreads))
3948 (unless (string= from-newsgroup (setq name (symbol-name group)))
3949 (setq idlist (symbol-value group))
3950 ;; Dead groups are not updated.
3952 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
3954 (when (stringp (setq nth4 (gnus-info-method info)))
3955 (setq nth4 (gnus-server-to-method nth4))))
3956 ;; Only do the xrefs if the group has the same
3957 ;; select method as the group we have just read.
3958 (or (gnus-methods-equal-p
3959 nth4 (gnus-find-method-for-group from-newsgroup))
3961 (equal nth4 (setq method (gnus-find-method-for-group
3963 (and (equal (car nth4) (car method))
3964 (equal (nth 1 nth4) (nth 1 method))))
3965 gnus-use-cross-reference
3966 (or (not (eq gnus-use-cross-reference t))
3968 ;; Only do cross-references on subscribed
3969 ;; groups, if that is what is wanted.
3970 (<= (gnus-info-level info) gnus-level-subscribed))
3971 (gnus-group-make-articles-read name idlist))))
3974 (defun gnus-group-make-articles-read (group articles)
3975 "Update the info of GROUP to say that only ARTICLES are unread."
3977 (entry (gnus-gethash group gnus-newsrc-hashtb))
3978 (info (nth 2 entry))
3979 (active (gnus-active group))
3981 ;; First peel off all illegal article numbers.
3983 (let ((ids articles)
3985 (while (setq id (pop ids))
3986 (when (and first (> id (cdr active)))
3987 ;; We'll end up in this situation in one particular
3988 ;; obscure situation. If you re-scan a group and get
3989 ;; a new article that is cross-posted to a different
3990 ;; group that has not been re-scanned, you might get
3991 ;; crossposted article that has a higher number than
3992 ;; Gnus believes possible. So we re-activate this
3993 ;; group as well. This might mean doing the
3994 ;; crossposting thingy will *increase* the number
3995 ;; of articles in some groups. Tsk, tsk.
3996 (setq active (or (gnus-activate-group group) active)))
3997 (when (or (> id (cdr active))
3998 (< id (car active)))
3999 (setq articles (delq id articles))))))
4001 (set-buffer gnus-group-buffer)
4004 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4005 (gnus-info-set-read ',info ',(gnus-info-read info))
4006 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4007 (gnus-group-update-group ,group t))))
4008 ;; If the read list is nil, we init it.
4010 (null (gnus-info-read info))
4012 (gnus-info-set-read info (cons 1 (1- (car active)))))
4013 ;; Then we add the read articles to the range.
4018 (gnus-info-read info) (setq articles (sort articles '<)))))
4019 ;; Then we have to re-compute how many unread
4020 ;; articles there are in this group.
4024 (setq num (- (1+ (cdr active)) (car active))))
4025 ((not (listp (cdr range)))
4026 (setq num (- (cdr active) (- (1+ (cdr range))
4030 (if (numberp (car range))
4032 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4033 (setq range (cdr range)))
4034 (setq num (- (cdr active) num))))
4035 ;; Update the number of unread articles.
4037 ;; Update the group buffer.
4038 (gnus-group-update-group group t))))
4040 (defun gnus-methods-equal-p (m1 m2)
4041 (let ((m1 (or m1 gnus-select-method))
4042 (m2 (or m2 gnus-select-method)))
4044 (and (eq (car m1) (car m2))
4045 (or (not (memq 'address (assoc (symbol-name (car m1))
4046 gnus-valid-select-methods)))
4047 (equal (nth 1 m1) (nth 1 m2)))))))
4049 (defvar gnus-newsgroup-none-id 0)
4051 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4052 (let ((cur nntp-server-buffer)
4055 (save-excursion (set-buffer gnus-summary-buffer)
4056 gnus-newsgroup-dependencies)))
4057 headers id id-dep ref-dep end ref)
4059 (set-buffer nntp-server-buffer)
4060 ;; Translate all TAB characters into SPACE characters.
4061 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4062 (run-hooks 'gnus-parse-headers-hook)
4063 (let ((case-fold-search t)
4064 in-reply-to header p lines)
4065 (goto-char (point-min))
4066 ;; Search to the beginning of the next header. Error messages
4067 ;; do not begin with 2 or 3.
4068 (while (re-search-forward "^[23][0-9]+ " nil t)
4071 ;; This implementation of this function, with nine
4072 ;; search-forwards instead of the one re-search-forward and
4073 ;; a case (which basically was the old function) is actually
4074 ;; about twice as fast, even though it looks messier. You
4075 ;; can't have everything, I guess. Speed and elegance
4076 ;; doesn't always go hand in hand.
4085 (narrow-to-region (point)
4086 (or (and (search-forward "\n.\n" nil t)
4092 (if (search-forward "\nsubject: " nil t)
4093 (nnheader-header-value) "(none)"))
4097 (if (search-forward "\nfrom: " nil t)
4098 (nnheader-header-value) "(nobody)"))
4102 (if (search-forward "\ndate: " nil t)
4103 (nnheader-header-value) ""))
4107 (setq id (if (search-forward "\nmessage-id: " nil t)
4108 (nnheader-header-value)
4109 ;; If there was no message-id, we just fake one
4110 ;; to make subsequent routines simpler.
4111 (nnheader-generate-fake-message-id))))
4115 (if (search-forward "\nreferences: " nil t)
4119 (nnheader-header-value)
4124 (search-backward ">" end t)
4127 (search-backward "<" end t)
4129 ;; Get the references from the in-reply-to header if there
4130 ;; were no references and the in-reply-to header looks
4132 (if (and (search-forward "\nin-reply-to: " nil t)
4133 (setq in-reply-to (nnheader-header-value))
4134 (string-match "<[^>]+>" in-reply-to))
4135 (setq ref (substring in-reply-to (match-beginning 0)
4143 (if (search-forward "\nlines: " nil t)
4144 (if (numberp (setq lines (read cur)))
4150 (and (search-forward "\nxref: " nil t)
4151 (nnheader-header-value)))))
4152 (when (equal id ref)
4154 ;; We do the threading while we read the headers. The
4155 ;; message-id and the last reference are both entered into
4156 ;; the same hash table. Some tippy-toeing around has to be
4157 ;; done in case an article has arrived before the article
4158 ;; which it refers to.
4159 (if (boundp (setq id-dep (intern id dependencies)))
4160 (if (and (car (symbol-value id-dep))
4162 ;; An article with this Message-ID has already been seen,
4163 ;; so we rename the Message-ID.
4166 (setq id-dep (intern (setq id (nnmail-message-id))
4169 (mail-header-set-id header id))
4170 (setcar (symbol-value id-dep) header))
4171 (set id-dep (list header)))
4173 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4174 (setcdr (symbol-value ref-dep)
4175 (nconc (cdr (symbol-value ref-dep))
4176 (list (symbol-value id-dep))))
4177 (set ref-dep (list nil (symbol-value id-dep))))
4178 (push header headers))
4179 (goto-char (point-max))
4181 (nreverse headers)))))
4183 ;; The following macros and functions were written by Felix Lee
4184 ;; <flee@cse.psu.edu>.
4186 (defmacro gnus-nov-read-integer ()
4188 (if (= (following-char) ?\t)
4190 (let ((num (ignore-errors (read buffer))))
4191 (if (numberp num) num 0)))
4195 (defmacro gnus-nov-skip-field ()
4196 '(search-forward "\t" eol 'move))
4198 (defmacro gnus-nov-field ()
4199 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4201 ;; (defvar gnus-nov-none-counter 0)
4203 ;; This function has to be called with point after the article number
4204 ;; on the beginning of the line.
4205 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4206 (let ((eol (gnus-point-at-eol))
4207 (buffer (current-buffer))
4208 header ref id id-dep ref-dep)
4210 ;; overview: [num subject from date id refs chars lines misc]
4213 (narrow-to-region (point) eol)
4220 (gnus-nov-field) ; subject
4221 (gnus-nov-field) ; from
4222 (gnus-nov-field) ; date
4223 (setq id (or (gnus-nov-field)
4224 (nnheader-generate-fake-message-id))) ; id
4226 (let ((beg (point)))
4227 (search-forward "\t" eol)
4228 (if (search-backward ">" beg t)
4232 (search-backward "<" beg t)))
4235 (gnus-nov-field)) ; refs
4236 (gnus-nov-read-integer) ; chars
4237 (gnus-nov-read-integer) ; lines
4238 (if (= (following-char) ?\n)
4240 (gnus-nov-field))))) ; misc
4244 ;; We build the thread tree.
4245 (when (equal id ref)
4246 ;; This article refers back to itself. Naughty, naughty.
4248 (if (boundp (setq id-dep (intern id dependencies)))
4249 (if (and (car (symbol-value id-dep))
4251 ;; An article with this Message-ID has already been seen,
4252 ;; so we rename the Message-ID.
4255 (setq id-dep (intern (setq id (nnmail-message-id))
4258 (mail-header-set-id header id))
4259 (setcar (symbol-value id-dep) header))
4260 (set id-dep (list header)))
4262 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4263 (setcdr (symbol-value ref-dep)
4264 (nconc (cdr (symbol-value ref-dep))
4265 (list (symbol-value id-dep))))
4266 (set ref-dep (list nil (symbol-value id-dep)))))
4269 ;; Goes through the xover lines and returns a list of vectors
4270 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4271 force-new dependencies
4272 group also-fetch-heads)
4273 "Parse the news overview data in the server buffer, and return a
4274 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4275 ;; Get the Xref when the users reads the articles since most/some
4276 ;; NNTP servers do not include Xrefs when using XOVER.
4277 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4278 (let ((cur nntp-server-buffer)
4279 (dependencies (or dependencies gnus-newsgroup-dependencies))
4280 number headers header)
4282 (set-buffer nntp-server-buffer)
4283 ;; Allow the user to mangle the headers before parsing them.
4284 (run-hooks 'gnus-parse-headers-hook)
4285 (goto-char (point-min))
4288 (while (and sequence (not (eobp)))
4289 (setq number (read cur))
4290 (while (and sequence
4291 (< (car sequence) number))
4292 (setq sequence (cdr sequence)))
4294 (eq number (car sequence))
4296 (setq sequence (cdr sequence))
4297 (setq header (inline
4298 (gnus-nov-parse-line
4299 number dependencies force-new))))
4300 (push header headers))
4303 (gnus-error 4 "Strange nov line (%d)"
4304 (count-lines (point-min) (point)))))
4306 ;; A common bug in inn is that if you have posted an article and
4307 ;; then retrieves the active file, it will answer correctly --
4308 ;; the new article is included. However, a NOV entry for the
4309 ;; article may not have been generated yet, so this may fail.
4310 ;; We work around this problem by retrieving the last few
4311 ;; headers using HEAD.
4312 (if (or (not also-fetch-heads)
4314 ;; We (probably) got all the headers.
4316 (let ((gnus-nov-is-evil t))
4319 (when (gnus-retrieve-headers sequence group)
4320 (gnus-get-newsgroup-headers))))))))
4322 (defun gnus-article-get-xrefs ()
4323 "Fill in the Xref value in `gnus-current-headers', if necessary.
4324 This is meant to be called in `gnus-article-internal-prepare-hook'."
4325 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4326 gnus-current-headers)))
4327 (or (not gnus-use-cross-reference)
4329 (and (mail-header-xref headers)
4330 (not (string= (mail-header-xref headers) "")))
4331 (let ((case-fold-search t)
4334 (nnheader-narrow-to-headers)
4335 (goto-char (point-min))
4336 (when (or (and (eq (downcase (following-char)) ?x)
4337 (looking-at "Xref:"))
4338 (search-forward "\nXref:" nil t))
4339 (goto-char (1+ (match-end 0)))
4340 (setq xref (buffer-substring (point)
4341 (progn (end-of-line) (point))))
4342 (mail-header-set-xref headers xref)))))))
4344 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4345 "Find article ID and insert the summary line for that article."
4346 (let ((header (if (and old-header use-old-header)
4347 old-header (gnus-read-header id)))
4348 (number (and (numberp id) id))
4351 ;; Rebuild the thread that this article is part of and go to the
4352 ;; article we have fetched.
4353 (when (and (not gnus-show-threads)
4355 (when (setq d (gnus-data-find (mail-header-number old-header)))
4356 (goto-char (gnus-data-pos d))
4359 (- (gnus-point-at-bol)
4361 (1+ (gnus-point-at-eol))
4362 (gnus-delete-line))))))
4364 (mail-header-set-number header (mail-header-number old-header)))
4365 (setq gnus-newsgroup-sparse
4366 (delq (setq number (mail-header-number header))
4367 gnus-newsgroup-sparse))
4368 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4369 (gnus-rebuild-thread (mail-header-id header))
4370 (gnus-summary-goto-subject number nil t))
4371 (when (and (numberp number)
4373 ;; We have to update the boundaries even if we can't fetch the
4374 ;; article if ID is a number -- so that the next `P' or `N'
4375 ;; command will fetch the previous (or next) article even
4376 ;; if the one we tried to fetch this time has been canceled.
4377 (when (> number gnus-newsgroup-end)
4378 (setq gnus-newsgroup-end number))
4379 (when (< number gnus-newsgroup-begin)
4380 (setq gnus-newsgroup-begin number))
4381 (setq gnus-newsgroup-unselected
4382 (delq number gnus-newsgroup-unselected)))
4383 ;; Report back a success?
4384 (and header (mail-header-number header))))
4386 ;;; Process/prefix in the summary buffer
4388 (defun gnus-summary-work-articles (n)
4389 "Return a list of articles to be worked upon. The prefix argument,
4390 the list of process marked articles, and the current article will be
4391 taken into consideration."
4394 ;; A numerical prefix has been given.
4395 (setq n (prefix-numeric-value n))
4396 (let ((backward (< n 0))
4397 (n (abs (prefix-numeric-value n)))
4402 (push (setq article (gnus-summary-article-number))
4405 (gnus-summary-find-prev nil article)
4406 (gnus-summary-find-next nil article)))
4408 (nreverse articles)))
4409 ((gnus-region-active-p)
4410 ;; Work on the region between point and mark.
4411 (let ((max (max (point) (mark)))
4414 (goto-char (min (point) (mark)))
4417 (push (setq article (gnus-summary-article-number)) articles)
4418 (gnus-summary-find-next nil article)
4420 (nreverse articles))))
4421 (gnus-newsgroup-processable
4422 ;; There are process-marked articles present.
4423 ;; Save current state.
4424 (gnus-summary-save-process-mark)
4426 (reverse gnus-newsgroup-processable))
4428 ;; Just return the current article.
4429 (list (gnus-summary-article-number)))))
4431 (defun gnus-summary-save-process-mark ()
4432 "Push the current set of process marked articles on the stack."
4434 (push (copy-sequence gnus-newsgroup-processable)
4435 gnus-newsgroup-process-stack))
4437 (defun gnus-summary-kill-process-mark ()
4438 "Push the current set of process marked articles on the stack and unmark."
4440 (gnus-summary-save-process-mark)
4441 (gnus-summary-unmark-all-processable))
4443 (defun gnus-summary-yank-process-mark ()
4444 "Pop the last process mark state off the stack and restore it."
4446 (unless gnus-newsgroup-process-stack
4447 (error "Empty mark stack"))
4448 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4450 (defun gnus-summary-process-mark-set (set)
4451 "Make SET into the current process marked articles."
4452 (gnus-summary-unmark-all-processable)
4454 (gnus-summary-set-process-mark (pop set))))
4456 ;;; Searching and stuff
4458 (defun gnus-summary-search-group (&optional backward use-level)
4459 "Search for next unread newsgroup.
4460 If optional argument BACKWARD is non-nil, search backward instead."
4462 (set-buffer gnus-group-buffer)
4463 (when (gnus-group-search-forward
4464 backward nil (if use-level (gnus-group-group-level) nil))
4465 (gnus-group-group-name))))
4467 (defun gnus-summary-best-group (&optional exclude-group)
4468 "Find the name of the best unread group.
4469 If EXCLUDE-GROUP, do not go to this group."
4471 (set-buffer gnus-group-buffer)
4473 (gnus-group-best-unread-group exclude-group))))
4475 (defun gnus-summary-find-next (&optional unread article backward)
4476 (if backward (gnus-summary-find-prev)
4477 (let* ((dummy (gnus-summary-article-intangible-p))
4478 (article (or article (gnus-summary-article-number)))
4479 (arts (gnus-data-find-list article))
4481 (when (and (not dummy)
4482 (or (not gnus-summary-check-current)
4484 (not (gnus-data-unread-p (car arts)))))
4485 (setq arts (cdr arts)))
4490 (when (gnus-data-unread-p (car arts))
4491 (setq result (car arts)
4493 (setq arts (cdr arts)))
4496 (goto-char (gnus-data-pos result))
4497 (gnus-data-number result)))))
4499 (defun gnus-summary-find-prev (&optional unread article)
4500 (let* ((eobp (eobp))
4501 (article (or article (gnus-summary-article-number)))
4502 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4504 (when (and (not eobp)
4505 (or (not gnus-summary-check-current)
4507 (not (gnus-data-unread-p (car arts)))))
4508 (setq arts (cdr arts)))
4513 (when (gnus-data-unread-p (car arts))
4514 (setq result (car arts)
4516 (setq arts (cdr arts)))
4519 (goto-char (gnus-data-pos result))
4520 (gnus-data-number result))))
4522 (defun gnus-summary-find-subject (subject &optional unread backward article)
4523 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4524 (article (or article (gnus-summary-article-number)))
4525 (articles (gnus-data-list backward))
4526 (arts (gnus-data-find-list article articles))
4528 (when (or (not gnus-summary-check-current)
4530 (not (gnus-data-unread-p (car arts))))
4531 (setq arts (cdr arts)))
4533 (and (or (not unread)
4534 (gnus-data-unread-p (car arts)))
4535 (vectorp (gnus-data-header (car arts)))
4537 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4538 (setq result (car arts)
4540 (setq arts (cdr arts)))
4542 (goto-char (gnus-data-pos result))
4543 (gnus-data-number result))))
4545 (defun gnus-summary-search-forward (&optional unread subject backward)
4546 "Search forward for an article.
4547 If UNREAD, look for unread articles. If SUBJECT, look for
4548 articles with that subject. If BACKWARD, search backward instead."
4549 (cond (subject (gnus-summary-find-subject subject unread backward))
4550 (backward (gnus-summary-find-prev unread))
4551 (t (gnus-summary-find-next unread))))
4553 (defun gnus-recenter (&optional n)
4554 "Center point in window and redisplay frame.
4555 Also do horizontal recentering."
4557 (when (and gnus-auto-center-summary
4558 (not (eq gnus-auto-center-summary 'vertical)))
4559 (gnus-horizontal-recenter))
4562 (defun gnus-summary-recenter ()
4563 "Center point in the summary window.
4564 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4565 displayed, no centering will be performed."
4566 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4567 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4568 (let* ((top (cond ((< (window-height) 4) 0)
4569 ((< (window-height) 7) 1)
4571 (height (1- (window-height)))
4572 (bottom (save-excursion (goto-char (point-max))
4573 (forward-line (- height))
4575 (window (get-buffer-window (current-buffer))))
4576 ;; The user has to want it.
4577 (when gnus-auto-center-summary
4578 (when (get-buffer-window gnus-article-buffer)
4579 ;; Only do recentering when the article buffer is displayed,
4580 ;; Set the window start to either `bottom', which is the biggest
4581 ;; possible valid number, or the second line from the top,
4582 ;; whichever is the least.
4584 window (min bottom (save-excursion
4585 (forward-line (- top)) (point)))))
4586 ;; Do horizontal recentering while we're at it.
4587 (when (and (get-buffer-window (current-buffer) t)
4588 (not (eq gnus-auto-center-summary 'vertical)))
4589 (let ((selected (selected-window)))
4590 (select-window (get-buffer-window (current-buffer) t))
4591 (gnus-summary-position-point)
4592 (gnus-horizontal-recenter)
4593 (select-window selected))))))
4595 (defun gnus-summary-jump-to-group (newsgroup)
4596 "Move point to NEWSGROUP in group mode buffer."
4597 ;; Keep update point of group mode buffer if visible.
4598 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4599 (save-window-excursion
4600 ;; Take care of tree window mode.
4601 (when (get-buffer-window gnus-group-buffer)
4602 (pop-to-buffer gnus-group-buffer))
4603 (gnus-group-jump-to-group newsgroup))
4605 ;; Take care of tree window mode.
4606 (if (get-buffer-window gnus-group-buffer)
4607 (pop-to-buffer gnus-group-buffer)
4608 (set-buffer gnus-group-buffer))
4609 (gnus-group-jump-to-group newsgroup))))
4611 ;; This function returns a list of article numbers based on the
4612 ;; difference between the ranges of read articles in this group and
4613 ;; the range of active articles.
4614 (defun gnus-list-of-unread-articles (group)
4615 (let* ((read (gnus-info-read (gnus-get-info group)))
4616 (active (or (gnus-active group) (gnus-activate-group group)))
4619 ;; If none are read, then all are unread.
4621 (setq first (car active))
4622 ;; If the range of read articles is a single range, then the
4623 ;; first unread article is the article after the last read
4624 ;; article. Sounds logical, doesn't it?
4625 (if (not (listp (cdr read)))
4626 (setq first (1+ (cdr read)))
4627 ;; `read' is a list of ranges.
4628 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4634 (while (< first nlast)
4636 (setq first (1+ first))))
4637 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4638 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4639 (setq read (cdr read)))))
4640 ;; And add the last unread articles.
4641 (while (<= first last)
4643 (setq first (1+ first)))
4644 ;; Return the list of unread articles.
4647 (defun gnus-list-of-read-articles (group)
4648 "Return a list of unread, unticked and non-dormant articles."
4649 (let* ((info (gnus-get-info group))
4650 (marked (gnus-info-marks info))
4651 (active (gnus-active group)))
4653 (gnus-set-difference
4654 (gnus-sorted-complement
4655 (gnus-uncompress-range active)
4656 (gnus-list-of-unread-articles group))
4658 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4659 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4661 ;; Various summary commands
4663 (defun gnus-summary-universal-argument (arg)
4664 "Perform any operation on all articles that are process/prefixed."
4666 (gnus-set-global-variables)
4667 (let ((articles (gnus-summary-work-articles arg))
4674 (substitute-command-keys
4675 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4678 (gnus-error 1 "Undefined key")
4681 (gnus-summary-goto-subject (setq article (pop articles)))
4682 (let (gnus-newsgroup-processable)
4683 (command-execute func))
4684 (gnus-summary-remove-process-mark article)))))
4685 (gnus-summary-position-point))
4687 (defun gnus-summary-toggle-truncation (&optional arg)
4688 "Toggle truncation of summary lines.
4689 With arg, turn line truncation on iff arg is positive."
4691 (setq truncate-lines
4692 (if (null arg) (not truncate-lines)
4693 (> (prefix-numeric-value arg) 0)))
4696 (defun gnus-summary-reselect-current-group (&optional all rescan)
4697 "Exit and then reselect the current newsgroup.
4698 The prefix argument ALL means to select all articles."
4700 (gnus-set-global-variables)
4701 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4702 (error "Ephemeral groups can't be reselected"))
4703 (let ((current-subject (gnus-summary-article-number))
4704 (group gnus-newsgroup-name))
4705 (setq gnus-newsgroup-begin nil)
4707 ;; We have to adjust the point of group mode buffer because
4708 ;; point was moved to the next unread newsgroup by exiting.
4709 (gnus-summary-jump-to-group group)
4712 (gnus-group-get-new-news-this-group 1)))
4713 (gnus-group-read-group all t)
4714 (gnus-summary-goto-subject current-subject nil t)))
4716 (defun gnus-summary-rescan-group (&optional all)
4717 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4719 (gnus-summary-reselect-current-group all t))
4721 (defun gnus-summary-update-info (&optional non-destructive)
4723 (let ((group gnus-newsgroup-name))
4724 (when gnus-newsgroup-kill-headers
4725 (setq gnus-newsgroup-killed
4726 (gnus-compress-sequence
4728 (gnus-set-sorted-intersection
4729 (gnus-uncompress-range gnus-newsgroup-killed)
4730 (setq gnus-newsgroup-unselected
4731 (sort gnus-newsgroup-unselected '<)))
4732 (setq gnus-newsgroup-unreads
4733 (sort gnus-newsgroup-unreads '<)))
4735 (unless (listp (cdr gnus-newsgroup-killed))
4736 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4737 (let ((headers gnus-newsgroup-headers))
4738 (when (and (not gnus-save-score)
4739 (not non-destructive))
4740 (setq gnus-newsgroup-scored nil))
4741 ;; Set the new ranges of read articles.
4742 (gnus-update-read-articles
4743 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4744 ;; Set the current article marks.
4746 ;; Do the cross-ref thing.
4747 (when gnus-use-cross-reference
4748 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4749 ;; Do adaptive scoring, and possibly save score files.
4750 (when gnus-newsgroup-adaptive
4751 (gnus-score-adaptive))
4752 (when gnus-use-scoring
4754 ;; Do not switch windows but change the buffer to work.
4755 (set-buffer gnus-group-buffer)
4756 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4757 (gnus-group-update-group group))))))
4759 (defun gnus-summary-save-newsrc (&optional force)
4760 "Save the current number of read/marked articles in the dribble buffer.
4761 The dribble buffer will then be saved.
4762 If FORCE (the prefix), also save the .newsrc file(s)."
4764 (gnus-summary-update-info t)
4766 (gnus-save-newsrc-file)
4767 (gnus-dribble-save)))
4769 (defun gnus-summary-exit (&optional temporary)
4770 "Exit reading current newsgroup, and then return to group selection mode.
4771 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4773 (gnus-set-global-variables)
4774 (gnus-kill-save-kill-buffer)
4775 (let* ((group gnus-newsgroup-name)
4776 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4778 (buf (current-buffer)))
4779 (run-hooks 'gnus-summary-prepare-exit-hook)
4780 ;; If we have several article buffers, we kill them at exit.
4781 (unless gnus-single-article-buffer
4782 (gnus-kill-buffer gnus-original-article-buffer)
4783 (setq gnus-article-current nil))
4784 (when gnus-use-cache
4785 (gnus-cache-possibly-remove-articles)
4786 (gnus-cache-save-buffers))
4787 (gnus-async-prefetch-remove-group group)
4788 (when gnus-suppress-duplicates
4789 (gnus-dup-enter-articles))
4790 (when gnus-use-trees
4791 (gnus-tree-close group))
4792 ;; Make all changes in this group permanent.
4794 (run-hooks 'gnus-exit-group-hook)
4795 (gnus-summary-update-info))
4796 (gnus-close-group group)
4797 ;; Make sure where I was, and go to next newsgroup.
4798 (set-buffer gnus-group-buffer)
4800 (gnus-group-jump-to-group group))
4801 (run-hooks 'gnus-summary-exit-hook)
4803 (gnus-group-next-unread-group 1))
4806 ;; If we have several article buffers, we kill them at exit.
4807 (unless gnus-single-article-buffer
4808 (gnus-kill-buffer gnus-article-buffer)
4809 (gnus-kill-buffer gnus-original-article-buffer)
4810 (setq gnus-article-current nil))
4812 (if (not gnus-kill-summary-on-exit)
4813 (gnus-deaden-summary)
4814 ;; We set all buffer-local variables to nil. It is unclear why
4815 ;; this is needed, but if we don't, buffer-local variables are
4816 ;; not garbage-collected, it seems. This would the lead to en
4817 ;; ever-growing Emacs.
4818 (gnus-summary-clear-local-variables)
4819 (when (get-buffer gnus-article-buffer)
4820 (bury-buffer gnus-article-buffer))
4821 ;; We clear the global counterparts of the buffer-local
4822 ;; variables as well, just to be on the safe side.
4823 (set-buffer gnus-group-buffer)
4824 (gnus-summary-clear-local-variables)
4825 ;; Return to group mode buffer.
4826 (when (eq mode 'gnus-summary-mode)
4827 (gnus-kill-buffer buf)))
4828 (setq gnus-current-select-method gnus-select-method)
4829 (pop-to-buffer gnus-group-buffer)
4830 ;; Clear the current group name.
4831 (if (not quit-config)
4833 (gnus-group-jump-to-group group)
4834 (gnus-group-next-unread-group 1)
4835 (gnus-configure-windows 'group 'force))
4836 (gnus-handle-ephemeral-exit quit-config))
4838 (setq gnus-newsgroup-name nil)))))
4840 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4841 (defun gnus-summary-exit-no-update (&optional no-questions)
4842 "Quit reading current newsgroup without updating read article info."
4844 (gnus-set-global-variables)
4845 (let* ((group gnus-newsgroup-name)
4846 (quit-config (gnus-group-quit-config group)))
4847 (when (or no-questions
4849 (gnus-y-or-n-p "Discard changes to this group and exit? "))
4850 ;; If we have several article buffers, we kill them at exit.
4851 (unless gnus-single-article-buffer
4852 (gnus-kill-buffer gnus-article-buffer)
4853 (gnus-kill-buffer gnus-original-article-buffer)
4854 (setq gnus-article-current nil))
4855 (if (not gnus-kill-summary-on-exit)
4856 (gnus-deaden-summary)
4857 (gnus-close-group group)
4858 (gnus-summary-clear-local-variables)
4859 (set-buffer gnus-group-buffer)
4860 (gnus-summary-clear-local-variables)
4861 (when (get-buffer gnus-summary-buffer)
4862 (kill-buffer gnus-summary-buffer)))
4863 (unless gnus-single-article-buffer
4864 (setq gnus-article-current nil))
4865 (when gnus-use-trees
4866 (gnus-tree-close group))
4867 (gnus-async-prefetch-remove-group group)
4868 (when (get-buffer gnus-article-buffer)
4869 (bury-buffer gnus-article-buffer))
4870 ;; Return to the group buffer.
4871 (gnus-configure-windows 'group 'force)
4872 ;; Clear the current group name.
4873 (setq gnus-newsgroup-name nil)
4874 (when (equal (gnus-group-group-name) group)
4875 (gnus-group-next-unread-group 1))
4877 (gnus-handle-ephemeral-exit quit-config)))))
4879 (defun gnus-handle-ephemeral-exit (quit-config)
4880 "Handle movement when leaving an ephemeral group. The state
4881 which existed when entering the ephemeral is reset."
4882 (if (not (buffer-name (car quit-config)))
4883 (gnus-configure-windows 'group 'force)
4884 (set-buffer (car quit-config))
4885 (cond ((eq major-mode 'gnus-summary-mode)
4886 (gnus-set-global-variables))
4887 ((eq major-mode 'gnus-article-mode)
4889 ;; The `gnus-summary-buffer' variable may point
4890 ;; to the old summary buffer when using a single
4892 (unless (gnus-buffer-live-p gnus-summary-buffer)
4893 (set-buffer gnus-group-buffer))
4894 (set-buffer gnus-summary-buffer)
4895 (gnus-set-global-variables))))
4896 (if (or (eq (cdr quit-config) 'article)
4897 (eq (cdr quit-config) 'pick))
4899 ;; The current article may be from the ephemeral group
4900 ;; thus it is best that we reload this article
4901 (gnus-summary-show-article)
4902 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
4903 (gnus-configure-windows 'pick 'force)
4904 (gnus-configure-windows (cdr quit-config) 'force)))
4905 (gnus-configure-windows (cdr quit-config) 'force))
4906 (when (eq major-mode 'gnus-summary-mode)
4907 (gnus-summary-next-subject 1 nil t)
4908 (gnus-summary-recenter)
4909 (gnus-summary-position-point))))
4913 (defvar gnus-dead-summary-mode-map nil)
4915 (unless gnus-dead-summary-mode-map
4916 (setq gnus-dead-summary-mode-map (make-keymap))
4917 (suppress-keymap gnus-dead-summary-mode-map)
4918 (substitute-key-definition
4919 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
4920 (let ((keys '("\C-d" "\r" "\177")))
4922 (define-key gnus-dead-summary-mode-map
4923 (pop keys) 'gnus-summary-wake-up-the-dead))))
4925 (defvar gnus-dead-summary-mode nil
4926 "Minor mode for Gnus summary buffers.")
4928 (defun gnus-dead-summary-mode (&optional arg)
4929 "Minor mode for Gnus summary buffers."
4931 (when (eq major-mode 'gnus-summary-mode)
4932 (make-local-variable 'gnus-dead-summary-mode)
4933 (setq gnus-dead-summary-mode
4934 (if (null arg) (not gnus-dead-summary-mode)
4935 (> (prefix-numeric-value arg) 0)))
4936 (when gnus-dead-summary-mode
4937 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
4938 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
4939 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
4940 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
4941 minor-mode-map-alist)))))
4943 (defun gnus-deaden-summary ()
4944 "Make the current summary buffer into a dead summary buffer."
4945 ;; Kill any previous dead summary buffer.
4946 (when (and gnus-dead-summary
4947 (buffer-name gnus-dead-summary))
4949 (set-buffer gnus-dead-summary)
4950 (when gnus-dead-summary-mode
4951 (kill-buffer (current-buffer)))))
4952 ;; Make this the current dead summary.
4953 (setq gnus-dead-summary (current-buffer))
4954 (gnus-dead-summary-mode 1)
4955 (let ((name (buffer-name)))
4956 (when (string-match "Summary" name)
4958 (concat (substring name 0 (match-beginning 0)) "Dead "
4959 (substring name (match-beginning 0)))
4962 (defun gnus-kill-or-deaden-summary (buffer)
4963 "Kill or deaden the summary BUFFER."
4964 (when (and (buffer-name buffer)
4965 (not gnus-single-article-buffer))
4968 (gnus-kill-buffer gnus-article-buffer)
4969 (gnus-kill-buffer gnus-original-article-buffer)))
4970 (cond (gnus-kill-summary-on-exit
4971 (when (and gnus-use-trees
4972 (and (get-buffer buffer)
4973 (buffer-name (get-buffer buffer))))
4975 (set-buffer (get-buffer buffer))
4976 (gnus-tree-close gnus-newsgroup-name)))
4977 (gnus-kill-buffer buffer))
4978 ((and (get-buffer buffer)
4979 (buffer-name (get-buffer buffer)))
4982 (gnus-deaden-summary)))))
4984 (defun gnus-summary-wake-up-the-dead (&rest args)
4985 "Wake up the dead summary buffer."
4987 (gnus-dead-summary-mode -1)
4988 (let ((name (buffer-name)))
4989 (when (string-match "Dead " name)
4991 (concat (substring name 0 (match-beginning 0))
4992 (substring name (match-end 0)))
4994 (gnus-message 3 "This dead summary is now alive again"))
4996 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
4997 (defun gnus-summary-fetch-faq (&optional faq-dir)
4998 "Fetch the FAQ for the current group.
4999 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5003 (when current-prefix-arg
5005 "Faq dir: " (and (listp gnus-group-faq-directory)
5006 gnus-group-faq-directory)))))
5007 (let (gnus-faq-buffer)
5008 (when (setq gnus-faq-buffer
5009 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5010 (gnus-configure-windows 'summary-faq))))
5012 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5013 (defun gnus-summary-describe-group (&optional force)
5014 "Describe the current newsgroup."
5016 (gnus-group-describe-group force gnus-newsgroup-name))
5018 (defun gnus-summary-describe-briefly ()
5019 "Describe summary mode commands briefly."
5022 (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")))
5024 ;; Walking around group mode buffer from summary mode.
5026 (defun gnus-summary-next-group (&optional no-article target-group backward)
5027 "Exit current newsgroup and then select next unread newsgroup.
5028 If prefix argument NO-ARTICLE is non-nil, no article is selected
5029 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5030 previous group instead."
5032 (gnus-set-global-variables)
5033 ;; Stop pre-fetching.
5034 (gnus-async-halt-prefetch)
5035 (let ((current-group gnus-newsgroup-name)
5036 (current-buffer (current-buffer))
5038 ;; First we semi-exit this group to update Xrefs and all variables.
5039 ;; We can't do a real exit, because the window conf must remain
5040 ;; the same in case the user is prompted for info, and we don't
5041 ;; want the window conf to change before that...
5042 (gnus-summary-exit t)
5043 (while (not entered)
5044 ;; Then we find what group we are supposed to enter.
5045 (set-buffer gnus-group-buffer)
5046 (gnus-group-jump-to-group current-group)
5049 (if (eq gnus-keep-same-level 'best)
5050 (gnus-summary-best-group gnus-newsgroup-name)
5051 (gnus-summary-search-group backward gnus-keep-same-level))))
5052 (if (not target-group)
5053 ;; There are no further groups, so we return to the group
5056 (gnus-message 5 "Returning to the group buffer")
5058 (set-buffer current-buffer)
5060 (run-hooks 'gnus-group-no-more-groups-hook))
5061 ;; We try to enter the target group.
5062 (gnus-group-jump-to-group target-group)
5063 (let ((unreads (gnus-group-group-unread)))
5064 (if (and (or (eq t unreads)
5065 (and unreads (not (zerop unreads))))
5066 (gnus-summary-read-group
5067 target-group nil no-article current-buffer))
5069 (setq current-group target-group
5070 target-group nil)))))))
5072 (defun gnus-summary-prev-group (&optional no-article)
5073 "Exit current newsgroup and then select previous unread newsgroup.
5074 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5076 (gnus-summary-next-group no-article nil t))
5078 ;; Walking around summary lines.
5080 (defun gnus-summary-first-subject (&optional unread)
5081 "Go to the first unread subject.
5082 If UNREAD is non-nil, go to the first unread article.
5083 Returns the article selected or nil if there are no unread articles."
5088 ((null gnus-newsgroup-data)
5089 (gnus-message 3 "No articles in the group")
5091 ;; Pick the first article.
5093 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5094 (gnus-data-number (car gnus-newsgroup-data)))
5095 ;; No unread articles.
5096 ((null gnus-newsgroup-unreads)
5097 (gnus-message 3 "No more unread articles")
5099 ;; Find the first unread article.
5101 (let ((data gnus-newsgroup-data))
5103 (not (gnus-data-unread-p (car data))))
5104 (setq data (cdr data)))
5106 (goto-char (gnus-data-pos (car data)))
5107 (gnus-data-number (car data))))))
5108 (gnus-summary-position-point)))
5110 (defun gnus-summary-next-subject (n &optional unread dont-display)
5111 "Go to next N'th summary line.
5112 If N is negative, go to the previous N'th subject line.
5113 If UNREAD is non-nil, only unread articles are selected.
5114 The difference between N and the actual number of steps taken is
5117 (let ((backward (< n 0))
5121 (gnus-summary-find-prev unread)
5122 (gnus-summary-find-next unread)))
5125 (gnus-message 7 "No more%s articles"
5126 (if unread " unread" "")))
5127 (unless dont-display
5128 (gnus-summary-recenter)
5129 (gnus-summary-position-point))
5132 (defun gnus-summary-next-unread-subject (n)
5133 "Go to next N'th unread summary line."
5135 (gnus-summary-next-subject n t))
5137 (defun gnus-summary-prev-subject (n &optional unread)
5138 "Go to previous N'th summary line.
5139 If optional argument UNREAD is non-nil, only unread article is selected."
5141 (gnus-summary-next-subject (- n) unread))
5143 (defun gnus-summary-prev-unread-subject (n)
5144 "Go to previous N'th unread summary line."
5146 (gnus-summary-next-subject (- n) t))
5148 (defun gnus-summary-goto-subject (article &optional force silent)
5149 "Go the subject line of ARTICLE.
5150 If FORCE, also allow jumping to articles not currently shown."
5151 (interactive "nArticle number: ")
5153 (data (gnus-data-find article)))
5154 ;; We read in the article if we have to.
5157 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5158 (setq data (gnus-data-find article)))
5163 (gnus-message 3 "Can't find article %d" article))
5165 (goto-char (gnus-data-pos data))
5168 ;; Walking around summary lines with displaying articles.
5170 (defun gnus-summary-expand-window (&optional arg)
5171 "Make the summary buffer take up the entire Emacs frame.
5172 Given a prefix, will force an `article' buffer configuration."
5174 (gnus-set-global-variables)
5176 (gnus-configure-windows 'article 'force)
5177 (gnus-configure-windows 'summary 'force)))
5179 (defun gnus-summary-display-article (article &optional all-header)
5180 "Display ARTICLE in article buffer."
5181 (gnus-set-global-variables)
5185 (if gnus-summary-display-article-function
5186 (funcall gnus-summary-display-article-function article all-header)
5187 (gnus-article-prepare article all-header))
5188 (run-hooks 'gnus-select-article-hook)
5189 (when (and gnus-current-article
5190 (not (zerop gnus-current-article)))
5191 (gnus-summary-goto-subject gnus-current-article))
5192 (gnus-summary-recenter)
5193 (when (and gnus-use-trees gnus-show-threads)
5194 (gnus-possibly-generate-tree article)
5195 (gnus-highlight-selected-tree article))
5196 ;; Successfully display article.
5197 (gnus-article-set-window-start
5198 (cdr (assq article gnus-newsgroup-bookmarks))))))
5200 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5201 "Select the current article.
5202 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5203 non-nil, the article will be re-fetched even if it already present in
5204 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5206 ;; Make sure we are in the summary buffer to work around bbdb bug.
5207 (unless (eq major-mode 'gnus-summary-mode)
5208 (set-buffer gnus-summary-buffer))
5209 (let ((article (or article (gnus-summary-article-number)))
5210 (all-headers (not (not all-headers))) ;Must be T or NIL.
5211 gnus-summary-display-article-function
5214 (gnus-summary-article-pseudo-p article)
5215 (error "This is a pseudo-article."))
5218 (set-buffer gnus-summary-buffer)
5219 (if (or (and gnus-single-article-buffer
5220 (or (null gnus-current-article)
5221 (null gnus-article-current)
5222 (null (get-buffer gnus-article-buffer))
5223 (not (eq article (cdr gnus-article-current)))
5224 (not (equal (car gnus-article-current)
5225 gnus-newsgroup-name))))
5226 (and (not gnus-single-article-buffer)
5227 (or (null gnus-current-article)
5228 (not (eq gnus-current-article article))))
5230 ;; The requested article is different from the current article.
5232 (gnus-summary-display-article article all-headers)
5234 (when (or all-headers gnus-show-all-headers)
5235 (gnus-article-show-all-headers))
5238 (gnus-article-set-window-start
5239 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5241 (defun gnus-summary-set-current-mark (&optional current-mark)
5242 "Obsolete function."
5245 (defun gnus-summary-next-article (&optional unread subject backward push)
5246 "Select the next article.
5247 If UNREAD, only unread articles are selected.
5248 If SUBJECT, only articles with SUBJECT are selected.
5249 If BACKWARD, the previous article is selected instead of the next."
5251 (gnus-set-global-variables)
5253 ;; Is there such an article?
5254 ((and (gnus-summary-search-forward unread subject backward)
5255 (or (gnus-summary-display-article (gnus-summary-article-number))
5256 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5257 (gnus-summary-position-point))
5258 ;; If not, we try the first unread, if that is wanted.
5260 gnus-auto-select-same
5261 (gnus-summary-first-unread-article))
5262 (gnus-summary-position-point)
5263 (gnus-message 6 "Wrapped"))
5264 ;; Try to get next/previous article not displayed in this group.
5265 ((and gnus-auto-extend-newsgroup
5266 (not unread) (not subject))
5267 (gnus-summary-goto-article
5268 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5270 ;; Go to next/previous group.
5272 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5273 (gnus-summary-jump-to-group gnus-newsgroup-name))
5274 (let ((cmd last-command-char)
5277 (set-buffer gnus-group-buffer)
5280 (if (eq gnus-keep-same-level 'best)
5281 (gnus-summary-best-group gnus-newsgroup-name)
5282 (gnus-summary-search-group backward gnus-keep-same-level))))
5283 ;; For some reason, the group window gets selected. We change
5285 (select-window (get-buffer-window (current-buffer)))
5286 ;; Select next unread newsgroup automagically.
5288 ((or (not gnus-auto-select-next)
5290 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5291 ((or (eq gnus-auto-select-next 'quietly)
5292 (and (eq gnus-auto-select-next 'slightly-quietly)
5294 (and (eq gnus-auto-select-next 'almost-quietly)
5295 (gnus-summary-last-article-p)))
5297 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5299 (gnus-message 7 "No more%s articles (%s)..."
5300 (if unread " unread" "")
5301 (if group (concat "selecting " group)
5303 (gnus-summary-next-group nil group backward)))
5305 (when (gnus-key-press-event-p last-input-event)
5306 (gnus-summary-walk-group-buffer
5307 gnus-newsgroup-name cmd unread backward point))))))))
5309 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5310 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5311 (?\C-p (gnus-group-prev-unread-group 1))))
5312 (cursor-in-echo-area t)
5313 keve key group ended)
5315 (set-buffer gnus-group-buffer)
5318 (if (eq gnus-keep-same-level 'best)
5319 (gnus-summary-best-group gnus-newsgroup-name)
5320 (gnus-summary-search-group backward gnus-keep-same-level))))
5323 5 "No more%s articles%s" (if unread " unread" "")
5325 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5326 (format " (Type %s for %s [%s])"
5327 (single-key-description cmd) group
5328 (car (gnus-gethash group gnus-newsrc-hashtb)))
5329 (format " (Type %s to exit %s)"
5330 (single-key-description cmd)
5331 gnus-newsgroup-name)))
5332 ;; Confirm auto selection.
5333 (setq key (car (setq keve (gnus-read-event-char))))
5336 ((assq key keystrokes)
5337 (let ((obuf (current-buffer)))
5338 (switch-to-buffer gnus-group-buffer)
5340 (gnus-group-jump-to-group group))
5341 (eval (cadr (assq key keystrokes)))
5342 (setq group (gnus-group-group-name))
5343 (switch-to-buffer obuf))
5347 (gnus-ephemeral-group-p gnus-newsgroup-name))
5349 (gnus-summary-next-group nil group backward)))
5351 (push (cdr keve) unread-command-events))))))
5353 (defun gnus-summary-next-unread-article ()
5354 "Select unread article after current one."
5356 (gnus-summary-next-article
5357 (or (not (eq gnus-summary-goto-unread 'never))
5358 (gnus-summary-last-article-p (gnus-summary-article-number)))
5359 (and gnus-auto-select-same
5360 (gnus-summary-article-subject))))
5362 (defun gnus-summary-prev-article (&optional unread subject)
5363 "Select the article after the current one.
5364 If UNREAD is non-nil, only unread articles are selected."
5366 (gnus-summary-next-article unread subject t))
5368 (defun gnus-summary-prev-unread-article ()
5369 "Select unread article before current one."
5371 (gnus-summary-prev-article
5372 (or (not (eq gnus-summary-goto-unread 'never))
5373 (gnus-summary-first-article-p (gnus-summary-article-number)))
5374 (and gnus-auto-select-same
5375 (gnus-summary-article-subject))))
5377 (defun gnus-summary-next-page (&optional lines circular)
5378 "Show next page of the selected article.
5379 If at the end of the current article, select the next article.
5380 LINES says how many lines should be scrolled up.
5382 If CIRCULAR is non-nil, go to the start of the article instead of
5383 selecting the next article when reaching the end of the current
5386 (setq gnus-summary-buffer (current-buffer))
5387 (gnus-set-global-variables)
5388 (let ((article (gnus-summary-article-number))
5389 (article-window (get-buffer-window gnus-article-buffer t))
5391 (gnus-configure-windows 'article)
5392 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5393 (if (and (eq gnus-summary-goto-unread 'never)
5394 (not (gnus-summary-last-article-p article)))
5395 (gnus-summary-next-article)
5396 (gnus-summary-next-unread-article))
5397 (if (or (null gnus-current-article)
5398 (null gnus-article-current)
5399 (/= article (cdr gnus-article-current))
5400 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5401 ;; Selected subject is different from current article's.
5402 (gnus-summary-display-article article)
5403 (when article-window
5404 (gnus-eval-in-buffer-window gnus-article-buffer
5405 (setq endp (gnus-article-next-page lines)))
5408 (gnus-summary-beginning-of-article))
5410 (gnus-message 3 "End of message"))
5412 (if (and (eq gnus-summary-goto-unread 'never)
5413 (not (gnus-summary-last-article-p article)))
5414 (gnus-summary-next-article)
5415 (gnus-summary-next-unread-article))))))))
5416 (gnus-summary-recenter)
5417 (gnus-summary-position-point)))
5419 (defun gnus-summary-prev-page (&optional lines)
5420 "Show previous page of selected article.
5421 Argument LINES specifies lines to be scrolled down."
5423 (gnus-set-global-variables)
5424 (let ((article (gnus-summary-article-number))
5425 (article-window (get-buffer-window gnus-article-buffer t)))
5426 (gnus-configure-windows 'article)
5427 (if (or (null gnus-current-article)
5428 (null gnus-article-current)
5429 (/= article (cdr gnus-article-current))
5430 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5431 ;; Selected subject is different from current article's.
5432 (gnus-summary-display-article article)
5433 (gnus-summary-recenter)
5434 (when article-window
5435 (gnus-eval-in-buffer-window gnus-article-buffer
5436 (gnus-article-prev-page lines)))))
5437 (gnus-summary-position-point))
5439 (defun gnus-summary-scroll-up (lines)
5440 "Scroll up (or down) one line current article.
5441 Argument LINES specifies lines to be scrolled up (or down if negative)."
5443 (gnus-set-global-variables)
5444 (gnus-configure-windows 'article)
5445 (gnus-summary-show-thread)
5446 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5447 (gnus-eval-in-buffer-window gnus-article-buffer
5449 (when (gnus-article-next-page lines)
5450 (gnus-message 3 "End of message")))
5452 (gnus-article-prev-page (- lines))))))
5453 (gnus-summary-recenter)
5454 (gnus-summary-position-point))
5456 (defun gnus-summary-next-same-subject ()
5457 "Select next article which has the same subject as current one."
5459 (gnus-set-global-variables)
5460 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5462 (defun gnus-summary-prev-same-subject ()
5463 "Select previous article which has the same subject as current one."
5465 (gnus-set-global-variables)
5466 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5468 (defun gnus-summary-next-unread-same-subject ()
5469 "Select next unread article which has the same subject as current one."
5471 (gnus-set-global-variables)
5472 (gnus-summary-next-article t (gnus-summary-article-subject)))
5474 (defun gnus-summary-prev-unread-same-subject ()
5475 "Select previous unread article which has the same subject as current one."
5477 (gnus-set-global-variables)
5478 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5480 (defun gnus-summary-first-unread-article ()
5481 "Select the first unread article.
5482 Return nil if there are no unread articles."
5484 (gnus-set-global-variables)
5486 (when (gnus-summary-first-subject t)
5487 (gnus-summary-show-thread)
5488 (gnus-summary-first-subject t)
5489 (gnus-summary-display-article (gnus-summary-article-number)))
5490 (gnus-summary-position-point)))
5492 (defun gnus-summary-first-article ()
5493 "Select the first article.
5494 Return nil if there are no articles."
5496 (gnus-set-global-variables)
5498 (when (gnus-summary-first-subject)
5499 (gnus-summary-show-thread)
5500 (gnus-summary-first-subject)
5501 (gnus-summary-display-article (gnus-summary-article-number)))
5502 (gnus-summary-position-point)))
5504 (defun gnus-summary-best-unread-article ()
5505 "Select the unread article with the highest score."
5507 (gnus-set-global-variables)
5508 (let ((best -1000000)
5509 (data gnus-newsgroup-data)
5512 (and (gnus-data-unread-p (car data))
5514 (gnus-summary-article-score (gnus-data-number (car data))))
5517 article (gnus-data-number (car data))))
5518 (setq data (cdr data)))
5521 (gnus-summary-goto-article article)
5522 (error "No unread articles"))
5523 (gnus-summary-position-point))))
5525 (defun gnus-summary-last-subject ()
5526 "Go to the last displayed subject line in the group."
5527 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5529 (gnus-summary-goto-subject article))))
5531 (defun gnus-summary-goto-article (article &optional all-headers force)
5532 "Fetch ARTICLE and display it if it exists.
5533 If ALL-HEADERS is non-nil, no header lines are hidden."
5539 (mapcar (lambda (number) (list (int-to-string number)))
5540 gnus-newsgroup-limit)))
5544 (if (gnus-summary-goto-subject article force)
5545 (gnus-summary-display-article article all-headers)
5546 (gnus-message 4 "Couldn't go to article %s" article) nil)
5547 (gnus-summary-position-point)))
5549 (defun gnus-summary-goto-last-article ()
5550 "Go to the previously read article."
5553 (when gnus-last-article
5554 (gnus-summary-goto-article gnus-last-article))
5555 (gnus-summary-position-point)))
5557 (defun gnus-summary-pop-article (number)
5558 "Pop one article off the history and go to the previous.
5559 NUMBER articles will be popped off."
5562 (setq gnus-newsgroup-history
5563 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5565 (gnus-summary-goto-article (car to))
5566 (error "Article history empty")))
5567 (gnus-summary-position-point))
5569 ;; Summary commands and functions for limiting the summary buffer.
5571 (defun gnus-summary-limit-to-articles (n)
5572 "Limit the summary buffer to the next N articles.
5573 If not given a prefix, use the process marked articles instead."
5575 (gnus-set-global-variables)
5577 (let ((articles (gnus-summary-work-articles n)))
5578 (setq gnus-newsgroup-processable nil)
5579 (gnus-summary-limit articles))
5580 (gnus-summary-position-point)))
5582 (defun gnus-summary-pop-limit (&optional total)
5583 "Restore the previous limit.
5584 If given a prefix, remove all limits."
5586 (gnus-set-global-variables)
5588 (setq gnus-newsgroup-limits
5589 (list (mapcar (lambda (h) (mail-header-number h))
5590 gnus-newsgroup-headers))))
5591 (unless gnus-newsgroup-limits
5592 (error "No limit to pop"))
5594 (gnus-summary-limit nil 'pop)
5595 (gnus-summary-position-point)))
5597 (defun gnus-summary-limit-to-subject (subject &optional header)
5598 "Limit the summary buffer to articles that have subjects that match a regexp."
5599 (interactive "sLimit to subject (regexp): ")
5601 (setq header "subject"))
5602 (when (not (equal "" subject))
5604 (let ((articles (gnus-summary-find-matching
5605 (or header "subject") subject 'all)))
5607 (error "Found no matches for \"%s\"" subject))
5608 (gnus-summary-limit articles))
5609 (gnus-summary-position-point))))
5611 (defun gnus-summary-limit-to-author (from)
5612 "Limit the summary buffer to articles that have authors that match a regexp."
5613 (interactive "sLimit to author (regexp): ")
5614 (gnus-summary-limit-to-subject from "from"))
5616 (defun gnus-summary-limit-to-age (age &optional younger-p)
5617 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5618 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5619 articles that are younger than AGE days."
5620 (interactive "nTime in days: \nP")
5622 (let ((data gnus-newsgroup-data)
5623 (cutoff (nnmail-days-to-time age))
5624 articles d date is-younger)
5625 (while (setq d (pop data))
5626 (when (and (vectorp (gnus-data-header d))
5627 (setq date (mail-header-date (gnus-data-header d))))
5628 (setq is-younger (nnmail-time-less
5629 (nnmail-time-since (nnmail-date-to-time date))
5631 (when (if younger-p is-younger (not is-younger))
5632 (push (gnus-data-number d) articles))))
5633 (gnus-summary-limit (nreverse articles)))
5634 (gnus-summary-position-point)))
5636 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5638 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5640 (defun gnus-summary-limit-to-unread (&optional all)
5641 "Limit the summary buffer to articles that are not marked as read.
5642 If ALL is non-nil, limit strictly to unread articles."
5645 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5646 (gnus-summary-limit-to-marks
5647 ;; Concat all the marks that say that an article is read and have
5649 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5650 gnus-killed-mark gnus-kill-file-mark
5651 gnus-low-score-mark gnus-expirable-mark
5652 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5653 gnus-duplicate-mark)
5656 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5657 (make-obsolete 'gnus-summary-delete-marked-with
5658 'gnus-summary-limit-exlude-marks)
5660 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5661 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5662 If REVERSE, limit the summary buffer to articles that are marked
5663 with MARKS. MARKS can either be a string of marks or a list of marks.
5664 Returns how many articles were removed."
5665 (interactive "sMarks: ")
5666 (gnus-summary-limit-to-marks marks t))
5668 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5669 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5670 If REVERSE (the prefix), limit the summary buffer to articles that are
5671 not marked with MARKS. MARKS can either be a string of marks or a
5673 Returns how many articles were removed."
5674 (interactive (list (read-string "Marks: ") current-prefix-arg))
5675 (gnus-set-global-variables)
5677 (let ((data gnus-newsgroup-data)
5678 (marks (if (listp marks) marks
5679 (append marks nil))) ; Transform to list.
5682 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5683 (memq (gnus-data-mark (car data)) marks))
5684 (push (gnus-data-number (car data)) articles))
5685 (setq data (cdr data)))
5686 (gnus-summary-limit articles))
5687 (gnus-summary-position-point)))
5689 (defun gnus-summary-limit-to-score (&optional score)
5690 "Limit to articles with score at or above SCORE."
5692 (gnus-set-global-variables)
5693 (setq score (if score
5694 (prefix-numeric-value score)
5695 (or gnus-summary-default-score 0)))
5696 (let ((data gnus-newsgroup-data)
5699 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5701 (push (gnus-data-number (car data)) articles))
5702 (setq data (cdr data)))
5704 (gnus-summary-limit articles)
5705 (gnus-summary-position-point))))
5707 (defun gnus-summary-limit-include-dormant ()
5708 "Display all the hidden articles that are marked as dormant."
5710 (gnus-set-global-variables)
5711 (unless gnus-newsgroup-dormant
5712 (error "There are no dormant articles in this group"))
5714 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5715 (gnus-summary-position-point)))
5717 (defun gnus-summary-limit-exclude-dormant ()
5718 "Hide all dormant articles."
5720 (gnus-set-global-variables)
5722 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5723 (gnus-summary-position-point)))
5725 (defun gnus-summary-limit-exclude-childless-dormant ()
5726 "Hide all dormant articles that have no children."
5728 (gnus-set-global-variables)
5729 (let ((data (gnus-data-list t))
5730 articles d children)
5731 ;; Find all articles that are either not dormant or have
5733 (while (setq d (pop data))
5734 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5736 (gnus-article-children (gnus-data-number d)))
5739 (when (memq (car children) articles)
5744 (push (gnus-data-number d) articles)))
5747 (gnus-summary-limit articles)
5748 (gnus-summary-position-point))))
5750 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5751 "Mark all unread excluded articles as read.
5752 If ALL, mark even excluded ticked and dormants as read."
5754 (let ((articles (gnus-sorted-complement
5756 (mapcar (lambda (h) (mail-header-number h))
5757 gnus-newsgroup-headers)
5759 (sort gnus-newsgroup-limit '<)))
5761 (setq gnus-newsgroup-unreads nil)
5763 (setq gnus-newsgroup-dormant nil
5764 gnus-newsgroup-marked nil
5765 gnus-newsgroup-reads
5767 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5768 gnus-newsgroup-reads))
5769 (while (setq article (pop articles))
5770 (unless (or (memq article gnus-newsgroup-dormant)
5771 (memq article gnus-newsgroup-marked))
5772 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5774 (defun gnus-summary-limit (articles &optional pop)
5776 ;; We pop the previous limit off the stack and use that.
5777 (setq articles (car gnus-newsgroup-limits)
5778 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5779 ;; We use the new limit, so we push the old limit on the stack.
5780 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5782 (setq gnus-newsgroup-limit articles)
5783 (let ((total (length gnus-newsgroup-data))
5784 (data (gnus-data-find-list (gnus-summary-article-number)))
5785 (gnus-summary-mark-below nil) ; Inhibit this.
5787 ;; This will do all the work of generating the new summary buffer
5788 ;; according to the new limit.
5789 (gnus-summary-prepare)
5790 ;; Hide any threads, possibly.
5791 (and gnus-show-threads
5792 gnus-thread-hide-subtree
5793 (gnus-summary-hide-all-threads))
5794 ;; Try to return to the article you were at, or one in the
5797 ;; We try to find some article after the current one.
5799 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5802 (setq data (cdr data))))
5804 ;; If there is no data, that means that we were after the last
5805 ;; article. The same goes when we can't find any articles
5806 ;; after the current one.
5807 (goto-char (point-max))
5808 (gnus-summary-find-prev))
5809 ;; We return how many articles were removed from the summary
5810 ;; buffer as a result of the new limit.
5811 (- total (length gnus-newsgroup-data))))
5813 (defsubst gnus-invisible-cut-children (threads)
5816 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5821 (defsubst gnus-cut-thread (thread)
5822 "Go forwards in the thread until we find an article that we want to display."
5823 (when (or (eq gnus-fetch-old-headers 'some)
5824 (eq gnus-build-sparse-threads 'some)
5825 (eq gnus-build-sparse-threads 'more))
5826 ;; Deal with old-fetched headers and sparse threads.
5830 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
5831 (gnus-summary-article-ancient-p
5832 (mail-header-number (car thread))))
5834 (if (<= (length (cdr thread)) 1)
5835 (setq thread (cadr thread))
5836 (when (gnus-invisible-cut-children (cdr thread))
5837 (let ((th (cdr thread)))
5839 (if (memq (mail-header-number (caar th))
5840 gnus-newsgroup-limit)
5841 (setq thread (car th)
5843 (setq th (cdr th)))))))))
5847 (defun gnus-cut-threads (threads)
5848 "Cut off all uninteresting articles from the beginning of threads."
5849 (when (or (eq gnus-fetch-old-headers 'some)
5850 (eq gnus-build-sparse-threads 'some)
5851 (eq gnus-build-sparse-threads 'more))
5854 (setcar th (gnus-cut-thread (car th)))
5855 (setq th (cdr th)))))
5856 ;; Remove nixed out threads.
5859 (defun gnus-summary-initial-limit (&optional show-if-empty)
5860 "Figure out what the initial limit is supposed to be on group entry.
5861 This entails weeding out unwanted dormants, low-scored articles,
5862 fetch-old-headers verbiage, and so on."
5863 ;; Most groups have nothing to remove.
5864 (if (or gnus-inhibit-limiting
5865 (and (null gnus-newsgroup-dormant)
5866 (not (eq gnus-fetch-old-headers 'some))
5867 (null gnus-summary-expunge-below)
5868 (not (eq gnus-build-sparse-threads 'some))
5869 (not (eq gnus-build-sparse-threads 'more))
5870 (null gnus-thread-expunge-below)
5871 (not gnus-use-nocem)))
5873 (push gnus-newsgroup-limit gnus-newsgroup-limits)
5874 (setq gnus-newsgroup-limit nil)
5877 (unless (car (symbol-value node))
5878 ;; These threads have no parents -- they are roots.
5879 (let ((nodes (cdr (symbol-value node)))
5882 (if (and gnus-thread-expunge-below
5883 (< (gnus-thread-total-score (car nodes))
5884 gnus-thread-expunge-below))
5885 (gnus-expunge-thread (pop nodes))
5886 (setq thread (pop nodes))
5887 (gnus-summary-limit-children thread))))))
5888 gnus-newsgroup-dependencies)
5889 ;; If this limitation resulted in an empty group, we might
5890 ;; pop the previous limit and use it instead.
5891 (when (and (not gnus-newsgroup-limit)
5893 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
5894 gnus-newsgroup-limit))
5896 (defun gnus-summary-limit-children (thread)
5897 "Return 1 if this subthread is visible and 0 if it is not."
5898 ;; First we get the number of visible children to this thread. This
5899 ;; is done by recursing down the thread using this function, so this
5900 ;; will really go down to a leaf article first, before slowly
5901 ;; working its way up towards the root.
5905 (apply '+ (mapcar 'gnus-summary-limit-children
5908 (number (mail-header-number (car thread)))
5911 (not (memq number gnus-newsgroup-marked))
5913 ;; If this article is dormant and has absolutely no visible
5914 ;; children, then this article isn't visible.
5915 (and (memq number gnus-newsgroup-dormant)
5917 ;; If this is "fetch-old-headered" and there is no
5918 ;; visible children, then we don't want this article.
5919 (and (eq gnus-fetch-old-headers 'some)
5920 (gnus-summary-article-ancient-p number)
5922 ;; If this is a sparsely inserted article with no children,
5923 ;; we don't want it.
5924 (and (eq gnus-build-sparse-threads 'some)
5925 (gnus-summary-article-sparse-p number)
5927 ;; If we use expunging, and this article is really
5928 ;; low-scored, then we don't want this article.
5929 (when (and gnus-summary-expunge-below
5931 (or (cdr (assq number gnus-newsgroup-scored))
5932 gnus-summary-default-score))
5933 gnus-summary-expunge-below))
5934 ;; We increase the expunge-tally here, but that has
5935 ;; nothing to do with the limits, really.
5936 (incf gnus-newsgroup-expunged-tally)
5937 ;; We also mark as read here, if that's wanted.
5938 (when (and gnus-summary-mark-below
5939 (< score gnus-summary-mark-below))
5940 (setq gnus-newsgroup-unreads
5941 (delq number gnus-newsgroup-unreads))
5942 (if gnus-newsgroup-auto-expire
5943 (push number gnus-newsgroup-expirable)
5944 (push (cons number gnus-low-score-mark)
5945 gnus-newsgroup-reads)))
5947 ;; Check NoCeM things.
5948 (if (and gnus-use-nocem
5949 (gnus-nocem-unwanted-article-p
5950 (mail-header-id (car thread))))
5952 (setq gnus-newsgroup-reads
5953 (delq number gnus-newsgroup-unreads))
5955 ;; Nope, invisible article.
5957 ;; Ok, this article is to be visible, so we add it to the limit
5959 (push number gnus-newsgroup-limit)
5962 (defun gnus-expunge-thread (thread)
5963 "Mark all articles in THREAD as read."
5964 (let* ((number (mail-header-number (car thread))))
5965 (incf gnus-newsgroup-expunged-tally)
5966 ;; We also mark as read here, if that's wanted.
5967 (setq gnus-newsgroup-unreads
5968 (delq number gnus-newsgroup-unreads))
5969 (if gnus-newsgroup-auto-expire
5970 (push number gnus-newsgroup-expirable)
5971 (push (cons number gnus-low-score-mark)
5972 gnus-newsgroup-reads)))
5973 ;; Go recursively through all subthreads.
5974 (mapcar 'gnus-expunge-thread (cdr thread)))
5976 ;; Summary article oriented commands
5978 (defun gnus-summary-refer-parent-article (n)
5979 "Refer parent article N times.
5980 If N is negative, go to ancestor -N instead.
5981 The difference between N and the number of articles fetched is returned."
5983 (gnus-set-global-variables)
5986 (when (not (natnump n))
5991 (setq header (gnus-summary-article-header))
5992 (if (and (eq (mail-header-number header)
5993 (cdr gnus-article-current))
5994 (equal gnus-newsgroup-name
5995 (car gnus-article-current)))
5996 ;; If we try to find the parent of the currently
5997 ;; displayed article, then we take a look at the actual
5998 ;; References header, since this is slightly more
5999 ;; reliable than the References field we got from the
6002 (set-buffer gnus-original-article-buffer)
6003 (nnheader-narrow-to-headers)
6004 (unless (setq ref (message-fetch-field "references"))
6005 (setq ref (message-fetch-field "in-reply-to")))
6008 ;; It's not the current article, so we take a bet on
6009 ;; the value we got from the server.
6010 (mail-header-references header)))
6012 (not (equal ref "")))
6013 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6014 (gnus-message 1 "Couldn't find parent"))
6015 (gnus-message 1 "No references in article %d"
6016 (gnus-summary-article-number))
6019 (gnus-summary-position-point)
6022 (defun gnus-summary-refer-references ()
6023 "Fetch all articles mentioned in the References header.
6024 Return how many articles were fetched."
6026 (gnus-set-global-variables)
6027 (let ((ref (mail-header-references (gnus-summary-article-header)))
6028 (current (gnus-summary-article-number))
6032 (error "No References in the current article")
6033 ;; For each Message-ID in the References header...
6034 (while (string-match "<[^>]*>" ref)
6036 ;; ... fetch that article.
6037 (gnus-summary-refer-article
6038 (prog1 (match-string 0 ref)
6039 (setq ref (substring ref (match-end 0))))))
6040 (gnus-summary-goto-subject current)
6041 (gnus-summary-position-point)
6044 (defun gnus-summary-refer-article (message-id)
6045 "Fetch an article specified by MESSAGE-ID."
6046 (interactive "sMessage-ID: ")
6047 (when (and (stringp message-id)
6048 (not (zerop (length message-id))))
6049 ;; Construct the correct Message-ID if necessary.
6050 ;; Suggested by tale@pawl.rpi.edu.
6051 (unless (string-match "^<" message-id)
6052 (setq message-id (concat "<" message-id)))
6053 (unless (string-match ">$" message-id)
6054 (setq message-id (concat message-id ">")))
6055 (let* ((header (gnus-id-to-header message-id))
6057 (gnus-summary-article-sparse-p
6058 (mail-header-number header)))))
6061 ;; The article is present in the buffer, to we just go to it.
6062 (gnus-summary-goto-article
6063 (mail-header-number header) nil header)
6065 (gnus-summary-update-article (mail-header-number header))))
6066 ;; We fetch the article
6067 (let ((gnus-override-method
6068 (and (gnus-news-group-p gnus-newsgroup-name)
6069 gnus-refer-article-method))
6071 ;; Start the special refer-article method, if necessary.
6072 (when (and gnus-refer-article-method
6073 (gnus-news-group-p gnus-newsgroup-name))
6074 (gnus-check-server gnus-refer-article-method))
6075 ;; Fetch the header, and display the article.
6076 (if (setq number (gnus-summary-insert-subject message-id))
6077 (gnus-summary-select-article nil nil nil number)
6078 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6080 (defun gnus-summary-enter-digest-group (&optional force)
6081 "Enter an nndoc group based on the current article.
6082 If FORCE, force a digest interpretation. If not, try
6083 to guess what the document format is."
6085 (gnus-set-global-variables)
6086 (let ((conf gnus-current-window-configuration))
6088 (gnus-summary-select-article))
6089 (setq gnus-current-window-configuration conf)
6090 (let* ((name (format "%s-%d"
6091 (gnus-group-prefixed-name
6092 gnus-newsgroup-name (list 'nndoc ""))
6094 (set-buffer gnus-summary-buffer)
6095 gnus-current-article)))
6096 (ogroup gnus-newsgroup-name)
6097 (params (append (gnus-info-params (gnus-get-info ogroup))
6098 (list (cons 'to-group ogroup))))
6099 (case-fold-search t)
6100 (buf (current-buffer))
6103 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6104 (insert-buffer-substring gnus-original-article-buffer)
6105 ;; Remove lines that may lead nndoc to misinterpret the
6108 (goto-char (point-min))
6109 (or (search-forward "\n\n" nil t) (point)))
6110 (goto-char (point-min))
6111 (delete-matching-lines "^\\(Path\\):\\|^From ")
6114 (if (gnus-group-read-ephemeral-group
6115 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6117 ,(if force 'digest 'guess))) t)
6118 ;; Make all postings to this group go to the parent group.
6119 (nconc (gnus-info-params (gnus-get-info name))
6121 ;; Couldn't select this doc group.
6122 (switch-to-buffer buf)
6123 (gnus-set-global-variables)
6124 (gnus-configure-windows 'summary)
6125 (gnus-message 3 "Article couldn't be entered?"))
6126 (kill-buffer dig)))))
6128 (defun gnus-summary-read-document (n)
6129 "Open a new group based on the current article(s).
6130 This will allow you to read digests and other similar
6131 documents as newsgroups.
6132 Obeys the standard process/prefix convention."
6134 (let* ((articles (gnus-summary-work-articles n))
6135 (ogroup gnus-newsgroup-name)
6136 (params (append (gnus-info-params (gnus-get-info ogroup))
6137 (list (cons 'to-group ogroup))))
6138 article group egroup groups vgroup)
6139 (while (setq article (pop articles))
6140 (setq group (format "%s-%d" gnus-newsgroup-name article))
6141 (gnus-summary-remove-process-mark article)
6142 (when (gnus-summary-display-article article)
6144 (nnheader-temp-write nil
6145 (insert-buffer-substring gnus-original-article-buffer)
6146 ;; Remove some headers that may lead nndoc to make
6148 (message-narrow-to-head)
6149 (goto-char (point-min))
6150 (delete-matching-lines "^\\(Path\\):\\|^From ")
6153 (gnus-group-read-ephemeral-group
6154 group `(nndoc ,group (nndoc-address ,(current-buffer))
6155 (nndoc-article-type guess))
6158 ;; Make all postings to this group go to the parent group.
6159 (nconc (gnus-info-params (gnus-get-info egroup))
6161 (push egroup groups))
6162 ;; Couldn't select this doc group.
6163 (gnus-error 3 "Article couldn't be entered"))))))
6164 ;; Now we have selected all the documents.
6167 (error "None of the articles could be interpreted as documents"))
6168 ((gnus-group-read-ephemeral-group
6169 (setq vgroup (format
6170 "nnvirtual:%s-%s" gnus-newsgroup-name
6171 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6172 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6174 (cons (current-buffer) 'summary)))
6176 (error "Couldn't select virtual nndoc group")))))
6178 (defun gnus-summary-isearch-article (&optional regexp-p)
6179 "Do incremental search forward on the current article.
6180 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6182 (gnus-set-global-variables)
6183 (gnus-summary-select-article)
6184 (gnus-configure-windows 'article)
6185 (gnus-eval-in-buffer-window gnus-article-buffer
6186 ;;(goto-char (point-min))
6187 (isearch-forward regexp-p)))
6189 (defun gnus-summary-search-article-forward (regexp &optional backward)
6190 "Search for an article containing REGEXP forward.
6191 If BACKWARD, search backward instead."
6194 (format "Search article %s (regexp%s): "
6195 (if current-prefix-arg "backward" "forward")
6196 (if gnus-last-search-regexp
6197 (concat ", default " gnus-last-search-regexp)
6199 current-prefix-arg))
6200 (gnus-set-global-variables)
6201 (if (string-equal regexp "")
6202 (setq regexp (or gnus-last-search-regexp ""))
6203 (setq gnus-last-search-regexp regexp))
6204 (if (gnus-summary-search-article regexp backward)
6205 (gnus-summary-show-thread)
6206 (error "Search failed: \"%s\"" regexp)))
6208 (defun gnus-summary-search-article-backward (regexp)
6209 "Search for an article containing REGEXP backward."
6212 (format "Search article backward (regexp%s): "
6213 (if gnus-last-search-regexp
6214 (concat ", default " gnus-last-search-regexp)
6216 (gnus-summary-search-article-forward regexp 'backward))
6218 (defun gnus-summary-search-article (regexp &optional backward)
6219 "Search for an article containing REGEXP.
6220 Optional argument BACKWARD means do search for backward.
6221 `gnus-select-article-hook' is not called during the search."
6222 (let ((gnus-select-article-hook nil) ;Disable hook.
6223 (gnus-article-display-hook nil)
6224 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6225 (gnus-use-article-prefetch nil)
6226 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6227 (sum (current-buffer))
6230 (gnus-save-hidden-threads
6231 (gnus-summary-select-article)
6232 (set-buffer gnus-article-buffer)
6236 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6238 (re-search-backward regexp nil t)
6239 (re-search-forward regexp nil t))
6240 ;; We found the regexp.
6245 (get-buffer-window (current-buffer))
6249 (setq point (point)))
6250 ;; We didn't find it, so we go to the next article.
6253 (while (eq found 'not)
6254 (if (not (if backward (gnus-summary-find-prev)
6255 (gnus-summary-find-next)))
6256 ;; No more articles.
6258 ;; Select the next article and adjust point.
6259 (unless (gnus-summary-article-sparse-p
6260 (gnus-summary-article-number))
6262 (gnus-summary-select-article)
6263 (set-buffer gnus-article-buffer)
6265 (goto-char (if backward (point-max) (point-min))))))))
6266 (gnus-message 7 ""))
6267 ;; Return whether we found the regexp.
6268 (when (eq found 'found)
6270 (gnus-summary-show-thread)
6271 (gnus-summary-goto-subject gnus-current-article)
6272 (gnus-summary-position-point)
6275 (defun gnus-summary-find-matching (header regexp &optional backward unread
6277 "Return a list of all articles that match REGEXP on HEADER.
6278 The search stars on the current article and goes forwards unless
6279 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6280 If UNREAD is non-nil, only unread articles will
6281 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6282 in the comparisons."
6283 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6284 (gnus-data-find-list
6285 (gnus-summary-article-number) (gnus-data-list backward))))
6286 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6287 (case-fold-search (not not-case-fold))
6289 (unless (fboundp (intern (concat "mail-header-" header)))
6290 (error "%s is not a valid header" header))
6293 (and (or (not unread) ; We want all articles...
6294 (gnus-data-unread-p d)) ; Or just unreads.
6295 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6296 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6297 (push (gnus-data-number d) articles)) ; Success!
6298 (setq data (cdr data)))
6299 (nreverse articles)))
6301 (defun gnus-summary-execute-command (header regexp command &optional backward)
6302 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6303 If HEADER is an empty string (or nil), the match is done on the entire
6304 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6306 (list (let ((completion-ignore-case t))
6309 (mapcar (lambda (string) (list string))
6310 '("Number" "Subject" "From" "Lines" "Date"
6311 "Message-ID" "Xref" "References" "Body"))
6312 nil 'require-match))
6313 (read-string "Regexp: ")
6314 (read-key-sequence "Command: ")
6315 current-prefix-arg))
6316 (when (equal header "Body")
6318 (gnus-set-global-variables)
6319 ;; Hidden thread subtrees must be searched as well.
6320 (gnus-summary-show-all-threads)
6321 ;; We don't want to change current point nor window configuration.
6323 (save-window-excursion
6324 (gnus-message 6 "Executing %s..." (key-description command))
6325 ;; We'd like to execute COMMAND interactively so as to give arguments.
6326 (gnus-execute header regexp
6327 `(call-interactively ',(key-binding command))
6329 (gnus-message 6 "Executing %s...done" (key-description command)))))
6331 (defun gnus-summary-beginning-of-article ()
6332 "Scroll the article back to the beginning."
6334 (gnus-set-global-variables)
6335 (gnus-summary-select-article)
6336 (gnus-configure-windows 'article)
6337 (gnus-eval-in-buffer-window gnus-article-buffer
6339 (goto-char (point-min))
6340 (when gnus-break-pages
6341 (gnus-narrow-to-page))))
6343 (defun gnus-summary-end-of-article ()
6344 "Scroll to the end of the article."
6346 (gnus-set-global-variables)
6347 (gnus-summary-select-article)
6348 (gnus-configure-windows 'article)
6349 (gnus-eval-in-buffer-window gnus-article-buffer
6351 (goto-char (point-max))
6353 (when gnus-break-pages
6354 (gnus-narrow-to-page))))
6356 (defun gnus-summary-print-article (&optional filename)
6357 "Generate and print a PostScript image of the article buffer.
6359 If the optional argument FILENAME is nil, send the image to the printer.
6360 If FILENAME is a string, save the PostScript image in a file with that
6361 name. If FILENAME is a number, prompt the user for the name of the file
6363 (interactive (list (ps-print-preprint current-prefix-arg)))
6364 (gnus-summary-select-article)
6365 (gnus-eval-in-buffer-window gnus-article-buffer
6366 (let ((buffer (generate-new-buffer " *print*")))
6369 (copy-to-buffer buffer (point-min) (point-max))
6371 (gnus-article-delete-invisible-text)
6372 (run-hooks 'gnus-ps-print-hook)
6373 (ps-print-buffer-with-faces filename))
6374 (kill-buffer buffer)))))
6376 (defun gnus-summary-show-article (&optional arg)
6377 "Force re-fetching of the current article.
6378 If ARG (the prefix) is non-nil, show the raw article without any
6379 article massaging functions being run."
6381 (gnus-set-global-variables)
6383 ;; Select the article the normal way.
6384 (gnus-summary-select-article nil 'force)
6385 ;; Bind the article treatment functions to nil.
6386 (let ((gnus-have-all-headers t)
6387 gnus-article-display-hook
6388 gnus-article-prepare-hook
6391 (gnus-summary-select-article nil 'force)))
6392 (gnus-summary-goto-subject gnus-current-article)
6393 ; (gnus-configure-windows 'article)
6394 (gnus-summary-position-point))
6396 (defun gnus-summary-verbose-headers (&optional arg)
6397 "Toggle permanent full header display.
6398 If ARG is a positive number, turn header display on.
6399 If ARG is a negative number, turn header display off."
6401 (gnus-set-global-variables)
6402 (setq gnus-show-all-headers
6403 (cond ((or (not (numberp arg))
6405 (not gnus-show-all-headers))
6408 (gnus-summary-show-article))
6410 (defun gnus-summary-toggle-header (&optional arg)
6411 "Show the headers if they are hidden, or hide them if they are shown.
6412 If ARG is a positive number, show the entire header.
6413 If ARG is a negative number, hide the unwanted header lines."
6415 (gnus-set-global-variables)
6417 (set-buffer gnus-article-buffer)
6418 (let* ((buffer-read-only nil)
6419 (inhibit-point-motion-hooks t)
6420 (hidden (text-property-any
6421 (goto-char (point-min)) (search-forward "\n\n")
6424 (goto-char (point-min))
6425 (when (search-forward "\n\n" nil t)
6426 (delete-region (point-min) (1- (point))))
6427 (goto-char (point-min))
6429 (set-buffer gnus-original-article-buffer)
6430 (goto-char (point-min))
6431 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6432 (insert-buffer-substring gnus-original-article-buffer 1 e)
6433 (let ((article-inhibit-hiding t))
6434 (run-hooks 'gnus-article-display-hook))
6435 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6436 (gnus-article-hide-headers)))))
6438 (defun gnus-summary-show-all-headers ()
6439 "Make all header lines visible."
6441 (gnus-set-global-variables)
6442 (gnus-article-show-all-headers))
6444 (defun gnus-summary-toggle-mime (&optional arg)
6445 "Toggle MIME processing.
6446 If ARG is a positive number, turn MIME processing on."
6448 (gnus-set-global-variables)
6449 (setq gnus-show-mime
6450 (if (null arg) (not gnus-show-mime)
6451 (> (prefix-numeric-value arg) 0)))
6452 (gnus-summary-select-article t 'force))
6454 (defun gnus-summary-caesar-message (&optional arg)
6455 "Caesar rotate the current article by 13.
6456 The numerical prefix specifies how many places to rotate each letter
6459 (gnus-set-global-variables)
6460 (gnus-summary-select-article)
6461 (let ((mail-header-separator ""))
6462 (gnus-eval-in-buffer-window gnus-article-buffer
6465 (let ((start (window-start))
6467 (message-caesar-buffer-body arg)
6468 (set-window-start (get-buffer-window (current-buffer)) start))))))
6470 (defun gnus-summary-stop-page-breaking ()
6471 "Stop page breaking in the current article."
6473 (gnus-set-global-variables)
6474 (gnus-summary-select-article)
6475 (gnus-eval-in-buffer-window gnus-article-buffer
6477 (when (gnus-visual-p 'page-marker)
6478 (let ((buffer-read-only nil))
6479 (gnus-remove-text-with-property 'gnus-prev)
6480 (gnus-remove-text-with-property 'gnus-next)))))
6482 (defun gnus-summary-move-article (&optional n to-newsgroup
6483 select-method action)
6484 "Move the current article to a different newsgroup.
6485 If N is a positive number, move the N next articles.
6486 If N is a negative number, move the N previous articles.
6487 If N is nil and any articles have been marked with the process mark,
6488 move those articles instead.
6489 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6490 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6491 re-spool using this method.
6493 For this function to work, both the current newsgroup and the
6494 newsgroup that you want to move to have to support the `request-move'
6495 and `request-accept' functions."
6498 (setq action 'move))
6499 (gnus-set-global-variables)
6500 ;; Disable marking as read.
6501 (let (gnus-mark-article-hook)
6502 (save-window-excursion
6503 (gnus-summary-select-article)))
6504 ;; Check whether the source group supports the required functions.
6505 (cond ((and (eq action 'move)
6506 (not (gnus-check-backend-function
6507 'request-move-article gnus-newsgroup-name)))
6508 (error "The current group does not support article moving"))
6509 ((and (eq action 'crosspost)
6510 (not (gnus-check-backend-function
6511 'request-replace-article gnus-newsgroup-name)))
6512 (error "The current group does not support article editing")))
6513 (let ((articles (gnus-summary-work-articles n))
6514 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6515 (names '((move "Move" "Moving")
6516 (copy "Copy" "Copying")
6517 (crosspost "Crosspost" "Crossposting")))
6518 (copy-buf (save-excursion
6519 (nnheader-set-temp-buffer " *copy article*")))
6520 art-group to-method new-xref article to-groups)
6521 (unless (assq action names)
6522 (error "Unknown action %s" action))
6523 ;; Read the newsgroup name.
6524 (when (and (not to-newsgroup)
6525 (not select-method))
6527 (gnus-read-move-group-name
6528 (cadr (assq action names))
6529 (symbol-value (intern (format "gnus-current-%s-group" action)))
6531 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6532 (setq to-method (or select-method
6533 (gnus-group-name-to-method to-newsgroup)))
6534 ;; Check the method we are to move this article to...
6535 (unless (gnus-check-backend-function
6536 'request-accept-article (car to-method))
6537 (error "%s does not support article copying" (car to-method)))
6538 (unless (gnus-check-server to-method)
6539 (error "Can't open server %s" (car to-method)))
6540 (gnus-message 6 "%s to %s: %s..."
6541 (caddr (assq action names))
6542 (or (car select-method) to-newsgroup) articles)
6544 (setq article (pop articles))
6548 ;; Move the article.
6550 (gnus-request-move-article
6551 article ; Article to move
6552 gnus-newsgroup-name ; From newsgroup
6553 (nth 1 (gnus-find-method-for-group
6554 gnus-newsgroup-name)) ; Server
6555 (list 'gnus-request-accept-article
6556 to-newsgroup (list 'quote select-method)
6557 (not articles)) ; Accept form
6558 (not articles))) ; Only save nov last time
6559 ;; Copy the article.
6562 (set-buffer copy-buf)
6563 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6564 (gnus-request-accept-article
6565 to-newsgroup select-method (not articles))))
6566 ;; Crosspost the article.
6567 ((eq action 'crosspost)
6568 (let ((xref (message-tokenize-header
6569 (mail-header-xref (gnus-summary-article-header article))
6571 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6574 (setq xref (list (system-name))))
6577 (mapconcat 'identity
6578 (delete "Xref:" (delete new-xref xref))
6582 (set-buffer copy-buf)
6583 ;; First put the article in the destination group.
6584 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6586 (gnus-request-accept-article
6587 to-newsgroup select-method (not articles)))
6588 (setq new-xref (concat new-xref " " (car art-group)
6589 ":" (cdr art-group)))
6590 ;; Now we have the new Xrefs header, so we insert
6591 ;; it and replace the new article.
6592 (nnheader-replace-header "Xref" new-xref)
6593 (gnus-request-replace-article
6594 (cdr art-group) to-newsgroup (current-buffer))
6597 (gnus-message 1 "Couldn't %s article %s"
6598 (cadr (assq action names)) article)
6601 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6603 (gnus-group-prefixed-name
6606 (gnus-find-method-for-group to-newsgroup)))
6607 gnus-newsrc-hashtb)))
6608 (info (nth 2 entry))
6609 (to-group (gnus-info-group info)))
6610 ;; Update the group that has been moved to.
6612 (memq action '(move copy)))
6613 (unless (member to-group to-groups)
6614 (push to-group to-groups))
6616 (unless (memq article gnus-newsgroup-unreads)
6618 info (gnus-add-to-range (gnus-info-read info)
6619 (list (cdr art-group)))))
6621 ;; Copy any marks over to the new group.
6622 (let ((marks gnus-article-mark-lists)
6623 (to-article (cdr art-group)))
6625 ;; See whether the article is to be put in the cache.
6626 (when gnus-use-cache
6627 (gnus-cache-possibly-enter-article
6629 (let ((header (copy-sequence
6630 (gnus-summary-article-header article))))
6631 (mail-header-set-number header to-article)
6633 (memq article gnus-newsgroup-marked)
6634 (memq article gnus-newsgroup-dormant)
6635 (memq article gnus-newsgroup-unreads)))
6637 (when (and (equal to-group gnus-newsgroup-name)
6638 (not (memq article gnus-newsgroup-unreads)))
6639 ;; Mark this article as read in this group.
6640 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6641 (setcdr (gnus-active to-group) to-article)
6642 (setcdr gnus-newsgroup-active to-article))
6645 (when (memq article (symbol-value
6646 (intern (format "gnus-newsgroup-%s"
6648 ;; If the other group is the same as this group,
6649 ;; then we have to add the mark to the list.
6650 (when (equal to-group gnus-newsgroup-name)
6651 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6654 (intern (format "gnus-newsgroup-%s"
6656 ;; Copy the marks to other group.
6657 (gnus-add-marked-articles
6658 to-group (cdar marks) (list to-article) info))
6659 (setq marks (cdr marks)))))
6661 ;; Update the Xref header in this article to point to
6662 ;; the new crossposted article we have just created.
6663 (when (eq action 'crosspost)
6665 (set-buffer copy-buf)
6666 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6667 (nnheader-replace-header "Xref" new-xref)
6668 (gnus-request-replace-article
6669 article gnus-newsgroup-name (current-buffer)))))
6671 (gnus-summary-goto-subject article)
6672 (when (eq action 'move)
6673 (gnus-summary-mark-article article gnus-canceled-mark)))
6674 (gnus-summary-remove-process-mark article))
6675 ;; Re-activate all groups that have been moved to.
6677 (gnus-activate-group (pop to-groups)))
6679 (gnus-kill-buffer copy-buf)
6680 (gnus-summary-position-point)
6681 (gnus-set-mode-line 'summary)))
6683 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6684 "Move the current article to a different newsgroup.
6685 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6686 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6687 re-spool using this method."
6689 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6691 (defun gnus-summary-crosspost-article (&optional n)
6692 "Crosspost the current article to some other group."
6694 (gnus-summary-move-article n nil nil 'crosspost))
6696 (defcustom gnus-summary-respool-default-method nil
6697 "Default method for respooling an article.
6698 If nil, use to the current newsgroup method."
6699 :type 'gnus-select-method-name
6700 :group 'gnus-summary-mail)
6702 (defun gnus-summary-respool-article (&optional n method)
6703 "Respool the current article.
6704 The article will be squeezed through the mail spooling process again,
6705 which means that it will be put in some mail newsgroup or other
6706 depending on `nnmail-split-methods'.
6707 If N is a positive number, respool the N next articles.
6708 If N is a negative number, respool the N previous articles.
6709 If N is nil and any articles have been marked with the process mark,
6710 respool those articles instead.
6712 Respooling can be done both from mail groups and \"real\" newsgroups.
6713 In the former case, the articles in question will be moved from the
6714 current group into whatever groups they are destined to. In the
6715 latter case, they will be copied into the relevant groups."
6717 (list current-prefix-arg
6718 (let* ((methods (gnus-methods-using 'respool))
6720 (symbol-name (or gnus-summary-respool-default-method
6721 (car (gnus-find-method-for-group
6722 gnus-newsgroup-name)))))
6724 (gnus-completing-read
6725 methname "What backend do you want to use when respooling?"
6726 methods nil t nil 'gnus-mail-method-history))
6729 ((zerop (length (setq ms (gnus-servers-using-backend
6731 (list (intern method) ""))
6735 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6736 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6738 (gnus-set-global-variables)
6740 (error "No method given for respooling"))
6741 (if (assoc (symbol-name
6742 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6743 (gnus-methods-using 'respool))
6744 (gnus-summary-move-article n nil method)
6745 (gnus-summary-copy-article n nil method)))
6747 (defun gnus-summary-import-article (file)
6748 "Import a random file into a mail newsgroup."
6749 (interactive "fImport file: ")
6750 (gnus-set-global-variables)
6751 (let ((group gnus-newsgroup-name)
6752 (now (current-time))
6754 (unless (gnus-check-backend-function 'request-accept-article group)
6755 (error "%s does not support article importing" group))
6756 (or (file-readable-p file)
6757 (not (file-regular-p file))
6758 (error "Can't read %s" file))
6760 (set-buffer (get-buffer-create " *import file*"))
6761 (buffer-disable-undo (current-buffer))
6763 (insert-file-contents file)
6764 (goto-char (point-min))
6765 (unless (nnheader-article-p)
6766 ;; This doesn't look like an article, so we fudge some headers.
6767 (setq atts (file-attributes file)
6768 lines (count-lines (point-min) (point-max)))
6769 (insert "From: " (read-string "From: ") "\n"
6770 "Subject: " (read-string "Subject: ") "\n"
6771 "Date: " (timezone-make-date-arpa-standard
6772 (current-time-string (nth 5 atts))
6773 (current-time-zone now)
6774 (current-time-zone now))
6776 "Message-ID: " (message-make-message-id) "\n"
6777 "Lines: " (int-to-string lines) "\n"
6778 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6779 (gnus-request-accept-article group nil t)
6780 (kill-buffer (current-buffer)))))
6782 (defun gnus-summary-article-posted-p ()
6783 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6784 This will be the case if the article has both been mailed and posted."
6786 (let ((id (mail-header-references (gnus-summary-article-header)))
6787 (gnus-override-method
6788 (or gnus-refer-article-method gnus-select-method)))
6789 (if (gnus-request-head id "")
6790 (gnus-message 2 "The current message was found on %s"
6791 gnus-override-method)
6792 (gnus-message 2 "The current message couldn't be found on %s"
6793 gnus-override-method)
6796 (defun gnus-summary-expire-articles (&optional now)
6797 "Expire all articles that are marked as expirable in the current group."
6799 (gnus-set-global-variables)
6800 (when (gnus-check-backend-function
6801 'request-expire-articles gnus-newsgroup-name)
6802 ;; This backend supports expiry.
6803 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6804 (expirable (if total
6806 ;; We need to update the info for
6807 ;; this group for `gnus-list-of-read-articles'
6808 ;; to give us the right answer.
6809 (run-hooks 'gnus-exit-group-hook)
6810 (gnus-summary-update-info)
6811 (gnus-list-of-read-articles gnus-newsgroup-name))
6812 (setq gnus-newsgroup-expirable
6813 (sort gnus-newsgroup-expirable '<))))
6814 (expiry-wait (if now 'immediate
6815 (gnus-group-find-parameter
6816 gnus-newsgroup-name 'expiry-wait)))
6819 ;; There are expirable articles in this group, so we run them
6820 ;; through the expiry process.
6821 (gnus-message 6 "Expiring articles...")
6822 ;; The list of articles that weren't expired is returned.
6824 (let ((nnmail-expiry-wait-function nil)
6825 (nnmail-expiry-wait expiry-wait))
6826 (setq es (gnus-request-expire-articles
6827 expirable gnus-newsgroup-name)))
6828 (setq es (gnus-request-expire-articles
6829 expirable gnus-newsgroup-name)))
6831 (setq gnus-newsgroup-expirable es))
6832 ;; We go through the old list of expirable, and mark all
6833 ;; really expired articles as nonexistent.
6834 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6835 (let ((gnus-use-cache nil))
6837 (unless (memq (car expirable) es)
6838 (when (gnus-data-find (car expirable))
6839 (gnus-summary-mark-article
6840 (car expirable) gnus-canceled-mark)))
6841 (setq expirable (cdr expirable)))))
6842 (gnus-message 6 "Expiring articles...done")))))
6844 (defun gnus-summary-expire-articles-now ()
6845 "Expunge all expirable articles in the current group.
6846 This means that *all* articles that are marked as expirable will be
6847 deleted forever, right now."
6849 (gnus-set-global-variables)
6850 (or gnus-expert-user
6852 "Are you really, really, really sure you want to delete all these messages? ")
6854 (gnus-summary-expire-articles t))
6856 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
6857 (defun gnus-summary-delete-article (&optional n)
6858 "Delete the N next (mail) articles.
6859 This command actually deletes articles. This is not a marking
6860 command. The article will disappear forever from your life, never to
6862 If N is negative, delete backwards.
6863 If N is nil and articles have been marked with the process mark,
6864 delete these instead."
6866 (gnus-set-global-variables)
6867 (unless (gnus-check-backend-function 'request-expire-articles
6868 gnus-newsgroup-name)
6869 (error "The current newsgroup does not support article deletion."))
6870 ;; Compute the list of articles to delete.
6871 (let ((articles (gnus-summary-work-articles n))
6873 (if (and gnus-novice-user
6874 (not (gnus-yes-or-no-p
6875 (format "Do you really want to delete %s forever? "
6876 (if (> (length articles) 1)
6877 (format "these %s articles" (length articles))
6880 ;; Delete the articles.
6881 (setq not-deleted (gnus-request-expire-articles
6882 articles gnus-newsgroup-name 'force))
6884 (gnus-summary-remove-process-mark (car articles))
6885 ;; The backend might not have been able to delete the article
6887 (unless (memq (car articles) not-deleted)
6888 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
6889 (setq articles (cdr articles)))
6891 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
6892 (gnus-summary-position-point)
6893 (gnus-set-mode-line 'summary)
6896 (defun gnus-summary-edit-article (&optional force)
6897 "Edit the current article.
6898 This will have permanent effect only in mail groups.
6899 If FORCE is non-nil, allow editing of articles even in read-only
6903 (set-buffer gnus-summary-buffer)
6904 (gnus-set-global-variables)
6905 (when (and (not force)
6906 (gnus-group-read-only-p))
6907 (error "The current newsgroup does not support article editing."))
6908 ;; Select article if needed.
6909 (unless (eq (gnus-summary-article-number)
6910 gnus-current-article)
6911 (gnus-summary-select-article t))
6912 (gnus-article-edit-article
6914 (gnus-summary-edit-article-done
6915 ,(or (mail-header-references gnus-current-headers) "")
6916 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
6918 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
6920 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
6921 "Make edits to the current article permanent."
6923 ;; Replace the article.
6924 (if (and (not read-only)
6925 (not (gnus-request-replace-article
6926 (cdr gnus-article-current) (car gnus-article-current)
6928 (error "Couldn't replace article.")
6929 ;; Update the summary buffer.
6931 (equal (message-tokenize-header references " ")
6932 (message-tokenize-header
6933 (or (message-fetch-field "references") "") " ")))
6934 ;; We only have to update this line.
6937 (message-narrow-to-head)
6938 (let ((head (buffer-string))
6940 (nnheader-temp-write nil
6941 (insert (format "211 %d Article retrieved.\n"
6942 (cdr gnus-article-current)))
6945 (let ((nntp-server-buffer (current-buffer)))
6946 (setq header (car (gnus-get-newsgroup-headers
6948 (set-buffer gnus-summary-buffer)
6949 gnus-newsgroup-dependencies)
6952 (set-buffer gnus-summary-buffer)
6953 (gnus-data-set-header
6954 (gnus-data-find (cdr gnus-article-current))
6956 (gnus-summary-update-article-line
6957 (cdr gnus-article-current) header))))))
6959 (set-buffer (or buffer gnus-summary-buffer))
6960 (gnus-summary-update-article (cdr gnus-article-current)))
6961 ;; Prettify the article buffer again.
6963 (set-buffer gnus-article-buffer)
6964 (run-hooks 'gnus-article-display-hook)
6965 (set-buffer gnus-original-article-buffer)
6966 (gnus-request-article
6967 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
6968 ;; Prettify the summary buffer line.
6969 (when (gnus-visual-p 'summary-highlight 'highlight)
6970 (run-hooks 'gnus-visual-mark-article-hook))))
6972 (defun gnus-summary-edit-wash (key)
6973 "Perform editing command in the article buffer."
6977 (message "%s" (concat (this-command-keys) "- "))
6980 (gnus-summary-edit-article)
6981 (execute-kbd-macro (concat (this-command-keys) key))
6982 (gnus-article-edit-done))
6986 (defun gnus-summary-respool-query ()
6987 "Query where the respool algorithm would put this article."
6989 (gnus-set-global-variables)
6990 (let (gnus-mark-article-hook)
6991 (gnus-summary-select-article)
6993 (set-buffer gnus-original-article-buffer)
6995 (message-narrow-to-head)
6996 (message "This message would go to %s"
6997 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
6999 ;; Summary marking commands.
7001 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7002 "Mark articles which has the same subject as read, and then select the next.
7003 If UNMARK is positive, remove any kind of mark.
7004 If UNMARK is negative, tick articles."
7006 (gnus-set-global-variables)
7008 (setq unmark (prefix-numeric-value unmark)))
7010 (gnus-summary-mark-same-subject
7011 (gnus-summary-article-subject) unmark)))
7012 ;; Select next unread article. If auto-select-same mode, should
7013 ;; select the first unread article.
7014 (gnus-summary-next-article t (and gnus-auto-select-same
7015 (gnus-summary-article-subject)))
7016 (gnus-message 7 "%d article%s marked as %s"
7017 count (if (= count 1) " is" "s are")
7018 (if unmark "unread" "read"))))
7020 (defun gnus-summary-kill-same-subject (&optional unmark)
7021 "Mark articles which has the same subject as read.
7022 If UNMARK is positive, remove any kind of mark.
7023 If UNMARK is negative, tick articles."
7025 (gnus-set-global-variables)
7027 (setq unmark (prefix-numeric-value unmark)))
7029 (gnus-summary-mark-same-subject
7030 (gnus-summary-article-subject) unmark)))
7031 ;; If marked as read, go to next unread subject.
7033 ;; Go to next unread subject.
7034 (gnus-summary-next-subject 1 t))
7035 (gnus-message 7 "%d articles are marked as %s"
7036 count (if unmark "unread" "read"))))
7038 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7039 "Mark articles with same SUBJECT as read, and return marked number.
7040 If optional argument UNMARK is positive, remove any kinds of marks.
7041 If optional argument UNMARK is negative, mark articles as unread instead."
7045 ((null unmark) ; Mark as read.
7048 (gnus-summary-mark-article-as-read gnus-killed-mark)
7049 (gnus-summary-show-thread) t)
7050 (gnus-summary-find-subject subject))
7051 (setq count (1+ count))))
7052 ((> unmark 0) ; Tick.
7055 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7056 (gnus-summary-show-thread) t)
7057 (gnus-summary-find-subject subject))
7058 (setq count (1+ count))))
7059 (t ; Mark as unread.
7062 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7063 (gnus-summary-show-thread) t)
7064 (gnus-summary-find-subject subject))
7065 (setq count (1+ count)))))
7066 (gnus-set-mode-line 'summary)
7067 ;; Return the number of marked articles.
7070 (defun gnus-summary-mark-as-processable (n &optional unmark)
7071 "Set the process mark on the next N articles.
7072 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7073 the process mark instead. The difference between N and the actual
7074 number of articles marked is returned."
7076 (gnus-set-global-variables)
7077 (let ((backward (< n 0))
7082 (gnus-summary-remove-process-mark
7083 (gnus-summary-article-number))
7084 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7085 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7088 (gnus-message 7 "No more articles"))
7089 (gnus-summary-recenter)
7090 (gnus-summary-position-point)
7093 (defun gnus-summary-unmark-as-processable (n)
7094 "Remove the process mark from the next N articles.
7095 If N is negative, mark backward instead. The difference between N and
7096 the actual number of articles marked is returned."
7098 (gnus-set-global-variables)
7099 (gnus-summary-mark-as-processable n t))
7101 (defun gnus-summary-unmark-all-processable ()
7102 "Remove the process mark from all articles."
7104 (gnus-set-global-variables)
7106 (while gnus-newsgroup-processable
7107 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7108 (gnus-summary-position-point))
7110 (defun gnus-summary-mark-as-expirable (n)
7111 "Mark N articles forward as expirable.
7112 If N is negative, mark backward instead. The difference between N and
7113 the actual number of articles marked is returned."
7115 (gnus-set-global-variables)
7116 (gnus-summary-mark-forward n gnus-expirable-mark))
7118 (defun gnus-summary-mark-article-as-replied (article)
7119 "Mark ARTICLE replied and update the summary line."
7120 (push article gnus-newsgroup-replied)
7121 (let ((buffer-read-only nil))
7122 (when (gnus-summary-goto-subject article)
7123 (gnus-summary-update-secondary-mark article))))
7125 (defun gnus-summary-set-bookmark (article)
7126 "Set a bookmark in current article."
7127 (interactive (list (gnus-summary-article-number)))
7128 (gnus-set-global-variables)
7129 (when (or (not (get-buffer gnus-article-buffer))
7130 (not gnus-current-article)
7131 (not gnus-article-current)
7132 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7133 (error "No current article selected"))
7134 ;; Remove old bookmark, if one exists.
7135 (let ((old (assq article gnus-newsgroup-bookmarks)))
7137 (setq gnus-newsgroup-bookmarks
7138 (delq old gnus-newsgroup-bookmarks))))
7139 ;; Set the new bookmark, which is on the form
7140 ;; (article-number . line-number-in-body).
7144 (set-buffer gnus-article-buffer)
7148 (goto-char (point-min))
7149 (search-forward "\n\n" nil t)
7152 gnus-newsgroup-bookmarks)
7153 (gnus-message 6 "A bookmark has been added to the current article."))
7155 (defun gnus-summary-remove-bookmark (article)
7156 "Remove the bookmark from the current article."
7157 (interactive (list (gnus-summary-article-number)))
7158 (gnus-set-global-variables)
7159 ;; Remove old bookmark, if one exists.
7160 (let ((old (assq article gnus-newsgroup-bookmarks)))
7163 (setq gnus-newsgroup-bookmarks
7164 (delq old gnus-newsgroup-bookmarks))
7165 (gnus-message 6 "Removed bookmark."))
7166 (gnus-message 6 "No bookmark in current article."))))
7168 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7169 (defun gnus-summary-mark-as-dormant (n)
7170 "Mark N articles forward as dormant.
7171 If N is negative, mark backward instead. The difference between N and
7172 the actual number of articles marked is returned."
7174 (gnus-set-global-variables)
7175 (gnus-summary-mark-forward n gnus-dormant-mark))
7177 (defun gnus-summary-set-process-mark (article)
7178 "Set the process mark on ARTICLE and update the summary line."
7179 (setq gnus-newsgroup-processable
7181 (delq article gnus-newsgroup-processable)))
7182 (when (gnus-summary-goto-subject article)
7183 (gnus-summary-show-thread)
7184 (gnus-summary-update-secondary-mark article)))
7186 (defun gnus-summary-remove-process-mark (article)
7187 "Remove the process mark from ARTICLE and update the summary line."
7188 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7189 (when (gnus-summary-goto-subject article)
7190 (gnus-summary-show-thread)
7191 (gnus-summary-update-secondary-mark article)))
7193 (defun gnus-summary-set-saved-mark (article)
7194 "Set the process mark on ARTICLE and update the summary line."
7195 (push article gnus-newsgroup-saved)
7196 (when (gnus-summary-goto-subject article)
7197 (gnus-summary-update-secondary-mark article)))
7199 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7200 "Mark N articles as read forwards.
7201 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7202 The difference between N and the actual number of articles marked is
7205 (gnus-set-global-variables)
7206 (let ((backward (< n 0))
7207 (gnus-summary-goto-unread
7208 (and gnus-summary-goto-unread
7209 (not (eq gnus-summary-goto-unread 'never))
7210 (not (memq mark (list gnus-unread-mark
7211 gnus-ticked-mark gnus-dormant-mark)))))
7213 (mark (or mark gnus-del-mark)))
7215 (gnus-summary-mark-article nil mark no-expire)
7216 (zerop (gnus-summary-next-subject
7218 (and gnus-summary-goto-unread
7219 (not (eq gnus-summary-goto-unread 'never)))
7223 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7224 (gnus-summary-recenter)
7225 (gnus-summary-position-point)
7226 (gnus-set-mode-line 'summary)
7229 (defun gnus-summary-mark-article-as-read (mark)
7230 "Mark the current article quickly as read with MARK."
7231 (let ((article (gnus-summary-article-number)))
7232 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7233 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7234 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7235 (push (cons article mark) gnus-newsgroup-reads)
7236 ;; Possibly remove from cache, if that is used.
7237 (when gnus-use-cache
7238 (gnus-cache-enter-remove-article article))
7239 ;; Allow the backend to change the mark.
7240 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7241 ;; Check for auto-expiry.
7242 (when (and gnus-newsgroup-auto-expire
7243 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7244 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7245 (= mark gnus-ancient-mark)
7246 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7247 (= mark gnus-duplicate-mark)))
7248 (setq mark gnus-expirable-mark)
7249 (push article gnus-newsgroup-expirable))
7250 ;; Set the mark in the buffer.
7251 (gnus-summary-update-mark mark 'unread)
7254 (defun gnus-summary-mark-article-as-unread (mark)
7255 "Mark the current article quickly as unread with MARK."
7256 (let ((article (gnus-summary-article-number)))
7258 (gnus-error 1 "Unmarkable article")
7259 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7260 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7261 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7262 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7263 (cond ((= mark gnus-ticked-mark)
7264 (push article gnus-newsgroup-marked))
7265 ((= mark gnus-dormant-mark)
7266 (push article gnus-newsgroup-dormant))
7268 (push article gnus-newsgroup-unreads)))
7269 (setq gnus-newsgroup-reads
7270 (delq (assq article gnus-newsgroup-reads)
7271 gnus-newsgroup-reads))
7273 ;; See whether the article is to be put in the cache.
7275 (vectorp (gnus-summary-article-header article))
7277 (gnus-cache-possibly-enter-article
7278 gnus-newsgroup-name article
7279 (gnus-summary-article-header article)
7280 (= mark gnus-ticked-mark)
7281 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7284 (gnus-summary-update-mark mark 'unread))
7287 (defun gnus-summary-mark-article (&optional article mark no-expire)
7288 "Mark ARTICLE with MARK. MARK can be any character.
7289 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7290 `??' (dormant) and `?E' (expirable).
7291 If MARK is nil, then the default character `?D' is used.
7292 If ARTICLE is nil, then the article on the current line will be
7294 ;; The mark might be a string.
7295 (when (stringp mark)
7296 (setq mark (aref mark 0)))
7297 ;; If no mark is given, then we check auto-expiring.
7298 (and (not no-expire)
7299 gnus-newsgroup-auto-expire
7301 (and (gnus-characterp mark)
7302 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7303 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7304 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7305 (= mark gnus-duplicate-mark))))
7306 (setq mark gnus-expirable-mark))
7307 (let* ((mark (or mark gnus-del-mark))
7308 (article (or article (gnus-summary-article-number))))
7310 (error "No article on current line"))
7311 (if (or (= mark gnus-unread-mark)
7312 (= mark gnus-ticked-mark)
7313 (= mark gnus-dormant-mark))
7314 (gnus-mark-article-as-unread article mark)
7315 (gnus-mark-article-as-read article mark))
7317 ;; See whether the article is to be put in the cache.
7319 (not (= mark gnus-canceled-mark))
7320 (vectorp (gnus-summary-article-header article))
7322 (gnus-cache-possibly-enter-article
7323 gnus-newsgroup-name article
7324 (gnus-summary-article-header article)
7325 (= mark gnus-ticked-mark)
7326 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7328 (when (gnus-summary-goto-subject article nil t)
7329 (let ((buffer-read-only nil))
7330 (gnus-summary-show-thread)
7332 (gnus-summary-update-mark mark 'unread)
7335 (defun gnus-summary-update-secondary-mark (article)
7336 "Update the secondary (read, process, cache) mark."
7337 (gnus-summary-update-mark
7338 (cond ((memq article gnus-newsgroup-processable)
7340 ((memq article gnus-newsgroup-cached)
7342 ((memq article gnus-newsgroup-replied)
7344 ((memq article gnus-newsgroup-saved)
7346 (t gnus-unread-mark))
7348 (when (gnus-visual-p 'summary-highlight 'highlight)
7349 (run-hooks 'gnus-summary-update-hook))
7352 (defun gnus-summary-update-mark (mark type)
7353 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7354 (buffer-read-only nil))
7355 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7356 (when (looking-at "\r")
7359 (<= (+ forward (point)) (point-max)))
7360 ;; Go to the right position on the line.
7361 (goto-char (+ forward (point)))
7362 ;; Replace the old mark with the new mark.
7363 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7364 ;; Optionally update the marks by some user rule.
7365 (when (eq type 'unread)
7367 (gnus-data-find (gnus-summary-article-number)) mark)
7368 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7370 (defun gnus-mark-article-as-read (article &optional mark)
7371 "Enter ARTICLE in the pertinent lists and remove it from others."
7372 ;; Make the article expirable.
7373 (let ((mark (or mark gnus-del-mark)))
7374 (if (= mark gnus-expirable-mark)
7375 (push article gnus-newsgroup-expirable)
7376 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7377 ;; Remove from unread and marked lists.
7378 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7379 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7380 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7381 (push (cons article mark) gnus-newsgroup-reads)
7382 ;; Possibly remove from cache, if that is used.
7383 (when gnus-use-cache
7384 (gnus-cache-enter-remove-article article))))
7386 (defun gnus-mark-article-as-unread (article &optional mark)
7387 "Enter ARTICLE in the pertinent lists and remove it from others."
7388 (let ((mark (or mark gnus-ticked-mark)))
7389 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7390 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7391 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7392 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7394 ;; Unsuppress duplicates?
7395 (when gnus-suppress-duplicates
7396 (gnus-dup-unsuppress-article article))
7398 (cond ((= mark gnus-ticked-mark)
7399 (push article gnus-newsgroup-marked))
7400 ((= mark gnus-dormant-mark)
7401 (push article gnus-newsgroup-dormant))
7403 (push article gnus-newsgroup-unreads)))
7404 (setq gnus-newsgroup-reads
7405 (delq (assq article gnus-newsgroup-reads)
7406 gnus-newsgroup-reads))))
7408 (defalias 'gnus-summary-mark-as-unread-forward
7409 'gnus-summary-tick-article-forward)
7410 (make-obsolete 'gnus-summary-mark-as-unread-forward
7411 'gnus-summary-tick-article-forward)
7412 (defun gnus-summary-tick-article-forward (n)
7413 "Tick N articles forwards.
7414 If N is negative, tick backwards instead.
7415 The difference between N and the number of articles ticked is returned."
7417 (gnus-summary-mark-forward n gnus-ticked-mark))
7419 (defalias 'gnus-summary-mark-as-unread-backward
7420 'gnus-summary-tick-article-backward)
7421 (make-obsolete 'gnus-summary-mark-as-unread-backward
7422 'gnus-summary-tick-article-backward)
7423 (defun gnus-summary-tick-article-backward (n)
7424 "Tick N articles backwards.
7425 The difference between N and the number of articles ticked is returned."
7427 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7429 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7430 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7431 (defun gnus-summary-tick-article (&optional article clear-mark)
7432 "Mark current article as unread.
7433 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7434 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7436 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7439 (defun gnus-summary-mark-as-read-forward (n)
7440 "Mark N articles as read forwards.
7441 If N is negative, mark backwards instead.
7442 The difference between N and the actual number of articles marked is
7445 (gnus-summary-mark-forward n gnus-del-mark t))
7447 (defun gnus-summary-mark-as-read-backward (n)
7448 "Mark the N articles as read backwards.
7449 The difference between N and the actual number of articles marked is
7452 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7454 (defun gnus-summary-mark-as-read (&optional article mark)
7455 "Mark current article as read.
7456 ARTICLE specifies the article to be marked as read.
7457 MARK specifies a string to be inserted at the beginning of the line."
7458 (gnus-summary-mark-article article mark))
7460 (defun gnus-summary-clear-mark-forward (n)
7461 "Clear marks from N articles forward.
7462 If N is negative, clear backward instead.
7463 The difference between N and the number of marks cleared is returned."
7465 (gnus-summary-mark-forward n gnus-unread-mark))
7467 (defun gnus-summary-clear-mark-backward (n)
7468 "Clear marks from N articles backward.
7469 The difference between N and the number of marks cleared is returned."
7471 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7473 (defun gnus-summary-mark-unread-as-read ()
7474 "Intended to be used by `gnus-summary-mark-article-hook'."
7475 (when (memq gnus-current-article gnus-newsgroup-unreads)
7476 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7478 (defun gnus-summary-mark-read-and-unread-as-read ()
7479 "Intended to be used by `gnus-summary-mark-article-hook'."
7480 (let ((mark (gnus-summary-article-mark)))
7481 (when (or (gnus-unread-mark-p mark)
7482 (gnus-read-mark-p mark))
7483 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7485 (defun gnus-summary-mark-region-as-read (point mark all)
7486 "Mark all unread articles between point and mark as read.
7487 If given a prefix, mark all articles between point and mark as read,
7488 even ticked and dormant ones."
7489 (interactive "r\nP")
7498 (memq (setq article (gnus-summary-article-number))
7499 gnus-newsgroup-unreads))
7500 (gnus-summary-mark-article article gnus-del-mark))
7502 (gnus-summary-find-next))))))
7504 (defun gnus-summary-mark-below (score mark)
7505 "Mark articles with score less than SCORE with MARK."
7506 (interactive "P\ncMark: ")
7507 (gnus-set-global-variables)
7508 (setq score (if score
7509 (prefix-numeric-value score)
7510 (or gnus-summary-default-score 0)))
7512 (set-buffer gnus-summary-buffer)
7513 (goto-char (point-min))
7516 (and (< (gnus-summary-article-score) score)
7517 (gnus-summary-mark-article nil mark))
7518 (gnus-summary-find-next)))))
7520 (defun gnus-summary-kill-below (&optional score)
7521 "Mark articles with score below SCORE as read."
7523 (gnus-set-global-variables)
7524 (gnus-summary-mark-below score gnus-killed-mark))
7526 (defun gnus-summary-clear-above (&optional score)
7527 "Clear all marks from articles with score above SCORE."
7529 (gnus-set-global-variables)
7530 (gnus-summary-mark-above score gnus-unread-mark))
7532 (defun gnus-summary-tick-above (&optional score)
7533 "Tick all articles with score above SCORE."
7535 (gnus-set-global-variables)
7536 (gnus-summary-mark-above score gnus-ticked-mark))
7538 (defun gnus-summary-mark-above (score mark)
7539 "Mark articles with score over SCORE with MARK."
7540 (interactive "P\ncMark: ")
7541 (gnus-set-global-variables)
7542 (setq score (if score
7543 (prefix-numeric-value score)
7544 (or gnus-summary-default-score 0)))
7546 (set-buffer gnus-summary-buffer)
7547 (goto-char (point-min))
7549 (when (> (gnus-summary-article-score) score)
7550 (gnus-summary-mark-article nil mark))
7552 (gnus-summary-find-next)))))
7554 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7555 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7556 (defun gnus-summary-limit-include-expunged (&optional no-error)
7557 "Display all the hidden articles that were expunged for low scores."
7559 (gnus-set-global-variables)
7560 (let ((buffer-read-only nil))
7561 (let ((scored gnus-newsgroup-scored)
7564 (unless (gnus-summary-goto-subject (caar scored))
7565 (and (setq h (gnus-summary-article-header (caar scored)))
7566 (< (cdar scored) gnus-summary-expunge-below)
7568 (setq scored (cdr scored)))
7570 (when (not no-error)
7571 (error "No expunged articles hidden."))
7572 (goto-char (point-min))
7573 (gnus-summary-prepare-unthreaded (nreverse headers))
7574 (goto-char (point-min))
7575 (gnus-summary-position-point)
7578 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7579 "Mark all unread articles in this newsgroup as read.
7580 If prefix argument ALL is non-nil, ticked and dormant articles will
7581 also be marked as read.
7582 If QUIETLY is non-nil, no questions will be asked.
7583 If TO-HERE is non-nil, it should be a point in the buffer. All
7584 articles before this point will be marked as read.
7585 Note that this function will only catch up the unread article
7586 in the current summary buffer limitation.
7587 The number of articles marked as read is returned."
7589 (gnus-set-global-variables)
7593 (not gnus-interactive-catchup) ;Without confirmation?
7597 "Mark absolutely all articles as read? "
7598 "Mark all unread articles as read? ")))
7600 (not gnus-newsgroup-adaptive)
7601 (not gnus-newsgroup-auto-expire)
7602 (not gnus-suppress-duplicates))
7605 (setq gnus-newsgroup-marked nil
7606 gnus-newsgroup-dormant nil))
7607 (setq gnus-newsgroup-unreads nil))
7608 ;; We actually mark all articles as canceled, which we
7609 ;; have to do when using auto-expiry or adaptive scoring.
7610 (gnus-summary-show-all-threads)
7611 (when (gnus-summary-first-subject (not all))
7613 (if to-here (< (point) to-here) t)
7614 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7615 (gnus-summary-find-next (not all)))))
7616 (gnus-set-mode-line 'summary))
7618 (gnus-summary-position-point)))
7620 (defun gnus-summary-catchup-to-here (&optional all)
7621 "Mark all unticked articles before the current one as read.
7622 If ALL is non-nil, also mark ticked and dormant articles as read."
7624 (gnus-set-global-variables)
7626 (gnus-save-hidden-threads
7627 (let ((beg (point)))
7628 ;; We check that there are unread articles.
7629 (when (or all (gnus-summary-find-prev))
7630 (gnus-summary-catchup all t beg)))))
7631 (gnus-summary-position-point))
7633 (defun gnus-summary-catchup-all (&optional quietly)
7634 "Mark all articles in this newsgroup as read."
7636 (gnus-set-global-variables)
7637 (gnus-summary-catchup t quietly))
7639 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7640 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7641 If prefix argument ALL is non-nil, all articles are marked as read."
7643 (gnus-set-global-variables)
7644 (when (gnus-summary-catchup all quietly nil 'fast)
7645 ;; Select next newsgroup or exit.
7646 (if (eq gnus-auto-select-next 'quietly)
7647 (gnus-summary-next-group nil)
7648 (gnus-summary-exit))))
7650 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7651 "Mark all articles in this newsgroup as read, and then exit."
7653 (gnus-set-global-variables)
7654 (gnus-summary-catchup-and-exit t quietly))
7656 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7657 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7658 "Mark all articles in this group as read and select the next group.
7659 If given a prefix, mark all articles, unread as well as ticked, as
7662 (gnus-set-global-variables)
7664 (gnus-summary-catchup all))
7665 (gnus-summary-next-article t nil nil t))
7667 ;; Thread-based commands.
7669 (defun gnus-summary-articles-in-thread (&optional article)
7670 "Return a list of all articles in the current thread.
7671 If ARTICLE is non-nil, return all articles in the thread that starts
7673 (let* ((article (or article (gnus-summary-article-number)))
7674 (data (gnus-data-find-list article))
7675 (top-level (gnus-data-level (car data)))
7677 (cond ((null gnus-thread-operation-ignore-subject)
7678 (gnus-simplify-subject-re
7679 (mail-header-subject (gnus-data-header (car data)))))
7680 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7681 (gnus-simplify-subject-fuzzy
7682 (mail-header-subject (gnus-data-header (car data)))))
7684 (end-point (save-excursion
7685 (if (gnus-summary-go-to-next-thread)
7686 (point) (point-max))))
7689 (< (gnus-data-pos (car data)) end-point))
7690 (when (or (not top-subject)
7691 (string= top-subject
7692 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7693 (gnus-simplify-subject-fuzzy
7694 (mail-header-subject
7695 (gnus-data-header (car data))))
7696 (gnus-simplify-subject-re
7697 (mail-header-subject
7698 (gnus-data-header (car data)))))))
7699 (push (gnus-data-number (car data)) articles))
7700 (unless (and (setq data (cdr data))
7701 (> (gnus-data-level (car data)) top-level))
7703 ;; Return the list of articles.
7704 (nreverse articles)))
7706 (defun gnus-summary-rethread-current ()
7707 "Rethread the thread the current article is part of."
7709 (gnus-set-global-variables)
7710 (let* ((gnus-show-threads t)
7711 (article (gnus-summary-article-number))
7712 (id (mail-header-id (gnus-summary-article-header)))
7713 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7715 (error "No article on the current line"))
7716 (gnus-rebuild-thread id)
7717 (gnus-summary-goto-subject article)))
7719 (defun gnus-summary-reparent-thread ()
7720 "Make the current article child of the marked (or previous) article.
7722 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7723 is non-nil or the Subject: of both articles are the same."
7725 (unless (not (gnus-group-read-only-p))
7726 (error "The current newsgroup does not support article editing."))
7727 (unless (<= (length gnus-newsgroup-processable) 1)
7728 (error "No more than one article may be marked."))
7729 (save-window-excursion
7730 (let ((gnus-article-buffer " *reparent*")
7731 (current-article (gnus-summary-article-number))
7732 ;; First grab the marked article, otherwise one line up.
7733 (parent-article (if (not (null gnus-newsgroup-processable))
7734 (car gnus-newsgroup-processable)
7736 (if (eq (forward-line -1) 0)
7737 (gnus-summary-article-number)
7738 (error "Beginning of summary buffer."))))))
7739 (unless (not (eq current-article parent-article))
7740 (error "An article may not be self-referential."))
7741 (let ((message-id (mail-header-id
7742 (gnus-summary-article-header parent-article))))
7743 (unless (and message-id (not (equal message-id "")))
7744 (error "No message-id in desired parent."))
7745 (gnus-summary-select-article t t nil current-article)
7746 (set-buffer gnus-original-article-buffer)
7747 (let ((buf (format "%s" (buffer-string))))
7748 (nnheader-temp-write nil
7750 (goto-char (point-min))
7751 (if (search-forward-regexp "^References: " nil t)
7752 (insert message-id " " )
7753 (insert "References: " message-id "\n"))
7754 (unless (gnus-request-replace-article
7755 current-article (car gnus-article-current)
7757 (error "Couldn't replace article."))))
7758 (set-buffer gnus-summary-buffer)
7759 (gnus-summary-unmark-all-processable)
7760 (gnus-summary-rethread-current)
7761 (gnus-message 3 "Article %d is now the child of article %d."
7762 current-article parent-article)))))
7764 (defun gnus-summary-toggle-threads (&optional arg)
7765 "Toggle showing conversation threads.
7766 If ARG is positive number, turn showing conversation threads on."
7768 (gnus-set-global-variables)
7769 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7770 (setq gnus-show-threads
7771 (if (null arg) (not gnus-show-threads)
7772 (> (prefix-numeric-value arg) 0)))
7773 (gnus-summary-prepare)
7774 (gnus-summary-goto-subject current)
7775 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7776 (gnus-summary-position-point)))
7778 (defun gnus-summary-show-all-threads ()
7781 (gnus-set-global-variables)
7783 (let ((buffer-read-only nil))
7784 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7785 (gnus-summary-position-point))
7787 (defun gnus-summary-show-thread ()
7788 "Show thread subtrees.
7789 Returns nil if no thread was there to be shown."
7791 (gnus-set-global-variables)
7792 (let ((buffer-read-only nil)
7794 ;; first goto end then to beg, to have point at beg after let
7795 (end (progn (end-of-line) (point)))
7796 (beg (progn (beginning-of-line) (point))))
7798 ;; Any hidden lines here?
7799 (search-forward "\r" end t)
7800 (subst-char-in-region beg end ?\^M ?\n t)
7802 (gnus-summary-position-point))))
7804 (defun gnus-summary-hide-all-threads ()
7805 "Hide all thread subtrees."
7807 (gnus-set-global-variables)
7809 (goto-char (point-min))
7810 (gnus-summary-hide-thread)
7811 (while (zerop (gnus-summary-next-thread 1 t))
7812 (gnus-summary-hide-thread)))
7813 (gnus-summary-position-point))
7815 (defun gnus-summary-hide-thread ()
7816 "Hide thread subtrees.
7817 Returns nil if no threads were there to be hidden."
7819 (gnus-set-global-variables)
7820 (let ((buffer-read-only nil)
7822 (article (gnus-summary-article-number)))
7824 ;; Go forward until either the buffer ends or the subthread
7826 (when (and (not (eobp))
7827 (or (zerop (gnus-summary-next-thread 1 t))
7828 (goto-char (point-max))))
7830 (if (and (> (point) start)
7831 (search-backward "\n" start t))
7833 (subst-char-in-region start (point) ?\n ?\^M)
7834 (gnus-summary-goto-subject article))
7837 ;;(gnus-summary-position-point)
7840 (defun gnus-summary-go-to-next-thread (&optional previous)
7841 "Go to the same level (or less) next thread.
7842 If PREVIOUS is non-nil, go to previous thread instead.
7843 Return the article number moved to, or nil if moving was impossible."
7844 (let ((level (gnus-summary-thread-level))
7845 (way (if previous -1 1))
7848 (while (and (not (eobp))
7849 (< level (gnus-summary-thread-level)))
7857 (gnus-summary-article-number)
7860 (defun gnus-summary-next-thread (n &optional silent)
7861 "Go to the same level next N'th thread.
7862 If N is negative, search backward instead.
7863 Returns the difference between N and the number of skips actually
7866 If SILENT, don't output messages."
7868 (gnus-set-global-variables)
7869 (let ((backward (< n 0))
7872 (gnus-summary-go-to-next-thread backward))
7875 (gnus-summary-position-point))
7876 (when (and (not silent) (/= 0 n))
7877 (gnus-message 7 "No more threads"))
7880 (defun gnus-summary-prev-thread (n)
7881 "Go to the same level previous N'th thread.
7882 Returns the difference between N and the number of skips actually
7885 (gnus-set-global-variables)
7886 (gnus-summary-next-thread (- n)))
7888 (defun gnus-summary-go-down-thread ()
7889 "Go down one level in the current thread."
7890 (let ((children (gnus-summary-article-children)))
7892 (gnus-summary-goto-subject (car children)))))
7894 (defun gnus-summary-go-up-thread ()
7895 "Go up one level in the current thread."
7896 (let ((parent (gnus-summary-article-parent)))
7898 (gnus-summary-goto-subject parent))))
7900 (defun gnus-summary-down-thread (n)
7901 "Go down thread N steps.
7902 If N is negative, go up instead.
7903 Returns the difference between N and how many steps down that were
7906 (gnus-set-global-variables)
7910 (if up (gnus-summary-go-up-thread)
7911 (gnus-summary-go-down-thread)))
7913 (gnus-summary-position-point)
7915 (gnus-message 7 "Can't go further"))
7918 (defun gnus-summary-up-thread (n)
7919 "Go up thread N steps.
7920 If N is negative, go up instead.
7921 Returns the difference between N and how many steps down that were
7924 (gnus-set-global-variables)
7925 (gnus-summary-down-thread (- n)))
7927 (defun gnus-summary-top-thread ()
7928 "Go to the top of the thread."
7930 (gnus-set-global-variables)
7931 (while (gnus-summary-go-up-thread))
7932 (gnus-summary-article-number))
7934 (defun gnus-summary-kill-thread (&optional unmark)
7935 "Mark articles under current thread as read.
7936 If the prefix argument is positive, remove any kinds of marks.
7937 If the prefix argument is negative, tick articles instead."
7939 (gnus-set-global-variables)
7941 (setq unmark (prefix-numeric-value unmark)))
7942 (let ((articles (gnus-summary-articles-in-thread)))
7944 ;; Expand the thread.
7945 (gnus-summary-show-thread)
7946 ;; Mark all the articles.
7948 (gnus-summary-goto-subject (car articles))
7949 (cond ((null unmark)
7950 (gnus-summary-mark-article-as-read gnus-killed-mark))
7952 (gnus-summary-mark-article-as-unread gnus-unread-mark))
7954 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
7955 (setq articles (cdr articles))))
7956 ;; Hide killed subtrees.
7958 gnus-thread-hide-killed
7959 (gnus-summary-hide-thread))
7960 ;; If marked as read, go to next unread subject.
7962 ;; Go to next unread subject.
7963 (gnus-summary-next-subject 1 t)))
7964 (gnus-set-mode-line 'summary))
7966 ;; Summary sorting commands
7968 (defun gnus-summary-sort-by-number (&optional reverse)
7969 "Sort the summary buffer by article number.
7970 Argument REVERSE means reverse order."
7972 (gnus-summary-sort 'number reverse))
7974 (defun gnus-summary-sort-by-author (&optional reverse)
7975 "Sort the summary buffer by author name alphabetically.
7976 If case-fold-search is non-nil, case of letters is ignored.
7977 Argument REVERSE means reverse order."
7979 (gnus-summary-sort 'author reverse))
7981 (defun gnus-summary-sort-by-subject (&optional reverse)
7982 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
7983 If case-fold-search is non-nil, case of letters is ignored.
7984 Argument REVERSE means reverse order."
7986 (gnus-summary-sort 'subject reverse))
7988 (defun gnus-summary-sort-by-date (&optional reverse)
7989 "Sort the summary buffer by date.
7990 Argument REVERSE means reverse order."
7992 (gnus-summary-sort 'date reverse))
7994 (defun gnus-summary-sort-by-score (&optional reverse)
7995 "Sort the summary buffer by score.
7996 Argument REVERSE means reverse order."
7998 (gnus-summary-sort 'score reverse))
8000 (defun gnus-summary-sort-by-lines (&optional reverse)
8001 "Sort the summary buffer by article length.
8002 Argument REVERSE means reverse order."
8004 (gnus-summary-sort 'lines reverse))
8006 (defun gnus-summary-sort (predicate reverse)
8007 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8008 (gnus-set-global-variables)
8009 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8010 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8011 (gnus-thread-sort-functions
8017 (gnus-article-sort-functions
8022 (,article t2 t1)))))
8024 (gnus-summary-prepare-hook nil))
8025 ;; We do the sorting by regenerating the threads.
8026 (gnus-summary-prepare)
8027 ;; Hide subthreads if needed.
8028 (when (and gnus-show-threads gnus-thread-hide-subtree)
8029 (gnus-summary-hide-all-threads))))
8031 ;; Summary saving commands.
8033 (defun gnus-summary-save-article (&optional n not-saved)
8034 "Save the current article using the default saver function.
8035 If N is a positive number, save the N next articles.
8036 If N is a negative number, save the N previous articles.
8037 If N is nil and any articles have been marked with the process mark,
8038 save those articles instead.
8039 The variable `gnus-default-article-saver' specifies the saver function."
8041 (gnus-set-global-variables)
8042 (let* ((articles (gnus-summary-work-articles n))
8043 (save-buffer (save-excursion
8044 (nnheader-set-temp-buffer " *Gnus Save*")))
8045 (num (length articles))
8046 header article file)
8048 (setq header (gnus-summary-article-header
8049 (setq article (pop articles))))
8050 (if (not (vectorp header))
8051 ;; This is a pseudo-article.
8052 (if (assq 'name header)
8053 (gnus-copy-file (cdr (assq 'name header)))
8054 (gnus-message 1 "Article %d is unsaveable" article))
8055 ;; This is a real article.
8056 (save-window-excursion
8057 (gnus-summary-select-article t nil nil article))
8059 (set-buffer save-buffer)
8061 (insert-buffer-substring gnus-original-article-buffer))
8062 (setq file (gnus-article-save save-buffer file num))
8063 (gnus-summary-remove-process-mark article)
8065 (gnus-summary-set-saved-mark article))))
8066 (gnus-kill-buffer save-buffer)
8067 (gnus-summary-position-point)
8068 (gnus-set-mode-line 'summary)
8071 (defun gnus-summary-pipe-output (&optional arg)
8072 "Pipe the current article to a subprocess.
8073 If N is a positive number, pipe the N next articles.
8074 If N is a negative number, pipe the N previous articles.
8075 If N is nil and any articles have been marked with the process mark,
8076 pipe those articles instead."
8078 (gnus-set-global-variables)
8079 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8080 (gnus-summary-save-article arg t))
8081 (gnus-configure-windows 'pipe))
8083 (defun gnus-summary-save-article-mail (&optional arg)
8084 "Append the current article to an mail file.
8085 If N is a positive number, save the N next articles.
8086 If N is a negative number, save the N previous articles.
8087 If N is nil and any articles have been marked with the process mark,
8088 save those articles instead."
8090 (gnus-set-global-variables)
8091 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8092 (gnus-summary-save-article arg)))
8094 (defun gnus-summary-save-article-rmail (&optional arg)
8095 "Append the current article to an rmail file.
8096 If N is a positive number, save the N next articles.
8097 If N is a negative number, save the N previous articles.
8098 If N is nil and any articles have been marked with the process mark,
8099 save those articles instead."
8101 (gnus-set-global-variables)
8102 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8103 (gnus-summary-save-article arg)))
8105 (defun gnus-summary-save-article-file (&optional arg)
8106 "Append the current article to a file.
8107 If N is a positive number, save the N next articles.
8108 If N is a negative number, save the N previous articles.
8109 If N is nil and any articles have been marked with the process mark,
8110 save those articles instead."
8112 (gnus-set-global-variables)
8113 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8114 (gnus-summary-save-article arg)))
8116 (defun gnus-summary-write-article-file (&optional arg)
8117 "Write the current article to a file, deleting the previous file.
8118 If N is a positive number, save the N next articles.
8119 If N is a negative number, save the N previous articles.
8120 If N is nil and any articles have been marked with the process mark,
8121 save those articles instead."
8123 (gnus-set-global-variables)
8124 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8125 (gnus-summary-save-article arg)))
8127 (defun gnus-summary-save-article-body-file (&optional arg)
8128 "Append the current article body to a file.
8129 If N is a positive number, save the N next articles.
8130 If N is a negative number, save the N previous articles.
8131 If N is nil and any articles have been marked with the process mark,
8132 save those articles instead."
8134 (gnus-set-global-variables)
8135 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8136 (gnus-summary-save-article arg)))
8138 (defun gnus-summary-pipe-message (program)
8139 "Pipe the current article through PROGRAM."
8140 (interactive "sProgram: ")
8141 (gnus-set-global-variables)
8142 (gnus-summary-select-article)
8143 (let ((mail-header-separator "")
8144 (art-buf (get-buffer gnus-article-buffer)))
8145 (gnus-eval-in-buffer-window gnus-article-buffer
8148 (let ((start (window-start))
8150 (message-pipe-buffer-body program)
8151 (set-window-start (get-buffer-window (current-buffer)) start))))))
8153 (defun gnus-get-split-value (methods)
8154 "Return a value based on the split METHODS."
8155 (let (split-name method result match)
8158 (set-buffer gnus-original-article-buffer)
8160 (nnheader-narrow-to-headers)
8162 (goto-char (point-min))
8163 (setq method (pop methods))
8164 (setq match (car method))
8167 ;; Regular expression.
8169 (re-search-forward match nil t)))
8170 ((gnus-functionp match)
8174 (setq result (funcall match gnus-newsgroup-name))))
8179 (setq result (eval match)))))
8180 (setq split-name (append (cdr method) split-name))
8181 (cond ((stringp result)
8182 (push (expand-file-name
8183 result gnus-article-save-directory)
8186 (setq split-name (append result split-name)))))))))
8189 (defun gnus-valid-move-group-p (group)
8194 (car (gnus-find-method-for-group
8195 (symbol-name group))))
8196 gnus-valid-select-methods))))
8198 (defun gnus-read-move-group-name (prompt default articles prefix)
8199 "Read a group name."
8200 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8201 (minibuffer-confirm-incomplete nil) ; XEmacs
8205 (if (> (length articles) 1)
8206 (format "these %d articles" (length articles))
8211 (gnus-completing-read default prom
8213 'gnus-valid-move-group-p
8215 'gnus-group-history))
8216 ((= 1 (length split-name))
8217 (gnus-completing-read (car split-name) prom
8219 'gnus-valid-move-group-p
8221 'gnus-group-history))
8223 (gnus-completing-read nil prom
8224 (mapcar (lambda (el) (list el))
8225 (nreverse split-name))
8227 'gnus-group-history)))))
8229 (if (or (string= to-newsgroup "")
8230 (string= to-newsgroup prefix))
8231 (setq to-newsgroup default))
8232 (unless to-newsgroup
8233 (error "No group name entered"))
8234 (or (gnus-active to-newsgroup)
8235 (gnus-activate-group to-newsgroup)
8236 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8238 (or (and (gnus-request-create-group
8239 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8240 (gnus-activate-group to-newsgroup nil nil
8241 (gnus-group-name-to-method
8243 (error "Couldn't create group %s" to-newsgroup)))
8244 (error "No such group: %s" to-newsgroup)))
8247 ;; Summary extract commands
8249 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8250 (let ((buffer-read-only nil)
8251 (article (gnus-summary-article-number))
8253 (unless (gnus-summary-goto-subject article)
8254 (error "No such article: %d" article))
8255 (gnus-summary-position-point)
8256 ;; If all commands are to be bunched up on one line, we collect
8258 (unless gnus-view-pseudos-separately
8259 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8262 (setq action (cdr (assq 'action (car ps))))
8263 (setq files (list (cdr (assq 'name (car ps)))))
8264 (while (and ps (cdr ps)
8265 (string= (or action "1")
8266 (or (cdr (assq 'action (cadr ps))) "2")))
8267 (push (cdr (assq 'name (cadr ps))) files)
8268 (setcdr ps (cddr ps)))
8270 (when (not (string-match "%s" action))
8273 (when (assq 'execute (car ps))
8274 (setcdr (assq 'execute (car ps))
8275 (funcall (if (string-match "%s" action)
8282 (gnus-quote-arg-for-sh-or-csh f)))
8284 (setq ps (cdr ps)))))
8285 (if (and gnus-view-pseudos (not not-view))
8287 (when (assq 'execute (car pslist))
8288 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8289 (eq gnus-view-pseudos 'not-confirm)))
8290 (setq pslist (cdr pslist)))
8293 (setq after-article (or (cdr (assq 'article (car pslist)))
8294 (gnus-summary-article-number)))
8295 (gnus-summary-goto-subject after-article)
8298 (insert " " (file-name-nondirectory
8299 (cdr (assq 'name (car pslist))))
8300 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8302 (forward-line -1) ; back to `b'
8303 (gnus-add-text-properties
8304 b (1- e) (list 'gnus-number gnus-reffed-article-number
8305 gnus-mouse-face-prop gnus-mouse-face))
8307 after-article gnus-reffed-article-number
8308 gnus-unread-mark b (car pslist) 0 (- e b))
8309 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8310 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8311 (setq pslist (cdr pslist)))))))
8313 (defun gnus-pseudos< (p1 p2)
8314 (let ((c1 (cdr (assq 'action p1)))
8315 (c2 (cdr (assq 'action p2))))
8316 (and c1 c2 (string< c1 c2))))
8318 (defun gnus-request-pseudo-article (props)
8319 (cond ((assq 'execute props)
8320 (gnus-execute-command (cdr (assq 'execute props)))))
8321 (let ((gnus-current-article (gnus-summary-article-number)))
8322 (run-hooks 'gnus-mark-article-hook)))
8324 (defun gnus-execute-command (command &optional automatic)
8326 (gnus-article-setup-buffer)
8327 (set-buffer gnus-article-buffer)
8328 (setq buffer-read-only nil)
8329 (let ((command (if automatic command (read-string "Command: " command)))
8330 ;; Just binding this here doesn't help, because there might
8331 ;; be output from the process after exiting the scope of
8333 ;; (buffer-read-only nil)
8336 (insert "$ " command "\n\n")
8337 (if gnus-view-pseudo-asynchronously
8338 (start-process "gnus-execute" nil shell-file-name
8339 shell-command-switch command)
8340 (call-process shell-file-name nil t nil
8341 shell-command-switch command)))))
8343 ;; Summary kill commands.
8345 (defun gnus-summary-edit-global-kill (article)
8346 "Edit the \"global\" kill file."
8347 (interactive (list (gnus-summary-article-number)))
8348 (gnus-set-global-variables)
8349 (gnus-group-edit-global-kill article))
8351 (defun gnus-summary-edit-local-kill ()
8352 "Edit a local kill file applied to the current newsgroup."
8354 (gnus-set-global-variables)
8355 (setq gnus-current-headers (gnus-summary-article-header))
8356 (gnus-set-global-variables)
8357 (gnus-group-edit-local-kill
8358 (gnus-summary-article-number) gnus-newsgroup-name))
8362 (defun gnus-read-header (id &optional header)
8363 "Read the headers of article ID and enter them into the Gnus system."
8364 (let ((group gnus-newsgroup-name)
8365 (gnus-override-method
8366 (and (gnus-news-group-p gnus-newsgroup-name)
8367 gnus-refer-article-method))
8369 ;; First we check to see whether the header in question is already
8372 ;; This is a Message-ID.
8373 (setq header (or header (gnus-id-to-header id)))
8374 ;; This is an article number.
8375 (setq header (or header (gnus-summary-article-header id))))
8377 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8378 ;; We have found the header.
8380 ;; We have to really fetch the header to this article.
8382 (set-buffer nntp-server-buffer)
8383 (when (setq where (gnus-request-head id group))
8384 (nnheader-fold-continuation-lines)
8385 (goto-char (point-max))
8387 (goto-char (point-min))
8391 ((cdr where) (cdr where))
8392 (header (mail-header-number header))
8393 (t gnus-reffed-article-number))
8395 (insert " Article retrieved.\n"))
8397 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8398 () ; Malformed head.
8399 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8400 (when (and (stringp id)
8401 (not (string= (gnus-group-real-name group)
8403 ;; If we fetched by Message-ID and the article came
8404 ;; from a different group, we fudge some bogus article
8405 ;; numbers for this article.
8406 (mail-header-set-number header gnus-reffed-article-number))
8408 (set-buffer gnus-summary-buffer)
8409 (decf gnus-reffed-article-number)
8410 (gnus-remove-header (mail-header-number header))
8411 (push header gnus-newsgroup-headers)
8412 (setq gnus-current-headers header)
8413 (push (mail-header-number header) gnus-newsgroup-limit)))
8416 (defun gnus-remove-header (number)
8417 "Remove header NUMBER from `gnus-newsgroup-headers'."
8418 (if (and gnus-newsgroup-headers
8419 (= number (mail-header-number (car gnus-newsgroup-headers))))
8420 (pop gnus-newsgroup-headers)
8421 (let ((headers gnus-newsgroup-headers))
8422 (while (and (cdr headers)
8423 (not (= number (mail-header-number (cadr headers)))))
8426 (setcdr headers (cddr headers))))))
8429 ;;; summary highlights
8432 (defun gnus-highlight-selected-summary ()
8433 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8434 ;; Highlight selected article in summary buffer
8435 (when gnus-summary-selected-face
8437 (let* ((beg (progn (beginning-of-line) (point)))
8438 (end (progn (end-of-line) (point)))
8439 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8440 (from (if (get-text-property beg gnus-mouse-face-prop)
8442 (or (next-single-property-change
8443 beg gnus-mouse-face-prop nil end)
8448 (or (next-single-property-change
8449 from gnus-mouse-face-prop nil end)
8451 ;; If no mouse-face prop on line we will have to = from = end,
8452 ;; so we highlight the entire line instead.
8453 (when (= (+ to 2) from)
8456 (if gnus-newsgroup-selected-overlay
8457 ;; Move old overlay.
8459 gnus-newsgroup-selected-overlay from to (current-buffer))
8460 ;; Create new overlay.
8462 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8463 'face gnus-summary-selected-face))))))
8465 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8466 (defun gnus-summary-highlight-line ()
8467 "Highlight current line according to `gnus-summary-highlight'."
8468 (let* ((list gnus-summary-highlight)
8470 (end (progn (end-of-line) (point)))
8471 ;; now find out where the line starts and leave point there.
8472 (beg (progn (beginning-of-line) (point)))
8473 (article (gnus-summary-article-number))
8474 (score (or (cdr (assq (or article gnus-current-article)
8475 gnus-newsgroup-scored))
8476 gnus-summary-default-score 0))
8477 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8478 (inhibit-read-only t))
8479 ;; Eval the cars of the lists until we find a match.
8480 (let ((default gnus-summary-default-score))
8482 (not (eval (caar list))))
8483 (setq list (cdr list))))
8484 (let ((face (cdar list)))
8485 (unless (eq face (get-text-property beg 'face))
8486 (gnus-put-text-property
8488 (setq face (if (boundp face) (symbol-value face) face)))
8489 (when gnus-summary-highlight-line-function
8490 (funcall gnus-summary-highlight-line-function article face))))
8493 (defun gnus-update-read-articles (group unread)
8494 "Update the list of read articles in GROUP."
8495 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8496 (entry (gnus-gethash group gnus-newsrc-hashtb))
8497 (info (nth 2 entry))
8499 (unread (sort (copy-sequence unread) '<))
8501 (if (or (not info) (not active))
8502 ;; There is no info on this group if it was, in fact,
8503 ;; killed. Gnus stores no information on killed groups, so
8504 ;; there's nothing to be done.
8505 ;; One could store the information somewhere temporarily,
8506 ;; perhaps... Hmmm...
8508 ;; Remove any negative articles numbers.
8509 (while (and unread (< (car unread) 0))
8510 (setq unread (cdr unread)))
8511 ;; Remove any expired article numbers
8512 (while (and unread (< (car unread) (car active)))
8513 (setq unread (cdr unread)))
8514 ;; Compute the ranges of read articles by looking at the list of
8517 (when (/= (car unread) prev)
8518 (push (if (= prev (1- (car unread))) prev
8519 (cons prev (1- (car unread))))
8521 (setq prev (1+ (car unread)))
8522 (setq unread (cdr unread)))
8523 (when (<= prev (cdr active))
8524 (push (cons prev (cdr active)) read))
8526 (set-buffer gnus-group-buffer)
8529 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8530 (gnus-info-set-read ',info ',(gnus-info-read info))
8531 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8532 (gnus-group-update-group ,group t))))
8533 ;; Enter this list into the group info.
8535 info (if (> (length read) 1) (nreverse read) read))
8536 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8537 (gnus-get-unread-articles-in-group info (gnus-active group))
8540 (defun gnus-offer-save-summaries ()
8541 "Offer to save all active summary buffers."
8543 (let ((buflist (buffer-list))
8545 ;; Go through all buffers and find all summaries.
8547 (and (setq bufname (buffer-name (car buflist)))
8548 (string-match "Summary" bufname)
8550 (set-buffer bufname)
8551 ;; We check that this is, indeed, a summary buffer.
8552 (and (eq major-mode 'gnus-summary-mode)
8553 ;; Also make sure this isn't bogus.
8554 gnus-newsgroup-prepared
8555 ;; Also make sure that this isn't a dead summary buffer.
8556 (not gnus-dead-summary-mode)))
8557 (push bufname buffers))
8558 (setq buflist (cdr buflist)))
8559 ;; Go through all these summary buffers and offer to save them.
8562 "Update summary buffer %s? "
8563 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8568 (run-hooks 'gnus-sum-load-hook)
8570 ;;; gnus-sum.el ends here