1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
35 (defcustom gnus-kill-summary-on-exit t
36 "*If non-nil, kill the summary buffer when you exit from it.
37 If nil, the summary will become a \"*Dead Summary*\" buffer, and
38 it will be killed sometime later."
39 :group 'gnus-summary-exit
42 (defcustom gnus-fetch-old-headers nil
43 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
44 If an unread article in the group refers to an older, already read (or
45 just marked as read) article, the old article will not normally be
46 displayed in the Summary buffer. If this variable is non-nil, Gnus
47 will attempt to grab the headers to the old articles, and thereby
48 build complete threads. If it has the value `some', only enough
49 headers to connect otherwise loose threads will be displayed.
50 This variable can also be a number. In that case, no more than that
51 number of old headers will be fetched.
53 The server has to support NOV for any of this to work."
55 :type '(choice (const :tag "off" nil)
58 (sexp :menu-tag "other" t)))
60 (defcustom gnus-summary-make-false-root 'adopt
61 "*nil means that Gnus won't gather loose threads.
62 If the root of a thread has expired or been read in a previous
63 session, the information necessary to build a complete thread has been
64 lost. Instead of having many small sub-threads from this original thread
65 scattered all over the summary buffer, Gnus can gather them.
67 If non-nil, Gnus will try to gather all loose sub-threads from an
68 original thread into one large thread.
70 If this variable is non-nil, it should be one of `none', `adopt',
73 If this variable is `none', Gnus will not make a false root, but just
74 present the sub-threads after another.
75 If this variable is `dummy', Gnus will create a dummy root that will
76 have all the sub-threads as children.
77 If this variable is `adopt', Gnus will make one of the \"children\"
78 the parent and mark all the step-children as such.
79 If this variable is `empty', the \"children\" are printed with empty
80 subject fields. (Or rather, they will be printed with a string
81 given by the `gnus-summary-same-subject' variable.)"
83 :type '(choice (const :tag "off" nil)
89 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
90 "*A regexp to match subjects to be excluded from loose thread gathering.
91 As loose thread gathering is done on subjects only, that means that
92 there can be many false gatherings performed. By rooting out certain
93 common subjects, gathering might become saner."
97 (defcustom gnus-summary-gather-subject-limit nil
98 "*Maximum length of subject comparisons when gathering loose threads.
99 Use nil to compare full subjects. Setting this variable to a low
100 number will help gather threads that have been corrupted by
101 newsreaders chopping off subject lines, but it might also mean that
102 unrelated articles that have subject that happen to begin with the
103 same few characters will be incorrectly gathered.
105 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
108 :type '(choice (const :tag "off" nil)
110 (sexp :menu-tag "on" t)))
112 (defcustom gnus-simplify-ignored-prefixes nil
113 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
115 :type '(choice (const :tag "off" nil)
118 (defcustom gnus-build-sparse-threads nil
119 "*If non-nil, fill in the gaps in threads.
120 If `some', only fill in the gaps that are needed to tie loose threads
121 together. If `more', fill in all leaf nodes that Gnus can find. If
122 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
124 :type '(choice (const :tag "off" nil)
127 (sexp :menu-tag "all" t)))
129 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
130 "Function used for gathering loose threads.
131 There are two pre-defined functions: `gnus-gather-threads-by-subject',
132 which only takes Subjects into consideration; and
133 `gnus-gather-threads-by-references', which compared the References
134 headers of the articles to find matches."
136 :type '(set (function-item gnus-gather-threads-by-subject)
137 (function-item gnus-gather-threads-by-references)
138 (function :tag "other")))
140 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
141 (defcustom gnus-summary-same-subject ""
142 "*String indicating that the current article has the same subject as the previous.
143 This variable will only be used if the value of
144 `gnus-summary-make-false-root' is `empty'."
145 :group 'gnus-summary-format
148 (defcustom gnus-summary-goto-unread t
149 "*If t, marking commands will go to the next unread article.
150 If `never', commands that usually go to the next unread article, will
151 go to the next article, whether it is read or not.
152 If nil, only the marking commands will go to the next (un)read article."
153 :group 'gnus-summary-marks
154 :link '(custom-manual "(gnus)Setting Marks")
155 :type '(choice (const :tag "off" nil)
157 (sexp :menu-tag "on" t)))
159 (defcustom gnus-summary-default-score 0
160 "*Default article score level.
161 If this variable is nil, scoring will be disabled."
162 :group 'gnus-score-default
163 :type '(choice (const :tag "disable")
166 (defcustom gnus-summary-zcore-fuzz 0
167 "*Fuzziness factor for the zcore in the summary buffer.
168 Articles with scores closer than this to `gnus-summary-default-score'
170 :group 'gnus-summary-format
173 (defcustom gnus-simplify-subject-fuzzy-regexp nil
174 "*Strings to be removed when doing fuzzy matches.
175 This can either be a regular expression or list of regular expressions
176 that will be removed from subject strings if fuzzy subject
177 simplification is selected."
179 :type '(repeat regexp))
181 (defcustom gnus-show-threads t
182 "*If non-nil, display threads in summary mode."
186 (defcustom gnus-thread-hide-subtree nil
187 "*If non-nil, hide all threads initially.
188 If threads are hidden, you have to run the command
189 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
190 to expose hidden threads."
194 (defcustom gnus-thread-hide-killed t
195 "*If non-nil, hide killed threads automatically."
199 (defcustom gnus-thread-ignore-subject nil
200 "*If non-nil, ignore subjects and do all threading based on the Reference header.
201 If nil, which is the default, articles that have different subjects
202 from their parents will start separate threads."
206 (defcustom gnus-thread-operation-ignore-subject t
207 "*If non-nil, subjects will be ignored when doing thread commands.
208 This affects commands like `gnus-summary-kill-thread' and
209 `gnus-summary-lower-thread'.
211 If this variable is nil, articles in the same thread with different
212 subjects will not be included in the operation in question. If this
213 variable is `fuzzy', only articles that have subjects that are fuzzily
214 equal will be included."
216 :type '(choice (const :tag "off" nil)
220 (defcustom gnus-thread-indent-level 4
221 "*Number that says how much each sub-thread should be indented."
225 (defcustom gnus-auto-extend-newsgroup t
226 "*If non-nil, extend newsgroup forward and backward when requested."
227 :group 'gnus-summary-choose
230 (defcustom gnus-auto-select-first t
231 "*If nil, don't select the first unread article when entering a group.
232 If this variable is `best', select the highest-scored unread article
233 in the group. If neither nil nor `best', select the first unread
236 If you want to prevent automatic selection of the first unread article
237 in some newsgroups, set the variable to nil in
238 `gnus-select-group-hook'."
239 :group 'gnus-group-select
240 :type '(choice (const :tag "none" nil)
242 (sexp :menu-tag "first" t)))
244 (defcustom gnus-auto-select-next t
245 "*If non-nil, offer to go to the next group from the end of the previous.
246 If the value is t and the next newsgroup is empty, Gnus will exit
247 summary mode and go back to group mode. If the value is neither nil
248 nor t, Gnus will select the following unread newsgroup. In
249 particular, if the value is the symbol `quietly', the next unread
250 newsgroup will be selected without any confirmation, and if it is
251 `almost-quietly', the next group will be selected without any
252 confirmation if you are located on the last article in the group.
253 Finally, if this variable is `slightly-quietly', the `Z n' command
254 will go to the next group without confirmation."
255 :group 'gnus-summary-maneuvering
256 :type '(choice (const :tag "off" nil)
258 (const almost-quietly)
259 (const slightly-quietly)
260 (sexp :menu-tag "on" t)))
262 (defcustom gnus-auto-select-same nil
263 "*If non-nil, select the next article with the same subject."
264 :group 'gnus-summary-maneuvering
267 (defcustom gnus-summary-check-current nil
268 "*If non-nil, consider the current article when moving.
269 The \"unread\" movement commands will stay on the same line if the
270 current article is unread."
271 :group 'gnus-summary-maneuvering
274 (defcustom gnus-auto-center-summary t
275 "*If non-nil, always center the current summary buffer.
276 In particular, if `vertical' do only vertical recentering. If non-nil
277 and non-`vertical', do both horizontal and vertical recentering."
278 :group 'gnus-summary-maneuvering
279 :type '(choice (const :tag "none" nil)
281 (sexp :menu-tag "both" t)))
283 (defcustom gnus-show-all-headers nil
284 "*If non-nil, don't hide any headers."
285 :group 'gnus-article-hiding
286 :group 'gnus-article-headers
289 (defcustom gnus-single-article-buffer t
290 "*If non-nil, display all articles in the same buffer.
291 If nil, each group will get its own article buffer."
292 :group 'gnus-article-various
295 (defcustom gnus-break-pages t
296 "*If non-nil, do page breaking on articles.
297 The page delimiter is specified by the `gnus-page-delimiter'
299 :group 'gnus-article-various
302 (defcustom gnus-show-mime nil
303 "*If non-nil, do mime processing of articles.
304 The articles will simply be fed to the function given by
305 `gnus-show-mime-method'."
306 :group 'gnus-article-mime
309 (defcustom gnus-move-split-methods nil
310 "*Variable used to suggest where articles are to be moved to.
311 It uses the same syntax as the `gnus-split-methods' variable."
312 :group 'gnus-summary-mail
313 :type '(repeat (choice (list function)
314 (cons regexp (repeat string))
317 (defcustom gnus-unread-mark ?
318 "*Mark used for unread articles."
319 :group 'gnus-summary-marks
322 (defcustom gnus-ticked-mark ?!
323 "*Mark used for ticked articles."
324 :group 'gnus-summary-marks
327 (defcustom gnus-dormant-mark ??
328 "*Mark used for dormant articles."
329 :group 'gnus-summary-marks
332 (defcustom gnus-del-mark ?r
333 "*Mark used for del'd articles."
334 :group 'gnus-summary-marks
337 (defcustom gnus-read-mark ?R
338 "*Mark used for read articles."
339 :group 'gnus-summary-marks
342 (defcustom gnus-expirable-mark ?E
343 "*Mark used for expirable articles."
344 :group 'gnus-summary-marks
347 (defcustom gnus-killed-mark ?K
348 "*Mark used for killed articles."
349 :group 'gnus-summary-marks
352 (defcustom gnus-souped-mark ?F
353 "*Mark used for killed articles."
354 :group 'gnus-summary-marks
357 (defcustom gnus-kill-file-mark ?X
358 "*Mark used for articles killed by kill files."
359 :group 'gnus-summary-marks
362 (defcustom gnus-low-score-mark ?Y
363 "*Mark used for articles with a low score."
364 :group 'gnus-summary-marks
367 (defcustom gnus-catchup-mark ?C
368 "*Mark used for articles that are caught up."
369 :group 'gnus-summary-marks
372 (defcustom gnus-replied-mark ?A
373 "*Mark used for articles that have been replied to."
374 :group 'gnus-summary-marks
377 (defcustom gnus-cached-mark ?*
378 "*Mark used for articles that are in the cache."
379 :group 'gnus-summary-marks
382 (defcustom gnus-saved-mark ?S
383 "*Mark used for articles that have been saved to."
384 :group 'gnus-summary-marks
387 (defcustom gnus-ancient-mark ?O
388 "*Mark used for ancient articles."
389 :group 'gnus-summary-marks
392 (defcustom gnus-sparse-mark ?Q
393 "*Mark used for sparsely reffed articles."
394 :group 'gnus-summary-marks
397 (defcustom gnus-canceled-mark ?G
398 "*Mark used for canceled articles."
399 :group 'gnus-summary-marks
402 (defcustom gnus-duplicate-mark ?M
403 "*Mark used for duplicate articles."
404 :group 'gnus-summary-marks
407 (defcustom gnus-score-over-mark ?+
408 "*Score mark used for articles with high scores."
409 :group 'gnus-summary-marks
412 (defcustom gnus-score-below-mark ?-
413 "*Score mark used for articles with low scores."
414 :group 'gnus-summary-marks
417 (defcustom gnus-empty-thread-mark ?
418 "*There is no thread under the article."
419 :group 'gnus-summary-marks
422 (defcustom gnus-not-empty-thread-mark ?=
423 "*There is a thread under the article."
424 :group 'gnus-summary-marks
427 (defcustom gnus-view-pseudo-asynchronously nil
428 "*If non-nil, Gnus will view pseudo-articles asynchronously."
429 :group 'gnus-extract-view
432 (defcustom gnus-view-pseudos nil
433 "*If `automatic', pseudo-articles will be viewed automatically.
434 If `not-confirm', pseudos will be viewed automatically, and the user
435 will not be asked to confirm the command."
436 :group 'gnus-extract-view
437 :type '(choice (const :tag "off" nil)
439 (const not-confirm)))
441 (defcustom gnus-view-pseudos-separately t
442 "*If non-nil, one pseudo-article will be created for each file to be viewed.
443 If nil, all files that use the same viewing command will be given as a
444 list of parameters to that command."
445 :group 'gnus-extract-view
448 (defcustom gnus-insert-pseudo-articles t
449 "*If non-nil, insert pseudo-articles when decoding articles."
450 :group 'gnus-extract-view
453 (defcustom gnus-summary-dummy-line-format
455 "*The format specification for the dummy roots in the summary buffer.
456 It works along the same lines as a normal formatting string,
457 with some simple extensions.
460 :group 'gnus-threading
463 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
464 "*The format specification for the summary mode line.
465 It works along the same lines as a normal formatting string,
466 with some simple extensions:
469 %p Unprefixed group name
470 %A Current article number
472 %U Number of unread articles in the group
473 %e Number of unselected articles in the group
474 %Z A string with unread/unselected article counts
475 %g Shortish group name
476 %S Subject of the current article
478 %s Current score file name
479 %d Number of dormant articles
480 %r Number of articles that have been marked as read in this session
481 %E Number of articles expunged by the score files"
482 :group 'gnus-summary-format
485 (defcustom gnus-summary-mark-below 0
486 "*Mark all articles with a score below this variable as read.
487 This variable is local to each summary buffer and usually set by the
489 :group 'gnus-score-default
492 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
493 "*List of functions used for sorting articles in the summary buffer.
494 This variable is only used when not using a threaded display."
495 :group 'gnus-summary-sort
496 :type '(repeat (choice (function-item gnus-article-sort-by-number)
497 (function-item gnus-article-sort-by-author)
498 (function-item gnus-article-sort-by-subject)
499 (function-item gnus-article-sort-by-date)
500 (function-item gnus-article-sort-by-score)
501 (function :tag "other"))))
503 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
504 "*List of functions used for sorting threads in the summary buffer.
505 By default, threads are sorted by article number.
507 Each function takes two threads and return non-nil if the first thread
508 should be sorted before the other. If you use more than one function,
509 the primary sort function should be the last. You should probably
510 always include `gnus-thread-sort-by-number' in the list of sorting
511 functions -- preferably first.
513 Ready-made functions include `gnus-thread-sort-by-number',
514 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
515 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
516 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
517 :group 'gnus-summary-sort
518 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
519 (function-item gnus-thread-sort-by-author)
520 (function-item gnus-thread-sort-by-subject)
521 (function-item gnus-thread-sort-by-date)
522 (function-item gnus-thread-sort-by-score)
523 (function-item gnus-thread-sort-by-total-score)
524 (function :tag "other"))))
526 (defcustom gnus-thread-score-function '+
527 "*Function used for calculating the total score of a thread.
529 The function is called with the scores of the article and each
530 subthread and should then return the score of the thread.
532 Some functions you can use are `+', `max', or `min'."
533 :group 'gnus-summary-sort
536 (defcustom gnus-summary-expunge-below nil
537 "All articles that have a score less than this variable will be expunged."
538 :group 'gnus-score-default
539 :type '(choice (const :tag "off" nil)
542 (defcustom gnus-thread-expunge-below nil
543 "All threads that have a total score less than this variable will be expunged.
544 See `gnus-thread-score-function' for en explanation of what a
545 \"thread score\" is."
546 :group 'gnus-treading
547 :group 'gnus-score-default
548 :type '(choice (const :tag "off" nil)
551 (defcustom gnus-summary-mode-hook nil
552 "*A hook for Gnus summary mode.
553 This hook is run before any variables are set in the summary buffer."
554 :group 'gnus-summary-various
557 (defcustom gnus-summary-menu-hook nil
558 "*Hook run after the creation of the summary mode menu."
559 :group 'gnus-summary-visual
562 (defcustom gnus-summary-exit-hook nil
563 "*A hook called on exit from the summary buffer.
564 It will be called with point in the group buffer."
565 :group 'gnus-summary-exit
568 (defcustom gnus-summary-prepare-hook nil
569 "*A hook called after the summary buffer has been generated.
570 If you want to modify the summary buffer, you can use this hook."
571 :group 'gnus-summary-various
574 (defcustom gnus-summary-generate-hook nil
575 "*A hook run just before generating the summary buffer.
576 This hook is commonly used to customize threading variables and the
578 :group 'gnus-summary-various
581 (defcustom gnus-select-group-hook nil
582 "*A hook called when a newsgroup is selected.
584 If you'd like to simplify subjects like the
585 `gnus-summary-next-same-subject' command does, you can use the
588 (setq gnus-select-group-hook
591 (mapcar (lambda (header)
592 (mail-header-set-subject
594 (gnus-simplify-subject
595 (mail-header-subject header) 're-only)))
596 gnus-newsgroup-headers))))"
597 :group 'gnus-group-select
600 (defcustom gnus-select-article-hook nil
601 "*A hook called when an article is selected."
602 :group 'gnus-summary-choose
605 (defcustom gnus-visual-mark-article-hook
606 (list 'gnus-highlight-selected-summary)
607 "*Hook run after selecting an article in the summary buffer.
608 It is meant to be used for highlighting the article in some way. It
609 is not run if `gnus-visual' is nil."
610 :group 'gnus-summary-visual
613 (defcustom gnus-parse-headers-hook
614 (list 'gnus-decode-rfc1522)
615 "*A hook called before parsing the headers."
619 (defcustom gnus-exit-group-hook nil
620 "*A hook called when exiting (not quitting) summary mode."
624 (defcustom gnus-summary-update-hook
625 (list 'gnus-summary-highlight-line)
626 "*A hook called when a summary line is changed.
627 The hook will not be called if `gnus-visual' is nil.
629 The default function `gnus-summary-highlight-line' will
630 highlight the line according to the `gnus-summary-highlight'
632 :group 'gnus-summary-visual
635 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
636 "*A hook called when an article is selected for the first time.
637 The hook is intended to mark an article as read (or unread)
638 automatically when it is selected."
639 :group 'gnus-summary-choose
642 (defcustom gnus-group-no-more-groups-hook nil
643 "*A hook run when returning to group mode having no more (unread) groups."
644 :group 'gnus-group-select
647 (defcustom gnus-ps-print-hook nil
648 "*A hook run before ps-printing something from Gnus."
652 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
653 "Face used for highlighting the current article in the summary buffer."
654 :group 'gnus-summary-visual
657 (defcustom gnus-summary-highlight
658 '(((= mark gnus-canceled-mark)
659 . gnus-summary-cancelled-face)
660 ((and (> score default)
661 (or (= mark gnus-dormant-mark)
662 (= mark gnus-ticked-mark)))
663 . gnus-summary-high-ticked-face)
664 ((and (< score default)
665 (or (= mark gnus-dormant-mark)
666 (= mark gnus-ticked-mark)))
667 . gnus-summary-low-ticked-face)
668 ((or (= mark gnus-dormant-mark)
669 (= mark gnus-ticked-mark))
670 . gnus-summary-normal-ticked-face)
671 ((and (> score default) (= mark gnus-ancient-mark))
672 . gnus-summary-high-ancient-face)
673 ((and (< score default) (= mark gnus-ancient-mark))
674 . gnus-summary-low-ancient-face)
675 ((= mark gnus-ancient-mark)
676 . gnus-summary-normal-ancient-face)
677 ((and (> score default) (= mark gnus-unread-mark))
678 . gnus-summary-high-unread-face)
679 ((and (< score default) (= mark gnus-unread-mark))
680 . gnus-summary-low-unread-face)
681 ((and (= mark gnus-unread-mark))
682 . gnus-summary-normal-unread-face)
684 . gnus-summary-high-read-face)
686 . gnus-summary-low-read-face)
688 . gnus-summary-normal-read-face))
689 "Controls the highlighting of summary buffer lines.
691 A list of (FORM . FACE) pairs. When deciding how a a particular
692 summary line should be displayed, each form is evaluated. The content
693 of the face field after the first true form is used. You can change
694 how those summary lines are displayed, by editing the face field.
696 You can use the following variables in the FORM field.
698 score: The articles score
699 default: The default article score.
700 below: The score below which articles are automatically marked as read.
701 mark: The articles mark."
702 :group 'gnus-summary-visual
703 :type '(repeat (cons (sexp :tag "Form" nil)
707 ;;; Internal variables
709 (defvar gnus-scores-exclude-files nil)
711 (defvar gnus-summary-display-table
712 ;; Change the display table. Odd characters have a tendency to mess
713 ;; up nicely formatted displays - we make all possible glyphs
714 ;; display only a single character.
716 ;; We start from the standard display table, if any.
717 (let ((table (or (copy-sequence standard-display-table)
718 (make-display-table)))
719 ;; Nix out all the control chars...
721 (while (>= (setq i (1- i)) 0)
723 ;; ... but not newline and cr, of course. (cr is necessary for the
724 ;; selective display).
727 ;; We nix out any glyphs over 126 that are not set already.
729 (while (>= (setq i (1- i)) 127)
730 ;; Only modify if the entry is nil.
732 (aset table i [??]))))
734 "Display table used in summary mode buffers.")
736 (defvar gnus-original-article nil)
737 (defvar gnus-article-internal-prepare-hook nil)
738 (defvar gnus-newsgroup-process-stack nil)
740 (defvar gnus-thread-indent-array nil)
741 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
743 ;; Avoid highlighting in kill files.
744 (defvar gnus-summary-inhibit-highlight nil)
745 (defvar gnus-newsgroup-selected-overlay nil)
746 (defvar gnus-inhibit-limiting nil)
747 (defvar gnus-newsgroup-adaptive-score-file nil)
748 (defvar gnus-current-score-file nil)
749 (defvar gnus-current-move-group nil)
750 (defvar gnus-current-copy-group nil)
751 (defvar gnus-current-crosspost-group nil)
753 (defvar gnus-newsgroup-dependencies nil)
754 (defvar gnus-newsgroup-adaptive nil)
755 (defvar gnus-summary-display-article-function nil)
756 (defvar gnus-summary-highlight-line-function nil
757 "Function called after highlighting a summary line.")
759 (defvar gnus-summary-line-format-alist
760 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
761 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
762 (?s gnus-tmp-subject-or-nil ?s)
763 (?n gnus-tmp-name ?s)
764 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
766 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
768 (?F gnus-tmp-from ?s)
769 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
770 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
771 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
772 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
773 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
774 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
775 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
776 (?L gnus-tmp-lines ?d)
777 (?I gnus-tmp-indentation ?s)
778 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
779 (?R gnus-tmp-replied ?c)
780 (?\[ gnus-tmp-opening-bracket ?c)
781 (?\] gnus-tmp-closing-bracket ?c)
782 (?\> (make-string gnus-tmp-level ? ) ?s)
783 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
784 (?i gnus-tmp-score ?d)
785 (?z gnus-tmp-score-char ?c)
786 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
787 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
788 (?U gnus-tmp-unread ?c)
789 (?t (gnus-summary-number-of-articles-in-thread
790 (and (boundp 'thread) (car thread)) gnus-tmp-level)
792 (?e (gnus-summary-number-of-articles-in-thread
793 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
795 (?u gnus-tmp-user-defined ?s)
796 (?P (gnus-pick-line-number) ?d))
797 "An alist of format specifications that can appear in summary lines,
798 and what variables they correspond with, along with the type of the
799 variable (string, integer, character, etc).")
801 (defvar gnus-summary-dummy-line-format-alist
802 `((?S gnus-tmp-subject ?s)
803 (?N gnus-tmp-number ?d)
804 (?u gnus-tmp-user-defined ?s)))
806 (defvar gnus-summary-mode-line-format-alist
807 `((?G gnus-tmp-group-name ?s)
808 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
809 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
810 (?A gnus-tmp-article-number ?d)
811 (?Z gnus-tmp-unread-and-unselected ?s)
813 (?U gnus-tmp-unread-and-unticked ?d)
814 (?S gnus-tmp-subject ?s)
815 (?e gnus-tmp-unselected ?d)
816 (?u gnus-tmp-user-defined ?s)
817 (?d (length gnus-newsgroup-dormant) ?d)
818 (?t (length gnus-newsgroup-marked) ?d)
819 (?r (length gnus-newsgroup-reads) ?d)
820 (?E gnus-newsgroup-expunged-tally ?d)
821 (?s (gnus-current-score-file-nondirectory) ?s)))
823 (defvar gnus-last-search-regexp nil
824 "Default regexp for article search command.")
826 (defvar gnus-last-shell-command nil
827 "Default shell command on article.")
829 (defvar gnus-newsgroup-begin nil)
830 (defvar gnus-newsgroup-end nil)
831 (defvar gnus-newsgroup-last-rmail nil)
832 (defvar gnus-newsgroup-last-mail nil)
833 (defvar gnus-newsgroup-last-folder nil)
834 (defvar gnus-newsgroup-last-file nil)
835 (defvar gnus-newsgroup-auto-expire nil)
836 (defvar gnus-newsgroup-active nil)
838 (defvar gnus-newsgroup-data nil)
839 (defvar gnus-newsgroup-data-reverse nil)
840 (defvar gnus-newsgroup-limit nil)
841 (defvar gnus-newsgroup-limits nil)
843 (defvar gnus-newsgroup-unreads nil
844 "List of unread articles in the current newsgroup.")
846 (defvar gnus-newsgroup-unselected nil
847 "List of unselected unread articles in the current newsgroup.")
849 (defvar gnus-newsgroup-reads nil
850 "Alist of read articles and article marks in the current newsgroup.")
852 (defvar gnus-newsgroup-expunged-tally nil)
854 (defvar gnus-newsgroup-marked nil
855 "List of ticked articles in the current newsgroup (a subset of unread art).")
857 (defvar gnus-newsgroup-killed nil
858 "List of ranges of articles that have been through the scoring process.")
860 (defvar gnus-newsgroup-cached nil
861 "List of articles that come from the article cache.")
863 (defvar gnus-newsgroup-saved nil
864 "List of articles that have been saved.")
866 (defvar gnus-newsgroup-kill-headers nil)
868 (defvar gnus-newsgroup-replied nil
869 "List of articles that have been replied to in the current newsgroup.")
871 (defvar gnus-newsgroup-expirable nil
872 "List of articles in the current newsgroup that can be expired.")
874 (defvar gnus-newsgroup-processable nil
875 "List of articles in the current newsgroup that can be processed.")
877 (defvar gnus-newsgroup-bookmarks nil
878 "List of articles in the current newsgroup that have bookmarks.")
880 (defvar gnus-newsgroup-dormant nil
881 "List of dormant articles in the current newsgroup.")
883 (defvar gnus-newsgroup-scored nil
884 "List of scored articles in the current newsgroup.")
886 (defvar gnus-newsgroup-headers nil
887 "List of article headers in the current newsgroup.")
889 (defvar gnus-newsgroup-threads nil)
891 (defvar gnus-newsgroup-prepared nil
892 "Whether the current group has been prepared properly.")
894 (defvar gnus-newsgroup-ancient nil
895 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
897 (defvar gnus-newsgroup-sparse nil)
899 (defvar gnus-current-article nil)
900 (defvar gnus-article-current nil)
901 (defvar gnus-current-headers nil)
902 (defvar gnus-have-all-headers nil)
903 (defvar gnus-last-article nil)
904 (defvar gnus-newsgroup-history nil)
906 (defconst gnus-summary-local-variables
907 '(gnus-newsgroup-name
908 gnus-newsgroup-begin gnus-newsgroup-end
909 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
910 gnus-newsgroup-last-folder gnus-newsgroup-last-file
911 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
912 gnus-newsgroup-unselected gnus-newsgroup-marked
913 gnus-newsgroup-reads gnus-newsgroup-saved
914 gnus-newsgroup-replied gnus-newsgroup-expirable
915 gnus-newsgroup-processable gnus-newsgroup-killed
916 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
917 gnus-newsgroup-headers gnus-newsgroup-threads
918 gnus-newsgroup-prepared gnus-summary-highlight-line-function
919 gnus-current-article gnus-current-headers gnus-have-all-headers
920 gnus-last-article gnus-article-internal-prepare-hook
921 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
922 gnus-newsgroup-scored gnus-newsgroup-kill-headers
923 gnus-thread-expunge-below
924 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
925 (gnus-summary-mark-below . global)
926 gnus-newsgroup-active gnus-scores-exclude-files
927 gnus-newsgroup-history gnus-newsgroup-ancient
928 gnus-newsgroup-sparse gnus-newsgroup-process-stack
929 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
930 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
931 (gnus-newsgroup-expunged-tally . 0)
932 gnus-cache-removable-articles gnus-newsgroup-cached
933 gnus-newsgroup-data gnus-newsgroup-data-reverse
934 gnus-newsgroup-limit gnus-newsgroup-limits)
935 "Variables that are buffer-local to the summary buffers.")
937 ;; Byte-compiler warning.
938 (defvar gnus-article-mode-map)
940 ;; Subject simplification.
942 (defsubst gnus-simplify-subject-re (subject)
943 "Remove \"Re:\" from subject lines."
944 (if (string-match "^[Rr][Ee]: *" subject)
945 (substring subject (match-end 0))
948 (defun gnus-simplify-subject (subject &optional re-only)
949 "Remove `Re:' and words in parentheses.
950 If RE-ONLY is non-nil, strip leading `Re:'s only."
951 (let ((case-fold-search t)) ;Ignore case.
952 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
953 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
954 (setq subject (substring subject (match-end 0))))
955 ;; Remove uninteresting prefixes.
956 (when (and (not re-only)
957 gnus-simplify-ignored-prefixes
958 (string-match gnus-simplify-ignored-prefixes subject))
959 (setq subject (substring subject (match-end 0))))
960 ;; Remove words in parentheses from end.
962 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
963 (setq subject (substring subject 0 (match-beginning 0)))))
964 ;; Return subject string.
967 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
969 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
970 (goto-char (point-min))
971 (while (re-search-forward regexp nil t)
972 (replace-match (or newtext ""))))
974 (defun gnus-simplify-buffer-fuzzy ()
975 "Simplify string in the buffer fuzzily.
976 The string in the accessible portion of the current buffer is simplified.
977 It is assumed to be a single-line subject.
978 Whitespace is generally cleaned up, and miscellaneous leading/trailing
979 matter is removed. Additional things can be deleted by setting
980 gnus-simplify-subject-fuzzy-regexp."
981 (let ((case-fold-search t)
983 (gnus-simplify-buffer-fuzzy-step "\t" " ")
985 (while (not (eq modified-tick (buffer-modified-tick)))
986 (setq modified-tick (buffer-modified-tick))
988 ((listp gnus-simplify-subject-fuzzy-regexp)
989 (mapcar 'gnus-simplify-buffer-fuzzy-step
990 gnus-simplify-subject-fuzzy-regexp))
991 (gnus-simplify-subject-fuzzy-regexp
992 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
993 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
994 (gnus-simplify-buffer-fuzzy-step
995 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
996 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
998 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
999 (gnus-simplify-buffer-fuzzy-step " +" " ")
1000 (gnus-simplify-buffer-fuzzy-step " $")
1001 (gnus-simplify-buffer-fuzzy-step "^ +")))
1003 (defun gnus-simplify-subject-fuzzy (subject)
1004 "Simplify a subject string fuzzily.
1005 See gnus-simplify-buffer-fuzzy for details."
1007 (gnus-set-work-buffer)
1008 (let ((case-fold-search t))
1010 (inline (gnus-simplify-buffer-fuzzy))
1013 (defsubst gnus-simplify-subject-fully (subject)
1014 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1016 ((null gnus-summary-gather-subject-limit)
1017 (gnus-simplify-subject-re subject))
1018 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1019 (gnus-simplify-subject-fuzzy subject))
1020 ((numberp gnus-summary-gather-subject-limit)
1021 (gnus-limit-string (gnus-simplify-subject-re subject)
1022 gnus-summary-gather-subject-limit))
1026 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1027 "Check whether two subjects are equal. If optional argument
1028 simple-first is t, first argument is already simplified."
1030 ((null simple-first)
1031 (equal (gnus-simplify-subject-fully s1)
1032 (gnus-simplify-subject-fully s2)))
1035 (gnus-simplify-subject-fully s2)))))
1037 (defun gnus-summary-bubble-group ()
1038 "Increase the score of the current group.
1039 This is a handy function to add to `gnus-summary-exit-hook' to
1040 increase the score of each group you read."
1041 (gnus-group-add-score gnus-newsgroup-name))
1045 ;;; Gnus summary mode
1048 (put 'gnus-summary-mode 'mode-class 'special)
1051 ;; Non-orthogonal keys
1053 (gnus-define-keys gnus-summary-mode-map
1054 " " gnus-summary-next-page
1055 "\177" gnus-summary-prev-page
1056 [delete] gnus-summary-prev-page
1057 "\r" gnus-summary-scroll-up
1058 "n" gnus-summary-next-unread-article
1059 "p" gnus-summary-prev-unread-article
1060 "N" gnus-summary-next-article
1061 "P" gnus-summary-prev-article
1062 "\M-\C-n" gnus-summary-next-same-subject
1063 "\M-\C-p" gnus-summary-prev-same-subject
1064 "\M-n" gnus-summary-next-unread-subject
1065 "\M-p" gnus-summary-prev-unread-subject
1066 "." gnus-summary-first-unread-article
1067 "," gnus-summary-best-unread-article
1068 "\M-s" gnus-summary-search-article-forward
1069 "\M-r" gnus-summary-search-article-backward
1070 "<" gnus-summary-beginning-of-article
1071 ">" gnus-summary-end-of-article
1072 "j" gnus-summary-goto-article
1073 "^" gnus-summary-refer-parent-article
1074 "\M-^" gnus-summary-refer-article
1075 "u" gnus-summary-tick-article-forward
1076 "!" gnus-summary-tick-article-forward
1077 "U" gnus-summary-tick-article-backward
1078 "d" gnus-summary-mark-as-read-forward
1079 "D" gnus-summary-mark-as-read-backward
1080 "E" gnus-summary-mark-as-expirable
1081 "\M-u" gnus-summary-clear-mark-forward
1082 "\M-U" gnus-summary-clear-mark-backward
1083 "k" gnus-summary-kill-same-subject-and-select
1084 "\C-k" gnus-summary-kill-same-subject
1085 "\M-\C-k" gnus-summary-kill-thread
1086 "\M-\C-l" gnus-summary-lower-thread
1087 "e" gnus-summary-edit-article
1088 "#" gnus-summary-mark-as-processable
1089 "\M-#" gnus-summary-unmark-as-processable
1090 "\M-\C-t" gnus-summary-toggle-threads
1091 "\M-\C-s" gnus-summary-show-thread
1092 "\M-\C-h" gnus-summary-hide-thread
1093 "\M-\C-f" gnus-summary-next-thread
1094 "\M-\C-b" gnus-summary-prev-thread
1095 "\M-\C-u" gnus-summary-up-thread
1096 "\M-\C-d" gnus-summary-down-thread
1097 "&" gnus-summary-execute-command
1098 "c" gnus-summary-catchup-and-exit
1099 "\C-w" gnus-summary-mark-region-as-read
1100 "\C-t" gnus-summary-toggle-truncation
1101 "?" gnus-summary-mark-as-dormant
1102 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1103 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1104 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1105 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1106 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1107 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1108 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1109 "=" gnus-summary-expand-window
1110 "\C-x\C-s" gnus-summary-reselect-current-group
1111 "\M-g" gnus-summary-rescan-group
1112 "w" gnus-summary-stop-page-breaking
1113 "\C-c\C-r" gnus-summary-caesar-message
1114 "\M-t" gnus-summary-toggle-mime
1115 "f" gnus-summary-followup
1116 "F" gnus-summary-followup-with-original
1117 "C" gnus-summary-cancel-article
1118 "r" gnus-summary-reply
1119 "R" gnus-summary-reply-with-original
1120 "\C-c\C-f" gnus-summary-mail-forward
1121 "o" gnus-summary-save-article
1122 "\C-o" gnus-summary-save-article-mail
1123 "|" gnus-summary-pipe-output
1124 "\M-k" gnus-summary-edit-local-kill
1125 "\M-K" gnus-summary-edit-global-kill
1127 "\C-c\C-d" gnus-summary-describe-group
1128 "q" gnus-summary-exit
1129 "Q" gnus-summary-exit-no-update
1130 "\C-c\C-i" gnus-info-find-node
1131 gnus-mouse-2 gnus-mouse-pick-article
1132 "m" gnus-summary-mail-other-window
1133 "a" gnus-summary-post-news
1134 "x" gnus-summary-limit-to-unread
1135 "s" gnus-summary-isearch-article
1136 "t" gnus-article-hide-headers
1137 "g" gnus-summary-show-article
1138 "l" gnus-summary-goto-last-article
1139 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1140 "\C-d" gnus-summary-enter-digest-group
1141 "\M-\C-d" gnus-summary-read-document
1143 "*" gnus-cache-enter-article
1144 "\M-*" gnus-cache-remove-article
1145 "\M-&" gnus-summary-universal-argument
1146 "\C-l" gnus-recenter
1147 "I" gnus-summary-increase-score
1148 "L" gnus-summary-lower-score
1150 "V" gnus-summary-score-map
1151 "X" gnus-uu-extract-map
1152 "S" gnus-summary-send-map)
1154 ;; Sort of orthogonal keymap
1155 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1156 "t" gnus-summary-tick-article-forward
1157 "!" gnus-summary-tick-article-forward
1158 "d" gnus-summary-mark-as-read-forward
1159 "r" gnus-summary-mark-as-read-forward
1160 "c" gnus-summary-clear-mark-forward
1161 " " gnus-summary-clear-mark-forward
1162 "e" gnus-summary-mark-as-expirable
1163 "x" gnus-summary-mark-as-expirable
1164 "?" gnus-summary-mark-as-dormant
1165 "b" gnus-summary-set-bookmark
1166 "B" gnus-summary-remove-bookmark
1167 "#" gnus-summary-mark-as-processable
1168 "\M-#" gnus-summary-unmark-as-processable
1169 "S" gnus-summary-limit-include-expunged
1170 "C" gnus-summary-catchup
1171 "H" gnus-summary-catchup-to-here
1172 "\C-c" gnus-summary-catchup-all
1173 "k" gnus-summary-kill-same-subject-and-select
1174 "K" gnus-summary-kill-same-subject
1175 "P" gnus-uu-mark-map)
1177 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1178 "c" gnus-summary-clear-above
1179 "u" gnus-summary-tick-above
1180 "m" gnus-summary-mark-above
1181 "k" gnus-summary-kill-below)
1183 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1184 "/" gnus-summary-limit-to-subject
1185 "n" gnus-summary-limit-to-articles
1186 "w" gnus-summary-pop-limit
1187 "s" gnus-summary-limit-to-subject
1188 "a" gnus-summary-limit-to-author
1189 "u" gnus-summary-limit-to-unread
1190 "m" gnus-summary-limit-to-marks
1191 "v" gnus-summary-limit-to-score
1192 "D" gnus-summary-limit-include-dormant
1193 "d" gnus-summary-limit-exclude-dormant
1194 "t" gnus-summary-limit-to-age
1195 "E" gnus-summary-limit-include-expunged
1196 "c" gnus-summary-limit-exclude-childless-dormant
1197 "C" gnus-summary-limit-mark-excluded-as-read)
1199 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1200 "n" gnus-summary-next-unread-article
1201 "p" gnus-summary-prev-unread-article
1202 "N" gnus-summary-next-article
1203 "P" gnus-summary-prev-article
1204 "\C-n" gnus-summary-next-same-subject
1205 "\C-p" gnus-summary-prev-same-subject
1206 "\M-n" gnus-summary-next-unread-subject
1207 "\M-p" gnus-summary-prev-unread-subject
1208 "f" gnus-summary-first-unread-article
1209 "b" gnus-summary-best-unread-article
1210 "j" gnus-summary-goto-article
1211 "g" gnus-summary-goto-subject
1212 "l" gnus-summary-goto-last-article
1213 "p" gnus-summary-pop-article)
1215 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1216 "k" gnus-summary-kill-thread
1217 "l" gnus-summary-lower-thread
1218 "i" gnus-summary-raise-thread
1219 "T" gnus-summary-toggle-threads
1220 "t" gnus-summary-rethread-current
1221 "^" gnus-summary-reparent-thread
1222 "s" gnus-summary-show-thread
1223 "S" gnus-summary-show-all-threads
1224 "h" gnus-summary-hide-thread
1225 "H" gnus-summary-hide-all-threads
1226 "n" gnus-summary-next-thread
1227 "p" gnus-summary-prev-thread
1228 "u" gnus-summary-up-thread
1229 "o" gnus-summary-top-thread
1230 "d" gnus-summary-down-thread
1231 "#" gnus-uu-mark-thread
1232 "\M-#" gnus-uu-unmark-thread)
1234 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1235 "g" gnus-summary-prepare
1236 "c" gnus-summary-insert-cached-articles)
1238 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1239 "c" gnus-summary-catchup-and-exit
1240 "C" gnus-summary-catchup-all-and-exit
1241 "E" gnus-summary-exit-no-update
1242 "Q" gnus-summary-exit
1243 "Z" gnus-summary-exit
1244 "n" gnus-summary-catchup-and-goto-next-group
1245 "R" gnus-summary-reselect-current-group
1246 "G" gnus-summary-rescan-group
1247 "N" gnus-summary-next-group
1248 "s" gnus-summary-save-newsrc
1249 "P" gnus-summary-prev-group)
1251 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1252 " " gnus-summary-next-page
1253 "n" gnus-summary-next-page
1254 "\177" gnus-summary-prev-page
1255 [delete] gnus-summary-prev-page
1256 "p" gnus-summary-prev-page
1257 "\r" gnus-summary-scroll-up
1258 "<" gnus-summary-beginning-of-article
1259 ">" gnus-summary-end-of-article
1260 "b" gnus-summary-beginning-of-article
1261 "e" gnus-summary-end-of-article
1262 "^" gnus-summary-refer-parent-article
1263 "r" gnus-summary-refer-parent-article
1264 "R" gnus-summary-refer-references
1265 "g" gnus-summary-show-article
1266 "s" gnus-summary-isearch-article
1267 "P" gnus-summary-print-article)
1269 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1270 "b" gnus-article-add-buttons
1271 "B" gnus-article-add-buttons-to-head
1272 "o" gnus-article-treat-overstrike
1273 "e" gnus-article-emphasize
1274 "w" gnus-article-fill-cited-article
1275 "c" gnus-article-remove-cr
1276 "q" gnus-article-de-quoted-unreadable
1277 "f" gnus-article-display-x-face
1278 "l" gnus-summary-stop-page-breaking
1279 "r" gnus-summary-caesar-message
1280 "t" gnus-article-hide-headers
1281 "v" gnus-summary-verbose-headers
1282 "m" gnus-summary-toggle-mime
1283 "h" gnus-article-treat-html)
1285 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1286 "a" gnus-article-hide
1287 "h" gnus-article-hide-headers
1288 "b" gnus-article-hide-boring-headers
1289 "s" gnus-article-hide-signature
1290 "c" gnus-article-hide-citation
1291 "p" gnus-article-hide-pgp
1292 "P" gnus-article-hide-pem
1293 "\C-c" gnus-article-hide-citation-maybe)
1295 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1296 "a" gnus-article-highlight
1297 "h" gnus-article-highlight-headers
1298 "c" gnus-article-highlight-citation
1299 "s" gnus-article-highlight-signature)
1301 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1302 "z" gnus-article-date-ut
1303 "u" gnus-article-date-ut
1304 "l" gnus-article-date-local
1305 "e" gnus-article-date-lapsed
1306 "o" gnus-article-date-original
1307 "s" gnus-article-date-user)
1309 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1310 "t" gnus-article-remove-trailing-blank-lines
1311 "l" gnus-article-strip-leading-blank-lines
1312 "m" gnus-article-strip-multiple-blank-lines
1313 "a" gnus-article-strip-blank-lines)
1315 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1317 "f" gnus-summary-fetch-faq
1318 "d" gnus-summary-describe-group
1319 "h" gnus-summary-describe-briefly
1320 "i" gnus-info-find-node)
1322 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1323 "e" gnus-summary-expire-articles
1324 "\M-\C-e" gnus-summary-expire-articles-now
1325 "\177" gnus-summary-delete-article
1326 [delete] gnus-summary-delete-article
1327 "m" gnus-summary-move-article
1328 "r" gnus-summary-respool-article
1329 "w" gnus-summary-edit-article
1330 "c" gnus-summary-copy-article
1331 "B" gnus-summary-crosspost-article
1332 "q" gnus-summary-respool-query
1333 "i" gnus-summary-import-article
1334 "p" gnus-summary-article-posted-p)
1336 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1337 "o" gnus-summary-save-article
1338 "m" gnus-summary-save-article-mail
1339 "F" gnus-summary-write-article-file
1340 "r" gnus-summary-save-article-rmail
1341 "f" gnus-summary-save-article-file
1342 "b" gnus-summary-save-article-body-file
1343 "h" gnus-summary-save-article-folder
1344 "v" gnus-summary-save-article-vm
1345 "p" gnus-summary-pipe-output
1346 "s" gnus-soup-add-article))
1348 (defun gnus-summary-make-menu-bar ()
1349 (gnus-turn-off-edit-menu 'summary)
1351 (unless (boundp 'gnus-summary-misc-menu)
1354 gnus-summary-kill-menu gnus-summary-mode-map ""
1359 ["Enter score..." gnus-summary-score-entry t]
1360 ["Customize" gnus-score-customize t])
1361 (gnus-make-score-map 'increase)
1362 (gnus-make-score-map 'lower)
1364 ["Kill below" gnus-summary-kill-below t]
1365 ["Mark above" gnus-summary-mark-above t]
1366 ["Tick above" gnus-summary-tick-above t]
1367 ["Clear above" gnus-summary-clear-above t])
1368 ["Current score" gnus-summary-current-score t]
1369 ["Set score" gnus-summary-set-score t]
1370 ["Switch current score file..." gnus-score-change-score-file t]
1371 ["Set mark below..." gnus-score-set-mark-below t]
1372 ["Set expunge below..." gnus-score-set-expunge-below t]
1373 ["Edit current score file" gnus-score-edit-current-scores t]
1374 ["Edit score file" gnus-score-edit-file t]
1375 ["Trace score" gnus-score-find-trace t]
1376 ["Find words" gnus-score-find-favourite-words t]
1377 ["Rescore buffer" gnus-summary-rescore t]
1378 ["Increase score..." gnus-summary-increase-score t]
1379 ["Lower score..." gnus-summary-lower-score t]))))
1382 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1384 :selected (null gnus-score-default-header)]
1385 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1387 :selected (eq gnus-score-default-header 'a)]
1388 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1390 :selected (eq gnus-score-default-header 's)]
1392 (gnus-score-set-default 'gnus-score-default-header 'b)
1394 :selected (eq gnus-score-default-header 'b )]
1396 (gnus-score-set-default 'gnus-score-default-header 'h)
1398 :selected (eq gnus-score-default-header 'h )]
1399 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1401 :selected (eq gnus-score-default-header 'i )]
1402 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1404 :selected (eq gnus-score-default-header 't )]
1406 (gnus-score-set-default 'gnus-score-default-header 'x)
1408 :selected (eq gnus-score-default-header 'x )]
1409 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1411 :selected (eq gnus-score-default-header 'l )]
1412 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1414 :selected (eq gnus-score-default-header 'd )]
1415 ["Followups to author"
1416 (gnus-score-set-default 'gnus-score-default-header 'f)
1418 :selected (eq gnus-score-default-header 'f )])
1420 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1422 :selected (null gnus-score-default-type)]
1423 ;; The `:active' key is commented out in the following,
1424 ;; because the GNU Emacs hack to support radio buttons use
1425 ;; active to indicate which button is selected.
1426 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1428 ;; :active (not (memq gnus-score-default-header '(l d)))
1429 :selected (eq gnus-score-default-type 's)]
1430 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1432 ;; :active (not (memq gnus-score-default-header '(l d)))
1433 :selected (eq gnus-score-default-type 'r)]
1434 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1436 ;; :active (not (memq gnus-score-default-header '(l d)))
1437 :selected (eq gnus-score-default-type 'e)]
1438 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1440 ;; :active (not (memq gnus-score-default-header '(l d)))
1441 :selected (eq gnus-score-default-type 'f)]
1442 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1444 ;; :active (eq (gnus-score-default-header 'd))
1445 :selected (eq gnus-score-default-type 'b)]
1446 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1448 ;; :active (eq (gnus-score-default-header 'd))
1449 :selected (eq gnus-score-default-type 'n)]
1450 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1452 ;; :active (eq (gnus-score-default-header 'd))
1453 :selected (eq gnus-score-default-type 'a)]
1455 (gnus-score-set-default 'gnus-score-default-type '<)
1457 ;; :active (eq (gnus-score-default-header 'l))
1458 :selected (eq gnus-score-default-type '<)]
1460 (gnus-score-set-default 'gnus-score-default-type '=)
1462 ;; :active (eq (gnus-score-default-header 'l))
1463 :selected (eq gnus-score-default-type '=)]
1464 ["Greater than number"
1465 (gnus-score-set-default 'gnus-score-default-type '>)
1467 ;; :active (eq (gnus-score-default-header 'l))
1468 :selected (eq gnus-score-default-type '>)])
1469 ["Default fold" gnus-score-default-fold-toggle
1471 :selected gnus-score-default-fold]
1473 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1475 :selected (null gnus-score-default-duration)]
1477 (gnus-score-set-default 'gnus-score-default-duration 'p)
1479 :selected (eq gnus-score-default-duration 'p)]
1481 (gnus-score-set-default 'gnus-score-default-duration 't)
1483 :selected (eq gnus-score-default-duration 't)]
1485 (gnus-score-set-default 'gnus-score-default-duration 'i)
1487 :selected (eq gnus-score-default-duration 'i)]))
1490 gnus-summary-article-menu gnus-summary-mode-map ""
1493 ["All" gnus-article-hide t]
1494 ["Headers" gnus-article-hide-headers t]
1495 ["Signature" gnus-article-hide-signature t]
1496 ["Citation" gnus-article-hide-citation t]
1497 ["PGP" gnus-article-hide-pgp t]
1498 ["Boring headers" gnus-article-hide-boring-headers t])
1500 ["All" gnus-article-highlight t]
1501 ["Headers" gnus-article-highlight-headers t]
1502 ["Signature" gnus-article-highlight-signature t]
1503 ["Citation" gnus-article-highlight-citation t])
1505 ["Local" gnus-article-date-local t]
1506 ["UT" gnus-article-date-ut t]
1507 ["Original" gnus-article-date-original t]
1508 ["Lapsed" gnus-article-date-lapsed t]
1509 ["User-defined" gnus-article-date-user t])
1512 ["Leading" gnus-article-strip-leading-blank-lines t]
1513 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1514 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1515 ["All of the above" gnus-article-strip-blank-lines t])
1516 ["Overstrike" gnus-article-treat-overstrike t]
1517 ["Emphasis" gnus-article-emphasize t]
1518 ["Word wrap" gnus-article-fill-cited-article t]
1519 ["CR" gnus-article-remove-cr t]
1520 ["Show X-Face" gnus-article-display-x-face t]
1521 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1522 ["UnHTMLize" gnus-article-treat-html t]
1523 ["Rot 13" gnus-summary-caesar-message t]
1524 ["Unix pipe" gnus-summary-pipe-message t]
1525 ["Add buttons" gnus-article-add-buttons t]
1526 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1527 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1528 ["Toggle MIME" gnus-summary-toggle-mime t]
1529 ["Verbose header" gnus-summary-verbose-headers t]
1530 ["Toggle header" gnus-summary-toggle-header t])
1532 ["Save in default format" gnus-summary-save-article t]
1533 ["Save in file" gnus-summary-save-article-file t]
1534 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1535 ["Write to file" gnus-summary-write-article-mail t]
1536 ["Save in MH folder" gnus-summary-save-article-folder t]
1537 ["Save in VM folder" gnus-summary-save-article-vm t]
1538 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1539 ["Save body in file" gnus-summary-save-article-body-file t]
1540 ["Pipe through a filter" gnus-summary-pipe-output t]
1541 ["Add to SOUP packet" gnus-soup-add-article t]
1542 ["Print" gnus-summary-print-article t])
1544 ["Respool article..." gnus-summary-respool-article t]
1545 ["Move article..." gnus-summary-move-article
1546 (gnus-check-backend-function
1547 'request-move-article gnus-newsgroup-name)]
1548 ["Copy article..." gnus-summary-copy-article t]
1549 ["Crosspost article..." gnus-summary-crosspost-article
1550 (gnus-check-backend-function
1551 'request-replace-article gnus-newsgroup-name)]
1552 ["Import file..." gnus-summary-import-article t]
1553 ["Check if posted" gnus-summary-article-posted-p t]
1554 ["Edit article" gnus-summary-edit-article
1555 (not (gnus-group-read-only-p))]
1556 ["Delete article" gnus-summary-delete-article
1557 (gnus-check-backend-function
1558 'request-expire-articles gnus-newsgroup-name)]
1559 ["Query respool" gnus-summary-respool-query t]
1560 ["Delete expirable articles" gnus-summary-expire-articles-now
1561 (gnus-check-backend-function
1562 'request-expire-articles gnus-newsgroup-name)])
1564 ["Uudecode" gnus-uu-decode-uu t]
1565 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1566 ["Unshar" gnus-uu-decode-unshar t]
1567 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1568 ["Save" gnus-uu-decode-save t]
1569 ["Binhex" gnus-uu-decode-binhex t]
1570 ["Postscript" gnus-uu-decode-postscript t])
1572 ["Enter article" gnus-cache-enter-article t]
1573 ["Remove article" gnus-cache-remove-article t])
1574 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1575 ["Isearch article..." gnus-summary-isearch-article t]
1576 ["Beginning of the article" gnus-summary-beginning-of-article t]
1577 ["End of the article" gnus-summary-end-of-article t]
1578 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1579 ["Fetch referenced articles" gnus-summary-refer-references t]
1580 ["Fetch article with id..." gnus-summary-refer-article t]
1581 ["Redisplay" gnus-summary-show-article t]))
1584 gnus-summary-thread-menu gnus-summary-mode-map ""
1586 ["Toggle threading" gnus-summary-toggle-threads t]
1587 ["Hide threads" gnus-summary-hide-all-threads t]
1588 ["Show threads" gnus-summary-show-all-threads t]
1589 ["Hide thread" gnus-summary-hide-thread t]
1590 ["Show thread" gnus-summary-show-thread t]
1591 ["Go to next thread" gnus-summary-next-thread t]
1592 ["Go to previous thread" gnus-summary-prev-thread t]
1593 ["Go down thread" gnus-summary-down-thread t]
1594 ["Go up thread" gnus-summary-up-thread t]
1595 ["Top of thread" gnus-summary-top-thread t]
1596 ["Mark thread as read" gnus-summary-kill-thread t]
1597 ["Lower thread score" gnus-summary-lower-thread t]
1598 ["Raise thread score" gnus-summary-raise-thread t]
1599 ["Rethread current" gnus-summary-rethread-current t]
1603 gnus-summary-post-menu gnus-summary-mode-map ""
1605 ["Post an article" gnus-summary-post-news t]
1606 ["Followup" gnus-summary-followup t]
1607 ["Followup and yank" gnus-summary-followup-with-original t]
1608 ["Supersede article" gnus-summary-supersede-article t]
1609 ["Cancel article" gnus-summary-cancel-article t]
1610 ["Reply" gnus-summary-reply t]
1611 ["Reply and yank" gnus-summary-reply-with-original t]
1612 ["Wide reply" gnus-summary-wide-reply t]
1613 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1614 ["Mail forward" gnus-summary-mail-forward t]
1615 ["Post forward" gnus-summary-post-forward t]
1616 ["Digest and mail" gnus-uu-digest-mail-forward t]
1617 ["Digest and post" gnus-uu-digest-post-forward t]
1618 ["Resend message" gnus-summary-resend-message t]
1619 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1620 ["Send a mail" gnus-summary-mail-other-window t]
1621 ["Uuencode and post" gnus-uu-post-news t]
1622 ["Followup via news" gnus-summary-followup-to-mail t]
1623 ["Followup via news and yank"
1624 gnus-summary-followup-to-mail-with-original t]
1626 ;;["Send" gnus-summary-send-draft t]
1627 ;;["Send bounced" gnus-resend-bounced-mail t])
1631 gnus-summary-misc-menu gnus-summary-mode-map ""
1634 ["Mark as read" gnus-summary-mark-as-read-forward t]
1635 ["Mark same subject and select"
1636 gnus-summary-kill-same-subject-and-select t]
1637 ["Mark same subject" gnus-summary-kill-same-subject t]
1638 ["Catchup" gnus-summary-catchup t]
1639 ["Catchup all" gnus-summary-catchup-all t]
1640 ["Catchup to here" gnus-summary-catchup-to-here t]
1641 ["Catchup region" gnus-summary-mark-region-as-read t]
1642 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1644 ["Tick" gnus-summary-tick-article-forward t]
1645 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1646 ["Remove marks" gnus-summary-clear-mark-forward t]
1647 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1648 ["Set bookmark" gnus-summary-set-bookmark t]
1649 ["Remove bookmark" gnus-summary-remove-bookmark t])
1651 ["Marks..." gnus-summary-limit-to-marks t]
1652 ["Subject..." gnus-summary-limit-to-subject t]
1653 ["Author..." gnus-summary-limit-to-author t]
1654 ["Age..." gnus-summary-limit-to-age t]
1655 ["Score" gnus-summary-limit-to-score t]
1656 ["Unread" gnus-summary-limit-to-unread t]
1657 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1658 ["Articles" gnus-summary-limit-to-articles t]
1659 ["Pop limit" gnus-summary-pop-limit t]
1660 ["Show dormant" gnus-summary-limit-include-dormant t]
1661 ["Hide childless dormant"
1662 gnus-summary-limit-exclude-childless-dormant t]
1663 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1664 ["Show expunged" gnus-summary-show-all-expunged t])
1666 ["Set mark" gnus-summary-mark-as-processable t]
1667 ["Remove mark" gnus-summary-unmark-as-processable t]
1668 ["Remove all marks" gnus-summary-unmark-all-processable t]
1669 ["Mark above" gnus-uu-mark-over t]
1670 ["Mark series" gnus-uu-mark-series t]
1671 ["Mark region" gnus-uu-mark-region t]
1672 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1673 ["Mark all" gnus-uu-mark-all t]
1674 ["Mark buffer" gnus-uu-mark-buffer t]
1675 ["Mark sparse" gnus-uu-mark-sparse t]
1676 ["Mark thread" gnus-uu-mark-thread t]
1677 ["Unmark thread" gnus-uu-unmark-thread t]
1678 ("Process Mark Sets"
1679 ["Kill" gnus-summary-kill-process-mark t]
1680 ["Yank" gnus-summary-yank-process-mark
1681 gnus-newsgroup-process-stack]
1682 ["Save" gnus-summary-save-process-mark t]))
1684 ["Page forward" gnus-summary-next-page t]
1685 ["Page backward" gnus-summary-prev-page t]
1686 ["Line forward" gnus-summary-scroll-up t])
1688 ["Next unread article" gnus-summary-next-unread-article t]
1689 ["Previous unread article" gnus-summary-prev-unread-article t]
1690 ["Next article" gnus-summary-next-article t]
1691 ["Previous article" gnus-summary-prev-article t]
1692 ["Next unread subject" gnus-summary-next-unread-subject t]
1693 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1694 ["Next article same subject" gnus-summary-next-same-subject t]
1695 ["Previous article same subject" gnus-summary-prev-same-subject t]
1696 ["First unread article" gnus-summary-first-unread-article t]
1697 ["Best unread article" gnus-summary-best-unread-article t]
1698 ["Go to subject number..." gnus-summary-goto-subject t]
1699 ["Go to article number..." gnus-summary-goto-article t]
1700 ["Go to the last article" gnus-summary-goto-last-article t]
1701 ["Pop article off history" gnus-summary-pop-article t])
1703 ["Sort by number" gnus-summary-sort-by-number t]
1704 ["Sort by author" gnus-summary-sort-by-author t]
1705 ["Sort by subject" gnus-summary-sort-by-subject t]
1706 ["Sort by date" gnus-summary-sort-by-date t]
1707 ["Sort by score" gnus-summary-sort-by-score t]
1708 ["Sort by lines" gnus-summary-sort-by-lines t])
1710 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1711 ["Describe group" gnus-summary-describe-group t]
1712 ["Read manual" gnus-info-find-node t])
1714 ["Pick and read" gnus-pick-mode t]
1715 ["Binary" gnus-binary-mode t])
1717 ["Regenerate" gnus-summary-prepare t]
1718 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1719 ["Toggle threading" gnus-summary-toggle-threads t])
1720 ["Filter articles..." gnus-summary-execute-command t]
1721 ["Run command on subjects..." gnus-summary-universal-argument t]
1722 ["Search articles forward..." gnus-summary-search-article-forward t]
1723 ["Search articles backward..." gnus-summary-search-article-backward t]
1724 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1725 ["Expand window" gnus-summary-expand-window t]
1726 ["Expire expirable articles" gnus-summary-expire-articles
1727 (gnus-check-backend-function
1728 'request-expire-articles gnus-newsgroup-name)]
1729 ["Edit local kill file" gnus-summary-edit-local-kill t]
1730 ["Edit main kill file" gnus-summary-edit-global-kill t]
1732 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1733 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1734 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1735 ["Exit group" gnus-summary-exit t]
1736 ["Exit group without updating" gnus-summary-exit-no-update t]
1737 ["Exit and goto next group" gnus-summary-next-group t]
1738 ["Exit and goto prev group" gnus-summary-prev-group t]
1739 ["Reselect group" gnus-summary-reselect-current-group t]
1740 ["Rescan group" gnus-summary-rescan-group t]
1741 ["Update dribble" gnus-summary-save-newsrc t])))
1743 (run-hooks 'gnus-summary-menu-hook)))
1745 (defun gnus-score-set-default (var value)
1746 "A version of set that updates the GNU Emacs menu-bar."
1748 ;; It is the message that forces the active status to be updated.
1751 (defun gnus-make-score-map (type)
1752 "Make a summary score map of type TYPE."
1755 (let ((headers '(("author" "from" string)
1756 ("subject" "subject" string)
1757 ("article body" "body" string)
1758 ("article head" "head" string)
1759 ("xref" "xref" string)
1760 ("lines" "lines" number)
1761 ("followups to author" "followup" string)))
1762 (types '((number ("less than" <)
1765 (string ("substring" s)
1769 (perms '(("temporary" (current-time-string))
1777 (if (eq type 'lower)
1782 (setq header (car headers))
1788 (let ((ts (cdr (assoc (nth 2 header) types)))
1804 'gnus-summary-score-entry
1806 (if (or (string= (nth 1 header)
1808 (string= (nth 1 header)
1811 (list 'gnus-summary-header
1813 (list 'quote (nth 1 (car ts)))
1814 (list 'gnus-score-default nil)
1820 (list (nreverse outp))))
1823 (list (nreverse outt))))
1825 (setq headers (cdr headers)))
1826 (list (nreverse outh))))))))
1830 (defun gnus-summary-mode (&optional group)
1831 "Major mode for reading articles.
1833 All normal editing commands are switched off.
1834 \\<gnus-summary-mode-map>
1835 Each line in this buffer represents one article. To read an
1836 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1837 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1840 You can also post articles and send mail from this buffer. To
1841 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1842 of an article, type `\\[gnus-summary-reply]'.
1844 There are approx. one gazillion commands you can execute in this
1845 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1847 The following commands are available:
1849 \\{gnus-summary-mode-map}"
1851 (when (gnus-visual-p 'summary-menu 'menu)
1852 (gnus-summary-make-menu-bar))
1853 (kill-all-local-variables)
1854 (gnus-summary-make-local-variables)
1855 (gnus-make-thread-indent-array)
1856 (gnus-simplify-mode-line)
1857 (setq major-mode 'gnus-summary-mode)
1858 (setq mode-name "Summary")
1859 (make-local-variable 'minor-mode-alist)
1860 (use-local-map gnus-summary-mode-map)
1861 (buffer-disable-undo (current-buffer))
1862 (setq buffer-read-only t) ;Disable modification
1863 (setq truncate-lines t)
1864 (setq selective-display t)
1865 (setq selective-display-ellipses t) ;Display `...'
1866 (setq buffer-display-table gnus-summary-display-table)
1867 (gnus-set-default-directory)
1868 (setq gnus-newsgroup-name group)
1869 (make-local-variable 'gnus-summary-line-format)
1870 (make-local-variable 'gnus-summary-line-format-spec)
1871 (make-local-variable 'gnus-summary-mark-positions)
1872 (make-local-hook 'post-command-hook)
1873 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1874 (run-hooks 'gnus-summary-mode-hook)
1875 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1876 (gnus-update-summary-mark-positions))
1878 (defun gnus-summary-make-local-variables ()
1879 "Make all the local summary buffer variables."
1880 (let ((locals gnus-summary-local-variables)
1882 (while (setq local (pop locals))
1885 (if (eq (cdr local) 'global)
1886 ;; Copy the global value of the variable.
1887 (setq global (symbol-value (car local)))
1888 ;; Use the value from the list.
1889 (setq global (eval (cdr local))))
1890 (make-local-variable (car local))
1891 (set (car local) global))
1892 ;; Simple nil-valued local variable.
1893 (make-local-variable local)
1896 (defun gnus-summary-clear-local-variables ()
1897 (let ((locals gnus-summary-local-variables))
1899 (if (consp (car locals))
1900 (and (vectorp (caar locals))
1901 (set (caar locals) nil))
1902 (and (vectorp (car locals))
1903 (set (car locals) nil)))
1904 (setq locals (cdr locals)))))
1906 ;; Summary data functions.
1908 (defmacro gnus-data-number (data)
1911 (defmacro gnus-data-set-number (data number)
1912 `(setcar ,data ,number))
1914 (defmacro gnus-data-mark (data)
1917 (defmacro gnus-data-set-mark (data mark)
1918 `(setcar (nthcdr 1 ,data) ,mark))
1920 (defmacro gnus-data-pos (data)
1923 (defmacro gnus-data-set-pos (data pos)
1924 `(setcar (nthcdr 2 ,data) ,pos))
1926 (defmacro gnus-data-header (data)
1929 (defmacro gnus-data-set-header (data header)
1930 `(setf (nth 3 ,data) ,header))
1932 (defmacro gnus-data-level (data)
1935 (defmacro gnus-data-unread-p (data)
1936 `(= (nth 1 ,data) gnus-unread-mark))
1938 (defmacro gnus-data-read-p (data)
1939 `(/= (nth 1 ,data) gnus-unread-mark))
1941 (defmacro gnus-data-pseudo-p (data)
1942 `(consp (nth 3 ,data)))
1944 (defmacro gnus-data-find (number)
1945 `(assq ,number gnus-newsgroup-data))
1947 (defmacro gnus-data-find-list (number &optional data)
1948 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1949 (memq (assq ,number bdata)
1952 (defmacro gnus-data-make (number mark pos header level)
1953 `(list ,number ,mark ,pos ,header ,level))
1955 (defun gnus-data-enter (after-article number mark pos header level offset)
1956 (let ((data (gnus-data-find-list after-article)))
1958 (error "No such article: %d" after-article))
1959 (setcdr data (cons (gnus-data-make number mark pos header level)
1961 (setq gnus-newsgroup-data-reverse nil)
1962 (gnus-data-update-list (cddr data) offset)))
1964 (defun gnus-data-enter-list (after-article list &optional offset)
1966 (let ((data (and after-article (gnus-data-find-list after-article)))
1968 (or data (not after-article) (error "No such article: %d" after-article))
1969 ;; Find the last element in the list to be spliced into the main
1972 (setq list (cdr list)))
1975 (setcdr list gnus-newsgroup-data)
1976 (setq gnus-newsgroup-data ilist)
1978 (gnus-data-update-list (cdr list) offset)))
1979 (setcdr list (cdr data))
1982 (gnus-data-update-list (cdr list) offset)))
1983 (setq gnus-newsgroup-data-reverse nil))))
1985 (defun gnus-data-remove (article &optional offset)
1986 (let ((data gnus-newsgroup-data))
1987 (if (= (gnus-data-number (car data)) article)
1989 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
1990 gnus-newsgroup-data-reverse nil)
1992 (gnus-data-update-list gnus-newsgroup-data offset)))
1994 (when (= (gnus-data-number (cadr data)) article)
1995 (setcdr data (cddr data))
1997 (gnus-data-update-list (cdr data) offset))
1999 gnus-newsgroup-data-reverse nil))
2000 (setq data (cdr data))))))
2002 (defmacro gnus-data-list (backward)
2004 (or gnus-newsgroup-data-reverse
2005 (setq gnus-newsgroup-data-reverse
2006 (reverse gnus-newsgroup-data)))
2007 gnus-newsgroup-data))
2009 (defun gnus-data-update-list (data offset)
2010 "Add OFFSET to the POS of all data entries in DATA."
2012 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2013 (setq data (cdr data))))
2015 (defun gnus-data-compute-positions ()
2016 "Compute the positions of all articles."
2017 (let ((data gnus-newsgroup-data)
2020 (when (setq pos (text-property-any
2021 (point-min) (point-max)
2022 'gnus-number (gnus-data-number (car data))))
2023 (gnus-data-set-pos (car data) (+ pos 3)))
2024 (setq data (cdr data)))))
2026 (defun gnus-summary-article-pseudo-p (article)
2027 "Say whether this article is a pseudo article or not."
2028 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2030 (defmacro gnus-summary-article-sparse-p (article)
2031 "Say whether this article is a sparse article or not."
2032 ` (memq ,article gnus-newsgroup-sparse))
2034 (defmacro gnus-summary-article-ancient-p (article)
2035 "Say whether this article is a sparse article or not."
2036 `(memq ,article gnus-newsgroup-ancient))
2038 (defun gnus-article-parent-p (number)
2039 "Say whether this article is a parent or not."
2040 (let ((data (gnus-data-find-list number)))
2041 (and (cdr data) ; There has to be an article after...
2042 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2043 (gnus-data-level (nth 1 data))))))
2045 (defun gnus-article-children (number)
2046 "Return a list of all children to NUMBER."
2047 (let* ((data (gnus-data-find-list number))
2048 (level (gnus-data-level (car data)))
2050 (setq data (cdr data))
2052 (= (gnus-data-level (car data)) (1+ level)))
2053 (push (gnus-data-number (car data)) children)
2054 (setq data (cdr data)))
2057 (defmacro gnus-summary-skip-intangible ()
2058 "If the current article is intangible, then jump to a different article."
2059 '(let ((to (get-text-property (point) 'gnus-intangible)))
2060 (and to (gnus-summary-goto-subject to))))
2062 (defmacro gnus-summary-article-intangible-p ()
2063 "Say whether this article is intangible or not."
2064 '(get-text-property (point) 'gnus-intangible))
2066 (defun gnus-article-read-p (article)
2067 "Say whether ARTICLE is read or not."
2068 (not (or (memq article gnus-newsgroup-marked)
2069 (memq article gnus-newsgroup-unreads)
2070 (memq article gnus-newsgroup-unselected)
2071 (memq article gnus-newsgroup-dormant))))
2073 ;; Some summary mode macros.
2075 (defmacro gnus-summary-article-number ()
2076 "The article number of the article on the current line.
2077 If there isn's an article number here, then we return the current
2080 (gnus-summary-skip-intangible)
2081 (or (get-text-property (point) 'gnus-number)
2082 (gnus-summary-last-subject))))
2084 (defmacro gnus-summary-article-header (&optional number)
2085 `(gnus-data-header (gnus-data-find
2086 ,(or number '(gnus-summary-article-number)))))
2088 (defmacro gnus-summary-thread-level (&optional number)
2089 `(if (and (eq gnus-summary-make-false-root 'dummy)
2090 (get-text-property (point) 'gnus-intangible))
2092 (gnus-data-level (gnus-data-find
2093 ,(or number '(gnus-summary-article-number))))))
2095 (defmacro gnus-summary-article-mark (&optional number)
2096 `(gnus-data-mark (gnus-data-find
2097 ,(or number '(gnus-summary-article-number)))))
2099 (defmacro gnus-summary-article-pos (&optional number)
2100 `(gnus-data-pos (gnus-data-find
2101 ,(or number '(gnus-summary-article-number)))))
2103 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2104 (defmacro gnus-summary-article-subject (&optional number)
2105 "Return current subject string or nil if nothing."
2108 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2109 '(gnus-data-header (assq (gnus-summary-article-number)
2110 gnus-newsgroup-data)))))
2113 (mail-header-subject headers))))
2115 (defmacro gnus-summary-article-score (&optional number)
2116 "Return current article score."
2117 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2118 gnus-newsgroup-scored))
2119 gnus-summary-default-score 0))
2121 (defun gnus-summary-article-children (&optional number)
2122 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2123 (level (gnus-data-level (car data)))
2125 (while (and (setq data (cdr data))
2126 (> (setq l (gnus-data-level (car data))) level))
2127 (and (= (1+ level) l)
2128 (push (gnus-data-number (car data))
2130 (nreverse children)))
2132 (defun gnus-summary-article-parent (&optional number)
2133 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2134 (gnus-data-list t)))
2135 (level (gnus-data-level (car data))))
2137 () ; This is a root.
2138 ;; We search until we find an article with a level less than
2139 ;; this one. That function has to be the parent.
2140 (while (and (setq data (cdr data))
2141 (not (< (gnus-data-level (car data)) level))))
2142 (and data (gnus-data-number (car data))))))
2144 (defun gnus-unread-mark-p (mark)
2145 "Say whether MARK is the unread mark."
2146 (= mark gnus-unread-mark))
2148 (defun gnus-read-mark-p (mark)
2149 "Say whether MARK is one of the marks that mark as read.
2150 This is all marks except unread, ticked, dormant, and expirable."
2151 (not (or (= mark gnus-unread-mark)
2152 (= mark gnus-ticked-mark)
2153 (= mark gnus-dormant-mark)
2154 (= mark gnus-expirable-mark))))
2156 (defmacro gnus-article-mark (number)
2158 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2159 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2160 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2161 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2162 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2163 gnus-ancient-mark))))
2165 ;; Saving hidden threads.
2167 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2168 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2170 (defmacro gnus-save-hidden-threads (&rest forms)
2171 "Save hidden threads, eval FORMS, and restore the hidden threads."
2172 (let ((config (make-symbol "config")))
2173 `(let ((,config (gnus-hidden-threads-configuration)))
2177 (gnus-restore-hidden-threads-configuration ,config)))))
2179 (defun gnus-hidden-threads-configuration ()
2180 "Return the current hidden threads configuration."
2183 (goto-char (point-min))
2184 (while (search-forward "\r" nil t)
2185 (push (1- (point)) config))
2188 (defun gnus-restore-hidden-threads-configuration (config)
2189 "Restore hidden threads configuration from CONFIG."
2190 (let (point buffer-read-only)
2191 (while (setq point (pop config))
2192 (when (and (< point (point-max))
2194 (= (following-char) ?\n))
2195 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2197 ;; Various summary mode internalish functions.
2199 (defun gnus-mouse-pick-article (e)
2202 (gnus-summary-next-page nil t))
2204 (defun gnus-summary-setup-buffer (group)
2205 "Initialize summary buffer."
2206 (let ((buffer (concat "*Summary " group "*")))
2207 (if (get-buffer buffer)
2210 (setq gnus-summary-buffer (current-buffer))
2211 (not gnus-newsgroup-prepared))
2212 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2213 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2214 (gnus-add-current-to-buffer-list)
2215 (gnus-summary-mode group)
2217 (gnus-carpal-setup-buffer 'summary))
2218 (unless gnus-single-article-buffer
2219 (make-local-variable 'gnus-article-buffer)
2220 (make-local-variable 'gnus-article-current)
2221 (make-local-variable 'gnus-original-article-buffer))
2222 (setq gnus-newsgroup-name group)
2225 (defun gnus-set-global-variables ()
2226 ;; Set the global equivalents of the summary buffer-local variables
2227 ;; to the latest values they had. These reflect the summary buffer
2228 ;; that was in action when the last article was fetched.
2229 (when (eq major-mode 'gnus-summary-mode)
2230 (setq gnus-summary-buffer (current-buffer))
2231 (let ((name gnus-newsgroup-name)
2232 (marked gnus-newsgroup-marked)
2233 (unread gnus-newsgroup-unreads)
2234 (headers gnus-current-headers)
2235 (data gnus-newsgroup-data)
2236 (summary gnus-summary-buffer)
2237 (article-buffer gnus-article-buffer)
2238 (original gnus-original-article-buffer)
2239 (gac gnus-article-current)
2240 (reffed gnus-reffed-article-number)
2241 (score-file gnus-current-score-file))
2243 (set-buffer gnus-group-buffer)
2244 (setq gnus-newsgroup-name name)
2245 (setq gnus-newsgroup-marked marked)
2246 (setq gnus-newsgroup-unreads unread)
2247 (setq gnus-current-headers headers)
2248 (setq gnus-newsgroup-data data)
2249 (setq gnus-article-current gac)
2250 (setq gnus-summary-buffer summary)
2251 (setq gnus-article-buffer article-buffer)
2252 (setq gnus-original-article-buffer original)
2253 (setq gnus-reffed-article-number reffed)
2254 (setq gnus-current-score-file score-file)
2255 ;; The article buffer also has local variables.
2256 (when (gnus-buffer-live-p gnus-article-buffer)
2257 (set-buffer gnus-article-buffer)
2258 (setq gnus-summary-buffer summary))))))
2260 (defun gnus-summary-article-unread-p (article)
2261 "Say whether ARTICLE is unread or not."
2262 (memq article gnus-newsgroup-unreads))
2264 (defun gnus-summary-first-article-p (&optional article)
2265 "Return whether ARTICLE is the first article in the buffer."
2266 (if (not (setq article (or article (gnus-summary-article-number))))
2268 (eq article (caar gnus-newsgroup-data))))
2270 (defun gnus-summary-last-article-p (&optional article)
2271 "Return whether ARTICLE is the last article in the buffer."
2272 (if (not (setq article (or article (gnus-summary-article-number))))
2273 t ; All non-existent numbers are the last article. :-)
2274 (not (cdr (gnus-data-find-list article)))))
2276 (defun gnus-make-thread-indent-array ()
2278 (unless (and gnus-thread-indent-array
2279 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2280 (setq gnus-thread-indent-array (make-vector 201 "")
2281 gnus-thread-indent-array-level gnus-thread-indent-level)
2283 (aset gnus-thread-indent-array n
2284 (make-string (* n gnus-thread-indent-level) ? ))
2287 (defun gnus-update-summary-mark-positions ()
2288 "Compute where the summary marks are to go."
2290 (when (and gnus-summary-buffer
2291 (get-buffer gnus-summary-buffer)
2292 (buffer-name (get-buffer gnus-summary-buffer)))
2293 (set-buffer gnus-summary-buffer))
2294 (let ((gnus-replied-mark 129)
2295 (gnus-score-below-mark 130)
2296 (gnus-score-over-mark 130)
2297 (spec gnus-summary-line-format-spec)
2298 thread gnus-visual pos)
2300 (gnus-set-work-buffer)
2301 (let ((gnus-summary-line-format-spec spec))
2302 (gnus-summary-insert-line
2303 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2304 (goto-char (point-min))
2305 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2307 (goto-char (point-min))
2308 (push (cons 'replied (and (search-forward "\201" nil t)
2311 (goto-char (point-min))
2312 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2314 (setq gnus-summary-mark-positions pos))))
2316 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2317 "Insert a dummy root in the summary buffer."
2319 (gnus-add-text-properties
2320 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2321 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2323 (defun gnus-summary-insert-line (gnus-tmp-header
2324 gnus-tmp-level gnus-tmp-current
2325 gnus-tmp-unread gnus-tmp-replied
2326 gnus-tmp-expirable gnus-tmp-subject-or-nil
2327 &optional gnus-tmp-dummy gnus-tmp-score
2329 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2330 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2331 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2332 (gnus-tmp-score-char
2333 (if (or (null gnus-summary-default-score)
2334 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2335 gnus-summary-zcore-fuzz))
2337 (if (< gnus-tmp-score gnus-summary-default-score)
2338 gnus-score-below-mark gnus-score-over-mark)))
2340 (cond (gnus-tmp-process gnus-process-mark)
2341 ((memq gnus-tmp-current gnus-newsgroup-cached)
2343 (gnus-tmp-replied gnus-replied-mark)
2344 ((memq gnus-tmp-current gnus-newsgroup-saved)
2346 (t gnus-unread-mark)))
2347 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2350 ((string-match "<[^>]+> *$" gnus-tmp-from)
2351 (let ((beg (match-beginning 0)))
2352 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2353 (substring gnus-tmp-from (1+ (match-beginning 0))
2354 (1- (match-end 0))))
2355 (substring gnus-tmp-from 0 beg))))
2356 ((string-match "(.+)" gnus-tmp-from)
2357 (substring gnus-tmp-from
2358 (1+ (match-beginning 0)) (1- (match-end 0))))
2360 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2361 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2362 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2363 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2364 (buffer-read-only nil))
2365 (when (string= gnus-tmp-name "")
2366 (setq gnus-tmp-name gnus-tmp-from))
2367 (unless (numberp gnus-tmp-lines)
2368 (setq gnus-tmp-lines 0))
2369 (gnus-put-text-property
2371 (progn (eval gnus-summary-line-format-spec) (point))
2372 'gnus-number gnus-tmp-number)
2373 (when (gnus-visual-p 'summary-highlight 'highlight)
2375 (run-hooks 'gnus-summary-update-hook)
2378 (defun gnus-summary-update-line (&optional dont-update)
2379 ;; Update summary line after change.
2380 (when (and gnus-summary-default-score
2381 (not gnus-summary-inhibit-highlight))
2382 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2383 (article (gnus-summary-article-number))
2384 (score (gnus-summary-article-score article)))
2386 (if (and gnus-summary-mark-below
2387 (< (gnus-summary-article-score)
2388 gnus-summary-mark-below))
2389 ;; This article has a low score, so we mark it as read.
2390 (when (memq article gnus-newsgroup-unreads)
2391 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2392 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2393 ;; This article was previously marked as read on account
2394 ;; of a low score, but now it has risen, so we mark it as
2396 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2397 (gnus-summary-update-mark
2398 (if (or (null gnus-summary-default-score)
2399 (<= (abs (- score gnus-summary-default-score))
2400 gnus-summary-zcore-fuzz))
2402 (if (< score gnus-summary-default-score)
2403 gnus-score-below-mark gnus-score-over-mark))
2405 ;; Do visual highlighting.
2406 (when (gnus-visual-p 'summary-highlight 'highlight)
2407 (run-hooks 'gnus-summary-update-hook)))))
2409 (defvar gnus-tmp-new-adopts nil)
2411 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2412 "Return the number of articles in THREAD.
2413 This may be 0 in some cases -- if none of the articles in
2414 the thread are to be displayed."
2416 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2418 ((not (listp thread))
2420 ((and (consp thread) (cdr thread))
2423 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2426 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2429 (when (and level (zerop level) gnus-tmp-new-adopts)
2432 'gnus-summary-number-of-articles-in-thread
2433 gnus-tmp-new-adopts))))
2435 (if (> number 1) gnus-not-empty-thread-mark
2436 gnus-empty-thread-mark)
2439 (defun gnus-summary-set-local-parameters (group)
2440 "Go through the local params of GROUP and set all variable specs in that list."
2441 (let ((params (gnus-group-find-parameter group))
2444 (setq elem (car params)
2445 params (cdr params))
2446 (and (consp elem) ; Has to be a cons.
2447 (consp (cdr elem)) ; The cdr has to be a list.
2448 (symbolp (car elem)) ; Has to be a symbol in there.
2449 (not (memq (car elem)
2450 '(quit-config to-address to-list to-group)))
2451 (progn ; So we set it.
2452 (make-local-variable (car elem))
2453 (set (car elem) (eval (nth 1 elem))))))))
2455 (defun gnus-summary-read-group (group &optional show-all no-article
2456 kill-buffer no-display)
2457 "Start reading news in newsgroup GROUP.
2458 If SHOW-ALL is non-nil, already read articles are also listed.
2459 If NO-ARTICLE is non-nil, no article is selected initially.
2460 If NO-DISPLAY, don't generate a summary buffer."
2461 ;; Killed foreign groups can't be entered.
2462 (when (and (not (gnus-group-native-p group))
2463 (not (gnus-gethash group gnus-newsrc-hashtb)))
2464 (error "Dead non-native groups can't be entered"))
2465 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2466 (let* ((new-group (gnus-summary-setup-buffer group))
2467 (quit-config (gnus-group-quit-config group))
2468 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2470 ;; This summary buffer exists already, so we just select it.
2472 (gnus-set-global-variables)
2474 (gnus-kill-or-deaden-summary kill-buffer))
2475 (gnus-configure-windows 'summary 'force)
2476 (gnus-set-mode-line 'summary)
2477 (gnus-summary-position-point)
2480 ;; We couldn't select this group.
2482 (when (and (eq major-mode 'gnus-summary-mode)
2483 (not (equal (current-buffer) kill-buffer)))
2484 (kill-buffer (current-buffer))
2485 (if (not quit-config)
2487 (set-buffer gnus-group-buffer)
2488 (gnus-group-jump-to-group group)
2489 (gnus-group-next-unread-group 1))
2490 (gnus-handle-ephemeral-exit quit-config)))
2491 (gnus-message 3 "Can't select group")
2493 ;; The user did a `C-g' while prompting for number of articles,
2494 ;; so we exit this group.
2495 ((eq did-select 'quit)
2496 (and (eq major-mode 'gnus-summary-mode)
2497 (not (equal (current-buffer) kill-buffer))
2498 (kill-buffer (current-buffer)))
2500 (gnus-kill-or-deaden-summary kill-buffer))
2501 (if (not quit-config)
2503 (set-buffer gnus-group-buffer)
2504 (gnus-group-jump-to-group group)
2505 (gnus-group-next-unread-group 1)
2506 (gnus-configure-windows 'group 'force))
2507 (gnus-handle-ephemeral-exit quit-config))
2508 ;; Finally signal the quit.
2510 ;; The group was successfully selected.
2512 (gnus-set-global-variables)
2513 ;; Save the active value in effect when the group was entered.
2514 (setq gnus-newsgroup-active
2516 (gnus-active gnus-newsgroup-name)))
2517 ;; You can change the summary buffer in some way with this hook.
2518 (run-hooks 'gnus-select-group-hook)
2519 ;; Set any local variables in the group parameters.
2520 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2521 (gnus-update-format-specifications
2522 nil 'summary 'summary-mode 'summary-dummy)
2523 ;; Do score processing.
2524 (when gnus-use-scoring
2525 (gnus-possibly-score-headers))
2526 ;; Check whether to fill in the gaps in the threads.
2527 (when gnus-build-sparse-threads
2528 (gnus-build-sparse-threads))
2529 ;; Find the initial limit.
2530 (if gnus-show-threads
2532 (let ((gnus-newsgroup-dormant nil))
2533 (gnus-summary-initial-limit show-all))
2534 (gnus-summary-initial-limit show-all))
2535 (setq gnus-newsgroup-limit
2537 (lambda (header) (mail-header-number header))
2538 gnus-newsgroup-headers)))
2539 ;; Generate the summary buffer.
2541 (gnus-summary-prepare))
2542 (when gnus-use-trees
2543 (gnus-tree-open group)
2544 (setq gnus-summary-highlight-line-function
2545 'gnus-tree-highlight-article))
2546 ;; If the summary buffer is empty, but there are some low-scored
2547 ;; articles or some excluded dormants, we include these in the
2549 (when (and (zerop (buffer-size))
2551 (cond (gnus-newsgroup-dormant
2552 (gnus-summary-limit-include-dormant))
2553 ((and gnus-newsgroup-scored show-all)
2554 (gnus-summary-limit-include-expunged t))))
2555 ;; Function `gnus-apply-kill-file' must be called in this hook.
2556 (run-hooks 'gnus-apply-kill-hook)
2557 (if (and (zerop (buffer-size))
2560 ;; This newsgroup is empty.
2561 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2562 (gnus-message 6 "No unread news")
2564 (gnus-kill-or-deaden-summary kill-buffer))
2565 ;; Return nil from this function.
2567 ;; Hide conversation thread subtrees. We cannot do this in
2568 ;; gnus-summary-prepare-hook since kill processing may not
2569 ;; work with hidden articles.
2570 (and gnus-show-threads
2571 gnus-thread-hide-subtree
2572 (gnus-summary-hide-all-threads))
2573 ;; Show first unread article if requested.
2574 (if (and (not no-article)
2576 gnus-newsgroup-unreads
2577 gnus-auto-select-first)
2578 (unless (if (eq gnus-auto-select-first 'best)
2579 (gnus-summary-best-unread-article)
2580 (gnus-summary-first-unread-article))
2581 (gnus-configure-windows 'summary))
2582 ;; Don't select any articles, just move point to the first
2583 ;; article in the group.
2584 (goto-char (point-min))
2585 (gnus-summary-position-point)
2586 (gnus-set-mode-line 'summary)
2587 (gnus-configure-windows 'summary 'force))
2589 (gnus-kill-or-deaden-summary kill-buffer))
2590 (when (get-buffer-window gnus-group-buffer t)
2591 ;; Gotta use windows, because recenter does weird stuff if
2592 ;; the current buffer ain't the displayed window.
2593 (let ((owin (selected-window)))
2594 (select-window (get-buffer-window gnus-group-buffer t))
2595 (when (gnus-group-goto-group group)
2597 (select-window owin))))
2598 ;; Mark this buffer as "prepared".
2599 (setq gnus-newsgroup-prepared t)
2602 (defun gnus-summary-prepare ()
2603 "Generate the summary buffer."
2605 (let ((buffer-read-only nil))
2607 (setq gnus-newsgroup-data nil
2608 gnus-newsgroup-data-reverse nil)
2609 (run-hooks 'gnus-summary-generate-hook)
2610 ;; Generate the buffer, either with threads or without.
2611 (when gnus-newsgroup-headers
2612 (gnus-summary-prepare-threads
2613 (if gnus-show-threads
2614 (gnus-sort-gathered-threads
2615 (funcall gnus-summary-thread-gathering-function
2617 (gnus-cut-threads (gnus-make-threads)))))
2618 ;; Unthreaded display.
2619 (gnus-sort-articles gnus-newsgroup-headers))))
2620 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2621 ;; Call hooks for modifying summary buffer.
2622 (goto-char (point-min))
2623 (run-hooks 'gnus-summary-prepare-hook)))
2625 (defsubst gnus-general-simplify-subject (subject)
2626 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2629 ;; Truncate the subject.
2630 ((numberp gnus-summary-gather-subject-limit)
2631 (setq subject (gnus-simplify-subject-re subject))
2632 (if (> (length subject) gnus-summary-gather-subject-limit)
2633 (substring subject 0 gnus-summary-gather-subject-limit)
2635 ;; Fuzzily simplify it.
2636 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2637 (gnus-simplify-subject-fuzzy subject))
2638 ;; Just remove the leading "Re:".
2640 (gnus-simplify-subject-re subject))))
2642 (if (and gnus-summary-gather-exclude-subject
2643 (string-match gnus-summary-gather-exclude-subject subject))
2644 nil ; This article shouldn't be gathered
2647 (defun gnus-summary-simplify-subject-query ()
2648 "Query where the respool algorithm would put this article."
2650 (gnus-set-global-variables)
2651 (gnus-summary-select-article)
2652 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2654 (defun gnus-gather-threads-by-subject (threads)
2655 "Gather threads by looking at Subject headers."
2656 (if (not gnus-summary-make-false-root)
2658 (let ((hashtb (gnus-make-hashtable 1024))
2661 subject hthread whole-subject)
2663 (setq subject (gnus-general-simplify-subject
2664 (setq whole-subject (mail-header-subject
2667 (if (setq hthread (gnus-gethash subject hashtb))
2669 ;; We enter a dummy root into the thread, if we
2670 ;; haven't done that already.
2671 (unless (stringp (caar hthread))
2672 (setcar hthread (list whole-subject (car hthread))))
2673 ;; We add this new gathered thread to this gathered
2675 (setcdr (car hthread)
2676 (nconc (cdar hthread) (list (car threads))))
2677 ;; Remove it from the list of threads.
2678 (setcdr prev (cdr threads))
2679 (setq threads prev))
2680 ;; Enter this thread into the hash table.
2681 (gnus-sethash subject threads hashtb)))
2683 (setq threads (cdr threads)))
2686 (defun gnus-gather-threads-by-references (threads)
2687 "Gather threads by looking at References headers."
2688 (let ((idhashtb (gnus-make-hashtable 1024))
2689 (thhashtb (gnus-make-hashtable 1024))
2692 ids references id gthread gid entered ref)
2694 (when (setq references (mail-header-references (caar threads)))
2695 (setq id (mail-header-id (caar threads))
2696 ids (gnus-split-references references)
2698 (while (setq ref (pop ids))
2699 (setq ids (delete ref ids))
2700 (if (not (setq gid (gnus-gethash ref idhashtb)))
2702 (gnus-sethash ref id idhashtb)
2703 (gnus-sethash id threads thhashtb))
2704 (setq gthread (gnus-gethash gid thhashtb))
2706 ;; We enter a dummy root into the thread, if we
2707 ;; haven't done that already.
2708 (unless (stringp (caar gthread))
2709 (setcar gthread (list (mail-header-subject (caar gthread))
2711 ;; We add this new gathered thread to this gathered
2713 (setcdr (car gthread)
2714 (nconc (cdar gthread) (list (car threads)))))
2715 ;; Add it into the thread hash table.
2716 (gnus-sethash id gthread thhashtb)
2718 ;; Remove it from the list of threads.
2719 (setcdr prev (cdr threads))
2720 (setq threads prev))))
2722 (setq threads (cdr threads)))
2725 (defun gnus-sort-gathered-threads (threads)
2726 "Sort subtreads inside each gathered thread by article number."
2727 (let ((result threads))
2729 (when (stringp (caar threads))
2730 (setcdr (car threads)
2731 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2732 (setq threads (cdr threads)))
2735 (defun gnus-thread-loop-p (root thread)
2736 "Say whether ROOT is in THREAD."
2737 (let ((th (cdr thread)))
2739 (not (eq (caar th) root)))
2742 ;; We have found a loop.
2744 (setcdr thread (delq (car th) (cdr thread)))
2745 (if (boundp (setq ref-dep (intern "none"
2746 gnus-newsgroup-dependencies)))
2747 (setcdr (symbol-value ref-dep)
2748 (nconc (cdr (symbol-value ref-dep))
2750 (set ref-dep (list nil (car th))))
2752 ;; Recurse down into the sub-threads and look for loops.
2755 (lambda (thread) (gnus-thread-loop-p root thread))
2758 (defun gnus-make-threads ()
2759 "Go through the dependency hashtb and find the roots. Return all threads."
2761 (while (catch 'infloop
2764 ;; Deal with self-referencing References loops.
2765 (when (and (car (symbol-value refs))
2772 (car (symbol-value refs)) thread))
2773 (cdr (symbol-value refs)))))))
2776 (unless (car (symbol-value refs))
2777 ;; These threads do not refer back to any other articles,
2778 ;; so they're roots.
2779 (setq threads (append (cdr (symbol-value refs)) threads))))
2780 gnus-newsgroup-dependencies)))
2783 (defun gnus-build-sparse-threads ()
2784 (let ((headers gnus-newsgroup-headers)
2785 (deps gnus-newsgroup-dependencies)
2786 header references generation relations
2787 cthread subject child end pthread relation)
2788 ;; First we create an alist of generations/relations, where
2789 ;; generations is how much we trust the relation, and the relation
2791 (gnus-message 7 "Making sparse threads...")
2793 (nnheader-set-temp-buffer " *gnus sparse threads*")
2794 (while (setq header (pop headers))
2795 (when (and (setq references (mail-header-references header))
2796 (not (string= references "")))
2798 (setq child (mail-header-id header)
2799 subject (mail-header-subject header))
2801 (while (search-backward ">" nil t)
2802 (setq end (1+ (point)))
2803 (when (search-backward "<" nil t)
2804 (push (list (incf generation)
2805 child (setq child (buffer-substring (point) end))
2808 (push (list (1+ generation) child nil subject) relations)
2810 (kill-buffer (current-buffer)))
2811 ;; Sort over trustworthiness.
2812 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
2813 (while (setq relation (pop relations))
2814 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
2815 (unless (car (symbol-value cthread))
2816 ;; Make this article the parent of these threads.
2817 (setcar (symbol-value cthread)
2818 (vector gnus-reffed-article-number
2822 (or (caddr relation) "") 0 0 "")))
2823 (set cthread (list (vector gnus-reffed-article-number
2825 "" "" (cadr relation)
2826 (or (caddr relation) "") 0 0 ""))))
2827 (push gnus-reffed-article-number gnus-newsgroup-limit)
2828 (push gnus-reffed-article-number gnus-newsgroup-sparse)
2829 (push (cons gnus-reffed-article-number gnus-sparse-mark)
2830 gnus-newsgroup-reads)
2831 (decf gnus-reffed-article-number)
2832 ;; Make this new thread the child of its parent.
2833 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
2834 (setcdr (symbol-value pthread)
2835 (nconc (cdr (symbol-value pthread))
2836 (list (symbol-value cthread))))
2837 (set pthread (list nil (symbol-value cthread))))))
2838 (gnus-message 7 "Making sparse threads...done")))
2840 (defun gnus-build-old-threads ()
2841 ;; Look at all the articles that refer back to old articles, and
2842 ;; fetch the headers for the articles that aren't there. This will
2843 ;; build complete threads - if the roots haven't been expired by the
2848 (when (not (car (symbol-value refs)))
2849 (setq heads (cdr (symbol-value refs)))
2851 (if (memq (mail-header-number (caar heads))
2852 gnus-newsgroup-dormant)
2853 (setq heads (cdr heads))
2854 (setq id (symbol-name refs))
2855 (while (and (setq id (gnus-build-get-header id))
2856 (not (car (gnus-gethash
2857 id gnus-newsgroup-dependencies)))))
2858 (setq heads nil)))))
2859 gnus-newsgroup-dependencies)))
2861 (defun gnus-build-get-header (id)
2862 ;; Look through the buffer of NOV lines and find the header to
2863 ;; ID. Enter this line into the dependencies hash table, and return
2864 ;; the id of the parent article (if any).
2865 (let ((deps gnus-newsgroup-dependencies)
2869 (set-buffer nntp-server-buffer)
2870 (goto-char (point-min))
2871 (while (and (not found) (search-forward id nil t))
2873 (setq found (looking-at
2874 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
2875 (regexp-quote id))))
2876 (or found (beginning-of-line 2)))
2880 (setq header (gnus-nov-parse-line
2881 (read (current-buffer)) deps))
2882 (gnus-parent-id (mail-header-references header)))))
2884 (let ((number (mail-header-number header)))
2885 (push number gnus-newsgroup-limit)
2886 (push header gnus-newsgroup-headers)
2887 (if (memq number gnus-newsgroup-unselected)
2889 (push number gnus-newsgroup-unreads)
2890 (setq gnus-newsgroup-unselected
2891 (delq number gnus-newsgroup-unselected)))
2892 (push number gnus-newsgroup-ancient)))))))
2894 (defun gnus-summary-update-article-line (article header)
2895 "Update the line for ARTICLE using HEADERS."
2896 (let* ((id (mail-header-id header))
2897 (thread (gnus-id-to-thread id)))
2899 (error "Article in no thread"))
2900 ;; Update the thread.
2901 (setcar thread header)
2902 (gnus-summary-goto-subject article)
2903 (let* ((datal (gnus-data-find-list article))
2905 (length (when (cdr datal)
2906 (- (gnus-data-pos data)
2907 (gnus-data-pos (cadr datal)))))
2908 (buffer-read-only nil)
2909 (level (gnus-summary-thread-level)))
2911 (gnus-summary-insert-line
2912 header level nil (gnus-article-mark article)
2913 (memq article gnus-newsgroup-replied)
2914 (memq article gnus-newsgroup-expirable)
2915 ;; Only insert the Subject string when it's different
2916 ;; from the previous Subject string.
2917 (unless (gnus-subject-equal
2919 (mail-header-subject
2922 (gnus-data-find-list
2924 (gnus-data-list t)))))
2926 (mail-header-subject header))
2927 (mail-header-subject header))
2928 nil (cdr (assq article gnus-newsgroup-scored))
2929 (memq article gnus-newsgroup-processable))
2931 (gnus-data-update-list
2932 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
2934 (defun gnus-summary-update-article (article &optional iheader)
2935 "Update ARTICLE in the summary buffer."
2936 (set-buffer gnus-summary-buffer)
2937 (let* ((header (or iheader (gnus-summary-article-header article)))
2938 (id (mail-header-id header))
2939 (data (gnus-data-find article))
2940 (thread (gnus-id-to-thread id))
2941 (references (mail-header-references header))
2945 (when (and references
2946 (not (equal "" references)))
2949 (buffer-read-only nil)
2951 (number (mail-header-number header))
2954 ;; !!! Should this be in or not?
2956 (setcar thread nil))
2958 (delq thread parent))
2959 (if (gnus-summary-insert-subject id header iheader)
2960 ;; Set the (possibly) new article number in the data structure.
2961 (gnus-data-set-number data (gnus-id-to-article id))
2965 (defun gnus-rebuild-thread (id)
2966 "Rebuild the thread containing ID."
2967 (let ((buffer-read-only nil)
2968 old-pos current thread data)
2969 (if (not gnus-show-threads)
2970 (setq thread (list (car (gnus-id-to-thread id))))
2971 ;; Get the thread this article is part of.
2972 (setq thread (gnus-remove-thread id)))
2973 (setq old-pos (gnus-point-at-bol))
2974 (setq current (save-excursion
2975 (and (zerop (forward-line -1))
2976 (gnus-summary-article-number))))
2977 ;; If this is a gathered thread, we have to go some re-gathering.
2978 (when (stringp (car thread))
2979 (let ((subject (car thread))
2981 (setq thread (cdr thread))
2983 (unless (memq (setq thr (gnus-id-to-thread
2985 (mail-header-id (caar thread)))))
2988 (setq thread (cdr thread)))
2989 ;; We now have all (unique) roots.
2990 (if (= (length roots) 1)
2991 ;; All the loose roots are now one solid root.
2992 (setq thread (car roots))
2993 (setq thread (cons subject (gnus-sort-threads roots))))))
2995 ;; We then insert this thread into the summary buffer.
2996 (let (gnus-newsgroup-data gnus-newsgroup-threads)
2997 (if gnus-show-threads
2998 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
2999 (gnus-summary-prepare-unthreaded thread))
3000 (setq data (nreverse gnus-newsgroup-data))
3001 (setq threads gnus-newsgroup-threads))
3002 ;; We splice the new data into the data structure.
3003 (gnus-data-enter-list current data (- (point) old-pos))
3004 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3006 (defun gnus-number-to-header (number)
3007 "Return the header for article NUMBER."
3008 (let ((headers gnus-newsgroup-headers))
3010 (not (= number (mail-header-number (car headers)))))
3015 (defun gnus-parent-headers (headers &optional generation)
3016 "Return the headers of the GENERATIONeth parent of HEADERS."
3018 (setq generation 1))
3019 (let (references parent)
3020 (while (and headers (not (zerop generation)))
3021 (setq references (mail-header-references headers))
3022 (when (and references
3023 (setq parent (gnus-parent-id references))
3024 (setq headers (car (gnus-id-to-thread parent))))
3028 (defun gnus-id-to-thread (id)
3029 "Return the (sub-)thread where ID appears."
3030 (gnus-gethash id gnus-newsgroup-dependencies))
3032 (defun gnus-id-to-article (id)
3033 "Return the article number of ID."
3034 (let ((thread (gnus-id-to-thread id)))
3037 (mail-header-number (car thread)))))
3039 (defun gnus-id-to-header (id)
3040 "Return the article headers of ID."
3041 (car (gnus-id-to-thread id)))
3043 (defun gnus-article-displayed-root-p (article)
3044 "Say whether ARTICLE is a root(ish) article."
3045 (let ((level (gnus-summary-thread-level article))
3046 (refs (mail-header-references (gnus-summary-article-header article)))
3052 ((null (gnus-parent-id refs)) t)
3054 (null (setq particle (gnus-id-to-article
3055 (gnus-parent-id refs))))
3056 (null (gnus-summary-thread-level particle)))))))
3058 (defun gnus-root-id (id)
3059 "Return the id of the root of the thread where ID appears."
3061 (while (and id (setq prev (car (gnus-gethash
3062 id gnus-newsgroup-dependencies))))
3064 id (gnus-parent-id (mail-header-references prev))))
3067 (defun gnus-remove-thread (id &optional dont-remove)
3068 "Remove the thread that has ID in it."
3069 (let ((dep gnus-newsgroup-dependencies)
3070 headers thread last-id)
3071 ;; First go up in this thread until we find the root.
3072 (setq last-id (gnus-root-id id))
3073 (setq headers (list (car (gnus-id-to-thread last-id))
3074 (caadr (gnus-id-to-thread last-id))))
3075 ;; We have now found the real root of this thread. It might have
3076 ;; been gathered into some loose thread, so we have to search
3077 ;; through the threads to find the thread we wanted.
3078 (let ((threads gnus-newsgroup-threads)
3081 (setq sub (car threads))
3082 (if (stringp (car sub))
3083 ;; This is a gathered thread, so we look at the roots
3084 ;; below it to find whether this article is in this
3087 (setq sub (cdr sub))
3089 (when (member (caar sub) headers)
3090 (setq thread (car threads)
3093 (setq sub (cdr sub))))
3094 ;; It's an ordinary thread, so we check it.
3095 (when (eq (car sub) (car headers))
3098 (setq threads (cdr threads)))
3099 ;; If this article is in no thread, then it's a root.
3102 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3103 (setq thread (gnus-gethash last-id dep)))
3106 thread ; We return this thread.
3108 (if (stringp (car thread))
3110 ;; If we use dummy roots, then we have to remove the
3111 ;; dummy root as well.
3112 (when (eq gnus-summary-make-false-root 'dummy)
3114 (gnus-data-compute-positions))
3115 (setq thread (cdr thread))
3117 (gnus-remove-thread-1 (car thread))
3118 (setq thread (cdr thread))))
3119 (gnus-remove-thread-1 thread))))))))
3121 (defun gnus-remove-thread-1 (thread)
3122 "Remove the thread THREAD recursively."
3123 (let ((number (mail-header-number (pop thread)))
3125 (setq thread (reverse thread))
3127 (gnus-remove-thread-1 (pop thread)))
3128 (when (setq d (gnus-data-find number))
3129 (goto-char (gnus-data-pos d))
3132 (- (gnus-point-at-bol)
3134 (1+ (gnus-point-at-eol))
3135 (gnus-delete-line)))))))
3137 (defun gnus-sort-threads (threads)
3139 (if (not gnus-thread-sort-functions)
3141 (gnus-message 7 "Sorting threads...")
3143 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3144 (gnus-message 7 "Sorting threads...done"))))
3146 (defun gnus-sort-articles (articles)
3148 (when gnus-article-sort-functions
3149 (gnus-message 7 "Sorting articles...")
3151 (setq gnus-newsgroup-headers
3152 (sort articles (gnus-make-sort-function
3153 gnus-article-sort-functions)))
3154 (gnus-message 7 "Sorting articles...done"))))
3156 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3157 (defmacro gnus-thread-header (thread)
3158 ;; Return header of first article in THREAD.
3159 ;; Note that THREAD must never, ever be anything else than a variable -
3160 ;; using some other form will lead to serious barfage.
3161 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3162 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3163 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3166 (defsubst gnus-article-sort-by-number (h1 h2)
3167 "Sort articles by article number."
3168 (< (mail-header-number h1)
3169 (mail-header-number h2)))
3171 (defun gnus-thread-sort-by-number (h1 h2)
3172 "Sort threads by root article number."
3173 (gnus-article-sort-by-number
3174 (gnus-thread-header h1) (gnus-thread-header h2)))
3176 (defsubst gnus-article-sort-by-lines (h1 h2)
3177 "Sort articles by article Lines header."
3178 (< (mail-header-lines h1)
3179 (mail-header-lines h2)))
3181 (defun gnus-thread-sort-by-lines (h1 h2)
3182 "Sort threads by root article Lines header."
3183 (gnus-article-sort-by-lines
3184 (gnus-thread-header h1) (gnus-thread-header h2)))
3186 (defsubst gnus-article-sort-by-author (h1 h2)
3187 "Sort articles by root author."
3189 (let ((extract (funcall
3190 gnus-extract-address-components
3191 (mail-header-from h1))))
3192 (or (car extract) (cdr extract)))
3193 (let ((extract (funcall
3194 gnus-extract-address-components
3195 (mail-header-from h2))))
3196 (or (car extract) (cdr extract)))))
3198 (defun gnus-thread-sort-by-author (h1 h2)
3199 "Sort threads by root author."
3200 (gnus-article-sort-by-author
3201 (gnus-thread-header h1) (gnus-thread-header h2)))
3203 (defsubst gnus-article-sort-by-subject (h1 h2)
3204 "Sort articles by root subject."
3206 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3207 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3209 (defun gnus-thread-sort-by-subject (h1 h2)
3210 "Sort threads by root subject."
3211 (gnus-article-sort-by-subject
3212 (gnus-thread-header h1) (gnus-thread-header h2)))
3214 (defsubst gnus-article-sort-by-date (h1 h2)
3215 "Sort articles by root article date."
3217 (gnus-date-get-time (mail-header-date h1))
3218 (gnus-date-get-time (mail-header-date h2))))
3220 (defun gnus-thread-sort-by-date (h1 h2)
3221 "Sort threads by root article date."
3222 (gnus-article-sort-by-date
3223 (gnus-thread-header h1) (gnus-thread-header h2)))
3225 (defsubst gnus-article-sort-by-score (h1 h2)
3226 "Sort articles by root article score.
3227 Unscored articles will be counted as having a score of zero."
3228 (> (or (cdr (assq (mail-header-number h1)
3229 gnus-newsgroup-scored))
3230 gnus-summary-default-score 0)
3231 (or (cdr (assq (mail-header-number h2)
3232 gnus-newsgroup-scored))
3233 gnus-summary-default-score 0)))
3235 (defun gnus-thread-sort-by-score (h1 h2)
3236 "Sort threads by root article score."
3237 (gnus-article-sort-by-score
3238 (gnus-thread-header h1) (gnus-thread-header h2)))
3240 (defun gnus-thread-sort-by-total-score (h1 h2)
3241 "Sort threads by the sum of all scores in the thread.
3242 Unscored articles will be counted as having a score of zero."
3243 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3245 (defun gnus-thread-total-score (thread)
3246 ;; This function find the total score of THREAD.
3247 (cond ((null thread)
3250 (if (stringp (car thread))
3251 (apply gnus-thread-score-function 0
3252 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3253 (gnus-thread-total-score-1 thread)))
3255 (gnus-thread-total-score-1 (list thread)))))
3257 (defun gnus-thread-total-score-1 (root)
3258 ;; This function find the total score of the thread below ROOT.
3259 (setq root (car root))
3260 (apply gnus-thread-score-function
3262 (mapcar 'gnus-thread-total-score
3263 (cdr (gnus-gethash (mail-header-id root)
3264 gnus-newsgroup-dependencies)))
3265 (when (> (mail-header-number root) 0)
3266 (list (or (cdr (assq (mail-header-number root)
3267 gnus-newsgroup-scored))
3268 gnus-summary-default-score 0))))
3269 (list gnus-summary-default-score)
3272 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3273 (defvar gnus-tmp-prev-subject nil)
3274 (defvar gnus-tmp-false-parent nil)
3275 (defvar gnus-tmp-root-expunged nil)
3276 (defvar gnus-tmp-dummy-line nil)
3278 (defun gnus-summary-prepare-threads (threads)
3279 "Prepare summary buffer from THREADS and indentation LEVEL.
3280 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3281 or a straight list of headers."
3282 (gnus-message 7 "Generating summary...")
3284 (setq gnus-newsgroup-threads threads)
3287 (let ((gnus-tmp-level 0)
3288 (default-score (or gnus-summary-default-score 0))
3289 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3290 thread number subject stack state gnus-tmp-gathered beg-match
3291 new-roots gnus-tmp-new-adopts thread-end
3292 gnus-tmp-header gnus-tmp-unread
3293 gnus-tmp-replied gnus-tmp-subject-or-nil
3294 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3295 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3296 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3298 (setq gnus-tmp-prev-subject nil)
3300 (if (vectorp (car threads))
3301 ;; If this is a straight (sic) list of headers, then a
3302 ;; threaded summary display isn't required, so we just create
3303 ;; an unthreaded one.
3304 (gnus-summary-prepare-unthreaded threads)
3306 ;; Do the threaded display.
3308 (while (or threads stack gnus-tmp-new-adopts new-roots)
3310 (if (and (= gnus-tmp-level 0)
3311 (not (setq gnus-tmp-dummy-line nil))
3314 (not gnus-tmp-false-parent)
3315 (or gnus-tmp-new-adopts new-roots))
3316 (if gnus-tmp-new-adopts
3317 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3318 thread (list (car gnus-tmp-new-adopts))
3319 gnus-tmp-header (caar thread)
3320 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3322 (setq thread (list (car new-roots))
3323 gnus-tmp-header (caar thread)
3324 new-roots (cdr new-roots))))
3327 ;; If there are some threads, we do them before the
3328 ;; threads on the stack.
3329 (setq thread threads
3330 gnus-tmp-header (caar thread))
3331 ;; There were no current threads, so we pop something off
3333 (setq state (car stack)
3334 gnus-tmp-level (car state)
3337 gnus-tmp-header (caar thread))))
3339 (setq gnus-tmp-false-parent nil)
3340 (setq gnus-tmp-root-expunged nil)
3341 (setq thread-end nil)
3343 (if (stringp gnus-tmp-header)
3344 ;; The header is a dummy root.
3346 ((eq gnus-summary-make-false-root 'adopt)
3347 ;; We let the first article adopt the rest.
3348 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3350 (setq gnus-tmp-gathered
3352 (lambda (h) (mail-header-number (car h)))
3355 (setq thread (cons (list (caar thread)
3358 (setq gnus-tmp-level -1
3359 gnus-tmp-false-parent t))
3360 ((eq gnus-summary-make-false-root 'empty)
3361 ;; We print adopted articles with empty subject fields.
3362 (setq gnus-tmp-gathered
3364 (lambda (h) (mail-header-number (car h)))
3367 (setq gnus-tmp-level -1))
3368 ((eq gnus-summary-make-false-root 'dummy)
3369 ;; We remember that we probably want to output a dummy
3371 (setq gnus-tmp-dummy-line gnus-tmp-header)
3372 (setq gnus-tmp-prev-subject gnus-tmp-header))
3374 ;; We do not make a root for the gathered
3375 ;; sub-threads at all.
3376 (setq gnus-tmp-level -1)))
3378 (setq number (mail-header-number gnus-tmp-header)
3379 subject (mail-header-subject gnus-tmp-header))
3382 ;; If the thread has changed subject, we might want to make
3383 ;; this subthread into a root.
3384 ((and (null gnus-thread-ignore-subject)
3385 (not (zerop gnus-tmp-level))
3386 gnus-tmp-prev-subject
3388 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3389 (setq new-roots (nconc new-roots (list (car thread)))
3391 gnus-tmp-header nil))
3392 ;; If the article lies outside the current limit,
3393 ;; then we do not display it.
3394 ((not (memq number gnus-newsgroup-limit))
3395 (setq gnus-tmp-gathered
3397 (lambda (h) (mail-header-number (car h)))
3400 (setq gnus-tmp-new-adopts (if (cdar thread)
3401 (append gnus-tmp-new-adopts
3403 gnus-tmp-new-adopts)
3405 gnus-tmp-header nil)
3406 (when (zerop gnus-tmp-level)
3407 (setq gnus-tmp-root-expunged t)))
3408 ;; Perhaps this article is to be marked as read?
3409 ((and gnus-summary-mark-below
3410 (< (or (cdr (assq number gnus-newsgroup-scored))
3412 gnus-summary-mark-below)
3413 ;; Don't touch sparse articles.
3414 (not (gnus-summary-article-sparse-p number))
3415 (not (gnus-summary-article-ancient-p number)))
3416 (setq gnus-newsgroup-unreads
3417 (delq number gnus-newsgroup-unreads))
3418 (if gnus-newsgroup-auto-expire
3419 (push number gnus-newsgroup-expirable)
3420 (push (cons number gnus-low-score-mark)
3421 gnus-newsgroup-reads))))
3423 (when gnus-tmp-header
3424 ;; We may have an old dummy line to output before this
3426 (when gnus-tmp-dummy-line
3427 (gnus-summary-insert-dummy-line
3428 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3429 (setq gnus-tmp-dummy-line nil))
3431 ;; Compute the mark.
3432 (setq gnus-tmp-unread (gnus-article-mark number))
3434 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3435 gnus-tmp-header gnus-tmp-level)
3436 gnus-newsgroup-data)
3438 ;; Actually insert the line.
3440 gnus-tmp-subject-or-nil
3442 ((and gnus-thread-ignore-subject
3443 gnus-tmp-prev-subject
3444 (not (inline (gnus-subject-equal
3445 gnus-tmp-prev-subject subject))))
3447 ((zerop gnus-tmp-level)
3448 (if (and (eq gnus-summary-make-false-root 'empty)
3449 (memq number gnus-tmp-gathered)
3450 gnus-tmp-prev-subject
3451 (inline (gnus-subject-equal
3452 gnus-tmp-prev-subject subject)))
3453 gnus-summary-same-subject
3455 (t gnus-summary-same-subject)))
3456 (if (and (eq gnus-summary-make-false-root 'adopt)
3457 (= gnus-tmp-level 1)
3458 (memq number gnus-tmp-gathered))
3459 (setq gnus-tmp-opening-bracket ?\<
3460 gnus-tmp-closing-bracket ?\>)
3461 (setq gnus-tmp-opening-bracket ?\[
3462 gnus-tmp-closing-bracket ?\]))
3464 gnus-tmp-indentation
3465 (aref gnus-thread-indent-array gnus-tmp-level)
3466 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3467 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3468 gnus-summary-default-score 0)
3470 (if (or (null gnus-summary-default-score)
3471 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3472 gnus-summary-zcore-fuzz))
3474 (if (< gnus-tmp-score gnus-summary-default-score)
3475 gnus-score-below-mark gnus-score-over-mark))
3477 (cond ((memq number gnus-newsgroup-processable)
3479 ((memq number gnus-newsgroup-cached)
3481 ((memq number gnus-newsgroup-replied)
3483 ((memq number gnus-newsgroup-saved)
3485 (t gnus-unread-mark))
3486 gnus-tmp-from (mail-header-from gnus-tmp-header)
3489 ((string-match "<[^>]+> *$" gnus-tmp-from)
3490 (setq beg-match (match-beginning 0))
3491 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3492 (substring gnus-tmp-from (1+ (match-beginning 0))
3493 (1- (match-end 0))))
3494 (substring gnus-tmp-from 0 beg-match)))
3495 ((string-match "(.+)" gnus-tmp-from)
3496 (substring gnus-tmp-from
3497 (1+ (match-beginning 0)) (1- (match-end 0))))
3499 (when (string= gnus-tmp-name "")
3500 (setq gnus-tmp-name gnus-tmp-from))
3501 (unless (numberp gnus-tmp-lines)
3502 (setq gnus-tmp-lines 0))
3503 (gnus-put-text-property
3505 (progn (eval gnus-summary-line-format-spec) (point))
3506 'gnus-number number)
3509 (run-hooks 'gnus-summary-update-hook)
3512 (setq gnus-tmp-prev-subject subject)))
3514 (when (nth 1 thread)
3515 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3516 (incf gnus-tmp-level)
3517 (setq threads (if thread-end nil (cdar thread)))
3519 (setq gnus-tmp-level 0)))))
3520 (gnus-message 7 "Generating summary...done"))
3522 (defun gnus-summary-prepare-unthreaded (headers)
3523 "Generate an unthreaded summary buffer based on HEADERS."
3524 (let (header number mark)
3529 ;; We may have to root out some bad articles...
3530 (when (memq (setq number (mail-header-number
3531 (setq header (pop headers))))
3532 gnus-newsgroup-limit)
3533 ;; Mark article as read when it has a low score.
3534 (when (and gnus-summary-mark-below
3535 (< (or (cdr (assq number gnus-newsgroup-scored))
3536 gnus-summary-default-score 0)
3537 gnus-summary-mark-below)
3538 (not (gnus-summary-article-ancient-p number)))
3539 (setq gnus-newsgroup-unreads
3540 (delq number gnus-newsgroup-unreads))
3541 (if gnus-newsgroup-auto-expire
3542 (push number gnus-newsgroup-expirable)
3543 (push (cons number gnus-low-score-mark)
3544 gnus-newsgroup-reads)))
3546 (setq mark (gnus-article-mark number))
3547 (push (gnus-data-make number mark (1+ (point)) header 0)
3548 gnus-newsgroup-data)
3549 (gnus-summary-insert-line
3551 mark (memq number gnus-newsgroup-replied)
3552 (memq number gnus-newsgroup-expirable)
3553 (mail-header-subject header) nil
3554 (cdr (assq number gnus-newsgroup-scored))
3555 (memq number gnus-newsgroup-processable))))))
3557 (defun gnus-select-newsgroup (group &optional read-all)
3558 "Select newsgroup GROUP.
3559 If READ-ALL is non-nil, all articles in the group are selected."
3560 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3561 (info (nth 2 entry))
3562 articles fetched-articles cached)
3564 (unless (gnus-check-server
3565 (setq gnus-current-select-method
3566 (gnus-find-method-for-group group)))
3567 (error "Couldn't open server"))
3569 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3570 (gnus-activate-group group) ; Or we can activate it...
3571 (progn ; Or we bug out.
3572 (when (equal major-mode 'gnus-summary-mode)
3573 (kill-buffer (current-buffer)))
3574 (error "Couldn't request group %s: %s"
3575 group (gnus-status-message group))))
3577 (unless (gnus-request-group group t)
3578 (when (equal major-mode 'gnus-summary-mode)
3579 (kill-buffer (current-buffer)))
3580 (error "Couldn't request group %s: %s"
3581 group (gnus-status-message group)))
3583 (setq gnus-newsgroup-name group)
3584 (setq gnus-newsgroup-unselected nil)
3585 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3587 ;; Adjust and set lists of article marks.
3589 (gnus-adjust-marked-articles info))
3591 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3592 (when (gnus-virtual-group-p group)
3593 (setq cached gnus-newsgroup-cached))
3595 (setq gnus-newsgroup-unreads
3596 (gnus-set-difference
3597 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3598 gnus-newsgroup-dormant))
3600 (setq gnus-newsgroup-processable nil)
3602 (gnus-update-read-articles group gnus-newsgroup-unreads)
3603 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
3604 (gnus-group-update-group group))
3606 (setq articles (gnus-articles-to-read group read-all))
3610 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3612 ((eq articles 0) nil)
3614 ;; Init the dependencies hash table.
3615 (setq gnus-newsgroup-dependencies
3616 (gnus-make-hashtable (length articles)))
3617 ;; Retrieve the headers and read them in.
3618 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3619 (setq gnus-newsgroup-headers
3621 (setq gnus-headers-retrieved-by
3622 (gnus-retrieve-headers
3623 articles gnus-newsgroup-name
3624 ;; We might want to fetch old headers, but
3625 ;; not if there is only 1 article.
3626 (and gnus-fetch-old-headers
3628 (not (eq gnus-fetch-old-headers 'some))
3629 (not (numberp gnus-fetch-old-headers)))
3630 (> (length articles) 1))))))
3631 (gnus-get-newsgroup-headers-xover
3632 articles nil nil gnus-newsgroup-name t)
3633 (gnus-get-newsgroup-headers)))
3634 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3636 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3638 (setq gnus-newsgroup-cached cached))
3640 ;; Suppress duplicates?
3641 (when gnus-suppress-duplicates
3642 (gnus-dup-suppress-articles))
3644 ;; Set the initial limit.
3645 (setq gnus-newsgroup-limit (copy-sequence articles))
3646 ;; Remove canceled articles from the list of unread articles.
3647 (setq gnus-newsgroup-unreads
3648 (gnus-set-sorted-intersection
3649 gnus-newsgroup-unreads
3650 (setq fetched-articles
3651 (mapcar (lambda (headers) (mail-header-number headers))
3652 gnus-newsgroup-headers))))
3653 ;; Removed marked articles that do not exist.
3654 (gnus-update-missing-marks
3655 (gnus-sorted-complement fetched-articles articles))
3656 ;; We might want to build some more threads first.
3657 (and gnus-fetch-old-headers
3658 (eq gnus-headers-retrieved-by 'nov)
3659 (gnus-build-old-threads))
3660 ;; Check whether auto-expire is to be done in this group.
3661 (setq gnus-newsgroup-auto-expire
3662 (gnus-group-auto-expirable-p group))
3663 ;; Set up the article buffer now, if necessary.
3664 (unless gnus-single-article-buffer
3665 (gnus-article-setup-buffer))
3666 ;; First and last article in this newsgroup.
3667 (when gnus-newsgroup-headers
3668 (setq gnus-newsgroup-begin
3669 (mail-header-number (car gnus-newsgroup-headers))
3672 (gnus-last-element gnus-newsgroup-headers))))
3673 ;; GROUP is successfully selected.
3674 (or gnus-newsgroup-headers t)))))
3676 (defun gnus-articles-to-read (group &optional read-all)
3677 ;; Find out what articles the user wants to read.
3679 ;; Select all articles if `read-all' is non-nil, or if there
3680 ;; are no unread articles.
3682 (and (zerop (length gnus-newsgroup-marked))
3683 (zerop (length gnus-newsgroup-unreads)))
3684 (eq (gnus-group-find-parameter group 'display)
3686 (gnus-uncompress-range (gnus-active group))
3687 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3688 (copy-sequence gnus-newsgroup-unreads))
3690 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3691 (scored (length scored-list))
3692 (number (length articles))
3693 (marked (+ (length gnus-newsgroup-marked)
3694 (length gnus-newsgroup-dormant)))
3702 ((and (or (<= scored marked) (= scored number))
3703 (numberp gnus-large-newsgroup)
3704 (> number gnus-large-newsgroup))
3708 "How many articles from %s (default %d): "
3709 (gnus-limit-string gnus-newsgroup-name 35)
3711 (if (string-match "^[ \t]*$" input) number input)))
3712 ((and (> scored marked) (< scored number)
3713 (> (- scored number) 20))
3716 (format "%s %s (%d scored, %d total): "
3717 "How many articles from"
3718 group scored number))))
3719 (if (string-match "^[ \t]*$" input)
3723 (setq select (if (stringp select) (string-to-number select) select))
3724 (if (or (null select) (zerop select))
3726 (if (and (not (zerop scored)) (<= (abs select) scored))
3728 (setq articles (sort scored-list '<))
3729 (setq number (length articles)))
3730 (setq articles (copy-sequence articles)))
3732 (when (< (abs select) number)
3734 ;; Select the N oldest articles.
3735 (setcdr (nthcdr (1- (abs select)) articles) nil)
3736 ;; Select the N most recent articles.
3737 (setq articles (nthcdr (- number select) articles))))
3738 (setq gnus-newsgroup-unselected
3739 (gnus-sorted-intersection
3740 gnus-newsgroup-unreads
3741 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3744 (defun gnus-killed-articles (killed articles)
3747 (when (inline (gnus-member-of-range (car articles) killed))
3748 (push (car articles) out))
3749 (setq articles (cdr articles)))
3752 (defun gnus-uncompress-marks (marks)
3753 "Uncompress the mark ranges in MARKS."
3754 (let ((uncompressed '(score bookmark))
3757 (if (memq (caar marks) uncompressed)
3758 (push (car marks) out)
3759 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3760 (setq marks (cdr marks)))
3763 (defun gnus-adjust-marked-articles (info)
3764 "Set all article lists and remove all marks that are no longer legal."
3765 (let* ((marked-lists (gnus-info-marks info))
3766 (active (gnus-active (gnus-info-group info)))
3769 (types gnus-article-mark-lists)
3770 (uncompressed '(score bookmark killed))
3771 marks var articles article mark)
3774 (setq marks (pop marked-lists))
3775 (set (setq var (intern (format "gnus-newsgroup-%s"
3776 (car (rassq (setq mark (car marks))
3778 (if (memq (car marks) uncompressed) (cdr marks)
3779 (gnus-uncompress-range (cdr marks))))
3781 (setq articles (symbol-value var))
3783 ;; All articles have to be subsets of the active articles.
3785 ;; Adjust "simple" lists.
3786 ((memq mark '(tick dormant expirable reply save))
3788 (when (or (< (setq article (pop articles)) min) (> article max))
3789 (set var (delq article (symbol-value var))))))
3791 ((memq mark uncompressed)
3793 (when (or (not (consp (setq article (pop articles))))
3794 (< (car article) min)
3795 (> (car article) max))
3796 (set var (delq article (symbol-value var))))))))))
3798 (defun gnus-update-missing-marks (missing)
3799 "Go through the list of MISSING articles and remove them mark lists."
3801 (let ((types gnus-article-mark-lists)
3803 ;; Go through all types.
3805 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
3806 (when (symbol-value var)
3807 ;; This list has articles. So we delete all missing articles
3811 (set var (delq (pop m) (symbol-value var)))))))))
3813 (defun gnus-update-marks ()
3814 "Enter the various lists of marked articles into the newsgroup info list."
3815 (let ((types gnus-article-mark-lists)
3816 (info (gnus-get-info gnus-newsgroup-name))
3817 (uncompressed '(score bookmark killed))
3818 type list newmarked symbol)
3820 ;; Add all marks lists that are non-nil to the list of marks lists.
3822 (setq type (pop types))
3823 (when (setq list (symbol-value
3825 (intern (format "gnus-newsgroup-%s"
3827 (push (cons (cdr type)
3828 (if (memq (cdr type) uncompressed) list
3829 (gnus-compress-sequence
3830 (set symbol (sort list '<)) t)))
3833 ;; Enter these new marks into the info of the group.
3835 (setcar (nthcdr 3 info) newmarked)
3836 ;; Add the marks lists to the end of the info.
3838 (setcdr (nthcdr 2 info) (list newmarked))))
3840 ;; Cut off the end of the info if there's nothing else there.
3844 (when (nthcdr (decf i) info)
3845 (setcdr (nthcdr i info) nil)))))))
3847 (defun gnus-set-mode-line (where)
3848 "This function sets the mode line of the article or summary buffers.
3849 If WHERE is `summary', the summary mode line format will be used."
3850 ;; Is this mode line one we keep updated?
3851 (when (memq where gnus-updated-mode-lines)
3854 ;; We evaluate this in the summary buffer since these
3855 ;; variables are buffer-local to that buffer.
3856 (set-buffer gnus-summary-buffer)
3857 ;; We bind all these variables that are used in the `eval' form
3859 (let* ((mformat (symbol-value
3861 (format "gnus-%s-mode-line-format-spec" where))))
3862 (gnus-tmp-group-name gnus-newsgroup-name)
3863 (gnus-tmp-article-number (or gnus-current-article 0))
3864 (gnus-tmp-unread gnus-newsgroup-unreads)
3865 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
3866 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
3867 (gnus-tmp-unread-and-unselected
3868 (cond ((and (zerop gnus-tmp-unread-and-unticked)
3869 (zerop gnus-tmp-unselected))
3871 ((zerop gnus-tmp-unselected)
3872 (format "{%d more}" gnus-tmp-unread-and-unticked))
3873 (t (format "{%d(+%d) more}"
3874 gnus-tmp-unread-and-unticked
3875 gnus-tmp-unselected))))
3877 (if (and gnus-current-headers
3878 (vectorp gnus-current-headers))
3879 (gnus-mode-string-quote
3880 (mail-header-subject gnus-current-headers))
3882 bufname-length max-len
3883 gnus-tmp-header);; passed as argument to any user-format-funcs
3884 (setq mode-string (eval mformat))
3885 (setq bufname-length (if (string-match "%b" mode-string)
3888 (if (eq where 'summary)
3890 (get-buffer gnus-article-buffer))))
3893 (setq max-len (max 4 (if gnus-mode-non-string-length
3895 gnus-mode-non-string-length
3897 (length mode-string))))
3898 ;; We might have to chop a bit of the string off...
3899 (when (> (length mode-string) max-len)
3901 (concat (gnus-truncate-string mode-string (- max-len 3))
3903 ;; Pad the mode string a bit.
3904 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
3905 ;; Update the mode line.
3906 (setq mode-line-buffer-identification
3907 (gnus-mode-line-buffer-identification (list mode-string)))
3908 (set-buffer-modified-p t))))
3910 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
3911 "Go through the HEADERS list and add all Xrefs to a hash table.
3912 The resulting hash table is returned, or nil if no Xrefs were found."
3913 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
3914 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
3915 (xref-hashtb (gnus-make-hashtable))
3916 start group entry number xrefs header)
3918 (setq header (pop headers))
3919 (when (and (setq xrefs (mail-header-xref header))
3920 (not (memq (setq number (mail-header-number header))
3923 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
3924 (setq start (match-end 0))
3925 (setq group (if prefix
3926 (concat prefix (substring xrefs (match-beginning 1)
3928 (substring xrefs (match-beginning 1) (match-end 1))))
3930 (string-to-int (substring xrefs (match-beginning 2)
3932 (if (setq entry (gnus-gethash group xref-hashtb))
3933 (setcdr entry (cons number (cdr entry)))
3934 (gnus-sethash group (cons number nil) xref-hashtb)))))
3935 (and start xref-hashtb)))
3937 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
3938 "Look through all the headers and mark the Xrefs as read."
3939 (let ((virtual (gnus-virtual-group-p from-newsgroup))
3940 name entry info xref-hashtb idlist method nth4)
3942 (set-buffer gnus-group-buffer)
3943 (when (setq xref-hashtb
3944 (gnus-create-xref-hashtb from-newsgroup headers unreads))
3947 (unless (string= from-newsgroup (setq name (symbol-name group)))
3948 (setq idlist (symbol-value group))
3949 ;; Dead groups are not updated.
3951 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
3953 (when (stringp (setq nth4 (gnus-info-method info)))
3954 (setq nth4 (gnus-server-to-method nth4))))
3955 ;; Only do the xrefs if the group has the same
3956 ;; select method as the group we have just read.
3957 (or (gnus-methods-equal-p
3958 nth4 (gnus-find-method-for-group from-newsgroup))
3960 (equal nth4 (setq method (gnus-find-method-for-group
3962 (and (equal (car nth4) (car method))
3963 (equal (nth 1 nth4) (nth 1 method))))
3964 gnus-use-cross-reference
3965 (or (not (eq gnus-use-cross-reference t))
3967 ;; Only do cross-references on subscribed
3968 ;; groups, if that is what is wanted.
3969 (<= (gnus-info-level info) gnus-level-subscribed))
3970 (gnus-group-make-articles-read name idlist))))
3973 (defun gnus-group-make-articles-read (group articles)
3974 "Update the info of GROUP to say that only ARTICLES are unread."
3976 (entry (gnus-gethash group gnus-newsrc-hashtb))
3977 (info (nth 2 entry))
3978 (active (gnus-active group))
3980 ;; First peel off all illegal article numbers.
3982 (let ((ids articles)
3984 (while (setq id (pop ids))
3985 (when (and first (> id (cdr active)))
3986 ;; We'll end up in this situation in one particular
3987 ;; obscure situation. If you re-scan a group and get
3988 ;; a new article that is cross-posted to a different
3989 ;; group that has not been re-scanned, you might get
3990 ;; crossposted article that has a higher number than
3991 ;; Gnus believes possible. So we re-activate this
3992 ;; group as well. This might mean doing the
3993 ;; crossposting thingy will *increase* the number
3994 ;; of articles in some groups. Tsk, tsk.
3995 (setq active (or (gnus-activate-group group) active)))
3996 (when (or (> id (cdr active))
3997 (< id (car active)))
3998 (setq articles (delq id articles))))))
4000 (set-buffer gnus-group-buffer)
4003 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4004 (gnus-info-set-read ',info ',(gnus-info-read info))
4005 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4006 (gnus-group-update-group ,group t))))
4007 ;; If the read list is nil, we init it.
4009 (null (gnus-info-read info))
4011 (gnus-info-set-read info (cons 1 (1- (car active)))))
4012 ;; Then we add the read articles to the range.
4017 (gnus-info-read info) (setq articles (sort articles '<)))))
4018 ;; Then we have to re-compute how many unread
4019 ;; articles there are in this group.
4023 (setq num (- (1+ (cdr active)) (car active))))
4024 ((not (listp (cdr range)))
4025 (setq num (- (cdr active) (- (1+ (cdr range))
4029 (if (numberp (car range))
4031 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4032 (setq range (cdr range)))
4033 (setq num (- (cdr active) num))))
4034 ;; Update the number of unread articles.
4036 ;; Update the group buffer.
4037 (gnus-group-update-group group t))))
4039 (defun gnus-methods-equal-p (m1 m2)
4040 (let ((m1 (or m1 gnus-select-method))
4041 (m2 (or m2 gnus-select-method)))
4043 (and (eq (car m1) (car m2))
4044 (or (not (memq 'address (assoc (symbol-name (car m1))
4045 gnus-valid-select-methods)))
4046 (equal (nth 1 m1) (nth 1 m2)))))))
4048 (defvar gnus-newsgroup-none-id 0)
4050 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4051 (let ((cur nntp-server-buffer)
4054 (save-excursion (set-buffer gnus-summary-buffer)
4055 gnus-newsgroup-dependencies)))
4056 headers id id-dep ref-dep end ref)
4058 (set-buffer nntp-server-buffer)
4059 ;; Translate all TAB characters into SPACE characters.
4060 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4061 (run-hooks 'gnus-parse-headers-hook)
4062 (let ((case-fold-search t)
4063 in-reply-to header p lines)
4064 (goto-char (point-min))
4065 ;; Search to the beginning of the next header. Error messages
4066 ;; do not begin with 2 or 3.
4067 (while (re-search-forward "^[23][0-9]+ " nil t)
4070 ;; This implementation of this function, with nine
4071 ;; search-forwards instead of the one re-search-forward and
4072 ;; a case (which basically was the old function) is actually
4073 ;; about twice as fast, even though it looks messier. You
4074 ;; can't have everything, I guess. Speed and elegance
4075 ;; doesn't always go hand in hand.
4084 (narrow-to-region (point)
4085 (or (and (search-forward "\n.\n" nil t)
4091 (if (search-forward "\nsubject: " nil t)
4092 (nnheader-header-value) "(none)"))
4096 (if (search-forward "\nfrom: " nil t)
4097 (nnheader-header-value) "(nobody)"))
4101 (if (search-forward "\ndate: " nil t)
4102 (nnheader-header-value) ""))
4106 (setq id (if (search-forward "\nmessage-id: " nil t)
4107 (nnheader-header-value)
4108 ;; If there was no message-id, we just fake one
4109 ;; to make subsequent routines simpler.
4110 (nnheader-generate-fake-message-id))))
4114 (if (search-forward "\nreferences: " nil t)
4118 (nnheader-header-value)
4123 (search-backward ">" end t)
4126 (search-backward "<" end t)
4128 ;; Get the references from the in-reply-to header if there
4129 ;; were no references and the in-reply-to header looks
4131 (if (and (search-forward "\nin-reply-to: " nil t)
4132 (setq in-reply-to (nnheader-header-value))
4133 (string-match "<[^>]+>" in-reply-to))
4134 (setq ref (substring in-reply-to (match-beginning 0)
4142 (if (search-forward "\nlines: " nil t)
4143 (if (numberp (setq lines (read cur)))
4149 (and (search-forward "\nxref: " nil t)
4150 (nnheader-header-value)))))
4151 (when (equal id ref)
4153 ;; We do the threading while we read the headers. The
4154 ;; message-id and the last reference are both entered into
4155 ;; the same hash table. Some tippy-toeing around has to be
4156 ;; done in case an article has arrived before the article
4157 ;; which it refers to.
4158 (if (boundp (setq id-dep (intern id dependencies)))
4159 (if (and (car (symbol-value id-dep))
4161 ;; An article with this Message-ID has already been seen,
4162 ;; so we rename the Message-ID.
4165 (setq id-dep (intern (setq id (nnmail-message-id))
4168 (mail-header-set-id header id))
4169 (setcar (symbol-value id-dep) header))
4170 (set id-dep (list header)))
4172 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4173 (setcdr (symbol-value ref-dep)
4174 (nconc (cdr (symbol-value ref-dep))
4175 (list (symbol-value id-dep))))
4176 (set ref-dep (list nil (symbol-value id-dep))))
4177 (push header headers))
4178 (goto-char (point-max))
4180 (nreverse headers)))))
4182 ;; The following macros and functions were written by Felix Lee
4183 ;; <flee@cse.psu.edu>.
4185 (defmacro gnus-nov-read-integer ()
4187 (if (= (following-char) ?\t)
4189 (let ((num (ignore-errors (read buffer))))
4190 (if (numberp num) num 0)))
4194 (defmacro gnus-nov-skip-field ()
4195 '(search-forward "\t" eol 'move))
4197 (defmacro gnus-nov-field ()
4198 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4200 ;; (defvar gnus-nov-none-counter 0)
4202 ;; This function has to be called with point after the article number
4203 ;; on the beginning of the line.
4204 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4205 (let ((eol (gnus-point-at-eol))
4206 (buffer (current-buffer))
4207 header ref id id-dep ref-dep)
4209 ;; overview: [num subject from date id refs chars lines misc]
4212 (narrow-to-region (point) eol)
4219 (gnus-nov-field) ; subject
4220 (gnus-nov-field) ; from
4221 (gnus-nov-field) ; date
4222 (setq id (or (gnus-nov-field)
4223 (nnheader-generate-fake-message-id))) ; id
4225 (let ((beg (point)))
4226 (search-forward "\t" eol)
4227 (if (search-backward ">" beg t)
4231 (search-backward "<" beg t)))
4234 (gnus-nov-field)) ; refs
4235 (gnus-nov-read-integer) ; chars
4236 (gnus-nov-read-integer) ; lines
4237 (if (= (following-char) ?\n)
4239 (gnus-nov-field))))) ; misc
4243 ;; We build the thread tree.
4244 (when (equal id ref)
4245 ;; This article refers back to itself. Naughty, naughty.
4247 (if (boundp (setq id-dep (intern id dependencies)))
4248 (if (and (car (symbol-value id-dep))
4250 ;; An article with this Message-ID has already been seen,
4251 ;; so we rename the Message-ID.
4254 (setq id-dep (intern (setq id (nnmail-message-id))
4257 (mail-header-set-id header id))
4258 (setcar (symbol-value id-dep) header))
4259 (set id-dep (list header)))
4261 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4262 (setcdr (symbol-value ref-dep)
4263 (nconc (cdr (symbol-value ref-dep))
4264 (list (symbol-value id-dep))))
4265 (set ref-dep (list nil (symbol-value id-dep)))))
4268 ;; Goes through the xover lines and returns a list of vectors
4269 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4270 force-new dependencies
4271 group also-fetch-heads)
4272 "Parse the news overview data in the server buffer, and return a
4273 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4274 ;; Get the Xref when the users reads the articles since most/some
4275 ;; NNTP servers do not include Xrefs when using XOVER.
4276 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4277 (let ((cur nntp-server-buffer)
4278 (dependencies (or dependencies gnus-newsgroup-dependencies))
4279 number headers header)
4281 (set-buffer nntp-server-buffer)
4282 ;; Allow the user to mangle the headers before parsing them.
4283 (run-hooks 'gnus-parse-headers-hook)
4284 (goto-char (point-min))
4287 (while (and sequence (not (eobp)))
4288 (setq number (read cur))
4289 (while (and sequence
4290 (< (car sequence) number))
4291 (setq sequence (cdr sequence)))
4293 (eq number (car sequence))
4295 (setq sequence (cdr sequence))
4296 (setq header (inline
4297 (gnus-nov-parse-line
4298 number dependencies force-new))))
4299 (push header headers))
4302 (gnus-error 4 "Strange nov line (%d)"
4303 (count-lines (point-min) (point)))))
4305 ;; A common bug in inn is that if you have posted an article and
4306 ;; then retrieves the active file, it will answer correctly --
4307 ;; the new article is included. However, a NOV entry for the
4308 ;; article may not have been generated yet, so this may fail.
4309 ;; We work around this problem by retrieving the last few
4310 ;; headers using HEAD.
4311 (if (or (not also-fetch-heads)
4313 ;; We (probably) got all the headers.
4315 (let ((gnus-nov-is-evil t))
4318 (when (gnus-retrieve-headers sequence group)
4319 (gnus-get-newsgroup-headers))))))))
4321 (defun gnus-article-get-xrefs ()
4322 "Fill in the Xref value in `gnus-current-headers', if necessary.
4323 This is meant to be called in `gnus-article-internal-prepare-hook'."
4324 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4325 gnus-current-headers)))
4326 (or (not gnus-use-cross-reference)
4328 (and (mail-header-xref headers)
4329 (not (string= (mail-header-xref headers) "")))
4330 (let ((case-fold-search t)
4333 (nnheader-narrow-to-headers)
4334 (goto-char (point-min))
4335 (when (or (and (eq (downcase (following-char)) ?x)
4336 (looking-at "Xref:"))
4337 (search-forward "\nXref:" nil t))
4338 (goto-char (1+ (match-end 0)))
4339 (setq xref (buffer-substring (point)
4340 (progn (end-of-line) (point))))
4341 (mail-header-set-xref headers xref)))))))
4343 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4344 "Find article ID and insert the summary line for that article."
4345 (let ((header (if (and old-header use-old-header)
4346 old-header (gnus-read-header id)))
4347 (number (and (numberp id) id))
4350 ;; Rebuild the thread that this article is part of and go to the
4351 ;; article we have fetched.
4352 (when (and (not gnus-show-threads)
4354 (when (setq d (gnus-data-find (mail-header-number old-header)))
4355 (goto-char (gnus-data-pos d))
4358 (- (gnus-point-at-bol)
4360 (1+ (gnus-point-at-eol))
4361 (gnus-delete-line))))))
4363 (mail-header-set-number header (mail-header-number old-header)))
4364 (setq gnus-newsgroup-sparse
4365 (delq (setq number (mail-header-number header))
4366 gnus-newsgroup-sparse))
4367 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4368 (gnus-rebuild-thread (mail-header-id header))
4369 (gnus-summary-goto-subject number nil t))
4370 (when (and (numberp number)
4372 ;; We have to update the boundaries even if we can't fetch the
4373 ;; article if ID is a number -- so that the next `P' or `N'
4374 ;; command will fetch the previous (or next) article even
4375 ;; if the one we tried to fetch this time has been canceled.
4376 (when (> number gnus-newsgroup-end)
4377 (setq gnus-newsgroup-end number))
4378 (when (< number gnus-newsgroup-begin)
4379 (setq gnus-newsgroup-begin number))
4380 (setq gnus-newsgroup-unselected
4381 (delq number gnus-newsgroup-unselected)))
4382 ;; Report back a success?
4383 (and header (mail-header-number header))))
4385 ;;; Process/prefix in the summary buffer
4387 (defun gnus-summary-work-articles (n)
4388 "Return a list of articles to be worked upon. The prefix argument,
4389 the list of process marked articles, and the current article will be
4390 taken into consideration."
4393 ;; A numerical prefix has been given.
4394 (setq n (prefix-numeric-value n))
4395 (let ((backward (< n 0))
4396 (n (abs (prefix-numeric-value n)))
4401 (push (setq article (gnus-summary-article-number))
4404 (gnus-summary-find-prev nil article)
4405 (gnus-summary-find-next nil article)))
4407 (nreverse articles)))
4408 ((gnus-region-active-p)
4409 ;; Work on the region between point and mark.
4410 (let ((max (max (point) (mark)))
4413 (goto-char (min (point) (mark)))
4416 (push (setq article (gnus-summary-article-number)) articles)
4417 (gnus-summary-find-next nil article)
4419 (nreverse articles))))
4420 (gnus-newsgroup-processable
4421 ;; There are process-marked articles present.
4422 ;; Save current state.
4423 (gnus-summary-save-process-mark)
4425 (reverse gnus-newsgroup-processable))
4427 ;; Just return the current article.
4428 (list (gnus-summary-article-number)))))
4430 (defun gnus-summary-save-process-mark ()
4431 "Push the current set of process marked articles on the stack."
4433 (push (copy-sequence gnus-newsgroup-processable)
4434 gnus-newsgroup-process-stack))
4436 (defun gnus-summary-kill-process-mark ()
4437 "Push the current set of process marked articles on the stack and unmark."
4439 (gnus-summary-save-process-mark)
4440 (gnus-summary-unmark-all-processable))
4442 (defun gnus-summary-yank-process-mark ()
4443 "Pop the last process mark state off the stack and restore it."
4445 (unless gnus-newsgroup-process-stack
4446 (error "Empty mark stack"))
4447 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4449 (defun gnus-summary-process-mark-set (set)
4450 "Make SET into the current process marked articles."
4451 (gnus-summary-unmark-all-processable)
4453 (gnus-summary-set-process-mark (pop set))))
4455 ;;; Searching and stuff
4457 (defun gnus-summary-search-group (&optional backward use-level)
4458 "Search for next unread newsgroup.
4459 If optional argument BACKWARD is non-nil, search backward instead."
4461 (set-buffer gnus-group-buffer)
4462 (when (gnus-group-search-forward
4463 backward nil (if use-level (gnus-group-group-level) nil))
4464 (gnus-group-group-name))))
4466 (defun gnus-summary-best-group (&optional exclude-group)
4467 "Find the name of the best unread group.
4468 If EXCLUDE-GROUP, do not go to this group."
4470 (set-buffer gnus-group-buffer)
4472 (gnus-group-best-unread-group exclude-group))))
4474 (defun gnus-summary-find-next (&optional unread article backward)
4475 (if backward (gnus-summary-find-prev)
4476 (let* ((dummy (gnus-summary-article-intangible-p))
4477 (article (or article (gnus-summary-article-number)))
4478 (arts (gnus-data-find-list article))
4480 (when (and (not dummy)
4481 (or (not gnus-summary-check-current)
4483 (not (gnus-data-unread-p (car arts)))))
4484 (setq arts (cdr arts)))
4489 (when (gnus-data-unread-p (car arts))
4490 (setq result (car arts)
4492 (setq arts (cdr arts)))
4495 (goto-char (gnus-data-pos result))
4496 (gnus-data-number result)))))
4498 (defun gnus-summary-find-prev (&optional unread article)
4499 (let* ((eobp (eobp))
4500 (article (or article (gnus-summary-article-number)))
4501 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4503 (when (and (not eobp)
4504 (or (not gnus-summary-check-current)
4506 (not (gnus-data-unread-p (car arts)))))
4507 (setq arts (cdr arts)))
4512 (when (gnus-data-unread-p (car arts))
4513 (setq result (car arts)
4515 (setq arts (cdr arts)))
4518 (goto-char (gnus-data-pos result))
4519 (gnus-data-number result))))
4521 (defun gnus-summary-find-subject (subject &optional unread backward article)
4522 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4523 (article (or article (gnus-summary-article-number)))
4524 (articles (gnus-data-list backward))
4525 (arts (gnus-data-find-list article articles))
4527 (when (or (not gnus-summary-check-current)
4529 (not (gnus-data-unread-p (car arts))))
4530 (setq arts (cdr arts)))
4532 (and (or (not unread)
4533 (gnus-data-unread-p (car arts)))
4534 (vectorp (gnus-data-header (car arts)))
4536 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4537 (setq result (car arts)
4539 (setq arts (cdr arts)))
4541 (goto-char (gnus-data-pos result))
4542 (gnus-data-number result))))
4544 (defun gnus-summary-search-forward (&optional unread subject backward)
4545 "Search forward for an article.
4546 If UNREAD, look for unread articles. If SUBJECT, look for
4547 articles with that subject. If BACKWARD, search backward instead."
4548 (cond (subject (gnus-summary-find-subject subject unread backward))
4549 (backward (gnus-summary-find-prev unread))
4550 (t (gnus-summary-find-next unread))))
4552 (defun gnus-recenter (&optional n)
4553 "Center point in window and redisplay frame.
4554 Also do horizontal recentering."
4556 (when (and gnus-auto-center-summary
4557 (not (eq gnus-auto-center-summary 'vertical)))
4558 (gnus-horizontal-recenter))
4561 (defun gnus-summary-recenter ()
4562 "Center point in the summary window.
4563 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4564 displayed, no centering will be performed."
4565 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4566 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4567 (let* ((top (cond ((< (window-height) 4) 0)
4568 ((< (window-height) 7) 1)
4570 (height (1- (window-height)))
4571 (bottom (save-excursion (goto-char (point-max))
4572 (forward-line (- height))
4574 (window (get-buffer-window (current-buffer))))
4575 ;; The user has to want it.
4576 (when gnus-auto-center-summary
4577 (when (get-buffer-window gnus-article-buffer)
4578 ;; Only do recentering when the article buffer is displayed,
4579 ;; Set the window start to either `bottom', which is the biggest
4580 ;; possible valid number, or the second line from the top,
4581 ;; whichever is the least.
4583 window (min bottom (save-excursion
4584 (forward-line (- top)) (point)))))
4585 ;; Do horizontal recentering while we're at it.
4586 (when (and (get-buffer-window (current-buffer) t)
4587 (not (eq gnus-auto-center-summary 'vertical)))
4588 (let ((selected (selected-window)))
4589 (select-window (get-buffer-window (current-buffer) t))
4590 (gnus-summary-position-point)
4591 (gnus-horizontal-recenter)
4592 (select-window selected))))))
4594 (defun gnus-summary-jump-to-group (newsgroup)
4595 "Move point to NEWSGROUP in group mode buffer."
4596 ;; Keep update point of group mode buffer if visible.
4597 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4598 (save-window-excursion
4599 ;; Take care of tree window mode.
4600 (when (get-buffer-window gnus-group-buffer)
4601 (pop-to-buffer gnus-group-buffer))
4602 (gnus-group-jump-to-group newsgroup))
4604 ;; Take care of tree window mode.
4605 (if (get-buffer-window gnus-group-buffer)
4606 (pop-to-buffer gnus-group-buffer)
4607 (set-buffer gnus-group-buffer))
4608 (gnus-group-jump-to-group newsgroup))))
4610 ;; This function returns a list of article numbers based on the
4611 ;; difference between the ranges of read articles in this group and
4612 ;; the range of active articles.
4613 (defun gnus-list-of-unread-articles (group)
4614 (let* ((read (gnus-info-read (gnus-get-info group)))
4615 (active (or (gnus-active group) (gnus-activate-group group)))
4618 ;; If none are read, then all are unread.
4620 (setq first (car active))
4621 ;; If the range of read articles is a single range, then the
4622 ;; first unread article is the article after the last read
4623 ;; article. Sounds logical, doesn't it?
4624 (if (not (listp (cdr read)))
4625 (setq first (1+ (cdr read)))
4626 ;; `read' is a list of ranges.
4627 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4633 (while (< first nlast)
4635 (setq first (1+ first))))
4636 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4637 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4638 (setq read (cdr read)))))
4639 ;; And add the last unread articles.
4640 (while (<= first last)
4642 (setq first (1+ first)))
4643 ;; Return the list of unread articles.
4646 (defun gnus-list-of-read-articles (group)
4647 "Return a list of unread, unticked and non-dormant articles."
4648 (let* ((info (gnus-get-info group))
4649 (marked (gnus-info-marks info))
4650 (active (gnus-active group)))
4652 (gnus-set-difference
4653 (gnus-sorted-complement
4654 (gnus-uncompress-range active)
4655 (gnus-list-of-unread-articles group))
4657 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4658 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4660 ;; Various summary commands
4662 (defun gnus-summary-universal-argument (arg)
4663 "Perform any operation on all articles that are process/prefixed."
4665 (gnus-set-global-variables)
4666 (let ((articles (gnus-summary-work-articles arg))
4673 (substitute-command-keys
4674 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4677 (gnus-error 1 "Undefined key")
4680 (gnus-summary-goto-subject (setq article (pop articles)))
4681 (let (gnus-newsgroup-processable)
4682 (command-execute func))
4683 (gnus-summary-remove-process-mark article)))))
4684 (gnus-summary-position-point))
4686 (defun gnus-summary-toggle-truncation (&optional arg)
4687 "Toggle truncation of summary lines.
4688 With arg, turn line truncation on iff arg is positive."
4690 (setq truncate-lines
4691 (if (null arg) (not truncate-lines)
4692 (> (prefix-numeric-value arg) 0)))
4695 (defun gnus-summary-reselect-current-group (&optional all rescan)
4696 "Exit and then reselect the current newsgroup.
4697 The prefix argument ALL means to select all articles."
4699 (gnus-set-global-variables)
4700 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4701 (error "Ephemeral groups can't be reselected"))
4702 (let ((current-subject (gnus-summary-article-number))
4703 (group gnus-newsgroup-name))
4704 (setq gnus-newsgroup-begin nil)
4706 ;; We have to adjust the point of group mode buffer because
4707 ;; point was moved to the next unread newsgroup by exiting.
4708 (gnus-summary-jump-to-group group)
4711 (gnus-group-get-new-news-this-group 1)))
4712 (gnus-group-read-group all t)
4713 (gnus-summary-goto-subject current-subject nil t)))
4715 (defun gnus-summary-rescan-group (&optional all)
4716 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4718 (gnus-summary-reselect-current-group all t))
4720 (defun gnus-summary-update-info (&optional non-destructive)
4722 (let ((group gnus-newsgroup-name))
4723 (when gnus-newsgroup-kill-headers
4724 (setq gnus-newsgroup-killed
4725 (gnus-compress-sequence
4727 (gnus-set-sorted-intersection
4728 (gnus-uncompress-range gnus-newsgroup-killed)
4729 (setq gnus-newsgroup-unselected
4730 (sort gnus-newsgroup-unselected '<)))
4731 (setq gnus-newsgroup-unreads
4732 (sort gnus-newsgroup-unreads '<)))
4734 (unless (listp (cdr gnus-newsgroup-killed))
4735 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4736 (let ((headers gnus-newsgroup-headers))
4737 (when (and (not gnus-save-score)
4738 (not non-destructive))
4739 (setq gnus-newsgroup-scored nil))
4740 ;; Set the new ranges of read articles.
4741 (gnus-update-read-articles
4742 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4743 ;; Set the current article marks.
4745 ;; Do the cross-ref thing.
4746 (when gnus-use-cross-reference
4747 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4748 ;; Do adaptive scoring, and possibly save score files.
4749 (when gnus-newsgroup-adaptive
4750 (gnus-score-adaptive))
4751 (when gnus-use-scoring
4753 ;; Do not switch windows but change the buffer to work.
4754 (set-buffer gnus-group-buffer)
4755 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4756 (gnus-group-update-group group))))))
4758 (defun gnus-summary-save-newsrc (&optional force)
4759 "Save the current number of read/marked articles in the dribble buffer.
4760 The dribble buffer will then be saved.
4761 If FORCE (the prefix), also save the .newsrc file(s)."
4763 (gnus-summary-update-info t)
4765 (gnus-save-newsrc-file)
4766 (gnus-dribble-save)))
4768 (defun gnus-summary-exit (&optional temporary)
4769 "Exit reading current newsgroup, and then return to group selection mode.
4770 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4772 (gnus-set-global-variables)
4773 (gnus-kill-save-kill-buffer)
4774 (let* ((group gnus-newsgroup-name)
4775 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4777 (buf (current-buffer)))
4778 (run-hooks 'gnus-summary-prepare-exit-hook)
4779 ;; If we have several article buffers, we kill them at exit.
4780 (unless gnus-single-article-buffer
4781 (gnus-kill-buffer gnus-original-article-buffer)
4782 (setq gnus-article-current nil))
4783 (when gnus-use-cache
4784 (gnus-cache-possibly-remove-articles)
4785 (gnus-cache-save-buffers))
4786 (gnus-async-prefetch-remove-group group)
4787 (when gnus-suppress-duplicates
4788 (gnus-dup-enter-articles))
4789 (when gnus-use-trees
4790 (gnus-tree-close group))
4791 ;; Make all changes in this group permanent.
4793 (run-hooks 'gnus-exit-group-hook)
4794 (gnus-summary-update-info))
4795 (gnus-close-group group)
4796 ;; Make sure where I was, and go to next newsgroup.
4797 (set-buffer gnus-group-buffer)
4799 (gnus-group-jump-to-group group))
4800 (run-hooks 'gnus-summary-exit-hook)
4802 (gnus-group-next-unread-group 1))
4805 ;; If we have several article buffers, we kill them at exit.
4806 (unless gnus-single-article-buffer
4807 (gnus-kill-buffer gnus-article-buffer)
4808 (gnus-kill-buffer gnus-original-article-buffer)
4809 (setq gnus-article-current nil))
4811 (if (not gnus-kill-summary-on-exit)
4812 (gnus-deaden-summary)
4813 ;; We set all buffer-local variables to nil. It is unclear why
4814 ;; this is needed, but if we don't, buffer-local variables are
4815 ;; not garbage-collected, it seems. This would the lead to en
4816 ;; ever-growing Emacs.
4817 (gnus-summary-clear-local-variables)
4818 (when (get-buffer gnus-article-buffer)
4819 (bury-buffer gnus-article-buffer))
4820 ;; We clear the global counterparts of the buffer-local
4821 ;; variables as well, just to be on the safe side.
4822 (set-buffer gnus-group-buffer)
4823 (gnus-summary-clear-local-variables)
4824 ;; Return to group mode buffer.
4825 (when (eq mode 'gnus-summary-mode)
4826 (gnus-kill-buffer buf)))
4827 (setq gnus-current-select-method gnus-select-method)
4828 (pop-to-buffer gnus-group-buffer)
4829 ;; Clear the current group name.
4830 (if (not quit-config)
4832 (gnus-group-jump-to-group group)
4833 (gnus-group-next-unread-group 1)
4834 (gnus-configure-windows 'group 'force))
4835 (gnus-handle-ephemeral-exit quit-config))
4837 (setq gnus-newsgroup-name nil)))))
4839 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
4840 (defun gnus-summary-exit-no-update (&optional no-questions)
4841 "Quit reading current newsgroup without updating read article info."
4843 (gnus-set-global-variables)
4844 (let* ((group gnus-newsgroup-name)
4845 (quit-config (gnus-group-quit-config group)))
4846 (when (or no-questions
4848 (gnus-y-or-n-p "Discard changes to this group and exit? "))
4849 ;; If we have several article buffers, we kill them at exit.
4850 (unless gnus-single-article-buffer
4851 (gnus-kill-buffer gnus-article-buffer)
4852 (gnus-kill-buffer gnus-original-article-buffer)
4853 (setq gnus-article-current nil))
4854 (if (not gnus-kill-summary-on-exit)
4855 (gnus-deaden-summary)
4856 (gnus-close-group group)
4857 (gnus-summary-clear-local-variables)
4858 (set-buffer gnus-group-buffer)
4859 (gnus-summary-clear-local-variables)
4860 (when (get-buffer gnus-summary-buffer)
4861 (kill-buffer gnus-summary-buffer)))
4862 (unless gnus-single-article-buffer
4863 (setq gnus-article-current nil))
4864 (when gnus-use-trees
4865 (gnus-tree-close group))
4866 (gnus-async-prefetch-remove-group group)
4867 (when (get-buffer gnus-article-buffer)
4868 (bury-buffer gnus-article-buffer))
4869 ;; Return to the group buffer.
4870 (gnus-configure-windows 'group 'force)
4871 ;; Clear the current group name.
4872 (setq gnus-newsgroup-name nil)
4873 (when (equal (gnus-group-group-name) group)
4874 (gnus-group-next-unread-group 1))
4876 (gnus-handle-ephemeral-exit quit-config)))))
4878 (defun gnus-handle-ephemeral-exit (quit-config)
4879 "Handle movement when leaving an ephemeral group. The state
4880 which existed when entering the ephemeral is reset."
4881 (if (not (buffer-name (car quit-config)))
4882 (gnus-configure-windows 'group 'force)
4883 (set-buffer (car quit-config))
4884 (cond ((eq major-mode 'gnus-summary-mode)
4885 (gnus-set-global-variables))
4886 ((eq major-mode 'gnus-article-mode)
4888 ;; The `gnus-summary-buffer' variable may point
4889 ;; to the old summary buffer when using a single
4891 (unless (gnus-buffer-live-p gnus-summary-buffer)
4892 (set-buffer gnus-group-buffer))
4893 (set-buffer gnus-summary-buffer)
4894 (gnus-set-global-variables))))
4895 (if (or (eq (cdr quit-config) 'article)
4896 (eq (cdr quit-config) 'pick))
4898 ;; The current article may be from the ephemeral group
4899 ;; thus it is best that we reload this article
4900 (gnus-summary-show-article)
4901 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
4902 (gnus-configure-windows 'pick 'force)
4903 (gnus-configure-windows (cdr quit-config) 'force)))
4904 (gnus-configure-windows (cdr quit-config) 'force))
4905 (when (eq major-mode 'gnus-summary-mode)
4906 (gnus-summary-next-subject 1 nil t)
4907 (gnus-summary-recenter)
4908 (gnus-summary-position-point))))
4912 (defvar gnus-dead-summary-mode-map nil)
4914 (unless gnus-dead-summary-mode-map
4915 (setq gnus-dead-summary-mode-map (make-keymap))
4916 (suppress-keymap gnus-dead-summary-mode-map)
4917 (substitute-key-definition
4918 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
4919 (let ((keys '("\C-d" "\r" "\177")))
4921 (define-key gnus-dead-summary-mode-map
4922 (pop keys) 'gnus-summary-wake-up-the-dead))))
4924 (defvar gnus-dead-summary-mode nil
4925 "Minor mode for Gnus summary buffers.")
4927 (defun gnus-dead-summary-mode (&optional arg)
4928 "Minor mode for Gnus summary buffers."
4930 (when (eq major-mode 'gnus-summary-mode)
4931 (make-local-variable 'gnus-dead-summary-mode)
4932 (setq gnus-dead-summary-mode
4933 (if (null arg) (not gnus-dead-summary-mode)
4934 (> (prefix-numeric-value arg) 0)))
4935 (when gnus-dead-summary-mode
4936 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
4937 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
4938 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
4939 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
4940 minor-mode-map-alist)))))
4942 (defun gnus-deaden-summary ()
4943 "Make the current summary buffer into a dead summary buffer."
4944 ;; Kill any previous dead summary buffer.
4945 (when (and gnus-dead-summary
4946 (buffer-name gnus-dead-summary))
4948 (set-buffer gnus-dead-summary)
4949 (when gnus-dead-summary-mode
4950 (kill-buffer (current-buffer)))))
4951 ;; Make this the current dead summary.
4952 (setq gnus-dead-summary (current-buffer))
4953 (gnus-dead-summary-mode 1)
4954 (let ((name (buffer-name)))
4955 (when (string-match "Summary" name)
4957 (concat (substring name 0 (match-beginning 0)) "Dead "
4958 (substring name (match-beginning 0)))
4961 (defun gnus-kill-or-deaden-summary (buffer)
4962 "Kill or deaden the summary BUFFER."
4963 (when (and (buffer-name buffer)
4964 (not gnus-single-article-buffer))
4967 (gnus-kill-buffer gnus-article-buffer)
4968 (gnus-kill-buffer gnus-original-article-buffer)))
4969 (cond (gnus-kill-summary-on-exit
4970 (when (and gnus-use-trees
4971 (and (get-buffer buffer)
4972 (buffer-name (get-buffer buffer))))
4974 (set-buffer (get-buffer buffer))
4975 (gnus-tree-close gnus-newsgroup-name)))
4976 (gnus-kill-buffer buffer))
4977 ((and (get-buffer buffer)
4978 (buffer-name (get-buffer buffer)))
4981 (gnus-deaden-summary)))))
4983 (defun gnus-summary-wake-up-the-dead (&rest args)
4984 "Wake up the dead summary buffer."
4986 (gnus-dead-summary-mode -1)
4987 (let ((name (buffer-name)))
4988 (when (string-match "Dead " name)
4990 (concat (substring name 0 (match-beginning 0))
4991 (substring name (match-end 0)))
4993 (gnus-message 3 "This dead summary is now alive again"))
4995 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
4996 (defun gnus-summary-fetch-faq (&optional faq-dir)
4997 "Fetch the FAQ for the current group.
4998 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5002 (when current-prefix-arg
5004 "Faq dir: " (and (listp gnus-group-faq-directory)
5005 gnus-group-faq-directory)))))
5006 (let (gnus-faq-buffer)
5007 (when (setq gnus-faq-buffer
5008 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5009 (gnus-configure-windows 'summary-faq))))
5011 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5012 (defun gnus-summary-describe-group (&optional force)
5013 "Describe the current newsgroup."
5015 (gnus-group-describe-group force gnus-newsgroup-name))
5017 (defun gnus-summary-describe-briefly ()
5018 "Describe summary mode commands briefly."
5021 (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")))
5023 ;; Walking around group mode buffer from summary mode.
5025 (defun gnus-summary-next-group (&optional no-article target-group backward)
5026 "Exit current newsgroup and then select next unread newsgroup.
5027 If prefix argument NO-ARTICLE is non-nil, no article is selected
5028 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5029 previous group instead."
5031 (gnus-set-global-variables)
5032 ;; Stop pre-fetching.
5033 (gnus-async-halt-prefetch)
5034 (let ((current-group gnus-newsgroup-name)
5035 (current-buffer (current-buffer))
5037 ;; First we semi-exit this group to update Xrefs and all variables.
5038 ;; We can't do a real exit, because the window conf must remain
5039 ;; the same in case the user is prompted for info, and we don't
5040 ;; want the window conf to change before that...
5041 (gnus-summary-exit t)
5042 (while (not entered)
5043 ;; Then we find what group we are supposed to enter.
5044 (set-buffer gnus-group-buffer)
5045 (gnus-group-jump-to-group current-group)
5048 (if (eq gnus-keep-same-level 'best)
5049 (gnus-summary-best-group gnus-newsgroup-name)
5050 (gnus-summary-search-group backward gnus-keep-same-level))))
5051 (if (not target-group)
5052 ;; There are no further groups, so we return to the group
5055 (gnus-message 5 "Returning to the group buffer")
5057 (set-buffer current-buffer)
5059 (run-hooks 'gnus-group-no-more-groups-hook))
5060 ;; We try to enter the target group.
5061 (gnus-group-jump-to-group target-group)
5062 (let ((unreads (gnus-group-group-unread)))
5063 (if (and (or (eq t unreads)
5064 (and unreads (not (zerop unreads))))
5065 (gnus-summary-read-group
5066 target-group nil no-article current-buffer))
5068 (setq current-group target-group
5069 target-group nil)))))))
5071 (defun gnus-summary-prev-group (&optional no-article)
5072 "Exit current newsgroup and then select previous unread newsgroup.
5073 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5075 (gnus-summary-next-group no-article nil t))
5077 ;; Walking around summary lines.
5079 (defun gnus-summary-first-subject (&optional unread)
5080 "Go to the first unread subject.
5081 If UNREAD is non-nil, go to the first unread article.
5082 Returns the article selected or nil if there are no unread articles."
5087 ((null gnus-newsgroup-data)
5088 (gnus-message 3 "No articles in the group")
5090 ;; Pick the first article.
5092 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5093 (gnus-data-number (car gnus-newsgroup-data)))
5094 ;; No unread articles.
5095 ((null gnus-newsgroup-unreads)
5096 (gnus-message 3 "No more unread articles")
5098 ;; Find the first unread article.
5100 (let ((data gnus-newsgroup-data))
5102 (not (gnus-data-unread-p (car data))))
5103 (setq data (cdr data)))
5105 (goto-char (gnus-data-pos (car data)))
5106 (gnus-data-number (car data))))))
5107 (gnus-summary-position-point)))
5109 (defun gnus-summary-next-subject (n &optional unread dont-display)
5110 "Go to next N'th summary line.
5111 If N is negative, go to the previous N'th subject line.
5112 If UNREAD is non-nil, only unread articles are selected.
5113 The difference between N and the actual number of steps taken is
5116 (let ((backward (< n 0))
5120 (gnus-summary-find-prev unread)
5121 (gnus-summary-find-next unread)))
5124 (gnus-message 7 "No more%s articles"
5125 (if unread " unread" "")))
5126 (unless dont-display
5127 (gnus-summary-recenter)
5128 (gnus-summary-position-point))
5131 (defun gnus-summary-next-unread-subject (n)
5132 "Go to next N'th unread summary line."
5134 (gnus-summary-next-subject n t))
5136 (defun gnus-summary-prev-subject (n &optional unread)
5137 "Go to previous N'th summary line.
5138 If optional argument UNREAD is non-nil, only unread article is selected."
5140 (gnus-summary-next-subject (- n) unread))
5142 (defun gnus-summary-prev-unread-subject (n)
5143 "Go to previous N'th unread summary line."
5145 (gnus-summary-next-subject (- n) t))
5147 (defun gnus-summary-goto-subject (article &optional force silent)
5148 "Go the subject line of ARTICLE.
5149 If FORCE, also allow jumping to articles not currently shown."
5150 (interactive "nArticle number: ")
5152 (data (gnus-data-find article)))
5153 ;; We read in the article if we have to.
5156 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5157 (setq data (gnus-data-find article)))
5162 (gnus-message 3 "Can't find article %d" article))
5164 (goto-char (gnus-data-pos data))
5167 ;; Walking around summary lines with displaying articles.
5169 (defun gnus-summary-expand-window (&optional arg)
5170 "Make the summary buffer take up the entire Emacs frame.
5171 Given a prefix, will force an `article' buffer configuration."
5173 (gnus-set-global-variables)
5175 (gnus-configure-windows 'article 'force)
5176 (gnus-configure-windows 'summary 'force)))
5178 (defun gnus-summary-display-article (article &optional all-header)
5179 "Display ARTICLE in article buffer."
5180 (gnus-set-global-variables)
5184 (if gnus-summary-display-article-function
5185 (funcall gnus-summary-display-article-function article all-header)
5186 (gnus-article-prepare article all-header))
5187 (run-hooks 'gnus-select-article-hook)
5188 (when (and gnus-current-article
5189 (not (zerop gnus-current-article)))
5190 (gnus-summary-goto-subject gnus-current-article))
5191 (gnus-summary-recenter)
5192 (when (and gnus-use-trees gnus-show-threads)
5193 (gnus-possibly-generate-tree article)
5194 (gnus-highlight-selected-tree article))
5195 ;; Successfully display article.
5196 (gnus-article-set-window-start
5197 (cdr (assq article gnus-newsgroup-bookmarks))))))
5199 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5200 "Select the current article.
5201 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5202 non-nil, the article will be re-fetched even if it already present in
5203 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5205 ;; Make sure we are in the summary buffer to work around bbdb bug.
5206 (unless (eq major-mode 'gnus-summary-mode)
5207 (set-buffer gnus-summary-buffer))
5208 (let ((article (or article (gnus-summary-article-number)))
5209 (all-headers (not (not all-headers))) ;Must be T or NIL.
5210 gnus-summary-display-article-function
5213 (gnus-summary-article-pseudo-p article)
5214 (error "This is a pseudo-article."))
5217 (set-buffer gnus-summary-buffer)
5218 (if (or (and gnus-single-article-buffer
5219 (or (null gnus-current-article)
5220 (null gnus-article-current)
5221 (null (get-buffer gnus-article-buffer))
5222 (not (eq article (cdr gnus-article-current)))
5223 (not (equal (car gnus-article-current)
5224 gnus-newsgroup-name))))
5225 (and (not gnus-single-article-buffer)
5226 (or (null gnus-current-article)
5227 (not (eq gnus-current-article article))))
5229 ;; The requested article is different from the current article.
5231 (gnus-summary-display-article article all-headers)
5233 (when (or all-headers gnus-show-all-headers)
5234 (gnus-article-show-all-headers))
5237 (gnus-article-set-window-start
5238 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5240 (defun gnus-summary-set-current-mark (&optional current-mark)
5241 "Obsolete function."
5244 (defun gnus-summary-next-article (&optional unread subject backward push)
5245 "Select the next article.
5246 If UNREAD, only unread articles are selected.
5247 If SUBJECT, only articles with SUBJECT are selected.
5248 If BACKWARD, the previous article is selected instead of the next."
5250 (gnus-set-global-variables)
5252 ;; Is there such an article?
5253 ((and (gnus-summary-search-forward unread subject backward)
5254 (or (gnus-summary-display-article (gnus-summary-article-number))
5255 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5256 (gnus-summary-position-point))
5257 ;; If not, we try the first unread, if that is wanted.
5259 gnus-auto-select-same
5260 (gnus-summary-first-unread-article))
5261 (gnus-summary-position-point)
5262 (gnus-message 6 "Wrapped"))
5263 ;; Try to get next/previous article not displayed in this group.
5264 ((and gnus-auto-extend-newsgroup
5265 (not unread) (not subject))
5266 (gnus-summary-goto-article
5267 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5269 ;; Go to next/previous group.
5271 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5272 (gnus-summary-jump-to-group gnus-newsgroup-name))
5273 (let ((cmd last-command-char)
5276 (set-buffer gnus-group-buffer)
5279 (if (eq gnus-keep-same-level 'best)
5280 (gnus-summary-best-group gnus-newsgroup-name)
5281 (gnus-summary-search-group backward gnus-keep-same-level))))
5282 ;; For some reason, the group window gets selected. We change
5284 (select-window (get-buffer-window (current-buffer)))
5285 ;; Select next unread newsgroup automagically.
5287 ((or (not gnus-auto-select-next)
5289 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5290 ((or (eq gnus-auto-select-next 'quietly)
5291 (and (eq gnus-auto-select-next 'slightly-quietly)
5293 (and (eq gnus-auto-select-next 'almost-quietly)
5294 (gnus-summary-last-article-p)))
5296 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5298 (gnus-message 7 "No more%s articles (%s)..."
5299 (if unread " unread" "")
5300 (if group (concat "selecting " group)
5302 (gnus-summary-next-group nil group backward)))
5304 (when (gnus-key-press-event-p last-input-event)
5305 (gnus-summary-walk-group-buffer
5306 gnus-newsgroup-name cmd unread backward point))))))))
5308 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5309 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5310 (?\C-p (gnus-group-prev-unread-group 1))))
5311 (cursor-in-echo-area t)
5312 keve key group ended)
5314 (set-buffer gnus-group-buffer)
5317 (if (eq gnus-keep-same-level 'best)
5318 (gnus-summary-best-group gnus-newsgroup-name)
5319 (gnus-summary-search-group backward gnus-keep-same-level))))
5322 5 "No more%s articles%s" (if unread " unread" "")
5324 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5325 (format " (Type %s for %s [%s])"
5326 (single-key-description cmd) group
5327 (car (gnus-gethash group gnus-newsrc-hashtb)))
5328 (format " (Type %s to exit %s)"
5329 (single-key-description cmd)
5330 gnus-newsgroup-name)))
5331 ;; Confirm auto selection.
5332 (setq key (car (setq keve (gnus-read-event-char))))
5335 ((assq key keystrokes)
5336 (let ((obuf (current-buffer)))
5337 (switch-to-buffer gnus-group-buffer)
5339 (gnus-group-jump-to-group group))
5340 (eval (cadr (assq key keystrokes)))
5341 (setq group (gnus-group-group-name))
5342 (switch-to-buffer obuf))
5346 (gnus-ephemeral-group-p gnus-newsgroup-name))
5348 (gnus-summary-next-group nil group backward)))
5350 (push (cdr keve) unread-command-events))))))
5352 (defun gnus-summary-next-unread-article ()
5353 "Select unread article after current one."
5355 (gnus-summary-next-article
5356 (or (not (eq gnus-summary-goto-unread 'never))
5357 (gnus-summary-last-article-p (gnus-summary-article-number)))
5358 (and gnus-auto-select-same
5359 (gnus-summary-article-subject))))
5361 (defun gnus-summary-prev-article (&optional unread subject)
5362 "Select the article after the current one.
5363 If UNREAD is non-nil, only unread articles are selected."
5365 (gnus-summary-next-article unread subject t))
5367 (defun gnus-summary-prev-unread-article ()
5368 "Select unread article before current one."
5370 (gnus-summary-prev-article
5371 (or (not (eq gnus-summary-goto-unread 'never))
5372 (gnus-summary-first-article-p (gnus-summary-article-number)))
5373 (and gnus-auto-select-same
5374 (gnus-summary-article-subject))))
5376 (defun gnus-summary-next-page (&optional lines circular)
5377 "Show next page of the selected article.
5378 If at the end of the current article, select the next article.
5379 LINES says how many lines should be scrolled up.
5381 If CIRCULAR is non-nil, go to the start of the article instead of
5382 selecting the next article when reaching the end of the current
5385 (setq gnus-summary-buffer (current-buffer))
5386 (gnus-set-global-variables)
5387 (let ((article (gnus-summary-article-number))
5388 (article-window (get-buffer-window gnus-article-buffer t))
5390 (gnus-configure-windows 'article)
5391 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5392 (if (and (eq gnus-summary-goto-unread 'never)
5393 (not (gnus-summary-last-article-p article)))
5394 (gnus-summary-next-article)
5395 (gnus-summary-next-unread-article))
5396 (if (or (null gnus-current-article)
5397 (null gnus-article-current)
5398 (/= article (cdr gnus-article-current))
5399 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5400 ;; Selected subject is different from current article's.
5401 (gnus-summary-display-article article)
5402 (when article-window
5403 (gnus-eval-in-buffer-window gnus-article-buffer
5404 (setq endp (gnus-article-next-page lines)))
5407 (gnus-summary-beginning-of-article))
5409 (gnus-message 3 "End of message"))
5411 (if (and (eq gnus-summary-goto-unread 'never)
5412 (not (gnus-summary-last-article-p article)))
5413 (gnus-summary-next-article)
5414 (gnus-summary-next-unread-article))))))))
5415 (gnus-summary-recenter)
5416 (gnus-summary-position-point)))
5418 (defun gnus-summary-prev-page (&optional lines)
5419 "Show previous page of selected article.
5420 Argument LINES specifies lines to be scrolled down."
5422 (gnus-set-global-variables)
5423 (let ((article (gnus-summary-article-number))
5424 (article-window (get-buffer-window gnus-article-buffer t)))
5425 (gnus-configure-windows 'article)
5426 (if (or (null gnus-current-article)
5427 (null gnus-article-current)
5428 (/= article (cdr gnus-article-current))
5429 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5430 ;; Selected subject is different from current article's.
5431 (gnus-summary-display-article article)
5432 (gnus-summary-recenter)
5433 (when article-window
5434 (gnus-eval-in-buffer-window gnus-article-buffer
5435 (gnus-article-prev-page lines)))))
5436 (gnus-summary-position-point))
5438 (defun gnus-summary-scroll-up (lines)
5439 "Scroll up (or down) one line current article.
5440 Argument LINES specifies lines to be scrolled up (or down if negative)."
5442 (gnus-set-global-variables)
5443 (gnus-configure-windows 'article)
5444 (gnus-summary-show-thread)
5445 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5446 (gnus-eval-in-buffer-window gnus-article-buffer
5448 (when (gnus-article-next-page lines)
5449 (gnus-message 3 "End of message")))
5451 (gnus-article-prev-page (- lines))))))
5452 (gnus-summary-recenter)
5453 (gnus-summary-position-point))
5455 (defun gnus-summary-next-same-subject ()
5456 "Select next article which has the same subject as current one."
5458 (gnus-set-global-variables)
5459 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5461 (defun gnus-summary-prev-same-subject ()
5462 "Select previous article which has the same subject as current one."
5464 (gnus-set-global-variables)
5465 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5467 (defun gnus-summary-next-unread-same-subject ()
5468 "Select next unread article which has the same subject as current one."
5470 (gnus-set-global-variables)
5471 (gnus-summary-next-article t (gnus-summary-article-subject)))
5473 (defun gnus-summary-prev-unread-same-subject ()
5474 "Select previous unread article which has the same subject as current one."
5476 (gnus-set-global-variables)
5477 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5479 (defun gnus-summary-first-unread-article ()
5480 "Select the first unread article.
5481 Return nil if there are no unread articles."
5483 (gnus-set-global-variables)
5485 (when (gnus-summary-first-subject t)
5486 (gnus-summary-show-thread)
5487 (gnus-summary-first-subject t)
5488 (gnus-summary-display-article (gnus-summary-article-number)))
5489 (gnus-summary-position-point)))
5491 (defun gnus-summary-first-article ()
5492 "Select the first article.
5493 Return nil if there are no articles."
5495 (gnus-set-global-variables)
5497 (when (gnus-summary-first-subject)
5498 (gnus-summary-show-thread)
5499 (gnus-summary-first-subject)
5500 (gnus-summary-display-article (gnus-summary-article-number)))
5501 (gnus-summary-position-point)))
5503 (defun gnus-summary-best-unread-article ()
5504 "Select the unread article with the highest score."
5506 (gnus-set-global-variables)
5507 (let ((best -1000000)
5508 (data gnus-newsgroup-data)
5511 (and (gnus-data-unread-p (car data))
5513 (gnus-summary-article-score (gnus-data-number (car data))))
5516 article (gnus-data-number (car data))))
5517 (setq data (cdr data)))
5520 (gnus-summary-goto-article article)
5521 (error "No unread articles"))
5522 (gnus-summary-position-point))))
5524 (defun gnus-summary-last-subject ()
5525 "Go to the last displayed subject line in the group."
5526 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5528 (gnus-summary-goto-subject article))))
5530 (defun gnus-summary-goto-article (article &optional all-headers force)
5531 "Fetch ARTICLE and display it if it exists.
5532 If ALL-HEADERS is non-nil, no header lines are hidden."
5538 (mapcar (lambda (number) (list (int-to-string number)))
5539 gnus-newsgroup-limit)))
5543 (if (gnus-summary-goto-subject article force)
5544 (gnus-summary-display-article article all-headers)
5545 (gnus-message 4 "Couldn't go to article %s" article) nil)
5546 (gnus-summary-position-point)))
5548 (defun gnus-summary-goto-last-article ()
5549 "Go to the previously read article."
5552 (when gnus-last-article
5553 (gnus-summary-goto-article gnus-last-article))
5554 (gnus-summary-position-point)))
5556 (defun gnus-summary-pop-article (number)
5557 "Pop one article off the history and go to the previous.
5558 NUMBER articles will be popped off."
5561 (setq gnus-newsgroup-history
5562 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5564 (gnus-summary-goto-article (car to))
5565 (error "Article history empty")))
5566 (gnus-summary-position-point))
5568 ;; Summary commands and functions for limiting the summary buffer.
5570 (defun gnus-summary-limit-to-articles (n)
5571 "Limit the summary buffer to the next N articles.
5572 If not given a prefix, use the process marked articles instead."
5574 (gnus-set-global-variables)
5576 (let ((articles (gnus-summary-work-articles n)))
5577 (setq gnus-newsgroup-processable nil)
5578 (gnus-summary-limit articles))
5579 (gnus-summary-position-point)))
5581 (defun gnus-summary-pop-limit (&optional total)
5582 "Restore the previous limit.
5583 If given a prefix, remove all limits."
5585 (gnus-set-global-variables)
5587 (setq gnus-newsgroup-limits
5588 (list (mapcar (lambda (h) (mail-header-number h))
5589 gnus-newsgroup-headers))))
5590 (unless gnus-newsgroup-limits
5591 (error "No limit to pop"))
5593 (gnus-summary-limit nil 'pop)
5594 (gnus-summary-position-point)))
5596 (defun gnus-summary-limit-to-subject (subject &optional header)
5597 "Limit the summary buffer to articles that have subjects that match a regexp."
5598 (interactive "sLimit to subject (regexp): ")
5600 (setq header "subject"))
5601 (when (not (equal "" subject))
5603 (let ((articles (gnus-summary-find-matching
5604 (or header "subject") subject 'all)))
5606 (error "Found no matches for \"%s\"" subject))
5607 (gnus-summary-limit articles))
5608 (gnus-summary-position-point))))
5610 (defun gnus-summary-limit-to-author (from)
5611 "Limit the summary buffer to articles that have authors that match a regexp."
5612 (interactive "sLimit to author (regexp): ")
5613 (gnus-summary-limit-to-subject from "from"))
5615 (defun gnus-summary-limit-to-age (age &optional younger-p)
5616 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5617 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5618 articles that are younger than AGE days."
5619 (interactive "nTime in days: \nP")
5621 (let ((data gnus-newsgroup-data)
5622 (cutoff (nnmail-days-to-time age))
5623 articles d date is-younger)
5624 (while (setq d (pop data))
5625 (when (and (vectorp (gnus-data-header d))
5626 (setq date (mail-header-date (gnus-data-header d))))
5627 (setq is-younger (nnmail-time-less
5628 (nnmail-time-since (nnmail-date-to-time date))
5630 (when (if younger-p is-younger (not is-younger))
5631 (push (gnus-data-number d) articles))))
5632 (gnus-summary-limit (nreverse articles)))
5633 (gnus-summary-position-point)))
5635 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5637 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5639 (defun gnus-summary-limit-to-unread (&optional all)
5640 "Limit the summary buffer to articles that are not marked as read.
5641 If ALL is non-nil, limit strictly to unread articles."
5644 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5645 (gnus-summary-limit-to-marks
5646 ;; Concat all the marks that say that an article is read and have
5648 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5649 gnus-killed-mark gnus-kill-file-mark
5650 gnus-low-score-mark gnus-expirable-mark
5651 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5652 gnus-duplicate-mark)
5655 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5656 (make-obsolete 'gnus-summary-delete-marked-with
5657 'gnus-summary-limit-exlude-marks)
5659 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5660 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5661 If REVERSE, limit the summary buffer to articles that are marked
5662 with MARKS. MARKS can either be a string of marks or a list of marks.
5663 Returns how many articles were removed."
5664 (interactive "sMarks: ")
5665 (gnus-summary-limit-to-marks marks t))
5667 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5668 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5669 If REVERSE (the prefix), limit the summary buffer to articles that are
5670 not marked with MARKS. MARKS can either be a string of marks or a
5672 Returns how many articles were removed."
5673 (interactive (list (read-string "Marks: ") current-prefix-arg))
5674 (gnus-set-global-variables)
5676 (let ((data gnus-newsgroup-data)
5677 (marks (if (listp marks) marks
5678 (append marks nil))) ; Transform to list.
5681 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5682 (memq (gnus-data-mark (car data)) marks))
5683 (push (gnus-data-number (car data)) articles))
5684 (setq data (cdr data)))
5685 (gnus-summary-limit articles))
5686 (gnus-summary-position-point)))
5688 (defun gnus-summary-limit-to-score (&optional score)
5689 "Limit to articles with score at or above SCORE."
5691 (gnus-set-global-variables)
5692 (setq score (if score
5693 (prefix-numeric-value score)
5694 (or gnus-summary-default-score 0)))
5695 (let ((data gnus-newsgroup-data)
5698 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5700 (push (gnus-data-number (car data)) articles))
5701 (setq data (cdr data)))
5703 (gnus-summary-limit articles)
5704 (gnus-summary-position-point))))
5706 (defun gnus-summary-limit-include-dormant ()
5707 "Display all the hidden articles that are marked as dormant."
5709 (gnus-set-global-variables)
5710 (unless gnus-newsgroup-dormant
5711 (error "There are no dormant articles in this group"))
5713 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5714 (gnus-summary-position-point)))
5716 (defun gnus-summary-limit-exclude-dormant ()
5717 "Hide all dormant articles."
5719 (gnus-set-global-variables)
5721 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5722 (gnus-summary-position-point)))
5724 (defun gnus-summary-limit-exclude-childless-dormant ()
5725 "Hide all dormant articles that have no children."
5727 (gnus-set-global-variables)
5728 (let ((data (gnus-data-list t))
5729 articles d children)
5730 ;; Find all articles that are either not dormant or have
5732 (while (setq d (pop data))
5733 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5735 (gnus-article-children (gnus-data-number d)))
5738 (when (memq (car children) articles)
5743 (push (gnus-data-number d) articles)))
5746 (gnus-summary-limit articles)
5747 (gnus-summary-position-point))))
5749 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5750 "Mark all unread excluded articles as read.
5751 If ALL, mark even excluded ticked and dormants as read."
5753 (let ((articles (gnus-sorted-complement
5755 (mapcar (lambda (h) (mail-header-number h))
5756 gnus-newsgroup-headers)
5758 (sort gnus-newsgroup-limit '<)))
5760 (setq gnus-newsgroup-unreads nil)
5762 (setq gnus-newsgroup-dormant nil
5763 gnus-newsgroup-marked nil
5764 gnus-newsgroup-reads
5766 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5767 gnus-newsgroup-reads))
5768 (while (setq article (pop articles))
5769 (unless (or (memq article gnus-newsgroup-dormant)
5770 (memq article gnus-newsgroup-marked))
5771 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5773 (defun gnus-summary-limit (articles &optional pop)
5775 ;; We pop the previous limit off the stack and use that.
5776 (setq articles (car gnus-newsgroup-limits)
5777 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5778 ;; We use the new limit, so we push the old limit on the stack.
5779 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5781 (setq gnus-newsgroup-limit articles)
5782 (let ((total (length gnus-newsgroup-data))
5783 (data (gnus-data-find-list (gnus-summary-article-number)))
5784 (gnus-summary-mark-below nil) ; Inhibit this.
5786 ;; This will do all the work of generating the new summary buffer
5787 ;; according to the new limit.
5788 (gnus-summary-prepare)
5789 ;; Hide any threads, possibly.
5790 (and gnus-show-threads
5791 gnus-thread-hide-subtree
5792 (gnus-summary-hide-all-threads))
5793 ;; Try to return to the article you were at, or one in the
5796 ;; We try to find some article after the current one.
5798 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5801 (setq data (cdr data))))
5803 ;; If there is no data, that means that we were after the last
5804 ;; article. The same goes when we can't find any articles
5805 ;; after the current one.
5806 (goto-char (point-max))
5807 (gnus-summary-find-prev))
5808 ;; We return how many articles were removed from the summary
5809 ;; buffer as a result of the new limit.
5810 (- total (length gnus-newsgroup-data))))
5812 (defsubst gnus-invisible-cut-children (threads)
5815 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
5820 (defsubst gnus-cut-thread (thread)
5821 "Go forwards in the thread until we find an article that we want to display."
5822 (when (or (eq gnus-fetch-old-headers 'some)
5823 (eq gnus-build-sparse-threads 'some)
5824 (eq gnus-build-sparse-threads 'more))
5825 ;; Deal with old-fetched headers and sparse threads.
5829 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
5830 (gnus-summary-article-ancient-p
5831 (mail-header-number (car thread))))
5833 (if (<= (length (cdr thread)) 1)
5834 (setq thread (cadr thread))
5835 (when (gnus-invisible-cut-children (cdr thread))
5836 (let ((th (cdr thread)))
5838 (if (memq (mail-header-number (caar th))
5839 gnus-newsgroup-limit)
5840 (setq thread (car th)
5842 (setq th (cdr th)))))))))
5846 (defun gnus-cut-threads (threads)
5847 "Cut off all uninteresting articles from the beginning of threads."
5848 (when (or (eq gnus-fetch-old-headers 'some)
5849 (eq gnus-build-sparse-threads 'some)
5850 (eq gnus-build-sparse-threads 'more))
5853 (setcar th (gnus-cut-thread (car th)))
5854 (setq th (cdr th)))))
5855 ;; Remove nixed out threads.
5858 (defun gnus-summary-initial-limit (&optional show-if-empty)
5859 "Figure out what the initial limit is supposed to be on group entry.
5860 This entails weeding out unwanted dormants, low-scored articles,
5861 fetch-old-headers verbiage, and so on."
5862 ;; Most groups have nothing to remove.
5863 (if (or gnus-inhibit-limiting
5864 (and (null gnus-newsgroup-dormant)
5865 (not (eq gnus-fetch-old-headers 'some))
5866 (null gnus-summary-expunge-below)
5867 (not (eq gnus-build-sparse-threads 'some))
5868 (not (eq gnus-build-sparse-threads 'more))
5869 (null gnus-thread-expunge-below)
5870 (not gnus-use-nocem)))
5872 (push gnus-newsgroup-limit gnus-newsgroup-limits)
5873 (setq gnus-newsgroup-limit nil)
5876 (unless (car (symbol-value node))
5877 ;; These threads have no parents -- they are roots.
5878 (let ((nodes (cdr (symbol-value node)))
5881 (if (and gnus-thread-expunge-below
5882 (< (gnus-thread-total-score (car nodes))
5883 gnus-thread-expunge-below))
5884 (gnus-expunge-thread (pop nodes))
5885 (setq thread (pop nodes))
5886 (gnus-summary-limit-children thread))))))
5887 gnus-newsgroup-dependencies)
5888 ;; If this limitation resulted in an empty group, we might
5889 ;; pop the previous limit and use it instead.
5890 (when (and (not gnus-newsgroup-limit)
5892 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
5893 gnus-newsgroup-limit))
5895 (defun gnus-summary-limit-children (thread)
5896 "Return 1 if this subthread is visible and 0 if it is not."
5897 ;; First we get the number of visible children to this thread. This
5898 ;; is done by recursing down the thread using this function, so this
5899 ;; will really go down to a leaf article first, before slowly
5900 ;; working its way up towards the root.
5904 (apply '+ (mapcar 'gnus-summary-limit-children
5907 (number (mail-header-number (car thread)))
5910 (not (memq number gnus-newsgroup-marked))
5912 ;; If this article is dormant and has absolutely no visible
5913 ;; children, then this article isn't visible.
5914 (and (memq number gnus-newsgroup-dormant)
5916 ;; If this is "fetch-old-headered" and there is no
5917 ;; visible children, then we don't want this article.
5918 (and (eq gnus-fetch-old-headers 'some)
5919 (gnus-summary-article-ancient-p number)
5921 ;; If this is a sparsely inserted article with no children,
5922 ;; we don't want it.
5923 (and (eq gnus-build-sparse-threads 'some)
5924 (gnus-summary-article-sparse-p number)
5926 ;; If we use expunging, and this article is really
5927 ;; low-scored, then we don't want this article.
5928 (when (and gnus-summary-expunge-below
5930 (or (cdr (assq number gnus-newsgroup-scored))
5931 gnus-summary-default-score))
5932 gnus-summary-expunge-below))
5933 ;; We increase the expunge-tally here, but that has
5934 ;; nothing to do with the limits, really.
5935 (incf gnus-newsgroup-expunged-tally)
5936 ;; We also mark as read here, if that's wanted.
5937 (when (and gnus-summary-mark-below
5938 (< score gnus-summary-mark-below))
5939 (setq gnus-newsgroup-unreads
5940 (delq number gnus-newsgroup-unreads))
5941 (if gnus-newsgroup-auto-expire
5942 (push number gnus-newsgroup-expirable)
5943 (push (cons number gnus-low-score-mark)
5944 gnus-newsgroup-reads)))
5946 ;; Check NoCeM things.
5947 (if (and gnus-use-nocem
5948 (gnus-nocem-unwanted-article-p
5949 (mail-header-id (car thread))))
5951 (setq gnus-newsgroup-reads
5952 (delq number gnus-newsgroup-unreads))
5954 ;; Nope, invisible article.
5956 ;; Ok, this article is to be visible, so we add it to the limit
5958 (push number gnus-newsgroup-limit)
5961 (defun gnus-expunge-thread (thread)
5962 "Mark all articles in THREAD as read."
5963 (let* ((number (mail-header-number (car thread))))
5964 (incf gnus-newsgroup-expunged-tally)
5965 ;; We also mark as read here, if that's wanted.
5966 (setq gnus-newsgroup-unreads
5967 (delq number gnus-newsgroup-unreads))
5968 (if gnus-newsgroup-auto-expire
5969 (push number gnus-newsgroup-expirable)
5970 (push (cons number gnus-low-score-mark)
5971 gnus-newsgroup-reads)))
5972 ;; Go recursively through all subthreads.
5973 (mapcar 'gnus-expunge-thread (cdr thread)))
5975 ;; Summary article oriented commands
5977 (defun gnus-summary-refer-parent-article (n)
5978 "Refer parent article N times.
5979 If N is negative, go to ancestor -N instead.
5980 The difference between N and the number of articles fetched is returned."
5982 (gnus-set-global-variables)
5985 (when (not (natnump n))
5990 (setq header (gnus-summary-article-header))
5991 (if (and (eq (mail-header-number header)
5992 (cdr gnus-article-current))
5993 (equal gnus-newsgroup-name
5994 (car gnus-article-current)))
5995 ;; If we try to find the parent of the currently
5996 ;; displayed article, then we take a look at the actual
5997 ;; References header, since this is slightly more
5998 ;; reliable than the References field we got from the
6001 (set-buffer gnus-original-article-buffer)
6002 (nnheader-narrow-to-headers)
6003 (unless (setq ref (message-fetch-field "references"))
6004 (setq ref (message-fetch-field "in-reply-to")))
6007 ;; It's not the current article, so we take a bet on
6008 ;; the value we got from the server.
6009 (mail-header-references header)))
6011 (not (equal ref "")))
6012 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6013 (gnus-message 1 "Couldn't find parent"))
6014 (gnus-message 1 "No references in article %d"
6015 (gnus-summary-article-number))
6018 (gnus-summary-position-point)
6021 (defun gnus-summary-refer-references ()
6022 "Fetch all articles mentioned in the References header.
6023 Return how many articles were fetched."
6025 (gnus-set-global-variables)
6026 (let ((ref (mail-header-references (gnus-summary-article-header)))
6027 (current (gnus-summary-article-number))
6031 (error "No References in the current article")
6032 ;; For each Message-ID in the References header...
6033 (while (string-match "<[^>]*>" ref)
6035 ;; ... fetch that article.
6036 (gnus-summary-refer-article
6037 (prog1 (match-string 0 ref)
6038 (setq ref (substring ref (match-end 0))))))
6039 (gnus-summary-goto-subject current)
6040 (gnus-summary-position-point)
6043 (defun gnus-summary-refer-article (message-id)
6044 "Fetch an article specified by MESSAGE-ID."
6045 (interactive "sMessage-ID: ")
6046 (when (and (stringp message-id)
6047 (not (zerop (length message-id))))
6048 ;; Construct the correct Message-ID if necessary.
6049 ;; Suggested by tale@pawl.rpi.edu.
6050 (unless (string-match "^<" message-id)
6051 (setq message-id (concat "<" message-id)))
6052 (unless (string-match ">$" message-id)
6053 (setq message-id (concat message-id ">")))
6054 (let* ((header (gnus-id-to-header message-id))
6056 (gnus-summary-article-sparse-p
6057 (mail-header-number header)))))
6060 ;; The article is present in the buffer, to we just go to it.
6061 (gnus-summary-goto-article
6062 (mail-header-number header) nil header)
6064 (gnus-summary-update-article (mail-header-number header))))
6065 ;; We fetch the article
6066 (let ((gnus-override-method
6067 (and (gnus-news-group-p gnus-newsgroup-name)
6068 gnus-refer-article-method))
6070 ;; Start the special refer-article method, if necessary.
6071 (when (and gnus-refer-article-method
6072 (gnus-news-group-p gnus-newsgroup-name))
6073 (gnus-check-server gnus-refer-article-method))
6074 ;; Fetch the header, and display the article.
6075 (if (setq number (gnus-summary-insert-subject message-id))
6076 (gnus-summary-select-article nil nil nil number)
6077 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6079 (defun gnus-summary-enter-digest-group (&optional force)
6080 "Enter an nndoc group based on the current article.
6081 If FORCE, force a digest interpretation. If not, try
6082 to guess what the document format is."
6084 (gnus-set-global-variables)
6085 (let ((conf gnus-current-window-configuration))
6087 (gnus-summary-select-article))
6088 (setq gnus-current-window-configuration conf)
6089 (let* ((name (format "%s-%d"
6090 (gnus-group-prefixed-name
6091 gnus-newsgroup-name (list 'nndoc ""))
6093 (set-buffer gnus-summary-buffer)
6094 gnus-current-article)))
6095 (ogroup gnus-newsgroup-name)
6096 (params (append (gnus-info-params (gnus-get-info ogroup))
6097 (list (cons 'to-group ogroup))))
6098 (case-fold-search t)
6099 (buf (current-buffer))
6102 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6103 (insert-buffer-substring gnus-original-article-buffer)
6104 ;; Remove lines that may lead nndoc to misinterpret the
6107 (goto-char (point-min))
6108 (or (search-forward "\n\n" nil t) (point)))
6109 (goto-char (point-min))
6110 (delete-matching-lines "^\\(Path\\):\\|^From ")
6113 (if (gnus-group-read-ephemeral-group
6114 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6116 ,(if force 'digest 'guess))) t)
6117 ;; Make all postings to this group go to the parent group.
6118 (nconc (gnus-info-params (gnus-get-info name))
6120 ;; Couldn't select this doc group.
6121 (switch-to-buffer buf)
6122 (gnus-set-global-variables)
6123 (gnus-configure-windows 'summary)
6124 (gnus-message 3 "Article couldn't be entered?"))
6125 (kill-buffer dig)))))
6127 (defun gnus-summary-read-document (n)
6128 "Open a new group based on the current article(s).
6129 This will allow you to read digests and other similar
6130 documents as newsgroups.
6131 Obeys the standard process/prefix convention."
6133 (let* ((articles (gnus-summary-work-articles n))
6134 (ogroup gnus-newsgroup-name)
6135 (params (append (gnus-info-params (gnus-get-info ogroup))
6136 (list (cons 'to-group ogroup))))
6137 article group egroup groups vgroup)
6138 (while (setq article (pop articles))
6139 (setq group (format "%s-%d" gnus-newsgroup-name article))
6140 (gnus-summary-remove-process-mark article)
6141 (when (gnus-summary-display-article article)
6143 (nnheader-temp-write nil
6144 (insert-buffer-substring gnus-original-article-buffer)
6145 ;; Remove some headers that may lead nndoc to make
6147 (message-narrow-to-head)
6148 (goto-char (point-min))
6149 (delete-matching-lines "^\\(Path\\):\\|^From ")
6152 (gnus-group-read-ephemeral-group
6153 group `(nndoc ,group (nndoc-address ,(current-buffer))
6154 (nndoc-article-type guess))
6157 ;; Make all postings to this group go to the parent group.
6158 (nconc (gnus-info-params (gnus-get-info egroup))
6160 (push egroup groups))
6161 ;; Couldn't select this doc group.
6162 (gnus-error 3 "Article couldn't be entered"))))))
6163 ;; Now we have selected all the documents.
6166 (error "None of the articles could be interpreted as documents"))
6167 ((gnus-group-read-ephemeral-group
6168 (setq vgroup (format
6169 "nnvirtual:%s-%s" gnus-newsgroup-name
6170 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6171 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6173 (cons (current-buffer) 'summary)))
6175 (error "Couldn't select virtual nndoc group")))))
6177 (defun gnus-summary-isearch-article (&optional regexp-p)
6178 "Do incremental search forward on the current article.
6179 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6181 (gnus-set-global-variables)
6182 (gnus-summary-select-article)
6183 (gnus-configure-windows 'article)
6184 (gnus-eval-in-buffer-window gnus-article-buffer
6185 ;;(goto-char (point-min))
6186 (isearch-forward regexp-p)))
6188 (defun gnus-summary-search-article-forward (regexp &optional backward)
6189 "Search for an article containing REGEXP forward.
6190 If BACKWARD, search backward instead."
6193 (format "Search article %s (regexp%s): "
6194 (if current-prefix-arg "backward" "forward")
6195 (if gnus-last-search-regexp
6196 (concat ", default " gnus-last-search-regexp)
6198 current-prefix-arg))
6199 (gnus-set-global-variables)
6200 (if (string-equal regexp "")
6201 (setq regexp (or gnus-last-search-regexp ""))
6202 (setq gnus-last-search-regexp regexp))
6203 (if (gnus-summary-search-article regexp backward)
6204 (gnus-summary-show-thread)
6205 (error "Search failed: \"%s\"" regexp)))
6207 (defun gnus-summary-search-article-backward (regexp)
6208 "Search for an article containing REGEXP backward."
6211 (format "Search article backward (regexp%s): "
6212 (if gnus-last-search-regexp
6213 (concat ", default " gnus-last-search-regexp)
6215 (gnus-summary-search-article-forward regexp 'backward))
6217 (defun gnus-summary-search-article (regexp &optional backward)
6218 "Search for an article containing REGEXP.
6219 Optional argument BACKWARD means do search for backward.
6220 `gnus-select-article-hook' is not called during the search."
6221 (let ((gnus-select-article-hook nil) ;Disable hook.
6222 (gnus-article-display-hook nil)
6223 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6224 (gnus-use-article-prefetch nil)
6225 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6226 (sum (current-buffer))
6229 (gnus-save-hidden-threads
6230 (gnus-summary-select-article)
6231 (set-buffer gnus-article-buffer)
6235 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6237 (re-search-backward regexp nil t)
6238 (re-search-forward regexp nil t))
6239 ;; We found the regexp.
6244 (get-buffer-window (current-buffer))
6248 (setq point (point)))
6249 ;; We didn't find it, so we go to the next article.
6252 (while (eq found 'not)
6253 (if (not (if backward (gnus-summary-find-prev)
6254 (gnus-summary-find-next)))
6255 ;; No more articles.
6257 ;; Select the next article and adjust point.
6258 (unless (gnus-summary-article-sparse-p
6259 (gnus-summary-article-number))
6261 (gnus-summary-select-article)
6262 (set-buffer gnus-article-buffer)
6264 (goto-char (if backward (point-max) (point-min))))))))
6265 (gnus-message 7 ""))
6266 ;; Return whether we found the regexp.
6267 (when (eq found 'found)
6269 (gnus-summary-show-thread)
6270 (gnus-summary-goto-subject gnus-current-article)
6271 (gnus-summary-position-point)
6274 (defun gnus-summary-find-matching (header regexp &optional backward unread
6276 "Return a list of all articles that match REGEXP on HEADER.
6277 The search stars on the current article and goes forwards unless
6278 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6279 If UNREAD is non-nil, only unread articles will
6280 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6281 in the comparisons."
6282 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6283 (gnus-data-find-list
6284 (gnus-summary-article-number) (gnus-data-list backward))))
6285 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6286 (case-fold-search (not not-case-fold))
6288 (unless (fboundp (intern (concat "mail-header-" header)))
6289 (error "%s is not a valid header" header))
6292 (and (or (not unread) ; We want all articles...
6293 (gnus-data-unread-p d)) ; Or just unreads.
6294 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6295 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6296 (push (gnus-data-number d) articles)) ; Success!
6297 (setq data (cdr data)))
6298 (nreverse articles)))
6300 (defun gnus-summary-execute-command (header regexp command &optional backward)
6301 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6302 If HEADER is an empty string (or nil), the match is done on the entire
6303 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6305 (list (let ((completion-ignore-case t))
6308 (mapcar (lambda (string) (list string))
6309 '("Number" "Subject" "From" "Lines" "Date"
6310 "Message-ID" "Xref" "References" "Body"))
6311 nil 'require-match))
6312 (read-string "Regexp: ")
6313 (read-key-sequence "Command: ")
6314 current-prefix-arg))
6315 (when (equal header "Body")
6317 (gnus-set-global-variables)
6318 ;; Hidden thread subtrees must be searched as well.
6319 (gnus-summary-show-all-threads)
6320 ;; We don't want to change current point nor window configuration.
6322 (save-window-excursion
6323 (gnus-message 6 "Executing %s..." (key-description command))
6324 ;; We'd like to execute COMMAND interactively so as to give arguments.
6325 (gnus-execute header regexp
6326 `(call-interactively ',(key-binding command))
6328 (gnus-message 6 "Executing %s...done" (key-description command)))))
6330 (defun gnus-summary-beginning-of-article ()
6331 "Scroll the article back to the beginning."
6333 (gnus-set-global-variables)
6334 (gnus-summary-select-article)
6335 (gnus-configure-windows 'article)
6336 (gnus-eval-in-buffer-window gnus-article-buffer
6338 (goto-char (point-min))
6339 (when gnus-break-pages
6340 (gnus-narrow-to-page))))
6342 (defun gnus-summary-end-of-article ()
6343 "Scroll to the end of the article."
6345 (gnus-set-global-variables)
6346 (gnus-summary-select-article)
6347 (gnus-configure-windows 'article)
6348 (gnus-eval-in-buffer-window gnus-article-buffer
6350 (goto-char (point-max))
6352 (when gnus-break-pages
6353 (gnus-narrow-to-page))))
6355 (defun gnus-summary-print-article (&optional filename)
6356 "Generate and print a PostScript image of the article buffer.
6358 If the optional argument FILENAME is nil, send the image to the printer.
6359 If FILENAME is a string, save the PostScript image in a file with that
6360 name. If FILENAME is a number, prompt the user for the name of the file
6362 (interactive (list (ps-print-preprint current-prefix-arg)))
6363 (gnus-summary-select-article)
6364 (gnus-eval-in-buffer-window gnus-article-buffer
6365 (let ((buffer (generate-new-buffer " *print*")))
6368 (copy-to-buffer buffer (point-min) (point-max))
6370 (gnus-article-delete-invisible-text)
6371 (run-hooks 'gnus-ps-print-hook)
6372 (ps-print-buffer-with-faces filename))
6373 (kill-buffer buffer)))))
6375 (defun gnus-summary-show-article (&optional arg)
6376 "Force re-fetching of the current article.
6377 If ARG (the prefix) is non-nil, show the raw article without any
6378 article massaging functions being run."
6380 (gnus-set-global-variables)
6382 ;; Select the article the normal way.
6383 (gnus-summary-select-article nil 'force)
6384 ;; Bind the article treatment functions to nil.
6385 (let ((gnus-have-all-headers t)
6386 gnus-article-display-hook
6387 gnus-article-prepare-hook
6390 (gnus-summary-select-article nil 'force)))
6391 (gnus-summary-goto-subject gnus-current-article)
6392 ; (gnus-configure-windows 'article)
6393 (gnus-summary-position-point))
6395 (defun gnus-summary-verbose-headers (&optional arg)
6396 "Toggle permanent full header display.
6397 If ARG is a positive number, turn header display on.
6398 If ARG is a negative number, turn header display off."
6400 (gnus-set-global-variables)
6401 (setq gnus-show-all-headers
6402 (cond ((or (not (numberp arg))
6404 (not gnus-show-all-headers))
6407 (gnus-summary-show-article))
6409 (defun gnus-summary-toggle-header (&optional arg)
6410 "Show the headers if they are hidden, or hide them if they are shown.
6411 If ARG is a positive number, show the entire header.
6412 If ARG is a negative number, hide the unwanted header lines."
6414 (gnus-set-global-variables)
6416 (set-buffer gnus-article-buffer)
6417 (let* ((buffer-read-only nil)
6418 (inhibit-point-motion-hooks t)
6419 (hidden (text-property-any
6420 (goto-char (point-min)) (search-forward "\n\n")
6423 (goto-char (point-min))
6424 (when (search-forward "\n\n" nil t)
6425 (delete-region (point-min) (1- (point))))
6426 (goto-char (point-min))
6428 (set-buffer gnus-original-article-buffer)
6429 (goto-char (point-min))
6430 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6431 (insert-buffer-substring gnus-original-article-buffer 1 e)
6432 (let ((article-inhibit-hiding t))
6433 (run-hooks 'gnus-article-display-hook))
6434 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6435 (gnus-article-hide-headers)))))
6437 (defun gnus-summary-show-all-headers ()
6438 "Make all header lines visible."
6440 (gnus-set-global-variables)
6441 (gnus-article-show-all-headers))
6443 (defun gnus-summary-toggle-mime (&optional arg)
6444 "Toggle MIME processing.
6445 If ARG is a positive number, turn MIME processing on."
6447 (gnus-set-global-variables)
6448 (setq gnus-show-mime
6449 (if (null arg) (not gnus-show-mime)
6450 (> (prefix-numeric-value arg) 0)))
6451 (gnus-summary-select-article t 'force))
6453 (defun gnus-summary-caesar-message (&optional arg)
6454 "Caesar rotate the current article by 13.
6455 The numerical prefix specifies how many places to rotate each letter
6458 (gnus-set-global-variables)
6459 (gnus-summary-select-article)
6460 (let ((mail-header-separator ""))
6461 (gnus-eval-in-buffer-window gnus-article-buffer
6464 (let ((start (window-start))
6466 (message-caesar-buffer-body arg)
6467 (set-window-start (get-buffer-window (current-buffer)) start))))))
6469 (defun gnus-summary-stop-page-breaking ()
6470 "Stop page breaking in the current article."
6472 (gnus-set-global-variables)
6473 (gnus-summary-select-article)
6474 (gnus-eval-in-buffer-window gnus-article-buffer
6476 (when (gnus-visual-p 'page-marker)
6477 (let ((buffer-read-only nil))
6478 (gnus-remove-text-with-property 'gnus-prev)
6479 (gnus-remove-text-with-property 'gnus-next)))))
6481 (defun gnus-summary-move-article (&optional n to-newsgroup
6482 select-method action)
6483 "Move the current article to a different newsgroup.
6484 If N is a positive number, move the N next articles.
6485 If N is a negative number, move the N previous articles.
6486 If N is nil and any articles have been marked with the process mark,
6487 move those articles instead.
6488 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6489 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6490 re-spool using this method.
6492 For this function to work, both the current newsgroup and the
6493 newsgroup that you want to move to have to support the `request-move'
6494 and `request-accept' functions."
6497 (setq action 'move))
6498 (gnus-set-global-variables)
6499 ;; Disable marking as read.
6500 (let (gnus-mark-article-hook)
6501 (save-window-excursion
6502 (gnus-summary-select-article)))
6503 ;; Check whether the source group supports the required functions.
6504 (cond ((and (eq action 'move)
6505 (not (gnus-check-backend-function
6506 'request-move-article gnus-newsgroup-name)))
6507 (error "The current group does not support article moving"))
6508 ((and (eq action 'crosspost)
6509 (not (gnus-check-backend-function
6510 'request-replace-article gnus-newsgroup-name)))
6511 (error "The current group does not support article editing")))
6512 (let ((articles (gnus-summary-work-articles n))
6513 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6514 (names '((move "Move" "Moving")
6515 (copy "Copy" "Copying")
6516 (crosspost "Crosspost" "Crossposting")))
6517 (copy-buf (save-excursion
6518 (nnheader-set-temp-buffer " *copy article*")))
6519 art-group to-method new-xref article to-groups)
6520 (unless (assq action names)
6521 (error "Unknown action %s" action))
6522 ;; Read the newsgroup name.
6523 (when (and (not to-newsgroup)
6524 (not select-method))
6526 (gnus-read-move-group-name
6527 (cadr (assq action names))
6528 (symbol-value (intern (format "gnus-current-%s-group" action)))
6530 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6531 (setq to-method (or select-method
6532 (gnus-group-name-to-method to-newsgroup)))
6533 ;; Check the method we are to move this article to...
6534 (unless (gnus-check-backend-function
6535 'request-accept-article (car to-method))
6536 (error "%s does not support article copying" (car to-method)))
6537 (unless (gnus-check-server to-method)
6538 (error "Can't open server %s" (car to-method)))
6539 (gnus-message 6 "%s to %s: %s..."
6540 (caddr (assq action names))
6541 (or (car select-method) to-newsgroup) articles)
6543 (setq article (pop articles))
6547 ;; Move the article.
6549 (gnus-request-move-article
6550 article ; Article to move
6551 gnus-newsgroup-name ; From newsgroup
6552 (nth 1 (gnus-find-method-for-group
6553 gnus-newsgroup-name)) ; Server
6554 (list 'gnus-request-accept-article
6555 to-newsgroup (list 'quote select-method)
6556 (not articles)) ; Accept form
6557 (not articles))) ; Only save nov last time
6558 ;; Copy the article.
6561 (set-buffer copy-buf)
6562 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6563 (gnus-request-accept-article
6564 to-newsgroup select-method (not articles))))
6565 ;; Crosspost the article.
6566 ((eq action 'crosspost)
6567 (let ((xref (message-tokenize-header
6568 (mail-header-xref (gnus-summary-article-header article))
6570 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6573 (setq xref (list (system-name))))
6576 (mapconcat 'identity
6577 (delete "Xref:" (delete new-xref xref))
6581 (set-buffer copy-buf)
6582 ;; First put the article in the destination group.
6583 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6585 (gnus-request-accept-article
6586 to-newsgroup select-method (not articles)))
6587 (setq new-xref (concat new-xref " " (car art-group)
6588 ":" (cdr art-group)))
6589 ;; Now we have the new Xrefs header, so we insert
6590 ;; it and replace the new article.
6591 (nnheader-replace-header "Xref" new-xref)
6592 (gnus-request-replace-article
6593 (cdr art-group) to-newsgroup (current-buffer))
6596 (gnus-message 1 "Couldn't %s article %s"
6597 (cadr (assq action names)) article)
6600 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6602 (gnus-group-prefixed-name
6605 (gnus-find-method-for-group to-newsgroup)))
6606 gnus-newsrc-hashtb)))
6607 (info (nth 2 entry))
6608 (to-group (gnus-info-group info)))
6609 ;; Update the group that has been moved to.
6611 (memq action '(move copy)))
6612 (unless (member to-group to-groups)
6613 (push to-group to-groups))
6615 (unless (memq article gnus-newsgroup-unreads)
6617 info (gnus-add-to-range (gnus-info-read info)
6618 (list (cdr art-group)))))
6620 ;; Copy any marks over to the new group.
6621 (let ((marks gnus-article-mark-lists)
6622 (to-article (cdr art-group)))
6624 ;; See whether the article is to be put in the cache.
6625 (when gnus-use-cache
6626 (gnus-cache-possibly-enter-article
6628 (let ((header (copy-sequence
6629 (gnus-summary-article-header article))))
6630 (mail-header-set-number header to-article)
6632 (memq article gnus-newsgroup-marked)
6633 (memq article gnus-newsgroup-dormant)
6634 (memq article gnus-newsgroup-unreads)))
6636 (when (and (equal to-group gnus-newsgroup-name)
6637 (not (memq article gnus-newsgroup-unreads)))
6638 ;; Mark this article as read in this group.
6639 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
6640 (setcdr (gnus-active to-group) to-article)
6641 (setcdr gnus-newsgroup-active to-article))
6644 (when (memq article (symbol-value
6645 (intern (format "gnus-newsgroup-%s"
6647 ;; If the other group is the same as this group,
6648 ;; then we have to add the mark to the list.
6649 (when (equal to-group gnus-newsgroup-name)
6650 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6653 (intern (format "gnus-newsgroup-%s"
6655 ;; Copy the marks to other group.
6656 (gnus-add-marked-articles
6657 to-group (cdar marks) (list to-article) info))
6658 (setq marks (cdr marks)))))
6660 ;; Update the Xref header in this article to point to
6661 ;; the new crossposted article we have just created.
6662 (when (eq action 'crosspost)
6664 (set-buffer copy-buf)
6665 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6666 (nnheader-replace-header "Xref" new-xref)
6667 (gnus-request-replace-article
6668 article gnus-newsgroup-name (current-buffer)))))
6670 (gnus-summary-goto-subject article)
6671 (when (eq action 'move)
6672 (gnus-summary-mark-article article gnus-canceled-mark)))
6673 (gnus-summary-remove-process-mark article))
6674 ;; Re-activate all groups that have been moved to.
6676 (gnus-activate-group (pop to-groups)))
6678 (gnus-kill-buffer copy-buf)
6679 (gnus-summary-position-point)
6680 (gnus-set-mode-line 'summary)))
6682 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6683 "Move the current article to a different newsgroup.
6684 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6685 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6686 re-spool using this method."
6688 (gnus-summary-move-article n to-newsgroup select-method 'copy))
6690 (defun gnus-summary-crosspost-article (&optional n)
6691 "Crosspost the current article to some other group."
6693 (gnus-summary-move-article n nil nil 'crosspost))
6695 (defcustom gnus-summary-respool-default-method nil
6696 "Default method for respooling an article.
6697 If nil, use to the current newsgroup method."
6698 :type 'gnus-select-method-name
6699 :group 'gnus-summary-mail)
6701 (defun gnus-summary-respool-article (&optional n method)
6702 "Respool the current article.
6703 The article will be squeezed through the mail spooling process again,
6704 which means that it will be put in some mail newsgroup or other
6705 depending on `nnmail-split-methods'.
6706 If N is a positive number, respool the N next articles.
6707 If N is a negative number, respool the N previous articles.
6708 If N is nil and any articles have been marked with the process mark,
6709 respool those articles instead.
6711 Respooling can be done both from mail groups and \"real\" newsgroups.
6712 In the former case, the articles in question will be moved from the
6713 current group into whatever groups they are destined to. In the
6714 latter case, they will be copied into the relevant groups."
6716 (list current-prefix-arg
6717 (let* ((methods (gnus-methods-using 'respool))
6719 (symbol-name (or gnus-summary-respool-default-method
6720 (car (gnus-find-method-for-group
6721 gnus-newsgroup-name)))))
6723 (gnus-completing-read
6724 methname "What backend do you want to use when respooling?"
6725 methods nil t nil 'gnus-mail-method-history))
6728 ((zerop (length (setq ms (gnus-servers-using-backend
6730 (list (intern method) ""))
6734 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6735 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6737 (gnus-set-global-variables)
6739 (error "No method given for respooling"))
6740 (if (assoc (symbol-name
6741 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6742 (gnus-methods-using 'respool))
6743 (gnus-summary-move-article n nil method)
6744 (gnus-summary-copy-article n nil method)))
6746 (defun gnus-summary-import-article (file)
6747 "Import a random file into a mail newsgroup."
6748 (interactive "fImport file: ")
6749 (gnus-set-global-variables)
6750 (let ((group gnus-newsgroup-name)
6751 (now (current-time))
6753 (unless (gnus-check-backend-function 'request-accept-article group)
6754 (error "%s does not support article importing" group))
6755 (or (file-readable-p file)
6756 (not (file-regular-p file))
6757 (error "Can't read %s" file))
6759 (set-buffer (get-buffer-create " *import file*"))
6760 (buffer-disable-undo (current-buffer))
6762 (insert-file-contents file)
6763 (goto-char (point-min))
6764 (unless (nnheader-article-p)
6765 ;; This doesn't look like an article, so we fudge some headers.
6766 (setq atts (file-attributes file)
6767 lines (count-lines (point-min) (point-max)))
6768 (insert "From: " (read-string "From: ") "\n"
6769 "Subject: " (read-string "Subject: ") "\n"
6770 "Date: " (timezone-make-date-arpa-standard
6771 (current-time-string (nth 5 atts))
6772 (current-time-zone now)
6773 (current-time-zone now))
6775 "Message-ID: " (message-make-message-id) "\n"
6776 "Lines: " (int-to-string lines) "\n"
6777 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6778 (gnus-request-accept-article group nil t)
6779 (kill-buffer (current-buffer)))))
6781 (defun gnus-summary-article-posted-p ()
6782 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6783 This will be the case if the article has both been mailed and posted."
6785 (let ((id (mail-header-references (gnus-summary-article-header)))
6786 (gnus-override-method
6787 (or gnus-refer-article-method gnus-select-method)))
6788 (if (gnus-request-head id "")
6789 (gnus-message 2 "The current message was found on %s"
6790 gnus-override-method)
6791 (gnus-message 2 "The current message couldn't be found on %s"
6792 gnus-override-method)
6795 (defun gnus-summary-expire-articles (&optional now)
6796 "Expire all articles that are marked as expirable in the current group."
6798 (gnus-set-global-variables)
6799 (when (gnus-check-backend-function
6800 'request-expire-articles gnus-newsgroup-name)
6801 ;; This backend supports expiry.
6802 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6803 (expirable (if total
6805 ;; We need to update the info for
6806 ;; this group for `gnus-list-of-read-articles'
6807 ;; to give us the right answer.
6808 (run-hooks 'gnus-exit-group-hook)
6809 (gnus-summary-update-info)
6810 (gnus-list-of-read-articles gnus-newsgroup-name))
6811 (setq gnus-newsgroup-expirable
6812 (sort gnus-newsgroup-expirable '<))))
6813 (expiry-wait (if now 'immediate
6814 (gnus-group-find-parameter
6815 gnus-newsgroup-name 'expiry-wait)))
6818 ;; There are expirable articles in this group, so we run them
6819 ;; through the expiry process.
6820 (gnus-message 6 "Expiring articles...")
6821 ;; The list of articles that weren't expired is returned.
6823 (let ((nnmail-expiry-wait-function nil)
6824 (nnmail-expiry-wait expiry-wait))
6825 (setq es (gnus-request-expire-articles
6826 expirable gnus-newsgroup-name)))
6827 (setq es (gnus-request-expire-articles
6828 expirable gnus-newsgroup-name)))
6830 (setq gnus-newsgroup-expirable es))
6831 ;; We go through the old list of expirable, and mark all
6832 ;; really expired articles as nonexistent.
6833 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6834 (let ((gnus-use-cache nil))
6836 (unless (memq (car expirable) es)
6837 (when (gnus-data-find (car expirable))
6838 (gnus-summary-mark-article
6839 (car expirable) gnus-canceled-mark)))
6840 (setq expirable (cdr expirable)))))
6841 (gnus-message 6 "Expiring articles...done")))))
6843 (defun gnus-summary-expire-articles-now ()
6844 "Expunge all expirable articles in the current group.
6845 This means that *all* articles that are marked as expirable will be
6846 deleted forever, right now."
6848 (gnus-set-global-variables)
6849 (or gnus-expert-user
6851 "Are you really, really, really sure you want to delete all these messages? ")
6853 (gnus-summary-expire-articles t))
6855 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
6856 (defun gnus-summary-delete-article (&optional n)
6857 "Delete the N next (mail) articles.
6858 This command actually deletes articles. This is not a marking
6859 command. The article will disappear forever from your life, never to
6861 If N is negative, delete backwards.
6862 If N is nil and articles have been marked with the process mark,
6863 delete these instead."
6865 (gnus-set-global-variables)
6866 (unless (gnus-check-backend-function 'request-expire-articles
6867 gnus-newsgroup-name)
6868 (error "The current newsgroup does not support article deletion."))
6869 ;; Compute the list of articles to delete.
6870 (let ((articles (gnus-summary-work-articles n))
6872 (if (and gnus-novice-user
6873 (not (gnus-yes-or-no-p
6874 (format "Do you really want to delete %s forever? "
6875 (if (> (length articles) 1)
6876 (format "these %s articles" (length articles))
6879 ;; Delete the articles.
6880 (setq not-deleted (gnus-request-expire-articles
6881 articles gnus-newsgroup-name 'force))
6883 (gnus-summary-remove-process-mark (car articles))
6884 ;; The backend might not have been able to delete the article
6886 (unless (memq (car articles) not-deleted)
6887 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
6888 (setq articles (cdr articles)))
6890 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
6891 (gnus-summary-position-point)
6892 (gnus-set-mode-line 'summary)
6895 (defun gnus-summary-edit-article (&optional force)
6896 "Edit the current article.
6897 This will have permanent effect only in mail groups.
6898 If FORCE is non-nil, allow editing of articles even in read-only
6902 (set-buffer gnus-summary-buffer)
6903 (gnus-set-global-variables)
6904 (when (and (not force)
6905 (gnus-group-read-only-p))
6906 (error "The current newsgroup does not support article editing."))
6907 ;; Select article if needed.
6908 (unless (eq (gnus-summary-article-number)
6909 gnus-current-article)
6910 (gnus-summary-select-article t))
6911 (gnus-article-edit-article
6913 (gnus-summary-edit-article-done
6914 ,(or (mail-header-references gnus-current-headers) "")
6915 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
6917 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
6919 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
6920 "Make edits to the current article permanent."
6922 ;; Replace the article.
6923 (if (and (not read-only)
6924 (not (gnus-request-replace-article
6925 (cdr gnus-article-current) (car gnus-article-current)
6927 (error "Couldn't replace article.")
6928 ;; Update the summary buffer.
6930 (equal (message-tokenize-header references " ")
6931 (message-tokenize-header
6932 (or (message-fetch-field "references") "") " ")))
6933 ;; We only have to update this line.
6936 (message-narrow-to-head)
6937 (let ((head (buffer-string))
6939 (nnheader-temp-write nil
6940 (insert (format "211 %d Article retrieved.\n"
6941 (cdr gnus-article-current)))
6944 (let ((nntp-server-buffer (current-buffer)))
6945 (setq header (car (gnus-get-newsgroup-headers
6947 (set-buffer gnus-summary-buffer)
6948 gnus-newsgroup-dependencies)
6951 (set-buffer gnus-summary-buffer)
6952 (gnus-data-set-header
6953 (gnus-data-find (cdr gnus-article-current))
6955 (gnus-summary-update-article-line
6956 (cdr gnus-article-current) header))))))
6958 (set-buffer (or buffer gnus-summary-buffer))
6959 (gnus-summary-update-article (cdr gnus-article-current)))
6960 ;; Prettify the article buffer again.
6962 (set-buffer gnus-article-buffer)
6963 (run-hooks 'gnus-article-display-hook)
6964 (set-buffer gnus-original-article-buffer)
6965 (gnus-request-article
6966 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
6967 ;; Prettify the summary buffer line.
6968 (when (gnus-visual-p 'summary-highlight 'highlight)
6969 (run-hooks 'gnus-visual-mark-article-hook))))
6971 (defun gnus-summary-edit-wash (key)
6972 "Perform editing command in the article buffer."
6976 (message "%s" (concat (this-command-keys) "- "))
6979 (gnus-summary-edit-article)
6980 (execute-kbd-macro (concat (this-command-keys) key))
6981 (gnus-article-edit-done))
6985 (defun gnus-summary-respool-query ()
6986 "Query where the respool algorithm would put this article."
6988 (gnus-set-global-variables)
6989 (let (gnus-mark-article-hook)
6990 (gnus-summary-select-article)
6992 (set-buffer gnus-original-article-buffer)
6994 (message-narrow-to-head)
6995 (message "This message would go to %s"
6996 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
6998 ;; Summary marking commands.
7000 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7001 "Mark articles which has the same subject as read, and then select the next.
7002 If UNMARK is positive, remove any kind of mark.
7003 If UNMARK is negative, tick articles."
7005 (gnus-set-global-variables)
7007 (setq unmark (prefix-numeric-value unmark)))
7009 (gnus-summary-mark-same-subject
7010 (gnus-summary-article-subject) unmark)))
7011 ;; Select next unread article. If auto-select-same mode, should
7012 ;; select the first unread article.
7013 (gnus-summary-next-article t (and gnus-auto-select-same
7014 (gnus-summary-article-subject)))
7015 (gnus-message 7 "%d article%s marked as %s"
7016 count (if (= count 1) " is" "s are")
7017 (if unmark "unread" "read"))))
7019 (defun gnus-summary-kill-same-subject (&optional unmark)
7020 "Mark articles which has the same subject as read.
7021 If UNMARK is positive, remove any kind of mark.
7022 If UNMARK is negative, tick articles."
7024 (gnus-set-global-variables)
7026 (setq unmark (prefix-numeric-value unmark)))
7028 (gnus-summary-mark-same-subject
7029 (gnus-summary-article-subject) unmark)))
7030 ;; If marked as read, go to next unread subject.
7032 ;; Go to next unread subject.
7033 (gnus-summary-next-subject 1 t))
7034 (gnus-message 7 "%d articles are marked as %s"
7035 count (if unmark "unread" "read"))))
7037 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7038 "Mark articles with same SUBJECT as read, and return marked number.
7039 If optional argument UNMARK is positive, remove any kinds of marks.
7040 If optional argument UNMARK is negative, mark articles as unread instead."
7044 ((null unmark) ; Mark as read.
7047 (gnus-summary-mark-article-as-read gnus-killed-mark)
7048 (gnus-summary-show-thread) t)
7049 (gnus-summary-find-subject subject))
7050 (setq count (1+ count))))
7051 ((> unmark 0) ; Tick.
7054 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7055 (gnus-summary-show-thread) t)
7056 (gnus-summary-find-subject subject))
7057 (setq count (1+ count))))
7058 (t ; Mark as unread.
7061 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7062 (gnus-summary-show-thread) t)
7063 (gnus-summary-find-subject subject))
7064 (setq count (1+ count)))))
7065 (gnus-set-mode-line 'summary)
7066 ;; Return the number of marked articles.
7069 (defun gnus-summary-mark-as-processable (n &optional unmark)
7070 "Set the process mark on the next N articles.
7071 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7072 the process mark instead. The difference between N and the actual
7073 number of articles marked is returned."
7075 (gnus-set-global-variables)
7076 (let ((backward (< n 0))
7081 (gnus-summary-remove-process-mark
7082 (gnus-summary-article-number))
7083 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7084 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7087 (gnus-message 7 "No more articles"))
7088 (gnus-summary-recenter)
7089 (gnus-summary-position-point)
7092 (defun gnus-summary-unmark-as-processable (n)
7093 "Remove the process mark from the next N articles.
7094 If N is negative, mark backward instead. The difference between N and
7095 the actual number of articles marked is returned."
7097 (gnus-set-global-variables)
7098 (gnus-summary-mark-as-processable n t))
7100 (defun gnus-summary-unmark-all-processable ()
7101 "Remove the process mark from all articles."
7103 (gnus-set-global-variables)
7105 (while gnus-newsgroup-processable
7106 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7107 (gnus-summary-position-point))
7109 (defun gnus-summary-mark-as-expirable (n)
7110 "Mark N articles forward as expirable.
7111 If N is negative, mark backward instead. The difference between N and
7112 the actual number of articles marked is returned."
7114 (gnus-set-global-variables)
7115 (gnus-summary-mark-forward n gnus-expirable-mark))
7117 (defun gnus-summary-mark-article-as-replied (article)
7118 "Mark ARTICLE replied and update the summary line."
7119 (push article gnus-newsgroup-replied)
7120 (let ((buffer-read-only nil))
7121 (when (gnus-summary-goto-subject article)
7122 (gnus-summary-update-secondary-mark article))))
7124 (defun gnus-summary-set-bookmark (article)
7125 "Set a bookmark in current article."
7126 (interactive (list (gnus-summary-article-number)))
7127 (gnus-set-global-variables)
7128 (when (or (not (get-buffer gnus-article-buffer))
7129 (not gnus-current-article)
7130 (not gnus-article-current)
7131 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7132 (error "No current article selected"))
7133 ;; Remove old bookmark, if one exists.
7134 (let ((old (assq article gnus-newsgroup-bookmarks)))
7136 (setq gnus-newsgroup-bookmarks
7137 (delq old gnus-newsgroup-bookmarks))))
7138 ;; Set the new bookmark, which is on the form
7139 ;; (article-number . line-number-in-body).
7143 (set-buffer gnus-article-buffer)
7147 (goto-char (point-min))
7148 (search-forward "\n\n" nil t)
7151 gnus-newsgroup-bookmarks)
7152 (gnus-message 6 "A bookmark has been added to the current article."))
7154 (defun gnus-summary-remove-bookmark (article)
7155 "Remove the bookmark from the current article."
7156 (interactive (list (gnus-summary-article-number)))
7157 (gnus-set-global-variables)
7158 ;; Remove old bookmark, if one exists.
7159 (let ((old (assq article gnus-newsgroup-bookmarks)))
7162 (setq gnus-newsgroup-bookmarks
7163 (delq old gnus-newsgroup-bookmarks))
7164 (gnus-message 6 "Removed bookmark."))
7165 (gnus-message 6 "No bookmark in current article."))))
7167 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7168 (defun gnus-summary-mark-as-dormant (n)
7169 "Mark N articles forward as dormant.
7170 If N is negative, mark backward instead. The difference between N and
7171 the actual number of articles marked is returned."
7173 (gnus-set-global-variables)
7174 (gnus-summary-mark-forward n gnus-dormant-mark))
7176 (defun gnus-summary-set-process-mark (article)
7177 "Set the process mark on ARTICLE and update the summary line."
7178 (setq gnus-newsgroup-processable
7180 (delq article gnus-newsgroup-processable)))
7181 (when (gnus-summary-goto-subject article)
7182 (gnus-summary-show-thread)
7183 (gnus-summary-update-secondary-mark article)))
7185 (defun gnus-summary-remove-process-mark (article)
7186 "Remove the process mark from ARTICLE and update the summary line."
7187 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7188 (when (gnus-summary-goto-subject article)
7189 (gnus-summary-show-thread)
7190 (gnus-summary-update-secondary-mark article)))
7192 (defun gnus-summary-set-saved-mark (article)
7193 "Set the process mark on ARTICLE and update the summary line."
7194 (push article gnus-newsgroup-saved)
7195 (when (gnus-summary-goto-subject article)
7196 (gnus-summary-update-secondary-mark article)))
7198 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7199 "Mark N articles as read forwards.
7200 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7201 The difference between N and the actual number of articles marked is
7204 (gnus-set-global-variables)
7205 (let ((backward (< n 0))
7206 (gnus-summary-goto-unread
7207 (and gnus-summary-goto-unread
7208 (not (eq gnus-summary-goto-unread 'never))
7209 (not (memq mark (list gnus-unread-mark
7210 gnus-ticked-mark gnus-dormant-mark)))))
7212 (mark (or mark gnus-del-mark)))
7214 (gnus-summary-mark-article nil mark no-expire)
7215 (zerop (gnus-summary-next-subject
7217 (and gnus-summary-goto-unread
7218 (not (eq gnus-summary-goto-unread 'never)))
7222 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7223 (gnus-summary-recenter)
7224 (gnus-summary-position-point)
7225 (gnus-set-mode-line 'summary)
7228 (defun gnus-summary-mark-article-as-read (mark)
7229 "Mark the current article quickly as read with MARK."
7230 (let ((article (gnus-summary-article-number)))
7231 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7232 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7233 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7234 (push (cons article mark) gnus-newsgroup-reads)
7235 ;; Possibly remove from cache, if that is used.
7236 (when gnus-use-cache
7237 (gnus-cache-enter-remove-article article))
7238 ;; Allow the backend to change the mark.
7239 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7240 ;; Check for auto-expiry.
7241 (when (and gnus-newsgroup-auto-expire
7242 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7243 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7244 (= mark gnus-ancient-mark)
7245 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7246 (= mark gnus-duplicate-mark)))
7247 (setq mark gnus-expirable-mark)
7248 (push article gnus-newsgroup-expirable))
7249 ;; Set the mark in the buffer.
7250 (gnus-summary-update-mark mark 'unread)
7253 (defun gnus-summary-mark-article-as-unread (mark)
7254 "Mark the current article quickly as unread with MARK."
7255 (let ((article (gnus-summary-article-number)))
7257 (gnus-error 1 "Unmarkable article")
7258 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7259 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7260 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7261 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7262 (cond ((= mark gnus-ticked-mark)
7263 (push article gnus-newsgroup-marked))
7264 ((= mark gnus-dormant-mark)
7265 (push article gnus-newsgroup-dormant))
7267 (push article gnus-newsgroup-unreads)))
7268 (setq gnus-newsgroup-reads
7269 (delq (assq article gnus-newsgroup-reads)
7270 gnus-newsgroup-reads))
7272 ;; See whether the article is to be put in the cache.
7274 (vectorp (gnus-summary-article-header article))
7276 (gnus-cache-possibly-enter-article
7277 gnus-newsgroup-name article
7278 (gnus-summary-article-header article)
7279 (= mark gnus-ticked-mark)
7280 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7283 (gnus-summary-update-mark mark 'unread))
7286 (defun gnus-summary-mark-article (&optional article mark no-expire)
7287 "Mark ARTICLE with MARK. MARK can be any character.
7288 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7289 `??' (dormant) and `?E' (expirable).
7290 If MARK is nil, then the default character `?D' is used.
7291 If ARTICLE is nil, then the article on the current line will be
7293 ;; The mark might be a string.
7294 (when (stringp mark)
7295 (setq mark (aref mark 0)))
7296 ;; If no mark is given, then we check auto-expiring.
7297 (and (not no-expire)
7298 gnus-newsgroup-auto-expire
7300 (and (gnus-characterp mark)
7301 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7302 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7303 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7304 (= mark gnus-duplicate-mark))))
7305 (setq mark gnus-expirable-mark))
7306 (let* ((mark (or mark gnus-del-mark))
7307 (article (or article (gnus-summary-article-number))))
7309 (error "No article on current line"))
7310 (if (or (= mark gnus-unread-mark)
7311 (= mark gnus-ticked-mark)
7312 (= mark gnus-dormant-mark))
7313 (gnus-mark-article-as-unread article mark)
7314 (gnus-mark-article-as-read article mark))
7316 ;; See whether the article is to be put in the cache.
7318 (not (= mark gnus-canceled-mark))
7319 (vectorp (gnus-summary-article-header article))
7321 (gnus-cache-possibly-enter-article
7322 gnus-newsgroup-name article
7323 (gnus-summary-article-header article)
7324 (= mark gnus-ticked-mark)
7325 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7327 (when (gnus-summary-goto-subject article nil t)
7328 (let ((buffer-read-only nil))
7329 (gnus-summary-show-thread)
7331 (gnus-summary-update-mark mark 'unread)
7334 (defun gnus-summary-update-secondary-mark (article)
7335 "Update the secondary (read, process, cache) mark."
7336 (gnus-summary-update-mark
7337 (cond ((memq article gnus-newsgroup-processable)
7339 ((memq article gnus-newsgroup-cached)
7341 ((memq article gnus-newsgroup-replied)
7343 ((memq article gnus-newsgroup-saved)
7345 (t gnus-unread-mark))
7347 (when (gnus-visual-p 'summary-highlight 'highlight)
7348 (run-hooks 'gnus-summary-update-hook))
7351 (defun gnus-summary-update-mark (mark type)
7352 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7353 (buffer-read-only nil))
7354 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7355 (when (looking-at "\r")
7358 (<= (+ forward (point)) (point-max)))
7359 ;; Go to the right position on the line.
7360 (goto-char (+ forward (point)))
7361 ;; Replace the old mark with the new mark.
7362 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7363 ;; Optionally update the marks by some user rule.
7364 (when (eq type 'unread)
7366 (gnus-data-find (gnus-summary-article-number)) mark)
7367 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7369 (defun gnus-mark-article-as-read (article &optional mark)
7370 "Enter ARTICLE in the pertinent lists and remove it from others."
7371 ;; Make the article expirable.
7372 (let ((mark (or mark gnus-del-mark)))
7373 (if (= mark gnus-expirable-mark)
7374 (push article gnus-newsgroup-expirable)
7375 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7376 ;; Remove from unread and marked lists.
7377 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7378 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7379 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7380 (push (cons article mark) gnus-newsgroup-reads)
7381 ;; Possibly remove from cache, if that is used.
7382 (when gnus-use-cache
7383 (gnus-cache-enter-remove-article article))))
7385 (defun gnus-mark-article-as-unread (article &optional mark)
7386 "Enter ARTICLE in the pertinent lists and remove it from others."
7387 (let ((mark (or mark gnus-ticked-mark)))
7388 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7389 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7390 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7391 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7393 ;; Unsuppress duplicates?
7394 (when gnus-suppress-duplicates
7395 (gnus-dup-unsuppress-article article))
7397 (cond ((= mark gnus-ticked-mark)
7398 (push article gnus-newsgroup-marked))
7399 ((= mark gnus-dormant-mark)
7400 (push article gnus-newsgroup-dormant))
7402 (push article gnus-newsgroup-unreads)))
7403 (setq gnus-newsgroup-reads
7404 (delq (assq article gnus-newsgroup-reads)
7405 gnus-newsgroup-reads))))
7407 (defalias 'gnus-summary-mark-as-unread-forward
7408 'gnus-summary-tick-article-forward)
7409 (make-obsolete 'gnus-summary-mark-as-unread-forward
7410 'gnus-summary-tick-article-forward)
7411 (defun gnus-summary-tick-article-forward (n)
7412 "Tick N articles forwards.
7413 If N is negative, tick backwards instead.
7414 The difference between N and the number of articles ticked is returned."
7416 (gnus-summary-mark-forward n gnus-ticked-mark))
7418 (defalias 'gnus-summary-mark-as-unread-backward
7419 'gnus-summary-tick-article-backward)
7420 (make-obsolete 'gnus-summary-mark-as-unread-backward
7421 'gnus-summary-tick-article-backward)
7422 (defun gnus-summary-tick-article-backward (n)
7423 "Tick N articles backwards.
7424 The difference between N and the number of articles ticked is returned."
7426 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7428 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7429 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7430 (defun gnus-summary-tick-article (&optional article clear-mark)
7431 "Mark current article as unread.
7432 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7433 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7435 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7438 (defun gnus-summary-mark-as-read-forward (n)
7439 "Mark N articles as read forwards.
7440 If N is negative, mark backwards instead.
7441 The difference between N and the actual number of articles marked is
7444 (gnus-summary-mark-forward n gnus-del-mark t))
7446 (defun gnus-summary-mark-as-read-backward (n)
7447 "Mark the N articles as read backwards.
7448 The difference between N and the actual number of articles marked is
7451 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7453 (defun gnus-summary-mark-as-read (&optional article mark)
7454 "Mark current article as read.
7455 ARTICLE specifies the article to be marked as read.
7456 MARK specifies a string to be inserted at the beginning of the line."
7457 (gnus-summary-mark-article article mark))
7459 (defun gnus-summary-clear-mark-forward (n)
7460 "Clear marks from N articles forward.
7461 If N is negative, clear backward instead.
7462 The difference between N and the number of marks cleared is returned."
7464 (gnus-summary-mark-forward n gnus-unread-mark))
7466 (defun gnus-summary-clear-mark-backward (n)
7467 "Clear marks from N articles backward.
7468 The difference between N and the number of marks cleared is returned."
7470 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7472 (defun gnus-summary-mark-unread-as-read ()
7473 "Intended to be used by `gnus-summary-mark-article-hook'."
7474 (when (memq gnus-current-article gnus-newsgroup-unreads)
7475 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7477 (defun gnus-summary-mark-read-and-unread-as-read ()
7478 "Intended to be used by `gnus-summary-mark-article-hook'."
7479 (let ((mark (gnus-summary-article-mark)))
7480 (when (or (gnus-unread-mark-p mark)
7481 (gnus-read-mark-p mark))
7482 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7484 (defun gnus-summary-mark-region-as-read (point mark all)
7485 "Mark all unread articles between point and mark as read.
7486 If given a prefix, mark all articles between point and mark as read,
7487 even ticked and dormant ones."
7488 (interactive "r\nP")
7497 (memq (setq article (gnus-summary-article-number))
7498 gnus-newsgroup-unreads))
7499 (gnus-summary-mark-article article gnus-del-mark))
7501 (gnus-summary-find-next))))))
7503 (defun gnus-summary-mark-below (score mark)
7504 "Mark articles with score less than SCORE with MARK."
7505 (interactive "P\ncMark: ")
7506 (gnus-set-global-variables)
7507 (setq score (if score
7508 (prefix-numeric-value score)
7509 (or gnus-summary-default-score 0)))
7511 (set-buffer gnus-summary-buffer)
7512 (goto-char (point-min))
7515 (and (< (gnus-summary-article-score) score)
7516 (gnus-summary-mark-article nil mark))
7517 (gnus-summary-find-next)))))
7519 (defun gnus-summary-kill-below (&optional score)
7520 "Mark articles with score below SCORE as read."
7522 (gnus-set-global-variables)
7523 (gnus-summary-mark-below score gnus-killed-mark))
7525 (defun gnus-summary-clear-above (&optional score)
7526 "Clear all marks from articles with score above SCORE."
7528 (gnus-set-global-variables)
7529 (gnus-summary-mark-above score gnus-unread-mark))
7531 (defun gnus-summary-tick-above (&optional score)
7532 "Tick all articles with score above SCORE."
7534 (gnus-set-global-variables)
7535 (gnus-summary-mark-above score gnus-ticked-mark))
7537 (defun gnus-summary-mark-above (score mark)
7538 "Mark articles with score over SCORE with MARK."
7539 (interactive "P\ncMark: ")
7540 (gnus-set-global-variables)
7541 (setq score (if score
7542 (prefix-numeric-value score)
7543 (or gnus-summary-default-score 0)))
7545 (set-buffer gnus-summary-buffer)
7546 (goto-char (point-min))
7548 (when (> (gnus-summary-article-score) score)
7549 (gnus-summary-mark-article nil mark))
7551 (gnus-summary-find-next)))))
7553 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7554 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7555 (defun gnus-summary-limit-include-expunged (&optional no-error)
7556 "Display all the hidden articles that were expunged for low scores."
7558 (gnus-set-global-variables)
7559 (let ((buffer-read-only nil))
7560 (let ((scored gnus-newsgroup-scored)
7563 (unless (gnus-summary-goto-subject (caar scored))
7564 (and (setq h (gnus-summary-article-header (caar scored)))
7565 (< (cdar scored) gnus-summary-expunge-below)
7567 (setq scored (cdr scored)))
7569 (when (not no-error)
7570 (error "No expunged articles hidden."))
7571 (goto-char (point-min))
7572 (gnus-summary-prepare-unthreaded (nreverse headers))
7573 (goto-char (point-min))
7574 (gnus-summary-position-point)
7577 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7578 "Mark all unread articles in this newsgroup as read.
7579 If prefix argument ALL is non-nil, ticked and dormant articles will
7580 also be marked as read.
7581 If QUIETLY is non-nil, no questions will be asked.
7582 If TO-HERE is non-nil, it should be a point in the buffer. All
7583 articles before this point will be marked as read.
7584 Note that this function will only catch up the unread article
7585 in the current summary buffer limitation.
7586 The number of articles marked as read is returned."
7588 (gnus-set-global-variables)
7592 (not gnus-interactive-catchup) ;Without confirmation?
7596 "Mark absolutely all articles as read? "
7597 "Mark all unread articles as read? ")))
7599 (not gnus-newsgroup-adaptive)
7600 (not gnus-newsgroup-auto-expire)
7601 (not gnus-suppress-duplicates))
7604 (setq gnus-newsgroup-marked nil
7605 gnus-newsgroup-dormant nil))
7606 (setq gnus-newsgroup-unreads nil))
7607 ;; We actually mark all articles as canceled, which we
7608 ;; have to do when using auto-expiry or adaptive scoring.
7609 (gnus-summary-show-all-threads)
7610 (when (gnus-summary-first-subject (not all))
7612 (if to-here (< (point) to-here) t)
7613 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7614 (gnus-summary-find-next (not all)))))
7615 (gnus-set-mode-line 'summary))
7617 (gnus-summary-position-point)))
7619 (defun gnus-summary-catchup-to-here (&optional all)
7620 "Mark all unticked articles before the current one as read.
7621 If ALL is non-nil, also mark ticked and dormant articles as read."
7623 (gnus-set-global-variables)
7625 (gnus-save-hidden-threads
7626 (let ((beg (point)))
7627 ;; We check that there are unread articles.
7628 (when (or all (gnus-summary-find-prev))
7629 (gnus-summary-catchup all t beg)))))
7630 (gnus-summary-position-point))
7632 (defun gnus-summary-catchup-all (&optional quietly)
7633 "Mark all articles in this newsgroup as read."
7635 (gnus-set-global-variables)
7636 (gnus-summary-catchup t quietly))
7638 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7639 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7640 If prefix argument ALL is non-nil, all articles are marked as read."
7642 (gnus-set-global-variables)
7643 (when (gnus-summary-catchup all quietly nil 'fast)
7644 ;; Select next newsgroup or exit.
7645 (if (eq gnus-auto-select-next 'quietly)
7646 (gnus-summary-next-group nil)
7647 (gnus-summary-exit))))
7649 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7650 "Mark all articles in this newsgroup as read, and then exit."
7652 (gnus-set-global-variables)
7653 (gnus-summary-catchup-and-exit t quietly))
7655 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7656 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7657 "Mark all articles in this group as read and select the next group.
7658 If given a prefix, mark all articles, unread as well as ticked, as
7661 (gnus-set-global-variables)
7663 (gnus-summary-catchup all))
7664 (gnus-summary-next-article t nil nil t))
7666 ;; Thread-based commands.
7668 (defun gnus-summary-articles-in-thread (&optional article)
7669 "Return a list of all articles in the current thread.
7670 If ARTICLE is non-nil, return all articles in the thread that starts
7672 (let* ((article (or article (gnus-summary-article-number)))
7673 (data (gnus-data-find-list article))
7674 (top-level (gnus-data-level (car data)))
7676 (cond ((null gnus-thread-operation-ignore-subject)
7677 (gnus-simplify-subject-re
7678 (mail-header-subject (gnus-data-header (car data)))))
7679 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7680 (gnus-simplify-subject-fuzzy
7681 (mail-header-subject (gnus-data-header (car data)))))
7683 (end-point (save-excursion
7684 (if (gnus-summary-go-to-next-thread)
7685 (point) (point-max))))
7688 (< (gnus-data-pos (car data)) end-point))
7689 (when (or (not top-subject)
7690 (string= top-subject
7691 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7692 (gnus-simplify-subject-fuzzy
7693 (mail-header-subject
7694 (gnus-data-header (car data))))
7695 (gnus-simplify-subject-re
7696 (mail-header-subject
7697 (gnus-data-header (car data)))))))
7698 (push (gnus-data-number (car data)) articles))
7699 (unless (and (setq data (cdr data))
7700 (> (gnus-data-level (car data)) top-level))
7702 ;; Return the list of articles.
7703 (nreverse articles)))
7705 (defun gnus-summary-rethread-current ()
7706 "Rethread the thread the current article is part of."
7708 (gnus-set-global-variables)
7709 (let* ((gnus-show-threads t)
7710 (article (gnus-summary-article-number))
7711 (id (mail-header-id (gnus-summary-article-header)))
7712 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7714 (error "No article on the current line"))
7715 (gnus-rebuild-thread id)
7716 (gnus-summary-goto-subject article)))
7718 (defun gnus-summary-reparent-thread ()
7719 "Make the current article child of the marked (or previous) article.
7721 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7722 is non-nil or the Subject: of both articles are the same."
7724 (unless (not (gnus-group-read-only-p))
7725 (error "The current newsgroup does not support article editing."))
7726 (unless (<= (length gnus-newsgroup-processable) 1)
7727 (error "No more than one article may be marked."))
7728 (save-window-excursion
7729 (let ((gnus-article-buffer " *reparent*")
7730 (current-article (gnus-summary-article-number))
7731 ;; First grab the marked article, otherwise one line up.
7732 (parent-article (if (not (null gnus-newsgroup-processable))
7733 (car gnus-newsgroup-processable)
7735 (if (eq (forward-line -1) 0)
7736 (gnus-summary-article-number)
7737 (error "Beginning of summary buffer."))))))
7738 (unless (not (eq current-article parent-article))
7739 (error "An article may not be self-referential."))
7740 (let ((message-id (mail-header-id
7741 (gnus-summary-article-header parent-article))))
7742 (unless (and message-id (not (equal message-id "")))
7743 (error "No message-id in desired parent."))
7744 (gnus-summary-select-article t t nil current-article)
7745 (set-buffer gnus-original-article-buffer)
7746 (let ((buf (format "%s" (buffer-string))))
7747 (nnheader-temp-write nil
7749 (goto-char (point-min))
7750 (if (search-forward-regexp "^References: " nil t)
7751 (insert message-id " " )
7752 (insert "References: " message-id "\n"))
7753 (unless (gnus-request-replace-article
7754 current-article (car gnus-article-current)
7756 (error "Couldn't replace article."))))
7757 (set-buffer gnus-summary-buffer)
7758 (gnus-summary-unmark-all-processable)
7759 (gnus-summary-rethread-current)
7760 (gnus-message 3 "Article %d is now the child of article %d."
7761 current-article parent-article)))))
7763 (defun gnus-summary-toggle-threads (&optional arg)
7764 "Toggle showing conversation threads.
7765 If ARG is positive number, turn showing conversation threads on."
7767 (gnus-set-global-variables)
7768 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7769 (setq gnus-show-threads
7770 (if (null arg) (not gnus-show-threads)
7771 (> (prefix-numeric-value arg) 0)))
7772 (gnus-summary-prepare)
7773 (gnus-summary-goto-subject current)
7774 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7775 (gnus-summary-position-point)))
7777 (defun gnus-summary-show-all-threads ()
7780 (gnus-set-global-variables)
7782 (let ((buffer-read-only nil))
7783 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7784 (gnus-summary-position-point))
7786 (defun gnus-summary-show-thread ()
7787 "Show thread subtrees.
7788 Returns nil if no thread was there to be shown."
7790 (gnus-set-global-variables)
7791 (let ((buffer-read-only nil)
7793 ;; first goto end then to beg, to have point at beg after let
7794 (end (progn (end-of-line) (point)))
7795 (beg (progn (beginning-of-line) (point))))
7797 ;; Any hidden lines here?
7798 (search-forward "\r" end t)
7799 (subst-char-in-region beg end ?\^M ?\n t)
7801 (gnus-summary-position-point))))
7803 (defun gnus-summary-hide-all-threads ()
7804 "Hide all thread subtrees."
7806 (gnus-set-global-variables)
7808 (goto-char (point-min))
7809 (gnus-summary-hide-thread)
7810 (while (zerop (gnus-summary-next-thread 1 t))
7811 (gnus-summary-hide-thread)))
7812 (gnus-summary-position-point))
7814 (defun gnus-summary-hide-thread ()
7815 "Hide thread subtrees.
7816 Returns nil if no threads were there to be hidden."
7818 (gnus-set-global-variables)
7819 (let ((buffer-read-only nil)
7821 (article (gnus-summary-article-number)))
7823 ;; Go forward until either the buffer ends or the subthread
7825 (when (and (not (eobp))
7826 (or (zerop (gnus-summary-next-thread 1 t))
7827 (goto-char (point-max))))
7829 (if (and (> (point) start)
7830 (search-backward "\n" start t))
7832 (subst-char-in-region start (point) ?\n ?\^M)
7833 (gnus-summary-goto-subject article))
7836 ;;(gnus-summary-position-point)
7839 (defun gnus-summary-go-to-next-thread (&optional previous)
7840 "Go to the same level (or less) next thread.
7841 If PREVIOUS is non-nil, go to previous thread instead.
7842 Return the article number moved to, or nil if moving was impossible."
7843 (let ((level (gnus-summary-thread-level))
7844 (way (if previous -1 1))
7847 (while (and (not (eobp))
7848 (< level (gnus-summary-thread-level)))
7856 (gnus-summary-article-number)
7859 (defun gnus-summary-next-thread (n &optional silent)
7860 "Go to the same level next N'th thread.
7861 If N is negative, search backward instead.
7862 Returns the difference between N and the number of skips actually
7865 If SILENT, don't output messages."
7867 (gnus-set-global-variables)
7868 (let ((backward (< n 0))
7871 (gnus-summary-go-to-next-thread backward))
7874 (gnus-summary-position-point))
7875 (when (and (not silent) (/= 0 n))
7876 (gnus-message 7 "No more threads"))
7879 (defun gnus-summary-prev-thread (n)
7880 "Go to the same level previous N'th thread.
7881 Returns the difference between N and the number of skips actually
7884 (gnus-set-global-variables)
7885 (gnus-summary-next-thread (- n)))
7887 (defun gnus-summary-go-down-thread ()
7888 "Go down one level in the current thread."
7889 (let ((children (gnus-summary-article-children)))
7891 (gnus-summary-goto-subject (car children)))))
7893 (defun gnus-summary-go-up-thread ()
7894 "Go up one level in the current thread."
7895 (let ((parent (gnus-summary-article-parent)))
7897 (gnus-summary-goto-subject parent))))
7899 (defun gnus-summary-down-thread (n)
7900 "Go down thread N steps.
7901 If N is negative, go up instead.
7902 Returns the difference between N and how many steps down that were
7905 (gnus-set-global-variables)
7909 (if up (gnus-summary-go-up-thread)
7910 (gnus-summary-go-down-thread)))
7912 (gnus-summary-position-point)
7914 (gnus-message 7 "Can't go further"))
7917 (defun gnus-summary-up-thread (n)
7918 "Go up thread N steps.
7919 If N is negative, go up instead.
7920 Returns the difference between N and how many steps down that were
7923 (gnus-set-global-variables)
7924 (gnus-summary-down-thread (- n)))
7926 (defun gnus-summary-top-thread ()
7927 "Go to the top of the thread."
7929 (gnus-set-global-variables)
7930 (while (gnus-summary-go-up-thread))
7931 (gnus-summary-article-number))
7933 (defun gnus-summary-kill-thread (&optional unmark)
7934 "Mark articles under current thread as read.
7935 If the prefix argument is positive, remove any kinds of marks.
7936 If the prefix argument is negative, tick articles instead."
7938 (gnus-set-global-variables)
7940 (setq unmark (prefix-numeric-value unmark)))
7941 (let ((articles (gnus-summary-articles-in-thread)))
7943 ;; Expand the thread.
7944 (gnus-summary-show-thread)
7945 ;; Mark all the articles.
7947 (gnus-summary-goto-subject (car articles))
7948 (cond ((null unmark)
7949 (gnus-summary-mark-article-as-read gnus-killed-mark))
7951 (gnus-summary-mark-article-as-unread gnus-unread-mark))
7953 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
7954 (setq articles (cdr articles))))
7955 ;; Hide killed subtrees.
7957 gnus-thread-hide-killed
7958 (gnus-summary-hide-thread))
7959 ;; If marked as read, go to next unread subject.
7961 ;; Go to next unread subject.
7962 (gnus-summary-next-subject 1 t)))
7963 (gnus-set-mode-line 'summary))
7965 ;; Summary sorting commands
7967 (defun gnus-summary-sort-by-number (&optional reverse)
7968 "Sort the summary buffer by article number.
7969 Argument REVERSE means reverse order."
7971 (gnus-summary-sort 'number reverse))
7973 (defun gnus-summary-sort-by-author (&optional reverse)
7974 "Sort the summary buffer by author name alphabetically.
7975 If case-fold-search is non-nil, case of letters is ignored.
7976 Argument REVERSE means reverse order."
7978 (gnus-summary-sort 'author reverse))
7980 (defun gnus-summary-sort-by-subject (&optional reverse)
7981 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
7982 If case-fold-search is non-nil, case of letters is ignored.
7983 Argument REVERSE means reverse order."
7985 (gnus-summary-sort 'subject reverse))
7987 (defun gnus-summary-sort-by-date (&optional reverse)
7988 "Sort the summary buffer by date.
7989 Argument REVERSE means reverse order."
7991 (gnus-summary-sort 'date reverse))
7993 (defun gnus-summary-sort-by-score (&optional reverse)
7994 "Sort the summary buffer by score.
7995 Argument REVERSE means reverse order."
7997 (gnus-summary-sort 'score reverse))
7999 (defun gnus-summary-sort-by-lines (&optional reverse)
8000 "Sort the summary buffer by article length.
8001 Argument REVERSE means reverse order."
8003 (gnus-summary-sort 'lines reverse))
8005 (defun gnus-summary-sort (predicate reverse)
8006 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8007 (gnus-set-global-variables)
8008 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8009 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8010 (gnus-thread-sort-functions
8016 (gnus-article-sort-functions
8021 (,article t2 t1)))))
8023 (gnus-summary-prepare-hook nil))
8024 ;; We do the sorting by regenerating the threads.
8025 (gnus-summary-prepare)
8026 ;; Hide subthreads if needed.
8027 (when (and gnus-show-threads gnus-thread-hide-subtree)
8028 (gnus-summary-hide-all-threads))))
8030 ;; Summary saving commands.
8032 (defun gnus-summary-save-article (&optional n not-saved)
8033 "Save the current article using the default saver function.
8034 If N is a positive number, save the N next articles.
8035 If N is a negative number, save the N previous articles.
8036 If N is nil and any articles have been marked with the process mark,
8037 save those articles instead.
8038 The variable `gnus-default-article-saver' specifies the saver function."
8040 (gnus-set-global-variables)
8041 (let* ((articles (gnus-summary-work-articles n))
8042 (save-buffer (save-excursion
8043 (nnheader-set-temp-buffer " *Gnus Save*")))
8044 (num (length articles))
8045 header article file)
8047 (setq header (gnus-summary-article-header
8048 (setq article (pop articles))))
8049 (if (not (vectorp header))
8050 ;; This is a pseudo-article.
8051 (if (assq 'name header)
8052 (gnus-copy-file (cdr (assq 'name header)))
8053 (gnus-message 1 "Article %d is unsaveable" article))
8054 ;; This is a real article.
8055 (save-window-excursion
8056 (gnus-summary-select-article t nil nil article))
8058 (set-buffer save-buffer)
8060 (insert-buffer-substring gnus-original-article-buffer))
8061 (setq file (gnus-article-save save-buffer file num))
8062 (gnus-summary-remove-process-mark article)
8064 (gnus-summary-set-saved-mark article))))
8065 (gnus-kill-buffer save-buffer)
8066 (gnus-summary-position-point)
8067 (gnus-set-mode-line 'summary)
8070 (defun gnus-summary-pipe-output (&optional arg)
8071 "Pipe the current article to a subprocess.
8072 If N is a positive number, pipe the N next articles.
8073 If N is a negative number, pipe the N previous articles.
8074 If N is nil and any articles have been marked with the process mark,
8075 pipe those articles instead."
8077 (gnus-set-global-variables)
8078 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8079 (gnus-summary-save-article arg t))
8080 (gnus-configure-windows 'pipe))
8082 (defun gnus-summary-save-article-mail (&optional arg)
8083 "Append the current article to an mail file.
8084 If N is a positive number, save the N next articles.
8085 If N is a negative number, save the N previous articles.
8086 If N is nil and any articles have been marked with the process mark,
8087 save those articles instead."
8089 (gnus-set-global-variables)
8090 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8091 (gnus-summary-save-article arg)))
8093 (defun gnus-summary-save-article-rmail (&optional arg)
8094 "Append the current article to an rmail file.
8095 If N is a positive number, save the N next articles.
8096 If N is a negative number, save the N previous articles.
8097 If N is nil and any articles have been marked with the process mark,
8098 save those articles instead."
8100 (gnus-set-global-variables)
8101 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8102 (gnus-summary-save-article arg)))
8104 (defun gnus-summary-save-article-file (&optional arg)
8105 "Append the current article to a file.
8106 If N is a positive number, save the N next articles.
8107 If N is a negative number, save the N previous articles.
8108 If N is nil and any articles have been marked with the process mark,
8109 save those articles instead."
8111 (gnus-set-global-variables)
8112 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8113 (gnus-summary-save-article arg)))
8115 (defun gnus-summary-write-article-file (&optional arg)
8116 "Write the current article to a file, deleting the previous file.
8117 If N is a positive number, save the N next articles.
8118 If N is a negative number, save the N previous articles.
8119 If N is nil and any articles have been marked with the process mark,
8120 save those articles instead."
8122 (gnus-set-global-variables)
8123 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8124 (gnus-summary-save-article arg)))
8126 (defun gnus-summary-save-article-body-file (&optional arg)
8127 "Append the current article body to a file.
8128 If N is a positive number, save the N next articles.
8129 If N is a negative number, save the N previous articles.
8130 If N is nil and any articles have been marked with the process mark,
8131 save those articles instead."
8133 (gnus-set-global-variables)
8134 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8135 (gnus-summary-save-article arg)))
8137 (defun gnus-summary-pipe-message (program)
8138 "Pipe the current article through PROGRAM."
8139 (interactive "sProgram: ")
8140 (gnus-set-global-variables)
8141 (gnus-summary-select-article)
8142 (let ((mail-header-separator "")
8143 (art-buf (get-buffer gnus-article-buffer)))
8144 (gnus-eval-in-buffer-window gnus-article-buffer
8147 (let ((start (window-start))
8149 (message-pipe-buffer-body program)
8150 (set-window-start (get-buffer-window (current-buffer)) start))))))
8152 (defun gnus-get-split-value (methods)
8153 "Return a value based on the split METHODS."
8154 (let (split-name method result match)
8157 (set-buffer gnus-original-article-buffer)
8159 (nnheader-narrow-to-headers)
8161 (goto-char (point-min))
8162 (setq method (pop methods))
8163 (setq match (car method))
8166 ;; Regular expression.
8168 (re-search-forward match nil t)))
8169 ((gnus-functionp match)
8173 (setq result (funcall match gnus-newsgroup-name))))
8178 (setq result (eval match)))))
8179 (setq split-name (append (cdr method) split-name))
8180 (cond ((stringp result)
8181 (push (expand-file-name
8182 result gnus-article-save-directory)
8185 (setq split-name (append result split-name)))))))))
8188 (defun gnus-valid-move-group-p (group)
8193 (car (gnus-find-method-for-group
8194 (symbol-name group))))
8195 gnus-valid-select-methods))))
8197 (defun gnus-read-move-group-name (prompt default articles prefix)
8198 "Read a group name."
8199 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8200 (minibuffer-confirm-incomplete nil) ; XEmacs
8204 (if (> (length articles) 1)
8205 (format "these %d articles" (length articles))
8210 (gnus-completing-read default prom
8212 'gnus-valid-move-group-p
8214 'gnus-group-history))
8215 ((= 1 (length split-name))
8216 (gnus-completing-read (car split-name) prom
8218 'gnus-valid-move-group-p
8220 'gnus-group-history))
8222 (gnus-completing-read nil prom
8223 (mapcar (lambda (el) (list el))
8224 (nreverse split-name))
8226 'gnus-group-history)))))
8228 (if (or (string= to-newsgroup "")
8229 (string= to-newsgroup prefix))
8230 (setq to-newsgroup default))
8231 (unless to-newsgroup
8232 (error "No group name entered"))
8233 (or (gnus-active to-newsgroup)
8234 (gnus-activate-group to-newsgroup)
8235 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8237 (or (and (gnus-request-create-group
8238 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8239 (gnus-activate-group to-newsgroup nil nil
8240 (gnus-group-name-to-method
8242 (error "Couldn't create group %s" to-newsgroup)))
8243 (error "No such group: %s" to-newsgroup)))
8246 ;; Summary extract commands
8248 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8249 (let ((buffer-read-only nil)
8250 (article (gnus-summary-article-number))
8252 (unless (gnus-summary-goto-subject article)
8253 (error "No such article: %d" article))
8254 (gnus-summary-position-point)
8255 ;; If all commands are to be bunched up on one line, we collect
8257 (unless gnus-view-pseudos-separately
8258 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8261 (setq action (cdr (assq 'action (car ps))))
8262 (setq files (list (cdr (assq 'name (car ps)))))
8263 (while (and ps (cdr ps)
8264 (string= (or action "1")
8265 (or (cdr (assq 'action (cadr ps))) "2")))
8266 (push (cdr (assq 'name (cadr ps))) files)
8267 (setcdr ps (cddr ps)))
8269 (when (not (string-match "%s" action))
8272 (when (assq 'execute (car ps))
8273 (setcdr (assq 'execute (car ps))
8274 (funcall (if (string-match "%s" action)
8281 (gnus-quote-arg-for-sh-or-csh f)))
8283 (setq ps (cdr ps)))))
8284 (if (and gnus-view-pseudos (not not-view))
8286 (when (assq 'execute (car pslist))
8287 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8288 (eq gnus-view-pseudos 'not-confirm)))
8289 (setq pslist (cdr pslist)))
8292 (setq after-article (or (cdr (assq 'article (car pslist)))
8293 (gnus-summary-article-number)))
8294 (gnus-summary-goto-subject after-article)
8297 (insert " " (file-name-nondirectory
8298 (cdr (assq 'name (car pslist))))
8299 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8301 (forward-line -1) ; back to `b'
8302 (gnus-add-text-properties
8303 b (1- e) (list 'gnus-number gnus-reffed-article-number
8304 gnus-mouse-face-prop gnus-mouse-face))
8306 after-article gnus-reffed-article-number
8307 gnus-unread-mark b (car pslist) 0 (- e b))
8308 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8309 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8310 (setq pslist (cdr pslist)))))))
8312 (defun gnus-pseudos< (p1 p2)
8313 (let ((c1 (cdr (assq 'action p1)))
8314 (c2 (cdr (assq 'action p2))))
8315 (and c1 c2 (string< c1 c2))))
8317 (defun gnus-request-pseudo-article (props)
8318 (cond ((assq 'execute props)
8319 (gnus-execute-command (cdr (assq 'execute props)))))
8320 (let ((gnus-current-article (gnus-summary-article-number)))
8321 (run-hooks 'gnus-mark-article-hook)))
8323 (defun gnus-execute-command (command &optional automatic)
8325 (gnus-article-setup-buffer)
8326 (set-buffer gnus-article-buffer)
8327 (setq buffer-read-only nil)
8328 (let ((command (if automatic command (read-string "Command: " command)))
8329 ;; Just binding this here doesn't help, because there might
8330 ;; be output from the process after exiting the scope of
8332 ;; (buffer-read-only nil)
8335 (insert "$ " command "\n\n")
8336 (if gnus-view-pseudo-asynchronously
8337 (start-process "gnus-execute" nil shell-file-name
8338 shell-command-switch command)
8339 (call-process shell-file-name nil t nil
8340 shell-command-switch command)))))
8342 ;; Summary kill commands.
8344 (defun gnus-summary-edit-global-kill (article)
8345 "Edit the \"global\" kill file."
8346 (interactive (list (gnus-summary-article-number)))
8347 (gnus-set-global-variables)
8348 (gnus-group-edit-global-kill article))
8350 (defun gnus-summary-edit-local-kill ()
8351 "Edit a local kill file applied to the current newsgroup."
8353 (gnus-set-global-variables)
8354 (setq gnus-current-headers (gnus-summary-article-header))
8355 (gnus-set-global-variables)
8356 (gnus-group-edit-local-kill
8357 (gnus-summary-article-number) gnus-newsgroup-name))
8361 (defun gnus-read-header (id &optional header)
8362 "Read the headers of article ID and enter them into the Gnus system."
8363 (let ((group gnus-newsgroup-name)
8364 (gnus-override-method
8365 (and (gnus-news-group-p gnus-newsgroup-name)
8366 gnus-refer-article-method))
8368 ;; First we check to see whether the header in question is already
8371 ;; This is a Message-ID.
8372 (setq header (or header (gnus-id-to-header id)))
8373 ;; This is an article number.
8374 (setq header (or header (gnus-summary-article-header id))))
8376 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8377 ;; We have found the header.
8379 ;; We have to really fetch the header to this article.
8381 (set-buffer nntp-server-buffer)
8382 (when (setq where (gnus-request-head id group))
8383 (nnheader-fold-continuation-lines)
8384 (goto-char (point-max))
8386 (goto-char (point-min))
8390 ((cdr where) (cdr where))
8391 (header (mail-header-number header))
8392 (t gnus-reffed-article-number))
8394 (insert " Article retrieved.\n"))
8396 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8397 () ; Malformed head.
8398 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8399 (when (and (stringp id)
8400 (not (string= (gnus-group-real-name group)
8402 ;; If we fetched by Message-ID and the article came
8403 ;; from a different group, we fudge some bogus article
8404 ;; numbers for this article.
8405 (mail-header-set-number header gnus-reffed-article-number))
8407 (set-buffer gnus-summary-buffer)
8408 (decf gnus-reffed-article-number)
8409 (gnus-remove-header (mail-header-number header))
8410 (push header gnus-newsgroup-headers)
8411 (setq gnus-current-headers header)
8412 (push (mail-header-number header) gnus-newsgroup-limit)))
8415 (defun gnus-remove-header (number)
8416 "Remove header NUMBER from `gnus-newsgroup-headers'."
8417 (if (and gnus-newsgroup-headers
8418 (= number (mail-header-number (car gnus-newsgroup-headers))))
8419 (pop gnus-newsgroup-headers)
8420 (let ((headers gnus-newsgroup-headers))
8421 (while (and (cdr headers)
8422 (not (= number (mail-header-number (cadr headers)))))
8425 (setcdr headers (cddr headers))))))
8428 ;;; summary highlights
8431 (defun gnus-highlight-selected-summary ()
8432 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8433 ;; Highlight selected article in summary buffer
8434 (when gnus-summary-selected-face
8436 (let* ((beg (progn (beginning-of-line) (point)))
8437 (end (progn (end-of-line) (point)))
8438 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8439 (from (if (get-text-property beg gnus-mouse-face-prop)
8441 (or (next-single-property-change
8442 beg gnus-mouse-face-prop nil end)
8447 (or (next-single-property-change
8448 from gnus-mouse-face-prop nil end)
8450 ;; If no mouse-face prop on line we will have to = from = end,
8451 ;; so we highlight the entire line instead.
8452 (when (= (+ to 2) from)
8455 (if gnus-newsgroup-selected-overlay
8456 ;; Move old overlay.
8458 gnus-newsgroup-selected-overlay from to (current-buffer))
8459 ;; Create new overlay.
8461 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8462 'face gnus-summary-selected-face))))))
8464 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8465 (defun gnus-summary-highlight-line ()
8466 "Highlight current line according to `gnus-summary-highlight'."
8467 (let* ((list gnus-summary-highlight)
8469 (end (progn (end-of-line) (point)))
8470 ;; now find out where the line starts and leave point there.
8471 (beg (progn (beginning-of-line) (point)))
8472 (article (gnus-summary-article-number))
8473 (score (or (cdr (assq (or article gnus-current-article)
8474 gnus-newsgroup-scored))
8475 gnus-summary-default-score 0))
8476 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8477 (inhibit-read-only t))
8478 ;; Eval the cars of the lists until we find a match.
8479 (let ((default gnus-summary-default-score))
8481 (not (eval (caar list))))
8482 (setq list (cdr list))))
8483 (let ((face (cdar list)))
8484 (unless (eq face (get-text-property beg 'face))
8485 (gnus-put-text-property
8487 (setq face (if (boundp face) (symbol-value face) face)))
8488 (when gnus-summary-highlight-line-function
8489 (funcall gnus-summary-highlight-line-function article face))))
8492 (defun gnus-update-read-articles (group unread)
8493 "Update the list of read articles in GROUP."
8494 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8495 (entry (gnus-gethash group gnus-newsrc-hashtb))
8496 (info (nth 2 entry))
8498 (unread (sort (copy-sequence unread) '<))
8500 (if (or (not info) (not active))
8501 ;; There is no info on this group if it was, in fact,
8502 ;; killed. Gnus stores no information on killed groups, so
8503 ;; there's nothing to be done.
8504 ;; One could store the information somewhere temporarily,
8505 ;; perhaps... Hmmm...
8507 ;; Remove any negative articles numbers.
8508 (while (and unread (< (car unread) 0))
8509 (setq unread (cdr unread)))
8510 ;; Remove any expired article numbers
8511 (while (and unread (< (car unread) (car active)))
8512 (setq unread (cdr unread)))
8513 ;; Compute the ranges of read articles by looking at the list of
8516 (when (/= (car unread) prev)
8517 (push (if (= prev (1- (car unread))) prev
8518 (cons prev (1- (car unread))))
8520 (setq prev (1+ (car unread)))
8521 (setq unread (cdr unread)))
8522 (when (<= prev (cdr active))
8523 (push (cons prev (cdr active)) read))
8525 (set-buffer gnus-group-buffer)
8528 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8529 (gnus-info-set-read ',info ',(gnus-info-read info))
8530 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8531 (gnus-group-update-group ,group t))))
8532 ;; Enter this list into the group info.
8534 info (if (> (length read) 1) (nreverse read) read))
8535 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8536 (gnus-get-unread-articles-in-group info (gnus-active group))
8539 (defun gnus-offer-save-summaries ()
8540 "Offer to save all active summary buffers."
8542 (let ((buflist (buffer-list))
8544 ;; Go through all buffers and find all summaries.
8546 (and (setq bufname (buffer-name (car buflist)))
8547 (string-match "Summary" bufname)
8549 (set-buffer bufname)
8550 ;; We check that this is, indeed, a summary buffer.
8551 (and (eq major-mode 'gnus-summary-mode)
8552 ;; Also make sure this isn't bogus.
8553 gnus-newsgroup-prepared
8554 ;; Also make sure that this isn't a dead summary buffer.
8555 (not gnus-dead-summary-mode)))
8556 (push bufname buffers))
8557 (setq buflist (cdr buflist)))
8558 ;; Go through all these summary buffers and offer to save them.
8561 "Update summary buffer %s? "
8562 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
8567 (run-hooks 'gnus-sum-load-hook)
8569 ;;; gnus-sum.el ends here