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
130 'gnus-gather-threads-by-subject
131 "Function used for gathering loose threads.
132 There are two pre-defined functions: `gnus-gather-threads-by-subject',
133 which only takes Subjects into consideration; and
134 `gnus-gather-threads-by-references', which compared the References
135 headers of the articles to find matches."
137 :type '(set (function-item gnus-gather-threads-by-subject)
138 (function-item gnus-gather-threads-by-references)
139 (function :tag "other")))
141 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
142 (defcustom gnus-summary-same-subject ""
143 "*String indicating that the current article has the same subject as the previous.
144 This variable will only be used if the value of
145 `gnus-summary-make-false-root' is `empty'."
146 :group 'gnus-summary-format
149 (defcustom gnus-summary-goto-unread t
150 "*If t, marking commands will go to the next unread article.
151 If `never', commands that usually go to the next unread article, will
152 go to the next article, whether it is read or not.
153 If nil, only the marking commands will go to the next (un)read article."
154 :group 'gnus-summary-marks
155 :link '(custom-manual "(gnus)Setting Marks")
156 :type '(choice (const :tag "off" nil)
158 (sexp :menu-tag "on" t)))
160 (defcustom gnus-summary-default-score 0
161 "*Default article score level.
162 All scores generated by the score files will be added to this score.
163 If this variable is nil, scoring will be disabled."
164 :group 'gnus-score-default
165 :type '(choice (const :tag "disable")
168 (defcustom gnus-summary-zcore-fuzz 0
169 "*Fuzziness factor for the zcore in the summary buffer.
170 Articles with scores closer than this to `gnus-summary-default-score'
172 :group 'gnus-summary-format
175 (defcustom gnus-simplify-subject-fuzzy-regexp nil
176 "*Strings to be removed when doing fuzzy matches.
177 This can either be a regular expression or list of regular expressions
178 that will be removed from subject strings if fuzzy subject
179 simplification is selected."
181 :type '(repeat regexp))
183 (defcustom gnus-show-threads t
184 "*If non-nil, display threads in summary mode."
188 (defcustom gnus-thread-hide-subtree nil
189 "*If non-nil, hide all threads initially.
190 If threads are hidden, you have to run the command
191 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
192 to expose hidden threads."
196 (defcustom gnus-thread-hide-killed t
197 "*If non-nil, hide killed threads automatically."
201 (defcustom gnus-thread-ignore-subject nil
202 "*If non-nil, ignore subjects and do all threading based on the Reference header.
203 If nil, which is the default, articles that have different subjects
204 from their parents will start separate threads."
208 (defcustom gnus-thread-operation-ignore-subject t
209 "*If non-nil, subjects will be ignored when doing thread commands.
210 This affects commands like `gnus-summary-kill-thread' and
211 `gnus-summary-lower-thread'.
213 If this variable is nil, articles in the same thread with different
214 subjects will not be included in the operation in question. If this
215 variable is `fuzzy', only articles that have subjects that are fuzzily
216 equal will be included."
218 :type '(choice (const :tag "off" nil)
222 (defcustom gnus-thread-indent-level 4
223 "*Number that says how much each sub-thread should be indented."
227 (defcustom gnus-auto-extend-newsgroup t
228 "*If non-nil, extend newsgroup forward and backward when requested."
229 :group 'gnus-summary-choose
232 (defcustom gnus-auto-select-first t
233 "*If nil, don't select the first unread article when entering a group.
234 If this variable is `best', select the highest-scored unread article
235 in the group. If neither nil nor `best', select the first unread
238 If you want to prevent automatic selection of the first unread article
239 in some newsgroups, set the variable to nil in
240 `gnus-select-group-hook'."
241 :group 'gnus-group-select
242 :type '(choice (const :tag "none" nil)
244 (sexp :menu-tag "first" t)))
246 (defcustom gnus-auto-select-next t
247 "*If non-nil, offer to go to the next group from the end of the previous.
248 If the value is t and the next newsgroup is empty, Gnus will exit
249 summary mode and go back to group mode. If the value is neither nil
250 nor t, Gnus will select the following unread newsgroup. In
251 particular, if the value is the symbol `quietly', the next unread
252 newsgroup will be selected without any confirmation, and if it is
253 `almost-quietly', the next group will be selected without any
254 confirmation if you are located on the last article in the group.
255 Finally, if this variable is `slightly-quietly', the `Z n' command
256 will go to the next group without confirmation."
257 :group 'gnus-summary-maneuvering
258 :type '(choice (const :tag "off" nil)
260 (const almost-quietly)
261 (const slightly-quietly)
262 (sexp :menu-tag "on" t)))
264 (defcustom gnus-auto-select-same nil
265 "*If non-nil, select the next article with the same subject."
266 :group 'gnus-summary-maneuvering
269 (defcustom gnus-summary-check-current nil
270 "*If non-nil, consider the current article when moving.
271 The \"unread\" movement commands will stay on the same line if the
272 current article is unread."
273 :group 'gnus-summary-maneuvering
276 (defcustom gnus-auto-center-summary t
277 "*If non-nil, always center the current summary buffer.
278 In particular, if `vertical' do only vertical recentering. If non-nil
279 and non-`vertical', do both horizontal and vertical recentering."
280 :group 'gnus-summary-maneuvering
281 :type '(choice (const :tag "none" nil)
283 (sexp :menu-tag "both" t)))
285 (defcustom gnus-show-all-headers nil
286 "*If non-nil, don't hide any headers."
287 :group 'gnus-article-hiding
288 :group 'gnus-article-headers
291 (defcustom gnus-single-article-buffer t
292 "*If non-nil, display all articles in the same buffer.
293 If nil, each group will get its own article buffer."
294 :group 'gnus-article-various
297 (defcustom gnus-break-pages t
298 "*If non-nil, do page breaking on articles.
299 The page delimiter is specified by the `gnus-page-delimiter'
301 :group 'gnus-article-various
304 (defcustom gnus-show-mime nil
305 "*If non-nil, do mime processing of articles.
306 The articles will simply be fed to the function given by
307 `gnus-show-mime-method'."
308 :group 'gnus-article-mime
311 (defcustom gnus-move-split-methods nil
312 "*Variable used to suggest where articles are to be moved to.
313 It uses the same syntax as the `gnus-split-methods' variable."
314 :group 'gnus-summary-mail
315 :type '(repeat (choice (list function)
316 (cons regexp (repeat string))
319 (defcustom gnus-unread-mark ?
320 "*Mark used for unread articles."
321 :group 'gnus-summary-marks
324 (defcustom gnus-ticked-mark ?!
325 "*Mark used for ticked articles."
326 :group 'gnus-summary-marks
329 (defcustom gnus-dormant-mark ??
330 "*Mark used for dormant articles."
331 :group 'gnus-summary-marks
334 (defcustom gnus-del-mark ?r
335 "*Mark used for del'd articles."
336 :group 'gnus-summary-marks
339 (defcustom gnus-read-mark ?R
340 "*Mark used for read articles."
341 :group 'gnus-summary-marks
344 (defcustom gnus-expirable-mark ?E
345 "*Mark used for expirable articles."
346 :group 'gnus-summary-marks
349 (defcustom gnus-killed-mark ?K
350 "*Mark used for killed articles."
351 :group 'gnus-summary-marks
354 (defcustom gnus-souped-mark ?F
355 "*Mark used for killed articles."
356 :group 'gnus-summary-marks
359 (defcustom gnus-kill-file-mark ?X
360 "*Mark used for articles killed by kill files."
361 :group 'gnus-summary-marks
364 (defcustom gnus-low-score-mark ?Y
365 "*Mark used for articles with a low score."
366 :group 'gnus-summary-marks
369 (defcustom gnus-catchup-mark ?C
370 "*Mark used for articles that are caught up."
371 :group 'gnus-summary-marks
374 (defcustom gnus-replied-mark ?A
375 "*Mark used for articles that have been replied to."
376 :group 'gnus-summary-marks
379 (defcustom gnus-cached-mark ?*
380 "*Mark used for articles that are in the cache."
381 :group 'gnus-summary-marks
384 (defcustom gnus-saved-mark ?S
385 "*Mark used for articles that have been saved to."
386 :group 'gnus-summary-marks
389 (defcustom gnus-ancient-mark ?O
390 "*Mark used for ancient articles."
391 :group 'gnus-summary-marks
394 (defcustom gnus-sparse-mark ?Q
395 "*Mark used for sparsely reffed articles."
396 :group 'gnus-summary-marks
399 (defcustom gnus-canceled-mark ?G
400 "*Mark used for canceled articles."
401 :group 'gnus-summary-marks
404 (defcustom gnus-duplicate-mark ?M
405 "*Mark used for duplicate articles."
406 :group 'gnus-summary-marks
409 (defcustom gnus-score-over-mark ?+
410 "*Score mark used for articles with high scores."
411 :group 'gnus-summary-marks
414 (defcustom gnus-score-below-mark ?-
415 "*Score mark used for articles with low scores."
416 :group 'gnus-summary-marks
419 (defcustom gnus-empty-thread-mark ?
420 "*There is no thread under the article."
421 :group 'gnus-summary-marks
424 (defcustom gnus-not-empty-thread-mark ?=
425 "*There is a thread under the article."
426 :group 'gnus-summary-marks
429 (defcustom gnus-view-pseudo-asynchronously nil
430 "*If non-nil, Gnus will view pseudo-articles asynchronously."
431 :group 'gnus-extract-view
434 (defcustom gnus-view-pseudos nil
435 "*If `automatic', pseudo-articles will be viewed automatically.
436 If `not-confirm', pseudos will be viewed automatically, and the user
437 will not be asked to confirm the command."
438 :group 'gnus-extract-view
439 :type '(choice (const :tag "off" nil)
441 (const not-confirm)))
443 (defcustom gnus-view-pseudos-separately t
444 "*If non-nil, one pseudo-article will be created for each file to be viewed.
445 If nil, all files that use the same viewing command will be given as a
446 list of parameters to that command."
447 :group 'gnus-extract-view
450 (defcustom gnus-insert-pseudo-articles t
451 "*If non-nil, insert pseudo-articles when decoding articles."
452 :group 'gnus-extract-view
455 (defcustom gnus-summary-dummy-line-format
457 "*The format specification for the dummy roots in the summary buffer.
458 It works along the same lines as a normal formatting string,
459 with some simple extensions.
462 :group 'gnus-threading
465 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
466 "*The format specification for the summary mode line.
467 It works along the same lines as a normal formatting string,
468 with some simple extensions:
471 %p Unprefixed group name
472 %A Current article number
474 %U Number of unread articles in the group
475 %e Number of unselected articles in the group
476 %Z A string with unread/unselected article counts
477 %g Shortish group name
478 %S Subject of the current article
480 %s Current score file name
481 %d Number of dormant articles
482 %r Number of articles that have been marked as read in this session
483 %E Number of articles expunged by the score files"
484 :group 'gnus-summary-format
487 (defcustom gnus-summary-mark-below 0
488 "*Mark all articles with a score below this variable as read.
489 This variable is local to each summary buffer and usually set by the
491 :group 'gnus-score-default
494 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
495 "*List of functions used for sorting articles in the summary buffer.
496 This variable is only used when not using a threaded display."
497 :group 'gnus-summary-sort
498 :type '(repeat (choice (function-item gnus-article-sort-by-number)
499 (function-item gnus-article-sort-by-author)
500 (function-item gnus-article-sort-by-subject)
501 (function-item gnus-article-sort-by-date)
502 (function-item gnus-article-sort-by-score)
503 (function :tag "other"))))
505 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
506 "*List of functions used for sorting threads in the summary buffer.
507 By default, threads are sorted by article number.
509 Each function takes two threads and return non-nil if the first thread
510 should be sorted before the other. If you use more than one function,
511 the primary sort function should be the last. You should probably
512 always include `gnus-thread-sort-by-number' in the list of sorting
513 functions -- preferably first.
515 Ready-made functions include `gnus-thread-sort-by-number',
516 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
517 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
518 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
519 :group 'gnus-summary-sort
520 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
521 (function-item gnus-thread-sort-by-author)
522 (function-item gnus-thread-sort-by-subject)
523 (function-item gnus-thread-sort-by-date)
524 (function-item gnus-thread-sort-by-score)
525 (function-item gnus-thread-sort-by-total-score)
526 (function :tag "other"))))
528 (defcustom gnus-thread-score-function '+
529 "*Function used for calculating the total score of a thread.
531 The function is called with the scores of the article and each
532 subthread and should then return the score of the thread.
534 Some functions you can use are `+', `max', or `min'."
535 :group 'gnus-summary-sort
538 (defcustom gnus-summary-expunge-below nil
539 "All articles that have a score less than this variable will be expunged."
540 :group 'gnus-score-default
541 :type '(choice (const :tag "off" nil)
544 (defcustom gnus-thread-expunge-below nil
545 "All threads that have a total score less than this variable will be expunged.
546 See `gnus-thread-score-function' for en explanation of what a
547 \"thread score\" is."
548 :group 'gnus-treading
549 :group 'gnus-score-default
550 :type '(choice (const :tag "off" nil)
553 (defcustom gnus-summary-mode-hook nil
554 "*A hook for Gnus summary mode.
555 This hook is run before any variables are set in the summary buffer."
556 :group 'gnus-summary-various
559 (defcustom gnus-summary-menu-hook nil
560 "*Hook run after the creation of the summary mode menu."
561 :group 'gnus-summary-visual
564 (defcustom gnus-summary-exit-hook nil
565 "*A hook called on exit from the summary buffer.
566 It will be called with point in the group buffer."
567 :group 'gnus-summary-exit
570 (defcustom gnus-summary-prepare-hook nil
571 "*A hook called after the summary buffer has been generated.
572 If you want to modify the summary buffer, you can use this hook."
573 :group 'gnus-summary-various
576 (defcustom gnus-summary-generate-hook nil
577 "*A hook run just before generating the summary buffer.
578 This hook is commonly used to customize threading variables and the
580 :group 'gnus-summary-various
583 (defcustom gnus-select-group-hook nil
584 "*A hook called when a newsgroup is selected.
586 If you'd like to simplify subjects like the
587 `gnus-summary-next-same-subject' command does, you can use the
590 (setq gnus-select-group-hook
593 (mapcar (lambda (header)
594 (mail-header-set-subject
596 (gnus-simplify-subject
597 (mail-header-subject header) 're-only)))
598 gnus-newsgroup-headers))))"
599 :group 'gnus-group-select
602 (defcustom gnus-select-article-hook nil
603 "*A hook called when an article is selected."
604 :group 'gnus-summary-choose
607 (defcustom gnus-visual-mark-article-hook
608 (list 'gnus-highlight-selected-summary)
609 "*Hook run after selecting an article in the summary buffer.
610 It is meant to be used for highlighting the article in some way. It
611 is not run if `gnus-visual' is nil."
612 :group 'gnus-summary-visual
615 (defcustom gnus-parse-headers-hook
616 (list 'gnus-decode-rfc1522)
617 "*A hook called before parsing the headers."
621 (defcustom gnus-exit-group-hook nil
622 "*A hook called when exiting (not quitting) summary mode."
626 (defcustom gnus-summary-update-hook
627 (list 'gnus-summary-highlight-line)
628 "*A hook called when a summary line is changed.
629 The hook will not be called if `gnus-visual' is nil.
631 The default function `gnus-summary-highlight-line' will
632 highlight the line according to the `gnus-summary-highlight'
634 :group 'gnus-summary-visual
637 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
638 "*A hook called when an article is selected for the first time.
639 The hook is intended to mark an article as read (or unread)
640 automatically when it is selected."
641 :group 'gnus-summary-choose
644 (defcustom gnus-group-no-more-groups-hook nil
645 "*A hook run when returning to group mode having no more (unread) groups."
646 :group 'gnus-group-select
649 (defcustom gnus-ps-print-hook nil
650 "*A hook run before ps-printing something from Gnus."
654 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
655 "Face used for highlighting the current article in the summary buffer."
656 :group 'gnus-summary-visual
659 (defcustom gnus-summary-highlight
660 '(((= mark gnus-canceled-mark)
661 . gnus-summary-cancelled-face)
662 ((and (> score default)
663 (or (= mark gnus-dormant-mark)
664 (= mark gnus-ticked-mark)))
665 . gnus-summary-high-ticked-face)
666 ((and (< score default)
667 (or (= mark gnus-dormant-mark)
668 (= mark gnus-ticked-mark)))
669 . gnus-summary-low-ticked-face)
670 ((or (= mark gnus-dormant-mark)
671 (= mark gnus-ticked-mark))
672 . gnus-summary-normal-ticked-face)
673 ((and (> score default) (= mark gnus-ancient-mark))
674 . gnus-summary-high-ancient-face)
675 ((and (< score default) (= mark gnus-ancient-mark))
676 . gnus-summary-low-ancient-face)
677 ((= mark gnus-ancient-mark)
678 . gnus-summary-normal-ancient-face)
679 ((and (> score default) (= mark gnus-unread-mark))
680 . gnus-summary-high-unread-face)
681 ((and (< score default) (= mark gnus-unread-mark))
682 . gnus-summary-low-unread-face)
683 ((and (= mark gnus-unread-mark))
684 . gnus-summary-normal-unread-face)
686 . gnus-summary-high-read-face)
688 . gnus-summary-low-read-face)
690 . gnus-summary-normal-read-face))
691 "Controls the highlighting of summary buffer lines.
693 A list of (FORM . FACE) pairs. When deciding how a a particular
694 summary line should be displayed, each form is evaluated. The content
695 of the face field after the first true form is used. You can change
696 how those summary lines are displayed, by editing the face field.
698 You can use the following variables in the FORM field.
700 score: The articles score
701 default: The default article score.
702 below: The score below which articles are automatically marked as read.
703 mark: The articles mark."
704 :group 'gnus-summary-visual
705 :type '(repeat (cons (sexp :tag "Form" nil)
709 ;;; Internal variables
711 (defvar gnus-scores-exclude-files nil)
713 (defvar gnus-summary-display-table
714 ;; Change the display table. Odd characters have a tendency to mess
715 ;; up nicely formatted displays - we make all possible glyphs
716 ;; display only a single character.
718 ;; We start from the standard display table, if any.
719 (let ((table (or (copy-sequence standard-display-table)
720 (make-display-table)))
721 ;; Nix out all the control chars...
723 (while (>= (setq i (1- i)) 0)
725 ;; ... but not newline and cr, of course. (cr is necessary for the
726 ;; selective display).
729 ;; We nix out any glyphs over 126 that are not set already.
731 (while (>= (setq i (1- i)) 127)
732 ;; Only modify if the entry is nil.
734 (aset table i [??]))))
736 "Display table used in summary mode buffers.")
738 (defvar gnus-original-article nil)
739 (defvar gnus-article-internal-prepare-hook nil)
740 (defvar gnus-newsgroup-process-stack nil)
742 (defvar gnus-thread-indent-array nil)
743 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
745 ;; Avoid highlighting in kill files.
746 (defvar gnus-summary-inhibit-highlight nil)
747 (defvar gnus-newsgroup-selected-overlay nil)
748 (defvar gnus-inhibit-limiting nil)
749 (defvar gnus-newsgroup-adaptive-score-file nil)
750 (defvar gnus-current-score-file nil)
751 (defvar gnus-current-move-group nil)
752 (defvar gnus-current-copy-group nil)
753 (defvar gnus-current-crosspost-group nil)
755 (defvar gnus-newsgroup-dependencies nil)
756 (defvar gnus-newsgroup-adaptive nil)
757 (defvar gnus-summary-display-article-function nil)
758 (defvar gnus-summary-highlight-line-function nil
759 "Function called after highlighting a summary line.")
761 (defvar gnus-summary-line-format-alist
762 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
763 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
764 (?s gnus-tmp-subject-or-nil ?s)
765 (?n gnus-tmp-name ?s)
766 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
768 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
770 (?F gnus-tmp-from ?s)
771 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
772 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
773 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
774 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
775 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
776 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
777 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
778 (?L gnus-tmp-lines ?d)
779 (?I gnus-tmp-indentation ?s)
780 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
781 (?R gnus-tmp-replied ?c)
782 (?\[ gnus-tmp-opening-bracket ?c)
783 (?\] gnus-tmp-closing-bracket ?c)
784 (?\> (make-string gnus-tmp-level ? ) ?s)
785 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
786 (?i gnus-tmp-score ?d)
787 (?z gnus-tmp-score-char ?c)
788 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
789 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
790 (?U gnus-tmp-unread ?c)
791 (?t (gnus-summary-number-of-articles-in-thread
792 (and (boundp 'thread) (car thread)) gnus-tmp-level)
794 (?e (gnus-summary-number-of-articles-in-thread
795 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
797 (?u gnus-tmp-user-defined ?s)
798 (?P (gnus-pick-line-number) ?d))
799 "An alist of format specifications that can appear in summary lines,
800 and what variables they correspond with, along with the type of the
801 variable (string, integer, character, etc).")
803 (defvar gnus-summary-dummy-line-format-alist
804 `((?S gnus-tmp-subject ?s)
805 (?N gnus-tmp-number ?d)
806 (?u gnus-tmp-user-defined ?s)))
808 (defvar gnus-summary-mode-line-format-alist
809 `((?G gnus-tmp-group-name ?s)
810 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
811 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
812 (?A gnus-tmp-article-number ?d)
813 (?Z gnus-tmp-unread-and-unselected ?s)
815 (?U gnus-tmp-unread-and-unticked ?d)
816 (?S gnus-tmp-subject ?s)
817 (?e gnus-tmp-unselected ?d)
818 (?u gnus-tmp-user-defined ?s)
819 (?d (length gnus-newsgroup-dormant) ?d)
820 (?t (length gnus-newsgroup-marked) ?d)
821 (?r (length gnus-newsgroup-reads) ?d)
822 (?E gnus-newsgroup-expunged-tally ?d)
823 (?s (gnus-current-score-file-nondirectory) ?s)))
825 (defvar gnus-last-search-regexp nil
826 "Default regexp for article search command.")
828 (defvar gnus-last-shell-command nil
829 "Default shell command on article.")
831 (defvar gnus-newsgroup-begin nil)
832 (defvar gnus-newsgroup-end nil)
833 (defvar gnus-newsgroup-last-rmail nil)
834 (defvar gnus-newsgroup-last-mail nil)
835 (defvar gnus-newsgroup-last-folder nil)
836 (defvar gnus-newsgroup-last-file nil)
837 (defvar gnus-newsgroup-auto-expire nil)
838 (defvar gnus-newsgroup-active nil)
840 (defvar gnus-newsgroup-data nil)
841 (defvar gnus-newsgroup-data-reverse nil)
842 (defvar gnus-newsgroup-limit nil)
843 (defvar gnus-newsgroup-limits nil)
845 (defvar gnus-newsgroup-unreads nil
846 "List of unread articles in the current newsgroup.")
848 (defvar gnus-newsgroup-unselected nil
849 "List of unselected unread articles in the current newsgroup.")
851 (defvar gnus-newsgroup-reads nil
852 "Alist of read articles and article marks in the current newsgroup.")
854 (defvar gnus-newsgroup-expunged-tally nil)
856 (defvar gnus-newsgroup-marked nil
857 "List of ticked articles in the current newsgroup (a subset of unread art).")
859 (defvar gnus-newsgroup-killed nil
860 "List of ranges of articles that have been through the scoring process.")
862 (defvar gnus-newsgroup-cached nil
863 "List of articles that come from the article cache.")
865 (defvar gnus-newsgroup-saved nil
866 "List of articles that have been saved.")
868 (defvar gnus-newsgroup-kill-headers nil)
870 (defvar gnus-newsgroup-replied nil
871 "List of articles that have been replied to in the current newsgroup.")
873 (defvar gnus-newsgroup-expirable nil
874 "List of articles in the current newsgroup that can be expired.")
876 (defvar gnus-newsgroup-processable nil
877 "List of articles in the current newsgroup that can be processed.")
879 (defvar gnus-newsgroup-bookmarks nil
880 "List of articles in the current newsgroup that have bookmarks.")
882 (defvar gnus-newsgroup-dormant nil
883 "List of dormant articles in the current newsgroup.")
885 (defvar gnus-newsgroup-scored nil
886 "List of scored articles in the current newsgroup.")
888 (defvar gnus-newsgroup-headers nil
889 "List of article headers in the current newsgroup.")
891 (defvar gnus-newsgroup-threads nil)
893 (defvar gnus-newsgroup-prepared nil
894 "Whether the current group has been prepared properly.")
896 (defvar gnus-newsgroup-ancient nil
897 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
899 (defvar gnus-newsgroup-sparse nil)
901 (defvar gnus-current-article nil)
902 (defvar gnus-article-current nil)
903 (defvar gnus-current-headers nil)
904 (defvar gnus-have-all-headers nil)
905 (defvar gnus-last-article nil)
906 (defvar gnus-newsgroup-history nil)
908 (defconst gnus-summary-local-variables
909 '(gnus-newsgroup-name
910 gnus-newsgroup-begin gnus-newsgroup-end
911 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
912 gnus-newsgroup-last-folder gnus-newsgroup-last-file
913 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
914 gnus-newsgroup-unselected gnus-newsgroup-marked
915 gnus-newsgroup-reads gnus-newsgroup-saved
916 gnus-newsgroup-replied gnus-newsgroup-expirable
917 gnus-newsgroup-processable gnus-newsgroup-killed
918 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
919 gnus-newsgroup-headers gnus-newsgroup-threads
920 gnus-newsgroup-prepared gnus-summary-highlight-line-function
921 gnus-current-article gnus-current-headers gnus-have-all-headers
922 gnus-last-article gnus-article-internal-prepare-hook
923 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
924 gnus-newsgroup-scored gnus-newsgroup-kill-headers
925 gnus-thread-expunge-below
926 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
927 (gnus-summary-mark-below . global)
928 gnus-newsgroup-active gnus-scores-exclude-files
929 gnus-newsgroup-history gnus-newsgroup-ancient
930 gnus-newsgroup-sparse gnus-newsgroup-process-stack
931 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
932 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
933 (gnus-newsgroup-expunged-tally . 0)
934 gnus-cache-removable-articles gnus-newsgroup-cached
935 gnus-newsgroup-data gnus-newsgroup-data-reverse
936 gnus-newsgroup-limit gnus-newsgroup-limits)
937 "Variables that are buffer-local to the summary buffers.")
939 ;; Byte-compiler warning.
940 (defvar gnus-article-mode-map)
942 ;; Subject simplification.
944 (defsubst gnus-simplify-subject-re (subject)
945 "Remove \"Re:\" from subject lines."
946 (if (string-match "^[Rr][Ee]: *" subject)
947 (substring subject (match-end 0))
950 (defun gnus-simplify-subject (subject &optional re-only)
951 "Remove `Re:' and words in parentheses.
952 If RE-ONLY is non-nil, strip leading `Re:'s only."
953 (let ((case-fold-search t)) ;Ignore case.
954 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
955 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
956 (setq subject (substring subject (match-end 0))))
957 ;; Remove uninteresting prefixes.
958 (when (and (not re-only)
959 gnus-simplify-ignored-prefixes
960 (string-match gnus-simplify-ignored-prefixes subject))
961 (setq subject (substring subject (match-end 0))))
962 ;; Remove words in parentheses from end.
964 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
965 (setq subject (substring subject 0 (match-beginning 0)))))
966 ;; Return subject string.
969 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
971 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
972 (goto-char (point-min))
973 (while (re-search-forward regexp nil t)
974 (replace-match (or newtext ""))))
976 (defun gnus-simplify-buffer-fuzzy ()
977 "Simplify string in the buffer fuzzily.
978 The string in the accessible portion of the current buffer is simplified.
979 It is assumed to be a single-line subject.
980 Whitespace is generally cleaned up, and miscellaneous leading/trailing
981 matter is removed. Additional things can be deleted by setting
982 gnus-simplify-subject-fuzzy-regexp."
983 (let ((case-fold-search t)
985 (gnus-simplify-buffer-fuzzy-step "\t" " ")
987 (while (not (eq modified-tick (buffer-modified-tick)))
988 (setq modified-tick (buffer-modified-tick))
990 ((listp gnus-simplify-subject-fuzzy-regexp)
991 (mapcar 'gnus-simplify-buffer-fuzzy-step
992 gnus-simplify-subject-fuzzy-regexp))
993 (gnus-simplify-subject-fuzzy-regexp
994 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
995 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
996 (gnus-simplify-buffer-fuzzy-step
997 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
998 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1000 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1001 (gnus-simplify-buffer-fuzzy-step " +" " ")
1002 (gnus-simplify-buffer-fuzzy-step " $")
1003 (gnus-simplify-buffer-fuzzy-step "^ +")))
1005 (defun gnus-simplify-subject-fuzzy (subject)
1006 "Simplify a subject string fuzzily.
1007 See gnus-simplify-buffer-fuzzy for details."
1009 (gnus-set-work-buffer)
1010 (let ((case-fold-search t))
1012 (inline (gnus-simplify-buffer-fuzzy))
1015 (defsubst gnus-simplify-subject-fully (subject)
1016 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1018 ((null gnus-summary-gather-subject-limit)
1019 (gnus-simplify-subject-re subject))
1020 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1021 (gnus-simplify-subject-fuzzy subject))
1022 ((numberp gnus-summary-gather-subject-limit)
1023 (gnus-limit-string (gnus-simplify-subject-re subject)
1024 gnus-summary-gather-subject-limit))
1028 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1029 "Check whether two subjects are equal. If optional argument
1030 simple-first is t, first argument is already simplified."
1032 ((null simple-first)
1033 (equal (gnus-simplify-subject-fully s1)
1034 (gnus-simplify-subject-fully s2)))
1037 (gnus-simplify-subject-fully s2)))))
1039 (defun gnus-summary-bubble-group ()
1040 "Increase the score of the current group.
1041 This is a handy function to add to `gnus-summary-exit-hook' to
1042 increase the score of each group you read."
1043 (gnus-group-add-score gnus-newsgroup-name))
1047 ;;; Gnus summary mode
1050 (put 'gnus-summary-mode 'mode-class 'special)
1053 ;; Non-orthogonal keys
1055 (gnus-define-keys gnus-summary-mode-map
1056 " " gnus-summary-next-page
1057 "\177" gnus-summary-prev-page
1058 [delete] gnus-summary-prev-page
1059 "\r" gnus-summary-scroll-up
1060 "n" gnus-summary-next-unread-article
1061 "p" gnus-summary-prev-unread-article
1062 "N" gnus-summary-next-article
1063 "P" gnus-summary-prev-article
1064 "\M-\C-n" gnus-summary-next-same-subject
1065 "\M-\C-p" gnus-summary-prev-same-subject
1066 "\M-n" gnus-summary-next-unread-subject
1067 "\M-p" gnus-summary-prev-unread-subject
1068 "." gnus-summary-first-unread-article
1069 "," gnus-summary-best-unread-article
1070 "\M-s" gnus-summary-search-article-forward
1071 "\M-r" gnus-summary-search-article-backward
1072 "<" gnus-summary-beginning-of-article
1073 ">" gnus-summary-end-of-article
1074 "j" gnus-summary-goto-article
1075 "^" gnus-summary-refer-parent-article
1076 "\M-^" gnus-summary-refer-article
1077 "u" gnus-summary-tick-article-forward
1078 "!" gnus-summary-tick-article-forward
1079 "U" gnus-summary-tick-article-backward
1080 "d" gnus-summary-mark-as-read-forward
1081 "D" gnus-summary-mark-as-read-backward
1082 "E" gnus-summary-mark-as-expirable
1083 "\M-u" gnus-summary-clear-mark-forward
1084 "\M-U" gnus-summary-clear-mark-backward
1085 "k" gnus-summary-kill-same-subject-and-select
1086 "\C-k" gnus-summary-kill-same-subject
1087 "\M-\C-k" gnus-summary-kill-thread
1088 "\M-\C-l" gnus-summary-lower-thread
1089 "e" gnus-summary-edit-article
1090 "#" gnus-summary-mark-as-processable
1091 "\M-#" gnus-summary-unmark-as-processable
1092 "\M-\C-t" gnus-summary-toggle-threads
1093 "\M-\C-s" gnus-summary-show-thread
1094 "\M-\C-h" gnus-summary-hide-thread
1095 "\M-\C-f" gnus-summary-next-thread
1096 "\M-\C-b" gnus-summary-prev-thread
1097 "\M-\C-u" gnus-summary-up-thread
1098 "\M-\C-d" gnus-summary-down-thread
1099 "&" gnus-summary-execute-command
1100 "c" gnus-summary-catchup-and-exit
1101 "\C-w" gnus-summary-mark-region-as-read
1102 "\C-t" gnus-summary-toggle-truncation
1103 "?" gnus-summary-mark-as-dormant
1104 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1105 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1106 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1107 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1108 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1109 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1110 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1111 "=" gnus-summary-expand-window
1112 "\C-x\C-s" gnus-summary-reselect-current-group
1113 "\M-g" gnus-summary-rescan-group
1114 "w" gnus-summary-stop-page-breaking
1115 "\C-c\C-r" gnus-summary-caesar-message
1116 "\M-t" gnus-summary-toggle-mime
1117 "f" gnus-summary-followup
1118 "F" gnus-summary-followup-with-original
1119 "C" gnus-summary-cancel-article
1120 "r" gnus-summary-reply
1121 "R" gnus-summary-reply-with-original
1122 "\C-c\C-f" gnus-summary-mail-forward
1123 "o" gnus-summary-save-article
1124 "\C-o" gnus-summary-save-article-mail
1125 "|" gnus-summary-pipe-output
1126 "\M-k" gnus-summary-edit-local-kill
1127 "\M-K" gnus-summary-edit-global-kill
1129 "\C-c\C-d" gnus-summary-describe-group
1130 "q" gnus-summary-exit
1131 "Q" gnus-summary-exit-no-update
1132 "\C-c\C-i" gnus-info-find-node
1133 gnus-mouse-2 gnus-mouse-pick-article
1134 "m" gnus-summary-mail-other-window
1135 "a" gnus-summary-post-news
1136 "x" gnus-summary-limit-to-unread
1137 "s" gnus-summary-isearch-article
1138 "t" gnus-article-hide-headers
1139 "g" gnus-summary-show-article
1140 "l" gnus-summary-goto-last-article
1141 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1142 "\C-d" gnus-summary-enter-digest-group
1143 "\M-\C-d" gnus-summary-read-document
1145 "*" gnus-cache-enter-article
1146 "\M-*" gnus-cache-remove-article
1147 "\M-&" gnus-summary-universal-argument
1148 "\C-l" gnus-recenter
1149 "I" gnus-summary-increase-score
1150 "L" gnus-summary-lower-score
1152 "V" gnus-summary-score-map
1153 "X" gnus-uu-extract-map
1154 "S" gnus-summary-send-map)
1156 ;; Sort of orthogonal keymap
1157 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1158 "t" gnus-summary-tick-article-forward
1159 "!" gnus-summary-tick-article-forward
1160 "d" gnus-summary-mark-as-read-forward
1161 "r" gnus-summary-mark-as-read-forward
1162 "c" gnus-summary-clear-mark-forward
1163 " " gnus-summary-clear-mark-forward
1164 "e" gnus-summary-mark-as-expirable
1165 "x" gnus-summary-mark-as-expirable
1166 "?" gnus-summary-mark-as-dormant
1167 "b" gnus-summary-set-bookmark
1168 "B" gnus-summary-remove-bookmark
1169 "#" gnus-summary-mark-as-processable
1170 "\M-#" gnus-summary-unmark-as-processable
1171 "S" gnus-summary-limit-include-expunged
1172 "C" gnus-summary-catchup
1173 "H" gnus-summary-catchup-to-here
1174 "\C-c" gnus-summary-catchup-all
1175 "k" gnus-summary-kill-same-subject-and-select
1176 "K" gnus-summary-kill-same-subject
1177 "P" gnus-uu-mark-map)
1179 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1180 "c" gnus-summary-clear-above
1181 "u" gnus-summary-tick-above
1182 "m" gnus-summary-mark-above
1183 "k" gnus-summary-kill-below)
1185 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1186 "/" gnus-summary-limit-to-subject
1187 "n" gnus-summary-limit-to-articles
1188 "w" gnus-summary-pop-limit
1189 "s" gnus-summary-limit-to-subject
1190 "a" gnus-summary-limit-to-author
1191 "u" gnus-summary-limit-to-unread
1192 "m" gnus-summary-limit-to-marks
1193 "v" gnus-summary-limit-to-score
1194 "D" gnus-summary-limit-include-dormant
1195 "d" gnus-summary-limit-exclude-dormant
1196 "t" gnus-summary-limit-to-age
1197 "E" gnus-summary-limit-include-expunged
1198 "c" gnus-summary-limit-exclude-childless-dormant
1199 "C" gnus-summary-limit-mark-excluded-as-read)
1201 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1202 "n" gnus-summary-next-unread-article
1203 "p" gnus-summary-prev-unread-article
1204 "N" gnus-summary-next-article
1205 "P" gnus-summary-prev-article
1206 "\C-n" gnus-summary-next-same-subject
1207 "\C-p" gnus-summary-prev-same-subject
1208 "\M-n" gnus-summary-next-unread-subject
1209 "\M-p" gnus-summary-prev-unread-subject
1210 "f" gnus-summary-first-unread-article
1211 "b" gnus-summary-best-unread-article
1212 "j" gnus-summary-goto-article
1213 "g" gnus-summary-goto-subject
1214 "l" gnus-summary-goto-last-article
1215 "p" gnus-summary-pop-article)
1217 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1218 "k" gnus-summary-kill-thread
1219 "l" gnus-summary-lower-thread
1220 "i" gnus-summary-raise-thread
1221 "T" gnus-summary-toggle-threads
1222 "t" gnus-summary-rethread-current
1223 "^" gnus-summary-reparent-thread
1224 "s" gnus-summary-show-thread
1225 "S" gnus-summary-show-all-threads
1226 "h" gnus-summary-hide-thread
1227 "H" gnus-summary-hide-all-threads
1228 "n" gnus-summary-next-thread
1229 "p" gnus-summary-prev-thread
1230 "u" gnus-summary-up-thread
1231 "o" gnus-summary-top-thread
1232 "d" gnus-summary-down-thread
1233 "#" gnus-uu-mark-thread
1234 "\M-#" gnus-uu-unmark-thread)
1236 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1237 "g" gnus-summary-prepare
1238 "c" gnus-summary-insert-cached-articles)
1240 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1241 "c" gnus-summary-catchup-and-exit
1242 "C" gnus-summary-catchup-all-and-exit
1243 "E" gnus-summary-exit-no-update
1244 "Q" gnus-summary-exit
1245 "Z" gnus-summary-exit
1246 "n" gnus-summary-catchup-and-goto-next-group
1247 "R" gnus-summary-reselect-current-group
1248 "G" gnus-summary-rescan-group
1249 "N" gnus-summary-next-group
1250 "s" gnus-summary-save-newsrc
1251 "P" gnus-summary-prev-group)
1253 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1254 " " gnus-summary-next-page
1255 "n" gnus-summary-next-page
1256 "\177" gnus-summary-prev-page
1257 [delete] gnus-summary-prev-page
1258 "p" gnus-summary-prev-page
1259 "\r" gnus-summary-scroll-up
1260 "<" gnus-summary-beginning-of-article
1261 ">" gnus-summary-end-of-article
1262 "b" gnus-summary-beginning-of-article
1263 "e" gnus-summary-end-of-article
1264 "^" gnus-summary-refer-parent-article
1265 "r" gnus-summary-refer-parent-article
1266 "R" gnus-summary-refer-references
1267 "g" gnus-summary-show-article
1268 "s" gnus-summary-isearch-article
1269 "P" gnus-summary-print-article)
1271 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1272 "b" gnus-article-add-buttons
1273 "B" gnus-article-add-buttons-to-head
1274 "o" gnus-article-treat-overstrike
1275 "e" gnus-article-emphasize
1276 "w" gnus-article-fill-cited-article
1277 "c" gnus-article-remove-cr
1278 "q" gnus-article-de-quoted-unreadable
1279 "f" gnus-article-display-x-face
1280 "l" gnus-summary-stop-page-breaking
1281 "r" gnus-summary-caesar-message
1282 "t" gnus-article-hide-headers
1283 "v" gnus-summary-verbose-headers
1284 "m" gnus-summary-toggle-mime
1285 "h" gnus-article-treat-html)
1287 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1288 "a" gnus-article-hide
1289 "h" gnus-article-hide-headers
1290 "b" gnus-article-hide-boring-headers
1291 "s" gnus-article-hide-signature
1292 "c" gnus-article-hide-citation
1293 "p" gnus-article-hide-pgp
1294 "P" gnus-article-hide-pem
1295 "\C-c" gnus-article-hide-citation-maybe)
1297 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1298 "a" gnus-article-highlight
1299 "h" gnus-article-highlight-headers
1300 "c" gnus-article-highlight-citation
1301 "s" gnus-article-highlight-signature)
1303 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1304 "z" gnus-article-date-ut
1305 "u" gnus-article-date-ut
1306 "l" gnus-article-date-local
1307 "e" gnus-article-date-lapsed
1308 "o" gnus-article-date-original
1309 "s" gnus-article-date-user)
1311 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1312 "t" gnus-article-remove-trailing-blank-lines
1313 "l" gnus-article-strip-leading-blank-lines
1314 "m" gnus-article-strip-multiple-blank-lines
1315 "a" gnus-article-strip-blank-lines
1316 "s" gnus-article-strip-leading-space)
1318 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1320 "f" gnus-summary-fetch-faq
1321 "d" gnus-summary-describe-group
1322 "h" gnus-summary-describe-briefly
1323 "i" gnus-info-find-node)
1325 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1326 "e" gnus-summary-expire-articles
1327 "\M-\C-e" gnus-summary-expire-articles-now
1328 "\177" gnus-summary-delete-article
1329 [delete] gnus-summary-delete-article
1330 "m" gnus-summary-move-article
1331 "r" gnus-summary-respool-article
1332 "w" gnus-summary-edit-article
1333 "c" gnus-summary-copy-article
1334 "B" gnus-summary-crosspost-article
1335 "q" gnus-summary-respool-query
1336 "i" gnus-summary-import-article
1337 "p" gnus-summary-article-posted-p)
1339 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1340 "o" gnus-summary-save-article
1341 "m" gnus-summary-save-article-mail
1342 "F" gnus-summary-write-article-file
1343 "r" gnus-summary-save-article-rmail
1344 "f" gnus-summary-save-article-file
1345 "b" gnus-summary-save-article-body-file
1346 "h" gnus-summary-save-article-folder
1347 "v" gnus-summary-save-article-vm
1348 "p" gnus-summary-pipe-output
1349 "s" gnus-soup-add-article))
1351 (defun gnus-summary-make-menu-bar ()
1352 (gnus-turn-off-edit-menu 'summary)
1354 (unless (boundp 'gnus-summary-misc-menu)
1357 gnus-summary-kill-menu gnus-summary-mode-map ""
1362 ["Enter score..." gnus-summary-score-entry t]
1363 ["Customize" gnus-score-customize t])
1364 (gnus-make-score-map 'increase)
1365 (gnus-make-score-map 'lower)
1367 ["Kill below" gnus-summary-kill-below t]
1368 ["Mark above" gnus-summary-mark-above t]
1369 ["Tick above" gnus-summary-tick-above t]
1370 ["Clear above" gnus-summary-clear-above t])
1371 ["Current score" gnus-summary-current-score t]
1372 ["Set score" gnus-summary-set-score t]
1373 ["Switch current score file..." gnus-score-change-score-file t]
1374 ["Set mark below..." gnus-score-set-mark-below t]
1375 ["Set expunge below..." gnus-score-set-expunge-below t]
1376 ["Edit current score file" gnus-score-edit-current-scores t]
1377 ["Edit score file" gnus-score-edit-file t]
1378 ["Trace score" gnus-score-find-trace t]
1379 ["Find words" gnus-score-find-favourite-words t]
1380 ["Rescore buffer" gnus-summary-rescore t]
1381 ["Increase score..." gnus-summary-increase-score t]
1382 ["Lower score..." gnus-summary-lower-score t]))))
1385 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1387 :selected (null gnus-score-default-header)]
1388 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1390 :selected (eq gnus-score-default-header 'a)]
1391 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1393 :selected (eq gnus-score-default-header 's)]
1395 (gnus-score-set-default 'gnus-score-default-header 'b)
1397 :selected (eq gnus-score-default-header 'b )]
1399 (gnus-score-set-default 'gnus-score-default-header 'h)
1401 :selected (eq gnus-score-default-header 'h )]
1402 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1404 :selected (eq gnus-score-default-header 'i )]
1405 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1407 :selected (eq gnus-score-default-header 't )]
1409 (gnus-score-set-default 'gnus-score-default-header 'x)
1411 :selected (eq gnus-score-default-header 'x )]
1412 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1414 :selected (eq gnus-score-default-header 'l )]
1415 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1417 :selected (eq gnus-score-default-header 'd )]
1418 ["Followups to author"
1419 (gnus-score-set-default 'gnus-score-default-header 'f)
1421 :selected (eq gnus-score-default-header 'f )])
1423 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1425 :selected (null gnus-score-default-type)]
1426 ;; The `:active' key is commented out in the following,
1427 ;; because the GNU Emacs hack to support radio buttons use
1428 ;; active to indicate which button is selected.
1429 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1431 ;; :active (not (memq gnus-score-default-header '(l d)))
1432 :selected (eq gnus-score-default-type 's)]
1433 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1435 ;; :active (not (memq gnus-score-default-header '(l d)))
1436 :selected (eq gnus-score-default-type 'r)]
1437 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1439 ;; :active (not (memq gnus-score-default-header '(l d)))
1440 :selected (eq gnus-score-default-type 'e)]
1441 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1443 ;; :active (not (memq gnus-score-default-header '(l d)))
1444 :selected (eq gnus-score-default-type 'f)]
1445 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1447 ;; :active (eq (gnus-score-default-header 'd))
1448 :selected (eq gnus-score-default-type 'b)]
1449 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1451 ;; :active (eq (gnus-score-default-header 'd))
1452 :selected (eq gnus-score-default-type 'n)]
1453 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1455 ;; :active (eq (gnus-score-default-header 'd))
1456 :selected (eq gnus-score-default-type 'a)]
1458 (gnus-score-set-default 'gnus-score-default-type '<)
1460 ;; :active (eq (gnus-score-default-header 'l))
1461 :selected (eq gnus-score-default-type '<)]
1463 (gnus-score-set-default 'gnus-score-default-type '=)
1465 ;; :active (eq (gnus-score-default-header 'l))
1466 :selected (eq gnus-score-default-type '=)]
1467 ["Greater than number"
1468 (gnus-score-set-default 'gnus-score-default-type '>)
1470 ;; :active (eq (gnus-score-default-header 'l))
1471 :selected (eq gnus-score-default-type '>)])
1472 ["Default fold" gnus-score-default-fold-toggle
1474 :selected gnus-score-default-fold]
1476 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1478 :selected (null gnus-score-default-duration)]
1480 (gnus-score-set-default 'gnus-score-default-duration 'p)
1482 :selected (eq gnus-score-default-duration 'p)]
1484 (gnus-score-set-default 'gnus-score-default-duration 't)
1486 :selected (eq gnus-score-default-duration 't)]
1488 (gnus-score-set-default 'gnus-score-default-duration 'i)
1490 :selected (eq gnus-score-default-duration 'i)]))
1493 gnus-summary-article-menu gnus-summary-mode-map ""
1496 ["All" gnus-article-hide t]
1497 ["Headers" gnus-article-hide-headers t]
1498 ["Signature" gnus-article-hide-signature t]
1499 ["Citation" gnus-article-hide-citation t]
1500 ["PGP" gnus-article-hide-pgp t]
1501 ["Boring headers" gnus-article-hide-boring-headers t])
1503 ["All" gnus-article-highlight t]
1504 ["Headers" gnus-article-highlight-headers t]
1505 ["Signature" gnus-article-highlight-signature t]
1506 ["Citation" gnus-article-highlight-citation t])
1508 ["Local" gnus-article-date-local t]
1509 ["UT" gnus-article-date-ut t]
1510 ["Original" gnus-article-date-original t]
1511 ["Lapsed" gnus-article-date-lapsed t]
1512 ["User-defined" gnus-article-date-user t])
1515 ["Leading" gnus-article-strip-leading-blank-lines t]
1516 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1517 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1518 ["All of the above" gnus-article-strip-blank-lines t]
1519 ["Leading space" gnus-article-strip-leading-space t])
1520 ["Overstrike" gnus-article-treat-overstrike t]
1521 ["Emphasis" gnus-article-emphasize t]
1522 ["Word wrap" gnus-article-fill-cited-article t]
1523 ["CR" gnus-article-remove-cr t]
1524 ["Show X-Face" gnus-article-display-x-face t]
1525 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1526 ["UnHTMLize" gnus-article-treat-html t]
1527 ["Rot 13" gnus-summary-caesar-message t]
1528 ["Unix pipe" gnus-summary-pipe-message t]
1529 ["Add buttons" gnus-article-add-buttons t]
1530 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1531 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1532 ["Toggle MIME" gnus-summary-toggle-mime t]
1533 ["Verbose header" gnus-summary-verbose-headers t]
1534 ["Toggle header" gnus-summary-toggle-header t])
1536 ["Save in default format" gnus-summary-save-article t]
1537 ["Save in file" gnus-summary-save-article-file t]
1538 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1539 ["Write to file" gnus-summary-write-article-mail t]
1540 ["Save in MH folder" gnus-summary-save-article-folder t]
1541 ["Save in VM folder" gnus-summary-save-article-vm t]
1542 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1543 ["Save body in file" gnus-summary-save-article-body-file t]
1544 ["Pipe through a filter" gnus-summary-pipe-output t]
1545 ["Add to SOUP packet" gnus-soup-add-article t]
1546 ["Print" gnus-summary-print-article t])
1548 ["Respool article..." gnus-summary-respool-article t]
1549 ["Move article..." gnus-summary-move-article
1550 (gnus-check-backend-function
1551 'request-move-article gnus-newsgroup-name)]
1552 ["Copy article..." gnus-summary-copy-article t]
1553 ["Crosspost article..." gnus-summary-crosspost-article
1554 (gnus-check-backend-function
1555 'request-replace-article gnus-newsgroup-name)]
1556 ["Import file..." gnus-summary-import-article t]
1557 ["Check if posted" gnus-summary-article-posted-p t]
1558 ["Edit article" gnus-summary-edit-article
1559 (not (gnus-group-read-only-p))]
1560 ["Delete article" gnus-summary-delete-article
1561 (gnus-check-backend-function
1562 'request-expire-articles gnus-newsgroup-name)]
1563 ["Query respool" gnus-summary-respool-query t]
1564 ["Delete expirable articles" gnus-summary-expire-articles-now
1565 (gnus-check-backend-function
1566 'request-expire-articles gnus-newsgroup-name)])
1568 ["Uudecode" gnus-uu-decode-uu t]
1569 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1570 ["Unshar" gnus-uu-decode-unshar t]
1571 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1572 ["Save" gnus-uu-decode-save t]
1573 ["Binhex" gnus-uu-decode-binhex t]
1574 ["Postscript" gnus-uu-decode-postscript t])
1576 ["Enter article" gnus-cache-enter-article t]
1577 ["Remove article" gnus-cache-remove-article t])
1578 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1579 ["Isearch article..." gnus-summary-isearch-article t]
1580 ["Beginning of the article" gnus-summary-beginning-of-article t]
1581 ["End of the article" gnus-summary-end-of-article t]
1582 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1583 ["Fetch referenced articles" gnus-summary-refer-references t]
1584 ["Fetch article with id..." gnus-summary-refer-article t]
1585 ["Redisplay" gnus-summary-show-article t]))
1588 gnus-summary-thread-menu gnus-summary-mode-map ""
1590 ["Toggle threading" gnus-summary-toggle-threads t]
1591 ["Hide threads" gnus-summary-hide-all-threads t]
1592 ["Show threads" gnus-summary-show-all-threads t]
1593 ["Hide thread" gnus-summary-hide-thread t]
1594 ["Show thread" gnus-summary-show-thread t]
1595 ["Go to next thread" gnus-summary-next-thread t]
1596 ["Go to previous thread" gnus-summary-prev-thread t]
1597 ["Go down thread" gnus-summary-down-thread t]
1598 ["Go up thread" gnus-summary-up-thread t]
1599 ["Top of thread" gnus-summary-top-thread t]
1600 ["Mark thread as read" gnus-summary-kill-thread t]
1601 ["Lower thread score" gnus-summary-lower-thread t]
1602 ["Raise thread score" gnus-summary-raise-thread t]
1603 ["Rethread current" gnus-summary-rethread-current t]
1607 gnus-summary-post-menu gnus-summary-mode-map ""
1609 ["Post an article" gnus-summary-post-news t]
1610 ["Followup" gnus-summary-followup t]
1611 ["Followup and yank" gnus-summary-followup-with-original t]
1612 ["Supersede article" gnus-summary-supersede-article t]
1613 ["Cancel article" gnus-summary-cancel-article t]
1614 ["Reply" gnus-summary-reply t]
1615 ["Reply and yank" gnus-summary-reply-with-original t]
1616 ["Wide reply" gnus-summary-wide-reply t]
1617 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1618 ["Mail forward" gnus-summary-mail-forward t]
1619 ["Post forward" gnus-summary-post-forward t]
1620 ["Digest and mail" gnus-uu-digest-mail-forward t]
1621 ["Digest and post" gnus-uu-digest-post-forward t]
1622 ["Resend message" gnus-summary-resend-message t]
1623 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1624 ["Send a mail" gnus-summary-mail-other-window t]
1625 ["Uuencode and post" gnus-uu-post-news t]
1626 ["Followup via news" gnus-summary-followup-to-mail t]
1627 ["Followup via news and yank"
1628 gnus-summary-followup-to-mail-with-original t]
1630 ;;["Send" gnus-summary-send-draft t]
1631 ;;["Send bounced" gnus-resend-bounced-mail t])
1635 gnus-summary-misc-menu gnus-summary-mode-map ""
1638 ["Mark as read" gnus-summary-mark-as-read-forward t]
1639 ["Mark same subject and select"
1640 gnus-summary-kill-same-subject-and-select t]
1641 ["Mark same subject" gnus-summary-kill-same-subject t]
1642 ["Catchup" gnus-summary-catchup t]
1643 ["Catchup all" gnus-summary-catchup-all t]
1644 ["Catchup to here" gnus-summary-catchup-to-here t]
1645 ["Catchup region" gnus-summary-mark-region-as-read t]
1646 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1648 ["Tick" gnus-summary-tick-article-forward t]
1649 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1650 ["Remove marks" gnus-summary-clear-mark-forward t]
1651 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1652 ["Set bookmark" gnus-summary-set-bookmark t]
1653 ["Remove bookmark" gnus-summary-remove-bookmark t])
1655 ["Marks..." gnus-summary-limit-to-marks t]
1656 ["Subject..." gnus-summary-limit-to-subject t]
1657 ["Author..." gnus-summary-limit-to-author t]
1658 ["Age..." gnus-summary-limit-to-age t]
1659 ["Score" gnus-summary-limit-to-score t]
1660 ["Unread" gnus-summary-limit-to-unread t]
1661 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1662 ["Articles" gnus-summary-limit-to-articles t]
1663 ["Pop limit" gnus-summary-pop-limit t]
1664 ["Show dormant" gnus-summary-limit-include-dormant t]
1665 ["Hide childless dormant"
1666 gnus-summary-limit-exclude-childless-dormant t]
1667 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1668 ["Show expunged" gnus-summary-show-all-expunged t])
1670 ["Set mark" gnus-summary-mark-as-processable t]
1671 ["Remove mark" gnus-summary-unmark-as-processable t]
1672 ["Remove all marks" gnus-summary-unmark-all-processable t]
1673 ["Mark above" gnus-uu-mark-over t]
1674 ["Mark series" gnus-uu-mark-series t]
1675 ["Mark region" gnus-uu-mark-region t]
1676 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1677 ["Mark all" gnus-uu-mark-all t]
1678 ["Mark buffer" gnus-uu-mark-buffer t]
1679 ["Mark sparse" gnus-uu-mark-sparse t]
1680 ["Mark thread" gnus-uu-mark-thread t]
1681 ["Unmark thread" gnus-uu-unmark-thread t]
1682 ("Process Mark Sets"
1683 ["Kill" gnus-summary-kill-process-mark t]
1684 ["Yank" gnus-summary-yank-process-mark
1685 gnus-newsgroup-process-stack]
1686 ["Save" gnus-summary-save-process-mark t]))
1688 ["Page forward" gnus-summary-next-page t]
1689 ["Page backward" gnus-summary-prev-page t]
1690 ["Line forward" gnus-summary-scroll-up t])
1692 ["Next unread article" gnus-summary-next-unread-article t]
1693 ["Previous unread article" gnus-summary-prev-unread-article t]
1694 ["Next article" gnus-summary-next-article t]
1695 ["Previous article" gnus-summary-prev-article t]
1696 ["Next unread subject" gnus-summary-next-unread-subject t]
1697 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1698 ["Next article same subject" gnus-summary-next-same-subject t]
1699 ["Previous article same subject" gnus-summary-prev-same-subject t]
1700 ["First unread article" gnus-summary-first-unread-article t]
1701 ["Best unread article" gnus-summary-best-unread-article t]
1702 ["Go to subject number..." gnus-summary-goto-subject t]
1703 ["Go to article number..." gnus-summary-goto-article t]
1704 ["Go to the last article" gnus-summary-goto-last-article t]
1705 ["Pop article off history" gnus-summary-pop-article t])
1707 ["Sort by number" gnus-summary-sort-by-number t]
1708 ["Sort by author" gnus-summary-sort-by-author t]
1709 ["Sort by subject" gnus-summary-sort-by-subject t]
1710 ["Sort by date" gnus-summary-sort-by-date t]
1711 ["Sort by score" gnus-summary-sort-by-score t]
1712 ["Sort by lines" gnus-summary-sort-by-lines t])
1714 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1715 ["Describe group" gnus-summary-describe-group t]
1716 ["Read manual" gnus-info-find-node t])
1718 ["Pick and read" gnus-pick-mode t]
1719 ["Binary" gnus-binary-mode t])
1721 ["Regenerate" gnus-summary-prepare t]
1722 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1723 ["Toggle threading" gnus-summary-toggle-threads t])
1724 ["Filter articles..." gnus-summary-execute-command t]
1725 ["Run command on subjects..." gnus-summary-universal-argument t]
1726 ["Search articles forward..." gnus-summary-search-article-forward t]
1727 ["Search articles backward..." gnus-summary-search-article-backward t]
1728 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1729 ["Expand window" gnus-summary-expand-window t]
1730 ["Expire expirable articles" gnus-summary-expire-articles
1731 (gnus-check-backend-function
1732 'request-expire-articles gnus-newsgroup-name)]
1733 ["Edit local kill file" gnus-summary-edit-local-kill t]
1734 ["Edit main kill file" gnus-summary-edit-global-kill t]
1736 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1737 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1738 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1739 ["Exit group" gnus-summary-exit t]
1740 ["Exit group without updating" gnus-summary-exit-no-update t]
1741 ["Exit and goto next group" gnus-summary-next-group t]
1742 ["Exit and goto prev group" gnus-summary-prev-group t]
1743 ["Reselect group" gnus-summary-reselect-current-group t]
1744 ["Rescan group" gnus-summary-rescan-group t]
1745 ["Update dribble" gnus-summary-save-newsrc t])))
1747 (run-hooks 'gnus-summary-menu-hook)))
1749 (defun gnus-score-set-default (var value)
1750 "A version of set that updates the GNU Emacs menu-bar."
1752 ;; It is the message that forces the active status to be updated.
1755 (defun gnus-make-score-map (type)
1756 "Make a summary score map of type TYPE."
1759 (let ((headers '(("author" "from" string)
1760 ("subject" "subject" string)
1761 ("article body" "body" string)
1762 ("article head" "head" string)
1763 ("xref" "xref" string)
1764 ("lines" "lines" number)
1765 ("followups to author" "followup" string)))
1766 (types '((number ("less than" <)
1769 (string ("substring" s)
1773 (perms '(("temporary" (current-time-string))
1781 (if (eq type 'lower)
1786 (setq header (car headers))
1792 (let ((ts (cdr (assoc (nth 2 header) types)))
1808 'gnus-summary-score-entry
1810 (if (or (string= (nth 1 header)
1812 (string= (nth 1 header)
1815 (list 'gnus-summary-header
1817 (list 'quote (nth 1 (car ts)))
1818 (list 'gnus-score-default nil)
1824 (list (nreverse outp))))
1827 (list (nreverse outt))))
1829 (setq headers (cdr headers)))
1830 (list (nreverse outh))))))))
1834 (defun gnus-summary-mode (&optional group)
1835 "Major mode for reading articles.
1837 All normal editing commands are switched off.
1838 \\<gnus-summary-mode-map>
1839 Each line in this buffer represents one article. To read an
1840 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1841 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1844 You can also post articles and send mail from this buffer. To
1845 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1846 of an article, type `\\[gnus-summary-reply]'.
1848 There are approx. one gazillion commands you can execute in this
1849 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1851 The following commands are available:
1853 \\{gnus-summary-mode-map}"
1855 (when (gnus-visual-p 'summary-menu 'menu)
1856 (gnus-summary-make-menu-bar))
1857 (kill-all-local-variables)
1858 (gnus-summary-make-local-variables)
1859 (gnus-make-thread-indent-array)
1860 (gnus-simplify-mode-line)
1861 (setq major-mode 'gnus-summary-mode)
1862 (setq mode-name "Summary")
1863 (make-local-variable 'minor-mode-alist)
1864 (use-local-map gnus-summary-mode-map)
1865 (buffer-disable-undo (current-buffer))
1866 (setq buffer-read-only t) ;Disable modification
1867 (setq truncate-lines t)
1868 (setq selective-display t)
1869 (setq selective-display-ellipses t) ;Display `...'
1870 (setq buffer-display-table gnus-summary-display-table)
1871 (gnus-set-default-directory)
1872 (setq gnus-newsgroup-name group)
1873 (make-local-variable 'gnus-summary-line-format)
1874 (make-local-variable 'gnus-summary-line-format-spec)
1875 (make-local-variable 'gnus-summary-mark-positions)
1876 (make-local-hook 'post-command-hook)
1877 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1878 (run-hooks 'gnus-summary-mode-hook)
1879 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1880 (gnus-update-summary-mark-positions))
1882 (defun gnus-summary-make-local-variables ()
1883 "Make all the local summary buffer variables."
1884 (let ((locals gnus-summary-local-variables)
1886 (while (setq local (pop locals))
1889 (if (eq (cdr local) 'global)
1890 ;; Copy the global value of the variable.
1891 (setq global (symbol-value (car local)))
1892 ;; Use the value from the list.
1893 (setq global (eval (cdr local))))
1894 (make-local-variable (car local))
1895 (set (car local) global))
1896 ;; Simple nil-valued local variable.
1897 (make-local-variable local)
1900 (defun gnus-summary-clear-local-variables ()
1901 (let ((locals gnus-summary-local-variables))
1903 (if (consp (car locals))
1904 (and (vectorp (caar locals))
1905 (set (caar locals) nil))
1906 (and (vectorp (car locals))
1907 (set (car locals) nil)))
1908 (setq locals (cdr locals)))))
1910 ;; Summary data functions.
1912 (defmacro gnus-data-number (data)
1915 (defmacro gnus-data-set-number (data number)
1916 `(setcar ,data ,number))
1918 (defmacro gnus-data-mark (data)
1921 (defmacro gnus-data-set-mark (data mark)
1922 `(setcar (nthcdr 1 ,data) ,mark))
1924 (defmacro gnus-data-pos (data)
1927 (defmacro gnus-data-set-pos (data pos)
1928 `(setcar (nthcdr 2 ,data) ,pos))
1930 (defmacro gnus-data-header (data)
1933 (defmacro gnus-data-set-header (data header)
1934 `(setf (nth 3 ,data) ,header))
1936 (defmacro gnus-data-level (data)
1939 (defmacro gnus-data-unread-p (data)
1940 `(= (nth 1 ,data) gnus-unread-mark))
1942 (defmacro gnus-data-read-p (data)
1943 `(/= (nth 1 ,data) gnus-unread-mark))
1945 (defmacro gnus-data-pseudo-p (data)
1946 `(consp (nth 3 ,data)))
1948 (defmacro gnus-data-find (number)
1949 `(assq ,number gnus-newsgroup-data))
1951 (defmacro gnus-data-find-list (number &optional data)
1952 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1953 (memq (assq ,number bdata)
1956 (defmacro gnus-data-make (number mark pos header level)
1957 `(list ,number ,mark ,pos ,header ,level))
1959 (defun gnus-data-enter (after-article number mark pos header level offset)
1960 (let ((data (gnus-data-find-list after-article)))
1962 (error "No such article: %d" after-article))
1963 (setcdr data (cons (gnus-data-make number mark pos header level)
1965 (setq gnus-newsgroup-data-reverse nil)
1966 (gnus-data-update-list (cddr data) offset)))
1968 (defun gnus-data-enter-list (after-article list &optional offset)
1970 (let ((data (and after-article (gnus-data-find-list after-article)))
1972 (or data (not after-article) (error "No such article: %d" after-article))
1973 ;; Find the last element in the list to be spliced into the main
1976 (setq list (cdr list)))
1979 (setcdr list gnus-newsgroup-data)
1980 (setq gnus-newsgroup-data ilist)
1982 (gnus-data-update-list (cdr list) offset)))
1983 (setcdr list (cdr data))
1986 (gnus-data-update-list (cdr list) offset)))
1987 (setq gnus-newsgroup-data-reverse nil))))
1989 (defun gnus-data-remove (article &optional offset)
1990 (let ((data gnus-newsgroup-data))
1991 (if (= (gnus-data-number (car data)) article)
1993 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
1994 gnus-newsgroup-data-reverse nil)
1996 (gnus-data-update-list gnus-newsgroup-data offset)))
1998 (when (= (gnus-data-number (cadr data)) article)
1999 (setcdr data (cddr data))
2001 (gnus-data-update-list (cdr data) offset))
2003 gnus-newsgroup-data-reverse nil))
2004 (setq data (cdr data))))))
2006 (defmacro gnus-data-list (backward)
2008 (or gnus-newsgroup-data-reverse
2009 (setq gnus-newsgroup-data-reverse
2010 (reverse gnus-newsgroup-data)))
2011 gnus-newsgroup-data))
2013 (defun gnus-data-update-list (data offset)
2014 "Add OFFSET to the POS of all data entries in DATA."
2016 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2017 (setq data (cdr data))))
2019 (defun gnus-data-compute-positions ()
2020 "Compute the positions of all articles."
2021 (let ((data gnus-newsgroup-data)
2024 (when (setq pos (text-property-any
2025 (point-min) (point-max)
2026 'gnus-number (gnus-data-number (car data))))
2027 (gnus-data-set-pos (car data) (+ pos 3)))
2028 (setq data (cdr data)))))
2030 (defun gnus-summary-article-pseudo-p (article)
2031 "Say whether this article is a pseudo article or not."
2032 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2034 (defmacro gnus-summary-article-sparse-p (article)
2035 "Say whether this article is a sparse article or not."
2036 ` (memq ,article gnus-newsgroup-sparse))
2038 (defmacro gnus-summary-article-ancient-p (article)
2039 "Say whether this article is a sparse article or not."
2040 `(memq ,article gnus-newsgroup-ancient))
2042 (defun gnus-article-parent-p (number)
2043 "Say whether this article is a parent or not."
2044 (let ((data (gnus-data-find-list number)))
2045 (and (cdr data) ; There has to be an article after...
2046 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2047 (gnus-data-level (nth 1 data))))))
2049 (defun gnus-article-children (number)
2050 "Return a list of all children to NUMBER."
2051 (let* ((data (gnus-data-find-list number))
2052 (level (gnus-data-level (car data)))
2054 (setq data (cdr data))
2056 (= (gnus-data-level (car data)) (1+ level)))
2057 (push (gnus-data-number (car data)) children)
2058 (setq data (cdr data)))
2061 (defmacro gnus-summary-skip-intangible ()
2062 "If the current article is intangible, then jump to a different article."
2063 '(let ((to (get-text-property (point) 'gnus-intangible)))
2064 (and to (gnus-summary-goto-subject to))))
2066 (defmacro gnus-summary-article-intangible-p ()
2067 "Say whether this article is intangible or not."
2068 '(get-text-property (point) 'gnus-intangible))
2070 (defun gnus-article-read-p (article)
2071 "Say whether ARTICLE is read or not."
2072 (not (or (memq article gnus-newsgroup-marked)
2073 (memq article gnus-newsgroup-unreads)
2074 (memq article gnus-newsgroup-unselected)
2075 (memq article gnus-newsgroup-dormant))))
2077 ;; Some summary mode macros.
2079 (defmacro gnus-summary-article-number ()
2080 "The article number of the article on the current line.
2081 If there isn's an article number here, then we return the current
2084 (gnus-summary-skip-intangible)
2085 (or (get-text-property (point) 'gnus-number)
2086 (gnus-summary-last-subject))))
2088 (defmacro gnus-summary-article-header (&optional number)
2089 `(gnus-data-header (gnus-data-find
2090 ,(or number '(gnus-summary-article-number)))))
2092 (defmacro gnus-summary-thread-level (&optional number)
2093 `(if (and (eq gnus-summary-make-false-root 'dummy)
2094 (get-text-property (point) 'gnus-intangible))
2096 (gnus-data-level (gnus-data-find
2097 ,(or number '(gnus-summary-article-number))))))
2099 (defmacro gnus-summary-article-mark (&optional number)
2100 `(gnus-data-mark (gnus-data-find
2101 ,(or number '(gnus-summary-article-number)))))
2103 (defmacro gnus-summary-article-pos (&optional number)
2104 `(gnus-data-pos (gnus-data-find
2105 ,(or number '(gnus-summary-article-number)))))
2107 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2108 (defmacro gnus-summary-article-subject (&optional number)
2109 "Return current subject string or nil if nothing."
2112 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2113 '(gnus-data-header (assq (gnus-summary-article-number)
2114 gnus-newsgroup-data)))))
2117 (mail-header-subject headers))))
2119 (defmacro gnus-summary-article-score (&optional number)
2120 "Return current article score."
2121 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2122 gnus-newsgroup-scored))
2123 gnus-summary-default-score 0))
2125 (defun gnus-summary-article-children (&optional number)
2126 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2127 (level (gnus-data-level (car data)))
2129 (while (and (setq data (cdr data))
2130 (> (setq l (gnus-data-level (car data))) level))
2131 (and (= (1+ level) l)
2132 (push (gnus-data-number (car data))
2134 (nreverse children)))
2136 (defun gnus-summary-article-parent (&optional number)
2137 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2138 (gnus-data-list t)))
2139 (level (gnus-data-level (car data))))
2141 () ; This is a root.
2142 ;; We search until we find an article with a level less than
2143 ;; this one. That function has to be the parent.
2144 (while (and (setq data (cdr data))
2145 (not (< (gnus-data-level (car data)) level))))
2146 (and data (gnus-data-number (car data))))))
2148 (defun gnus-unread-mark-p (mark)
2149 "Say whether MARK is the unread mark."
2150 (= mark gnus-unread-mark))
2152 (defun gnus-read-mark-p (mark)
2153 "Say whether MARK is one of the marks that mark as read.
2154 This is all marks except unread, ticked, dormant, and expirable."
2155 (not (or (= mark gnus-unread-mark)
2156 (= mark gnus-ticked-mark)
2157 (= mark gnus-dormant-mark)
2158 (= mark gnus-expirable-mark))))
2160 (defmacro gnus-article-mark (number)
2162 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2163 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2164 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2165 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2166 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2167 gnus-ancient-mark))))
2169 ;; Saving hidden threads.
2171 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2172 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2174 (defmacro gnus-save-hidden-threads (&rest forms)
2175 "Save hidden threads, eval FORMS, and restore the hidden threads."
2176 (let ((config (make-symbol "config")))
2177 `(let ((,config (gnus-hidden-threads-configuration)))
2181 (gnus-restore-hidden-threads-configuration ,config)))))
2183 (defun gnus-hidden-threads-configuration ()
2184 "Return the current hidden threads configuration."
2187 (goto-char (point-min))
2188 (while (search-forward "\r" nil t)
2189 (push (1- (point)) config))
2192 (defun gnus-restore-hidden-threads-configuration (config)
2193 "Restore hidden threads configuration from CONFIG."
2194 (let (point buffer-read-only)
2195 (while (setq point (pop config))
2196 (when (and (< point (point-max))
2198 (= (following-char) ?\n))
2199 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2201 ;; Various summary mode internalish functions.
2203 (defun gnus-mouse-pick-article (e)
2206 (gnus-summary-next-page nil t))
2208 (defun gnus-summary-setup-buffer (group)
2209 "Initialize summary buffer."
2210 (let ((buffer (concat "*Summary " group "*")))
2211 (if (get-buffer buffer)
2214 (setq gnus-summary-buffer (current-buffer))
2215 (not gnus-newsgroup-prepared))
2216 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2217 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2218 (gnus-add-current-to-buffer-list)
2219 (gnus-summary-mode group)
2221 (gnus-carpal-setup-buffer 'summary))
2222 (unless gnus-single-article-buffer
2223 (make-local-variable 'gnus-article-buffer)
2224 (make-local-variable 'gnus-article-current)
2225 (make-local-variable 'gnus-original-article-buffer))
2226 (setq gnus-newsgroup-name group)
2229 (defun gnus-set-global-variables ()
2230 ;; Set the global equivalents of the summary buffer-local variables
2231 ;; to the latest values they had. These reflect the summary buffer
2232 ;; that was in action when the last article was fetched.
2233 (when (eq major-mode 'gnus-summary-mode)
2234 (setq gnus-summary-buffer (current-buffer))
2235 (let ((name gnus-newsgroup-name)
2236 (marked gnus-newsgroup-marked)
2237 (unread gnus-newsgroup-unreads)
2238 (headers gnus-current-headers)
2239 (data gnus-newsgroup-data)
2240 (summary gnus-summary-buffer)
2241 (article-buffer gnus-article-buffer)
2242 (original gnus-original-article-buffer)
2243 (gac gnus-article-current)
2244 (reffed gnus-reffed-article-number)
2245 (score-file gnus-current-score-file))
2247 (set-buffer gnus-group-buffer)
2248 (setq gnus-newsgroup-name name)
2249 (setq gnus-newsgroup-marked marked)
2250 (setq gnus-newsgroup-unreads unread)
2251 (setq gnus-current-headers headers)
2252 (setq gnus-newsgroup-data data)
2253 (setq gnus-article-current gac)
2254 (setq gnus-summary-buffer summary)
2255 (setq gnus-article-buffer article-buffer)
2256 (setq gnus-original-article-buffer original)
2257 (setq gnus-reffed-article-number reffed)
2258 (setq gnus-current-score-file score-file)
2259 ;; The article buffer also has local variables.
2260 (when (gnus-buffer-live-p gnus-article-buffer)
2261 (set-buffer gnus-article-buffer)
2262 (setq gnus-summary-buffer summary))))))
2264 (defun gnus-summary-article-unread-p (article)
2265 "Say whether ARTICLE is unread or not."
2266 (memq article gnus-newsgroup-unreads))
2268 (defun gnus-summary-first-article-p (&optional article)
2269 "Return whether ARTICLE is the first article in the buffer."
2270 (if (not (setq article (or article (gnus-summary-article-number))))
2272 (eq article (caar gnus-newsgroup-data))))
2274 (defun gnus-summary-last-article-p (&optional article)
2275 "Return whether ARTICLE is the last article in the buffer."
2276 (if (not (setq article (or article (gnus-summary-article-number))))
2277 t ; All non-existent numbers are the last article. :-)
2278 (not (cdr (gnus-data-find-list article)))))
2280 (defun gnus-make-thread-indent-array ()
2282 (unless (and gnus-thread-indent-array
2283 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2284 (setq gnus-thread-indent-array (make-vector 201 "")
2285 gnus-thread-indent-array-level gnus-thread-indent-level)
2287 (aset gnus-thread-indent-array n
2288 (make-string (* n gnus-thread-indent-level) ? ))
2291 (defun gnus-update-summary-mark-positions ()
2292 "Compute where the summary marks are to go."
2294 (when (and gnus-summary-buffer
2295 (get-buffer gnus-summary-buffer)
2296 (buffer-name (get-buffer gnus-summary-buffer)))
2297 (set-buffer gnus-summary-buffer))
2298 (let ((gnus-replied-mark 129)
2299 (gnus-score-below-mark 130)
2300 (gnus-score-over-mark 130)
2301 (spec gnus-summary-line-format-spec)
2302 thread gnus-visual pos)
2304 (gnus-set-work-buffer)
2305 (let ((gnus-summary-line-format-spec spec))
2306 (gnus-summary-insert-line
2307 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2308 (goto-char (point-min))
2309 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2311 (goto-char (point-min))
2312 (push (cons 'replied (and (search-forward "\201" nil t)
2315 (goto-char (point-min))
2316 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2318 (setq gnus-summary-mark-positions pos))))
2320 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2321 "Insert a dummy root in the summary buffer."
2323 (gnus-add-text-properties
2324 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2325 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2327 (defun gnus-summary-insert-line (gnus-tmp-header
2328 gnus-tmp-level gnus-tmp-current
2329 gnus-tmp-unread gnus-tmp-replied
2330 gnus-tmp-expirable gnus-tmp-subject-or-nil
2331 &optional gnus-tmp-dummy gnus-tmp-score
2333 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2334 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2335 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2336 (gnus-tmp-score-char
2337 (if (or (null gnus-summary-default-score)
2338 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2339 gnus-summary-zcore-fuzz))
2341 (if (< gnus-tmp-score gnus-summary-default-score)
2342 gnus-score-below-mark gnus-score-over-mark)))
2344 (cond (gnus-tmp-process gnus-process-mark)
2345 ((memq gnus-tmp-current gnus-newsgroup-cached)
2347 (gnus-tmp-replied gnus-replied-mark)
2348 ((memq gnus-tmp-current gnus-newsgroup-saved)
2350 (t gnus-unread-mark)))
2351 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2354 ((string-match "<[^>]+> *$" gnus-tmp-from)
2355 (let ((beg (match-beginning 0)))
2356 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2357 (substring gnus-tmp-from (1+ (match-beginning 0))
2358 (1- (match-end 0))))
2359 (substring gnus-tmp-from 0 beg))))
2360 ((string-match "(.+)" gnus-tmp-from)
2361 (substring gnus-tmp-from
2362 (1+ (match-beginning 0)) (1- (match-end 0))))
2364 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2365 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2366 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2367 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2368 (buffer-read-only nil))
2369 (when (string= gnus-tmp-name "")
2370 (setq gnus-tmp-name gnus-tmp-from))
2371 (unless (numberp gnus-tmp-lines)
2372 (setq gnus-tmp-lines 0))
2373 (gnus-put-text-property
2375 (progn (eval gnus-summary-line-format-spec) (point))
2376 'gnus-number gnus-tmp-number)
2377 (when (gnus-visual-p 'summary-highlight 'highlight)
2379 (run-hooks 'gnus-summary-update-hook)
2382 (defun gnus-summary-update-line (&optional dont-update)
2383 ;; Update summary line after change.
2384 (when (and gnus-summary-default-score
2385 (not gnus-summary-inhibit-highlight))
2386 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2387 (article (gnus-summary-article-number))
2388 (score (gnus-summary-article-score article)))
2390 (if (and gnus-summary-mark-below
2391 (< (gnus-summary-article-score)
2392 gnus-summary-mark-below))
2393 ;; This article has a low score, so we mark it as read.
2394 (when (memq article gnus-newsgroup-unreads)
2395 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2396 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2397 ;; This article was previously marked as read on account
2398 ;; of a low score, but now it has risen, so we mark it as
2400 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2401 (gnus-summary-update-mark
2402 (if (or (null gnus-summary-default-score)
2403 (<= (abs (- score gnus-summary-default-score))
2404 gnus-summary-zcore-fuzz))
2406 (if (< score gnus-summary-default-score)
2407 gnus-score-below-mark gnus-score-over-mark))
2409 ;; Do visual highlighting.
2410 (when (gnus-visual-p 'summary-highlight 'highlight)
2411 (run-hooks 'gnus-summary-update-hook)))))
2413 (defvar gnus-tmp-new-adopts nil)
2415 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2416 "Return the number of articles in THREAD.
2417 This may be 0 in some cases -- if none of the articles in
2418 the thread are to be displayed."
2420 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2422 ((not (listp thread))
2424 ((and (consp thread) (cdr thread))
2427 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2430 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2433 (when (and level (zerop level) gnus-tmp-new-adopts)
2436 'gnus-summary-number-of-articles-in-thread
2437 gnus-tmp-new-adopts))))
2439 (if (> number 1) gnus-not-empty-thread-mark
2440 gnus-empty-thread-mark)
2443 (defun gnus-summary-set-local-parameters (group)
2444 "Go through the local params of GROUP and set all variable specs in that list."
2445 (let ((params (gnus-group-find-parameter group))
2448 (setq elem (car params)
2449 params (cdr params))
2450 (and (consp elem) ; Has to be a cons.
2451 (consp (cdr elem)) ; The cdr has to be a list.
2452 (symbolp (car elem)) ; Has to be a symbol in there.
2453 (not (memq (car elem)
2454 '(quit-config to-address to-list to-group)))
2455 (ignore-errors ; So we set it.
2456 (make-local-variable (car elem))
2457 (set (car elem) (eval (nth 1 elem))))))))
2459 (defun gnus-summary-read-group (group &optional show-all no-article
2460 kill-buffer no-display)
2461 "Start reading news in newsgroup GROUP.
2462 If SHOW-ALL is non-nil, already read articles are also listed.
2463 If NO-ARTICLE is non-nil, no article is selected initially.
2464 If NO-DISPLAY, don't generate a summary buffer."
2465 ;; Killed foreign groups can't be entered.
2466 (when (and (not (gnus-group-native-p group))
2467 (not (gnus-gethash group gnus-newsrc-hashtb)))
2468 (error "Dead non-native groups can't be entered"))
2469 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2470 (let* ((new-group (gnus-summary-setup-buffer group))
2471 (quit-config (gnus-group-quit-config group))
2472 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2474 ;; This summary buffer exists already, so we just select it.
2476 (gnus-set-global-variables)
2478 (gnus-kill-or-deaden-summary kill-buffer))
2479 (gnus-configure-windows 'summary 'force)
2480 (gnus-set-mode-line 'summary)
2481 (gnus-summary-position-point)
2484 ;; We couldn't select this group.
2486 (when (and (eq major-mode 'gnus-summary-mode)
2487 (not (equal (current-buffer) kill-buffer)))
2488 (kill-buffer (current-buffer))
2489 (if (not quit-config)
2491 (set-buffer gnus-group-buffer)
2492 (gnus-group-jump-to-group group)
2493 (gnus-group-next-unread-group 1))
2494 (gnus-handle-ephemeral-exit quit-config)))
2495 (gnus-message 3 "Can't select group")
2497 ;; The user did a `C-g' while prompting for number of articles,
2498 ;; so we exit this group.
2499 ((eq did-select 'quit)
2500 (and (eq major-mode 'gnus-summary-mode)
2501 (not (equal (current-buffer) kill-buffer))
2502 (kill-buffer (current-buffer)))
2504 (gnus-kill-or-deaden-summary kill-buffer))
2505 (if (not quit-config)
2507 (set-buffer gnus-group-buffer)
2508 (gnus-group-jump-to-group group)
2509 (gnus-group-next-unread-group 1)
2510 (gnus-configure-windows 'group 'force))
2511 (gnus-handle-ephemeral-exit quit-config))
2512 ;; Finally signal the quit.
2514 ;; The group was successfully selected.
2516 (gnus-set-global-variables)
2517 ;; Save the active value in effect when the group was entered.
2518 (setq gnus-newsgroup-active
2520 (gnus-active gnus-newsgroup-name)))
2521 ;; You can change the summary buffer in some way with this hook.
2522 (run-hooks 'gnus-select-group-hook)
2523 ;; Set any local variables in the group parameters.
2524 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2525 (gnus-update-format-specifications
2526 nil 'summary 'summary-mode 'summary-dummy)
2527 ;; Do score processing.
2528 (when gnus-use-scoring
2529 (gnus-possibly-score-headers))
2530 ;; Check whether to fill in the gaps in the threads.
2531 (when gnus-build-sparse-threads
2532 (gnus-build-sparse-threads))
2533 ;; Find the initial limit.
2534 (if gnus-show-threads
2536 (let ((gnus-newsgroup-dormant nil))
2537 (gnus-summary-initial-limit show-all))
2538 (gnus-summary-initial-limit show-all))
2539 (setq gnus-newsgroup-limit
2541 (lambda (header) (mail-header-number header))
2542 gnus-newsgroup-headers)))
2543 ;; Generate the summary buffer.
2545 (gnus-summary-prepare))
2546 (when gnus-use-trees
2547 (gnus-tree-open group)
2548 (setq gnus-summary-highlight-line-function
2549 'gnus-tree-highlight-article))
2550 ;; If the summary buffer is empty, but there are some low-scored
2551 ;; articles or some excluded dormants, we include these in the
2553 (when (and (zerop (buffer-size))
2555 (cond (gnus-newsgroup-dormant
2556 (gnus-summary-limit-include-dormant))
2557 ((and gnus-newsgroup-scored show-all)
2558 (gnus-summary-limit-include-expunged t))))
2559 ;; Function `gnus-apply-kill-file' must be called in this hook.
2560 (run-hooks 'gnus-apply-kill-hook)
2561 (if (and (zerop (buffer-size))
2564 ;; This newsgroup is empty.
2565 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2566 (gnus-message 6 "No unread news")
2568 (gnus-kill-or-deaden-summary kill-buffer))
2569 ;; Return nil from this function.
2571 ;; Hide conversation thread subtrees. We cannot do this in
2572 ;; gnus-summary-prepare-hook since kill processing may not
2573 ;; work with hidden articles.
2574 (and gnus-show-threads
2575 gnus-thread-hide-subtree
2576 (gnus-summary-hide-all-threads))
2577 ;; Show first unread article if requested.
2578 (if (and (not no-article)
2580 gnus-newsgroup-unreads
2581 gnus-auto-select-first)
2582 (unless (if (eq gnus-auto-select-first 'best)
2583 (gnus-summary-best-unread-article)
2584 (gnus-summary-first-unread-article))
2585 (gnus-configure-windows 'summary))
2586 ;; Don't select any articles, just move point to the first
2587 ;; article in the group.
2588 (goto-char (point-min))
2589 (gnus-summary-position-point)
2590 (gnus-set-mode-line 'summary)
2591 (gnus-configure-windows 'summary 'force))
2593 (gnus-kill-or-deaden-summary kill-buffer))
2594 (when (get-buffer-window gnus-group-buffer t)
2595 ;; Gotta use windows, because recenter does weird stuff if
2596 ;; the current buffer ain't the displayed window.
2597 (let ((owin (selected-window)))
2598 (select-window (get-buffer-window gnus-group-buffer t))
2599 (when (gnus-group-goto-group group)
2601 (select-window owin))))
2602 ;; Mark this buffer as "prepared".
2603 (setq gnus-newsgroup-prepared t)
2606 (defun gnus-summary-prepare ()
2607 "Generate the summary buffer."
2609 (let ((buffer-read-only nil))
2611 (setq gnus-newsgroup-data nil
2612 gnus-newsgroup-data-reverse nil)
2613 (run-hooks 'gnus-summary-generate-hook)
2614 ;; Generate the buffer, either with threads or without.
2615 (when gnus-newsgroup-headers
2616 (gnus-summary-prepare-threads
2617 (if gnus-show-threads
2618 (gnus-sort-gathered-threads
2619 (funcall gnus-summary-thread-gathering-function
2621 (gnus-cut-threads (gnus-make-threads)))))
2622 ;; Unthreaded display.
2623 (gnus-sort-articles gnus-newsgroup-headers))))
2624 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2625 ;; Call hooks for modifying summary buffer.
2626 (goto-char (point-min))
2627 (run-hooks 'gnus-summary-prepare-hook)))
2629 (defsubst gnus-general-simplify-subject (subject)
2630 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2633 ;; Truncate the subject.
2634 ((numberp gnus-summary-gather-subject-limit)
2635 (setq subject (gnus-simplify-subject-re subject))
2636 (if (> (length subject) gnus-summary-gather-subject-limit)
2637 (substring subject 0 gnus-summary-gather-subject-limit)
2639 ;; Fuzzily simplify it.
2640 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2641 (gnus-simplify-subject-fuzzy subject))
2642 ;; Just remove the leading "Re:".
2644 (gnus-simplify-subject-re subject))))
2646 (if (and gnus-summary-gather-exclude-subject
2647 (string-match gnus-summary-gather-exclude-subject subject))
2648 nil ; This article shouldn't be gathered
2651 (defun gnus-summary-simplify-subject-query ()
2652 "Query where the respool algorithm would put this article."
2654 (gnus-set-global-variables)
2655 (gnus-summary-select-article)
2656 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2658 (defun gnus-gather-threads-by-subject (threads)
2659 "Gather threads by looking at Subject headers."
2660 (if (not gnus-summary-make-false-root)
2662 (let ((hashtb (gnus-make-hashtable 1024))
2665 subject hthread whole-subject)
2667 (setq subject (gnus-general-simplify-subject
2668 (setq whole-subject (mail-header-subject
2671 (if (setq hthread (gnus-gethash subject hashtb))
2673 ;; We enter a dummy root into the thread, if we
2674 ;; haven't done that already.
2675 (unless (stringp (caar hthread))
2676 (setcar hthread (list whole-subject (car hthread))))
2677 ;; We add this new gathered thread to this gathered
2679 (setcdr (car hthread)
2680 (nconc (cdar hthread) (list (car threads))))
2681 ;; Remove it from the list of threads.
2682 (setcdr prev (cdr threads))
2683 (setq threads prev))
2684 ;; Enter this thread into the hash table.
2685 (gnus-sethash subject threads hashtb)))
2687 (setq threads (cdr threads)))
2690 (defun gnus-gather-threads-by-references (threads)
2691 "Gather threads by looking at References headers."
2692 (let ((idhashtb (gnus-make-hashtable 1024))
2693 (thhashtb (gnus-make-hashtable 1024))
2696 ids references id gthread gid entered ref)
2698 (when (setq references (mail-header-references (caar threads)))
2699 (setq id (mail-header-id (caar threads))
2700 ids (gnus-split-references references)
2702 (while (setq ref (pop ids))
2703 (setq ids (delete ref ids))
2704 (if (not (setq gid (gnus-gethash ref idhashtb)))
2706 (gnus-sethash ref id idhashtb)
2707 (gnus-sethash id threads thhashtb))
2708 (setq gthread (gnus-gethash gid thhashtb))
2710 ;; We enter a dummy root into the thread, if we
2711 ;; haven't done that already.
2712 (unless (stringp (caar gthread))
2713 (setcar gthread (list (mail-header-subject (caar gthread))
2715 ;; We add this new gathered thread to this gathered
2717 (setcdr (car gthread)
2718 (nconc (cdar gthread) (list (car threads)))))
2719 ;; Add it into the thread hash table.
2720 (gnus-sethash id gthread thhashtb)
2722 ;; Remove it from the list of threads.
2723 (setcdr prev (cdr threads))
2724 (setq threads prev))))
2726 (setq threads (cdr threads)))
2729 (defun gnus-sort-gathered-threads (threads)
2730 "Sort subtreads inside each gathered thread by article number."
2731 (let ((result threads))
2733 (when (stringp (caar threads))
2734 (setcdr (car threads)
2735 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2736 (setq threads (cdr threads)))
2739 (defun gnus-thread-loop-p (root thread)
2740 "Say whether ROOT is in THREAD."
2741 (let ((th (cdr thread)))
2743 (not (eq (caar th) root)))
2746 ;; We have found a loop.
2748 (setcdr thread (delq (car th) (cdr thread)))
2749 (if (boundp (setq ref-dep (intern "none"
2750 gnus-newsgroup-dependencies)))
2751 (setcdr (symbol-value ref-dep)
2752 (nconc (cdr (symbol-value ref-dep))
2754 (set ref-dep (list nil (car th))))
2756 ;; Recurse down into the sub-threads and look for loops.
2759 (lambda (thread) (gnus-thread-loop-p root thread))
2762 (defun gnus-make-threads ()
2763 "Go through the dependency hashtb and find the roots. Return all threads."
2765 (while (catch 'infloop
2768 ;; Deal with self-referencing References loops.
2769 (when (and (car (symbol-value refs))
2776 (car (symbol-value refs)) thread))
2777 (cdr (symbol-value refs)))))))
2780 (unless (car (symbol-value refs))
2781 ;; These threads do not refer back to any other articles,
2782 ;; so they're roots.
2783 (setq threads (append (cdr (symbol-value refs)) threads))))
2784 gnus-newsgroup-dependencies)))
2787 (defun gnus-build-sparse-threads ()
2788 (let ((headers gnus-newsgroup-headers)
2789 (deps gnus-newsgroup-dependencies)
2790 header references generation relations
2791 cthread subject child end pthread relation)
2792 ;; First we create an alist of generations/relations, where
2793 ;; generations is how much we trust the relation, and the relation
2795 (gnus-message 7 "Making sparse threads...")
2797 (nnheader-set-temp-buffer " *gnus sparse threads*")
2798 (while (setq header (pop headers))
2799 (when (and (setq references (mail-header-references header))
2800 (not (string= references "")))
2802 (setq child (mail-header-id header)
2803 subject (mail-header-subject header))
2805 (while (search-backward ">" nil t)
2806 (setq end (1+ (point)))
2807 (when (search-backward "<" nil t)
2808 (push (list (incf generation)
2809 child (setq child (buffer-substring (point) end))
2812 (push (list (1+ generation) child nil subject) relations)
2814 (kill-buffer (current-buffer)))
2815 ;; Sort over trustworthiness.
2816 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2817 (while (setq relation (pop relations))
2818 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2819 (unless (car (symbol-value cthread))
2820 ;; Make this article the parent of these threads.
2821 (setcar (symbol-value cthread)
2822 (vector gnus-reffed-article-number
2826 (or (caddr relation) "") 0 0 "")))
2827 (set cthread (list (vector gnus-reffed-article-number
2829 "" "" (cadr relation)
2830 (or (caddr relation) "") 0 0 ""))))
2831 (push gnus-reffed-article-number gnus-newsgroup-limit)
2832 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2833 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2834 gnus-newsgroup-reads)
2835 (decf gnus-reffed-article-number)
2836 ;; Make this new thread the child of its parent.
2837 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2838 (setcdr (symbol-value pthread)
2839 (nconc (cdr (symbol-value pthread))
2840 (list (symbol-value cthread))))
2841 (set pthread (list nil (symbol-value cthread))))))
2842 (gnus-message 7 "Making sparse threads...done")))
2844 (defun gnus-build-old-threads ()
2845 ;; Look at all the articles that refer back to old articles, and
2846 ;; fetch the headers for the articles that aren't there. This will
2847 ;; build complete threads - if the roots haven't been expired by the
2852 (when (not (car (symbol-value refs)))
2853 (setq heads (cdr (symbol-value refs)))
2855 (if (memq (mail-header-number (caar heads))
2856 gnus-newsgroup-dormant)
2857 (setq heads (cdr heads))
2858 (setq id (symbol-name refs))
2859 (while (and (setq id (gnus-build-get-header id))
2860 (not (car (gnus-gethash
2861 id gnus-newsgroup-dependencies)))))
2862 (setq heads nil)))))
2863 gnus-newsgroup-dependencies)))
2865 (defun gnus-build-get-header (id)
2866 ;; Look through the buffer of NOV lines and find the header to
2867 ;; ID. Enter this line into the dependencies hash table, and return
2868 ;; the id of the parent article (if any).
2869 (let ((deps gnus-newsgroup-dependencies)
2873 (set-buffer nntp-server-buffer)
2874 (goto-char (point-min))
2875 (while (and (not found) (search-forward id nil t))
2877 (setq found (looking-at
2878 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2879 (regexp-quote id))))
2880 (or found (beginning-of-line 2)))
2884 (setq header (gnus-nov-parse-line
2885 (read (current-buffer)) deps))
2886 (gnus-parent-id (mail-header-references header)))))
2888 (let ((number (mail-header-number header)))
2889 (push number gnus-newsgroup-limit)
2890 (push header gnus-newsgroup-headers)
2891 (if (memq number gnus-newsgroup-unselected)
2893 (push number gnus-newsgroup-unreads)
2894 (setq gnus-newsgroup-unselected
2895 (delq number gnus-newsgroup-unselected)))
2896 (push number gnus-newsgroup-ancient)))))))
2898 (defun gnus-summary-update-article-line (article header)
2899 "Update the line for ARTICLE using HEADERS."
2900 (let* ((id (mail-header-id header))
2901 (thread (gnus-id-to-thread id)))
2903 (error "Article in no thread"))
2904 ;; Update the thread.
2905 (setcar thread header)
2906 (gnus-summary-goto-subject article)
2907 (let* ((datal (gnus-data-find-list article))
2909 (length (when (cdr datal)
2910 (- (gnus-data-pos data)
2911 (gnus-data-pos (cadr datal)))))
2912 (buffer-read-only nil)
2913 (level (gnus-summary-thread-level)))
2915 (gnus-summary-insert-line
2916 header level nil (gnus-article-mark article)
2917 (memq article gnus-newsgroup-replied)
2918 (memq article gnus-newsgroup-expirable)
2919 ;; Only insert the Subject string when it's different
2920 ;; from the previous Subject string.
2921 (unless (gnus-subject-equal
2923 (mail-header-subject
2926 (gnus-data-find-list
2928 (gnus-data-list t)))))
2930 (mail-header-subject header))
2931 (mail-header-subject header))
2932 nil (cdr (assq article gnus-newsgroup-scored))
2933 (memq article gnus-newsgroup-processable))
2935 (gnus-data-update-list
2936 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
2938 (defun gnus-summary-update-article (article &optional iheader)
2939 "Update ARTICLE in the summary buffer."
2940 (set-buffer gnus-summary-buffer)
2941 (let* ((header (or iheader (gnus-summary-article-header article)))
2942 (id (mail-header-id header))
2943 (data (gnus-data-find article))
2944 (thread (gnus-id-to-thread id))
2945 (references (mail-header-references header))
2949 (when (and references
2950 (not (equal "" references)))
2953 (buffer-read-only nil)
2955 (number (mail-header-number header))
2958 ;; !!! Should this be in or not?
2960 (setcar thread nil))
2962 (delq thread parent))
2963 (if (gnus-summary-insert-subject id header iheader)
2964 ;; Set the (possibly) new article number in the data structure.
2965 (gnus-data-set-number data (gnus-id-to-article id))
2969 (defun gnus-rebuild-thread (id)
2970 "Rebuild the thread containing ID."
2971 (let ((buffer-read-only nil)
2972 old-pos current thread data)
2973 (if (not gnus-show-threads)
2974 (setq thread (list (car (gnus-id-to-thread id))))
2975 ;; Get the thread this article is part of.
2976 (setq thread (gnus-remove-thread id)))
2977 (setq old-pos (gnus-point-at-bol))
2978 (setq current (save-excursion
2979 (and (zerop (forward-line -1))
2980 (gnus-summary-article-number))))
2981 ;; If this is a gathered thread, we have to go some re-gathering.
2982 (when (stringp (car thread))
2983 (let ((subject (car thread))
2985 (setq thread (cdr thread))
2987 (unless (memq (setq thr (gnus-id-to-thread
2989 (mail-header-id (caar thread)))))
2992 (setq thread (cdr thread)))
2993 ;; We now have all (unique) roots.
2994 (if (= (length roots) 1)
2995 ;; All the loose roots are now one solid root.
2996 (setq thread (car roots))
2997 (setq thread (cons subject (gnus-sort-threads roots))))))
2999 ;; We then insert this thread into the summary buffer.
3000 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3001 (if gnus-show-threads
3002 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3003 (gnus-summary-prepare-unthreaded thread))
3004 (setq data (nreverse gnus-newsgroup-data))
3005 (setq threads gnus-newsgroup-threads))
3006 ;; We splice the new data into the data structure.
3007 (gnus-data-enter-list current data (- (point) old-pos))
3008 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3010 (defun gnus-number-to-header (number)
3011 "Return the header for article NUMBER."
3012 (let ((headers gnus-newsgroup-headers))
3014 (not (= number (mail-header-number (car headers)))))
3019 (defun gnus-parent-headers (headers &optional generation)
3020 "Return the headers of the GENERATIONeth parent of HEADERS."
3022 (setq generation 1))
3023 (let (references parent)
3024 (while (and headers (not (zerop generation)))
3025 (setq references (mail-header-references headers))
3026 (when (and references
3027 (setq parent (gnus-parent-id references))
3028 (setq headers (car (gnus-id-to-thread parent))))
3032 (defun gnus-id-to-thread (id)
3033 "Return the (sub-)thread where ID appears."
3034 (gnus-gethash id gnus-newsgroup-dependencies))
3036 (defun gnus-id-to-article (id)
3037 "Return the article number of ID."
3038 (let ((thread (gnus-id-to-thread id)))
3041 (mail-header-number (car thread)))))
3043 (defun gnus-id-to-header (id)
3044 "Return the article headers of ID."
3045 (car (gnus-id-to-thread id)))
3047 (defun gnus-article-displayed-root-p (article)
3048 "Say whether ARTICLE is a root(ish) article."
3049 (let ((level (gnus-summary-thread-level article))
3050 (refs (mail-header-references (gnus-summary-article-header article)))
3056 ((null (gnus-parent-id refs)) t)
3058 (null (setq particle (gnus-id-to-article
3059 (gnus-parent-id refs))))
3060 (null (gnus-summary-thread-level particle)))))))
3062 (defun gnus-root-id (id)
3063 "Return the id of the root of the thread where ID appears."
3065 (while (and id (setq prev (car (gnus-gethash
3066 id gnus-newsgroup-dependencies))))
3068 id (gnus-parent-id (mail-header-references prev))))
3071 (defun gnus-remove-thread (id &optional dont-remove)
3072 "Remove the thread that has ID in it."
3073 (let ((dep gnus-newsgroup-dependencies)
3074 headers thread last-id)
3075 ;; First go up in this thread until we find the root.
3076 (setq last-id (gnus-root-id id))
3077 (setq headers (list (car (gnus-id-to-thread last-id))
3078 (caadr (gnus-id-to-thread last-id))))
3079 ;; We have now found the real root of this thread. It might have
3080 ;; been gathered into some loose thread, so we have to search
3081 ;; through the threads to find the thread we wanted.
3082 (let ((threads gnus-newsgroup-threads)
3085 (setq sub (car threads))
3086 (if (stringp (car sub))
3087 ;; This is a gathered thread, so we look at the roots
3088 ;; below it to find whether this article is in this
3091 (setq sub (cdr sub))
3093 (when (member (caar sub) headers)
3094 (setq thread (car threads)
3097 (setq sub (cdr sub))))
3098 ;; It's an ordinary thread, so we check it.
3099 (when (eq (car sub) (car headers))
3102 (setq threads (cdr threads)))
3103 ;; If this article is in no thread, then it's a root.
3106 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3107 (setq thread (gnus-gethash last-id dep)))
3110 thread ; We return this thread.
3112 (if (stringp (car thread))
3114 ;; If we use dummy roots, then we have to remove the
3115 ;; dummy root as well.
3116 (when (eq gnus-summary-make-false-root 'dummy)
3118 (gnus-data-compute-positions))
3119 (setq thread (cdr thread))
3121 (gnus-remove-thread-1 (car thread))
3122 (setq thread (cdr thread))))
3123 (gnus-remove-thread-1 thread))))))))
3125 (defun gnus-remove-thread-1 (thread)
3126 "Remove the thread THREAD recursively."
3127 (let ((number (mail-header-number (pop thread)))
3129 (setq thread (reverse thread))
3131 (gnus-remove-thread-1 (pop thread)))
3132 (when (setq d (gnus-data-find number))
3133 (goto-char (gnus-data-pos d))
3136 (- (gnus-point-at-bol)
3138 (1+ (gnus-point-at-eol))
3139 (gnus-delete-line)))))))
3141 (defun gnus-sort-threads (threads)
3143 (if (not gnus-thread-sort-functions)
3145 (gnus-message 7 "Sorting threads...")
3147 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3148 (gnus-message 7 "Sorting threads...done"))))
3150 (defun gnus-sort-articles (articles)
3152 (when gnus-article-sort-functions
3153 (gnus-message 7 "Sorting articles...")
3155 (setq gnus-newsgroup-headers
3156 (sort articles (gnus-make-sort-function
3157 gnus-article-sort-functions)))
3158 (gnus-message 7 "Sorting articles...done"))))
3160 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3161 (defmacro gnus-thread-header (thread)
3162 ;; Return header of first article in THREAD.
3163 ;; Note that THREAD must never, ever be anything else than a variable -
3164 ;; using some other form will lead to serious barfage.
3165 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3166 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3167 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3170 (defsubst gnus-article-sort-by-number (h1 h2)
3171 "Sort articles by article number."
3172 (< (mail-header-number h1)
3173 (mail-header-number h2)))
3175 (defun gnus-thread-sort-by-number (h1 h2)
3176 "Sort threads by root article number."
3177 (gnus-article-sort-by-number
3178 (gnus-thread-header h1) (gnus-thread-header h2)))
3180 (defsubst gnus-article-sort-by-lines (h1 h2)
3181 "Sort articles by article Lines header."
3182 (< (mail-header-lines h1)
3183 (mail-header-lines h2)))
3185 (defun gnus-thread-sort-by-lines (h1 h2)
3186 "Sort threads by root article Lines header."
3187 (gnus-article-sort-by-lines
3188 (gnus-thread-header h1) (gnus-thread-header h2)))
3190 (defsubst gnus-article-sort-by-author (h1 h2)
3191 "Sort articles by root author."
3193 (let ((extract (funcall
3194 gnus-extract-address-components
3195 (mail-header-from h1))))
3196 (or (car extract) (cadr extract) ""))
3197 (let ((extract (funcall
3198 gnus-extract-address-components
3199 (mail-header-from h2))))
3200 (or (car extract) (cadr extract) ""))))
3202 (defun gnus-thread-sort-by-author (h1 h2)
3203 "Sort threads by root author."
3204 (gnus-article-sort-by-author
3205 (gnus-thread-header h1) (gnus-thread-header h2)))
3207 (defsubst gnus-article-sort-by-subject (h1 h2)
3208 "Sort articles by root subject."
3210 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3211 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3213 (defun gnus-thread-sort-by-subject (h1 h2)
3214 "Sort threads by root subject."
3215 (gnus-article-sort-by-subject
3216 (gnus-thread-header h1) (gnus-thread-header h2)))
3218 (defsubst gnus-article-sort-by-date (h1 h2)
3219 "Sort articles by root article date."
3221 (gnus-date-get-time (mail-header-date h1))
3222 (gnus-date-get-time (mail-header-date h2))))
3224 (defun gnus-thread-sort-by-date (h1 h2)
3225 "Sort threads by root article date."
3226 (gnus-article-sort-by-date
3227 (gnus-thread-header h1) (gnus-thread-header h2)))
3229 (defsubst gnus-article-sort-by-score (h1 h2)
3230 "Sort articles by root article score.
3231 Unscored articles will be counted as having a score of zero."
3232 (> (or (cdr (assq (mail-header-number h1)
3233 gnus-newsgroup-scored))
3234 gnus-summary-default-score 0)
3235 (or (cdr (assq (mail-header-number h2)
3236 gnus-newsgroup-scored))
3237 gnus-summary-default-score 0)))
3239 (defun gnus-thread-sort-by-score (h1 h2)
3240 "Sort threads by root article score."
3241 (gnus-article-sort-by-score
3242 (gnus-thread-header h1) (gnus-thread-header h2)))
3244 (defun gnus-thread-sort-by-total-score (h1 h2)
3245 "Sort threads by the sum of all scores in the thread.
3246 Unscored articles will be counted as having a score of zero."
3247 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3249 (defun gnus-thread-total-score (thread)
3250 ;; This function find the total score of THREAD.
3251 (cond ((null thread)
3254 (if (stringp (car thread))
3255 (apply gnus-thread-score-function 0
3256 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3257 (gnus-thread-total-score-1 thread)))
3259 (gnus-thread-total-score-1 (list thread)))))
3261 (defun gnus-thread-total-score-1 (root)
3262 ;; This function find the total score of the thread below ROOT.
3263 (setq root (car root))
3264 (apply gnus-thread-score-function
3266 (mapcar 'gnus-thread-total-score
3267 (cdr (gnus-gethash (mail-header-id root)
3268 gnus-newsgroup-dependencies)))
3269 (when (> (mail-header-number root) 0)
3270 (list (or (cdr (assq (mail-header-number root)
3271 gnus-newsgroup-scored))
3272 gnus-summary-default-score 0))))
3273 (list gnus-summary-default-score)
3276 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3277 (defvar gnus-tmp-prev-subject nil)
3278 (defvar gnus-tmp-false-parent nil)
3279 (defvar gnus-tmp-root-expunged nil)
3280 (defvar gnus-tmp-dummy-line nil)
3282 (defun gnus-summary-prepare-threads (threads)
3283 "Prepare summary buffer from THREADS and indentation LEVEL.
3284 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3285 or a straight list of headers."
3286 (gnus-message 7 "Generating summary...")
3288 (setq gnus-newsgroup-threads threads)
3291 (let ((gnus-tmp-level 0)
3292 (default-score (or gnus-summary-default-score 0))
3293 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3294 thread number subject stack state gnus-tmp-gathered beg-match
3295 new-roots gnus-tmp-new-adopts thread-end
3296 gnus-tmp-header gnus-tmp-unread
3297 gnus-tmp-replied gnus-tmp-subject-or-nil
3298 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3299 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3300 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3302 (setq gnus-tmp-prev-subject nil)
3304 (if (vectorp (car threads))
3305 ;; If this is a straight (sic) list of headers, then a
3306 ;; threaded summary display isn't required, so we just create
3307 ;; an unthreaded one.
3308 (gnus-summary-prepare-unthreaded threads)
3310 ;; Do the threaded display.
3312 (while (or threads stack gnus-tmp-new-adopts new-roots)
3314 (if (and (= gnus-tmp-level 0)
3315 (not (setq gnus-tmp-dummy-line nil))
3318 (not gnus-tmp-false-parent)
3319 (or gnus-tmp-new-adopts new-roots))
3320 (if gnus-tmp-new-adopts
3321 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3322 thread (list (car gnus-tmp-new-adopts))
3323 gnus-tmp-header (caar thread)
3324 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3326 (setq thread (list (car new-roots))
3327 gnus-tmp-header (caar thread)
3328 new-roots (cdr new-roots))))
3331 ;; If there are some threads, we do them before the
3332 ;; threads on the stack.
3333 (setq thread threads
3334 gnus-tmp-header (caar thread))
3335 ;; There were no current threads, so we pop something off
3337 (setq state (car stack)
3338 gnus-tmp-level (car state)
3341 gnus-tmp-header (caar thread))))
3343 (setq gnus-tmp-false-parent nil)
3344 (setq gnus-tmp-root-expunged nil)
3345 (setq thread-end nil)
3347 (if (stringp gnus-tmp-header)
3348 ;; The header is a dummy root.
3350 ((eq gnus-summary-make-false-root 'adopt)
3351 ;; We let the first article adopt the rest.
3352 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3354 (setq gnus-tmp-gathered
3356 (lambda (h) (mail-header-number (car h)))
3359 (setq thread (cons (list (caar thread)
3362 (setq gnus-tmp-level -1
3363 gnus-tmp-false-parent t))
3364 ((eq gnus-summary-make-false-root 'empty)
3365 ;; We print adopted articles with empty subject fields.
3366 (setq gnus-tmp-gathered
3368 (lambda (h) (mail-header-number (car h)))
3371 (setq gnus-tmp-level -1))
3372 ((eq gnus-summary-make-false-root 'dummy)
3373 ;; We remember that we probably want to output a dummy
3375 (setq gnus-tmp-dummy-line gnus-tmp-header)
3376 (setq gnus-tmp-prev-subject gnus-tmp-header))
3378 ;; We do not make a root for the gathered
3379 ;; sub-threads at all.
3380 (setq gnus-tmp-level -1)))
3382 (setq number (mail-header-number gnus-tmp-header)
3383 subject (mail-header-subject gnus-tmp-header))
3386 ;; If the thread has changed subject, we might want to make
3387 ;; this subthread into a root.
3388 ((and (null gnus-thread-ignore-subject)
3389 (not (zerop gnus-tmp-level))
3390 gnus-tmp-prev-subject
3392 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3393 (setq new-roots (nconc new-roots (list (car thread)))
3395 gnus-tmp-header nil))
3396 ;; If the article lies outside the current limit,
3397 ;; then we do not display it.
3398 ((not (memq number gnus-newsgroup-limit))
3399 (setq gnus-tmp-gathered
3401 (lambda (h) (mail-header-number (car h)))
3404 (setq gnus-tmp-new-adopts (if (cdar thread)
3405 (append gnus-tmp-new-adopts
3407 gnus-tmp-new-adopts)
3409 gnus-tmp-header nil)
3410 (when (zerop gnus-tmp-level)
3411 (setq gnus-tmp-root-expunged t)))
3412 ;; Perhaps this article is to be marked as read?
3413 ((and gnus-summary-mark-below
3414 (< (or (cdr (assq number gnus-newsgroup-scored))
3416 gnus-summary-mark-below)
3417 ;; Don't touch sparse articles.
3418 (not (gnus-summary-article-sparse-p number))
3419 (not (gnus-summary-article-ancient-p number)))
3420 (setq gnus-newsgroup-unreads
3421 (delq number gnus-newsgroup-unreads))
3422 (if gnus-newsgroup-auto-expire
3423 (push number gnus-newsgroup-expirable)
3424 (push (cons number gnus-low-score-mark)
3425 gnus-newsgroup-reads))))
3427 (when gnus-tmp-header
3428 ;; We may have an old dummy line to output before this
3430 (when gnus-tmp-dummy-line
3431 (gnus-summary-insert-dummy-line
3432 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3433 (setq gnus-tmp-dummy-line nil))
3435 ;; Compute the mark.
3436 (setq gnus-tmp-unread (gnus-article-mark number))
3438 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3439 gnus-tmp-header gnus-tmp-level)
3440 gnus-newsgroup-data)
3442 ;; Actually insert the line.
3444 gnus-tmp-subject-or-nil
3446 ((and gnus-thread-ignore-subject
3447 gnus-tmp-prev-subject
3448 (not (inline (gnus-subject-equal
3449 gnus-tmp-prev-subject subject))))
3451 ((zerop gnus-tmp-level)
3452 (if (and (eq gnus-summary-make-false-root 'empty)
3453 (memq number gnus-tmp-gathered)
3454 gnus-tmp-prev-subject
3455 (inline (gnus-subject-equal
3456 gnus-tmp-prev-subject subject)))
3457 gnus-summary-same-subject
3459 (t gnus-summary-same-subject)))
3460 (if (and (eq gnus-summary-make-false-root 'adopt)
3461 (= gnus-tmp-level 1)
3462 (memq number gnus-tmp-gathered))
3463 (setq gnus-tmp-opening-bracket ?\<
3464 gnus-tmp-closing-bracket ?\>)
3465 (setq gnus-tmp-opening-bracket ?\[
3466 gnus-tmp-closing-bracket ?\]))
3468 gnus-tmp-indentation
3469 (aref gnus-thread-indent-array gnus-tmp-level)
3470 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3471 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3472 gnus-summary-default-score 0)
3474 (if (or (null gnus-summary-default-score)
3475 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3476 gnus-summary-zcore-fuzz))
3478 (if (< gnus-tmp-score gnus-summary-default-score)
3479 gnus-score-below-mark gnus-score-over-mark))
3481 (cond ((memq number gnus-newsgroup-processable)
3483 ((memq number gnus-newsgroup-cached)
3485 ((memq number gnus-newsgroup-replied)
3487 ((memq number gnus-newsgroup-saved)
3489 (t gnus-unread-mark))
3490 gnus-tmp-from (mail-header-from gnus-tmp-header)
3493 ((string-match "<[^>]+> *$" gnus-tmp-from)
3494 (setq beg-match (match-beginning 0))
3495 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3496 (substring gnus-tmp-from (1+ (match-beginning 0))
3497 (1- (match-end 0))))
3498 (substring gnus-tmp-from 0 beg-match)))
3499 ((string-match "(.+)" gnus-tmp-from)
3500 (substring gnus-tmp-from
3501 (1+ (match-beginning 0)) (1- (match-end 0))))
3503 (when (string= gnus-tmp-name "")
3504 (setq gnus-tmp-name gnus-tmp-from))
3505 (unless (numberp gnus-tmp-lines)
3506 (setq gnus-tmp-lines 0))
3507 (gnus-put-text-property
3509 (progn (eval gnus-summary-line-format-spec) (point))
3510 'gnus-number number)
3513 (run-hooks 'gnus-summary-update-hook)
3516 (setq gnus-tmp-prev-subject subject)))
3518 (when (nth 1 thread)
3519 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3520 (incf gnus-tmp-level)
3521 (setq threads (if thread-end nil (cdar thread)))
3523 (setq gnus-tmp-level 0)))))
3524 (gnus-message 7 "Generating summary...done"))
3526 (defun gnus-summary-prepare-unthreaded (headers)
3527 "Generate an unthreaded summary buffer based on HEADERS."
3528 (let (header number mark)
3533 ;; We may have to root out some bad articles...
3534 (when (memq (setq number (mail-header-number
3535 (setq header (pop headers))))
3536 gnus-newsgroup-limit)
3537 ;; Mark article as read when it has a low score.
3538 (when (and gnus-summary-mark-below
3539 (< (or (cdr (assq number gnus-newsgroup-scored))
3540 gnus-summary-default-score 0)
3541 gnus-summary-mark-below)
3542 (not (gnus-summary-article-ancient-p number)))
3543 (setq gnus-newsgroup-unreads
3544 (delq number gnus-newsgroup-unreads))
3545 (if gnus-newsgroup-auto-expire
3546 (push number gnus-newsgroup-expirable)
3547 (push (cons number gnus-low-score-mark)
3548 gnus-newsgroup-reads)))
3550 (setq mark (gnus-article-mark number))
3551 (push (gnus-data-make number mark (1+ (point)) header 0)
3552 gnus-newsgroup-data)
3553 (gnus-summary-insert-line
3555 mark (memq number gnus-newsgroup-replied)
3556 (memq number gnus-newsgroup-expirable)
3557 (mail-header-subject header) nil
3558 (cdr (assq number gnus-newsgroup-scored))
3559 (memq number gnus-newsgroup-processable))))))
3561 (defun gnus-select-newsgroup (group &optional read-all)
3562 "Select newsgroup GROUP.
3563 If READ-ALL is non-nil, all articles in the group are selected."
3564 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3565 (info (nth 2 entry))
3566 articles fetched-articles cached)
3568 (unless (gnus-check-server
3569 (setq gnus-current-select-method
3570 (gnus-find-method-for-group group)))
3571 (error "Couldn't open server"))
3573 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3574 (gnus-activate-group group) ; Or we can activate it...
3575 (progn ; Or we bug out.
3576 (when (equal major-mode 'gnus-summary-mode)
3577 (kill-buffer (current-buffer)))
3578 (error "Couldn't request group %s: %s"
3579 group (gnus-status-message group))))
3581 (unless (gnus-request-group group t)
3582 (when (equal major-mode 'gnus-summary-mode)
3583 (kill-buffer (current-buffer)))
3584 (error "Couldn't request group %s: %s"
3585 group (gnus-status-message group)))
3587 (setq gnus-newsgroup-name group)
3588 (setq gnus-newsgroup-unselected nil)
3589 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3591 ;; Adjust and set lists of article marks.
3593 (gnus-adjust-marked-articles info))
3595 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3596 (when (gnus-virtual-group-p group)
3597 (setq cached gnus-newsgroup-cached))
3599 (setq gnus-newsgroup-unreads
3600 (gnus-set-difference
3601 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3602 gnus-newsgroup-dormant))
3604 (setq gnus-newsgroup-processable nil)
3606 (gnus-update-read-articles group gnus-newsgroup-unreads)
3607 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3608 (gnus-group-update-group group))
3610 (setq articles (gnus-articles-to-read group read-all))
3614 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3616 ((eq articles 0) nil)
3618 ;; Init the dependencies hash table.
3619 (setq gnus-newsgroup-dependencies
3620 (gnus-make-hashtable (length articles)))
3621 ;; Retrieve the headers and read them in.
3622 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3623 (setq gnus-newsgroup-headers
3625 (setq gnus-headers-retrieved-by
3626 (gnus-retrieve-headers
3627 articles gnus-newsgroup-name
3628 ;; We might want to fetch old headers, but
3629 ;; not if there is only 1 article.
3630 (and gnus-fetch-old-headers
3632 (not (eq gnus-fetch-old-headers 'some))
3633 (not (numberp gnus-fetch-old-headers)))
3634 (> (length articles) 1))))))
3635 (gnus-get-newsgroup-headers-xover
3636 articles nil nil gnus-newsgroup-name t)
3637 (gnus-get-newsgroup-headers)))
3638 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3640 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3642 (setq gnus-newsgroup-cached cached))
3644 ;; Suppress duplicates?
3645 (when gnus-suppress-duplicates
3646 (gnus-dup-suppress-articles))
3648 ;; Set the initial limit.
3649 (setq gnus-newsgroup-limit (copy-sequence articles))
3650 ;; Remove canceled articles from the list of unread articles.
3651 (setq gnus-newsgroup-unreads
3652 (gnus-set-sorted-intersection
3653 gnus-newsgroup-unreads
3654 (setq fetched-articles
3655 (mapcar (lambda (headers) (mail-header-number headers))
3656 gnus-newsgroup-headers))))
3657 ;; Removed marked articles that do not exist.
3658 (gnus-update-missing-marks
3659 (gnus-sorted-complement fetched-articles articles))
3660 ;; We might want to build some more threads first.
3661 (and gnus-fetch-old-headers
3662 (eq gnus-headers-retrieved-by 'nov)
3663 (gnus-build-old-threads))
3664 ;; Check whether auto-expire is to be done in this group.
3665 (setq gnus-newsgroup-auto-expire
3666 (gnus-group-auto-expirable-p group))
3667 ;; Set up the article buffer now, if necessary.
3668 (unless gnus-single-article-buffer
3669 (gnus-article-setup-buffer))
3670 ;; First and last article in this newsgroup.
3671 (when gnus-newsgroup-headers
3672 (setq gnus-newsgroup-begin
3673 (mail-header-number (car gnus-newsgroup-headers))
3676 (gnus-last-element gnus-newsgroup-headers))))
3677 ;; GROUP is successfully selected.
3678 (or gnus-newsgroup-headers t)))))
3680 (defun gnus-articles-to-read (group &optional read-all)
3681 ;; Find out what articles the user wants to read.
3683 ;; Select all articles if `read-all' is non-nil, or if there
3684 ;; are no unread articles.
3686 (and (zerop (length gnus-newsgroup-marked))
3687 (zerop (length gnus-newsgroup-unreads)))
3688 (eq (gnus-group-find-parameter group 'display)
3690 (gnus-uncompress-range (gnus-active group))
3691 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3692 (copy-sequence gnus-newsgroup-unreads))
3694 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3695 (scored (length scored-list))
3696 (number (length articles))
3697 (marked (+ (length gnus-newsgroup-marked)
3698 (length gnus-newsgroup-dormant)))
3706 ((and (or (<= scored marked) (= scored number))
3707 (numberp gnus-large-newsgroup)
3708 (> number gnus-large-newsgroup))
3712 "How many articles from %s (default %d): "
3713 (gnus-limit-string gnus-newsgroup-name 35)
3715 (if (string-match "^[ \t]*$" input) number input)))
3716 ((and (> scored marked) (< scored number)
3717 (> (- scored number) 20))
3720 (format "%s %s (%d scored, %d total): "
3721 "How many articles from"
3722 group scored number))))
3723 (if (string-match "^[ \t]*$" input)
3727 (setq select (if (stringp select) (string-to-number select) select))
3728 (if (or (null select) (zerop select))
3730 (if (and (not (zerop scored)) (<= (abs select) scored))
3732 (setq articles (sort scored-list '<))
3733 (setq number (length articles)))
3734 (setq articles (copy-sequence articles)))
3736 (when (< (abs select) number)
3738 ;; Select the N oldest articles.
3739 (setcdr (nthcdr (1- (abs select)) articles) nil)
3740 ;; Select the N most recent articles.
3741 (setq articles (nthcdr (- number select) articles))))
3742 (setq gnus-newsgroup-unselected
3743 (gnus-sorted-intersection
3744 gnus-newsgroup-unreads
3745 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3748 (defun gnus-killed-articles (killed articles)
3751 (when (inline (gnus-member-of-range (car articles) killed))
3752 (push (car articles) out))
3753 (setq articles (cdr articles)))
3756 (defun gnus-uncompress-marks (marks)
3757 "Uncompress the mark ranges in MARKS."
3758 (let ((uncompressed '(score bookmark))
3761 (if (memq (caar marks) uncompressed)
3762 (push (car marks) out)
3763 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3764 (setq marks (cdr marks)))
3767 (defun gnus-adjust-marked-articles (info)
3768 "Set all article lists and remove all marks that are no longer legal."
3769 (let* ((marked-lists (gnus-info-marks info))
3770 (active (gnus-active (gnus-info-group info)))
3773 (types gnus-article-mark-lists)
3774 (uncompressed '(score bookmark killed))
3775 marks var articles article mark)
3778 (setq marks (pop marked-lists))
3779 (set (setq var (intern (format "gnus-newsgroup-%s"
3780 (car (rassq (setq mark (car marks))
3782 (if (memq (car marks) uncompressed) (cdr marks)
3783 (gnus-uncompress-range (cdr marks))))
3785 (setq articles (symbol-value var))
3787 ;; All articles have to be subsets of the active articles.
3789 ;; Adjust "simple" lists.
3790 ((memq mark '(tick dormant expirable reply save))
3792 (when (or (< (setq article (pop articles)) min) (> article max))
3793 (set var (delq article (symbol-value var))))))
3795 ((memq mark uncompressed)
3797 (when (or (not (consp (setq article (pop articles))))
3798 (< (car article) min)
3799 (> (car article) max))
3800 (set var (delq article (symbol-value var))))))))))
3802 (defun gnus-update-missing-marks (missing)
3803 "Go through the list of MISSING articles and remove them mark lists."
3805 (let ((types gnus-article-mark-lists)
3807 ;; Go through all types.
3809 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3810 (when (symbol-value var)
3811 ;; This list has articles. So we delete all missing articles
3815 (set var (delq (pop m) (symbol-value var)))))))))
3817 (defun gnus-update-marks ()
3818 "Enter the various lists of marked articles into the newsgroup info list."
3819 (let ((types gnus-article-mark-lists)
3820 (info (gnus-get-info gnus-newsgroup-name))
3821 (uncompressed '(score bookmark killed))
3822 type list newmarked symbol)
3824 ;; Add all marks lists that are non-nil to the list of marks lists.
3825 (while (setq type (pop types))
3826 (when (setq list (symbol-value
3828 (intern (format "gnus-newsgroup-%s"
3831 ;; Get rid of the entries of the articles that have the
3833 (when (and (eq (cdr type) 'score)
3837 (prev (cons nil articles))
3840 (if (or (not (consp (car arts)))
3841 (= (cdar arts) gnus-summary-default-score))
3842 (setcdr prev (cdr arts))
3844 (setq arts (cdr arts)))
3845 (setq list (cdr all))))
3847 (push (cons (cdr type)
3848 (if (memq (cdr type) uncompressed) list
3849 (gnus-compress-sequence
3850 (set symbol (sort list '<)) t)))
3853 ;; Enter these new marks into the info of the group.
3855 (setcar (nthcdr 3 info) newmarked)
3856 ;; Add the marks lists to the end of the info.
3858 (setcdr (nthcdr 2 info) (list newmarked))))
3860 ;; Cut off the end of the info if there's nothing else there.
3864 (when (nthcdr (decf i) info)
3865 (setcdr (nthcdr i info) nil)))))))
3867 (defun gnus-set-mode-line (where)
3868 "This function sets the mode line of the article or summary buffers.
3869 If WHERE is `summary', the summary mode line format will be used."
3870 ;; Is this mode line one we keep updated?
3871 (when (memq where gnus-updated-mode-lines)
3874 ;; We evaluate this in the summary buffer since these
3875 ;; variables are buffer-local to that buffer.
3876 (set-buffer gnus-summary-buffer)
3877 ;; We bind all these variables that are used in the `eval' form
3879 (let* ((mformat (symbol-value
3881 (format "gnus-%s-mode-line-format-spec" where))))
3882 (gnus-tmp-group-name gnus-newsgroup-name)
3883 (gnus-tmp-article-number (or gnus-current-article 0))
3884 (gnus-tmp-unread gnus-newsgroup-unreads)
3885 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3886 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3887 (gnus-tmp-unread-and-unselected
3888 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3889 (zerop gnus-tmp-unselected))
3891 ((zerop gnus-tmp-unselected)
3892 (format "{%d more}" gnus-tmp-unread-and-unticked))
3893 (t (format "{%d(+%d) more}"
3894 gnus-tmp-unread-and-unticked
3895 gnus-tmp-unselected))))
3897 (if (and gnus-current-headers
3898 (vectorp gnus-current-headers))
3899 (gnus-mode-string-quote
3900 (mail-header-subject gnus-current-headers))
3902 bufname-length max-len
3903 gnus-tmp-header);; passed as argument to any user-format-funcs
3904 (setq mode-string (eval mformat))
3905 (setq bufname-length (if (string-match "%b" mode-string)
3908 (if (eq where 'summary)
3910 (get-buffer gnus-article-buffer))))
3913 (setq max-len (max 4 (if gnus-mode-non-string-length
3915 gnus-mode-non-string-length
3917 (length mode-string))))
3918 ;; We might have to chop a bit of the string off...
3919 (when (> (length mode-string) max-len)
3921 (concat (gnus-truncate-string mode-string (- max-len 3))
3923 ;; Pad the mode string a bit.
3924 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
3925 ;; Update the mode line.
3926 (setq mode-line-buffer-identification
3927 (gnus-mode-line-buffer-identification (list mode-string)))
3928 (set-buffer-modified-p t))))
3930 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
3931 "Go through the HEADERS list and add all Xrefs to a hash table.
3932 The resulting hash table is returned, or nil if no Xrefs were found."
3933 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
3934 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
3935 (xref-hashtb (gnus-make-hashtable))
3936 start group entry number xrefs header)
3938 (setq header (pop headers))
3939 (when (and (setq xrefs (mail-header-xref header))
3940 (not (memq (setq number (mail-header-number header))
3943 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
3944 (setq start (match-end 0))
3945 (setq group (if prefix
3946 (concat prefix (substring xrefs (match-beginning 1)
3948 (substring xrefs (match-beginning 1) (match-end 1))))
3950 (string-to-int (substring xrefs (match-beginning 2)
3952 (if (setq entry (gnus-gethash group xref-hashtb))
3953 (setcdr entry (cons number (cdr entry)))
3954 (gnus-sethash group (cons number nil) xref-hashtb)))))
3955 (and start xref-hashtb)))
3957 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
3958 "Look through all the headers and mark the Xrefs as read."
3959 (let ((virtual (gnus-virtual-group-p from-newsgroup))
3960 name entry info xref-hashtb idlist method nth4)
3962 (set-buffer gnus-group-buffer)
3963 (when (setq xref-hashtb
3964 (gnus-create-xref-hashtb from-newsgroup headers unreads))
3967 (unless (string= from-newsgroup (setq name (symbol-name group)))
3968 (setq idlist (symbol-value group))
3969 ;; Dead groups are not updated.
3971 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
3973 (when (stringp (setq nth4 (gnus-info-method info)))
3974 (setq nth4 (gnus-server-to-method nth4))))
3975 ;; Only do the xrefs if the group has the same
3976 ;; select method as the group we have just read.
3977 (or (gnus-methods-equal-p
3978 nth4 (gnus-find-method-for-group from-newsgroup))
3980 (equal nth4 (setq method (gnus-find-method-for-group
3982 (and (equal (car nth4) (car method))
3983 (equal (nth 1 nth4) (nth 1 method))))
3984 gnus-use-cross-reference
3985 (or (not (eq gnus-use-cross-reference t))
3987 ;; Only do cross-references on subscribed
3988 ;; groups, if that is what is wanted.
3989 (<= (gnus-info-level info) gnus-level-subscribed))
3990 (gnus-group-make-articles-read name idlist))))
3993 (defun gnus-group-make-articles-read (group articles)
3994 "Update the info of GROUP to say that ARTICLES are read."
3996 (entry (gnus-gethash group gnus-newsrc-hashtb))
3997 (info (nth 2 entry))
3998 (active (gnus-active group))
4000 ;; First peel off all illegal article numbers.
4002 (let ((ids articles)
4004 (while (setq id (pop ids))
4005 (when (and first (> id (cdr active)))
4006 ;; We'll end up in this situation in one particular
4007 ;; obscure situation. If you re-scan a group and get
4008 ;; a new article that is cross-posted to a different
4009 ;; group that has not been re-scanned, you might get
4010 ;; crossposted article that has a higher number than
4011 ;; Gnus believes possible. So we re-activate this
4012 ;; group as well. This might mean doing the
4013 ;; crossposting thingy will *increase* the number
4014 ;; of articles in some groups. Tsk, tsk.
4015 (setq active (or (gnus-activate-group group) active)))
4016 (when (or (> id (cdr active))
4017 (< id (car active)))
4018 (setq articles (delq id articles))))))
4020 (set-buffer gnus-group-buffer)
4023 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4024 (gnus-info-set-read ',info ',(gnus-info-read info))
4025 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4026 (gnus-group-update-group ,group t))))
4027 ;; If the read list is nil, we init it.
4029 (null (gnus-info-read info))
4031 (gnus-info-set-read info (cons 1 (1- (car active)))))
4032 ;; Then we add the read articles to the range.
4037 (gnus-info-read info) (setq articles (sort articles '<)))))
4038 ;; Then we have to re-compute how many unread
4039 ;; articles there are in this group.
4043 (setq num (- (1+ (cdr active)) (car active))))
4044 ((not (listp (cdr range)))
4045 (setq num (- (cdr active) (- (1+ (cdr range))
4049 (if (numberp (car range))
4051 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4052 (setq range (cdr range)))
4053 (setq num (- (cdr active) num))))
4054 ;; Update the number of unread articles.
4056 ;; Update the group buffer.
4057 (gnus-group-update-group group t))))
4059 (defun gnus-methods-equal-p (m1 m2)
4060 (let ((m1 (or m1 gnus-select-method))
4061 (m2 (or m2 gnus-select-method)))
4063 (and (eq (car m1) (car m2))
4064 (or (not (memq 'address (assoc (symbol-name (car m1))
4065 gnus-valid-select-methods)))
4066 (equal (nth 1 m1) (nth 1 m2)))))))
4068 (defvar gnus-newsgroup-none-id 0)
4070 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4071 (let ((cur nntp-server-buffer)
4074 (save-excursion (set-buffer gnus-summary-buffer)
4075 gnus-newsgroup-dependencies)))
4076 headers id id-dep ref-dep end ref)
4078 (set-buffer nntp-server-buffer)
4079 ;; Translate all TAB characters into SPACE characters.
4080 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4081 (run-hooks 'gnus-parse-headers-hook)
4082 (let ((case-fold-search t)
4083 in-reply-to header p lines)
4084 (goto-char (point-min))
4085 ;; Search to the beginning of the next header. Error messages
4086 ;; do not begin with 2 or 3.
4087 (while (re-search-forward "^[23][0-9]+ " nil t)
4090 ;; This implementation of this function, with nine
4091 ;; search-forwards instead of the one re-search-forward and
4092 ;; a case (which basically was the old function) is actually
4093 ;; about twice as fast, even though it looks messier. You
4094 ;; can't have everything, I guess. Speed and elegance
4095 ;; doesn't always go hand in hand.
4104 (narrow-to-region (point)
4105 (or (and (search-forward "\n.\n" nil t)
4111 (if (search-forward "\nsubject: " nil t)
4112 (nnheader-header-value) "(none)"))
4116 (if (search-forward "\nfrom: " nil t)
4117 (nnheader-header-value) "(nobody)"))
4121 (if (search-forward "\ndate: " nil t)
4122 (nnheader-header-value) ""))
4126 (setq id (if (search-forward "\nmessage-id:" nil t)
4128 (1- (or (search-forward "<" nil t) (point)))
4129 (or (search-forward ">" nil t) (point)))
4130 ;; If there was no message-id, we just fake one
4131 ;; to make subsequent routines simpler.
4132 (nnheader-generate-fake-message-id))))
4136 (if (search-forward "\nreferences: " nil t)
4140 (nnheader-header-value)
4145 (search-backward ">" end t)
4148 (search-backward "<" end t)
4150 ;; Get the references from the in-reply-to header if there
4151 ;; were no references and the in-reply-to header looks
4153 (if (and (search-forward "\nin-reply-to: " nil t)
4154 (setq in-reply-to (nnheader-header-value))
4155 (string-match "<[^>]+>" in-reply-to))
4156 (setq ref (substring in-reply-to (match-beginning 0)
4164 (if (search-forward "\nlines: " nil t)
4165 (if (numberp (setq lines (read cur)))
4171 (and (search-forward "\nxref: " nil t)
4172 (nnheader-header-value)))))
4173 (when (equal id ref)
4175 ;; We do the threading while we read the headers. The
4176 ;; message-id and the last reference are both entered into
4177 ;; the same hash table. Some tippy-toeing around has to be
4178 ;; done in case an article has arrived before the article
4179 ;; which it refers to.
4180 (if (boundp (setq id-dep (intern id dependencies)))
4181 (if (and (car (symbol-value id-dep))
4183 ;; An article with this Message-ID has already been seen,
4184 ;; so we rename the Message-ID.
4187 (setq id-dep (intern (setq id (nnmail-message-id))
4190 (mail-header-set-id header id))
4191 (setcar (symbol-value id-dep) header))
4192 (set id-dep (list header)))
4194 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4195 (setcdr (symbol-value ref-dep)
4196 (nconc (cdr (symbol-value ref-dep))
4197 (list (symbol-value id-dep))))
4198 (set ref-dep (list nil (symbol-value id-dep))))
4199 (push header headers))
4200 (goto-char (point-max))
4202 (nreverse headers)))))
4204 ;; The following macros and functions were written by Felix Lee
4205 ;; <flee@cse.psu.edu>.
4207 (defmacro gnus-nov-read-integer ()
4209 (if (= (following-char) ?\t)
4211 (let ((num (ignore-errors (read buffer))))
4212 (if (numberp num) num 0)))
4216 (defmacro gnus-nov-skip-field ()
4217 '(search-forward "\t" eol 'move))
4219 (defmacro gnus-nov-field ()
4220 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4222 ;; (defvar gnus-nov-none-counter 0)
4224 ;; This function has to be called with point after the article number
4225 ;; on the beginning of the line.
4226 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4227 (let ((eol (gnus-point-at-eol))
4228 (buffer (current-buffer))
4229 header ref id id-dep ref-dep)
4231 ;; overview: [num subject from date id refs chars lines misc]
4234 (narrow-to-region (point) eol)
4241 (gnus-nov-field) ; subject
4242 (gnus-nov-field) ; from
4243 (gnus-nov-field) ; date
4244 (setq id (or (gnus-nov-field)
4245 (nnheader-generate-fake-message-id))) ; id
4247 (let ((beg (point)))
4248 (search-forward "\t" eol)
4249 (if (search-backward ">" beg t)
4253 (search-backward "<" beg t)))
4256 (gnus-nov-field)) ; refs
4257 (gnus-nov-read-integer) ; chars
4258 (gnus-nov-read-integer) ; lines
4259 (if (= (following-char) ?\n)
4261 (gnus-nov-field))))) ; misc
4265 ;; We build the thread tree.
4266 (when (equal id ref)
4267 ;; This article refers back to itself. Naughty, naughty.
4269 (if (boundp (setq id-dep (intern id dependencies)))
4270 (if (and (car (symbol-value id-dep))
4272 ;; An article with this Message-ID has already been seen,
4273 ;; so we rename the Message-ID.
4276 (setq id-dep (intern (setq id (nnmail-message-id))
4279 (mail-header-set-id header id))
4280 (setcar (symbol-value id-dep) header))
4281 (set id-dep (list header)))
4283 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4284 (setcdr (symbol-value ref-dep)
4285 (nconc (cdr (symbol-value ref-dep))
4286 (list (symbol-value id-dep))))
4287 (set ref-dep (list nil (symbol-value id-dep)))))
4290 ;; Goes through the xover lines and returns a list of vectors
4291 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4292 force-new dependencies
4293 group also-fetch-heads)
4294 "Parse the news overview data in the server buffer, and return a
4295 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4296 ;; Get the Xref when the users reads the articles since most/some
4297 ;; NNTP servers do not include Xrefs when using XOVER.
4298 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4299 (let ((cur nntp-server-buffer)
4300 (dependencies (or dependencies gnus-newsgroup-dependencies))
4301 number headers header)
4303 (set-buffer nntp-server-buffer)
4304 ;; Allow the user to mangle the headers before parsing them.
4305 (run-hooks 'gnus-parse-headers-hook)
4306 (goto-char (point-min))
4309 (while (and sequence (not (eobp)))
4310 (setq number (read cur))
4311 (while (and sequence
4312 (< (car sequence) number))
4313 (setq sequence (cdr sequence)))
4315 (eq number (car sequence))
4317 (setq sequence (cdr sequence))
4318 (setq header (inline
4319 (gnus-nov-parse-line
4320 number dependencies force-new))))
4321 (push header headers))
4324 (gnus-error 4 "Strange nov line (%d)"
4325 (count-lines (point-min) (point)))))
4327 ;; A common bug in inn is that if you have posted an article and
4328 ;; then retrieves the active file, it will answer correctly --
4329 ;; the new article is included. However, a NOV entry for the
4330 ;; article may not have been generated yet, so this may fail.
4331 ;; We work around this problem by retrieving the last few
4332 ;; headers using HEAD.
4333 (if (or (not also-fetch-heads)
4335 ;; We (probably) got all the headers.
4337 (let ((gnus-nov-is-evil t))
4340 (when (gnus-retrieve-headers sequence group)
4341 (gnus-get-newsgroup-headers))))))))
4343 (defun gnus-article-get-xrefs ()
4344 "Fill in the Xref value in `gnus-current-headers', if necessary.
4345 This is meant to be called in `gnus-article-internal-prepare-hook'."
4346 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4347 gnus-current-headers)))
4348 (or (not gnus-use-cross-reference)
4350 (and (mail-header-xref headers)
4351 (not (string= (mail-header-xref headers) "")))
4352 (let ((case-fold-search t)
4355 (nnheader-narrow-to-headers)
4356 (goto-char (point-min))
4357 (when (or (and (eq (downcase (following-char)) ?x)
4358 (looking-at "Xref:"))
4359 (search-forward "\nXref:" nil t))
4360 (goto-char (1+ (match-end 0)))
4361 (setq xref (buffer-substring (point)
4362 (progn (end-of-line) (point))))
4363 (mail-header-set-xref headers xref)))))))
4365 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4366 "Find article ID and insert the summary line for that article."
4367 (let ((header (if (and old-header use-old-header)
4368 old-header (gnus-read-header id)))
4369 (number (and (numberp id) id))
4372 ;; Rebuild the thread that this article is part of and go to the
4373 ;; article we have fetched.
4374 (when (and (not gnus-show-threads)
4376 (when (setq d (gnus-data-find (mail-header-number old-header)))
4377 (goto-char (gnus-data-pos d))
4380 (- (gnus-point-at-bol)
4382 (1+ (gnus-point-at-eol))
4383 (gnus-delete-line))))))
4385 (mail-header-set-number header (mail-header-number old-header)))
4386 (setq gnus-newsgroup-sparse
4387 (delq (setq number (mail-header-number header))
4388 gnus-newsgroup-sparse))
4389 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4390 (gnus-rebuild-thread (mail-header-id header))
4391 (gnus-summary-goto-subject number nil t))
4392 (when (and (numberp number)
4394 ;; We have to update the boundaries even if we can't fetch the
4395 ;; article if ID is a number -- so that the next `P' or `N'
4396 ;; command will fetch the previous (or next) article even
4397 ;; if the one we tried to fetch this time has been canceled.
4398 (when (> number gnus-newsgroup-end)
4399 (setq gnus-newsgroup-end number))
4400 (when (< number gnus-newsgroup-begin)
4401 (setq gnus-newsgroup-begin number))
4402 (setq gnus-newsgroup-unselected
4403 (delq number gnus-newsgroup-unselected)))
4404 ;; Report back a success?
4405 (and header (mail-header-number header))))
4407 ;;; Process/prefix in the summary buffer
4409 (defun gnus-summary-work-articles (n)
4410 "Return a list of articles to be worked upon. The prefix argument,
4411 the list of process marked articles, and the current article will be
4412 taken into consideration."
4415 ;; A numerical prefix has been given.
4416 (setq n (prefix-numeric-value n))
4417 (let ((backward (< n 0))
4418 (n (abs (prefix-numeric-value n)))
4423 (push (setq article (gnus-summary-article-number))
4426 (gnus-summary-find-prev nil article)
4427 (gnus-summary-find-next nil article)))
4429 (nreverse articles)))
4430 ((gnus-region-active-p)
4431 ;; Work on the region between point and mark.
4432 (let ((max (max (point) (mark)))
4435 (goto-char (min (point) (mark)))
4438 (push (setq article (gnus-summary-article-number)) articles)
4439 (gnus-summary-find-next nil article)
4441 (nreverse articles))))
4442 (gnus-newsgroup-processable
4443 ;; There are process-marked articles present.
4444 ;; Save current state.
4445 (gnus-summary-save-process-mark)
4447 (reverse gnus-newsgroup-processable))
4449 ;; Just return the current article.
4450 (list (gnus-summary-article-number)))))
4452 (defun gnus-summary-save-process-mark ()
4453 "Push the current set of process marked articles on the stack."
4455 (push (copy-sequence gnus-newsgroup-processable)
4456 gnus-newsgroup-process-stack))
4458 (defun gnus-summary-kill-process-mark ()
4459 "Push the current set of process marked articles on the stack and unmark."
4461 (gnus-summary-save-process-mark)
4462 (gnus-summary-unmark-all-processable))
4464 (defun gnus-summary-yank-process-mark ()
4465 "Pop the last process mark state off the stack and restore it."
4467 (unless gnus-newsgroup-process-stack
4468 (error "Empty mark stack"))
4469 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4471 (defun gnus-summary-process-mark-set (set)
4472 "Make SET into the current process marked articles."
4473 (gnus-summary-unmark-all-processable)
4475 (gnus-summary-set-process-mark (pop set))))
4477 ;;; Searching and stuff
4479 (defun gnus-summary-search-group (&optional backward use-level)
4480 "Search for next unread newsgroup.
4481 If optional argument BACKWARD is non-nil, search backward instead."
4483 (set-buffer gnus-group-buffer)
4484 (when (gnus-group-search-forward
4485 backward nil (if use-level (gnus-group-group-level) nil))
4486 (gnus-group-group-name))))
4488 (defun gnus-summary-best-group (&optional exclude-group)
4489 "Find the name of the best unread group.
4490 If EXCLUDE-GROUP, do not go to this group."
4492 (set-buffer gnus-group-buffer)
4494 (gnus-group-best-unread-group exclude-group))))
4496 (defun gnus-summary-find-next (&optional unread article backward)
4497 (if backward (gnus-summary-find-prev)
4498 (let* ((dummy (gnus-summary-article-intangible-p))
4499 (article (or article (gnus-summary-article-number)))
4500 (arts (gnus-data-find-list article))
4502 (when (and (not dummy)
4503 (or (not gnus-summary-check-current)
4505 (not (gnus-data-unread-p (car arts)))))
4506 (setq arts (cdr arts)))
4511 (when (gnus-data-unread-p (car arts))
4512 (setq result (car arts)
4514 (setq arts (cdr arts)))
4517 (goto-char (gnus-data-pos result))
4518 (gnus-data-number result)))))
4520 (defun gnus-summary-find-prev (&optional unread article)
4521 (let* ((eobp (eobp))
4522 (article (or article (gnus-summary-article-number)))
4523 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4525 (when (and (not eobp)
4526 (or (not gnus-summary-check-current)
4528 (not (gnus-data-unread-p (car arts)))))
4529 (setq arts (cdr arts)))
4534 (when (gnus-data-unread-p (car arts))
4535 (setq result (car arts)
4537 (setq arts (cdr arts)))
4540 (goto-char (gnus-data-pos result))
4541 (gnus-data-number result))))
4543 (defun gnus-summary-find-subject (subject &optional unread backward article)
4544 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4545 (article (or article (gnus-summary-article-number)))
4546 (articles (gnus-data-list backward))
4547 (arts (gnus-data-find-list article articles))
4549 (when (or (not gnus-summary-check-current)
4551 (not (gnus-data-unread-p (car arts))))
4552 (setq arts (cdr arts)))
4554 (and (or (not unread)
4555 (gnus-data-unread-p (car arts)))
4556 (vectorp (gnus-data-header (car arts)))
4558 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4559 (setq result (car arts)
4561 (setq arts (cdr arts)))
4563 (goto-char (gnus-data-pos result))
4564 (gnus-data-number result))))
4566 (defun gnus-summary-search-forward (&optional unread subject backward)
4567 "Search forward for an article.
4568 If UNREAD, look for unread articles. If SUBJECT, look for
4569 articles with that subject. If BACKWARD, search backward instead."
4570 (cond (subject (gnus-summary-find-subject subject unread backward))
4571 (backward (gnus-summary-find-prev unread))
4572 (t (gnus-summary-find-next unread))))
4574 (defun gnus-recenter (&optional n)
4575 "Center point in window and redisplay frame.
4576 Also do horizontal recentering."
4578 (when (and gnus-auto-center-summary
4579 (not (eq gnus-auto-center-summary 'vertical)))
4580 (gnus-horizontal-recenter))
4583 (defun gnus-summary-recenter ()
4584 "Center point in the summary window.
4585 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4586 displayed, no centering will be performed."
4587 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4588 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4589 (let* ((top (cond ((< (window-height) 4) 0)
4590 ((< (window-height) 7) 1)
4592 (height (1- (window-height)))
4593 (bottom (save-excursion (goto-char (point-max))
4594 (forward-line (- height))
4596 (window (get-buffer-window (current-buffer))))
4597 ;; The user has to want it.
4598 (when gnus-auto-center-summary
4599 (when (get-buffer-window gnus-article-buffer)
4600 ;; Only do recentering when the article buffer is displayed,
4601 ;; Set the window start to either `bottom', which is the biggest
4602 ;; possible valid number, or the second line from the top,
4603 ;; whichever is the least.
4605 window (min bottom (save-excursion
4606 (forward-line (- top)) (point)))))
4607 ;; Do horizontal recentering while we're at it.
4608 (when (and (get-buffer-window (current-buffer) t)
4609 (not (eq gnus-auto-center-summary 'vertical)))
4610 (let ((selected (selected-window)))
4611 (select-window (get-buffer-window (current-buffer) t))
4612 (gnus-summary-position-point)
4613 (gnus-horizontal-recenter)
4614 (select-window selected))))))
4616 (defun gnus-summary-jump-to-group (newsgroup)
4617 "Move point to NEWSGROUP in group mode buffer."
4618 ;; Keep update point of group mode buffer if visible.
4619 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4620 (save-window-excursion
4621 ;; Take care of tree window mode.
4622 (when (get-buffer-window gnus-group-buffer)
4623 (pop-to-buffer gnus-group-buffer))
4624 (gnus-group-jump-to-group newsgroup))
4626 ;; Take care of tree window mode.
4627 (if (get-buffer-window gnus-group-buffer)
4628 (pop-to-buffer gnus-group-buffer)
4629 (set-buffer gnus-group-buffer))
4630 (gnus-group-jump-to-group newsgroup))))
4632 ;; This function returns a list of article numbers based on the
4633 ;; difference between the ranges of read articles in this group and
4634 ;; the range of active articles.
4635 (defun gnus-list-of-unread-articles (group)
4636 (let* ((read (gnus-info-read (gnus-get-info group)))
4637 (active (or (gnus-active group) (gnus-activate-group group)))
4640 ;; If none are read, then all are unread.
4642 (setq first (car active))
4643 ;; If the range of read articles is a single range, then the
4644 ;; first unread article is the article after the last read
4645 ;; article. Sounds logical, doesn't it?
4646 (if (not (listp (cdr read)))
4647 (setq first (1+ (cdr read)))
4648 ;; `read' is a list of ranges.
4649 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4655 (while (< first nlast)
4657 (setq first (1+ first))))
4658 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4659 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4660 (setq read (cdr read)))))
4661 ;; And add the last unread articles.
4662 (while (<= first last)
4664 (setq first (1+ first)))
4665 ;; Return the list of unread articles.
4668 (defun gnus-list-of-read-articles (group)
4669 "Return a list of unread, unticked and non-dormant articles."
4670 (let* ((info (gnus-get-info group))
4671 (marked (gnus-info-marks info))
4672 (active (gnus-active group)))
4674 (gnus-set-difference
4675 (gnus-sorted-complement
4676 (gnus-uncompress-range active)
4677 (gnus-list-of-unread-articles group))
4679 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4680 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4682 ;; Various summary commands
4684 (defun gnus-summary-universal-argument (arg)
4685 "Perform any operation on all articles that are process/prefixed."
4687 (gnus-set-global-variables)
4688 (let ((articles (gnus-summary-work-articles arg))
4695 (substitute-command-keys
4696 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4699 (gnus-error 1 "Undefined key")
4702 (gnus-summary-goto-subject (setq article (pop articles)))
4703 (let (gnus-newsgroup-processable)
4704 (command-execute func))
4705 (gnus-summary-remove-process-mark article)))))
4706 (gnus-summary-position-point))
4708 (defun gnus-summary-toggle-truncation (&optional arg)
4709 "Toggle truncation of summary lines.
4710 With arg, turn line truncation on iff arg is positive."
4712 (setq truncate-lines
4713 (if (null arg) (not truncate-lines)
4714 (> (prefix-numeric-value arg) 0)))
4717 (defun gnus-summary-reselect-current-group (&optional all rescan)
4718 "Exit and then reselect the current newsgroup.
4719 The prefix argument ALL means to select all articles."
4721 (gnus-set-global-variables)
4722 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4723 (error "Ephemeral groups can't be reselected"))
4724 (let ((current-subject (gnus-summary-article-number))
4725 (group gnus-newsgroup-name))
4726 (setq gnus-newsgroup-begin nil)
4728 ;; We have to adjust the point of group mode buffer because
4729 ;; point was moved to the next unread newsgroup by exiting.
4730 (gnus-summary-jump-to-group group)
4733 (gnus-group-get-new-news-this-group 1)))
4734 (gnus-group-read-group all t)
4735 (gnus-summary-goto-subject current-subject nil t)))
4737 (defun gnus-summary-rescan-group (&optional all)
4738 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4740 (gnus-summary-reselect-current-group all t))
4742 (defun gnus-summary-update-info (&optional non-destructive)
4744 (let ((group gnus-newsgroup-name))
4745 (when gnus-newsgroup-kill-headers
4746 (setq gnus-newsgroup-killed
4747 (gnus-compress-sequence
4749 (gnus-set-sorted-intersection
4750 (gnus-uncompress-range gnus-newsgroup-killed)
4751 (setq gnus-newsgroup-unselected
4752 (sort gnus-newsgroup-unselected '<)))
4753 (setq gnus-newsgroup-unreads
4754 (sort gnus-newsgroup-unreads '<)))
4756 (unless (listp (cdr gnus-newsgroup-killed))
4757 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4758 (let ((headers gnus-newsgroup-headers))
4759 (when (and (not gnus-save-score)
4760 (not non-destructive))
4761 (setq gnus-newsgroup-scored nil))
4762 ;; Set the new ranges of read articles.
4763 (gnus-update-read-articles
4764 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4765 ;; Set the current article marks.
4767 ;; Do the cross-ref thing.
4768 (when gnus-use-cross-reference
4769 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4770 ;; Do adaptive scoring, and possibly save score files.
4771 (when gnus-newsgroup-adaptive
4772 (gnus-score-adaptive))
4773 (when gnus-use-scoring
4775 ;; Do not switch windows but change the buffer to work.
4776 (set-buffer gnus-group-buffer)
4777 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4778 (gnus-group-update-group group))))))
4780 (defun gnus-summary-save-newsrc (&optional force)
4781 "Save the current number of read/marked articles in the dribble buffer.
4782 The dribble buffer will then be saved.
4783 If FORCE (the prefix), also save the .newsrc file(s)."
4785 (gnus-summary-update-info t)
4787 (gnus-save-newsrc-file)
4788 (gnus-dribble-save)))
4790 (defun gnus-summary-exit (&optional temporary)
4791 "Exit reading current newsgroup, and then return to group selection mode.
4792 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4794 (gnus-set-global-variables)
4795 (gnus-kill-save-kill-buffer)
4796 (let* ((group gnus-newsgroup-name)
4797 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4799 (buf (current-buffer)))
4800 (run-hooks 'gnus-summary-prepare-exit-hook)
4801 ;; If we have several article buffers, we kill them at exit.
4802 (unless gnus-single-article-buffer
4803 (gnus-kill-buffer gnus-original-article-buffer)
4804 (setq gnus-article-current nil))
4805 (when gnus-use-cache
4806 (gnus-cache-possibly-remove-articles)
4807 (gnus-cache-save-buffers))
4808 (gnus-async-prefetch-remove-group group)
4809 (when gnus-suppress-duplicates
4810 (gnus-dup-enter-articles))
4811 (when gnus-use-trees
4812 (gnus-tree-close group))
4813 ;; Make all changes in this group permanent.
4815 (run-hooks 'gnus-exit-group-hook)
4816 (gnus-summary-update-info))
4817 (gnus-close-group group)
4818 ;; Make sure where I was, and go to next newsgroup.
4819 (set-buffer gnus-group-buffer)
4821 (gnus-group-jump-to-group group))
4822 (run-hooks 'gnus-summary-exit-hook)
4824 (gnus-group-next-unread-group 1))
4827 ;; If we have several article buffers, we kill them at exit.
4828 (unless gnus-single-article-buffer
4829 (gnus-kill-buffer gnus-article-buffer)
4830 (gnus-kill-buffer gnus-original-article-buffer)
4831 (setq gnus-article-current nil))
4833 (if (not gnus-kill-summary-on-exit)
4834 (gnus-deaden-summary)
4835 ;; We set all buffer-local variables to nil. It is unclear why
4836 ;; this is needed, but if we don't, buffer-local variables are
4837 ;; not garbage-collected, it seems. This would the lead to en
4838 ;; ever-growing Emacs.
4839 (gnus-summary-clear-local-variables)
4840 (when (get-buffer gnus-article-buffer)
4841 (bury-buffer gnus-article-buffer))
4842 ;; We clear the global counterparts of the buffer-local
4843 ;; variables as well, just to be on the safe side.
4844 (set-buffer gnus-group-buffer)
4845 (gnus-summary-clear-local-variables)
4846 ;; Return to group mode buffer.
4847 (when (eq mode 'gnus-summary-mode)
4848 (gnus-kill-buffer buf)))
4849 (setq gnus-current-select-method gnus-select-method)
4850 (pop-to-buffer gnus-group-buffer)
4851 ;; Clear the current group name.
4852 (if (not quit-config)
4854 (gnus-group-jump-to-group group)
4855 (gnus-group-next-unread-group 1)
4856 (gnus-configure-windows 'group 'force))
4857 (gnus-handle-ephemeral-exit quit-config))
4859 (setq gnus-newsgroup-name nil)))))
4861 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4862 (defun gnus-summary-exit-no-update (&optional no-questions)
4863 "Quit reading current newsgroup without updating read article info."
4865 (gnus-set-global-variables)
4866 (let* ((group gnus-newsgroup-name)
4867 (quit-config (gnus-group-quit-config group)))
4868 (when (or no-questions
4870 (gnus-y-or-n-p "Discard changes to this group and exit? "))
4871 ;; If we have several article buffers, we kill them at exit.
4872 (unless gnus-single-article-buffer
4873 (gnus-kill-buffer gnus-article-buffer)
4874 (gnus-kill-buffer gnus-original-article-buffer)
4875 (setq gnus-article-current nil))
4876 (if (not gnus-kill-summary-on-exit)
4877 (gnus-deaden-summary)
4878 (gnus-close-group group)
4879 (gnus-summary-clear-local-variables)
4880 (set-buffer gnus-group-buffer)
4881 (gnus-summary-clear-local-variables)
4882 (when (get-buffer gnus-summary-buffer)
4883 (kill-buffer gnus-summary-buffer)))
4884 (unless gnus-single-article-buffer
4885 (setq gnus-article-current nil))
4886 (when gnus-use-trees
4887 (gnus-tree-close group))
4888 (gnus-async-prefetch-remove-group group)
4889 (when (get-buffer gnus-article-buffer)
4890 (bury-buffer gnus-article-buffer))
4891 ;; Return to the group buffer.
4892 (gnus-configure-windows 'group 'force)
4893 ;; Clear the current group name.
4894 (setq gnus-newsgroup-name nil)
4895 (when (equal (gnus-group-group-name) group)
4896 (gnus-group-next-unread-group 1))
4898 (gnus-handle-ephemeral-exit quit-config)))))
4900 (defun gnus-handle-ephemeral-exit (quit-config)
4901 "Handle movement when leaving an ephemeral group. The state
4902 which existed when entering the ephemeral is reset."
4903 (if (not (buffer-name (car quit-config)))
4904 (gnus-configure-windows 'group 'force)
4905 (set-buffer (car quit-config))
4906 (cond ((eq major-mode 'gnus-summary-mode)
4907 (gnus-set-global-variables))
4908 ((eq major-mode 'gnus-article-mode)
4910 ;; The `gnus-summary-buffer' variable may point
4911 ;; to the old summary buffer when using a single
4913 (unless (gnus-buffer-live-p gnus-summary-buffer)
4914 (set-buffer gnus-group-buffer))
4915 (set-buffer gnus-summary-buffer)
4916 (gnus-set-global-variables))))
4917 (if (or (eq (cdr quit-config) 'article)
4918 (eq (cdr quit-config) 'pick))
4920 ;; The current article may be from the ephemeral group
4921 ;; thus it is best that we reload this article
4922 (gnus-summary-show-article)
4923 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
4924 (gnus-configure-windows 'pick 'force)
4925 (gnus-configure-windows (cdr quit-config) 'force)))
4926 (gnus-configure-windows (cdr quit-config) 'force))
4927 (when (eq major-mode 'gnus-summary-mode)
4928 (gnus-summary-next-subject 1 nil t)
4929 (gnus-summary-recenter)
4930 (gnus-summary-position-point))))
4934 (defvar gnus-dead-summary-mode-map nil)
4936 (unless gnus-dead-summary-mode-map
4937 (setq gnus-dead-summary-mode-map (make-keymap))
4938 (suppress-keymap gnus-dead-summary-mode-map)
4939 (substitute-key-definition
4940 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
4941 (let ((keys '("\C-d" "\r" "\177")))
4943 (define-key gnus-dead-summary-mode-map
4944 (pop keys) 'gnus-summary-wake-up-the-dead))))
4946 (defvar gnus-dead-summary-mode nil
4947 "Minor mode for Gnus summary buffers.")
4949 (defun gnus-dead-summary-mode (&optional arg)
4950 "Minor mode for Gnus summary buffers."
4952 (when (eq major-mode 'gnus-summary-mode)
4953 (make-local-variable 'gnus-dead-summary-mode)
4954 (setq gnus-dead-summary-mode
4955 (if (null arg) (not gnus-dead-summary-mode)
4956 (> (prefix-numeric-value arg) 0)))
4957 (when gnus-dead-summary-mode
4958 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
4959 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
4960 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
4961 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
4962 minor-mode-map-alist)))))
4964 (defun gnus-deaden-summary ()
4965 "Make the current summary buffer into a dead summary buffer."
4966 ;; Kill any previous dead summary buffer.
4967 (when (and gnus-dead-summary
4968 (buffer-name gnus-dead-summary))
4970 (set-buffer gnus-dead-summary)
4971 (when gnus-dead-summary-mode
4972 (kill-buffer (current-buffer)))))
4973 ;; Make this the current dead summary.
4974 (setq gnus-dead-summary (current-buffer))
4975 (gnus-dead-summary-mode 1)
4976 (let ((name (buffer-name)))
4977 (when (string-match "Summary" name)
4979 (concat (substring name 0 (match-beginning 0)) "Dead "
4980 (substring name (match-beginning 0)))
4983 (defun gnus-kill-or-deaden-summary (buffer)
4984 "Kill or deaden the summary BUFFER."
4985 (when (and (buffer-name buffer)
4986 (not gnus-single-article-buffer))
4989 (gnus-kill-buffer gnus-article-buffer)
4990 (gnus-kill-buffer gnus-original-article-buffer)))
4991 (cond (gnus-kill-summary-on-exit
4992 (when (and gnus-use-trees
4993 (and (get-buffer buffer)
4994 (buffer-name (get-buffer buffer))))
4996 (set-buffer (get-buffer buffer))
4997 (gnus-tree-close gnus-newsgroup-name)))
4998 (gnus-kill-buffer buffer))
4999 ((and (get-buffer buffer)
5000 (buffer-name (get-buffer buffer)))
5003 (gnus-deaden-summary)))))
5005 (defun gnus-summary-wake-up-the-dead (&rest args)
5006 "Wake up the dead summary buffer."
5008 (gnus-dead-summary-mode -1)
5009 (let ((name (buffer-name)))
5010 (when (string-match "Dead " name)
5012 (concat (substring name 0 (match-beginning 0))
5013 (substring name (match-end 0)))
5015 (gnus-message 3 "This dead summary is now alive again"))
5017 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5018 (defun gnus-summary-fetch-faq (&optional faq-dir)
5019 "Fetch the FAQ for the current group.
5020 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5024 (when current-prefix-arg
5026 "Faq dir: " (and (listp gnus-group-faq-directory)
5027 gnus-group-faq-directory)))))
5028 (let (gnus-faq-buffer)
5029 (when (setq gnus-faq-buffer
5030 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5031 (gnus-configure-windows 'summary-faq))))
5033 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5034 (defun gnus-summary-describe-group (&optional force)
5035 "Describe the current newsgroup."
5037 (gnus-group-describe-group force gnus-newsgroup-name))
5039 (defun gnus-summary-describe-briefly ()
5040 "Describe summary mode commands briefly."
5043 (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")))
5045 ;; Walking around group mode buffer from summary mode.
5047 (defun gnus-summary-next-group (&optional no-article target-group backward)
5048 "Exit current newsgroup and then select next unread newsgroup.
5049 If prefix argument NO-ARTICLE is non-nil, no article is selected
5050 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5051 previous group instead."
5053 (gnus-set-global-variables)
5054 ;; Stop pre-fetching.
5055 (gnus-async-halt-prefetch)
5056 (let ((current-group gnus-newsgroup-name)
5057 (current-buffer (current-buffer))
5059 ;; First we semi-exit this group to update Xrefs and all variables.
5060 ;; We can't do a real exit, because the window conf must remain
5061 ;; the same in case the user is prompted for info, and we don't
5062 ;; want the window conf to change before that...
5063 (gnus-summary-exit t)
5064 (while (not entered)
5065 ;; Then we find what group we are supposed to enter.
5066 (set-buffer gnus-group-buffer)
5067 (gnus-group-jump-to-group current-group)
5070 (if (eq gnus-keep-same-level 'best)
5071 (gnus-summary-best-group gnus-newsgroup-name)
5072 (gnus-summary-search-group backward gnus-keep-same-level))))
5073 (if (not target-group)
5074 ;; There are no further groups, so we return to the group
5077 (gnus-message 5 "Returning to the group buffer")
5079 (set-buffer current-buffer)
5081 (run-hooks 'gnus-group-no-more-groups-hook))
5082 ;; We try to enter the target group.
5083 (gnus-group-jump-to-group target-group)
5084 (let ((unreads (gnus-group-group-unread)))
5085 (if (and (or (eq t unreads)
5086 (and unreads (not (zerop unreads))))
5087 (gnus-summary-read-group
5088 target-group nil no-article current-buffer))
5090 (setq current-group target-group
5091 target-group nil)))))))
5093 (defun gnus-summary-prev-group (&optional no-article)
5094 "Exit current newsgroup and then select previous unread newsgroup.
5095 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5097 (gnus-summary-next-group no-article nil t))
5099 ;; Walking around summary lines.
5101 (defun gnus-summary-first-subject (&optional unread)
5102 "Go to the first unread subject.
5103 If UNREAD is non-nil, go to the first unread article.
5104 Returns the article selected or nil if there are no unread articles."
5109 ((null gnus-newsgroup-data)
5110 (gnus-message 3 "No articles in the group")
5112 ;; Pick the first article.
5114 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5115 (gnus-data-number (car gnus-newsgroup-data)))
5116 ;; No unread articles.
5117 ((null gnus-newsgroup-unreads)
5118 (gnus-message 3 "No more unread articles")
5120 ;; Find the first unread article.
5122 (let ((data gnus-newsgroup-data))
5124 (not (gnus-data-unread-p (car data))))
5125 (setq data (cdr data)))
5127 (goto-char (gnus-data-pos (car data)))
5128 (gnus-data-number (car data))))))
5129 (gnus-summary-position-point)))
5131 (defun gnus-summary-next-subject (n &optional unread dont-display)
5132 "Go to next N'th summary line.
5133 If N is negative, go to the previous N'th subject line.
5134 If UNREAD is non-nil, only unread articles are selected.
5135 The difference between N and the actual number of steps taken is
5138 (let ((backward (< n 0))
5142 (gnus-summary-find-prev unread)
5143 (gnus-summary-find-next unread)))
5146 (gnus-message 7 "No more%s articles"
5147 (if unread " unread" "")))
5148 (unless dont-display
5149 (gnus-summary-recenter)
5150 (gnus-summary-position-point))
5153 (defun gnus-summary-next-unread-subject (n)
5154 "Go to next N'th unread summary line."
5156 (gnus-summary-next-subject n t))
5158 (defun gnus-summary-prev-subject (n &optional unread)
5159 "Go to previous N'th summary line.
5160 If optional argument UNREAD is non-nil, only unread article is selected."
5162 (gnus-summary-next-subject (- n) unread))
5164 (defun gnus-summary-prev-unread-subject (n)
5165 "Go to previous N'th unread summary line."
5167 (gnus-summary-next-subject (- n) t))
5169 (defun gnus-summary-goto-subject (article &optional force silent)
5170 "Go the subject line of ARTICLE.
5171 If FORCE, also allow jumping to articles not currently shown."
5172 (interactive "nArticle number: ")
5174 (data (gnus-data-find article)))
5175 ;; We read in the article if we have to.
5178 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5179 (setq data (gnus-data-find article)))
5184 (gnus-message 3 "Can't find article %d" article))
5186 (goto-char (gnus-data-pos data))
5189 ;; Walking around summary lines with displaying articles.
5191 (defun gnus-summary-expand-window (&optional arg)
5192 "Make the summary buffer take up the entire Emacs frame.
5193 Given a prefix, will force an `article' buffer configuration."
5195 (gnus-set-global-variables)
5197 (gnus-configure-windows 'article 'force)
5198 (gnus-configure-windows 'summary 'force)))
5200 (defun gnus-summary-display-article (article &optional all-header)
5201 "Display ARTICLE in article buffer."
5202 (gnus-set-global-variables)
5206 (if gnus-summary-display-article-function
5207 (funcall gnus-summary-display-article-function article all-header)
5208 (gnus-article-prepare article all-header))
5209 (run-hooks 'gnus-select-article-hook)
5210 (when (and gnus-current-article
5211 (not (zerop gnus-current-article)))
5212 (gnus-summary-goto-subject gnus-current-article))
5213 (gnus-summary-recenter)
5214 (when (and gnus-use-trees gnus-show-threads)
5215 (gnus-possibly-generate-tree article)
5216 (gnus-highlight-selected-tree article))
5217 ;; Successfully display article.
5218 (gnus-article-set-window-start
5219 (cdr (assq article gnus-newsgroup-bookmarks))))))
5221 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5222 "Select the current article.
5223 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5224 non-nil, the article will be re-fetched even if it already present in
5225 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5227 ;; Make sure we are in the summary buffer to work around bbdb bug.
5228 (unless (eq major-mode 'gnus-summary-mode)
5229 (set-buffer gnus-summary-buffer))
5230 (let ((article (or article (gnus-summary-article-number)))
5231 (all-headers (not (not all-headers))) ;Must be T or NIL.
5232 gnus-summary-display-article-function
5235 (gnus-summary-article-pseudo-p article)
5236 (error "This is a pseudo-article."))
5239 (set-buffer gnus-summary-buffer)
5240 (if (or (and gnus-single-article-buffer
5241 (or (null gnus-current-article)
5242 (null gnus-article-current)
5243 (null (get-buffer gnus-article-buffer))
5244 (not (eq article (cdr gnus-article-current)))
5245 (not (equal (car gnus-article-current)
5246 gnus-newsgroup-name))))
5247 (and (not gnus-single-article-buffer)
5248 (or (null gnus-current-article)
5249 (not (eq gnus-current-article article))))
5251 ;; The requested article is different from the current article.
5253 (gnus-summary-display-article article all-headers)
5255 (when (or all-headers gnus-show-all-headers)
5256 (gnus-article-show-all-headers))
5259 (gnus-article-set-window-start
5260 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5262 (defun gnus-summary-set-current-mark (&optional current-mark)
5263 "Obsolete function."
5266 (defun gnus-summary-next-article (&optional unread subject backward push)
5267 "Select the next article.
5268 If UNREAD, only unread articles are selected.
5269 If SUBJECT, only articles with SUBJECT are selected.
5270 If BACKWARD, the previous article is selected instead of the next."
5272 (gnus-set-global-variables)
5274 ;; Is there such an article?
5275 ((and (gnus-summary-search-forward unread subject backward)
5276 (or (gnus-summary-display-article (gnus-summary-article-number))
5277 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5278 (gnus-summary-position-point))
5279 ;; If not, we try the first unread, if that is wanted.
5281 gnus-auto-select-same
5282 (gnus-summary-first-unread-article))
5283 (gnus-summary-position-point)
5284 (gnus-message 6 "Wrapped"))
5285 ;; Try to get next/previous article not displayed in this group.
5286 ((and gnus-auto-extend-newsgroup
5287 (not unread) (not subject))
5288 (gnus-summary-goto-article
5289 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5291 ;; Go to next/previous group.
5293 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5294 (gnus-summary-jump-to-group gnus-newsgroup-name))
5295 (let ((cmd last-command-char)
5298 (set-buffer gnus-group-buffer)
5301 (if (eq gnus-keep-same-level 'best)
5302 (gnus-summary-best-group gnus-newsgroup-name)
5303 (gnus-summary-search-group backward gnus-keep-same-level))))
5304 ;; For some reason, the group window gets selected. We change
5306 (select-window (get-buffer-window (current-buffer)))
5307 ;; Select next unread newsgroup automagically.
5309 ((or (not gnus-auto-select-next)
5311 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5312 ((or (eq gnus-auto-select-next 'quietly)
5313 (and (eq gnus-auto-select-next 'slightly-quietly)
5315 (and (eq gnus-auto-select-next 'almost-quietly)
5316 (gnus-summary-last-article-p)))
5318 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5320 (gnus-message 7 "No more%s articles (%s)..."
5321 (if unread " unread" "")
5322 (if group (concat "selecting " group)
5324 (gnus-summary-next-group nil group backward)))
5326 (when (gnus-key-press-event-p last-input-event)
5327 (gnus-summary-walk-group-buffer
5328 gnus-newsgroup-name cmd unread backward point))))))))
5330 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5331 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5332 (?\C-p (gnus-group-prev-unread-group 1))))
5333 (cursor-in-echo-area t)
5334 keve key group ended)
5336 (set-buffer gnus-group-buffer)
5339 (if (eq gnus-keep-same-level 'best)
5340 (gnus-summary-best-group gnus-newsgroup-name)
5341 (gnus-summary-search-group backward gnus-keep-same-level))))
5344 5 "No more%s articles%s" (if unread " unread" "")
5346 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5347 (format " (Type %s for %s [%s])"
5348 (single-key-description cmd) group
5349 (car (gnus-gethash group gnus-newsrc-hashtb)))
5350 (format " (Type %s to exit %s)"
5351 (single-key-description cmd)
5352 gnus-newsgroup-name)))
5353 ;; Confirm auto selection.
5354 (setq key (car (setq keve (gnus-read-event-char))))
5357 ((assq key keystrokes)
5358 (let ((obuf (current-buffer)))
5359 (switch-to-buffer gnus-group-buffer)
5361 (gnus-group-jump-to-group group))
5362 (eval (cadr (assq key keystrokes)))
5363 (setq group (gnus-group-group-name))
5364 (switch-to-buffer obuf))
5368 (gnus-ephemeral-group-p gnus-newsgroup-name))
5370 (gnus-summary-next-group nil group backward)))
5372 (push (cdr keve) unread-command-events))))))
5374 (defun gnus-summary-next-unread-article ()
5375 "Select unread article after current one."
5377 (gnus-summary-next-article
5378 (or (not (eq gnus-summary-goto-unread 'never))
5379 (gnus-summary-last-article-p (gnus-summary-article-number)))
5380 (and gnus-auto-select-same
5381 (gnus-summary-article-subject))))
5383 (defun gnus-summary-prev-article (&optional unread subject)
5384 "Select the article after the current one.
5385 If UNREAD is non-nil, only unread articles are selected."
5387 (gnus-summary-next-article unread subject t))
5389 (defun gnus-summary-prev-unread-article ()
5390 "Select unread article before current one."
5392 (gnus-summary-prev-article
5393 (or (not (eq gnus-summary-goto-unread 'never))
5394 (gnus-summary-first-article-p (gnus-summary-article-number)))
5395 (and gnus-auto-select-same
5396 (gnus-summary-article-subject))))
5398 (defun gnus-summary-next-page (&optional lines circular)
5399 "Show next page of the selected article.
5400 If at the end of the current article, select the next article.
5401 LINES says how many lines should be scrolled up.
5403 If CIRCULAR is non-nil, go to the start of the article instead of
5404 selecting the next article when reaching the end of the current
5407 (setq gnus-summary-buffer (current-buffer))
5408 (gnus-set-global-variables)
5409 (let ((article (gnus-summary-article-number))
5410 (article-window (get-buffer-window gnus-article-buffer t))
5412 (gnus-configure-windows 'article)
5413 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5414 (if (and (eq gnus-summary-goto-unread 'never)
5415 (not (gnus-summary-last-article-p article)))
5416 (gnus-summary-next-article)
5417 (gnus-summary-next-unread-article))
5418 (if (or (null gnus-current-article)
5419 (null gnus-article-current)
5420 (/= article (cdr gnus-article-current))
5421 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5422 ;; Selected subject is different from current article's.
5423 (gnus-summary-display-article article)
5424 (when article-window
5425 (gnus-eval-in-buffer-window gnus-article-buffer
5426 (setq endp (gnus-article-next-page lines)))
5429 (gnus-summary-beginning-of-article))
5431 (gnus-message 3 "End of message"))
5433 (if (and (eq gnus-summary-goto-unread 'never)
5434 (not (gnus-summary-last-article-p article)))
5435 (gnus-summary-next-article)
5436 (gnus-summary-next-unread-article))))))))
5437 (gnus-summary-recenter)
5438 (gnus-summary-position-point)))
5440 (defun gnus-summary-prev-page (&optional lines move)
5441 "Show previous page of selected article.
5442 Argument LINES specifies lines to be scrolled down.
5443 If MOVE, move to the previous unread article if point is at
5444 the beginning of the buffer."
5446 (gnus-set-global-variables)
5447 (let ((article (gnus-summary-article-number))
5448 (article-window (get-buffer-window gnus-article-buffer t))
5450 (gnus-configure-windows 'article)
5451 (if (or (null gnus-current-article)
5452 (null gnus-article-current)
5453 (/= article (cdr gnus-article-current))
5454 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5455 ;; Selected subject is different from current article's.
5456 (gnus-summary-display-article article)
5457 (gnus-summary-recenter)
5458 (when article-window
5459 (gnus-eval-in-buffer-window gnus-article-buffer
5460 (setq endp (gnus-article-prev-page lines)))
5461 (when (and move endp)
5463 (gnus-message 3 "Beginning of message"))
5465 (if (and (eq gnus-summary-goto-unread 'never)
5466 (not (gnus-summary-first-article-p article)))
5467 (gnus-summary-prev-article)
5468 (gnus-summary-prev-unread-article))))))))
5469 (gnus-summary-position-point))
5471 (defun gnus-summary-prev-page-or-article (&optional lines)
5472 "Show previous page of selected article.
5473 Argument LINES specifies lines to be scrolled down.
5474 If at the beginning of the article, go to the next article."
5476 (gnus-summary-prev-page lines t))
5478 (defun gnus-summary-scroll-up (lines)
5479 "Scroll up (or down) one line current article.
5480 Argument LINES specifies lines to be scrolled up (or down if negative)."
5482 (gnus-set-global-variables)
5483 (gnus-configure-windows 'article)
5484 (gnus-summary-show-thread)
5485 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5486 (gnus-eval-in-buffer-window gnus-article-buffer
5488 (when (gnus-article-next-page lines)
5489 (gnus-message 3 "End of message")))
5491 (gnus-article-prev-page (- lines))))))
5492 (gnus-summary-recenter)
5493 (gnus-summary-position-point))
5495 (defun gnus-summary-next-same-subject ()
5496 "Select next article which has the same subject as current one."
5498 (gnus-set-global-variables)
5499 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5501 (defun gnus-summary-prev-same-subject ()
5502 "Select previous article which has the same subject as current one."
5504 (gnus-set-global-variables)
5505 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5507 (defun gnus-summary-next-unread-same-subject ()
5508 "Select next unread article which has the same subject as current one."
5510 (gnus-set-global-variables)
5511 (gnus-summary-next-article t (gnus-summary-article-subject)))
5513 (defun gnus-summary-prev-unread-same-subject ()
5514 "Select previous unread article which has the same subject as current one."
5516 (gnus-set-global-variables)
5517 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5519 (defun gnus-summary-first-unread-article ()
5520 "Select the first unread article.
5521 Return nil if there are no unread articles."
5523 (gnus-set-global-variables)
5525 (when (gnus-summary-first-subject t)
5526 (gnus-summary-show-thread)
5527 (gnus-summary-first-subject t)
5528 (gnus-summary-display-article (gnus-summary-article-number)))
5529 (gnus-summary-position-point)))
5531 (defun gnus-summary-first-article ()
5532 "Select the first article.
5533 Return nil if there are no articles."
5535 (gnus-set-global-variables)
5537 (when (gnus-summary-first-subject)
5538 (gnus-summary-show-thread)
5539 (gnus-summary-first-subject)
5540 (gnus-summary-display-article (gnus-summary-article-number)))
5541 (gnus-summary-position-point)))
5543 (defun gnus-summary-best-unread-article ()
5544 "Select the unread article with the highest score."
5546 (gnus-set-global-variables)
5547 (let ((best -1000000)
5548 (data gnus-newsgroup-data)
5551 (and (gnus-data-unread-p (car data))
5553 (gnus-summary-article-score (gnus-data-number (car data))))
5556 article (gnus-data-number (car data))))
5557 (setq data (cdr data)))
5560 (gnus-summary-goto-article article)
5561 (error "No unread articles"))
5562 (gnus-summary-position-point))))
5564 (defun gnus-summary-last-subject ()
5565 "Go to the last displayed subject line in the group."
5566 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5568 (gnus-summary-goto-subject article))))
5570 (defun gnus-summary-goto-article (article &optional all-headers force)
5571 "Fetch ARTICLE and display it if it exists.
5572 If ALL-HEADERS is non-nil, no header lines are hidden."
5578 (mapcar (lambda (number) (list (int-to-string number)))
5579 gnus-newsgroup-limit)))
5583 (if (gnus-summary-goto-subject article force)
5584 (gnus-summary-display-article article all-headers)
5585 (gnus-message 4 "Couldn't go to article %s" article) nil)
5586 (gnus-summary-position-point)))
5588 (defun gnus-summary-goto-last-article ()
5589 "Go to the previously read article."
5592 (when gnus-last-article
5593 (gnus-summary-goto-article gnus-last-article))
5594 (gnus-summary-position-point)))
5596 (defun gnus-summary-pop-article (number)
5597 "Pop one article off the history and go to the previous.
5598 NUMBER articles will be popped off."
5601 (setq gnus-newsgroup-history
5602 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5604 (gnus-summary-goto-article (car to))
5605 (error "Article history empty")))
5606 (gnus-summary-position-point))
5608 ;; Summary commands and functions for limiting the summary buffer.
5610 (defun gnus-summary-limit-to-articles (n)
5611 "Limit the summary buffer to the next N articles.
5612 If not given a prefix, use the process marked articles instead."
5614 (gnus-set-global-variables)
5616 (let ((articles (gnus-summary-work-articles n)))
5617 (setq gnus-newsgroup-processable nil)
5618 (gnus-summary-limit articles))
5619 (gnus-summary-position-point)))
5621 (defun gnus-summary-pop-limit (&optional total)
5622 "Restore the previous limit.
5623 If given a prefix, remove all limits."
5625 (gnus-set-global-variables)
5627 (setq gnus-newsgroup-limits
5628 (list (mapcar (lambda (h) (mail-header-number h))
5629 gnus-newsgroup-headers))))
5630 (unless gnus-newsgroup-limits
5631 (error "No limit to pop"))
5633 (gnus-summary-limit nil 'pop)
5634 (gnus-summary-position-point)))
5636 (defun gnus-summary-limit-to-subject (subject &optional header)
5637 "Limit the summary buffer to articles that have subjects that match a regexp."
5638 (interactive "sLimit to subject (regexp): ")
5640 (setq header "subject"))
5641 (when (not (equal "" subject))
5643 (let ((articles (gnus-summary-find-matching
5644 (or header "subject") subject 'all)))
5646 (error "Found no matches for \"%s\"" subject))
5647 (gnus-summary-limit articles))
5648 (gnus-summary-position-point))))
5650 (defun gnus-summary-limit-to-author (from)
5651 "Limit the summary buffer to articles that have authors that match a regexp."
5652 (interactive "sLimit to author (regexp): ")
5653 (gnus-summary-limit-to-subject from "from"))
5655 (defun gnus-summary-limit-to-age (age &optional younger-p)
5656 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5657 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5658 articles that are younger than AGE days."
5659 (interactive "nTime in days: \nP")
5661 (let ((data gnus-newsgroup-data)
5662 (cutoff (nnmail-days-to-time age))
5663 articles d date is-younger)
5664 (while (setq d (pop data))
5665 (when (and (vectorp (gnus-data-header d))
5666 (setq date (mail-header-date (gnus-data-header d))))
5667 (setq is-younger (nnmail-time-less
5668 (nnmail-time-since (nnmail-date-to-time date))
5670 (when (if younger-p is-younger (not is-younger))
5671 (push (gnus-data-number d) articles))))
5672 (gnus-summary-limit (nreverse articles)))
5673 (gnus-summary-position-point)))
5675 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5677 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5679 (defun gnus-summary-limit-to-unread (&optional all)
5680 "Limit the summary buffer to articles that are not marked as read.
5681 If ALL is non-nil, limit strictly to unread articles."
5684 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5685 (gnus-summary-limit-to-marks
5686 ;; Concat all the marks that say that an article is read and have
5688 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5689 gnus-killed-mark gnus-kill-file-mark
5690 gnus-low-score-mark gnus-expirable-mark
5691 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5692 gnus-duplicate-mark gnus-souped-mark)
5695 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5696 (make-obsolete 'gnus-summary-delete-marked-with
5697 'gnus-summary-limit-exlude-marks)
5699 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5700 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5701 If REVERSE, limit the summary buffer to articles that are marked
5702 with MARKS. MARKS can either be a string of marks or a list of marks.
5703 Returns how many articles were removed."
5704 (interactive "sMarks: ")
5705 (gnus-summary-limit-to-marks marks t))
5707 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5708 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5709 If REVERSE (the prefix), limit the summary buffer to articles that are
5710 not marked with MARKS. MARKS can either be a string of marks or a
5712 Returns how many articles were removed."
5713 (interactive (list (read-string "Marks: ") current-prefix-arg))
5714 (gnus-set-global-variables)
5716 (let ((data gnus-newsgroup-data)
5717 (marks (if (listp marks) marks
5718 (append marks nil))) ; Transform to list.
5721 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5722 (memq (gnus-data-mark (car data)) marks))
5723 (push (gnus-data-number (car data)) articles))
5724 (setq data (cdr data)))
5725 (gnus-summary-limit articles))
5726 (gnus-summary-position-point)))
5728 (defun gnus-summary-limit-to-score (&optional score)
5729 "Limit to articles with score at or above SCORE."
5731 (gnus-set-global-variables)
5732 (setq score (if score
5733 (prefix-numeric-value score)
5734 (or gnus-summary-default-score 0)))
5735 (let ((data gnus-newsgroup-data)
5738 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5740 (push (gnus-data-number (car data)) articles))
5741 (setq data (cdr data)))
5743 (gnus-summary-limit articles)
5744 (gnus-summary-position-point))))
5746 (defun gnus-summary-limit-include-dormant ()
5747 "Display all the hidden articles that are marked as dormant."
5749 (gnus-set-global-variables)
5750 (unless gnus-newsgroup-dormant
5751 (error "There are no dormant articles in this group"))
5753 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5754 (gnus-summary-position-point)))
5756 (defun gnus-summary-limit-exclude-dormant ()
5757 "Hide all dormant articles."
5759 (gnus-set-global-variables)
5761 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5762 (gnus-summary-position-point)))
5764 (defun gnus-summary-limit-exclude-childless-dormant ()
5765 "Hide all dormant articles that have no children."
5767 (gnus-set-global-variables)
5768 (let ((data (gnus-data-list t))
5769 articles d children)
5770 ;; Find all articles that are either not dormant or have
5772 (while (setq d (pop data))
5773 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5775 (gnus-article-children (gnus-data-number d)))
5778 (when (memq (car children) articles)
5783 (push (gnus-data-number d) articles)))
5786 (gnus-summary-limit articles)
5787 (gnus-summary-position-point))))
5789 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5790 "Mark all unread excluded articles as read.
5791 If ALL, mark even excluded ticked and dormants as read."
5793 (let ((articles (gnus-sorted-complement
5795 (mapcar (lambda (h) (mail-header-number h))
5796 gnus-newsgroup-headers)
5798 (sort gnus-newsgroup-limit '<)))
5800 (setq gnus-newsgroup-unreads nil)
5802 (setq gnus-newsgroup-dormant nil
5803 gnus-newsgroup-marked nil
5804 gnus-newsgroup-reads
5806 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5807 gnus-newsgroup-reads))
5808 (while (setq article (pop articles))
5809 (unless (or (memq article gnus-newsgroup-dormant)
5810 (memq article gnus-newsgroup-marked))
5811 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5813 (defun gnus-summary-limit (articles &optional pop)
5815 ;; We pop the previous limit off the stack and use that.
5816 (setq articles (car gnus-newsgroup-limits)
5817 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5818 ;; We use the new limit, so we push the old limit on the stack.
5819 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5821 (setq gnus-newsgroup-limit articles)
5822 (let ((total (length gnus-newsgroup-data))
5823 (data (gnus-data-find-list (gnus-summary-article-number)))
5824 (gnus-summary-mark-below nil) ; Inhibit this.
5826 ;; This will do all the work of generating the new summary buffer
5827 ;; according to the new limit.
5828 (gnus-summary-prepare)
5829 ;; Hide any threads, possibly.
5830 (and gnus-show-threads
5831 gnus-thread-hide-subtree
5832 (gnus-summary-hide-all-threads))
5833 ;; Try to return to the article you were at, or one in the
5836 ;; We try to find some article after the current one.
5838 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5841 (setq data (cdr data))))
5843 ;; If there is no data, that means that we were after the last
5844 ;; article. The same goes when we can't find any articles
5845 ;; after the current one.
5846 (goto-char (point-max))
5847 (gnus-summary-find-prev))
5848 ;; We return how many articles were removed from the summary
5849 ;; buffer as a result of the new limit.
5850 (- total (length gnus-newsgroup-data))))
5852 (defsubst gnus-invisible-cut-children (threads)
5855 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5860 (defsubst gnus-cut-thread (thread)
5861 "Go forwards in the thread until we find an article that we want to display."
5862 (when (or (eq gnus-fetch-old-headers 'some)
5863 (eq gnus-build-sparse-threads 'some)
5864 (eq gnus-build-sparse-threads 'more))
5865 ;; Deal with old-fetched headers and sparse threads.
5869 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
5870 (gnus-summary-article-ancient-p
5871 (mail-header-number (car thread))))
5873 (if (<= (length (cdr thread)) 1)
5874 (setq thread (cadr thread))
5875 (when (gnus-invisible-cut-children (cdr thread))
5876 (let ((th (cdr thread)))
5878 (if (memq (mail-header-number (caar th))
5879 gnus-newsgroup-limit)
5880 (setq thread (car th)
5882 (setq th (cdr th)))))))))
5886 (defun gnus-cut-threads (threads)
5887 "Cut off all uninteresting articles from the beginning of threads."
5888 (when (or (eq gnus-fetch-old-headers 'some)
5889 (eq gnus-build-sparse-threads 'some)
5890 (eq gnus-build-sparse-threads 'more))
5893 (setcar th (gnus-cut-thread (car th)))
5894 (setq th (cdr th)))))
5895 ;; Remove nixed out threads.
5898 (defun gnus-summary-initial-limit (&optional show-if-empty)
5899 "Figure out what the initial limit is supposed to be on group entry.
5900 This entails weeding out unwanted dormants, low-scored articles,
5901 fetch-old-headers verbiage, and so on."
5902 ;; Most groups have nothing to remove.
5903 (if (or gnus-inhibit-limiting
5904 (and (null gnus-newsgroup-dormant)
5905 (not (eq gnus-fetch-old-headers 'some))
5906 (null gnus-summary-expunge-below)
5907 (not (eq gnus-build-sparse-threads 'some))
5908 (not (eq gnus-build-sparse-threads 'more))
5909 (null gnus-thread-expunge-below)
5910 (not gnus-use-nocem)))
5912 (push gnus-newsgroup-limit gnus-newsgroup-limits)
5913 (setq gnus-newsgroup-limit nil)
5916 (unless (car (symbol-value node))
5917 ;; These threads have no parents -- they are roots.
5918 (let ((nodes (cdr (symbol-value node)))
5921 (if (and gnus-thread-expunge-below
5922 (< (gnus-thread-total-score (car nodes))
5923 gnus-thread-expunge-below))
5924 (gnus-expunge-thread (pop nodes))
5925 (setq thread (pop nodes))
5926 (gnus-summary-limit-children thread))))))
5927 gnus-newsgroup-dependencies)
5928 ;; If this limitation resulted in an empty group, we might
5929 ;; pop the previous limit and use it instead.
5930 (when (and (not gnus-newsgroup-limit)
5932 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
5933 gnus-newsgroup-limit))
5935 (defun gnus-summary-limit-children (thread)
5936 "Return 1 if this subthread is visible and 0 if it is not."
5937 ;; First we get the number of visible children to this thread. This
5938 ;; is done by recursing down the thread using this function, so this
5939 ;; will really go down to a leaf article first, before slowly
5940 ;; working its way up towards the root.
5944 (apply '+ (mapcar 'gnus-summary-limit-children
5947 (number (mail-header-number (car thread)))
5950 (not (memq number gnus-newsgroup-marked))
5952 ;; If this article is dormant and has absolutely no visible
5953 ;; children, then this article isn't visible.
5954 (and (memq number gnus-newsgroup-dormant)
5956 ;; If this is "fetch-old-headered" and there is no
5957 ;; visible children, then we don't want this article.
5958 (and (eq gnus-fetch-old-headers 'some)
5959 (gnus-summary-article-ancient-p number)
5961 ;; If this is a sparsely inserted article with no children,
5962 ;; we don't want it.
5963 (and (eq gnus-build-sparse-threads 'some)
5964 (gnus-summary-article-sparse-p number)
5966 ;; If we use expunging, and this article is really
5967 ;; low-scored, then we don't want this article.
5968 (when (and gnus-summary-expunge-below
5970 (or (cdr (assq number gnus-newsgroup-scored))
5971 gnus-summary-default-score))
5972 gnus-summary-expunge-below))
5973 ;; We increase the expunge-tally here, but that has
5974 ;; nothing to do with the limits, really.
5975 (incf gnus-newsgroup-expunged-tally)
5976 ;; We also mark as read here, if that's wanted.
5977 (when (and gnus-summary-mark-below
5978 (< score gnus-summary-mark-below))
5979 (setq gnus-newsgroup-unreads
5980 (delq number gnus-newsgroup-unreads))
5981 (if gnus-newsgroup-auto-expire
5982 (push number gnus-newsgroup-expirable)
5983 (push (cons number gnus-low-score-mark)
5984 gnus-newsgroup-reads)))
5986 ;; Check NoCeM things.
5987 (if (and gnus-use-nocem
5988 (gnus-nocem-unwanted-article-p
5989 (mail-header-id (car thread))))
5991 (setq gnus-newsgroup-reads
5992 (delq number gnus-newsgroup-unreads))
5994 ;; Nope, invisible article.
5996 ;; Ok, this article is to be visible, so we add it to the limit
5998 (push number gnus-newsgroup-limit)
6001 (defun gnus-expunge-thread (thread)
6002 "Mark all articles in THREAD as read."
6003 (let* ((number (mail-header-number (car thread))))
6004 (incf gnus-newsgroup-expunged-tally)
6005 ;; We also mark as read here, if that's wanted.
6006 (setq gnus-newsgroup-unreads
6007 (delq number gnus-newsgroup-unreads))
6008 (if gnus-newsgroup-auto-expire
6009 (push number gnus-newsgroup-expirable)
6010 (push (cons number gnus-low-score-mark)
6011 gnus-newsgroup-reads)))
6012 ;; Go recursively through all subthreads.
6013 (mapcar 'gnus-expunge-thread (cdr thread)))
6015 ;; Summary article oriented commands
6017 (defun gnus-summary-refer-parent-article (n)
6018 "Refer parent article N times.
6019 If N is negative, go to ancestor -N instead.
6020 The difference between N and the number of articles fetched is returned."
6022 (gnus-set-global-variables)
6025 (when (not (natnump n))
6030 (setq header (gnus-summary-article-header))
6031 (if (and (eq (mail-header-number header)
6032 (cdr gnus-article-current))
6033 (equal gnus-newsgroup-name
6034 (car gnus-article-current)))
6035 ;; If we try to find the parent of the currently
6036 ;; displayed article, then we take a look at the actual
6037 ;; References header, since this is slightly more
6038 ;; reliable than the References field we got from the
6041 (set-buffer gnus-original-article-buffer)
6042 (nnheader-narrow-to-headers)
6043 (unless (setq ref (message-fetch-field "references"))
6044 (setq ref (message-fetch-field "in-reply-to")))
6047 ;; It's not the current article, so we take a bet on
6048 ;; the value we got from the server.
6049 (mail-header-references header)))
6051 (not (equal ref "")))
6052 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6053 (gnus-message 1 "Couldn't find parent"))
6054 (gnus-message 1 "No references in article %d"
6055 (gnus-summary-article-number))
6058 (gnus-summary-position-point)
6061 (defun gnus-summary-refer-references ()
6062 "Fetch all articles mentioned in the References header.
6063 Return how many articles were fetched."
6065 (gnus-set-global-variables)
6066 (let ((ref (mail-header-references (gnus-summary-article-header)))
6067 (current (gnus-summary-article-number))
6071 (error "No References in the current article")
6072 ;; For each Message-ID in the References header...
6073 (while (string-match "<[^>]*>" ref)
6075 ;; ... fetch that article.
6076 (gnus-summary-refer-article
6077 (prog1 (match-string 0 ref)
6078 (setq ref (substring ref (match-end 0))))))
6079 (gnus-summary-goto-subject current)
6080 (gnus-summary-position-point)
6083 (defun gnus-summary-refer-article (message-id)
6084 "Fetch an article specified by MESSAGE-ID."
6085 (interactive "sMessage-ID: ")
6086 (when (and (stringp message-id)
6087 (not (zerop (length message-id))))
6088 ;; Construct the correct Message-ID if necessary.
6089 ;; Suggested by tale@pawl.rpi.edu.
6090 (unless (string-match "^<" message-id)
6091 (setq message-id (concat "<" message-id)))
6092 (unless (string-match ">$" message-id)
6093 (setq message-id (concat message-id ">")))
6094 (let* ((header (gnus-id-to-header message-id))
6096 (gnus-summary-article-sparse-p
6097 (mail-header-number header)))))
6100 ;; The article is present in the buffer, to we just go to it.
6101 (gnus-summary-goto-article
6102 (mail-header-number header) nil header)
6104 (gnus-summary-update-article (mail-header-number header))))
6105 ;; We fetch the article
6106 (let ((gnus-override-method
6107 (and (gnus-news-group-p gnus-newsgroup-name)
6108 gnus-refer-article-method))
6110 ;; Start the special refer-article method, if necessary.
6111 (when (and gnus-refer-article-method
6112 (gnus-news-group-p gnus-newsgroup-name))
6113 (gnus-check-server gnus-refer-article-method))
6114 ;; Fetch the header, and display the article.
6115 (if (setq number (gnus-summary-insert-subject message-id))
6116 (gnus-summary-select-article nil nil nil number)
6117 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6119 (defun gnus-summary-enter-digest-group (&optional force)
6120 "Enter an nndoc group based on the current article.
6121 If FORCE, force a digest interpretation. If not, try
6122 to guess what the document format is."
6124 (gnus-set-global-variables)
6125 (let ((conf gnus-current-window-configuration))
6127 (gnus-summary-select-article))
6128 (setq gnus-current-window-configuration conf)
6129 (let* ((name (format "%s-%d"
6130 (gnus-group-prefixed-name
6131 gnus-newsgroup-name (list 'nndoc ""))
6133 (set-buffer gnus-summary-buffer)
6134 gnus-current-article)))
6135 (ogroup gnus-newsgroup-name)
6136 (params (append (gnus-info-params (gnus-get-info ogroup))
6137 (list (cons 'to-group ogroup))))
6138 (case-fold-search t)
6139 (buf (current-buffer))
6142 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6143 (insert-buffer-substring gnus-original-article-buffer)
6144 ;; Remove lines that may lead nndoc to misinterpret the
6147 (goto-char (point-min))
6148 (or (search-forward "\n\n" nil t) (point)))
6149 (goto-char (point-min))
6150 (delete-matching-lines "^\\(Path\\):\\|^From ")
6153 (if (gnus-group-read-ephemeral-group
6154 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6156 ,(if force 'digest 'guess))) t)
6157 ;; Make all postings to this group go to the parent group.
6158 (nconc (gnus-info-params (gnus-get-info name))
6160 ;; Couldn't select this doc group.
6161 (switch-to-buffer buf)
6162 (gnus-set-global-variables)
6163 (gnus-configure-windows 'summary)
6164 (gnus-message 3 "Article couldn't be entered?"))
6165 (kill-buffer dig)))))
6167 (defun gnus-summary-read-document (n)
6168 "Open a new group based on the current article(s).
6169 This will allow you to read digests and other similar
6170 documents as newsgroups.
6171 Obeys the standard process/prefix convention."
6173 (let* ((articles (gnus-summary-work-articles n))
6174 (ogroup gnus-newsgroup-name)
6175 (params (append (gnus-info-params (gnus-get-info ogroup))
6176 (list (cons 'to-group ogroup))))
6177 article group egroup groups vgroup)
6178 (while (setq article (pop articles))
6179 (setq group (format "%s-%d" gnus-newsgroup-name article))
6180 (gnus-summary-remove-process-mark article)
6181 (when (gnus-summary-display-article article)
6183 (nnheader-temp-write nil
6184 (insert-buffer-substring gnus-original-article-buffer)
6185 ;; Remove some headers that may lead nndoc to make
6187 (message-narrow-to-head)
6188 (goto-char (point-min))
6189 (delete-matching-lines "^\\(Path\\):\\|^From ")
6192 (gnus-group-read-ephemeral-group
6193 group `(nndoc ,group (nndoc-address ,(current-buffer))
6194 (nndoc-article-type guess))
6197 ;; Make all postings to this group go to the parent group.
6198 (nconc (gnus-info-params (gnus-get-info egroup))
6200 (push egroup groups))
6201 ;; Couldn't select this doc group.
6202 (gnus-error 3 "Article couldn't be entered"))))))
6203 ;; Now we have selected all the documents.
6206 (error "None of the articles could be interpreted as documents"))
6207 ((gnus-group-read-ephemeral-group
6208 (setq vgroup (format
6209 "nnvirtual:%s-%s" gnus-newsgroup-name
6210 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6211 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6213 (cons (current-buffer) 'summary)))
6215 (error "Couldn't select virtual nndoc group")))))
6217 (defun gnus-summary-isearch-article (&optional regexp-p)
6218 "Do incremental search forward on the current article.
6219 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6221 (gnus-set-global-variables)
6222 (gnus-summary-select-article)
6223 (gnus-configure-windows 'article)
6224 (gnus-eval-in-buffer-window gnus-article-buffer
6225 ;;(goto-char (point-min))
6226 (isearch-forward regexp-p)))
6228 (defun gnus-summary-search-article-forward (regexp &optional backward)
6229 "Search for an article containing REGEXP forward.
6230 If BACKWARD, search backward instead."
6233 (format "Search article %s (regexp%s): "
6234 (if current-prefix-arg "backward" "forward")
6235 (if gnus-last-search-regexp
6236 (concat ", default " gnus-last-search-regexp)
6238 current-prefix-arg))
6239 (gnus-set-global-variables)
6240 (if (string-equal regexp "")
6241 (setq regexp (or gnus-last-search-regexp ""))
6242 (setq gnus-last-search-regexp regexp))
6243 (if (gnus-summary-search-article regexp backward)
6244 (gnus-summary-show-thread)
6245 (error "Search failed: \"%s\"" regexp)))
6247 (defun gnus-summary-search-article-backward (regexp)
6248 "Search for an article containing REGEXP backward."
6251 (format "Search article backward (regexp%s): "
6252 (if gnus-last-search-regexp
6253 (concat ", default " gnus-last-search-regexp)
6255 (gnus-summary-search-article-forward regexp 'backward))
6257 (defun gnus-summary-search-article (regexp &optional backward)
6258 "Search for an article containing REGEXP.
6259 Optional argument BACKWARD means do search for backward.
6260 `gnus-select-article-hook' is not called during the search."
6261 (let ((gnus-select-article-hook nil) ;Disable hook.
6262 (gnus-article-display-hook nil)
6263 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6264 (gnus-use-article-prefetch nil)
6265 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6266 (sum (current-buffer))
6269 (gnus-save-hidden-threads
6270 (gnus-summary-select-article)
6271 (set-buffer gnus-article-buffer)
6275 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6277 (re-search-backward regexp nil t)
6278 (re-search-forward regexp nil t))
6279 ;; We found the regexp.
6284 (get-buffer-window (current-buffer))
6288 (setq point (point)))
6289 ;; We didn't find it, so we go to the next article.
6292 (while (eq found 'not)
6293 (if (not (if backward (gnus-summary-find-prev)
6294 (gnus-summary-find-next)))
6295 ;; No more articles.
6297 ;; Select the next article and adjust point.
6298 (unless (gnus-summary-article-sparse-p
6299 (gnus-summary-article-number))
6301 (gnus-summary-select-article)
6302 (set-buffer gnus-article-buffer)
6304 (goto-char (if backward (point-max) (point-min))))))))
6305 (gnus-message 7 ""))
6306 ;; Return whether we found the regexp.
6307 (when (eq found 'found)
6309 (gnus-summary-show-thread)
6310 (gnus-summary-goto-subject gnus-current-article)
6311 (gnus-summary-position-point)
6314 (defun gnus-summary-find-matching (header regexp &optional backward unread
6316 "Return a list of all articles that match REGEXP on HEADER.
6317 The search stars on the current article and goes forwards unless
6318 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6319 If UNREAD is non-nil, only unread articles will
6320 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6321 in the comparisons."
6322 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6323 (gnus-data-find-list
6324 (gnus-summary-article-number) (gnus-data-list backward))))
6325 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6326 (case-fold-search (not not-case-fold))
6328 (unless (fboundp (intern (concat "mail-header-" header)))
6329 (error "%s is not a valid header" header))
6332 (and (or (not unread) ; We want all articles...
6333 (gnus-data-unread-p d)) ; Or just unreads.
6334 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6335 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6336 (push (gnus-data-number d) articles)) ; Success!
6337 (setq data (cdr data)))
6338 (nreverse articles)))
6340 (defun gnus-summary-execute-command (header regexp command &optional backward)
6341 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6342 If HEADER is an empty string (or nil), the match is done on the entire
6343 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6345 (list (let ((completion-ignore-case t))
6348 (mapcar (lambda (string) (list string))
6349 '("Number" "Subject" "From" "Lines" "Date"
6350 "Message-ID" "Xref" "References" "Body"))
6351 nil 'require-match))
6352 (read-string "Regexp: ")
6353 (read-key-sequence "Command: ")
6354 current-prefix-arg))
6355 (when (equal header "Body")
6357 (gnus-set-global-variables)
6358 ;; Hidden thread subtrees must be searched as well.
6359 (gnus-summary-show-all-threads)
6360 ;; We don't want to change current point nor window configuration.
6362 (save-window-excursion
6363 (gnus-message 6 "Executing %s..." (key-description command))
6364 ;; We'd like to execute COMMAND interactively so as to give arguments.
6365 (gnus-execute header regexp
6366 `(call-interactively ',(key-binding command))
6368 (gnus-message 6 "Executing %s...done" (key-description command)))))
6370 (defun gnus-summary-beginning-of-article ()
6371 "Scroll the article back to the beginning."
6373 (gnus-set-global-variables)
6374 (gnus-summary-select-article)
6375 (gnus-configure-windows 'article)
6376 (gnus-eval-in-buffer-window gnus-article-buffer
6378 (goto-char (point-min))
6379 (when gnus-break-pages
6380 (gnus-narrow-to-page))))
6382 (defun gnus-summary-end-of-article ()
6383 "Scroll to the end of the article."
6385 (gnus-set-global-variables)
6386 (gnus-summary-select-article)
6387 (gnus-configure-windows 'article)
6388 (gnus-eval-in-buffer-window gnus-article-buffer
6390 (goto-char (point-max))
6392 (when gnus-break-pages
6393 (gnus-narrow-to-page))))
6395 (defun gnus-summary-print-article (&optional filename)
6396 "Generate and print a PostScript image of the article buffer.
6398 If the optional argument FILENAME is nil, send the image to the printer.
6399 If FILENAME is a string, save the PostScript image in a file with that
6400 name. If FILENAME is a number, prompt the user for the name of the file
6402 (interactive (list (ps-print-preprint current-prefix-arg)))
6403 (gnus-summary-select-article)
6404 (gnus-eval-in-buffer-window gnus-article-buffer
6405 (let ((buffer (generate-new-buffer " *print*")))
6408 (copy-to-buffer buffer (point-min) (point-max))
6410 (gnus-article-delete-invisible-text)
6411 (run-hooks 'gnus-ps-print-hook)
6412 (ps-print-buffer-with-faces filename))
6413 (kill-buffer buffer)))))
6415 (defun gnus-summary-show-article (&optional arg)
6416 "Force re-fetching of the current article.
6417 If ARG (the prefix) is non-nil, show the raw article without any
6418 article massaging functions being run."
6420 (gnus-set-global-variables)
6422 ;; Select the article the normal way.
6423 (gnus-summary-select-article nil 'force)
6424 ;; Bind the article treatment functions to nil.
6425 (let ((gnus-have-all-headers t)
6426 gnus-article-display-hook
6427 gnus-article-prepare-hook
6430 (gnus-summary-select-article nil 'force)))
6431 (gnus-summary-goto-subject gnus-current-article)
6432 ; (gnus-configure-windows 'article)
6433 (gnus-summary-position-point))
6435 (defun gnus-summary-verbose-headers (&optional arg)
6436 "Toggle permanent full header display.
6437 If ARG is a positive number, turn header display on.
6438 If ARG is a negative number, turn header display off."
6440 (gnus-set-global-variables)
6441 (setq gnus-show-all-headers
6442 (cond ((or (not (numberp arg))
6444 (not gnus-show-all-headers))
6447 (gnus-summary-show-article))
6449 (defun gnus-summary-toggle-header (&optional arg)
6450 "Show the headers if they are hidden, or hide them if they are shown.
6451 If ARG is a positive number, show the entire header.
6452 If ARG is a negative number, hide the unwanted header lines."
6454 (gnus-set-global-variables)
6456 (set-buffer gnus-article-buffer)
6457 (let* ((buffer-read-only nil)
6458 (inhibit-point-motion-hooks t)
6459 (hidden (text-property-any
6460 (goto-char (point-min)) (search-forward "\n\n")
6463 (goto-char (point-min))
6464 (when (search-forward "\n\n" nil t)
6465 (delete-region (point-min) (1- (point))))
6466 (goto-char (point-min))
6468 (set-buffer gnus-original-article-buffer)
6469 (goto-char (point-min))
6470 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6471 (insert-buffer-substring gnus-original-article-buffer 1 e)
6472 (let ((article-inhibit-hiding t))
6473 (run-hooks 'gnus-article-display-hook))
6474 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6475 (gnus-article-hide-headers)))))
6477 (defun gnus-summary-show-all-headers ()
6478 "Make all header lines visible."
6480 (gnus-set-global-variables)
6481 (gnus-article-show-all-headers))
6483 (defun gnus-summary-toggle-mime (&optional arg)
6484 "Toggle MIME processing.
6485 If ARG is a positive number, turn MIME processing on."
6487 (gnus-set-global-variables)
6488 (setq gnus-show-mime
6489 (if (null arg) (not gnus-show-mime)
6490 (> (prefix-numeric-value arg) 0)))
6491 (gnus-summary-select-article t 'force))
6493 (defun gnus-summary-caesar-message (&optional arg)
6494 "Caesar rotate the current article by 13.
6495 The numerical prefix specifies how many places to rotate each letter
6498 (gnus-set-global-variables)
6499 (gnus-summary-select-article)
6500 (let ((mail-header-separator ""))
6501 (gnus-eval-in-buffer-window gnus-article-buffer
6504 (let ((start (window-start))
6506 (message-caesar-buffer-body arg)
6507 (set-window-start (get-buffer-window (current-buffer)) start))))))
6509 (defun gnus-summary-stop-page-breaking ()
6510 "Stop page breaking in the current article."
6512 (gnus-set-global-variables)
6513 (gnus-summary-select-article)
6514 (gnus-eval-in-buffer-window gnus-article-buffer
6516 (when (gnus-visual-p 'page-marker)
6517 (let ((buffer-read-only nil))
6518 (gnus-remove-text-with-property 'gnus-prev)
6519 (gnus-remove-text-with-property 'gnus-next)))))
6521 (defun gnus-summary-move-article (&optional n to-newsgroup
6522 select-method action)
6523 "Move the current article to a different newsgroup.
6524 If N is a positive number, move the N next articles.
6525 If N is a negative number, move the N previous articles.
6526 If N is nil and any articles have been marked with the process mark,
6527 move those articles instead.
6528 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6529 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6530 re-spool using this method.
6532 For this function to work, both the current newsgroup and the
6533 newsgroup that you want to move to have to support the `request-move'
6534 and `request-accept' functions."
6537 (setq action 'move))
6538 (gnus-set-global-variables)
6539 ;; Disable marking as read.
6540 (let (gnus-mark-article-hook)
6541 (save-window-excursion
6542 (gnus-summary-select-article)))
6543 ;; Check whether the source group supports the required functions.
6544 (cond ((and (eq action 'move)
6545 (not (gnus-check-backend-function
6546 'request-move-article gnus-newsgroup-name)))
6547 (error "The current group does not support article moving"))
6548 ((and (eq action 'crosspost)
6549 (not (gnus-check-backend-function
6550 'request-replace-article gnus-newsgroup-name)))
6551 (error "The current group does not support article editing")))
6552 (let ((articles (gnus-summary-work-articles n))
6553 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6554 (names '((move "Move" "Moving")
6555 (copy "Copy" "Copying")
6556 (crosspost "Crosspost" "Crossposting")))
6557 (copy-buf (save-excursion
6558 (nnheader-set-temp-buffer " *copy article*")))
6559 art-group to-method new-xref article to-groups)
6560 (unless (assq action names)
6561 (error "Unknown action %s" action))
6562 ;; Read the newsgroup name.
6563 (when (and (not to-newsgroup)
6564 (not select-method))
6566 (gnus-read-move-group-name
6567 (cadr (assq action names))
6568 (symbol-value (intern (format "gnus-current-%s-group" action)))
6570 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6571 (setq to-method (or select-method
6572 (gnus-group-name-to-method to-newsgroup)))
6573 ;; Check the method we are to move this article to...
6574 (unless (gnus-check-backend-function
6575 'request-accept-article (car to-method))
6576 (error "%s does not support article copying" (car to-method)))
6577 (unless (gnus-check-server to-method)
6578 (error "Can't open server %s" (car to-method)))
6579 (gnus-message 6 "%s to %s: %s..."
6580 (caddr (assq action names))
6581 (or (car select-method) to-newsgroup) articles)
6583 (setq article (pop articles))
6587 ;; Move the article.
6589 (gnus-request-move-article
6590 article ; Article to move
6591 gnus-newsgroup-name ; From newsgroup
6592 (nth 1 (gnus-find-method-for-group
6593 gnus-newsgroup-name)) ; Server
6594 (list 'gnus-request-accept-article
6595 to-newsgroup (list 'quote select-method)
6596 (not articles)) ; Accept form
6597 (not articles))) ; Only save nov last time
6598 ;; Copy the article.
6601 (set-buffer copy-buf)
6602 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6603 (gnus-request-accept-article
6604 to-newsgroup select-method (not articles))))
6605 ;; Crosspost the article.
6606 ((eq action 'crosspost)
6607 (let ((xref (message-tokenize-header
6608 (mail-header-xref (gnus-summary-article-header article))
6610 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6613 (setq xref (list (system-name))))
6616 (mapconcat 'identity
6617 (delete "Xref:" (delete new-xref xref))
6621 (set-buffer copy-buf)
6622 ;; First put the article in the destination group.
6623 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6625 (gnus-request-accept-article
6626 to-newsgroup select-method (not articles)))
6627 (setq new-xref (concat new-xref " " (car art-group)
6628 ":" (cdr art-group)))
6629 ;; Now we have the new Xrefs header, so we insert
6630 ;; it and replace the new article.
6631 (nnheader-replace-header "Xref" new-xref)
6632 (gnus-request-replace-article
6633 (cdr art-group) to-newsgroup (current-buffer))
6636 (gnus-message 1 "Couldn't %s article %s"
6637 (cadr (assq action names)) article)
6640 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6642 (gnus-group-prefixed-name
6645 (gnus-find-method-for-group to-newsgroup)))
6646 gnus-newsrc-hashtb)))
6647 (info (nth 2 entry))
6648 (to-group (gnus-info-group info)))
6649 ;; Update the group that has been moved to.
6651 (memq action '(move copy)))
6652 (unless (member to-group to-groups)
6653 (push to-group to-groups))
6655 (unless (memq article gnus-newsgroup-unreads)
6657 info (gnus-add-to-range (gnus-info-read info)
6658 (list (cdr art-group)))))
6660 ;; Copy any marks over to the new group.
6661 (let ((marks gnus-article-mark-lists)
6662 (to-article (cdr art-group)))
6664 ;; See whether the article is to be put in the cache.
6665 (when gnus-use-cache
6666 (gnus-cache-possibly-enter-article
6668 (let ((header (copy-sequence
6669 (gnus-summary-article-header article))))
6670 (mail-header-set-number header to-article)
6672 (memq article gnus-newsgroup-marked)
6673 (memq article gnus-newsgroup-dormant)
6674 (memq article gnus-newsgroup-unreads)))
6676 (when (and (equal to-group gnus-newsgroup-name)
6677 (not (memq article gnus-newsgroup-unreads)))
6678 ;; Mark this article as read in this group.
6679 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6680 (setcdr (gnus-active to-group) to-article)
6681 (setcdr gnus-newsgroup-active to-article))
6684 (when (memq article (symbol-value
6685 (intern (format "gnus-newsgroup-%s"
6687 ;; If the other group is the same as this group,
6688 ;; then we have to add the mark to the list.
6689 (when (equal to-group gnus-newsgroup-name)
6690 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6693 (intern (format "gnus-newsgroup-%s"
6695 ;; Copy the marks to other group.
6696 (gnus-add-marked-articles
6697 to-group (cdar marks) (list to-article) info))
6698 (setq marks (cdr marks)))))
6700 ;; Update the Xref header in this article to point to
6701 ;; the new crossposted article we have just created.
6702 (when (eq action 'crosspost)
6704 (set-buffer copy-buf)
6705 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6706 (nnheader-replace-header "Xref" new-xref)
6707 (gnus-request-replace-article
6708 article gnus-newsgroup-name (current-buffer)))))
6710 (gnus-summary-goto-subject article)
6711 (when (eq action 'move)
6712 (gnus-summary-mark-article article gnus-canceled-mark)))
6713 (gnus-summary-remove-process-mark article))
6714 ;; Re-activate all groups that have been moved to.
6716 (gnus-activate-group (pop to-groups)))
6718 (gnus-kill-buffer copy-buf)
6719 (gnus-summary-position-point)
6720 (gnus-set-mode-line 'summary)))
6722 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6723 "Move the current article to a different newsgroup.
6724 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6725 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6726 re-spool using this method."
6728 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6730 (defun gnus-summary-crosspost-article (&optional n)
6731 "Crosspost the current article to some other group."
6733 (gnus-summary-move-article n nil nil 'crosspost))
6735 (defcustom gnus-summary-respool-default-method nil
6736 "Default method for respooling an article.
6737 If nil, use to the current newsgroup method."
6738 :type 'gnus-select-method-name
6739 :group 'gnus-summary-mail)
6741 (defun gnus-summary-respool-article (&optional n method)
6742 "Respool the current article.
6743 The article will be squeezed through the mail spooling process again,
6744 which means that it will be put in some mail newsgroup or other
6745 depending on `nnmail-split-methods'.
6746 If N is a positive number, respool the N next articles.
6747 If N is a negative number, respool the N previous articles.
6748 If N is nil and any articles have been marked with the process mark,
6749 respool those articles instead.
6751 Respooling can be done both from mail groups and \"real\" newsgroups.
6752 In the former case, the articles in question will be moved from the
6753 current group into whatever groups they are destined to. In the
6754 latter case, they will be copied into the relevant groups."
6756 (list current-prefix-arg
6757 (let* ((methods (gnus-methods-using 'respool))
6759 (symbol-name (or gnus-summary-respool-default-method
6760 (car (gnus-find-method-for-group
6761 gnus-newsgroup-name)))))
6763 (gnus-completing-read
6764 methname "What backend do you want to use when respooling?"
6765 methods nil t nil 'gnus-mail-method-history))
6768 ((zerop (length (setq ms (gnus-servers-using-backend
6770 (list (intern method) ""))
6774 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6775 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6777 (gnus-set-global-variables)
6779 (error "No method given for respooling"))
6780 (if (assoc (symbol-name
6781 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6782 (gnus-methods-using 'respool))
6783 (gnus-summary-move-article n nil method)
6784 (gnus-summary-copy-article n nil method)))
6786 (defun gnus-summary-import-article (file)
6787 "Import a random file into a mail newsgroup."
6788 (interactive "fImport file: ")
6789 (gnus-set-global-variables)
6790 (let ((group gnus-newsgroup-name)
6791 (now (current-time))
6793 (unless (gnus-check-backend-function 'request-accept-article group)
6794 (error "%s does not support article importing" group))
6795 (or (file-readable-p file)
6796 (not (file-regular-p file))
6797 (error "Can't read %s" file))
6799 (set-buffer (get-buffer-create " *import file*"))
6800 (buffer-disable-undo (current-buffer))
6802 (insert-file-contents file)
6803 (goto-char (point-min))
6804 (unless (nnheader-article-p)
6805 ;; This doesn't look like an article, so we fudge some headers.
6806 (setq atts (file-attributes file)
6807 lines (count-lines (point-min) (point-max)))
6808 (insert "From: " (read-string "From: ") "\n"
6809 "Subject: " (read-string "Subject: ") "\n"
6810 "Date: " (timezone-make-date-arpa-standard
6811 (current-time-string (nth 5 atts))
6812 (current-time-zone now)
6813 (current-time-zone now))
6815 "Message-ID: " (message-make-message-id) "\n"
6816 "Lines: " (int-to-string lines) "\n"
6817 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6818 (gnus-request-accept-article group nil t)
6819 (kill-buffer (current-buffer)))))
6821 (defun gnus-summary-article-posted-p ()
6822 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6823 This will be the case if the article has both been mailed and posted."
6825 (let ((id (mail-header-references (gnus-summary-article-header)))
6826 (gnus-override-method
6827 (or gnus-refer-article-method gnus-select-method)))
6828 (if (gnus-request-head id "")
6829 (gnus-message 2 "The current message was found on %s"
6830 gnus-override-method)
6831 (gnus-message 2 "The current message couldn't be found on %s"
6832 gnus-override-method)
6835 (defun gnus-summary-expire-articles (&optional now)
6836 "Expire all articles that are marked as expirable in the current group."
6838 (gnus-set-global-variables)
6839 (when (gnus-check-backend-function
6840 'request-expire-articles gnus-newsgroup-name)
6841 ;; This backend supports expiry.
6842 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6843 (expirable (if total
6845 ;; We need to update the info for
6846 ;; this group for `gnus-list-of-read-articles'
6847 ;; to give us the right answer.
6848 (run-hooks 'gnus-exit-group-hook)
6849 (gnus-summary-update-info)
6850 (gnus-list-of-read-articles gnus-newsgroup-name))
6851 (setq gnus-newsgroup-expirable
6852 (sort gnus-newsgroup-expirable '<))))
6853 (expiry-wait (if now 'immediate
6854 (gnus-group-find-parameter
6855 gnus-newsgroup-name 'expiry-wait)))
6858 ;; There are expirable articles in this group, so we run them
6859 ;; through the expiry process.
6860 (gnus-message 6 "Expiring articles...")
6861 ;; The list of articles that weren't expired is returned.
6863 (let ((nnmail-expiry-wait-function nil)
6864 (nnmail-expiry-wait expiry-wait))
6865 (setq es (gnus-request-expire-articles
6866 expirable gnus-newsgroup-name)))
6867 (setq es (gnus-request-expire-articles
6868 expirable gnus-newsgroup-name)))
6870 (setq gnus-newsgroup-expirable es))
6871 ;; We go through the old list of expirable, and mark all
6872 ;; really expired articles as nonexistent.
6873 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6874 (let ((gnus-use-cache nil))
6876 (unless (memq (car expirable) es)
6877 (when (gnus-data-find (car expirable))
6878 (gnus-summary-mark-article
6879 (car expirable) gnus-canceled-mark)))
6880 (setq expirable (cdr expirable)))))
6881 (gnus-message 6 "Expiring articles...done")))))
6883 (defun gnus-summary-expire-articles-now ()
6884 "Expunge all expirable articles in the current group.
6885 This means that *all* articles that are marked as expirable will be
6886 deleted forever, right now."
6888 (gnus-set-global-variables)
6889 (or gnus-expert-user
6891 "Are you really, really, really sure you want to delete all these messages? ")
6893 (gnus-summary-expire-articles t))
6895 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
6896 (defun gnus-summary-delete-article (&optional n)
6897 "Delete the N next (mail) articles.
6898 This command actually deletes articles. This is not a marking
6899 command. The article will disappear forever from your life, never to
6901 If N is negative, delete backwards.
6902 If N is nil and articles have been marked with the process mark,
6903 delete these instead."
6905 (gnus-set-global-variables)
6906 (unless (gnus-check-backend-function 'request-expire-articles
6907 gnus-newsgroup-name)
6908 (error "The current newsgroup does not support article deletion."))
6909 ;; Compute the list of articles to delete.
6910 (let ((articles (gnus-summary-work-articles n))
6912 (if (and gnus-novice-user
6913 (not (gnus-yes-or-no-p
6914 (format "Do you really want to delete %s forever? "
6915 (if (> (length articles) 1)
6916 (format "these %s articles" (length articles))
6919 ;; Delete the articles.
6920 (setq not-deleted (gnus-request-expire-articles
6921 articles gnus-newsgroup-name 'force))
6923 (gnus-summary-remove-process-mark (car articles))
6924 ;; The backend might not have been able to delete the article
6926 (unless (memq (car articles) not-deleted)
6927 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
6928 (setq articles (cdr articles)))
6930 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
6931 (gnus-summary-position-point)
6932 (gnus-set-mode-line 'summary)
6935 (defun gnus-summary-edit-article (&optional force)
6936 "Edit the current article.
6937 This will have permanent effect only in mail groups.
6938 If FORCE is non-nil, allow editing of articles even in read-only
6942 (set-buffer gnus-summary-buffer)
6943 (gnus-set-global-variables)
6944 (when (and (not force)
6945 (gnus-group-read-only-p))
6946 (error "The current newsgroup does not support article editing."))
6947 ;; Select article if needed.
6948 (unless (eq (gnus-summary-article-number)
6949 gnus-current-article)
6950 (gnus-summary-select-article t))
6951 (gnus-article-edit-article
6953 (gnus-summary-edit-article-done
6954 ,(or (mail-header-references gnus-current-headers) "")
6955 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
6957 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
6959 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
6960 "Make edits to the current article permanent."
6962 ;; Replace the article.
6963 (if (and (not read-only)
6964 (not (gnus-request-replace-article
6965 (cdr gnus-article-current) (car gnus-article-current)
6967 (error "Couldn't replace article.")
6968 ;; Update the summary buffer.
6970 (equal (message-tokenize-header references " ")
6971 (message-tokenize-header
6972 (or (message-fetch-field "references") "") " ")))
6973 ;; We only have to update this line.
6976 (message-narrow-to-head)
6977 (let ((head (buffer-string))
6979 (nnheader-temp-write nil
6980 (insert (format "211 %d Article retrieved.\n"
6981 (cdr gnus-article-current)))
6984 (let ((nntp-server-buffer (current-buffer)))
6985 (setq header (car (gnus-get-newsgroup-headers
6987 (set-buffer gnus-summary-buffer)
6988 gnus-newsgroup-dependencies)
6991 (set-buffer gnus-summary-buffer)
6992 (gnus-data-set-header
6993 (gnus-data-find (cdr gnus-article-current))
6995 (gnus-summary-update-article-line
6996 (cdr gnus-article-current) header))))))
6998 (set-buffer (or buffer gnus-summary-buffer))
6999 (gnus-summary-update-article (cdr gnus-article-current)))
7000 ;; Prettify the article buffer again.
7002 (set-buffer gnus-article-buffer)
7003 (run-hooks 'gnus-article-display-hook)
7004 (set-buffer gnus-original-article-buffer)
7005 (gnus-request-article
7006 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
7007 ;; Prettify the summary buffer line.
7008 (when (gnus-visual-p 'summary-highlight 'highlight)
7009 (run-hooks 'gnus-visual-mark-article-hook))))
7011 (defun gnus-summary-edit-wash (key)
7012 "Perform editing command in the article buffer."
7016 (message "%s" (concat (this-command-keys) "- "))
7019 (gnus-summary-edit-article)
7020 (execute-kbd-macro (concat (this-command-keys) key))
7021 (gnus-article-edit-done))
7025 (defun gnus-summary-respool-query ()
7026 "Query where the respool algorithm would put this article."
7028 (gnus-set-global-variables)
7029 (let (gnus-mark-article-hook)
7030 (gnus-summary-select-article)
7032 (set-buffer gnus-original-article-buffer)
7034 (message-narrow-to-head)
7035 (message "This message would go to %s"
7036 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
7038 ;; Summary marking commands.
7040 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7041 "Mark articles which has the same subject as read, and then select the next.
7042 If UNMARK is positive, remove any kind of mark.
7043 If UNMARK is negative, tick articles."
7045 (gnus-set-global-variables)
7047 (setq unmark (prefix-numeric-value unmark)))
7049 (gnus-summary-mark-same-subject
7050 (gnus-summary-article-subject) unmark)))
7051 ;; Select next unread article. If auto-select-same mode, should
7052 ;; select the first unread article.
7053 (gnus-summary-next-article t (and gnus-auto-select-same
7054 (gnus-summary-article-subject)))
7055 (gnus-message 7 "%d article%s marked as %s"
7056 count (if (= count 1) " is" "s are")
7057 (if unmark "unread" "read"))))
7059 (defun gnus-summary-kill-same-subject (&optional unmark)
7060 "Mark articles which has the same subject as read.
7061 If UNMARK is positive, remove any kind of mark.
7062 If UNMARK is negative, tick articles."
7064 (gnus-set-global-variables)
7066 (setq unmark (prefix-numeric-value unmark)))
7068 (gnus-summary-mark-same-subject
7069 (gnus-summary-article-subject) unmark)))
7070 ;; If marked as read, go to next unread subject.
7072 ;; Go to next unread subject.
7073 (gnus-summary-next-subject 1 t))
7074 (gnus-message 7 "%d articles are marked as %s"
7075 count (if unmark "unread" "read"))))
7077 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7078 "Mark articles with same SUBJECT as read, and return marked number.
7079 If optional argument UNMARK is positive, remove any kinds of marks.
7080 If optional argument UNMARK is negative, mark articles as unread instead."
7084 ((null unmark) ; Mark as read.
7087 (gnus-summary-mark-article-as-read gnus-killed-mark)
7088 (gnus-summary-show-thread) t)
7089 (gnus-summary-find-subject subject))
7090 (setq count (1+ count))))
7091 ((> unmark 0) ; Tick.
7094 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7095 (gnus-summary-show-thread) t)
7096 (gnus-summary-find-subject subject))
7097 (setq count (1+ count))))
7098 (t ; Mark as unread.
7101 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7102 (gnus-summary-show-thread) t)
7103 (gnus-summary-find-subject subject))
7104 (setq count (1+ count)))))
7105 (gnus-set-mode-line 'summary)
7106 ;; Return the number of marked articles.
7109 (defun gnus-summary-mark-as-processable (n &optional unmark)
7110 "Set the process mark on the next N articles.
7111 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7112 the process mark instead. The difference between N and the actual
7113 number of articles marked is returned."
7115 (gnus-set-global-variables)
7116 (let ((backward (< n 0))
7121 (gnus-summary-remove-process-mark
7122 (gnus-summary-article-number))
7123 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7124 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7127 (gnus-message 7 "No more articles"))
7128 (gnus-summary-recenter)
7129 (gnus-summary-position-point)
7132 (defun gnus-summary-unmark-as-processable (n)
7133 "Remove the process mark from the next N articles.
7134 If N is negative, mark backward instead. The difference between N and
7135 the actual number of articles marked is returned."
7137 (gnus-set-global-variables)
7138 (gnus-summary-mark-as-processable n t))
7140 (defun gnus-summary-unmark-all-processable ()
7141 "Remove the process mark from all articles."
7143 (gnus-set-global-variables)
7145 (while gnus-newsgroup-processable
7146 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7147 (gnus-summary-position-point))
7149 (defun gnus-summary-mark-as-expirable (n)
7150 "Mark N articles forward as expirable.
7151 If N is negative, mark backward instead. The difference between N and
7152 the actual number of articles marked is returned."
7154 (gnus-set-global-variables)
7155 (gnus-summary-mark-forward n gnus-expirable-mark))
7157 (defun gnus-summary-mark-article-as-replied (article)
7158 "Mark ARTICLE replied and update the summary line."
7159 (push article gnus-newsgroup-replied)
7160 (let ((buffer-read-only nil))
7161 (when (gnus-summary-goto-subject article)
7162 (gnus-summary-update-secondary-mark article))))
7164 (defun gnus-summary-set-bookmark (article)
7165 "Set a bookmark in current article."
7166 (interactive (list (gnus-summary-article-number)))
7167 (gnus-set-global-variables)
7168 (when (or (not (get-buffer gnus-article-buffer))
7169 (not gnus-current-article)
7170 (not gnus-article-current)
7171 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7172 (error "No current article selected"))
7173 ;; Remove old bookmark, if one exists.
7174 (let ((old (assq article gnus-newsgroup-bookmarks)))
7176 (setq gnus-newsgroup-bookmarks
7177 (delq old gnus-newsgroup-bookmarks))))
7178 ;; Set the new bookmark, which is on the form
7179 ;; (article-number . line-number-in-body).
7183 (set-buffer gnus-article-buffer)
7187 (goto-char (point-min))
7188 (search-forward "\n\n" nil t)
7191 gnus-newsgroup-bookmarks)
7192 (gnus-message 6 "A bookmark has been added to the current article."))
7194 (defun gnus-summary-remove-bookmark (article)
7195 "Remove the bookmark from the current article."
7196 (interactive (list (gnus-summary-article-number)))
7197 (gnus-set-global-variables)
7198 ;; Remove old bookmark, if one exists.
7199 (let ((old (assq article gnus-newsgroup-bookmarks)))
7202 (setq gnus-newsgroup-bookmarks
7203 (delq old gnus-newsgroup-bookmarks))
7204 (gnus-message 6 "Removed bookmark."))
7205 (gnus-message 6 "No bookmark in current article."))))
7207 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7208 (defun gnus-summary-mark-as-dormant (n)
7209 "Mark N articles forward as dormant.
7210 If N is negative, mark backward instead. The difference between N and
7211 the actual number of articles marked is returned."
7213 (gnus-set-global-variables)
7214 (gnus-summary-mark-forward n gnus-dormant-mark))
7216 (defun gnus-summary-set-process-mark (article)
7217 "Set the process mark on ARTICLE and update the summary line."
7218 (setq gnus-newsgroup-processable
7220 (delq article gnus-newsgroup-processable)))
7221 (when (gnus-summary-goto-subject article)
7222 (gnus-summary-show-thread)
7223 (gnus-summary-update-secondary-mark article)))
7225 (defun gnus-summary-remove-process-mark (article)
7226 "Remove the process mark from ARTICLE and update the summary line."
7227 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7228 (when (gnus-summary-goto-subject article)
7229 (gnus-summary-show-thread)
7230 (gnus-summary-update-secondary-mark article)))
7232 (defun gnus-summary-set-saved-mark (article)
7233 "Set the process mark on ARTICLE and update the summary line."
7234 (push article gnus-newsgroup-saved)
7235 (when (gnus-summary-goto-subject article)
7236 (gnus-summary-update-secondary-mark article)))
7238 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7239 "Mark N articles as read forwards.
7240 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7241 The difference between N and the actual number of articles marked is
7244 (gnus-set-global-variables)
7245 (let ((backward (< n 0))
7246 (gnus-summary-goto-unread
7247 (and gnus-summary-goto-unread
7248 (not (eq gnus-summary-goto-unread 'never))
7249 (not (memq mark (list gnus-unread-mark
7250 gnus-ticked-mark gnus-dormant-mark)))))
7252 (mark (or mark gnus-del-mark)))
7254 (gnus-summary-mark-article nil mark no-expire)
7255 (zerop (gnus-summary-next-subject
7257 (and gnus-summary-goto-unread
7258 (not (eq gnus-summary-goto-unread 'never)))
7262 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7263 (gnus-summary-recenter)
7264 (gnus-summary-position-point)
7265 (gnus-set-mode-line 'summary)
7268 (defun gnus-summary-mark-article-as-read (mark)
7269 "Mark the current article quickly as read with MARK."
7270 (let ((article (gnus-summary-article-number)))
7271 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7272 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7273 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7274 (push (cons article mark) gnus-newsgroup-reads)
7275 ;; Possibly remove from cache, if that is used.
7276 (when gnus-use-cache
7277 (gnus-cache-enter-remove-article article))
7278 ;; Allow the backend to change the mark.
7279 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7280 ;; Check for auto-expiry.
7281 (when (and gnus-newsgroup-auto-expire
7282 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7283 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7284 (= mark gnus-ancient-mark)
7285 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7286 (= mark gnus-duplicate-mark)))
7287 (setq mark gnus-expirable-mark)
7288 (push article gnus-newsgroup-expirable))
7289 ;; Set the mark in the buffer.
7290 (gnus-summary-update-mark mark 'unread)
7293 (defun gnus-summary-mark-article-as-unread (mark)
7294 "Mark the current article quickly as unread with MARK."
7295 (let ((article (gnus-summary-article-number)))
7297 (gnus-error 1 "Unmarkable article")
7298 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7299 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7300 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7301 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7302 (cond ((= mark gnus-ticked-mark)
7303 (push article gnus-newsgroup-marked))
7304 ((= mark gnus-dormant-mark)
7305 (push article gnus-newsgroup-dormant))
7307 (push article gnus-newsgroup-unreads)))
7308 (setq gnus-newsgroup-reads
7309 (delq (assq article gnus-newsgroup-reads)
7310 gnus-newsgroup-reads))
7312 ;; See whether the article is to be put in the cache.
7314 (vectorp (gnus-summary-article-header article))
7316 (gnus-cache-possibly-enter-article
7317 gnus-newsgroup-name article
7318 (gnus-summary-article-header article)
7319 (= mark gnus-ticked-mark)
7320 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7323 (gnus-summary-update-mark mark 'unread))
7326 (defun gnus-summary-mark-article (&optional article mark no-expire)
7327 "Mark ARTICLE with MARK. MARK can be any character.
7328 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7329 `??' (dormant) and `?E' (expirable).
7330 If MARK is nil, then the default character `?D' is used.
7331 If ARTICLE is nil, then the article on the current line will be
7333 ;; The mark might be a string.
7334 (when (stringp mark)
7335 (setq mark (aref mark 0)))
7336 ;; If no mark is given, then we check auto-expiring.
7337 (and (not no-expire)
7338 gnus-newsgroup-auto-expire
7340 (and (gnus-characterp mark)
7341 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7342 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7343 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7344 (= mark gnus-duplicate-mark))))
7345 (setq mark gnus-expirable-mark))
7346 (let* ((mark (or mark gnus-del-mark))
7347 (article (or article (gnus-summary-article-number))))
7349 (error "No article on current line"))
7350 (if (or (= mark gnus-unread-mark)
7351 (= mark gnus-ticked-mark)
7352 (= mark gnus-dormant-mark))
7353 (gnus-mark-article-as-unread article mark)
7354 (gnus-mark-article-as-read article mark))
7356 ;; See whether the article is to be put in the cache.
7358 (not (= mark gnus-canceled-mark))
7359 (vectorp (gnus-summary-article-header article))
7361 (gnus-cache-possibly-enter-article
7362 gnus-newsgroup-name article
7363 (gnus-summary-article-header article)
7364 (= mark gnus-ticked-mark)
7365 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7367 (when (gnus-summary-goto-subject article nil t)
7368 (let ((buffer-read-only nil))
7369 (gnus-summary-show-thread)
7371 (gnus-summary-update-mark mark 'unread)
7374 (defun gnus-summary-update-secondary-mark (article)
7375 "Update the secondary (read, process, cache) mark."
7376 (gnus-summary-update-mark
7377 (cond ((memq article gnus-newsgroup-processable)
7379 ((memq article gnus-newsgroup-cached)
7381 ((memq article gnus-newsgroup-replied)
7383 ((memq article gnus-newsgroup-saved)
7385 (t gnus-unread-mark))
7387 (when (gnus-visual-p 'summary-highlight 'highlight)
7388 (run-hooks 'gnus-summary-update-hook))
7391 (defun gnus-summary-update-mark (mark type)
7392 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7393 (buffer-read-only nil))
7394 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7395 (when (looking-at "\r")
7398 (<= (+ forward (point)) (point-max)))
7399 ;; Go to the right position on the line.
7400 (goto-char (+ forward (point)))
7401 ;; Replace the old mark with the new mark.
7402 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7403 ;; Optionally update the marks by some user rule.
7404 (when (eq type 'unread)
7406 (gnus-data-find (gnus-summary-article-number)) mark)
7407 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7409 (defun gnus-mark-article-as-read (article &optional mark)
7410 "Enter ARTICLE in the pertinent lists and remove it from others."
7411 ;; Make the article expirable.
7412 (let ((mark (or mark gnus-del-mark)))
7413 (if (= mark gnus-expirable-mark)
7414 (push article gnus-newsgroup-expirable)
7415 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7416 ;; Remove from unread and marked lists.
7417 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7418 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7419 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7420 (push (cons article mark) gnus-newsgroup-reads)
7421 ;; Possibly remove from cache, if that is used.
7422 (when gnus-use-cache
7423 (gnus-cache-enter-remove-article article))))
7425 (defun gnus-mark-article-as-unread (article &optional mark)
7426 "Enter ARTICLE in the pertinent lists and remove it from others."
7427 (let ((mark (or mark gnus-ticked-mark)))
7428 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7429 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7430 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7431 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7433 ;; Unsuppress duplicates?
7434 (when gnus-suppress-duplicates
7435 (gnus-dup-unsuppress-article article))
7437 (cond ((= mark gnus-ticked-mark)
7438 (push article gnus-newsgroup-marked))
7439 ((= mark gnus-dormant-mark)
7440 (push article gnus-newsgroup-dormant))
7442 (push article gnus-newsgroup-unreads)))
7443 (setq gnus-newsgroup-reads
7444 (delq (assq article gnus-newsgroup-reads)
7445 gnus-newsgroup-reads))))
7447 (defalias 'gnus-summary-mark-as-unread-forward
7448 'gnus-summary-tick-article-forward)
7449 (make-obsolete 'gnus-summary-mark-as-unread-forward
7450 'gnus-summary-tick-article-forward)
7451 (defun gnus-summary-tick-article-forward (n)
7452 "Tick N articles forwards.
7453 If N is negative, tick backwards instead.
7454 The difference between N and the number of articles ticked is returned."
7456 (gnus-summary-mark-forward n gnus-ticked-mark))
7458 (defalias 'gnus-summary-mark-as-unread-backward
7459 'gnus-summary-tick-article-backward)
7460 (make-obsolete 'gnus-summary-mark-as-unread-backward
7461 'gnus-summary-tick-article-backward)
7462 (defun gnus-summary-tick-article-backward (n)
7463 "Tick N articles backwards.
7464 The difference between N and the number of articles ticked is returned."
7466 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7468 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7469 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7470 (defun gnus-summary-tick-article (&optional article clear-mark)
7471 "Mark current article as unread.
7472 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7473 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7475 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7478 (defun gnus-summary-mark-as-read-forward (n)
7479 "Mark N articles as read forwards.
7480 If N is negative, mark backwards instead.
7481 The difference between N and the actual number of articles marked is
7484 (gnus-summary-mark-forward n gnus-del-mark t))
7486 (defun gnus-summary-mark-as-read-backward (n)
7487 "Mark the N articles as read backwards.
7488 The difference between N and the actual number of articles marked is
7491 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7493 (defun gnus-summary-mark-as-read (&optional article mark)
7494 "Mark current article as read.
7495 ARTICLE specifies the article to be marked as read.
7496 MARK specifies a string to be inserted at the beginning of the line."
7497 (gnus-summary-mark-article article mark))
7499 (defun gnus-summary-clear-mark-forward (n)
7500 "Clear marks from N articles forward.
7501 If N is negative, clear backward instead.
7502 The difference between N and the number of marks cleared is returned."
7504 (gnus-summary-mark-forward n gnus-unread-mark))
7506 (defun gnus-summary-clear-mark-backward (n)
7507 "Clear marks from N articles backward.
7508 The difference between N and the number of marks cleared is returned."
7510 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7512 (defun gnus-summary-mark-unread-as-read ()
7513 "Intended to be used by `gnus-summary-mark-article-hook'."
7514 (when (memq gnus-current-article gnus-newsgroup-unreads)
7515 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7517 (defun gnus-summary-mark-read-and-unread-as-read ()
7518 "Intended to be used by `gnus-summary-mark-article-hook'."
7519 (let ((mark (gnus-summary-article-mark)))
7520 (when (or (gnus-unread-mark-p mark)
7521 (gnus-read-mark-p mark))
7522 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7524 (defun gnus-summary-mark-region-as-read (point mark all)
7525 "Mark all unread articles between point and mark as read.
7526 If given a prefix, mark all articles between point and mark as read,
7527 even ticked and dormant ones."
7528 (interactive "r\nP")
7537 (memq (setq article (gnus-summary-article-number))
7538 gnus-newsgroup-unreads))
7539 (gnus-summary-mark-article article gnus-del-mark))
7541 (gnus-summary-find-next))))))
7543 (defun gnus-summary-mark-below (score mark)
7544 "Mark articles with score less than SCORE with MARK."
7545 (interactive "P\ncMark: ")
7546 (gnus-set-global-variables)
7547 (setq score (if score
7548 (prefix-numeric-value score)
7549 (or gnus-summary-default-score 0)))
7551 (set-buffer gnus-summary-buffer)
7552 (goto-char (point-min))
7555 (and (< (gnus-summary-article-score) score)
7556 (gnus-summary-mark-article nil mark))
7557 (gnus-summary-find-next)))))
7559 (defun gnus-summary-kill-below (&optional score)
7560 "Mark articles with score below SCORE as read."
7562 (gnus-set-global-variables)
7563 (gnus-summary-mark-below score gnus-killed-mark))
7565 (defun gnus-summary-clear-above (&optional score)
7566 "Clear all marks from articles with score above SCORE."
7568 (gnus-set-global-variables)
7569 (gnus-summary-mark-above score gnus-unread-mark))
7571 (defun gnus-summary-tick-above (&optional score)
7572 "Tick all articles with score above SCORE."
7574 (gnus-set-global-variables)
7575 (gnus-summary-mark-above score gnus-ticked-mark))
7577 (defun gnus-summary-mark-above (score mark)
7578 "Mark articles with score over SCORE with MARK."
7579 (interactive "P\ncMark: ")
7580 (gnus-set-global-variables)
7581 (setq score (if score
7582 (prefix-numeric-value score)
7583 (or gnus-summary-default-score 0)))
7585 (set-buffer gnus-summary-buffer)
7586 (goto-char (point-min))
7588 (when (> (gnus-summary-article-score) score)
7589 (gnus-summary-mark-article nil mark))
7591 (gnus-summary-find-next)))))
7593 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7594 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7595 (defun gnus-summary-limit-include-expunged (&optional no-error)
7596 "Display all the hidden articles that were expunged for low scores."
7598 (gnus-set-global-variables)
7599 (let ((buffer-read-only nil))
7600 (let ((scored gnus-newsgroup-scored)
7603 (unless (gnus-summary-goto-subject (caar scored))
7604 (and (setq h (gnus-summary-article-header (caar scored)))
7605 (< (cdar scored) gnus-summary-expunge-below)
7607 (setq scored (cdr scored)))
7609 (when (not no-error)
7610 (error "No expunged articles hidden."))
7611 (goto-char (point-min))
7612 (gnus-summary-prepare-unthreaded (nreverse headers))
7613 (goto-char (point-min))
7614 (gnus-summary-position-point)
7617 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7618 "Mark all unread articles in this newsgroup as read.
7619 If prefix argument ALL is non-nil, ticked and dormant articles will
7620 also be marked as read.
7621 If QUIETLY is non-nil, no questions will be asked.
7622 If TO-HERE is non-nil, it should be a point in the buffer. All
7623 articles before this point will be marked as read.
7624 Note that this function will only catch up the unread article
7625 in the current summary buffer limitation.
7626 The number of articles marked as read is returned."
7628 (gnus-set-global-variables)
7632 (not gnus-interactive-catchup) ;Without confirmation?
7636 "Mark absolutely all articles as read? "
7637 "Mark all unread articles as read? ")))
7639 (not gnus-newsgroup-adaptive)
7640 (not gnus-newsgroup-auto-expire)
7641 (not gnus-suppress-duplicates))
7644 (setq gnus-newsgroup-marked nil
7645 gnus-newsgroup-dormant nil))
7646 (setq gnus-newsgroup-unreads nil))
7647 ;; We actually mark all articles as canceled, which we
7648 ;; have to do when using auto-expiry or adaptive scoring.
7649 (gnus-summary-show-all-threads)
7650 (when (gnus-summary-first-subject (not all))
7652 (if to-here (< (point) to-here) t)
7653 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7654 (gnus-summary-find-next (not all)))))
7655 (gnus-set-mode-line 'summary))
7657 (gnus-summary-position-point)))
7659 (defun gnus-summary-catchup-to-here (&optional all)
7660 "Mark all unticked articles before the current one as read.
7661 If ALL is non-nil, also mark ticked and dormant articles as read."
7663 (gnus-set-global-variables)
7665 (gnus-save-hidden-threads
7666 (let ((beg (point)))
7667 ;; We check that there are unread articles.
7668 (when (or all (gnus-summary-find-prev))
7669 (gnus-summary-catchup all t beg)))))
7670 (gnus-summary-position-point))
7672 (defun gnus-summary-catchup-all (&optional quietly)
7673 "Mark all articles in this newsgroup as read."
7675 (gnus-set-global-variables)
7676 (gnus-summary-catchup t quietly))
7678 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7679 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7680 If prefix argument ALL is non-nil, all articles are marked as read."
7682 (gnus-set-global-variables)
7683 (when (gnus-summary-catchup all quietly nil 'fast)
7684 ;; Select next newsgroup or exit.
7685 (if (eq gnus-auto-select-next 'quietly)
7686 (gnus-summary-next-group nil)
7687 (gnus-summary-exit))))
7689 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7690 "Mark all articles in this newsgroup as read, and then exit."
7692 (gnus-set-global-variables)
7693 (gnus-summary-catchup-and-exit t quietly))
7695 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7696 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7697 "Mark all articles in this group as read and select the next group.
7698 If given a prefix, mark all articles, unread as well as ticked, as
7701 (gnus-set-global-variables)
7703 (gnus-summary-catchup all))
7704 (gnus-summary-next-article t nil nil t))
7706 ;; Thread-based commands.
7708 (defun gnus-summary-articles-in-thread (&optional article)
7709 "Return a list of all articles in the current thread.
7710 If ARTICLE is non-nil, return all articles in the thread that starts
7712 (let* ((article (or article (gnus-summary-article-number)))
7713 (data (gnus-data-find-list article))
7714 (top-level (gnus-data-level (car data)))
7716 (cond ((null gnus-thread-operation-ignore-subject)
7717 (gnus-simplify-subject-re
7718 (mail-header-subject (gnus-data-header (car data)))))
7719 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7720 (gnus-simplify-subject-fuzzy
7721 (mail-header-subject (gnus-data-header (car data)))))
7723 (end-point (save-excursion
7724 (if (gnus-summary-go-to-next-thread)
7725 (point) (point-max))))
7728 (< (gnus-data-pos (car data)) end-point))
7729 (when (or (not top-subject)
7730 (string= top-subject
7731 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7732 (gnus-simplify-subject-fuzzy
7733 (mail-header-subject
7734 (gnus-data-header (car data))))
7735 (gnus-simplify-subject-re
7736 (mail-header-subject
7737 (gnus-data-header (car data)))))))
7738 (push (gnus-data-number (car data)) articles))
7739 (unless (and (setq data (cdr data))
7740 (> (gnus-data-level (car data)) top-level))
7742 ;; Return the list of articles.
7743 (nreverse articles)))
7745 (defun gnus-summary-rethread-current ()
7746 "Rethread the thread the current article is part of."
7748 (gnus-set-global-variables)
7749 (let* ((gnus-show-threads t)
7750 (article (gnus-summary-article-number))
7751 (id (mail-header-id (gnus-summary-article-header)))
7752 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7754 (error "No article on the current line"))
7755 (gnus-rebuild-thread id)
7756 (gnus-summary-goto-subject article)))
7758 (defun gnus-summary-reparent-thread ()
7759 "Make the current article child of the marked (or previous) article.
7761 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7762 is non-nil or the Subject: of both articles are the same."
7764 (unless (not (gnus-group-read-only-p))
7765 (error "The current newsgroup does not support article editing."))
7766 (unless (<= (length gnus-newsgroup-processable) 1)
7767 (error "No more than one article may be marked."))
7768 (save-window-excursion
7769 (let ((gnus-article-buffer " *reparent*")
7770 (current-article (gnus-summary-article-number))
7771 ;; First grab the marked article, otherwise one line up.
7772 (parent-article (if (not (null gnus-newsgroup-processable))
7773 (car gnus-newsgroup-processable)
7775 (if (eq (forward-line -1) 0)
7776 (gnus-summary-article-number)
7777 (error "Beginning of summary buffer."))))))
7778 (unless (not (eq current-article parent-article))
7779 (error "An article may not be self-referential."))
7780 (let ((message-id (mail-header-id
7781 (gnus-summary-article-header parent-article))))
7782 (unless (and message-id (not (equal message-id "")))
7783 (error "No message-id in desired parent."))
7784 (gnus-summary-select-article t t nil current-article)
7785 (set-buffer gnus-original-article-buffer)
7786 (let ((buf (format "%s" (buffer-string))))
7787 (nnheader-temp-write nil
7789 (goto-char (point-min))
7790 (if (search-forward-regexp "^References: " nil t)
7791 (insert message-id " " )
7792 (insert "References: " message-id "\n"))
7793 (unless (gnus-request-replace-article
7794 current-article (car gnus-article-current)
7796 (error "Couldn't replace article."))))
7797 (set-buffer gnus-summary-buffer)
7798 (gnus-summary-unmark-all-processable)
7799 (gnus-summary-rethread-current)
7800 (gnus-message 3 "Article %d is now the child of article %d."
7801 current-article parent-article)))))
7803 (defun gnus-summary-toggle-threads (&optional arg)
7804 "Toggle showing conversation threads.
7805 If ARG is positive number, turn showing conversation threads on."
7807 (gnus-set-global-variables)
7808 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7809 (setq gnus-show-threads
7810 (if (null arg) (not gnus-show-threads)
7811 (> (prefix-numeric-value arg) 0)))
7812 (gnus-summary-prepare)
7813 (gnus-summary-goto-subject current)
7814 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7815 (gnus-summary-position-point)))
7817 (defun gnus-summary-show-all-threads ()
7820 (gnus-set-global-variables)
7822 (let ((buffer-read-only nil))
7823 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7824 (gnus-summary-position-point))
7826 (defun gnus-summary-show-thread ()
7827 "Show thread subtrees.
7828 Returns nil if no thread was there to be shown."
7830 (gnus-set-global-variables)
7831 (let ((buffer-read-only nil)
7833 ;; first goto end then to beg, to have point at beg after let
7834 (end (progn (end-of-line) (point)))
7835 (beg (progn (beginning-of-line) (point))))
7837 ;; Any hidden lines here?
7838 (search-forward "\r" end t)
7839 (subst-char-in-region beg end ?\^M ?\n t)
7841 (gnus-summary-position-point))))
7843 (defun gnus-summary-hide-all-threads ()
7844 "Hide all thread subtrees."
7846 (gnus-set-global-variables)
7848 (goto-char (point-min))
7849 (gnus-summary-hide-thread)
7850 (while (zerop (gnus-summary-next-thread 1 t))
7851 (gnus-summary-hide-thread)))
7852 (gnus-summary-position-point))
7854 (defun gnus-summary-hide-thread ()
7855 "Hide thread subtrees.
7856 Returns nil if no threads were there to be hidden."
7858 (gnus-set-global-variables)
7859 (let ((buffer-read-only nil)
7861 (article (gnus-summary-article-number)))
7863 ;; Go forward until either the buffer ends or the subthread
7865 (when (and (not (eobp))
7866 (or (zerop (gnus-summary-next-thread 1 t))
7867 (goto-char (point-max))))
7869 (if (and (> (point) start)
7870 (search-backward "\n" start t))
7872 (subst-char-in-region start (point) ?\n ?\^M)
7873 (gnus-summary-goto-subject article))
7876 ;;(gnus-summary-position-point)
7879 (defun gnus-summary-go-to-next-thread (&optional previous)
7880 "Go to the same level (or less) next thread.
7881 If PREVIOUS is non-nil, go to previous thread instead.
7882 Return the article number moved to, or nil if moving was impossible."
7883 (let ((level (gnus-summary-thread-level))
7884 (way (if previous -1 1))
7887 (while (and (not (eobp))
7888 (< level (gnus-summary-thread-level)))
7896 (gnus-summary-article-number)
7899 (defun gnus-summary-next-thread (n &optional silent)
7900 "Go to the same level next N'th thread.
7901 If N is negative, search backward instead.
7902 Returns the difference between N and the number of skips actually
7905 If SILENT, don't output messages."
7907 (gnus-set-global-variables)
7908 (let ((backward (< n 0))
7911 (gnus-summary-go-to-next-thread backward))
7914 (gnus-summary-position-point))
7915 (when (and (not silent) (/= 0 n))
7916 (gnus-message 7 "No more threads"))
7919 (defun gnus-summary-prev-thread (n)
7920 "Go to the same level previous N'th thread.
7921 Returns the difference between N and the number of skips actually
7924 (gnus-set-global-variables)
7925 (gnus-summary-next-thread (- n)))
7927 (defun gnus-summary-go-down-thread ()
7928 "Go down one level in the current thread."
7929 (let ((children (gnus-summary-article-children)))
7931 (gnus-summary-goto-subject (car children)))))
7933 (defun gnus-summary-go-up-thread ()
7934 "Go up one level in the current thread."
7935 (let ((parent (gnus-summary-article-parent)))
7937 (gnus-summary-goto-subject parent))))
7939 (defun gnus-summary-down-thread (n)
7940 "Go down thread N steps.
7941 If N is negative, go up instead.
7942 Returns the difference between N and how many steps down that were
7945 (gnus-set-global-variables)
7949 (if up (gnus-summary-go-up-thread)
7950 (gnus-summary-go-down-thread)))
7952 (gnus-summary-position-point)
7954 (gnus-message 7 "Can't go further"))
7957 (defun gnus-summary-up-thread (n)
7958 "Go up thread N steps.
7959 If N is negative, go up instead.
7960 Returns the difference between N and how many steps down that were
7963 (gnus-set-global-variables)
7964 (gnus-summary-down-thread (- n)))
7966 (defun gnus-summary-top-thread ()
7967 "Go to the top of the thread."
7969 (gnus-set-global-variables)
7970 (while (gnus-summary-go-up-thread))
7971 (gnus-summary-article-number))
7973 (defun gnus-summary-kill-thread (&optional unmark)
7974 "Mark articles under current thread as read.
7975 If the prefix argument is positive, remove any kinds of marks.
7976 If the prefix argument is negative, tick articles instead."
7978 (gnus-set-global-variables)
7980 (setq unmark (prefix-numeric-value unmark)))
7981 (let ((articles (gnus-summary-articles-in-thread)))
7983 ;; Expand the thread.
7984 (gnus-summary-show-thread)
7985 ;; Mark all the articles.
7987 (gnus-summary-goto-subject (car articles))
7988 (cond ((null unmark)
7989 (gnus-summary-mark-article-as-read gnus-killed-mark))
7991 (gnus-summary-mark-article-as-unread gnus-unread-mark))
7993 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
7994 (setq articles (cdr articles))))
7995 ;; Hide killed subtrees.
7997 gnus-thread-hide-killed
7998 (gnus-summary-hide-thread))
7999 ;; If marked as read, go to next unread subject.
8001 ;; Go to next unread subject.
8002 (gnus-summary-next-subject 1 t)))
8003 (gnus-set-mode-line 'summary))
8005 ;; Summary sorting commands
8007 (defun gnus-summary-sort-by-number (&optional reverse)
8008 "Sort the summary buffer by article number.
8009 Argument REVERSE means reverse order."
8011 (gnus-summary-sort 'number reverse))
8013 (defun gnus-summary-sort-by-author (&optional reverse)
8014 "Sort the summary buffer by author name alphabetically.
8015 If case-fold-search is non-nil, case of letters is ignored.
8016 Argument REVERSE means reverse order."
8018 (gnus-summary-sort 'author reverse))
8020 (defun gnus-summary-sort-by-subject (&optional reverse)
8021 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8022 If case-fold-search is non-nil, case of letters is ignored.
8023 Argument REVERSE means reverse order."
8025 (gnus-summary-sort 'subject reverse))
8027 (defun gnus-summary-sort-by-date (&optional reverse)
8028 "Sort the summary buffer by date.
8029 Argument REVERSE means reverse order."
8031 (gnus-summary-sort 'date reverse))
8033 (defun gnus-summary-sort-by-score (&optional reverse)
8034 "Sort the summary buffer by score.
8035 Argument REVERSE means reverse order."
8037 (gnus-summary-sort 'score reverse))
8039 (defun gnus-summary-sort-by-lines (&optional reverse)
8040 "Sort the summary buffer by article length.
8041 Argument REVERSE means reverse order."
8043 (gnus-summary-sort 'lines reverse))
8045 (defun gnus-summary-sort (predicate reverse)
8046 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8047 (gnus-set-global-variables)
8048 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8049 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8050 (gnus-thread-sort-functions
8056 (gnus-article-sort-functions
8061 (,article t2 t1)))))
8063 (gnus-summary-prepare-hook nil))
8064 ;; We do the sorting by regenerating the threads.
8065 (gnus-summary-prepare)
8066 ;; Hide subthreads if needed.
8067 (when (and gnus-show-threads gnus-thread-hide-subtree)
8068 (gnus-summary-hide-all-threads))))
8070 ;; Summary saving commands.
8072 (defun gnus-summary-save-article (&optional n not-saved)
8073 "Save the current article using the default saver function.
8074 If N is a positive number, save the N next articles.
8075 If N is a negative number, save the N previous articles.
8076 If N is nil and any articles have been marked with the process mark,
8077 save those articles instead.
8078 The variable `gnus-default-article-saver' specifies the saver function."
8080 (gnus-set-global-variables)
8081 (let* ((articles (gnus-summary-work-articles n))
8082 (save-buffer (save-excursion
8083 (nnheader-set-temp-buffer " *Gnus Save*")))
8084 (num (length articles))
8085 header article file)
8087 (setq header (gnus-summary-article-header
8088 (setq article (pop articles))))
8089 (if (not (vectorp header))
8090 ;; This is a pseudo-article.
8091 (if (assq 'name header)
8092 (gnus-copy-file (cdr (assq 'name header)))
8093 (gnus-message 1 "Article %d is unsaveable" article))
8094 ;; This is a real article.
8095 (save-window-excursion
8096 (gnus-summary-select-article t nil nil article))
8098 (set-buffer save-buffer)
8100 (insert-buffer-substring gnus-original-article-buffer))
8101 (setq file (gnus-article-save save-buffer file num))
8102 (gnus-summary-remove-process-mark article)
8104 (gnus-summary-set-saved-mark article))))
8105 (gnus-kill-buffer save-buffer)
8106 (gnus-summary-position-point)
8107 (gnus-set-mode-line 'summary)
8110 (defun gnus-summary-pipe-output (&optional arg)
8111 "Pipe the current article to a subprocess.
8112 If N is a positive number, pipe the N next articles.
8113 If N is a negative number, pipe the N previous articles.
8114 If N is nil and any articles have been marked with the process mark,
8115 pipe those articles instead."
8117 (gnus-set-global-variables)
8118 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8119 (gnus-summary-save-article arg t))
8120 (gnus-configure-windows 'pipe))
8122 (defun gnus-summary-save-article-mail (&optional arg)
8123 "Append the current article to an mail file.
8124 If N is a positive number, save the N next articles.
8125 If N is a negative number, save the N previous articles.
8126 If N is nil and any articles have been marked with the process mark,
8127 save those articles instead."
8129 (gnus-set-global-variables)
8130 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8131 (gnus-summary-save-article arg)))
8133 (defun gnus-summary-save-article-rmail (&optional arg)
8134 "Append the current article to an rmail file.
8135 If N is a positive number, save the N next articles.
8136 If N is a negative number, save the N previous articles.
8137 If N is nil and any articles have been marked with the process mark,
8138 save those articles instead."
8140 (gnus-set-global-variables)
8141 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8142 (gnus-summary-save-article arg)))
8144 (defun gnus-summary-save-article-file (&optional arg)
8145 "Append the current article to a file.
8146 If N is a positive number, save the N next articles.
8147 If N is a negative number, save the N previous articles.
8148 If N is nil and any articles have been marked with the process mark,
8149 save those articles instead."
8151 (gnus-set-global-variables)
8152 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8153 (gnus-summary-save-article arg)))
8155 (defun gnus-summary-write-article-file (&optional arg)
8156 "Write the current article to a file, deleting the previous file.
8157 If N is a positive number, save the N next articles.
8158 If N is a negative number, save the N previous articles.
8159 If N is nil and any articles have been marked with the process mark,
8160 save those articles instead."
8162 (gnus-set-global-variables)
8163 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8164 (gnus-summary-save-article arg)))
8166 (defun gnus-summary-save-article-body-file (&optional arg)
8167 "Append the current article body to a file.
8168 If N is a positive number, save the N next articles.
8169 If N is a negative number, save the N previous articles.
8170 If N is nil and any articles have been marked with the process mark,
8171 save those articles instead."
8173 (gnus-set-global-variables)
8174 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8175 (gnus-summary-save-article arg)))
8177 (defun gnus-summary-pipe-message (program)
8178 "Pipe the current article through PROGRAM."
8179 (interactive "sProgram: ")
8180 (gnus-set-global-variables)
8181 (gnus-summary-select-article)
8182 (let ((mail-header-separator "")
8183 (art-buf (get-buffer gnus-article-buffer)))
8184 (gnus-eval-in-buffer-window gnus-article-buffer
8187 (let ((start (window-start))
8189 (message-pipe-buffer-body program)
8190 (set-window-start (get-buffer-window (current-buffer)) start))))))
8192 (defun gnus-get-split-value (methods)
8193 "Return a value based on the split METHODS."
8194 (let (split-name method result match)
8197 (set-buffer gnus-original-article-buffer)
8199 (nnheader-narrow-to-headers)
8201 (goto-char (point-min))
8202 (setq method (pop methods))
8203 (setq match (car method))
8206 ;; Regular expression.
8208 (re-search-forward match nil t)))
8209 ((gnus-functionp match)
8213 (setq result (funcall match gnus-newsgroup-name))))
8218 (setq result (eval match)))))
8219 (setq split-name (append (cdr method) split-name))
8220 (cond ((stringp result)
8221 (push (expand-file-name
8222 result gnus-article-save-directory)
8225 (setq split-name (append result split-name)))))))))
8228 (defun gnus-valid-move-group-p (group)
8233 (car (gnus-find-method-for-group
8234 (symbol-name group))))
8235 gnus-valid-select-methods))))
8237 (defun gnus-read-move-group-name (prompt default articles prefix)
8238 "Read a group name."
8239 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8240 (minibuffer-confirm-incomplete nil) ; XEmacs
8244 (if (> (length articles) 1)
8245 (format "these %d articles" (length articles))
8250 (gnus-completing-read default prom
8252 'gnus-valid-move-group-p
8254 'gnus-group-history))
8255 ((= 1 (length split-name))
8256 (gnus-completing-read (car split-name) prom
8258 'gnus-valid-move-group-p
8260 'gnus-group-history))
8262 (gnus-completing-read nil prom
8263 (mapcar (lambda (el) (list el))
8264 (nreverse split-name))
8266 'gnus-group-history)))))
8268 (if (or (string= to-newsgroup "")
8269 (string= to-newsgroup prefix))
8270 (setq to-newsgroup default))
8271 (unless to-newsgroup
8272 (error "No group name entered"))
8273 (or (gnus-active to-newsgroup)
8274 (gnus-activate-group to-newsgroup)
8275 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8277 (or (and (gnus-request-create-group
8278 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8279 (gnus-activate-group to-newsgroup nil nil
8280 (gnus-group-name-to-method
8282 (error "Couldn't create group %s" to-newsgroup)))
8283 (error "No such group: %s" to-newsgroup)))
8286 ;; Summary extract commands
8288 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8289 (let ((buffer-read-only nil)
8290 (article (gnus-summary-article-number))
8292 (unless (gnus-summary-goto-subject article)
8293 (error "No such article: %d" article))
8294 (gnus-summary-position-point)
8295 ;; If all commands are to be bunched up on one line, we collect
8297 (unless gnus-view-pseudos-separately
8298 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8301 (setq action (cdr (assq 'action (car ps))))
8302 (setq files (list (cdr (assq 'name (car ps)))))
8303 (while (and ps (cdr ps)
8304 (string= (or action "1")
8305 (or (cdr (assq 'action (cadr ps))) "2")))
8306 (push (cdr (assq 'name (cadr ps))) files)
8307 (setcdr ps (cddr ps)))
8309 (when (not (string-match "%s" action))
8312 (when (assq 'execute (car ps))
8313 (setcdr (assq 'execute (car ps))
8314 (funcall (if (string-match "%s" action)
8321 (gnus-quote-arg-for-sh-or-csh f)))
8323 (setq ps (cdr ps)))))
8324 (if (and gnus-view-pseudos (not not-view))
8326 (when (assq 'execute (car pslist))
8327 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8328 (eq gnus-view-pseudos 'not-confirm)))
8329 (setq pslist (cdr pslist)))
8332 (setq after-article (or (cdr (assq 'article (car pslist)))
8333 (gnus-summary-article-number)))
8334 (gnus-summary-goto-subject after-article)
8337 (insert " " (file-name-nondirectory
8338 (cdr (assq 'name (car pslist))))
8339 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8341 (forward-line -1) ; back to `b'
8342 (gnus-add-text-properties
8343 b (1- e) (list 'gnus-number gnus-reffed-article-number
8344 gnus-mouse-face-prop gnus-mouse-face))
8346 after-article gnus-reffed-article-number
8347 gnus-unread-mark b (car pslist) 0 (- e b))
8348 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8349 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8350 (setq pslist (cdr pslist)))))))
8352 (defun gnus-pseudos< (p1 p2)
8353 (let ((c1 (cdr (assq 'action p1)))
8354 (c2 (cdr (assq 'action p2))))
8355 (and c1 c2 (string< c1 c2))))
8357 (defun gnus-request-pseudo-article (props)
8358 (cond ((assq 'execute props)
8359 (gnus-execute-command (cdr (assq 'execute props)))))
8360 (let ((gnus-current-article (gnus-summary-article-number)))
8361 (run-hooks 'gnus-mark-article-hook)))
8363 (defun gnus-execute-command (command &optional automatic)
8365 (gnus-article-setup-buffer)
8366 (set-buffer gnus-article-buffer)
8367 (setq buffer-read-only nil)
8368 (let ((command (if automatic command (read-string "Command: " command))))
8370 (insert "$ " command "\n\n")
8371 (if gnus-view-pseudo-asynchronously
8372 (start-process "gnus-execute" (current-buffer) shell-file-name
8373 shell-command-switch command)
8374 (call-process shell-file-name nil t nil
8375 shell-command-switch command)))))
8377 ;; Summary kill commands.
8379 (defun gnus-summary-edit-global-kill (article)
8380 "Edit the \"global\" kill file."
8381 (interactive (list (gnus-summary-article-number)))
8382 (gnus-set-global-variables)
8383 (gnus-group-edit-global-kill article))
8385 (defun gnus-summary-edit-local-kill ()
8386 "Edit a local kill file applied to the current newsgroup."
8388 (gnus-set-global-variables)
8389 (setq gnus-current-headers (gnus-summary-article-header))
8390 (gnus-set-global-variables)
8391 (gnus-group-edit-local-kill
8392 (gnus-summary-article-number) gnus-newsgroup-name))
8396 (defun gnus-read-header (id &optional header)
8397 "Read the headers of article ID and enter them into the Gnus system."
8398 (let ((group gnus-newsgroup-name)
8399 (gnus-override-method
8400 (and (gnus-news-group-p gnus-newsgroup-name)
8401 gnus-refer-article-method))
8403 ;; First we check to see whether the header in question is already
8406 ;; This is a Message-ID.
8407 (setq header (or header (gnus-id-to-header id)))
8408 ;; This is an article number.
8409 (setq header (or header (gnus-summary-article-header id))))
8411 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8412 ;; We have found the header.
8414 ;; We have to really fetch the header to this article.
8416 (set-buffer nntp-server-buffer)
8417 (when (setq where (gnus-request-head id group))
8418 (nnheader-fold-continuation-lines)
8419 (goto-char (point-max))
8421 (goto-char (point-min))
8425 ((cdr where) (cdr where))
8426 (header (mail-header-number header))
8427 (t gnus-reffed-article-number))
8429 (insert " Article retrieved.\n"))
8431 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8432 () ; Malformed head.
8433 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8434 (when (and (stringp id)
8435 (not (string= (gnus-group-real-name group)
8437 ;; If we fetched by Message-ID and the article came
8438 ;; from a different group, we fudge some bogus article
8439 ;; numbers for this article.
8440 (mail-header-set-number header gnus-reffed-article-number))
8442 (set-buffer gnus-summary-buffer)
8443 (decf gnus-reffed-article-number)
8444 (gnus-remove-header (mail-header-number header))
8445 (push header gnus-newsgroup-headers)
8446 (setq gnus-current-headers header)
8447 (push (mail-header-number header) gnus-newsgroup-limit)))
8450 (defun gnus-remove-header (number)
8451 "Remove header NUMBER from `gnus-newsgroup-headers'."
8452 (if (and gnus-newsgroup-headers
8453 (= number (mail-header-number (car gnus-newsgroup-headers))))
8454 (pop gnus-newsgroup-headers)
8455 (let ((headers gnus-newsgroup-headers))
8456 (while (and (cdr headers)
8457 (not (= number (mail-header-number (cadr headers)))))
8460 (setcdr headers (cddr headers))))))
8463 ;;; summary highlights
8466 (defun gnus-highlight-selected-summary ()
8467 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8468 ;; Highlight selected article in summary buffer
8469 (when gnus-summary-selected-face
8471 (let* ((beg (progn (beginning-of-line) (point)))
8472 (end (progn (end-of-line) (point)))
8473 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8474 (from (if (get-text-property beg gnus-mouse-face-prop)
8476 (or (next-single-property-change
8477 beg gnus-mouse-face-prop nil end)
8482 (or (next-single-property-change
8483 from gnus-mouse-face-prop nil end)
8485 ;; If no mouse-face prop on line we will have to = from = end,
8486 ;; so we highlight the entire line instead.
8487 (when (= (+ to 2) from)
8490 (if gnus-newsgroup-selected-overlay
8491 ;; Move old overlay.
8493 gnus-newsgroup-selected-overlay from to (current-buffer))
8494 ;; Create new overlay.
8496 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8497 'face gnus-summary-selected-face))))))
8499 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8500 (defun gnus-summary-highlight-line ()
8501 "Highlight current line according to `gnus-summary-highlight'."
8502 (let* ((list gnus-summary-highlight)
8504 (end (progn (end-of-line) (point)))
8505 ;; now find out where the line starts and leave point there.
8506 (beg (progn (beginning-of-line) (point)))
8507 (article (gnus-summary-article-number))
8508 (score (or (cdr (assq (or article gnus-current-article)
8509 gnus-newsgroup-scored))
8510 gnus-summary-default-score 0))
8511 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8512 (inhibit-read-only t))
8513 ;; Eval the cars of the lists until we find a match.
8514 (let ((default gnus-summary-default-score))
8516 (not (eval (caar list))))
8517 (setq list (cdr list))))
8518 (let ((face (cdar list)))
8519 (unless (eq face (get-text-property beg 'face))
8520 (gnus-put-text-property
8522 (setq face (if (boundp face) (symbol-value face) face)))
8523 (when gnus-summary-highlight-line-function
8524 (funcall gnus-summary-highlight-line-function article face))))
8527 (defun gnus-update-read-articles (group unread)
8528 "Update the list of read articles in GROUP."
8529 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8530 (entry (gnus-gethash group gnus-newsrc-hashtb))
8531 (info (nth 2 entry))
8533 (unread (sort (copy-sequence unread) '<))
8535 (if (or (not info) (not active))
8536 ;; There is no info on this group if it was, in fact,
8537 ;; killed. Gnus stores no information on killed groups, so
8538 ;; there's nothing to be done.
8539 ;; One could store the information somewhere temporarily,
8540 ;; perhaps... Hmmm...
8542 ;; Remove any negative articles numbers.
8543 (while (and unread (< (car unread) 0))
8544 (setq unread (cdr unread)))
8545 ;; Remove any expired article numbers
8546 (while (and unread (< (car unread) (car active)))
8547 (setq unread (cdr unread)))
8548 ;; Compute the ranges of read articles by looking at the list of
8551 (when (/= (car unread) prev)
8552 (push (if (= prev (1- (car unread))) prev
8553 (cons prev (1- (car unread))))
8555 (setq prev (1+ (car unread)))
8556 (setq unread (cdr unread)))
8557 (when (<= prev (cdr active))
8558 (push (cons prev (cdr active)) read))
8560 (set-buffer gnus-group-buffer)
8563 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8564 (gnus-info-set-read ',info ',(gnus-info-read info))
8565 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8566 (gnus-group-update-group ,group t))))
8567 ;; Enter this list into the group info.
8569 info (if (> (length read) 1) (nreverse read) read))
8570 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8571 (gnus-get-unread-articles-in-group info (gnus-active group))
8574 (defun gnus-offer-save-summaries ()
8575 "Offer to save all active summary buffers."
8577 (let ((buflist (buffer-list))
8579 ;; Go through all buffers and find all summaries.
8581 (and (setq bufname (buffer-name (car buflist)))
8582 (string-match "Summary" bufname)
8584 (set-buffer bufname)
8585 ;; We check that this is, indeed, a summary buffer.
8586 (and (eq major-mode 'gnus-summary-mode)
8587 ;; Also make sure this isn't bogus.
8588 gnus-newsgroup-prepared
8589 ;; Also make sure that this isn't a dead summary buffer.
8590 (not gnus-dead-summary-mode)))
8591 (push bufname buffers))
8592 (setq buflist (cdr buflist)))
8593 ;; Go through all these summary buffers and offer to save them.
8596 "Update summary buffer %s? "
8597 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8602 (run-hooks 'gnus-sum-load-hook)
8604 ;;; gnus-sum.el ends here