1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996 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 ;; Belongs to to gnus.el
36 (defgroup gnus-various nil
38 :link '(custom-manual "(gnus)Various Various")
41 ;; Belongs to to gnus-group.el
42 (defgroup gnus-group-select nil
44 :link '(custom-manual "(gnus)Selecting a Group")
47 ;; Belongs to to gnus-uu.el
48 (defgroup gnus-extract-view nil
49 "Viewing extracted files."
50 :link '(custom-manual "(gnus)Viewing Files")
53 ;; Belongs to article.el
54 (defgroup article-hiding-headers nil
55 "Hiding headers in the article buffer."
56 :link '(custom-manual "(gnus)Hiding Headers")
59 (defgroup article-various nil
60 "Miscellaneous article options."
61 :link '(custom-manual "(gnus)Misc Article")
64 (defgroup article-mime nil
65 "Encoding articles and including attachments."
66 :link '(custom-manual "(gnus)Using MIME")
70 (defgroup gnus-summary nil
72 :link '(custom-manual "(gnus)The Summary Buffer")
75 (defgroup gnus-summary-exit nil
76 "Leaving summary buffers."
77 :link '(custom-manual "(gnus)Exiting the Summary Buffer")
80 (defgroup gnus-summary-marks nil
81 "Marks used in summary buffers."
82 :link '(custom-manual "(gnus)Marking Articles")
85 (defgroup gnus-thread nil
86 "Ordering articles according to replies."
87 :link '(custom-manual "(gnus)Threading")
90 (defgroup gnus-summary-format nil
91 "Formatting of the summary buffer."
92 :link '(custom-manual "(gnus)Summary Buffer Format")
95 (defgroup gnus-summary-choose nil
97 :link '(custom-manual "(gnus)Choosing Articles")
100 (defgroup gnus-summary-maneuvering nil
101 "Summary movement commands."
102 :link '(custom-manual "(gnus)Summary Maneuvering")
103 :group 'gnus-summary)
105 (defgroup gnus-summary-mail nil
106 "Mail group commands."
107 :link '(custom-manual "(gnus)Mail Group Commands")
108 :group 'gnus-summary)
110 (defgroup gnus-summary-sort nil
111 "Sorting the summary buffer."
112 :link '(custom-manual "(gnus)Sorting")
113 :group 'gnus-summary)
115 (defgroup gnus-summary-visual nil
116 "Highlighting and menus in the summary buffer."
117 :link '(custom-manual "(gnus)Summary Highlighting")
119 :group 'gnus-summary)
121 (defgroup gnus-summary-various nil
122 "Various summary buffer options."
123 :link '(custom-manual "(gnus)Various Summary Stuff")
124 :group 'gnus-summary)
126 (defcustom gnus-kill-summary-on-exit t
127 "*If non-nil, kill the summary buffer when you exit from it.
128 If nil, the summary will become a \"*Dead Summary*\" buffer, and
129 it will be killed sometime later."
130 :group 'gnus-summary-exit
133 (defcustom gnus-fetch-old-headers nil
134 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
135 If an unread article in the group refers to an older, already read (or
136 just marked as read) article, the old article will not normally be
137 displayed in the Summary buffer. If this variable is non-nil, Gnus
138 will attempt to grab the headers to the old articles, and thereby
139 build complete threads. If it has the value `some', only enough
140 headers to connect otherwise loose threads will be displayed.
141 This variable can also be a number. In that case, no more than that
142 number of old headers will be fetched.
144 The server has to support NOV for any of this to work."
146 :type '(choice (const :tag "off" nil)
149 (sexp :menu-tag "other" t)))
151 (defcustom gnus-summary-make-false-root 'adopt
152 "*nil means that Gnus won't gather loose threads.
153 If the root of a thread has expired or been read in a previous
154 session, the information necessary to build a complete thread has been
155 lost. Instead of having many small sub-threads from this original thread
156 scattered all over the summary buffer, Gnus can gather them.
158 If non-nil, Gnus will try to gather all loose sub-threads from an
159 original thread into one large thread.
161 If this variable is non-nil, it should be one of `none', `adopt',
164 If this variable is `none', Gnus will not make a false root, but just
165 present the sub-threads after another.
166 If this variable is `dummy', Gnus will create a dummy root that will
167 have all the sub-threads as children.
168 If this variable is `adopt', Gnus will make one of the \"children\"
169 the parent and mark all the step-children as such.
170 If this variable is `empty', the \"children\" are printed with empty
171 subject fields. (Or rather, they will be printed with a string
172 given by the `gnus-summary-same-subject' variable.)"
174 :type '(choice (const :tag "off" nil)
180 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
181 "*A regexp to match subjects to be excluded from loose thread gathering.
182 As loose thread gathering is done on subjects only, that means that
183 there can be many false gatherings performed. By rooting out certain
184 common subjects, gathering might become saner."
188 (defcustom gnus-summary-gather-subject-limit nil
189 "*Maximum length of subject comparisons when gathering loose threads.
190 Use nil to compare full subjects. Setting this variable to a low
191 number will help gather threads that have been corrupted by
192 newsreaders chopping off subject lines, but it might also mean that
193 unrelated articles that have subject that happen to begin with the
194 same few characters will be incorrectly gathered.
196 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
199 :type '(choice (const :tag "off" nil)
201 (sexp :menu-tag "on" t)))
203 (defcustom gnus-simplify-ignored-prefixes nil
204 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
206 :type '(choice (const :tag "off" nil)
209 (defcustom gnus-build-sparse-threads nil
210 "*If non-nil, fill in the gaps in threads.
211 If `some', only fill in the gaps that are needed to tie loose threads
212 together. If `more', fill in all leaf nodes that Gnus can find. If
213 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
215 :type '(choice (const :tag "off" nil)
218 (sexp :menu-tag "all" t)))
220 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
221 "Function used for gathering loose threads.
222 There are two pre-defined functions: `gnus-gather-threads-by-subject',
223 which only takes Subjects into consideration; and
224 `gnus-gather-threads-by-references', which compared the References
225 headers of the articles to find matches."
227 :type '(set (function-item gnus-gather-threads-by-subject)
228 (function-item gnus-gather-threads-by-references)
229 (function :tag "other")))
231 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
232 (defcustom gnus-summary-same-subject ""
233 "*String indicating that the current article has the same subject as the previous.
234 This variable will only be used if the value of
235 `gnus-summary-make-false-root' is `empty'."
236 :group 'gnus-summary-format
239 (defcustom gnus-summary-goto-unread t
240 "*If t, marking commands will go to the next unread article.
241 If `never', commands that usually go to the next unread article, will
242 go to the next article, whether it is read or not.
243 If nil, only the marking commands will go to the next (un)read article."
244 :group 'gnus-summary-marks
245 :link '(custom-manual "(gnus)Setting Marks")
246 :type '(choice (const :tag "off" nil)
248 (sexp :menu-tag "on" t)))
250 (defcustom gnus-summary-default-score 0
251 "*Default article score level.
252 If this variable is nil, scoring will be disabled."
254 :type '(choice (const :tag "disable")
257 (defcustom gnus-summary-zcore-fuzz 0
258 "*Fuzziness factor for the zcore in the summary buffer.
259 Articles with scores closer than this to `gnus-summary-default-score'
261 :group 'gnus-summary-format
264 (defcustom gnus-simplify-subject-fuzzy-regexp nil
265 "*Strings to be removed when doing fuzzy matches.
266 This can either be a regular expression or list of regular expressions
267 that will be removed from subject strings if fuzzy subject
268 simplification is selected."
270 :type '(repeat regexp))
272 (defcustom gnus-show-threads t
273 "*If non-nil, display threads in summary mode."
277 (defcustom gnus-thread-hide-subtree nil
278 "*If non-nil, hide all threads initially.
279 If threads are hidden, you have to run the command
280 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
281 to expose hidden threads."
285 (defcustom gnus-thread-hide-killed t
286 "*If non-nil, hide killed threads automatically."
290 (defcustom gnus-thread-ignore-subject nil
291 "*If non-nil, ignore subjects and do all threading based on the Reference header.
292 If nil, which is the default, articles that have different subjects
293 from their parents will start separate threads."
297 (defcustom gnus-thread-operation-ignore-subject t
298 "*If non-nil, subjects will be ignored when doing thread commands.
299 This affects commands like `gnus-summary-kill-thread' and
300 `gnus-summary-lower-thread'.
302 If this variable is nil, articles in the same thread with different
303 subjects will not be included in the operation in question. If this
304 variable is `fuzzy', only articles that have subjects that are fuzzily
305 equal will be included."
307 :type '(choice (const :tag "off" nil)
311 (defcustom gnus-thread-indent-level 4
312 "*Number that says how much each sub-thread should be indented."
316 (defcustom gnus-auto-extend-newsgroup t
317 "*If non-nil, extend newsgroup forward and backward when requested."
318 :group 'gnus-summary-choose
321 (defcustom gnus-auto-select-first t
322 "*If nil, don't select the first unread article when entering a group.
323 If this variable is `best', select the highest-scored unread article
324 in the group. If neither nil nor `best', select the first unread
327 If you want to prevent automatic selection of the first unread article
328 in some newsgroups, set the variable to nil in
329 `gnus-select-group-hook'."
330 :group 'gnus-group-select
331 :type '(choice (const :tag "none" nil)
333 (sexp :menu-tag "first" t)))
335 (defcustom gnus-auto-select-next t
336 "*If non-nil, offer to go to the next group from the end of the previous.
337 If the value is t and the next newsgroup is empty, Gnus will exit
338 summary mode and go back to group mode. If the value is neither nil
339 nor t, Gnus will select the following unread newsgroup. In
340 particular, if the value is the symbol `quietly', the next unread
341 newsgroup will be selected without any confirmation, and if it is
342 `almost-quietly', the next group will be selected without any
343 confirmation if you are located on the last article in the group.
344 Finally, if this variable is `slightly-quietly', the `Z n' command
345 will go to the next group without confirmation."
346 :group 'gnus-summary-maneuvering
347 :type '(choice (const :tag "off" nil)
349 (const almost-quietly)
350 (const slightly-quietly)
351 (sexp :menu-tag "on" t)))
353 (defcustom gnus-auto-select-same nil
354 "*If non-nil, select the next article with the same subject."
355 :group 'gnus-summary-maneuvering
358 (defcustom gnus-summary-check-current nil
359 "*If non-nil, consider the current article when moving.
360 The \"unread\" movement commands will stay on the same line if the
361 current article is unread."
362 :group 'gnus-summary-maneuvering
365 (defcustom gnus-auto-center-summary t
366 "*If non-nil, always center the current summary buffer.
367 In particular, if `vertical' do only vertical recentering. If non-nil
368 and non-`vertical', do both horizontal and vertical recentering."
369 :group 'gnus-summary-maneuvering
370 :type '(choice (const :tag "none" nil)
372 (sexp :menu-tag "both" t)))
374 (defcustom gnus-show-all-headers nil
375 "*If non-nil, don't hide any headers."
376 :group 'article-hiding-headers
379 (defcustom gnus-single-article-buffer t
380 "*If non-nil, display all articles in the same buffer.
381 If nil, each group will get its own article buffer."
382 :group 'article-various
385 (defcustom gnus-break-pages t
386 "*If non-nil, do page breaking on articles.
387 The page delimiter is specified by the `gnus-page-delimiter'
389 :group 'article-various
392 (defcustom gnus-show-mime nil
393 "*If non-nil, do mime processing of articles.
394 The articles will simply be fed to the function given by
395 `gnus-show-mime-method'."
399 (defcustom gnus-move-split-methods nil
400 "*Variable used to suggest where articles are to be moved to.
401 It uses the same syntax as the `gnus-split-methods' variable."
402 :group 'gnus-summary-mail
403 :type '(repeat (choice (list function)
404 (cons regexp (repeat string))
407 ;; Mark variables suggested by Thomas Michanek
408 ;; <Thomas.Michanek@telelogic.se>.
410 (defcustom gnus-unread-mark ?
411 "*Mark used for unread articles."
412 :group 'gnus-summary-marks
415 (defcustom gnus-ticked-mark ?!
416 "*Mark used for ticked articles."
417 :group 'gnus-summary-marks
420 (defcustom gnus-dormant-mark ??
421 "*Mark used for dormant articles."
422 :group 'gnus-summary-marks
425 (defcustom gnus-del-mark ?r
426 "*Mark used for del'd articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-read-mark ?R
431 "*Mark used for read articles."
432 :group 'gnus-summary-marks
435 (defcustom gnus-expirable-mark ?E
436 "*Mark used for expirable articles."
437 :group 'gnus-summary-marks
440 (defcustom gnus-killed-mark ?K
441 "*Mark used for killed articles."
442 :group 'gnus-summary-marks
445 (defcustom gnus-souped-mark ?F
446 "*Mark used for killed articles."
447 :group 'gnus-summary-marks
450 (defcustom gnus-kill-file-mark ?X
451 "*Mark used for articles killed by kill files."
452 :group 'gnus-summary-marks
455 (defcustom gnus-low-score-mark ?Y
456 "*Mark used for articles with a low score."
457 :group 'gnus-summary-marks
460 (defcustom gnus-catchup-mark ?C
461 "*Mark used for articles that are caught up."
462 :group 'gnus-summary-marks
465 (defcustom gnus-replied-mark ?A
466 "*Mark used for articles that have been replied to."
467 :group 'gnus-summary-marks
470 (defcustom gnus-cached-mark ?*
471 "*Mark used for articles that are in the cache."
472 :group 'gnus-summary-marks
475 (defcustom gnus-saved-mark ?S
476 "*Mark used for articles that have been saved to."
477 :group 'gnus-summary-marks
480 (defcustom gnus-ancient-mark ?O
481 "*Mark used for ancient articles."
482 :group 'gnus-summary-marks
485 (defcustom gnus-sparse-mark ?Q
486 "*Mark used for sparsely reffed articles."
487 :group 'gnus-summary-marks
490 (defcustom gnus-canceled-mark ?G
491 "*Mark used for canceled articles."
492 :group 'gnus-summary-marks
495 (defcustom gnus-duplicate-mark ?M
496 "*Mark used for duplicate articles."
497 :group 'gnus-summary-marks
500 (defcustom gnus-score-over-mark ?+
501 "*Score mark used for articles with high scores."
502 :group 'gnus-summary-marks
505 (defcustom gnus-score-below-mark ?-
506 "*Score mark used for articles with low scores."
507 :group 'gnus-summary-marks
510 (defcustom gnus-empty-thread-mark ?
511 "*There is no thread under the article."
512 :group 'gnus-summary-marks
515 (defcustom gnus-not-empty-thread-mark ?=
516 "*There is a thread under the article."
517 :group 'gnus-summary-marks
520 (defcustom gnus-view-pseudo-asynchronously nil
521 "*If non-nil, Gnus will view pseudo-articles asynchronously."
522 :group 'gnus-extract-view
525 (defcustom gnus-view-pseudos nil
526 "*If `automatic', pseudo-articles will be viewed automatically.
527 If `not-confirm', pseudos will be viewed automatically, and the user
528 will not be asked to confirm the command."
529 :group 'gnus-extract-view
530 :type '(choice (const :tag "off" nil)
532 (const not-confirm)))
534 (defcustom gnus-view-pseudos-separately t
535 "*If non-nil, one pseudo-article will be created for each file to be viewed.
536 If nil, all files that use the same viewing command will be given as a
537 list of parameters to that command."
538 :group 'gnus-extract-view
541 (defcustom gnus-insert-pseudo-articles t
542 "*If non-nil, insert pseudo-articles when decoding articles."
543 :group 'gnus-extract-view
546 (defcustom gnus-summary-dummy-line-format
548 "*The format specification for the dummy roots in the summary buffer.
549 It works along the same lines as a normal formatting string,
550 with some simple extensions.
553 :group 'gnus-threading
556 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
557 "*The format specification for the summary mode line.
558 It works along the same lines as a normal formatting string,
559 with some simple extensions:
562 %p Unprefixed group name
563 %A Current article number
565 %U Number of unread articles in the group
566 %e Number of unselected articles in the group
567 %Z A string with unread/unselected article counts
568 %g Shortish group name
569 %S Subject of the current article
571 %s Current score file name
572 %d Number of dormant articles
573 %r Number of articles that have been marked as read in this session
574 %E Number of articles expunged by the score files"
575 :group 'gnus-summary-format
578 (defcustom gnus-summary-mark-below 0
579 "*Mark all articles with a score below this variable as read.
580 This variable is local to each summary buffer and usually set by the
585 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
586 "*List of functions used for sorting articles in the summary buffer.
587 This variable is only used when not using a threaded display."
588 :group 'gnus-summary-sort
589 :type '(repeat (choice (function-item gnus-article-sort-by-number)
590 (function-item gnus-article-sort-by-author)
591 (function-item gnus-article-sort-by-subject)
592 (function-item gnus-article-sort-by-date)
593 (function-item gnus-article-sort-by-score)
594 (function :tag "other"))))
596 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
597 "*List of functions used for sorting threads in the summary buffer.
598 By default, threads are sorted by article number.
600 Each function takes two threads and return non-nil if the first thread
601 should be sorted before the other. If you use more than one function,
602 the primary sort function should be the last. You should probably
603 always include `gnus-thread-sort-by-number' in the list of sorting
604 functions -- preferably first.
606 Ready-made functions include `gnus-thread-sort-by-number',
607 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
608 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
609 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
610 :group 'gnus-summary-sort
611 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
612 (function-item gnus-thread-sort-by-author)
613 (function-item gnus-thread-sort-by-subject)
614 (function-item gnus-thread-sort-by-date)
615 (function-item gnus-thread-sort-by-score)
616 (function-item gnus-thread-sort-by-total-score)
617 (function :tag "other"))))
619 (defcustom gnus-thread-score-function '+
620 "*Function used for calculating the total score of a thread.
622 The function is called with the scores of the article and each
623 subthread and should then return the score of the thread.
625 Some functions you can use are `+', `max', or `min'."
626 :group 'gnus-summary-sort
629 (defcustom gnus-summary-expunge-below nil
630 "All articles that have a score less than this variable will be expunged."
632 :type '(choice (const :tag "off" nil)
635 (defcustom gnus-thread-expunge-below nil
636 "All threads that have a total score less than this variable will be expunged.
637 See `gnus-thread-score-function' for en explanation of what a
638 \"thread score\" is."
639 :group 'gnus-treading
641 :type '(choice (const :tag "off" nil)
644 (defcustom gnus-summary-mode-hook nil
645 "*A hook for Gnus summary mode.
646 This hook is run before any variables are set in the summary buffer."
647 :group 'gnus-summary-various
650 (defcustom gnus-summary-menu-hook nil
651 "*Hook run after the creation of the summary mode menu."
652 :group 'gnus-summary-visual
655 (defcustom gnus-summary-exit-hook nil
656 "*A hook called on exit from the summary buffer."
657 :group 'gnus-summary-exit
660 (defcustom gnus-summary-prepare-hook nil
661 "*A hook called after the summary buffer has been generated.
662 If you want to modify the summary buffer, you can use this hook."
663 :group 'gnus-summary-various
666 (defcustom gnus-summary-generate-hook nil
667 "*A hook run just before generating the summary buffer.
668 This hook is commonly used to customize threading variables and the
670 :group 'gnus-summary-various
673 (defcustom gnus-select-group-hook nil
674 "*A hook called when a newsgroup is selected.
676 If you'd like to simplify subjects like the
677 `gnus-summary-next-same-subject' command does, you can use the
680 (setq gnus-select-group-hook
683 (mapcar (lambda (header)
684 (mail-header-set-subject
686 (gnus-simplify-subject
687 (mail-header-subject header) 're-only)))
688 gnus-newsgroup-headers))))"
689 :group 'gnus-group-select
692 (defcustom gnus-select-article-hook nil
693 "*A hook called when an article is selected."
694 :group 'gnus-summary-choose
697 (defcustom gnus-visual-mark-article-hook
698 (list 'gnus-highlight-selected-summary)
699 "*Hook run after selecting an article in the summary buffer.
700 It is meant to be used for highlighting the article in some way. It
701 is not run if `gnus-visual' is nil."
702 :group 'gnus-summary-visual
705 (defcustom gnus-parse-headers-hook
706 (list 'gnus-decode-rfc1522)
707 "*A hook called before parsing the headers."
711 (defcustom gnus-exit-group-hook nil
712 "*A hook called when exiting (not quitting) summary mode."
716 (defcustom gnus-summary-update-hook
717 (list 'gnus-summary-highlight-line)
718 "*A hook called when a summary line is changed.
719 The hook will not be called if `gnus-visual' is nil.
721 The default function `gnus-summary-highlight-line' will
722 highlight the line according to the `gnus-summary-highlight'
724 :group 'gnus-summary-visual
727 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
728 "*A hook called when an article is selected for the first time.
729 The hook is intended to mark an article as read (or unread)
730 automatically when it is selected."
731 :group 'gnus-summary-choose
734 (defcustom gnus-group-no-more-groups-hook nil
735 "*A hook run when returning to group mode having no more (unread) groups."
736 :group 'gnus-group-select
739 (defface gnus-summary-selected-face '((t
741 "Face used for selected articles.")
743 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
744 "Face used for highlighting the current article in the summary buffer."
745 :group 'gnus-summary-visual
748 (defface gnus-summary-cancelled-face
750 (:foreground "yellow" :background "black")))
751 "Face used for cancelled articles.")
753 (defface gnus-summary-high-ticked-face
756 (:foreground "pink" :bold t))
759 (:foreground "firebrick" :bold t))
762 "Face used for high interest ticked articles.")
764 (defface gnus-summary-low-ticked-face
767 (:foreground "pink" :italic t))
770 (:foreground "firebrick" :italic t))
773 "Face used for low interest ticked articles.")
775 (defface gnus-summary-normal-ticked-face
778 (:foreground "pink"))
781 (:foreground "firebrick"))
784 "Face used for normal interest ticked articles.")
786 (defface gnus-summary-high-ancient-face
789 (:foreground "SkyBlue" :bold t))
792 (:foreground "RoyalBlue" :bold t))
795 "Face used for high interest ancient articles.")
797 (defface gnus-summary-low-ancient-face
800 (:foreground "SkyBlue" :italic t))
803 (:foreground "RoyalBlue" :italic t))
806 "Face used for low interest ancient articles.")
808 (defface gnus-summary-normal-ancient-face
811 (:foreground "SkyBlue"))
814 (:foreground "RoyalBlue"))
817 "Face used for normal interest ancient articles.")
819 (defface gnus-summary-high-unread-face
822 "Face used for high interest unread articles.")
824 (defface gnus-summary-low-unread-face
827 "Face used for low interest unread articles.")
829 (defface gnus-summary-normal-unread-face
832 "Face used for normal interest unread articles.")
834 (defface gnus-summary-high-read-face
837 (:foreground "PaleGreen"
841 (:foreground "DarkGreen"
845 "Face used for high interest read articles.")
847 (defface gnus-summary-low-read-face
850 (:foreground "PaleGreen"
854 (:foreground "DarkGreen"
858 "Face used for low interest read articles.")
860 (defface gnus-summary-normal-read-face
863 (:foreground "PaleGreen"))
866 (:foreground "DarkGreen"))
869 "Face used for normal interest read articles.")
871 (defcustom gnus-summary-highlight
872 '(((= mark gnus-canceled-mark)
873 . gnus-summary-cancelled-face)
874 ((and (> score default)
875 (or (= mark gnus-dormant-mark)
876 (= mark gnus-ticked-mark)))
877 . gnus-summary-high-ticked-face)
878 ((and (< score default)
879 (or (= mark gnus-dormant-mark)
880 (= mark gnus-ticked-mark)))
881 . gnus-summary-low-ticked-face)
882 ((or (= mark gnus-dormant-mark)
883 (= mark gnus-ticked-mark))
884 . gnus-summary-normal-ticked-face)
885 ((and (> score default) (= mark gnus-ancient-mark))
886 . gnus-summary-high-ancient-face)
887 ((and (< score default) (= mark gnus-ancient-mark))
888 . gnus-summary-low-ancient-face)
889 ((= mark gnus-ancient-mark)
890 . gnus-summary-normal-ancient-face)
891 ((and (> score default) (= mark gnus-unread-mark))
892 . gnus-summary-high-unread-face)
893 ((and (< score default) (= mark gnus-unread-mark))
894 . gnus-summary-low-unread-face)
895 ((and (= mark gnus-unread-mark))
896 . gnus-summary-normal-unread-face)
898 . gnus-summary-high-read-face)
900 . gnus-summary-low-read-face)
902 . gnus-summary-normal-read-face))
903 "Controls the highlighting of summary buffer lines.
905 A list of (FORM . FACE) pairs. When deciding how a a particular
906 summary line should be displayed, each form is evaluated. The content
907 of the face field after the first true form is used. You can change
908 how those summary lines are displayed, by editing the face field.
910 You can use the following variables in the FORM field.
912 score: The articles score
913 default: The default article score.
914 below: The score below which articles are automatically marked as read.
915 mark: The articles mark."
916 :group 'gnus-summary-visual
917 :type '(repeat (cons (sexp :tag "Form" nil)
920 ;;; Internal variables
922 (defvar gnus-scores-exclude-files nil)
924 (defvar gnus-summary-display-table
925 ;; Change the display table. Odd characters have a tendency to mess
926 ;; up nicely formatted displays - we make all possible glyphs
927 ;; display only a single character.
929 ;; We start from the standard display table, if any.
930 (let ((table (or (copy-sequence standard-display-table)
931 (make-display-table)))
932 ;; Nix out all the control chars...
934 (while (>= (setq i (1- i)) 0)
936 ;; ... but not newline and cr, of course. (cr is necessary for the
937 ;; selective display).
940 ;; We nix out any glyphs over 126 that are not set already.
942 (while (>= (setq i (1- i)) 127)
943 ;; Only modify if the entry is nil.
945 (aset table i [??]))))
947 "Display table used in summary mode buffers.")
949 (defvar gnus-original-article nil)
950 (defvar gnus-article-internal-prepare-hook nil)
951 (defvar gnus-newsgroup-process-stack nil)
953 (defvar gnus-thread-indent-array nil)
954 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
956 ;; Avoid highlighting in kill files.
957 (defvar gnus-summary-inhibit-highlight nil)
958 (defvar gnus-newsgroup-selected-overlay nil)
959 (defvar gnus-inhibit-limiting nil)
960 (defvar gnus-newsgroup-adaptive-score-file nil)
961 (defvar gnus-current-score-file nil)
962 (defvar gnus-current-move-group nil)
963 (defvar gnus-current-copy-group nil)
964 (defvar gnus-current-crosspost-group nil)
966 (defvar gnus-newsgroup-dependencies nil)
967 (defvar gnus-newsgroup-adaptive nil)
968 (defvar gnus-summary-display-article-function nil)
969 (defvar gnus-summary-highlight-line-function nil
970 "Function called after highlighting a summary line.")
972 (defvar gnus-summary-line-format-alist
973 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
974 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
975 (?s gnus-tmp-subject-or-nil ?s)
976 (?n gnus-tmp-name ?s)
977 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
979 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
981 (?F gnus-tmp-from ?s)
982 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
983 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
984 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
985 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
986 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
987 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
988 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
989 (?L gnus-tmp-lines ?d)
990 (?I gnus-tmp-indentation ?s)
991 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
992 (?R gnus-tmp-replied ?c)
993 (?\[ gnus-tmp-opening-bracket ?c)
994 (?\] gnus-tmp-closing-bracket ?c)
995 (?\> (make-string gnus-tmp-level ? ) ?s)
996 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
997 (?i gnus-tmp-score ?d)
998 (?z gnus-tmp-score-char ?c)
999 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
1000 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1001 (?U gnus-tmp-unread ?c)
1002 (?t (gnus-summary-number-of-articles-in-thread
1003 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1005 (?e (gnus-summary-number-of-articles-in-thread
1006 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1008 (?u gnus-tmp-user-defined ?s)
1009 (?P (gnus-pick-line-number) ?d))
1010 "An alist of format specifications that can appear in summary lines,
1011 and what variables they correspond with, along with the type of the
1012 variable (string, integer, character, etc).")
1014 (defvar gnus-summary-dummy-line-format-alist
1015 `((?S gnus-tmp-subject ?s)
1016 (?N gnus-tmp-number ?d)
1017 (?u gnus-tmp-user-defined ?s)))
1019 (defvar gnus-summary-mode-line-format-alist
1020 `((?G gnus-tmp-group-name ?s)
1021 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1022 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1023 (?A gnus-tmp-article-number ?d)
1024 (?Z gnus-tmp-unread-and-unselected ?s)
1025 (?V gnus-version ?s)
1026 (?U gnus-tmp-unread-and-unticked ?d)
1027 (?S gnus-tmp-subject ?s)
1028 (?e gnus-tmp-unselected ?d)
1029 (?u gnus-tmp-user-defined ?s)
1030 (?d (length gnus-newsgroup-dormant) ?d)
1031 (?t (length gnus-newsgroup-marked) ?d)
1032 (?r (length gnus-newsgroup-reads) ?d)
1033 (?E gnus-newsgroup-expunged-tally ?d)
1034 (?s (gnus-current-score-file-nondirectory) ?s)))
1036 (defvar gnus-last-search-regexp nil
1037 "Default regexp for article search command.")
1039 (defvar gnus-last-shell-command nil
1040 "Default shell command on article.")
1042 (defvar gnus-newsgroup-begin nil)
1043 (defvar gnus-newsgroup-end nil)
1044 (defvar gnus-newsgroup-last-rmail nil)
1045 (defvar gnus-newsgroup-last-mail nil)
1046 (defvar gnus-newsgroup-last-folder nil)
1047 (defvar gnus-newsgroup-last-file nil)
1048 (defvar gnus-newsgroup-auto-expire nil)
1049 (defvar gnus-newsgroup-active nil)
1051 (defvar gnus-newsgroup-data nil)
1052 (defvar gnus-newsgroup-data-reverse nil)
1053 (defvar gnus-newsgroup-limit nil)
1054 (defvar gnus-newsgroup-limits nil)
1056 (defvar gnus-newsgroup-unreads nil
1057 "List of unread articles in the current newsgroup.")
1059 (defvar gnus-newsgroup-unselected nil
1060 "List of unselected unread articles in the current newsgroup.")
1062 (defvar gnus-newsgroup-reads nil
1063 "Alist of read articles and article marks in the current newsgroup.")
1065 (defvar gnus-newsgroup-expunged-tally nil)
1067 (defvar gnus-newsgroup-marked nil
1068 "List of ticked articles in the current newsgroup (a subset of unread art).")
1070 (defvar gnus-newsgroup-killed nil
1071 "List of ranges of articles that have been through the scoring process.")
1073 (defvar gnus-newsgroup-cached nil
1074 "List of articles that come from the article cache.")
1076 (defvar gnus-newsgroup-saved nil
1077 "List of articles that have been saved.")
1079 (defvar gnus-newsgroup-kill-headers nil)
1081 (defvar gnus-newsgroup-replied nil
1082 "List of articles that have been replied to in the current newsgroup.")
1084 (defvar gnus-newsgroup-expirable nil
1085 "List of articles in the current newsgroup that can be expired.")
1087 (defvar gnus-newsgroup-processable nil
1088 "List of articles in the current newsgroup that can be processed.")
1090 (defvar gnus-newsgroup-bookmarks nil
1091 "List of articles in the current newsgroup that have bookmarks.")
1093 (defvar gnus-newsgroup-dormant nil
1094 "List of dormant articles in the current newsgroup.")
1096 (defvar gnus-newsgroup-scored nil
1097 "List of scored articles in the current newsgroup.")
1099 (defvar gnus-newsgroup-headers nil
1100 "List of article headers in the current newsgroup.")
1102 (defvar gnus-newsgroup-threads nil)
1104 (defvar gnus-newsgroup-prepared nil
1105 "Whether the current group has been prepared properly.")
1107 (defvar gnus-newsgroup-ancient nil
1108 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1110 (defvar gnus-newsgroup-sparse nil)
1112 (defvar gnus-current-article nil)
1113 (defvar gnus-article-current nil)
1114 (defvar gnus-current-headers nil)
1115 (defvar gnus-have-all-headers nil)
1116 (defvar gnus-last-article nil)
1117 (defvar gnus-newsgroup-history nil)
1119 (defconst gnus-summary-local-variables
1120 '(gnus-newsgroup-name
1121 gnus-newsgroup-begin gnus-newsgroup-end
1122 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1123 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1124 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1125 gnus-newsgroup-unselected gnus-newsgroup-marked
1126 gnus-newsgroup-reads gnus-newsgroup-saved
1127 gnus-newsgroup-replied gnus-newsgroup-expirable
1128 gnus-newsgroup-processable gnus-newsgroup-killed
1129 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1130 gnus-newsgroup-headers gnus-newsgroup-threads
1131 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1132 gnus-current-article gnus-current-headers gnus-have-all-headers
1133 gnus-last-article gnus-article-internal-prepare-hook
1134 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1135 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1136 gnus-thread-expunge-below
1137 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1138 (gnus-summary-mark-below . global)
1139 gnus-newsgroup-active gnus-scores-exclude-files
1140 gnus-newsgroup-history gnus-newsgroup-ancient
1141 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1142 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1143 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1144 (gnus-newsgroup-expunged-tally . 0)
1145 gnus-cache-removable-articles gnus-newsgroup-cached
1146 gnus-newsgroup-data gnus-newsgroup-data-reverse
1147 gnus-newsgroup-limit gnus-newsgroup-limits)
1148 "Variables that are buffer-local to the summary buffers.")
1150 ;; Byte-compiler warning.
1151 (defvar gnus-article-mode-map)
1153 ;; Subject simplification.
1155 (defsubst gnus-simplify-subject-re (subject)
1156 "Remove \"Re:\" from subject lines."
1157 (if (string-match "^[Rr][Ee]: *" subject)
1158 (substring subject (match-end 0))
1161 (defun gnus-simplify-subject (subject &optional re-only)
1162 "Remove `Re:' and words in parentheses.
1163 If RE-ONLY is non-nil, strip leading `Re:'s only."
1164 (let ((case-fold-search t)) ;Ignore case.
1165 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1166 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1167 (setq subject (substring subject (match-end 0))))
1168 ;; Remove uninteresting prefixes.
1169 (when (and (not re-only)
1170 gnus-simplify-ignored-prefixes
1171 (string-match gnus-simplify-ignored-prefixes subject))
1172 (setq subject (substring subject (match-end 0))))
1173 ;; Remove words in parentheses from end.
1175 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1176 (setq subject (substring subject 0 (match-beginning 0)))))
1177 ;; Return subject string.
1180 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1182 ;; Written by Stainless Steel Rat <ratinox@ccs.neu.edu>.
1183 (defun gnus-simplify-buffer-fuzzy ()
1184 (let ((case-fold-search t))
1185 (goto-char (point-min))
1186 (while (search-forward "\t" nil t)
1187 (replace-match " " t t))
1188 (goto-char (point-min))
1189 (re-search-forward "^ *\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;] *" nil t)
1190 (goto-char (match-beginning 0))
1193 gnus-simplify-subject-fuzzy-regexp
1194 (looking-at gnus-simplify-subject-fuzzy-regexp))
1195 (looking-at "^ *\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1196 (looking-at "^[[].*: .*[]]$"))
1197 (goto-char (point-min))
1198 (when gnus-simplify-subject-fuzzy-regexp
1199 (while (re-search-forward gnus-simplify-subject-fuzzy-regexp
1201 (replace-match "" t t)))
1202 (goto-char (point-min))
1203 (while (re-search-forward "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *"
1205 (replace-match "" t t))
1206 (goto-char (point-min))
1207 (while (re-search-forward "^[[].*: .*[]]$" nil t)
1208 (goto-char (match-end 0))
1211 (progn (goto-char (match-beginning 0)))
1212 (re-search-forward ":"))))
1213 (goto-char (point-min))
1214 (while (re-search-forward " *[[{(][^()\n]*[]})] *$" nil t)
1215 (replace-match "" t t))
1216 (goto-char (point-min))
1217 (while (re-search-forward " +" nil t)
1218 (replace-match " " t t))
1219 (goto-char (point-min))
1220 (while (re-search-forward " $" nil t)
1221 (replace-match "" t t))
1222 (goto-char (point-min))
1223 (while (re-search-forward "^ +" nil t)
1224 (replace-match "" t t))))
1226 (defun gnus-simplify-subject-fuzzy (subject)
1227 "Simplify a subject string fuzzily."
1229 (gnus-set-work-buffer)
1230 (let ((case-fold-search t))
1232 (inline (gnus-simplify-buffer-fuzzy))
1235 (defsubst gnus-simplify-subject-fully (subject)
1236 "Simplify a subject string according to the user's wishes."
1238 ((null gnus-summary-gather-subject-limit)
1239 (gnus-simplify-subject-re subject))
1240 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1241 (gnus-simplify-subject-fuzzy subject))
1242 ((numberp gnus-summary-gather-subject-limit)
1243 (gnus-limit-string (gnus-simplify-subject-re subject)
1244 gnus-summary-gather-subject-limit))
1248 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1249 "Check whether two subjects are equal. If optional argument
1250 simple-first is t, first argument is already simplified."
1252 ((null simple-first)
1253 (equal (gnus-simplify-subject-fully s1)
1254 (gnus-simplify-subject-fully s2)))
1257 (gnus-simplify-subject-fully s2)))))
1259 (defun gnus-offer-save-summaries ()
1260 "Offer to save all active summary buffers."
1262 (let ((buflist (buffer-list))
1264 ;; Go through all buffers and find all summaries.
1266 (and (setq bufname (buffer-name (car buflist)))
1267 (string-match "Summary" bufname)
1269 (set-buffer bufname)
1270 ;; We check that this is, indeed, a summary buffer.
1271 (and (eq major-mode 'gnus-summary-mode)
1272 ;; Also make sure this isn't bogus.
1273 gnus-newsgroup-prepared))
1274 (push bufname buffers))
1275 (setq buflist (cdr buflist)))
1276 ;; Go through all these summary buffers and offer to save them.
1279 "Update summary buffer %s? "
1280 (lambda (buf) (set-buffer buf) (gnus-summary-exit))
1283 (defun gnus-summary-bubble-group ()
1284 "Increase the score of the current group.
1285 This is a handy function to add to `gnus-summary-exit-hook' to
1286 increase the score of each group you read."
1287 (gnus-group-add-score gnus-newsgroup-name))
1291 ;;; Gnus summary mode
1294 (put 'gnus-summary-mode 'mode-class 'special)
1297 ;; Non-orthogonal keys
1299 (gnus-define-keys gnus-summary-mode-map
1300 " " gnus-summary-next-page
1301 "\177" gnus-summary-prev-page
1302 [delete] gnus-summary-prev-page
1303 "\r" gnus-summary-scroll-up
1304 "n" gnus-summary-next-unread-article
1305 "p" gnus-summary-prev-unread-article
1306 "N" gnus-summary-next-article
1307 "P" gnus-summary-prev-article
1308 "\M-\C-n" gnus-summary-next-same-subject
1309 "\M-\C-p" gnus-summary-prev-same-subject
1310 "\M-n" gnus-summary-next-unread-subject
1311 "\M-p" gnus-summary-prev-unread-subject
1312 "." gnus-summary-first-unread-article
1313 "," gnus-summary-best-unread-article
1314 "\M-s" gnus-summary-search-article-forward
1315 "\M-r" gnus-summary-search-article-backward
1316 "<" gnus-summary-beginning-of-article
1317 ">" gnus-summary-end-of-article
1318 "j" gnus-summary-goto-article
1319 "^" gnus-summary-refer-parent-article
1320 "\M-^" gnus-summary-refer-article
1321 "u" gnus-summary-tick-article-forward
1322 "!" gnus-summary-tick-article-forward
1323 "U" gnus-summary-tick-article-backward
1324 "d" gnus-summary-mark-as-read-forward
1325 "D" gnus-summary-mark-as-read-backward
1326 "E" gnus-summary-mark-as-expirable
1327 "\M-u" gnus-summary-clear-mark-forward
1328 "\M-U" gnus-summary-clear-mark-backward
1329 "k" gnus-summary-kill-same-subject-and-select
1330 "\C-k" gnus-summary-kill-same-subject
1331 "\M-\C-k" gnus-summary-kill-thread
1332 "\M-\C-l" gnus-summary-lower-thread
1333 "e" gnus-summary-edit-article
1334 "#" gnus-summary-mark-as-processable
1335 "\M-#" gnus-summary-unmark-as-processable
1336 "\M-\C-t" gnus-summary-toggle-threads
1337 "\M-\C-s" gnus-summary-show-thread
1338 "\M-\C-h" gnus-summary-hide-thread
1339 "\M-\C-f" gnus-summary-next-thread
1340 "\M-\C-b" gnus-summary-prev-thread
1341 "\M-\C-u" gnus-summary-up-thread
1342 "\M-\C-d" gnus-summary-down-thread
1343 "&" gnus-summary-execute-command
1344 "c" gnus-summary-catchup-and-exit
1345 "\C-w" gnus-summary-mark-region-as-read
1346 "\C-t" gnus-summary-toggle-truncation
1347 "?" gnus-summary-mark-as-dormant
1348 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1349 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1350 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1351 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1352 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1353 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1354 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1355 "=" gnus-summary-expand-window
1356 "\C-x\C-s" gnus-summary-reselect-current-group
1357 "\M-g" gnus-summary-rescan-group
1358 "w" gnus-summary-stop-page-breaking
1359 "\C-c\C-r" gnus-summary-caesar-message
1360 "\M-t" gnus-summary-toggle-mime
1361 "f" gnus-summary-followup
1362 "F" gnus-summary-followup-with-original
1363 "C" gnus-summary-cancel-article
1364 "r" gnus-summary-reply
1365 "R" gnus-summary-reply-with-original
1366 "\C-c\C-f" gnus-summary-mail-forward
1367 "o" gnus-summary-save-article
1368 "\C-o" gnus-summary-save-article-mail
1369 "|" gnus-summary-pipe-output
1370 "\M-k" gnus-summary-edit-local-kill
1371 "\M-K" gnus-summary-edit-global-kill
1373 "\C-c\C-d" gnus-summary-describe-group
1374 "q" gnus-summary-exit
1375 "Q" gnus-summary-exit-no-update
1376 "\C-c\C-i" gnus-info-find-node
1377 gnus-mouse-2 gnus-mouse-pick-article
1378 "m" gnus-summary-mail-other-window
1379 "a" gnus-summary-post-news
1380 "x" gnus-summary-limit-to-unread
1381 "s" gnus-summary-isearch-article
1382 "t" gnus-article-hide-headers
1383 "g" gnus-summary-show-article
1384 "l" gnus-summary-goto-last-article
1385 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1386 "\C-d" gnus-summary-enter-digest-group
1387 "\M-\C-d" gnus-summary-read-document
1389 "*" gnus-cache-enter-article
1390 "\M-*" gnus-cache-remove-article
1391 "\M-&" gnus-summary-universal-argument
1392 "\C-l" gnus-recenter
1393 "I" gnus-summary-increase-score
1394 "L" gnus-summary-lower-score
1396 "V" gnus-summary-score-map
1397 "X" gnus-uu-extract-map
1398 "S" gnus-summary-send-map)
1400 ;; Sort of orthogonal keymap
1401 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1402 "t" gnus-summary-tick-article-forward
1403 "!" gnus-summary-tick-article-forward
1404 "d" gnus-summary-mark-as-read-forward
1405 "r" gnus-summary-mark-as-read-forward
1406 "c" gnus-summary-clear-mark-forward
1407 " " gnus-summary-clear-mark-forward
1408 "e" gnus-summary-mark-as-expirable
1409 "x" gnus-summary-mark-as-expirable
1410 "?" gnus-summary-mark-as-dormant
1411 "b" gnus-summary-set-bookmark
1412 "B" gnus-summary-remove-bookmark
1413 "#" gnus-summary-mark-as-processable
1414 "\M-#" gnus-summary-unmark-as-processable
1415 "S" gnus-summary-limit-include-expunged
1416 "C" gnus-summary-catchup
1417 "H" gnus-summary-catchup-to-here
1418 "\C-c" gnus-summary-catchup-all
1419 "k" gnus-summary-kill-same-subject-and-select
1420 "K" gnus-summary-kill-same-subject
1421 "P" gnus-uu-mark-map)
1423 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1424 "c" gnus-summary-clear-above
1425 "u" gnus-summary-tick-above
1426 "m" gnus-summary-mark-above
1427 "k" gnus-summary-kill-below)
1429 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1430 "/" gnus-summary-limit-to-subject
1431 "n" gnus-summary-limit-to-articles
1432 "w" gnus-summary-pop-limit
1433 "s" gnus-summary-limit-to-subject
1434 "a" gnus-summary-limit-to-author
1435 "u" gnus-summary-limit-to-unread
1436 "m" gnus-summary-limit-to-marks
1437 "v" gnus-summary-limit-to-score
1438 "D" gnus-summary-limit-include-dormant
1439 "d" gnus-summary-limit-exclude-dormant
1440 "t" gnus-summary-limit-to-age
1441 "E" gnus-summary-limit-include-expunged
1442 "c" gnus-summary-limit-exclude-childless-dormant
1443 "C" gnus-summary-limit-mark-excluded-as-read)
1445 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1446 "n" gnus-summary-next-unread-article
1447 "p" gnus-summary-prev-unread-article
1448 "N" gnus-summary-next-article
1449 "P" gnus-summary-prev-article
1450 "\C-n" gnus-summary-next-same-subject
1451 "\C-p" gnus-summary-prev-same-subject
1452 "\M-n" gnus-summary-next-unread-subject
1453 "\M-p" gnus-summary-prev-unread-subject
1454 "f" gnus-summary-first-unread-article
1455 "b" gnus-summary-best-unread-article
1456 "j" gnus-summary-goto-article
1457 "g" gnus-summary-goto-subject
1458 "l" gnus-summary-goto-last-article
1459 "p" gnus-summary-pop-article)
1461 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1462 "k" gnus-summary-kill-thread
1463 "l" gnus-summary-lower-thread
1464 "i" gnus-summary-raise-thread
1465 "T" gnus-summary-toggle-threads
1466 "t" gnus-summary-rethread-current
1467 "^" gnus-summary-reparent-thread
1468 "s" gnus-summary-show-thread
1469 "S" gnus-summary-show-all-threads
1470 "h" gnus-summary-hide-thread
1471 "H" gnus-summary-hide-all-threads
1472 "n" gnus-summary-next-thread
1473 "p" gnus-summary-prev-thread
1474 "u" gnus-summary-up-thread
1475 "o" gnus-summary-top-thread
1476 "d" gnus-summary-down-thread
1477 "#" gnus-uu-mark-thread
1478 "\M-#" gnus-uu-unmark-thread)
1480 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1481 "g" gnus-summary-prepare
1482 "c" gnus-summary-insert-cached-articles)
1484 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1485 "c" gnus-summary-catchup-and-exit
1486 "C" gnus-summary-catchup-all-and-exit
1487 "E" gnus-summary-exit-no-update
1488 "Q" gnus-summary-exit
1489 "Z" gnus-summary-exit
1490 "n" gnus-summary-catchup-and-goto-next-group
1491 "R" gnus-summary-reselect-current-group
1492 "G" gnus-summary-rescan-group
1493 "N" gnus-summary-next-group
1494 "s" gnus-summary-save-newsrc
1495 "P" gnus-summary-prev-group)
1497 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1498 " " gnus-summary-next-page
1499 "n" gnus-summary-next-page
1500 "\177" gnus-summary-prev-page
1501 [delete] gnus-summary-prev-page
1502 "p" gnus-summary-prev-page
1503 "\r" gnus-summary-scroll-up
1504 "<" gnus-summary-beginning-of-article
1505 ">" gnus-summary-end-of-article
1506 "b" gnus-summary-beginning-of-article
1507 "e" gnus-summary-end-of-article
1508 "^" gnus-summary-refer-parent-article
1509 "r" gnus-summary-refer-parent-article
1510 "R" gnus-summary-refer-references
1511 "g" gnus-summary-show-article
1512 "s" gnus-summary-isearch-article
1513 "P" gnus-summary-print-article)
1515 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1516 "b" gnus-article-add-buttons
1517 "B" gnus-article-add-buttons-to-head
1518 "o" gnus-article-treat-overstrike
1519 "e" gnus-article-emphasize
1520 "w" gnus-article-fill-cited-article
1521 "c" gnus-article-remove-cr
1522 "q" gnus-article-de-quoted-unreadable
1523 "f" gnus-article-display-x-face
1524 "l" gnus-summary-stop-page-breaking
1525 "r" gnus-summary-caesar-message
1526 "t" gnus-article-hide-headers
1527 "v" gnus-summary-verbose-headers
1528 "m" gnus-summary-toggle-mime)
1530 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1531 "a" gnus-article-hide
1532 "h" gnus-article-hide-headers
1533 "b" gnus-article-hide-boring-headers
1534 "s" gnus-article-hide-signature
1535 "c" gnus-article-hide-citation
1536 "p" gnus-article-hide-pgp
1537 "P" gnus-article-hide-pem
1538 "\C-c" gnus-article-hide-citation-maybe)
1540 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1541 "a" gnus-article-highlight
1542 "h" gnus-article-highlight-headers
1543 "c" gnus-article-highlight-citation
1544 "s" gnus-article-highlight-signature)
1546 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1547 "z" gnus-article-date-ut
1548 "u" gnus-article-date-ut
1549 "l" gnus-article-date-local
1550 "e" gnus-article-date-lapsed
1551 "o" gnus-article-date-original)
1553 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1554 "t" gnus-article-remove-trailing-blank-lines
1555 "l" gnus-article-strip-leading-blank-lines
1556 "m" gnus-article-strip-multiple-blank-lines
1557 "a" gnus-article-strip-blank-lines)
1559 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1561 "f" gnus-summary-fetch-faq
1562 "d" gnus-summary-describe-group
1563 "h" gnus-summary-describe-briefly
1564 "i" gnus-info-find-node)
1566 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1567 "e" gnus-summary-expire-articles
1568 "\M-\C-e" gnus-summary-expire-articles-now
1569 "\177" gnus-summary-delete-article
1570 [delete] gnus-summary-delete-article
1571 "m" gnus-summary-move-article
1572 "r" gnus-summary-respool-article
1573 "w" gnus-summary-edit-article
1574 "c" gnus-summary-copy-article
1575 "B" gnus-summary-crosspost-article
1576 "q" gnus-summary-respool-query
1577 "i" gnus-summary-import-article
1578 "p" gnus-summary-article-posted-p)
1580 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1581 "o" gnus-summary-save-article
1582 "m" gnus-summary-save-article-mail
1583 "F" gnus-summary-write-article-file
1584 "r" gnus-summary-save-article-rmail
1585 "f" gnus-summary-save-article-file
1586 "b" gnus-summary-save-article-body-file
1587 "h" gnus-summary-save-article-folder
1588 "v" gnus-summary-save-article-vm
1589 "p" gnus-summary-pipe-output
1590 "s" gnus-soup-add-article))
1592 (defun gnus-summary-make-menu-bar ()
1593 (gnus-turn-off-edit-menu 'summary)
1595 (unless (boundp 'gnus-summary-misc-menu)
1598 gnus-summary-kill-menu gnus-summary-mode-map ""
1603 ["Enter score..." gnus-summary-score-entry t]
1604 ["Customize" gnus-score-customize t])
1605 (gnus-make-score-map 'increase)
1606 (gnus-make-score-map 'lower)
1608 ["Kill below" gnus-summary-kill-below t]
1609 ["Mark above" gnus-summary-mark-above t]
1610 ["Tick above" gnus-summary-tick-above t]
1611 ["Clear above" gnus-summary-clear-above t])
1612 ["Current score" gnus-summary-current-score t]
1613 ["Set score" gnus-summary-set-score t]
1614 ["Switch current score file..." gnus-score-change-score-file t]
1615 ["Set mark below..." gnus-score-set-mark-below t]
1616 ["Set expunge below..." gnus-score-set-expunge-below t]
1617 ["Edit current score file" gnus-score-edit-current-scores t]
1618 ["Edit score file" gnus-score-edit-file t]
1619 ["Trace score" gnus-score-find-trace t]
1620 ["Find words" gnus-score-find-favourite-words t]
1621 ["Rescore buffer" gnus-summary-rescore t]
1622 ["Increase score..." gnus-summary-increase-score t]
1623 ["Lower score..." gnus-summary-lower-score t]))))
1626 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1628 :selected (null gnus-score-default-header)]
1629 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1631 :selected (eq gnus-score-default-header 'a)]
1632 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1634 :selected (eq gnus-score-default-header 's)]
1636 (gnus-score-set-default 'gnus-score-default-header 'b)
1638 :selected (eq gnus-score-default-header 'b )]
1640 (gnus-score-set-default 'gnus-score-default-header 'h)
1642 :selected (eq gnus-score-default-header 'h )]
1643 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1645 :selected (eq gnus-score-default-header 'i )]
1646 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1648 :selected (eq gnus-score-default-header 't )]
1650 (gnus-score-set-default 'gnus-score-default-header 'x)
1652 :selected (eq gnus-score-default-header 'x )]
1653 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1655 :selected (eq gnus-score-default-header 'l )]
1656 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1658 :selected (eq gnus-score-default-header 'd )]
1659 ["Followups to author"
1660 (gnus-score-set-default 'gnus-score-default-header 'f)
1662 :selected (eq gnus-score-default-header 'f )])
1664 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1666 :selected (null gnus-score-default-type)]
1667 ;; The `:active' key is commented out in the following,
1668 ;; because the GNU Emacs hack to support radio buttons use
1669 ;; active to indicate which button is selected.
1670 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1672 ;; :active (not (memq gnus-score-default-header '(l d)))
1673 :selected (eq gnus-score-default-type 's)]
1674 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1676 ;; :active (not (memq gnus-score-default-header '(l d)))
1677 :selected (eq gnus-score-default-type 'r)]
1678 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1680 ;; :active (not (memq gnus-score-default-header '(l d)))
1681 :selected (eq gnus-score-default-type 'e)]
1682 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1684 ;; :active (not (memq gnus-score-default-header '(l d)))
1685 :selected (eq gnus-score-default-type 'f)]
1686 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1688 ;; :active (eq (gnus-score-default-header 'd))
1689 :selected (eq gnus-score-default-type 'b)]
1690 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1692 ;; :active (eq (gnus-score-default-header 'd))
1693 :selected (eq gnus-score-default-type 'n)]
1694 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1696 ;; :active (eq (gnus-score-default-header 'd))
1697 :selected (eq gnus-score-default-type 'a)]
1699 (gnus-score-set-default 'gnus-score-default-type '<)
1701 ;; :active (eq (gnus-score-default-header 'l))
1702 :selected (eq gnus-score-default-type '<)]
1704 (gnus-score-set-default 'gnus-score-default-type '=)
1706 ;; :active (eq (gnus-score-default-header 'l))
1707 :selected (eq gnus-score-default-type '=)]
1708 ["Greater than number"
1709 (gnus-score-set-default 'gnus-score-default-type '>)
1711 ;; :active (eq (gnus-score-default-header 'l))
1712 :selected (eq gnus-score-default-type '>)])
1713 ["Default fold" gnus-score-default-fold-toggle
1715 :selected gnus-score-default-fold]
1717 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1719 :selected (null gnus-score-default-duration)]
1721 (gnus-score-set-default 'gnus-score-default-duration 'p)
1723 :selected (eq gnus-score-default-duration 'p)]
1725 (gnus-score-set-default 'gnus-score-default-duration 't)
1727 :selected (eq gnus-score-default-duration 't)]
1729 (gnus-score-set-default 'gnus-score-default-duration 'i)
1731 :selected (eq gnus-score-default-duration 'i)]))
1734 gnus-summary-article-menu gnus-summary-mode-map ""
1737 ["All" gnus-article-hide t]
1738 ["Headers" gnus-article-hide-headers t]
1739 ["Signature" gnus-article-hide-signature t]
1740 ["Citation" gnus-article-hide-citation t]
1741 ["PGP" gnus-article-hide-pgp t]
1742 ["Boring headers" gnus-article-hide-boring-headers t])
1744 ["All" gnus-article-highlight t]
1745 ["Headers" gnus-article-highlight-headers t]
1746 ["Signature" gnus-article-highlight-signature t]
1747 ["Citation" gnus-article-highlight-citation t])
1749 ["Local" gnus-article-date-local t]
1750 ["UT" gnus-article-date-ut t]
1751 ["Original" gnus-article-date-original t]
1752 ["Lapsed" gnus-article-date-lapsed t])
1755 ["Leading" gnus-article-strip-leading-blank-lines t]
1756 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1757 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1758 ["All of the above" gnus-article-strip-blank-lines t])
1759 ["Overstrike" gnus-article-treat-overstrike t]
1760 ["Emphasis" gnus-article-emphasize t]
1761 ["Word wrap" gnus-article-fill-cited-article t]
1762 ["CR" gnus-article-remove-cr t]
1763 ["Show X-Face" gnus-article-display-x-face t]
1764 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1765 ["Rot 13" gnus-summary-caesar-message t]
1766 ["Add buttons" gnus-article-add-buttons t]
1767 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1768 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1769 ["Toggle MIME" gnus-summary-toggle-mime t]
1770 ["Verbose header" gnus-summary-verbose-headers t]
1771 ["Toggle header" gnus-summary-toggle-header t])
1773 ["Save in default format" gnus-summary-save-article t]
1774 ["Save in file" gnus-summary-save-article-file t]
1775 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1776 ["Write to file" gnus-summary-write-article-mail t]
1777 ["Save in MH folder" gnus-summary-save-article-folder t]
1778 ["Save in VM folder" gnus-summary-save-article-vm t]
1779 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1780 ["Save body in file" gnus-summary-save-article-body-file t]
1781 ["Pipe through a filter" gnus-summary-pipe-output t]
1782 ["Add to SOUP packet" gnus-soup-add-article t]
1783 ["Print" gnus-summary-print-article t])
1785 ["Respool article..." gnus-summary-respool-article t]
1786 ["Move article..." gnus-summary-move-article
1787 (gnus-check-backend-function
1788 'request-move-article gnus-newsgroup-name)]
1789 ["Copy article..." gnus-summary-copy-article t]
1790 ["Crosspost article..." gnus-summary-crosspost-article
1791 (gnus-check-backend-function
1792 'request-replace-article gnus-newsgroup-name)]
1793 ["Import file..." gnus-summary-import-article t]
1794 ["Check if posted" gnus-summary-article-posted-p t]
1795 ["Edit article" gnus-summary-edit-article
1796 (not (gnus-group-read-only-p))]
1797 ["Delete article" gnus-summary-delete-article
1798 (gnus-check-backend-function
1799 'request-expire-articles gnus-newsgroup-name)]
1800 ["Query respool" gnus-summary-respool-query t]
1801 ["Delete expirable articles" gnus-summary-expire-articles-now
1802 (gnus-check-backend-function
1803 'request-expire-articles gnus-newsgroup-name)])
1805 ["Uudecode" gnus-uu-decode-uu t]
1806 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1807 ["Unshar" gnus-uu-decode-unshar t]
1808 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1809 ["Save" gnus-uu-decode-save t]
1810 ["Binhex" gnus-uu-decode-binhex t]
1811 ["Postscript" gnus-uu-decode-postscript t])
1812 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1813 ["Isearch article..." gnus-summary-isearch-article t]
1814 ["Search articles forward..." gnus-summary-search-article-forward t]
1815 ["Search articles backward..." gnus-summary-search-article-backward t]
1816 ["Beginning of the article" gnus-summary-beginning-of-article t]
1817 ["End of the article" gnus-summary-end-of-article t]
1818 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1819 ["Fetch referenced articles" gnus-summary-refer-references t]
1820 ["Fetch article with id..." gnus-summary-refer-article t]
1821 ["Redisplay" gnus-summary-show-article t]))
1824 gnus-summary-thread-menu gnus-summary-mode-map ""
1826 ["Toggle threading" gnus-summary-toggle-threads t]
1827 ["Hide threads" gnus-summary-hide-all-threads t]
1828 ["Show threads" gnus-summary-show-all-threads t]
1829 ["Hide thread" gnus-summary-hide-thread t]
1830 ["Show thread" gnus-summary-show-thread t]
1831 ["Go to next thread" gnus-summary-next-thread t]
1832 ["Go to previous thread" gnus-summary-prev-thread t]
1833 ["Go down thread" gnus-summary-down-thread t]
1834 ["Go up thread" gnus-summary-up-thread t]
1835 ["Top of thread" gnus-summary-top-thread t]
1836 ["Mark thread as read" gnus-summary-kill-thread t]
1837 ["Lower thread score" gnus-summary-lower-thread t]
1838 ["Raise thread score" gnus-summary-raise-thread t]
1839 ["Rethread current" gnus-summary-rethread-current t]
1843 gnus-summary-post-menu gnus-summary-mode-map ""
1845 ["Post an article" gnus-summary-post-news t]
1846 ["Followup" gnus-summary-followup t]
1847 ["Followup and yank" gnus-summary-followup-with-original t]
1848 ["Supersede article" gnus-summary-supersede-article t]
1849 ["Cancel article" gnus-summary-cancel-article t]
1850 ["Reply" gnus-summary-reply t]
1851 ["Reply and yank" gnus-summary-reply-with-original t]
1852 ["Mail forward" gnus-summary-mail-forward t]
1853 ["Post forward" gnus-summary-post-forward t]
1854 ["Digest and mail" gnus-uu-digest-mail-forward t]
1855 ["Digest and post" gnus-uu-digest-post-forward t]
1856 ["Resend message" gnus-summary-resend-message t]
1857 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1858 ["Send a mail" gnus-summary-mail-other-window t]
1859 ["Uuencode and post" gnus-uu-post-news t]
1860 ["Followup via news" gnus-summary-followup-to-mail t]
1861 ["Followup via news and yank"
1862 gnus-summary-followup-to-mail-with-original t]
1864 ;;["Send" gnus-summary-send-draft t]
1865 ;;["Send bounced" gnus-resend-bounced-mail t])
1869 gnus-summary-misc-menu gnus-summary-mode-map ""
1872 ["Mark as read" gnus-summary-mark-as-read-forward t]
1873 ["Mark same subject and select"
1874 gnus-summary-kill-same-subject-and-select t]
1875 ["Mark same subject" gnus-summary-kill-same-subject t]
1876 ["Catchup" gnus-summary-catchup t]
1877 ["Catchup all" gnus-summary-catchup-all t]
1878 ["Catchup to here" gnus-summary-catchup-to-here t]
1879 ["Catchup region" gnus-summary-mark-region-as-read t]
1880 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1882 ["Tick" gnus-summary-tick-article-forward t]
1883 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1884 ["Remove marks" gnus-summary-clear-mark-forward t]
1885 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1886 ["Set bookmark" gnus-summary-set-bookmark t]
1887 ["Remove bookmark" gnus-summary-remove-bookmark t])
1889 ["Marks..." gnus-summary-limit-to-marks t]
1890 ["Subject..." gnus-summary-limit-to-subject t]
1891 ["Author..." gnus-summary-limit-to-author t]
1892 ["Age..." gnus-summary-limit-to-age t]
1893 ["Score" gnus-summary-limit-to-score t]
1894 ["Unread" gnus-summary-limit-to-unread t]
1895 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1896 ["Articles" gnus-summary-limit-to-articles t]
1897 ["Pop limit" gnus-summary-pop-limit t]
1898 ["Show dormant" gnus-summary-limit-include-dormant t]
1899 ["Hide childless dormant"
1900 gnus-summary-limit-exclude-childless-dormant t]
1901 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1902 ["Show expunged" gnus-summary-show-all-expunged t])
1904 ["Set mark" gnus-summary-mark-as-processable t]
1905 ["Remove mark" gnus-summary-unmark-as-processable t]
1906 ["Remove all marks" gnus-summary-unmark-all-processable t]
1907 ["Mark above" gnus-uu-mark-over t]
1908 ["Mark series" gnus-uu-mark-series t]
1909 ["Mark region" gnus-uu-mark-region t]
1910 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1911 ["Mark all" gnus-uu-mark-all t]
1912 ["Mark buffer" gnus-uu-mark-buffer t]
1913 ["Mark sparse" gnus-uu-mark-sparse t]
1914 ["Mark thread" gnus-uu-mark-thread t]
1915 ["Unmark thread" gnus-uu-unmark-thread t]
1916 ("Process Mark Sets"
1917 ["Kill" gnus-summary-kill-process-mark t]
1918 ["Yank" gnus-summary-yank-process-mark
1919 gnus-newsgroup-process-stack]
1920 ["Save" gnus-summary-save-process-mark t]))
1922 ["Page forward" gnus-summary-next-page t]
1923 ["Page backward" gnus-summary-prev-page t]
1924 ["Line forward" gnus-summary-scroll-up t])
1926 ["Next unread article" gnus-summary-next-unread-article t]
1927 ["Previous unread article" gnus-summary-prev-unread-article t]
1928 ["Next article" gnus-summary-next-article t]
1929 ["Previous article" gnus-summary-prev-article t]
1930 ["Next unread subject" gnus-summary-next-unread-subject t]
1931 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1932 ["Next article same subject" gnus-summary-next-same-subject t]
1933 ["Previous article same subject" gnus-summary-prev-same-subject t]
1934 ["First unread article" gnus-summary-first-unread-article t]
1935 ["Best unread article" gnus-summary-best-unread-article t]
1936 ["Go to subject number..." gnus-summary-goto-subject t]
1937 ["Go to article number..." gnus-summary-goto-article t]
1938 ["Go to the last article" gnus-summary-goto-last-article t]
1939 ["Pop article off history" gnus-summary-pop-article t])
1941 ["Sort by number" gnus-summary-sort-by-number t]
1942 ["Sort by author" gnus-summary-sort-by-author t]
1943 ["Sort by subject" gnus-summary-sort-by-subject t]
1944 ["Sort by date" gnus-summary-sort-by-date t]
1945 ["Sort by score" gnus-summary-sort-by-score t]
1946 ["Sort by lines" gnus-summary-sort-by-lines t])
1948 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1949 ["Describe group" gnus-summary-describe-group t]
1950 ["Read manual" gnus-info-find-node t])
1952 ["Enter article" gnus-cache-enter-article t]
1953 ["Remove article" gnus-cache-remove-article t])
1955 ["Pick and read" gnus-pick-mode t]
1956 ["Binary" gnus-binary-mode t])
1958 ["Regenerate" gnus-summary-prepare t]
1959 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1960 ["Toggle threading" gnus-summary-toggle-threads t])
1961 ["Filter articles..." gnus-summary-execute-command t]
1962 ["Run command on subjects..." gnus-summary-universal-argument t]
1963 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1964 ["Expand window" gnus-summary-expand-window t]
1965 ["Expire expirable articles" gnus-summary-expire-articles
1966 (gnus-check-backend-function
1967 'request-expire-articles gnus-newsgroup-name)]
1968 ["Regenerate buffer" gnus-summary-prepare t]
1969 ["Edit local kill file" gnus-summary-edit-local-kill t]
1970 ["Edit main kill file" gnus-summary-edit-global-kill t]
1972 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1973 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1974 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1975 ["Exit group" gnus-summary-exit t]
1976 ["Exit group without updating" gnus-summary-exit-no-update t]
1977 ["Exit and goto next group" gnus-summary-next-group t]
1978 ["Exit and goto prev group" gnus-summary-prev-group t]
1979 ["Reselect group" gnus-summary-reselect-current-group t]
1980 ["Rescan group" gnus-summary-rescan-group t]
1981 ["Update dribble" gnus-summary-save-newsrc t])))
1983 (run-hooks 'gnus-summary-menu-hook)))
1985 (defun gnus-score-set-default (var value)
1986 "A version of set that updates the GNU Emacs menu-bar."
1988 ;; It is the message that forces the active status to be updated.
1991 (defun gnus-make-score-map (type)
1992 "Make a summary score map of type TYPE."
1995 (let ((headers '(("author" "from" string)
1996 ("subject" "subject" string)
1997 ("article body" "body" string)
1998 ("article head" "head" string)
1999 ("xref" "xref" string)
2000 ("lines" "lines" number)
2001 ("followups to author" "followup" string)))
2002 (types '((number ("less than" <)
2005 (string ("substring" s)
2009 (perms '(("temporary" (current-time-string))
2017 (if (eq type 'lower)
2022 (setq header (car headers))
2028 (let ((ts (cdr (assoc (nth 2 header) types)))
2044 'gnus-summary-score-entry
2046 (if (or (string= (nth 1 header)
2048 (string= (nth 1 header)
2051 (list 'gnus-summary-header
2053 (list 'quote (nth 1 (car ts)))
2054 (list 'gnus-score-default nil)
2060 (list (nreverse outp))))
2063 (list (nreverse outt))))
2065 (setq headers (cdr headers)))
2066 (list (nreverse outh))))))))
2070 (defun gnus-summary-mode (&optional group)
2071 "Major mode for reading articles.
2073 All normal editing commands are switched off.
2074 \\<gnus-summary-mode-map>
2075 Each line in this buffer represents one article. To read an
2076 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2077 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2080 You can also post articles and send mail from this buffer. To
2081 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2082 of an article, type `\\[gnus-summary-reply]'.
2084 There are approx. one gazillion commands you can execute in this
2085 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2087 The following commands are available:
2089 \\{gnus-summary-mode-map}"
2091 (when (gnus-visual-p 'summary-menu 'menu)
2092 (gnus-summary-make-menu-bar))
2093 (kill-all-local-variables)
2094 (gnus-summary-make-local-variables)
2095 (gnus-make-thread-indent-array)
2096 (gnus-simplify-mode-line)
2097 (setq major-mode 'gnus-summary-mode)
2098 (setq mode-name "Summary")
2099 (make-local-variable 'minor-mode-alist)
2100 (use-local-map gnus-summary-mode-map)
2101 (buffer-disable-undo (current-buffer))
2102 (setq buffer-read-only t) ;Disable modification
2103 (setq truncate-lines t)
2104 (setq selective-display t)
2105 (setq selective-display-ellipses t) ;Display `...'
2106 (setq buffer-display-table gnus-summary-display-table)
2107 (gnus-set-default-directory)
2108 (setq gnus-newsgroup-name group)
2109 (make-local-variable 'gnus-summary-line-format)
2110 (make-local-variable 'gnus-summary-line-format-spec)
2111 (make-local-variable 'gnus-summary-mark-positions)
2112 (gnus-make-local-hook 'post-command-hook)
2113 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
2114 (run-hooks 'gnus-summary-mode-hook)
2115 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2116 (gnus-update-summary-mark-positions))
2118 (defun gnus-summary-make-local-variables ()
2119 "Make all the local summary buffer variables."
2120 (let ((locals gnus-summary-local-variables)
2122 (while (setq local (pop locals))
2125 (if (eq (cdr local) 'global)
2126 ;; Copy the global value of the variable.
2127 (setq global (symbol-value (car local)))
2128 ;; Use the value from the list.
2129 (setq global (eval (cdr local))))
2130 (make-local-variable (car local))
2131 (set (car local) global))
2132 ;; Simple nil-valued local variable.
2133 (make-local-variable local)
2136 (defun gnus-summary-clear-local-variables ()
2137 (let ((locals gnus-summary-local-variables))
2139 (if (consp (car locals))
2140 (and (vectorp (caar locals))
2141 (set (caar locals) nil))
2142 (and (vectorp (car locals))
2143 (set (car locals) nil)))
2144 (setq locals (cdr locals)))))
2146 ;; Summary data functions.
2148 (defmacro gnus-data-number (data)
2151 (defmacro gnus-data-set-number (data number)
2152 `(setcar ,data ,number))
2154 (defmacro gnus-data-mark (data)
2157 (defmacro gnus-data-set-mark (data mark)
2158 `(setcar (nthcdr 1 ,data) ,mark))
2160 (defmacro gnus-data-pos (data)
2163 (defmacro gnus-data-set-pos (data pos)
2164 `(setcar (nthcdr 2 ,data) ,pos))
2166 (defmacro gnus-data-header (data)
2169 (defmacro gnus-data-level (data)
2172 (defmacro gnus-data-unread-p (data)
2173 `(= (nth 1 ,data) gnus-unread-mark))
2175 (defmacro gnus-data-read-p (data)
2176 `(/= (nth 1 ,data) gnus-unread-mark))
2178 (defmacro gnus-data-pseudo-p (data)
2179 `(consp (nth 3 ,data)))
2181 (defmacro gnus-data-find (number)
2182 `(assq ,number gnus-newsgroup-data))
2184 (defmacro gnus-data-find-list (number &optional data)
2185 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2186 (memq (assq ,number bdata)
2189 (defmacro gnus-data-make (number mark pos header level)
2190 `(list ,number ,mark ,pos ,header ,level))
2192 (defun gnus-data-enter (after-article number mark pos header level offset)
2193 (let ((data (gnus-data-find-list after-article)))
2195 (error "No such article: %d" after-article))
2196 (setcdr data (cons (gnus-data-make number mark pos header level)
2198 (setq gnus-newsgroup-data-reverse nil)
2199 (gnus-data-update-list (cddr data) offset)))
2201 (defun gnus-data-enter-list (after-article list &optional offset)
2203 (let ((data (and after-article (gnus-data-find-list after-article)))
2205 (or data (not after-article) (error "No such article: %d" after-article))
2206 ;; Find the last element in the list to be spliced into the main
2209 (setq list (cdr list)))
2212 (setcdr list gnus-newsgroup-data)
2213 (setq gnus-newsgroup-data ilist)
2215 (gnus-data-update-list (cdr list) offset)))
2216 (setcdr list (cdr data))
2219 (gnus-data-update-list (cdr list) offset)))
2220 (setq gnus-newsgroup-data-reverse nil))))
2222 (defun gnus-data-remove (article &optional offset)
2223 (let ((data gnus-newsgroup-data))
2224 (if (= (gnus-data-number (car data)) article)
2226 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2227 gnus-newsgroup-data-reverse nil)
2229 (gnus-data-update-list gnus-newsgroup-data offset)))
2231 (when (= (gnus-data-number (cadr data)) article)
2232 (setcdr data (cddr data))
2234 (gnus-data-update-list (cdr data) offset))
2236 gnus-newsgroup-data-reverse nil))
2237 (setq data (cdr data))))))
2239 (defmacro gnus-data-list (backward)
2241 (or gnus-newsgroup-data-reverse
2242 (setq gnus-newsgroup-data-reverse
2243 (reverse gnus-newsgroup-data)))
2244 gnus-newsgroup-data))
2246 (defun gnus-data-update-list (data offset)
2247 "Add OFFSET to the POS of all data entries in DATA."
2249 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2250 (setq data (cdr data))))
2252 (defun gnus-data-compute-positions ()
2253 "Compute the positions of all articles."
2254 (let ((data gnus-newsgroup-data)
2257 (when (setq pos (text-property-any
2258 (point-min) (point-max)
2259 'gnus-number (gnus-data-number (car data))))
2260 (gnus-data-set-pos (car data) (+ pos 3)))
2261 (setq data (cdr data)))))
2263 (defun gnus-summary-article-pseudo-p (article)
2264 "Say whether this article is a pseudo article or not."
2265 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2267 (defmacro gnus-summary-article-sparse-p (article)
2268 "Say whether this article is a sparse article or not."
2269 ` (memq ,article gnus-newsgroup-sparse))
2271 (defmacro gnus-summary-article-ancient-p (article)
2272 "Say whether this article is a sparse article or not."
2273 `(memq ,article gnus-newsgroup-ancient))
2275 (defun gnus-article-parent-p (number)
2276 "Say whether this article is a parent or not."
2277 (let ((data (gnus-data-find-list number)))
2278 (and (cdr data) ; There has to be an article after...
2279 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2280 (gnus-data-level (nth 1 data))))))
2282 (defun gnus-article-children (number)
2283 "Return a list of all children to NUMBER."
2284 (let* ((data (gnus-data-find-list number))
2285 (level (gnus-data-level (car data)))
2287 (setq data (cdr data))
2289 (= (gnus-data-level (car data)) (1+ level)))
2290 (push (gnus-data-number (car data)) children)
2291 (setq data (cdr data)))
2294 (defmacro gnus-summary-skip-intangible ()
2295 "If the current article is intangible, then jump to a different article."
2296 '(let ((to (get-text-property (point) 'gnus-intangible)))
2297 (and to (gnus-summary-goto-subject to))))
2299 (defmacro gnus-summary-article-intangible-p ()
2300 "Say whether this article is intangible or not."
2301 '(get-text-property (point) 'gnus-intangible))
2303 (defun gnus-article-read-p (article)
2304 "Say whether ARTICLE is read or not."
2305 (not (or (memq article gnus-newsgroup-marked)
2306 (memq article gnus-newsgroup-unreads)
2307 (memq article gnus-newsgroup-unselected)
2308 (memq article gnus-newsgroup-dormant))))
2310 ;; Some summary mode macros.
2312 (defmacro gnus-summary-article-number ()
2313 "The article number of the article on the current line.
2314 If there isn's an article number here, then we return the current
2317 (gnus-summary-skip-intangible)
2318 (or (get-text-property (point) 'gnus-number)
2319 (gnus-summary-last-subject))))
2321 (defmacro gnus-summary-article-header (&optional number)
2322 `(gnus-data-header (gnus-data-find
2323 ,(or number '(gnus-summary-article-number)))))
2325 (defmacro gnus-summary-thread-level (&optional number)
2326 `(if (and (eq gnus-summary-make-false-root 'dummy)
2327 (get-text-property (point) 'gnus-intangible))
2329 (gnus-data-level (gnus-data-find
2330 ,(or number '(gnus-summary-article-number))))))
2332 (defmacro gnus-summary-article-mark (&optional number)
2333 `(gnus-data-mark (gnus-data-find
2334 ,(or number '(gnus-summary-article-number)))))
2336 (defmacro gnus-summary-article-pos (&optional number)
2337 `(gnus-data-pos (gnus-data-find
2338 ,(or number '(gnus-summary-article-number)))))
2340 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2341 (defmacro gnus-summary-article-subject (&optional number)
2342 "Return current subject string or nil if nothing."
2345 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2346 '(gnus-data-header (assq (gnus-summary-article-number)
2347 gnus-newsgroup-data)))))
2350 (mail-header-subject headers))))
2352 (defmacro gnus-summary-article-score (&optional number)
2353 "Return current article score."
2354 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2355 gnus-newsgroup-scored))
2356 gnus-summary-default-score 0))
2358 (defun gnus-summary-article-children (&optional number)
2359 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2360 (level (gnus-data-level (car data)))
2362 (while (and (setq data (cdr data))
2363 (> (setq l (gnus-data-level (car data))) level))
2364 (and (= (1+ level) l)
2365 (push (gnus-data-number (car data))
2367 (nreverse children)))
2369 (defun gnus-summary-article-parent (&optional number)
2370 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2371 (gnus-data-list t)))
2372 (level (gnus-data-level (car data))))
2374 () ; This is a root.
2375 ;; We search until we find an article with a level less than
2376 ;; this one. That function has to be the parent.
2377 (while (and (setq data (cdr data))
2378 (not (< (gnus-data-level (car data)) level))))
2379 (and data (gnus-data-number (car data))))))
2381 (defun gnus-unread-mark-p (mark)
2382 "Say whether MARK is the unread mark."
2383 (= mark gnus-unread-mark))
2385 (defun gnus-read-mark-p (mark)
2386 "Say whether MARK is one of the marks that mark as read.
2387 This is all marks except unread, ticked, dormant, and expirable."
2388 (not (or (= mark gnus-unread-mark)
2389 (= mark gnus-ticked-mark)
2390 (= mark gnus-dormant-mark)
2391 (= mark gnus-expirable-mark))))
2393 (defmacro gnus-article-mark (number)
2395 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2396 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2397 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2398 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2399 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2400 gnus-ancient-mark))))
2402 ;; Saving hidden threads.
2404 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2405 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2407 (defmacro gnus-save-hidden-threads (&rest forms)
2408 "Save hidden threads, eval FORMS, and restore the hidden threads."
2409 (let ((config (make-symbol "config")))
2410 `(let ((,config (gnus-hidden-threads-configuration)))
2414 (gnus-restore-hidden-threads-configuration ,config)))))
2416 (defun gnus-hidden-threads-configuration ()
2417 "Return the current hidden threads configuration."
2420 (goto-char (point-min))
2421 (while (search-forward "\r" nil t)
2422 (push (1- (point)) config))
2425 (defun gnus-restore-hidden-threads-configuration (config)
2426 "Restore hidden threads configuration from CONFIG."
2427 (let (point buffer-read-only)
2428 (while (setq point (pop config))
2429 (when (and (< point (point-max))
2431 (= (following-char) ?\n))
2432 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2434 ;; Various summary mode internalish functions.
2436 (defun gnus-mouse-pick-article (e)
2439 (gnus-summary-next-page nil t))
2441 (defun gnus-summary-setup-buffer (group)
2442 "Initialize summary buffer."
2443 (let ((buffer (concat "*Summary " group "*")))
2444 (if (get-buffer buffer)
2447 (setq gnus-summary-buffer (current-buffer))
2448 (not gnus-newsgroup-prepared))
2449 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2450 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2451 (gnus-add-current-to-buffer-list)
2452 (gnus-summary-mode group)
2454 (gnus-carpal-setup-buffer 'summary))
2455 (unless gnus-single-article-buffer
2456 (make-local-variable 'gnus-article-buffer)
2457 (make-local-variable 'gnus-article-current)
2458 (make-local-variable 'gnus-original-article-buffer))
2459 (setq gnus-newsgroup-name group)
2462 (defun gnus-set-global-variables ()
2463 ;; Set the global equivalents of the summary buffer-local variables
2464 ;; to the latest values they had. These reflect the summary buffer
2465 ;; that was in action when the last article was fetched.
2466 (when (eq major-mode 'gnus-summary-mode)
2467 (setq gnus-summary-buffer (current-buffer))
2468 (let ((name gnus-newsgroup-name)
2469 (marked gnus-newsgroup-marked)
2470 (unread gnus-newsgroup-unreads)
2471 (headers gnus-current-headers)
2472 (data gnus-newsgroup-data)
2473 (summary gnus-summary-buffer)
2474 (article-buffer gnus-article-buffer)
2475 (original gnus-original-article-buffer)
2476 (gac gnus-article-current)
2477 (reffed gnus-reffed-article-number)
2478 (score-file gnus-current-score-file))
2480 (set-buffer gnus-group-buffer)
2481 (setq gnus-newsgroup-name name)
2482 (setq gnus-newsgroup-marked marked)
2483 (setq gnus-newsgroup-unreads unread)
2484 (setq gnus-current-headers headers)
2485 (setq gnus-newsgroup-data data)
2486 (setq gnus-article-current gac)
2487 (setq gnus-summary-buffer summary)
2488 (setq gnus-article-buffer article-buffer)
2489 (setq gnus-original-article-buffer original)
2490 (setq gnus-reffed-article-number reffed)
2491 (setq gnus-current-score-file score-file)
2492 ;; The article buffer also has local variables.
2493 (when (gnus-buffer-live-p gnus-article-buffer)
2494 (set-buffer gnus-article-buffer)
2495 (setq gnus-summary-buffer summary))))))
2497 (defun gnus-summary-article-unread-p (article)
2498 "Say whether ARTICLE is unread or not."
2499 (memq article gnus-newsgroup-unreads))
2501 (defun gnus-summary-first-article-p (&optional article)
2502 "Return whether ARTICLE is the first article in the buffer."
2503 (if (not (setq article (or article (gnus-summary-article-number))))
2505 (eq article (caar gnus-newsgroup-data))))
2507 (defun gnus-summary-last-article-p (&optional article)
2508 "Return whether ARTICLE is the last article in the buffer."
2509 (if (not (setq article (or article (gnus-summary-article-number))))
2510 t ; All non-existent numbers are the last article. :-)
2511 (not (cdr (gnus-data-find-list article)))))
2513 (defun gnus-make-thread-indent-array ()
2515 (unless (and gnus-thread-indent-array
2516 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2517 (setq gnus-thread-indent-array (make-vector 201 "")
2518 gnus-thread-indent-array-level gnus-thread-indent-level)
2520 (aset gnus-thread-indent-array n
2521 (make-string (* n gnus-thread-indent-level) ? ))
2524 (defun gnus-update-summary-mark-positions ()
2525 "Compute where the summary marks are to go."
2527 (when (and gnus-summary-buffer
2528 (get-buffer gnus-summary-buffer)
2529 (buffer-name (get-buffer gnus-summary-buffer)))
2530 (set-buffer gnus-summary-buffer))
2531 (let ((gnus-replied-mark 129)
2532 (gnus-score-below-mark 130)
2533 (gnus-score-over-mark 130)
2534 (spec gnus-summary-line-format-spec)
2535 thread gnus-visual pos)
2537 (gnus-set-work-buffer)
2538 (let ((gnus-summary-line-format-spec spec))
2539 (gnus-summary-insert-line
2540 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2541 (goto-char (point-min))
2542 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2544 (goto-char (point-min))
2545 (push (cons 'replied (and (search-forward "\201" nil t)
2548 (goto-char (point-min))
2549 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2551 (setq gnus-summary-mark-positions pos))))
2553 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2554 "Insert a dummy root in the summary buffer."
2556 (gnus-add-text-properties
2557 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2558 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2560 (defun gnus-summary-insert-line (gnus-tmp-header
2561 gnus-tmp-level gnus-tmp-current
2562 gnus-tmp-unread gnus-tmp-replied
2563 gnus-tmp-expirable gnus-tmp-subject-or-nil
2564 &optional gnus-tmp-dummy gnus-tmp-score
2566 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2567 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2568 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2569 (gnus-tmp-score-char
2570 (if (or (null gnus-summary-default-score)
2571 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2572 gnus-summary-zcore-fuzz))
2574 (if (< gnus-tmp-score gnus-summary-default-score)
2575 gnus-score-below-mark gnus-score-over-mark)))
2577 (cond (gnus-tmp-process gnus-process-mark)
2578 ((memq gnus-tmp-current gnus-newsgroup-cached)
2580 (gnus-tmp-replied gnus-replied-mark)
2581 ((memq gnus-tmp-current gnus-newsgroup-saved)
2583 (t gnus-unread-mark)))
2584 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2587 ((string-match "<[^>]+> *$" gnus-tmp-from)
2588 (let ((beg (match-beginning 0)))
2589 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2590 (substring gnus-tmp-from (1+ (match-beginning 0))
2591 (1- (match-end 0))))
2592 (substring gnus-tmp-from 0 beg))))
2593 ((string-match "(.+)" gnus-tmp-from)
2594 (substring gnus-tmp-from
2595 (1+ (match-beginning 0)) (1- (match-end 0))))
2597 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2598 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2599 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2600 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2601 (buffer-read-only nil))
2602 (when (string= gnus-tmp-name "")
2603 (setq gnus-tmp-name gnus-tmp-from))
2604 (unless (numberp gnus-tmp-lines)
2605 (setq gnus-tmp-lines 0))
2606 (gnus-put-text-property
2608 (progn (eval gnus-summary-line-format-spec) (point))
2609 'gnus-number gnus-tmp-number)
2610 (when (gnus-visual-p 'summary-highlight 'highlight)
2612 (run-hooks 'gnus-summary-update-hook)
2615 (defun gnus-summary-update-line (&optional dont-update)
2616 ;; Update summary line after change.
2617 (when (and gnus-summary-default-score
2618 (not gnus-summary-inhibit-highlight))
2619 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2620 (article (gnus-summary-article-number))
2621 (score (gnus-summary-article-score article)))
2623 (if (and gnus-summary-mark-below
2624 (< (gnus-summary-article-score)
2625 gnus-summary-mark-below))
2626 ;; This article has a low score, so we mark it as read.
2627 (when (memq article gnus-newsgroup-unreads)
2628 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2629 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2630 ;; This article was previously marked as read on account
2631 ;; of a low score, but now it has risen, so we mark it as
2633 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2634 (gnus-summary-update-mark
2635 (if (or (null gnus-summary-default-score)
2636 (<= (abs (- score gnus-summary-default-score))
2637 gnus-summary-zcore-fuzz))
2639 (if (< score gnus-summary-default-score)
2640 gnus-score-below-mark gnus-score-over-mark))
2642 ;; Do visual highlighting.
2643 (when (gnus-visual-p 'summary-highlight 'highlight)
2644 (run-hooks 'gnus-summary-update-hook)))))
2646 (defvar gnus-tmp-new-adopts nil)
2648 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2649 "Return the number of articles in THREAD.
2650 This may be 0 in some cases -- if none of the articles in
2651 the thread are to be displayed."
2653 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2655 ((not (listp thread))
2657 ((and (consp thread) (cdr thread))
2660 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2663 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2666 (when (and level (zerop level) gnus-tmp-new-adopts)
2669 'gnus-summary-number-of-articles-in-thread
2670 gnus-tmp-new-adopts))))
2672 (if (> number 1) gnus-not-empty-thread-mark
2673 gnus-empty-thread-mark)
2676 (defun gnus-summary-set-local-parameters (group)
2677 "Go through the local params of GROUP and set all variable specs in that list."
2678 (let ((params (gnus-group-find-parameter group))
2681 (setq elem (car params)
2682 params (cdr params))
2683 (and (consp elem) ; Has to be a cons.
2684 (consp (cdr elem)) ; The cdr has to be a list.
2685 (symbolp (car elem)) ; Has to be a symbol in there.
2686 (not (memq (car elem)
2687 '(quit-config to-address to-list to-group)))
2688 (progn ; So we set it.
2689 (make-local-variable (car elem))
2690 (set (car elem) (eval (nth 1 elem))))))))
2692 (defun gnus-summary-read-group (group &optional show-all no-article
2693 kill-buffer no-display)
2694 "Start reading news in newsgroup GROUP.
2695 If SHOW-ALL is non-nil, already read articles are also listed.
2696 If NO-ARTICLE is non-nil, no article is selected initially.
2697 If NO-DISPLAY, don't generate a summary buffer."
2698 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2699 (let* ((new-group (gnus-summary-setup-buffer group))
2700 (quit-config (gnus-group-quit-config group))
2701 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2703 ;; This summary buffer exists already, so we just select it.
2705 (gnus-set-global-variables)
2707 (gnus-kill-or-deaden-summary kill-buffer))
2708 (gnus-configure-windows 'summary 'force)
2709 (gnus-set-mode-line 'summary)
2710 (gnus-summary-position-point)
2713 ;; We couldn't select this group.
2715 (when (and (eq major-mode 'gnus-summary-mode)
2716 (not (equal (current-buffer) kill-buffer)))
2717 (kill-buffer (current-buffer))
2718 (if (not quit-config)
2720 (set-buffer gnus-group-buffer)
2721 (gnus-group-jump-to-group group)
2722 (gnus-group-next-unread-group 1))
2723 (gnus-handle-ephemeral-exit quit-config)))
2724 (gnus-message 3 "Can't select group")
2726 ;; The user did a `C-g' while prompting for number of articles,
2727 ;; so we exit this group.
2728 ((eq did-select 'quit)
2729 (and (eq major-mode 'gnus-summary-mode)
2730 (not (equal (current-buffer) kill-buffer))
2731 (kill-buffer (current-buffer)))
2733 (gnus-kill-or-deaden-summary kill-buffer))
2734 (if (not quit-config)
2736 (set-buffer gnus-group-buffer)
2737 (gnus-group-jump-to-group group)
2738 (gnus-group-next-unread-group 1)
2739 (gnus-configure-windows 'group 'force))
2740 (gnus-handle-ephemeral-exit quit-config))
2741 ;; Finally signal the quit.
2743 ;; The group was successfully selected.
2745 (gnus-set-global-variables)
2746 ;; Save the active value in effect when the group was entered.
2747 (setq gnus-newsgroup-active
2749 (gnus-active gnus-newsgroup-name)))
2750 ;; You can change the summary buffer in some way with this hook.
2751 (run-hooks 'gnus-select-group-hook)
2752 ;; Set any local variables in the group parameters.
2753 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2754 (gnus-update-format-specifications
2755 nil 'summary 'summary-mode 'summary-dummy)
2756 ;; Do score processing.
2757 (when gnus-use-scoring
2758 (gnus-possibly-score-headers))
2759 ;; Check whether to fill in the gaps in the threads.
2760 (when gnus-build-sparse-threads
2761 (gnus-build-sparse-threads))
2762 ;; Find the initial limit.
2763 (if gnus-show-threads
2765 (let ((gnus-newsgroup-dormant nil))
2766 (gnus-summary-initial-limit show-all))
2767 (gnus-summary-initial-limit show-all))
2768 (setq gnus-newsgroup-limit
2770 (lambda (header) (mail-header-number header))
2771 gnus-newsgroup-headers)))
2772 ;; Generate the summary buffer.
2774 (gnus-summary-prepare))
2775 (when gnus-use-trees
2776 (gnus-tree-open group)
2777 (setq gnus-summary-highlight-line-function
2778 'gnus-tree-highlight-article))
2779 ;; If the summary buffer is empty, but there are some low-scored
2780 ;; articles or some excluded dormants, we include these in the
2782 (when (and (zerop (buffer-size))
2784 (cond (gnus-newsgroup-dormant
2785 (gnus-summary-limit-include-dormant))
2786 ((and gnus-newsgroup-scored show-all)
2787 (gnus-summary-limit-include-expunged t))))
2788 ;; Function `gnus-apply-kill-file' must be called in this hook.
2789 (run-hooks 'gnus-apply-kill-hook)
2790 (if (and (zerop (buffer-size))
2793 ;; This newsgroup is empty.
2794 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2795 (gnus-message 6 "No unread news")
2797 (gnus-kill-or-deaden-summary kill-buffer))
2798 ;; Return nil from this function.
2800 ;; Hide conversation thread subtrees. We cannot do this in
2801 ;; gnus-summary-prepare-hook since kill processing may not
2802 ;; work with hidden articles.
2803 (and gnus-show-threads
2804 gnus-thread-hide-subtree
2805 (gnus-summary-hide-all-threads))
2806 ;; Show first unread article if requested.
2807 (if (and (not no-article)
2809 gnus-newsgroup-unreads
2810 gnus-auto-select-first)
2811 (unless (if (eq gnus-auto-select-first 'best)
2812 (gnus-summary-best-unread-article)
2813 (gnus-summary-first-unread-article))
2814 (gnus-configure-windows 'summary))
2815 ;; Don't select any articles, just move point to the first
2816 ;; article in the group.
2817 (goto-char (point-min))
2818 (gnus-summary-position-point)
2819 (gnus-set-mode-line 'summary)
2820 (gnus-configure-windows 'summary 'force))
2822 (gnus-kill-or-deaden-summary kill-buffer))
2823 (when (get-buffer-window gnus-group-buffer t)
2824 ;; Gotta use windows, because recenter does weird stuff if
2825 ;; the current buffer ain't the displayed window.
2826 (let ((owin (selected-window)))
2827 (select-window (get-buffer-window gnus-group-buffer t))
2828 (when (gnus-group-goto-group group)
2830 (select-window owin))))
2831 ;; Mark this buffer as "prepared".
2832 (setq gnus-newsgroup-prepared t)
2835 (defun gnus-summary-prepare ()
2836 "Generate the summary buffer."
2838 (let ((buffer-read-only nil))
2840 (setq gnus-newsgroup-data nil
2841 gnus-newsgroup-data-reverse nil)
2842 (run-hooks 'gnus-summary-generate-hook)
2843 ;; Generate the buffer, either with threads or without.
2844 (when gnus-newsgroup-headers
2845 (gnus-summary-prepare-threads
2846 (if gnus-show-threads
2847 (gnus-sort-gathered-threads
2848 (funcall gnus-summary-thread-gathering-function
2850 (gnus-cut-threads (gnus-make-threads)))))
2851 ;; Unthreaded display.
2852 (gnus-sort-articles gnus-newsgroup-headers))))
2853 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2854 ;; Call hooks for modifying summary buffer.
2855 (goto-char (point-min))
2856 (run-hooks 'gnus-summary-prepare-hook)))
2858 (defsubst gnus-general-simplify-subject (subject)
2859 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2862 ;; Truncate the subject.
2863 ((numberp gnus-summary-gather-subject-limit)
2864 (setq subject (gnus-simplify-subject-re subject))
2865 (if (> (length subject) gnus-summary-gather-subject-limit)
2866 (substring subject 0 gnus-summary-gather-subject-limit)
2868 ;; Fuzzily simplify it.
2869 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2870 (gnus-simplify-subject-fuzzy subject))
2871 ;; Just remove the leading "Re:".
2873 (gnus-simplify-subject-re subject))))
2875 (if (and gnus-summary-gather-exclude-subject
2876 (string-match gnus-summary-gather-exclude-subject subject))
2877 nil ; This article shouldn't be gathered
2880 (defun gnus-summary-simplify-subject-query ()
2881 "Query where the respool algorithm would put this article."
2883 (gnus-set-global-variables)
2884 (gnus-summary-select-article)
2885 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2887 (defun gnus-gather-threads-by-subject (threads)
2888 "Gather threads by looking at Subject headers."
2889 (if (not gnus-summary-make-false-root)
2891 (let ((hashtb (gnus-make-hashtable 1024))
2894 subject hthread whole-subject)
2896 (setq subject (gnus-general-simplify-subject
2897 (setq whole-subject (mail-header-subject
2900 (if (setq hthread (gnus-gethash subject hashtb))
2902 ;; We enter a dummy root into the thread, if we
2903 ;; haven't done that already.
2904 (unless (stringp (caar hthread))
2905 (setcar hthread (list whole-subject (car hthread))))
2906 ;; We add this new gathered thread to this gathered
2908 (setcdr (car hthread)
2909 (nconc (cdar hthread) (list (car threads))))
2910 ;; Remove it from the list of threads.
2911 (setcdr prev (cdr threads))
2912 (setq threads prev))
2913 ;; Enter this thread into the hash table.
2914 (gnus-sethash subject threads hashtb)))
2916 (setq threads (cdr threads)))
2919 (defun gnus-gather-threads-by-references (threads)
2920 "Gather threads by looking at References headers."
2921 (let ((idhashtb (gnus-make-hashtable 1024))
2922 (thhashtb (gnus-make-hashtable 1024))
2925 ids references id gthread gid entered ref)
2927 (when (setq references (mail-header-references (caar threads)))
2928 (setq id (mail-header-id (caar threads))
2929 ids (gnus-split-references references)
2931 (while (setq ref (pop ids))
2932 (setq ids (delete ref ids))
2933 (if (not (setq gid (gnus-gethash ref idhashtb)))
2935 (gnus-sethash ref id idhashtb)
2936 (gnus-sethash id threads thhashtb))
2937 (setq gthread (gnus-gethash gid thhashtb))
2939 ;; We enter a dummy root into the thread, if we
2940 ;; haven't done that already.
2941 (unless (stringp (caar gthread))
2942 (setcar gthread (list (mail-header-subject (caar gthread))
2944 ;; We add this new gathered thread to this gathered
2946 (setcdr (car gthread)
2947 (nconc (cdar gthread) (list (car threads)))))
2948 ;; Add it into the thread hash table.
2949 (gnus-sethash id gthread thhashtb)
2951 ;; Remove it from the list of threads.
2952 (setcdr prev (cdr threads))
2953 (setq threads prev))))
2955 (setq threads (cdr threads)))
2958 (defun gnus-sort-gathered-threads (threads)
2959 "Sort subtreads inside each gathered thread by article number."
2960 (let ((result threads))
2962 (when (stringp (caar threads))
2963 (setcdr (car threads)
2964 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2965 (setq threads (cdr threads)))
2968 (defun gnus-thread-loop-p (root thread)
2969 "Say whether ROOT is in THREAD."
2970 (let ((th (cdr thread)))
2972 (not (eq (caar th) root)))
2975 ;; We have found a loop.
2977 (setcdr thread (delq (car th) (cdr thread)))
2978 (if (boundp (setq ref-dep (intern "none"
2979 gnus-newsgroup-dependencies)))
2980 (setcdr (symbol-value ref-dep)
2981 (nconc (cdr (symbol-value ref-dep))
2983 (set ref-dep (list nil (car th))))
2985 ;; Recurse down into the sub-threads and look for loops.
2988 (lambda (thread) (gnus-thread-loop-p root thread))
2991 (defun gnus-make-threads ()
2992 "Go through the dependency hashtb and find the roots. Return all threads."
2994 (while (catch 'infloop
2997 ;; Deal with self-referencing References loops.
2998 (when (and (car (symbol-value refs))
3005 (car (symbol-value refs)) thread))
3006 (cdr (symbol-value refs)))))))
3009 (unless (car (symbol-value refs))
3010 ;; These threads do not refer back to any other articles,
3011 ;; so they're roots.
3012 (setq threads (append (cdr (symbol-value refs)) threads))))
3013 gnus-newsgroup-dependencies)))
3016 (defun gnus-build-sparse-threads ()
3017 (let ((headers gnus-newsgroup-headers)
3018 (deps gnus-newsgroup-dependencies)
3019 header references generation relations
3020 cthread subject child end pthread relation)
3021 ;; First we create an alist of generations/relations, where
3022 ;; generations is how much we trust the relation, and the relation
3024 (gnus-message 7 "Making sparse threads...")
3026 (nnheader-set-temp-buffer " *gnus sparse threads*")
3027 (while (setq header (pop headers))
3028 (when (and (setq references (mail-header-references header))
3029 (not (string= references "")))
3031 (setq child (mail-header-id header)
3032 subject (mail-header-subject header))
3034 (while (search-backward ">" nil t)
3035 (setq end (1+ (point)))
3036 (when (search-backward "<" nil t)
3037 (push (list (incf generation)
3038 child (setq child (buffer-substring (point) end))
3041 (push (list (1+ generation) child nil subject) relations)
3043 (kill-buffer (current-buffer)))
3044 ;; Sort over trustworthiness.
3045 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
3046 (while (setq relation (pop relations))
3047 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
3048 (unless (car (symbol-value cthread))
3049 ;; Make this article the parent of these threads.
3050 (setcar (symbol-value cthread)
3051 (vector gnus-reffed-article-number
3055 (or (caddr relation) "") 0 0 "")))
3056 (set cthread (list (vector gnus-reffed-article-number
3058 "" "" (cadr relation)
3059 (or (caddr relation) "") 0 0 ""))))
3060 (push gnus-reffed-article-number gnus-newsgroup-limit)
3061 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3062 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3063 gnus-newsgroup-reads)
3064 (decf gnus-reffed-article-number)
3065 ;; Make this new thread the child of its parent.
3066 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
3067 (setcdr (symbol-value pthread)
3068 (nconc (cdr (symbol-value pthread))
3069 (list (symbol-value cthread))))
3070 (set pthread (list nil (symbol-value cthread))))))
3071 (gnus-message 7 "Making sparse threads...done")))
3073 (defun gnus-build-old-threads ()
3074 ;; Look at all the articles that refer back to old articles, and
3075 ;; fetch the headers for the articles that aren't there. This will
3076 ;; build complete threads - if the roots haven't been expired by the
3081 (when (not (car (symbol-value refs)))
3082 (setq heads (cdr (symbol-value refs)))
3084 (if (memq (mail-header-number (caar heads))
3085 gnus-newsgroup-dormant)
3086 (setq heads (cdr heads))
3087 (setq id (symbol-name refs))
3088 (while (and (setq id (gnus-build-get-header id))
3089 (not (car (gnus-gethash
3090 id gnus-newsgroup-dependencies)))))
3091 (setq heads nil)))))
3092 gnus-newsgroup-dependencies)))
3094 (defun gnus-build-get-header (id)
3095 ;; Look through the buffer of NOV lines and find the header to
3096 ;; ID. Enter this line into the dependencies hash table, and return
3097 ;; the id of the parent article (if any).
3098 (let ((deps gnus-newsgroup-dependencies)
3102 (set-buffer nntp-server-buffer)
3103 (goto-char (point-min))
3104 (while (and (not found) (search-forward id nil t))
3106 (setq found (looking-at
3107 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3108 (regexp-quote id))))
3109 (or found (beginning-of-line 2)))
3113 (setq header (gnus-nov-parse-line
3114 (read (current-buffer)) deps))
3115 (gnus-parent-id (mail-header-references header)))))
3117 (let ((number (mail-header-number header)))
3118 (push number gnus-newsgroup-limit)
3119 (push header gnus-newsgroup-headers)
3120 (if (memq number gnus-newsgroup-unselected)
3122 (push number gnus-newsgroup-unreads)
3123 (setq gnus-newsgroup-unselected
3124 (delq number gnus-newsgroup-unselected)))
3125 (push number gnus-newsgroup-ancient)))))))
3127 (defun gnus-summary-update-article-line (article header)
3128 "Update the line for ARTICLE using HEADERS."
3129 (let* ((id (mail-header-id header))
3130 (thread (gnus-id-to-thread id)))
3132 (error "Article in no thread"))
3133 ;; Update the thread.
3134 (setcar thread header)
3135 (gnus-summary-goto-subject article)
3136 (let* ((datal (gnus-data-find-list article))
3138 (length (when (cdr datal)
3139 (- (gnus-data-pos data)
3140 (gnus-data-pos (cadr datal)))))
3141 (buffer-read-only nil)
3142 (level (gnus-summary-thread-level)))
3144 (gnus-summary-insert-line
3145 header level nil (gnus-article-mark article)
3146 (memq article gnus-newsgroup-replied)
3147 (memq article gnus-newsgroup-expirable)
3148 (mail-header-subject header)
3149 nil (cdr (assq article gnus-newsgroup-scored))
3150 (memq article gnus-newsgroup-processable))
3152 (gnus-data-update-list
3153 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3155 (defun gnus-summary-update-article (article &optional iheader)
3156 "Update ARTICLE in the summary buffer."
3157 (set-buffer gnus-summary-buffer)
3158 (let* ((header (or iheader (gnus-summary-article-header article)))
3159 (id (mail-header-id header))
3160 (data (gnus-data-find article))
3161 (thread (gnus-id-to-thread id))
3162 (references (mail-header-references header))
3166 (when (and references
3167 (not (equal "" references)))
3170 (buffer-read-only nil)
3172 (number (mail-header-number header))
3175 ;; !!! Should this be in or not?
3177 (setcar thread nil))
3179 (delq thread parent))
3180 (if (gnus-summary-insert-subject id header iheader)
3181 ;; Set the (possibly) new article number in the data structure.
3182 (gnus-data-set-number data (gnus-id-to-article id))
3186 (defun gnus-rebuild-thread (id)
3187 "Rebuild the thread containing ID."
3188 (let ((buffer-read-only nil)
3189 old-pos current thread data)
3190 (if (not gnus-show-threads)
3191 (setq thread (list (car (gnus-id-to-thread id))))
3192 ;; Get the thread this article is part of.
3193 (setq thread (gnus-remove-thread id)))
3194 (setq old-pos (gnus-point-at-bol))
3195 (setq current (save-excursion
3196 (and (zerop (forward-line -1))
3197 (gnus-summary-article-number))))
3198 ;; If this is a gathered thread, we have to go some re-gathering.
3199 (when (stringp (car thread))
3200 (let ((subject (car thread))
3202 (setq thread (cdr thread))
3204 (unless (memq (setq thr (gnus-id-to-thread
3206 (mail-header-id (caar thread)))))
3209 (setq thread (cdr thread)))
3210 ;; We now have all (unique) roots.
3211 (if (= (length roots) 1)
3212 ;; All the loose roots are now one solid root.
3213 (setq thread (car roots))
3214 (setq thread (cons subject (gnus-sort-threads roots))))))
3216 ;; We then insert this thread into the summary buffer.
3217 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3218 (if gnus-show-threads
3219 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3220 (gnus-summary-prepare-unthreaded thread))
3221 (setq data (nreverse gnus-newsgroup-data))
3222 (setq threads gnus-newsgroup-threads))
3223 ;; We splice the new data into the data structure.
3224 (gnus-data-enter-list current data (- (point) old-pos))
3225 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3227 (defun gnus-number-to-header (number)
3228 "Return the header for article NUMBER."
3229 (let ((headers gnus-newsgroup-headers))
3231 (not (= number (mail-header-number (car headers)))))
3236 (defun gnus-parent-headers (headers &optional generation)
3237 "Return the headers of the GENERATIONeth parent of HEADERS."
3239 (setq generation 1))
3240 (let (references parent)
3241 (while (and headers (not (zerop generation)))
3242 (setq references (mail-header-references headers))
3243 (when (and references
3244 (setq parent (gnus-parent-id references))
3245 (setq headers (car (gnus-id-to-thread parent))))
3249 (defun gnus-id-to-thread (id)
3250 "Return the (sub-)thread where ID appears."
3251 (gnus-gethash id gnus-newsgroup-dependencies))
3253 (defun gnus-id-to-article (id)
3254 "Return the article number of ID."
3255 (let ((thread (gnus-id-to-thread id)))
3258 (mail-header-number (car thread)))))
3260 (defun gnus-id-to-header (id)
3261 "Return the article headers of ID."
3262 (car (gnus-id-to-thread id)))
3264 (defun gnus-article-displayed-root-p (article)
3265 "Say whether ARTICLE is a root(ish) article."
3266 (let ((level (gnus-summary-thread-level article))
3267 (refs (mail-header-references (gnus-summary-article-header article)))
3273 ((null (gnus-parent-id refs)) t)
3275 (null (setq particle (gnus-id-to-article
3276 (gnus-parent-id refs))))
3277 (null (gnus-summary-thread-level particle)))))))
3279 (defun gnus-root-id (id)
3280 "Return the id of the root of the thread where ID appears."
3282 (while (and id (setq prev (car (gnus-gethash
3283 id gnus-newsgroup-dependencies))))
3285 id (gnus-parent-id (mail-header-references prev))))
3288 (defun gnus-remove-thread (id &optional dont-remove)
3289 "Remove the thread that has ID in it."
3290 (let ((dep gnus-newsgroup-dependencies)
3291 headers thread last-id)
3292 ;; First go up in this thread until we find the root.
3293 (setq last-id (gnus-root-id id))
3294 (setq headers (list (car (gnus-id-to-thread last-id))
3295 (caadr (gnus-id-to-thread last-id))))
3296 ;; We have now found the real root of this thread. It might have
3297 ;; been gathered into some loose thread, so we have to search
3298 ;; through the threads to find the thread we wanted.
3299 (let ((threads gnus-newsgroup-threads)
3302 (setq sub (car threads))
3303 (if (stringp (car sub))
3304 ;; This is a gathered thread, so we look at the roots
3305 ;; below it to find whether this article is in this
3308 (setq sub (cdr sub))
3310 (when (member (caar sub) headers)
3311 (setq thread (car threads)
3314 (setq sub (cdr sub))))
3315 ;; It's an ordinary thread, so we check it.
3316 (when (eq (car sub) (car headers))
3319 (setq threads (cdr threads)))
3320 ;; If this article is in no thread, then it's a root.
3323 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3324 (setq thread (gnus-gethash last-id dep)))
3327 thread ; We return this thread.
3329 (if (stringp (car thread))
3331 ;; If we use dummy roots, then we have to remove the
3332 ;; dummy root as well.
3333 (when (eq gnus-summary-make-false-root 'dummy)
3335 (gnus-data-compute-positions))
3336 (setq thread (cdr thread))
3338 (gnus-remove-thread-1 (car thread))
3339 (setq thread (cdr thread))))
3340 (gnus-remove-thread-1 thread))))))))
3342 (defun gnus-remove-thread-1 (thread)
3343 "Remove the thread THREAD recursively."
3344 (let ((number (mail-header-number (pop thread)))
3346 (setq thread (reverse thread))
3348 (gnus-remove-thread-1 (pop thread)))
3349 (when (setq d (gnus-data-find number))
3350 (goto-char (gnus-data-pos d))
3353 (- (gnus-point-at-bol)
3355 (1+ (gnus-point-at-eol))
3356 (gnus-delete-line)))))))
3358 (defun gnus-sort-threads (threads)
3360 (if (not gnus-thread-sort-functions)
3362 (gnus-message 7 "Sorting threads...")
3364 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3365 (gnus-message 7 "Sorting threads...done"))))
3367 (defun gnus-sort-articles (articles)
3369 (when gnus-article-sort-functions
3370 (gnus-message 7 "Sorting articles...")
3372 (setq gnus-newsgroup-headers
3373 (sort articles (gnus-make-sort-function
3374 gnus-article-sort-functions)))
3375 (gnus-message 7 "Sorting articles...done"))))
3377 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3378 (defmacro gnus-thread-header (thread)
3379 ;; Return header of first article in THREAD.
3380 ;; Note that THREAD must never, ever be anything else than a variable -
3381 ;; using some other form will lead to serious barfage.
3382 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3383 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3384 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3387 (defsubst gnus-article-sort-by-number (h1 h2)
3388 "Sort articles by article number."
3389 (< (mail-header-number h1)
3390 (mail-header-number h2)))
3392 (defun gnus-thread-sort-by-number (h1 h2)
3393 "Sort threads by root article number."
3394 (gnus-article-sort-by-number
3395 (gnus-thread-header h1) (gnus-thread-header h2)))
3397 (defsubst gnus-article-sort-by-lines (h1 h2)
3398 "Sort articles by article Lines header."
3399 (< (mail-header-lines h1)
3400 (mail-header-lines h2)))
3402 (defun gnus-thread-sort-by-lines (h1 h2)
3403 "Sort threads by root article Lines header."
3404 (gnus-article-sort-by-lines
3405 (gnus-thread-header h1) (gnus-thread-header h2)))
3407 (defsubst gnus-article-sort-by-author (h1 h2)
3408 "Sort articles by root author."
3410 (let ((extract (funcall
3411 gnus-extract-address-components
3412 (mail-header-from h1))))
3413 (or (car extract) (cdr extract)))
3414 (let ((extract (funcall
3415 gnus-extract-address-components
3416 (mail-header-from h2))))
3417 (or (car extract) (cdr extract)))))
3419 (defun gnus-thread-sort-by-author (h1 h2)
3420 "Sort threads by root author."
3421 (gnus-article-sort-by-author
3422 (gnus-thread-header h1) (gnus-thread-header h2)))
3424 (defsubst gnus-article-sort-by-subject (h1 h2)
3425 "Sort articles by root subject."
3427 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3428 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3430 (defun gnus-thread-sort-by-subject (h1 h2)
3431 "Sort threads by root subject."
3432 (gnus-article-sort-by-subject
3433 (gnus-thread-header h1) (gnus-thread-header h2)))
3435 (defsubst gnus-article-sort-by-date (h1 h2)
3436 "Sort articles by root article date."
3438 (gnus-date-get-time (mail-header-date h1))
3439 (gnus-date-get-time (mail-header-date h2))))
3441 (defun gnus-thread-sort-by-date (h1 h2)
3442 "Sort threads by root article date."
3443 (gnus-article-sort-by-date
3444 (gnus-thread-header h1) (gnus-thread-header h2)))
3446 (defsubst gnus-article-sort-by-score (h1 h2)
3447 "Sort articles by root article score.
3448 Unscored articles will be counted as having a score of zero."
3449 (> (or (cdr (assq (mail-header-number h1)
3450 gnus-newsgroup-scored))
3451 gnus-summary-default-score 0)
3452 (or (cdr (assq (mail-header-number h2)
3453 gnus-newsgroup-scored))
3454 gnus-summary-default-score 0)))
3456 (defun gnus-thread-sort-by-score (h1 h2)
3457 "Sort threads by root article score."
3458 (gnus-article-sort-by-score
3459 (gnus-thread-header h1) (gnus-thread-header h2)))
3461 (defun gnus-thread-sort-by-total-score (h1 h2)
3462 "Sort threads by the sum of all scores in the thread.
3463 Unscored articles will be counted as having a score of zero."
3464 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3466 (defun gnus-thread-total-score (thread)
3467 ;; This function find the total score of THREAD.
3468 (cond ((null thread)
3471 (if (stringp (car thread))
3472 (apply gnus-thread-score-function 0
3473 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3474 (gnus-thread-total-score-1 thread)))
3476 (gnus-thread-total-score-1 (list thread)))))
3478 (defun gnus-thread-total-score-1 (root)
3479 ;; This function find the total score of the thread below ROOT.
3480 (setq root (car root))
3481 (apply gnus-thread-score-function
3483 (mapcar 'gnus-thread-total-score
3484 (cdr (gnus-gethash (mail-header-id root)
3485 gnus-newsgroup-dependencies)))
3486 (when (> (mail-header-number root) 0)
3487 (list (or (cdr (assq (mail-header-number root)
3488 gnus-newsgroup-scored))
3489 gnus-summary-default-score 0))))
3490 (list gnus-summary-default-score)
3493 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3494 (defvar gnus-tmp-prev-subject nil)
3495 (defvar gnus-tmp-false-parent nil)
3496 (defvar gnus-tmp-root-expunged nil)
3497 (defvar gnus-tmp-dummy-line nil)
3499 (defun gnus-summary-prepare-threads (threads)
3500 "Prepare summary buffer from THREADS and indentation LEVEL.
3501 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3502 or a straight list of headers."
3503 (gnus-message 7 "Generating summary...")
3505 (setq gnus-newsgroup-threads threads)
3508 (let ((gnus-tmp-level 0)
3509 (default-score (or gnus-summary-default-score 0))
3510 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3511 thread number subject stack state gnus-tmp-gathered beg-match
3512 new-roots gnus-tmp-new-adopts thread-end
3513 gnus-tmp-header gnus-tmp-unread
3514 gnus-tmp-replied gnus-tmp-subject-or-nil
3515 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3516 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3517 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3519 (setq gnus-tmp-prev-subject nil)
3521 (if (vectorp (car threads))
3522 ;; If this is a straight (sic) list of headers, then a
3523 ;; threaded summary display isn't required, so we just create
3524 ;; an unthreaded one.
3525 (gnus-summary-prepare-unthreaded threads)
3527 ;; Do the threaded display.
3529 (while (or threads stack gnus-tmp-new-adopts new-roots)
3531 (if (and (= gnus-tmp-level 0)
3532 (not (setq gnus-tmp-dummy-line nil))
3535 (not gnus-tmp-false-parent)
3536 (or gnus-tmp-new-adopts new-roots))
3537 (if gnus-tmp-new-adopts
3538 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3539 thread (list (car gnus-tmp-new-adopts))
3540 gnus-tmp-header (caar thread)
3541 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3543 (setq thread (list (car new-roots))
3544 gnus-tmp-header (caar thread)
3545 new-roots (cdr new-roots))))
3548 ;; If there are some threads, we do them before the
3549 ;; threads on the stack.
3550 (setq thread threads
3551 gnus-tmp-header (caar thread))
3552 ;; There were no current threads, so we pop something off
3554 (setq state (car stack)
3555 gnus-tmp-level (car state)
3558 gnus-tmp-header (caar thread))))
3560 (setq gnus-tmp-false-parent nil)
3561 (setq gnus-tmp-root-expunged nil)
3562 (setq thread-end nil)
3564 (if (stringp gnus-tmp-header)
3565 ;; The header is a dummy root.
3567 ((eq gnus-summary-make-false-root 'adopt)
3568 ;; We let the first article adopt the rest.
3569 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3571 (setq gnus-tmp-gathered
3573 (lambda (h) (mail-header-number (car h)))
3576 (setq thread (cons (list (caar thread)
3579 (setq gnus-tmp-level -1
3580 gnus-tmp-false-parent t))
3581 ((eq gnus-summary-make-false-root 'empty)
3582 ;; We print adopted articles with empty subject fields.
3583 (setq gnus-tmp-gathered
3585 (lambda (h) (mail-header-number (car h)))
3588 (setq gnus-tmp-level -1))
3589 ((eq gnus-summary-make-false-root 'dummy)
3590 ;; We remember that we probably want to output a dummy
3592 (setq gnus-tmp-dummy-line gnus-tmp-header)
3593 (setq gnus-tmp-prev-subject gnus-tmp-header))
3595 ;; We do not make a root for the gathered
3596 ;; sub-threads at all.
3597 (setq gnus-tmp-level -1)))
3599 (setq number (mail-header-number gnus-tmp-header)
3600 subject (mail-header-subject gnus-tmp-header))
3603 ;; If the thread has changed subject, we might want to make
3604 ;; this subthread into a root.
3605 ((and (null gnus-thread-ignore-subject)
3606 (not (zerop gnus-tmp-level))
3607 gnus-tmp-prev-subject
3609 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3610 (setq new-roots (nconc new-roots (list (car thread)))
3612 gnus-tmp-header nil))
3613 ;; If the article lies outside the current limit,
3614 ;; then we do not display it.
3615 ((not (memq number gnus-newsgroup-limit))
3616 (setq gnus-tmp-gathered
3618 (lambda (h) (mail-header-number (car h)))
3621 (setq gnus-tmp-new-adopts (if (cdar thread)
3622 (append gnus-tmp-new-adopts
3624 gnus-tmp-new-adopts)
3626 gnus-tmp-header nil)
3627 (when (zerop gnus-tmp-level)
3628 (setq gnus-tmp-root-expunged t)))
3629 ;; Perhaps this article is to be marked as read?
3630 ((and gnus-summary-mark-below
3631 (< (or (cdr (assq number gnus-newsgroup-scored))
3633 gnus-summary-mark-below)
3634 ;; Don't touch sparse articles.
3635 (not (gnus-summary-article-sparse-p number))
3636 (not (gnus-summary-article-ancient-p number)))
3637 (setq gnus-newsgroup-unreads
3638 (delq number gnus-newsgroup-unreads))
3639 (if gnus-newsgroup-auto-expire
3640 (push number gnus-newsgroup-expirable)
3641 (push (cons number gnus-low-score-mark)
3642 gnus-newsgroup-reads))))
3644 (when gnus-tmp-header
3645 ;; We may have an old dummy line to output before this
3647 (when gnus-tmp-dummy-line
3648 (gnus-summary-insert-dummy-line
3649 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3650 (setq gnus-tmp-dummy-line nil))
3652 ;; Compute the mark.
3653 (setq gnus-tmp-unread (gnus-article-mark number))
3655 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3656 gnus-tmp-header gnus-tmp-level)
3657 gnus-newsgroup-data)
3659 ;; Actually insert the line.
3661 gnus-tmp-subject-or-nil
3663 ((and gnus-thread-ignore-subject
3664 gnus-tmp-prev-subject
3665 (not (inline (gnus-subject-equal
3666 gnus-tmp-prev-subject subject))))
3668 ((zerop gnus-tmp-level)
3669 (if (and (eq gnus-summary-make-false-root 'empty)
3670 (memq number gnus-tmp-gathered)
3671 gnus-tmp-prev-subject
3672 (inline (gnus-subject-equal
3673 gnus-tmp-prev-subject subject)))
3674 gnus-summary-same-subject
3676 (t gnus-summary-same-subject)))
3677 (if (and (eq gnus-summary-make-false-root 'adopt)
3678 (= gnus-tmp-level 1)
3679 (memq number gnus-tmp-gathered))
3680 (setq gnus-tmp-opening-bracket ?\<
3681 gnus-tmp-closing-bracket ?\>)
3682 (setq gnus-tmp-opening-bracket ?\[
3683 gnus-tmp-closing-bracket ?\]))
3685 gnus-tmp-indentation
3686 (aref gnus-thread-indent-array gnus-tmp-level)
3687 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3688 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3689 gnus-summary-default-score 0)
3691 (if (or (null gnus-summary-default-score)
3692 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3693 gnus-summary-zcore-fuzz))
3695 (if (< gnus-tmp-score gnus-summary-default-score)
3696 gnus-score-below-mark gnus-score-over-mark))
3698 (cond ((memq number gnus-newsgroup-processable)
3700 ((memq number gnus-newsgroup-cached)
3702 ((memq number gnus-newsgroup-replied)
3704 ((memq number gnus-newsgroup-saved)
3706 (t gnus-unread-mark))
3707 gnus-tmp-from (mail-header-from gnus-tmp-header)
3710 ((string-match "<[^>]+> *$" gnus-tmp-from)
3711 (setq beg-match (match-beginning 0))
3712 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3713 (substring gnus-tmp-from (1+ (match-beginning 0))
3714 (1- (match-end 0))))
3715 (substring gnus-tmp-from 0 beg-match)))
3716 ((string-match "(.+)" gnus-tmp-from)
3717 (substring gnus-tmp-from
3718 (1+ (match-beginning 0)) (1- (match-end 0))))
3720 (when (string= gnus-tmp-name "")
3721 (setq gnus-tmp-name gnus-tmp-from))
3722 (unless (numberp gnus-tmp-lines)
3723 (setq gnus-tmp-lines 0))
3724 (gnus-put-text-property
3726 (progn (eval gnus-summary-line-format-spec) (point))
3727 'gnus-number number)
3730 (run-hooks 'gnus-summary-update-hook)
3733 (setq gnus-tmp-prev-subject subject)))
3735 (when (nth 1 thread)
3736 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3737 (incf gnus-tmp-level)
3738 (setq threads (if thread-end nil (cdar thread)))
3740 (setq gnus-tmp-level 0)))))
3741 (gnus-message 7 "Generating summary...done"))
3743 (defun gnus-summary-prepare-unthreaded (headers)
3744 "Generate an unthreaded summary buffer based on HEADERS."
3745 (let (header number mark)
3748 ;; We may have to root out some bad articles...
3749 (when (memq (setq number (mail-header-number
3750 (setq header (pop headers))))
3751 gnus-newsgroup-limit)
3752 ;; Mark article as read when it has a low score.
3753 (when (and gnus-summary-mark-below
3754 (< (or (cdr (assq number gnus-newsgroup-scored))
3755 gnus-summary-default-score 0)
3756 gnus-summary-mark-below)
3757 (not (gnus-summary-article-ancient-p number)))
3758 (setq gnus-newsgroup-unreads
3759 (delq number gnus-newsgroup-unreads))
3760 (if gnus-newsgroup-auto-expire
3761 (push number gnus-newsgroup-expirable)
3762 (push (cons number gnus-low-score-mark)
3763 gnus-newsgroup-reads)))
3765 (setq mark (gnus-article-mark number))
3766 (push (gnus-data-make number mark (1+ (point)) header 0)
3767 gnus-newsgroup-data)
3768 (gnus-summary-insert-line
3770 mark (memq number gnus-newsgroup-replied)
3771 (memq number gnus-newsgroup-expirable)
3772 (mail-header-subject header) nil
3773 (cdr (assq number gnus-newsgroup-scored))
3774 (memq number gnus-newsgroup-processable))))))
3776 (defun gnus-select-newsgroup (group &optional read-all)
3777 "Select newsgroup GROUP.
3778 If READ-ALL is non-nil, all articles in the group are selected."
3779 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3780 (info (nth 2 entry))
3781 articles fetched-articles cached)
3783 (unless (gnus-check-server
3784 (setq gnus-current-select-method (gnus-find-method-for-group group)))
3785 (error "Couldn't open server"))
3787 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3788 (gnus-activate-group group) ; Or we can activate it...
3789 (progn ; Or we bug out.
3790 (when (equal major-mode 'gnus-summary-mode)
3791 (kill-buffer (current-buffer)))
3792 (error "Couldn't request group %s: %s"
3793 group (gnus-status-message group))))
3795 (unless (gnus-request-group group t)
3796 (when (equal major-mode 'gnus-summary-mode)
3797 (kill-buffer (current-buffer)))
3798 (error "Couldn't request group %s: %s"
3799 group (gnus-status-message group)))
3801 (setq gnus-newsgroup-name group)
3802 (setq gnus-newsgroup-unselected nil)
3803 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3805 ;; Adjust and set lists of article marks.
3807 (gnus-adjust-marked-articles info))
3809 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3810 (when (gnus-virtual-group-p group)
3811 (setq cached gnus-newsgroup-cached))
3813 (setq gnus-newsgroup-unreads
3814 (gnus-set-difference
3815 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3816 gnus-newsgroup-dormant))
3818 (setq gnus-newsgroup-processable nil)
3820 (setq articles (gnus-articles-to-read group read-all))
3824 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3826 ((eq articles 0) nil)
3828 ;; Init the dependencies hash table.
3829 (setq gnus-newsgroup-dependencies
3830 (gnus-make-hashtable (length articles)))
3831 ;; Retrieve the headers and read them in.
3832 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3833 (setq gnus-newsgroup-headers
3835 (setq gnus-headers-retrieved-by
3836 (gnus-retrieve-headers
3837 articles gnus-newsgroup-name
3838 ;; We might want to fetch old headers, but
3839 ;; not if there is only 1 article.
3840 (and gnus-fetch-old-headers
3842 (not (eq gnus-fetch-old-headers 'some))
3843 (not (numberp gnus-fetch-old-headers)))
3844 (> (length articles) 1))))))
3845 (gnus-get-newsgroup-headers-xover articles)
3846 (gnus-get-newsgroup-headers)))
3847 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3849 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3851 (setq gnus-newsgroup-cached cached))
3853 ;; Suppress duplicates?
3854 (when gnus-suppress-duplicates
3855 (gnus-dup-suppress-articles))
3857 ;; Set the initial limit.
3858 (setq gnus-newsgroup-limit (copy-sequence articles))
3859 ;; Remove canceled articles from the list of unread articles.
3860 (setq gnus-newsgroup-unreads
3861 (gnus-set-sorted-intersection
3862 gnus-newsgroup-unreads
3863 (setq fetched-articles
3864 (mapcar (lambda (headers) (mail-header-number headers))
3865 gnus-newsgroup-headers))))
3866 ;; Removed marked articles that do not exist.
3867 (gnus-update-missing-marks
3868 (gnus-sorted-complement fetched-articles articles))
3869 ;; We might want to build some more threads first.
3870 (and gnus-fetch-old-headers
3871 (eq gnus-headers-retrieved-by 'nov)
3872 (gnus-build-old-threads))
3873 ;; Check whether auto-expire is to be done in this group.
3874 (setq gnus-newsgroup-auto-expire
3875 (gnus-group-auto-expirable-p group))
3876 ;; Set up the article buffer now, if necessary.
3877 (unless gnus-single-article-buffer
3878 (gnus-article-setup-buffer))
3879 ;; First and last article in this newsgroup.
3880 (when gnus-newsgroup-headers
3881 (setq gnus-newsgroup-begin
3882 (mail-header-number (car gnus-newsgroup-headers))
3885 (gnus-last-element gnus-newsgroup-headers))))
3886 ;; GROUP is successfully selected.
3887 (or gnus-newsgroup-headers t)))))
3889 (defun gnus-articles-to-read (group &optional read-all)
3890 ;; Find out what articles the user wants to read.
3892 ;; Select all articles if `read-all' is non-nil, or if there
3893 ;; are no unread articles.
3895 (and (zerop (length gnus-newsgroup-marked))
3896 (zerop (length gnus-newsgroup-unreads)))
3897 (eq (gnus-group-find-parameter group 'display)
3899 (gnus-uncompress-range (gnus-active group))
3900 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3901 (copy-sequence gnus-newsgroup-unreads))
3903 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3904 (scored (length scored-list))
3905 (number (length articles))
3906 (marked (+ (length gnus-newsgroup-marked)
3907 (length gnus-newsgroup-dormant)))
3915 ((and (or (<= scored marked) (= scored number))
3916 (numberp gnus-large-newsgroup)
3917 (> number gnus-large-newsgroup))
3921 "How many articles from %s (default %d): "
3922 gnus-newsgroup-name number))))
3923 (if (string-match "^[ \t]*$" input) number input)))
3924 ((and (> scored marked) (< scored number)
3925 (> (- scored number) 20))
3928 (format "%s %s (%d scored, %d total): "
3929 "How many articles from"
3930 group scored number))))
3931 (if (string-match "^[ \t]*$" input)
3935 (setq select (if (stringp select) (string-to-number select) select))
3936 (if (or (null select) (zerop select))
3938 (if (and (not (zerop scored)) (<= (abs select) scored))
3940 (setq articles (sort scored-list '<))
3941 (setq number (length articles)))
3942 (setq articles (copy-sequence articles)))
3944 (when (< (abs select) number)
3946 ;; Select the N oldest articles.
3947 (setcdr (nthcdr (1- (abs select)) articles) nil)
3948 ;; Select the N most recent articles.
3949 (setq articles (nthcdr (- number select) articles))))
3950 (setq gnus-newsgroup-unselected
3951 (gnus-sorted-intersection
3952 gnus-newsgroup-unreads
3953 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3956 (defun gnus-killed-articles (killed articles)
3959 (when (inline (gnus-member-of-range (car articles) killed))
3960 (push (car articles) out))
3961 (setq articles (cdr articles)))
3964 (defun gnus-uncompress-marks (marks)
3965 "Uncompress the mark ranges in MARKS."
3966 (let ((uncompressed '(score bookmark))
3969 (if (memq (caar marks) uncompressed)
3970 (push (car marks) out)
3971 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3972 (setq marks (cdr marks)))
3975 (defun gnus-adjust-marked-articles (info)
3976 "Set all article lists and remove all marks that are no longer legal."
3977 (let* ((marked-lists (gnus-info-marks info))
3978 (active (gnus-active (gnus-info-group info)))
3981 (types gnus-article-mark-lists)
3982 (uncompressed '(score bookmark killed))
3983 marks var articles article mark)
3986 (setq marks (pop marked-lists))
3987 (set (setq var (intern (format "gnus-newsgroup-%s"
3988 (car (rassq (setq mark (car marks))
3990 (if (memq (car marks) uncompressed) (cdr marks)
3991 (gnus-uncompress-range (cdr marks))))
3993 (setq articles (symbol-value var))
3995 ;; All articles have to be subsets of the active articles.
3997 ;; Adjust "simple" lists.
3998 ((memq mark '(tick dormant expirable reply save))
4000 (when (or (< (setq article (pop articles)) min) (> article max))
4001 (set var (delq article (symbol-value var))))))
4003 ((memq mark uncompressed)
4005 (when (or (not (consp (setq article (pop articles))))
4006 (< (car article) min)
4007 (> (car article) max))
4008 (set var (delq article (symbol-value var))))))))))
4010 (defun gnus-update-missing-marks (missing)
4011 "Go through the list of MISSING articles and remove them mark lists."
4013 (let ((types gnus-article-mark-lists)
4015 ;; Go through all types.
4017 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4018 (when (symbol-value var)
4019 ;; This list has articles. So we delete all missing articles
4023 (set var (delq (pop m) (symbol-value var)))))))))
4025 (defun gnus-update-marks ()
4026 "Enter the various lists of marked articles into the newsgroup info list."
4027 (let ((types gnus-article-mark-lists)
4028 (info (gnus-get-info gnus-newsgroup-name))
4029 (uncompressed '(score bookmark killed))
4030 type list newmarked symbol)
4032 ;; Add all marks lists that are non-nil to the list of marks lists.
4034 (setq type (pop types))
4035 (when (setq list (symbol-value
4037 (intern (format "gnus-newsgroup-%s"
4039 (push (cons (cdr type)
4040 (if (memq (cdr type) uncompressed) list
4041 (gnus-compress-sequence
4042 (set symbol (sort list '<)) t)))
4045 ;; Enter these new marks into the info of the group.
4047 (setcar (nthcdr 3 info) newmarked)
4048 ;; Add the marks lists to the end of the info.
4050 (setcdr (nthcdr 2 info) (list newmarked))))
4052 ;; Cut off the end of the info if there's nothing else there.
4056 (when (nthcdr (decf i) info)
4057 (setcdr (nthcdr i info) nil)))))))
4059 (defun gnus-set-mode-line (where)
4060 "This function sets the mode line of the article or summary buffers.
4061 If WHERE is `summary', the summary mode line format will be used."
4062 ;; Is this mode line one we keep updated?
4063 (when (memq where gnus-updated-mode-lines)
4066 ;; We evaluate this in the summary buffer since these
4067 ;; variables are buffer-local to that buffer.
4068 (set-buffer gnus-summary-buffer)
4069 ;; We bind all these variables that are used in the `eval' form
4071 (let* ((mformat (symbol-value
4073 (format "gnus-%s-mode-line-format-spec" where))))
4074 (gnus-tmp-group-name gnus-newsgroup-name)
4075 (gnus-tmp-article-number (or gnus-current-article 0))
4076 (gnus-tmp-unread gnus-newsgroup-unreads)
4077 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4078 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4079 (gnus-tmp-unread-and-unselected
4080 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4081 (zerop gnus-tmp-unselected))
4083 ((zerop gnus-tmp-unselected)
4084 (format "{%d more}" gnus-tmp-unread-and-unticked))
4085 (t (format "{%d(+%d) more}"
4086 gnus-tmp-unread-and-unticked
4087 gnus-tmp-unselected))))
4089 (if (and gnus-current-headers
4090 (vectorp gnus-current-headers))
4091 (gnus-mode-string-quote
4092 (mail-header-subject gnus-current-headers))
4095 gnus-tmp-header);; passed as argument to any user-format-funcs
4096 (setq mode-string (eval mformat))
4097 (setq max-len (max 4 (if gnus-mode-non-string-length
4099 gnus-mode-non-string-length)
4100 (length mode-string))))
4101 ;; We might have to chop a bit of the string off...
4102 (when (> (length mode-string) max-len)
4104 (concat (gnus-truncate-string mode-string (- max-len 3))
4106 ;; Pad the mode string a bit.
4107 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4108 ;; Update the mode line.
4109 (setq mode-line-buffer-identification
4110 (gnus-mode-line-buffer-identification
4111 (list mode-string)))
4112 (set-buffer-modified-p t))))
4114 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4115 "Go through the HEADERS list and add all Xrefs to a hash table.
4116 The resulting hash table is returned, or nil if no Xrefs were found."
4117 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4118 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4119 (xref-hashtb (gnus-make-hashtable))
4120 start group entry number xrefs header)
4122 (setq header (pop headers))
4123 (when (and (setq xrefs (mail-header-xref header))
4124 (not (memq (setq number (mail-header-number header))
4127 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4128 (setq start (match-end 0))
4129 (setq group (if prefix
4130 (concat prefix (substring xrefs (match-beginning 1)
4132 (substring xrefs (match-beginning 1) (match-end 1))))
4134 (string-to-int (substring xrefs (match-beginning 2)
4136 (if (setq entry (gnus-gethash group xref-hashtb))
4137 (setcdr entry (cons number (cdr entry)))
4138 (gnus-sethash group (cons number nil) xref-hashtb)))))
4139 (and start xref-hashtb)))
4141 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4142 "Look through all the headers and mark the Xrefs as read."
4143 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4144 name entry info xref-hashtb idlist method nth4)
4146 (set-buffer gnus-group-buffer)
4147 (when (setq xref-hashtb
4148 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4151 (unless (string= from-newsgroup (setq name (symbol-name group)))
4152 (setq idlist (symbol-value group))
4153 ;; Dead groups are not updated.
4155 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4157 (when (stringp (setq nth4 (gnus-info-method info)))
4158 (setq nth4 (gnus-server-to-method nth4))))
4159 ;; Only do the xrefs if the group has the same
4160 ;; select method as the group we have just read.
4161 (or (gnus-methods-equal-p
4162 nth4 (gnus-find-method-for-group from-newsgroup))
4164 (equal nth4 (setq method (gnus-find-method-for-group
4166 (and (equal (car nth4) (car method))
4167 (equal (nth 1 nth4) (nth 1 method))))
4168 gnus-use-cross-reference
4169 (or (not (eq gnus-use-cross-reference t))
4171 ;; Only do cross-references on subscribed
4172 ;; groups, if that is what is wanted.
4173 (<= (gnus-info-level info) gnus-level-subscribed))
4174 (gnus-group-make-articles-read name idlist))))
4177 (defun gnus-group-make-articles-read (group articles)
4178 "Update the info of GROUP to say that only ARTICLES are unread."
4180 (entry (gnus-gethash group gnus-newsrc-hashtb))
4181 (info (nth 2 entry))
4182 (active (gnus-active group))
4184 ;; First peel off all illegal article numbers.
4186 (let ((ids articles)
4188 (while (setq id (pop ids))
4189 (when (and first (> id (cdr active)))
4190 ;; We'll end up in this situation in one particular
4191 ;; obscure situation. If you re-scan a group and get
4192 ;; a new article that is cross-posted to a different
4193 ;; group that has not been re-scanned, you might get
4194 ;; crossposted article that has a higher number than
4195 ;; Gnus believes possible. So we re-activate this
4196 ;; group as well. This might mean doing the
4197 ;; crossposting thingy will *increase* the number
4198 ;; of articles in some groups. Tsk, tsk.
4199 (setq active (or (gnus-activate-group group) active)))
4200 (when (or (> id (cdr active))
4201 (< id (car active)))
4202 (setq articles (delq id articles))))))
4204 (set-buffer gnus-group-buffer)
4207 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4208 (gnus-info-set-read ',info ',(gnus-info-read info))
4209 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4210 (gnus-group-update-group ,group t))))
4211 ;; If the read list is nil, we init it.
4213 (null (gnus-info-read info))
4215 (gnus-info-set-read info (cons 1 (1- (car active)))))
4216 ;; Then we add the read articles to the range.
4221 (gnus-info-read info) (setq articles (sort articles '<)))))
4222 ;; Then we have to re-compute how many unread
4223 ;; articles there are in this group.
4227 (setq num (- (1+ (cdr active)) (car active))))
4228 ((not (listp (cdr range)))
4229 (setq num (- (cdr active) (- (1+ (cdr range))
4233 (if (numberp (car range))
4235 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4236 (setq range (cdr range)))
4237 (setq num (- (cdr active) num))))
4238 ;; Update the number of unread articles.
4240 ;; Update the group buffer.
4241 (gnus-group-update-group group t))))
4243 (defun gnus-methods-equal-p (m1 m2)
4244 (let ((m1 (or m1 gnus-select-method))
4245 (m2 (or m2 gnus-select-method)))
4247 (and (eq (car m1) (car m2))
4248 (or (not (memq 'address (assoc (symbol-name (car m1))
4249 gnus-valid-select-methods)))
4250 (equal (nth 1 m1) (nth 1 m2)))))))
4252 (defvar gnus-newsgroup-none-id 0)
4254 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4255 (let ((cur nntp-server-buffer)
4258 (save-excursion (set-buffer gnus-summary-buffer)
4259 gnus-newsgroup-dependencies)))
4260 headers id id-dep ref-dep end ref)
4262 (set-buffer nntp-server-buffer)
4263 ;; Translate all TAB characters into SPACE characters.
4264 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4265 (run-hooks 'gnus-parse-headers-hook)
4266 (let ((case-fold-search t)
4267 in-reply-to header p lines)
4268 (goto-char (point-min))
4269 ;; Search to the beginning of the next header. Error messages
4270 ;; do not begin with 2 or 3.
4271 (while (re-search-forward "^[23][0-9]+ " nil t)
4274 ;; This implementation of this function, with nine
4275 ;; search-forwards instead of the one re-search-forward and
4276 ;; a case (which basically was the old function) is actually
4277 ;; about twice as fast, even though it looks messier. You
4278 ;; can't have everything, I guess. Speed and elegance
4279 ;; doesn't always go hand in hand.
4288 (narrow-to-region (point)
4289 (or (and (search-forward "\n.\n" nil t)
4295 (if (search-forward "\nsubject: " nil t)
4296 (nnheader-header-value) "(none)"))
4300 (if (search-forward "\nfrom: " nil t)
4301 (nnheader-header-value) "(nobody)"))
4305 (if (search-forward "\ndate: " nil t)
4306 (nnheader-header-value) ""))
4310 (setq id (if (search-forward "\nmessage-id: " nil t)
4311 (nnheader-header-value)
4312 ;; If there was no message-id, we just fake one
4313 ;; to make subsequent routines simpler.
4314 (nnheader-generate-fake-message-id))))
4318 (if (search-forward "\nreferences: " nil t)
4322 (nnheader-header-value)
4327 (search-backward ">" end t)
4330 (search-backward "<" end t)
4332 ;; Get the references from the in-reply-to header if there
4333 ;; were no references and the in-reply-to header looks
4335 (if (and (search-forward "\nin-reply-to: " nil t)
4336 (setq in-reply-to (nnheader-header-value))
4337 (string-match "<[^>]+>" in-reply-to))
4338 (setq ref (substring in-reply-to (match-beginning 0)
4346 (if (search-forward "\nlines: " nil t)
4347 (if (numberp (setq lines (read cur)))
4353 (and (search-forward "\nxref: " nil t)
4354 (nnheader-header-value)))))
4355 (when (equal id ref)
4357 ;; We do the threading while we read the headers. The
4358 ;; message-id and the last reference are both entered into
4359 ;; the same hash table. Some tippy-toeing around has to be
4360 ;; done in case an article has arrived before the article
4361 ;; which it refers to.
4362 (if (boundp (setq id-dep (intern id dependencies)))
4363 (if (and (car (symbol-value id-dep))
4365 ;; An article with this Message-ID has already
4366 ;; been seen, so we ignore this one, except we add
4367 ;; any additional Xrefs (in case the two articles
4368 ;; came from different servers).
4370 (mail-header-set-xref
4371 (car (symbol-value id-dep))
4372 (concat (or (mail-header-xref
4373 (car (symbol-value id-dep)))
4375 (or (mail-header-xref header) "")))
4377 (setcar (symbol-value id-dep) header))
4378 (set id-dep (list header)))
4380 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4381 (setcdr (symbol-value ref-dep)
4382 (nconc (cdr (symbol-value ref-dep))
4383 (list (symbol-value id-dep))))
4384 (set ref-dep (list nil (symbol-value id-dep))))
4385 (push header headers))
4386 (goto-char (point-max))
4388 (nreverse headers)))))
4390 ;; The following macros and functions were written by Felix Lee
4391 ;; <flee@cse.psu.edu>.
4393 (defmacro gnus-nov-read-integer ()
4395 (if (= (following-char) ?\t)
4397 (let ((num (ignore-errors (read buffer))))
4398 (if (numberp num) num 0)))
4402 (defmacro gnus-nov-skip-field ()
4403 '(search-forward "\t" eol 'move))
4405 (defmacro gnus-nov-field ()
4406 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4408 ;; (defvar gnus-nov-none-counter 0)
4410 ;; This function has to be called with point after the article number
4411 ;; on the beginning of the line.
4412 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4413 (let ((eol (gnus-point-at-eol))
4414 (buffer (current-buffer))
4415 header ref id id-dep ref-dep)
4417 ;; overview: [num subject from date id refs chars lines misc]
4420 (narrow-to-region (point) eol)
4427 (gnus-nov-field) ; subject
4428 (gnus-nov-field) ; from
4429 (gnus-nov-field) ; date
4430 (setq id (or (gnus-nov-field)
4431 (nnheader-generate-fake-message-id))) ; id
4433 (let ((beg (point)))
4434 (search-forward "\t" eol)
4435 (if (search-backward ">" beg t)
4439 (search-backward "<" beg t)))
4442 (gnus-nov-field)) ; refs
4443 (gnus-nov-read-integer) ; chars
4444 (gnus-nov-read-integer) ; lines
4445 (if (= (following-char) ?\n)
4447 (gnus-nov-field)) ; misc
4452 ;; We build the thread tree.
4453 (when (equal id ref)
4454 ;; This article refers back to itself. Naughty, naughty.
4456 (if (boundp (setq id-dep (intern id dependencies)))
4457 (if (and (car (symbol-value id-dep))
4459 ;; An article with this Message-ID has already been seen,
4460 ;; so we ignore this one, except we add any additional
4461 ;; Xrefs (in case the two articles came from different
4464 (mail-header-set-xref
4465 (car (symbol-value id-dep))
4466 (concat (or (mail-header-xref
4467 (car (symbol-value id-dep)))
4469 (or (mail-header-xref header) "")))
4471 (setcar (symbol-value id-dep) header))
4472 (set id-dep (list header)))
4474 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4475 (setcdr (symbol-value ref-dep)
4476 (nconc (cdr (symbol-value ref-dep))
4477 (list (symbol-value id-dep))))
4478 (set ref-dep (list nil (symbol-value id-dep)))))
4481 ;; Goes through the xover lines and returns a list of vectors
4482 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4483 force-new dependencies)
4484 "Parse the news overview data in the server buffer, and return a
4485 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4486 ;; Get the Xref when the users reads the articles since most/some
4487 ;; NNTP servers do not include Xrefs when using XOVER.
4488 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4489 (let ((cur nntp-server-buffer)
4490 (dependencies (or dependencies gnus-newsgroup-dependencies))
4491 number headers header)
4493 (set-buffer nntp-server-buffer)
4494 ;; Allow the user to mangle the headers before parsing them.
4495 (run-hooks 'gnus-parse-headers-hook)
4496 (goto-char (point-min))
4499 (while (and sequence (not (eobp)))
4500 (setq number (read cur))
4501 (while (and sequence
4502 (< (car sequence) number))
4503 (setq sequence (cdr sequence)))
4505 (eq number (car sequence))
4507 (setq sequence (cdr sequence))
4508 (setq header (inline
4509 (gnus-nov-parse-line
4510 number dependencies force-new))))
4511 (push header headers))
4514 (gnus-error 4 "Strange nov line (%d)"
4515 (count-lines (point-min) (point)))))
4517 (nreverse headers))))
4519 (defun gnus-article-get-xrefs ()
4520 "Fill in the Xref value in `gnus-current-headers', if necessary.
4521 This is meant to be called in `gnus-article-internal-prepare-hook'."
4522 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4523 gnus-current-headers)))
4524 (or (not gnus-use-cross-reference)
4526 (and (mail-header-xref headers)
4527 (not (string= (mail-header-xref headers) "")))
4528 (let ((case-fold-search t)
4531 (nnheader-narrow-to-headers)
4532 (goto-char (point-min))
4533 (when (or (and (eq (downcase (following-char)) ?x)
4534 (looking-at "Xref:"))
4535 (search-forward "\nXref:" nil t))
4536 (goto-char (1+ (match-end 0)))
4537 (setq xref (buffer-substring (point)
4538 (progn (end-of-line) (point))))
4539 (mail-header-set-xref headers xref)))))))
4541 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4542 "Find article ID and insert the summary line for that article."
4543 (let ((header (if (and old-header use-old-header)
4544 old-header (gnus-read-header id)))
4545 (number (and (numberp id) id))
4548 ;; Rebuild the thread that this article is part of and go to the
4549 ;; article we have fetched.
4550 (when (and (not gnus-show-threads)
4552 (when (setq d (gnus-data-find (mail-header-number old-header)))
4553 (goto-char (gnus-data-pos d))
4556 (- (gnus-point-at-bol)
4558 (1+ (gnus-point-at-eol))
4559 (gnus-delete-line))))))
4561 (mail-header-set-number header (mail-header-number old-header)))
4562 (setq gnus-newsgroup-sparse
4563 (delq (setq number (mail-header-number header))
4564 gnus-newsgroup-sparse))
4565 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4566 (gnus-rebuild-thread (mail-header-id header))
4567 (gnus-summary-goto-subject number nil t))
4568 (when (and (numberp number)
4570 ;; We have to update the boundaries even if we can't fetch the
4571 ;; article if ID is a number -- so that the next `P' or `N'
4572 ;; command will fetch the previous (or next) article even
4573 ;; if the one we tried to fetch this time has been canceled.
4574 (when (> number gnus-newsgroup-end)
4575 (setq gnus-newsgroup-end number))
4576 (when (< number gnus-newsgroup-begin)
4577 (setq gnus-newsgroup-begin number))
4578 (setq gnus-newsgroup-unselected
4579 (delq number gnus-newsgroup-unselected)))
4580 ;; Report back a success?
4581 (and header (mail-header-number header))))
4583 ;;; Process/prefix in the summary buffer
4585 (defun gnus-summary-work-articles (n)
4586 "Return a list of articles to be worked upon. The prefix argument,
4587 the list of process marked articles, and the current article will be
4588 taken into consideration."
4591 ;; A numerical prefix has been given.
4592 (let ((backward (< n 0))
4593 (n (abs (prefix-numeric-value n)))
4598 (push (setq article (gnus-summary-article-number))
4601 (gnus-summary-find-prev nil article)
4602 (gnus-summary-find-next nil article)))
4604 (nreverse articles)))
4605 ((and (boundp 'transient-mark-mode)
4608 ;; Work on the region between point and mark.
4609 (let ((max (max (point) (mark)))
4612 (goto-char (min (point) (mark)))
4615 (push (setq article (gnus-summary-article-number)) articles)
4616 (gnus-summary-find-next nil article)
4618 (nreverse articles))))
4619 (gnus-newsgroup-processable
4620 ;; There are process-marked articles present.
4621 ;; Save current state.
4622 (gnus-summary-save-process-mark)
4624 (reverse gnus-newsgroup-processable))
4626 ;; Just return the current article.
4627 (list (gnus-summary-article-number)))))
4629 (defun gnus-summary-save-process-mark ()
4630 "Push the current set of process marked articles on the stack."
4632 (push (copy-sequence gnus-newsgroup-processable)
4633 gnus-newsgroup-process-stack))
4635 (defun gnus-summary-kill-process-mark ()
4636 "Push the current set of process marked articles on the stack and unmark."
4638 (gnus-summary-save-process-mark)
4639 (gnus-summary-unmark-all-processable))
4641 (defun gnus-summary-yank-process-mark ()
4642 "Pop the last process mark state off the stack and restore it."
4644 (unless gnus-newsgroup-process-stack
4645 (error "Empty mark stack"))
4646 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4648 (defun gnus-summary-process-mark-set (set)
4649 "Make SET into the current process marked articles."
4650 (gnus-summary-unmark-all-processable)
4652 (gnus-summary-set-process-mark (pop set))))
4654 ;;; Searching and stuff
4656 (defun gnus-summary-search-group (&optional backward use-level)
4657 "Search for next unread newsgroup.
4658 If optional argument BACKWARD is non-nil, search backward instead."
4660 (set-buffer gnus-group-buffer)
4661 (when (gnus-group-search-forward
4662 backward nil (if use-level (gnus-group-group-level) nil))
4663 (gnus-group-group-name))))
4665 (defun gnus-summary-best-group (&optional exclude-group)
4666 "Find the name of the best unread group.
4667 If EXCLUDE-GROUP, do not go to this group."
4669 (set-buffer gnus-group-buffer)
4671 (gnus-group-best-unread-group exclude-group))))
4673 (defun gnus-summary-find-next (&optional unread article backward)
4674 (if backward (gnus-summary-find-prev)
4675 (let* ((dummy (gnus-summary-article-intangible-p))
4676 (article (or article (gnus-summary-article-number)))
4677 (arts (gnus-data-find-list article))
4679 (when (and (not dummy)
4680 (or (not gnus-summary-check-current)
4682 (not (gnus-data-unread-p (car arts)))))
4683 (setq arts (cdr arts)))
4688 (when (gnus-data-unread-p (car arts))
4689 (setq result (car arts)
4691 (setq arts (cdr arts)))
4694 (goto-char (gnus-data-pos result))
4695 (gnus-data-number result)))))
4697 (defun gnus-summary-find-prev (&optional unread article)
4698 (let* ((eobp (eobp))
4699 (article (or article (gnus-summary-article-number)))
4700 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4702 (when (and (not eobp)
4703 (or (not gnus-summary-check-current)
4705 (not (gnus-data-unread-p (car arts)))))
4706 (setq arts (cdr arts)))
4711 (when (gnus-data-unread-p (car arts))
4712 (setq result (car arts)
4714 (setq arts (cdr arts)))
4717 (goto-char (gnus-data-pos result))
4718 (gnus-data-number result))))
4720 (defun gnus-summary-find-subject (subject &optional unread backward article)
4721 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4722 (article (or article (gnus-summary-article-number)))
4723 (articles (gnus-data-list backward))
4724 (arts (gnus-data-find-list article articles))
4726 (when (or (not gnus-summary-check-current)
4728 (not (gnus-data-unread-p (car arts))))
4729 (setq arts (cdr arts)))
4731 (and (or (not unread)
4732 (gnus-data-unread-p (car arts)))
4733 (vectorp (gnus-data-header (car arts)))
4735 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4736 (setq result (car arts)
4738 (setq arts (cdr arts)))
4740 (goto-char (gnus-data-pos result))
4741 (gnus-data-number result))))
4743 (defun gnus-summary-search-forward (&optional unread subject backward)
4744 "Search forward for an article.
4745 If UNREAD, look for unread articles. If SUBJECT, look for
4746 articles with that subject. If BACKWARD, search backward instead."
4747 (cond (subject (gnus-summary-find-subject subject unread backward))
4748 (backward (gnus-summary-find-prev unread))
4749 (t (gnus-summary-find-next unread))))
4751 (defun gnus-recenter (&optional n)
4752 "Center point in window and redisplay frame.
4753 Also do horizontal recentering."
4755 (when (and gnus-auto-center-summary
4756 (not (eq gnus-auto-center-summary 'vertical)))
4757 (gnus-horizontal-recenter))
4760 (defun gnus-summary-recenter ()
4761 "Center point in the summary window.
4762 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4763 displayed, no centering will be performed."
4764 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4765 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4766 (let* ((top (cond ((< (window-height) 4) 0)
4767 ((< (window-height) 7) 1)
4769 (height (1- (window-height)))
4770 (bottom (save-excursion (goto-char (point-max))
4771 (forward-line (- height))
4773 (window (get-buffer-window (current-buffer))))
4774 ;; The user has to want it.
4775 (when gnus-auto-center-summary
4776 (when (get-buffer-window gnus-article-buffer)
4777 ;; Only do recentering when the article buffer is displayed,
4778 ;; Set the window start to either `bottom', which is the biggest
4779 ;; possible valid number, or the second line from the top,
4780 ;; whichever is the least.
4782 window (min bottom (save-excursion
4783 (forward-line (- top)) (point)))))
4784 ;; Do horizontal recentering while we're at it.
4785 (when (and (get-buffer-window (current-buffer) t)
4786 (not (eq gnus-auto-center-summary 'vertical)))
4787 (let ((selected (selected-window)))
4788 (select-window (get-buffer-window (current-buffer) t))
4789 (gnus-summary-position-point)
4790 (gnus-horizontal-recenter)
4791 (select-window selected))))))
4793 (defun gnus-summary-jump-to-group (newsgroup)
4794 "Move point to NEWSGROUP in group mode buffer."
4795 ;; Keep update point of group mode buffer if visible.
4796 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4797 (save-window-excursion
4798 ;; Take care of tree window mode.
4799 (when (get-buffer-window gnus-group-buffer)
4800 (pop-to-buffer gnus-group-buffer))
4801 (gnus-group-jump-to-group newsgroup))
4803 ;; Take care of tree window mode.
4804 (if (get-buffer-window gnus-group-buffer)
4805 (pop-to-buffer gnus-group-buffer)
4806 (set-buffer gnus-group-buffer))
4807 (gnus-group-jump-to-group newsgroup))))
4809 ;; This function returns a list of article numbers based on the
4810 ;; difference between the ranges of read articles in this group and
4811 ;; the range of active articles.
4812 (defun gnus-list-of-unread-articles (group)
4813 (let* ((read (gnus-info-read (gnus-get-info group)))
4814 (active (or (gnus-active group) (gnus-activate-group group)))
4817 ;; If none are read, then all are unread.
4819 (setq first (car active))
4820 ;; If the range of read articles is a single range, then the
4821 ;; first unread article is the article after the last read
4822 ;; article. Sounds logical, doesn't it?
4823 (if (not (listp (cdr read)))
4824 (setq first (1+ (cdr read)))
4825 ;; `read' is a list of ranges.
4826 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4832 (while (< first nlast)
4834 (setq first (1+ first))))
4835 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4836 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4837 (setq read (cdr read)))))
4838 ;; And add the last unread articles.
4839 (while (<= first last)
4841 (setq first (1+ first)))
4842 ;; Return the list of unread articles.
4845 (defun gnus-list-of-read-articles (group)
4846 "Return a list of unread, unticked and non-dormant articles."
4847 (let* ((info (gnus-get-info group))
4848 (marked (gnus-info-marks info))
4849 (active (gnus-active group)))
4851 (gnus-set-difference
4852 (gnus-sorted-complement
4853 (gnus-uncompress-range active)
4854 (gnus-list-of-unread-articles group))
4856 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4857 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4859 ;; Various summary commands
4861 (defun gnus-summary-universal-argument (arg)
4862 "Perform any operation on all articles that are process/prefixed."
4864 (gnus-set-global-variables)
4865 (let ((articles (gnus-summary-work-articles arg))
4872 (substitute-command-keys
4873 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4876 (gnus-error 1 "Undefined key")
4879 (gnus-summary-goto-subject (setq article (pop articles)))
4880 (let (gnus-newsgroup-processable)
4881 (command-execute func))
4882 (gnus-summary-remove-process-mark article)))))
4883 (gnus-summary-position-point))
4885 (defun gnus-summary-toggle-truncation (&optional arg)
4886 "Toggle truncation of summary lines.
4887 With arg, turn line truncation on iff arg is positive."
4889 (setq truncate-lines
4890 (if (null arg) (not truncate-lines)
4891 (> (prefix-numeric-value arg) 0)))
4894 (defun gnus-summary-reselect-current-group (&optional all rescan)
4895 "Exit and then reselect the current newsgroup.
4896 The prefix argument ALL means to select all articles."
4898 (gnus-set-global-variables)
4899 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4900 (error "Ephemeral groups can't be reselected"))
4901 (let ((current-subject (gnus-summary-article-number))
4902 (group gnus-newsgroup-name))
4903 (setq gnus-newsgroup-begin nil)
4905 ;; We have to adjust the point of group mode buffer because the
4906 ;; current point was moved to the next unread newsgroup by
4908 (gnus-summary-jump-to-group group)
4911 (gnus-group-get-new-news-this-group 1)))
4912 (gnus-group-read-group all t)
4913 (gnus-summary-goto-subject current-subject nil t)))
4915 (defun gnus-summary-rescan-group (&optional all)
4916 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4918 (gnus-summary-reselect-current-group all t))
4920 (defun gnus-summary-update-info ()
4922 (let ((group gnus-newsgroup-name))
4923 (when gnus-newsgroup-kill-headers
4924 (setq gnus-newsgroup-killed
4925 (gnus-compress-sequence
4927 (gnus-set-sorted-intersection
4928 (gnus-uncompress-range gnus-newsgroup-killed)
4929 (setq gnus-newsgroup-unselected
4930 (sort gnus-newsgroup-unselected '<)))
4931 (setq gnus-newsgroup-unreads
4932 (sort gnus-newsgroup-unreads '<)))
4934 (unless (listp (cdr gnus-newsgroup-killed))
4935 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4936 (let ((headers gnus-newsgroup-headers))
4937 (unless gnus-save-score
4938 (setq gnus-newsgroup-scored nil))
4939 ;; Set the new ranges of read articles.
4940 (gnus-update-read-articles
4941 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4942 ;; Set the current article marks.
4944 ;; Do the cross-ref thing.
4945 (when gnus-use-cross-reference
4946 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4947 ;; Do adaptive scoring, and possibly save score files.
4948 (when gnus-newsgroup-adaptive
4949 (gnus-score-adaptive))
4950 (when gnus-use-scoring
4952 ;; Do not switch windows but change the buffer to work.
4953 (set-buffer gnus-group-buffer)
4954 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4955 (gnus-group-update-group group))))))
4957 (defun gnus-summary-save-newsrc (&optional force)
4958 "Save the current number of read/marked articles in the dribble buffer.
4959 If FORCE (the prefix), also save the .newsrc file(s)."
4961 (gnus-summary-update-info)
4963 (gnus-save-newsrc-file)))
4965 (defun gnus-summary-exit (&optional temporary)
4966 "Exit reading current newsgroup, and then return to group selection mode.
4967 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4969 (gnus-set-global-variables)
4970 (gnus-kill-save-kill-buffer)
4971 (let* ((group gnus-newsgroup-name)
4972 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4974 (buf (current-buffer)))
4975 (run-hooks 'gnus-summary-prepare-exit-hook)
4976 ;; If we have several article buffers, we kill them at exit.
4977 (unless gnus-single-article-buffer
4978 (gnus-kill-buffer gnus-original-article-buffer)
4979 (setq gnus-article-current nil))
4980 (when gnus-use-cache
4981 (gnus-cache-possibly-remove-articles)
4982 (gnus-cache-save-buffers))
4983 (gnus-async-prefetch-remove-group group)
4984 (when gnus-suppress-duplicates
4985 (gnus-dup-enter-articles))
4986 (when gnus-use-trees
4987 (gnus-tree-close group))
4988 ;; Make all changes in this group permanent.
4990 (run-hooks 'gnus-exit-group-hook)
4991 (gnus-summary-update-info))
4992 (gnus-close-group group)
4993 ;; Make sure where I was, and go to next newsgroup.
4994 (set-buffer gnus-group-buffer)
4996 (gnus-group-jump-to-group group))
4997 (run-hooks 'gnus-summary-exit-hook)
4999 (gnus-group-next-unread-group 1))
5002 ;; If we have several article buffers, we kill them at exit.
5003 (unless gnus-single-article-buffer
5004 (gnus-kill-buffer gnus-article-buffer)
5005 (gnus-kill-buffer gnus-original-article-buffer)
5006 (setq gnus-article-current nil))
5008 (if (not gnus-kill-summary-on-exit)
5009 (gnus-deaden-summary)
5010 ;; We set all buffer-local variables to nil. It is unclear why
5011 ;; this is needed, but if we don't, buffer-local variables are
5012 ;; not garbage-collected, it seems. This would the lead to en
5013 ;; ever-growing Emacs.
5014 (gnus-summary-clear-local-variables)
5015 (when (get-buffer gnus-article-buffer)
5016 (bury-buffer gnus-article-buffer))
5017 ;; We clear the global counterparts of the buffer-local
5018 ;; variables as well, just to be on the safe side.
5019 (set-buffer gnus-group-buffer)
5020 (gnus-summary-clear-local-variables)
5021 ;; Return to group mode buffer.
5022 (when (eq mode 'gnus-summary-mode)
5023 (gnus-kill-buffer buf)))
5024 (setq gnus-current-select-method gnus-select-method)
5025 (pop-to-buffer gnus-group-buffer)
5026 ;; Clear the current group name.
5027 (if (not quit-config)
5029 (gnus-group-jump-to-group group)
5030 (gnus-group-next-unread-group 1)
5031 (gnus-configure-windows 'group 'force))
5032 (gnus-handle-ephemeral-exit quit-config))
5034 (setq gnus-newsgroup-name nil)))))
5036 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5037 (defun gnus-summary-exit-no-update (&optional no-questions)
5038 "Quit reading current newsgroup without updating read article info."
5040 (gnus-set-global-variables)
5041 (let* ((group gnus-newsgroup-name)
5042 (quit-config (gnus-group-quit-config group)))
5043 (when (or no-questions
5045 (gnus-y-or-n-p "Do you really wanna quit reading this group? "))
5046 ;; If we have several article buffers, we kill them at exit.
5047 (unless gnus-single-article-buffer
5048 (gnus-kill-buffer gnus-article-buffer)
5049 (gnus-kill-buffer gnus-original-article-buffer)
5050 (setq gnus-article-current nil))
5051 (if (not gnus-kill-summary-on-exit)
5052 (gnus-deaden-summary)
5053 (gnus-close-group group)
5054 (gnus-summary-clear-local-variables)
5055 (set-buffer gnus-group-buffer)
5056 (gnus-summary-clear-local-variables)
5057 (when (get-buffer gnus-summary-buffer)
5058 (kill-buffer gnus-summary-buffer)))
5059 (unless gnus-single-article-buffer
5060 (setq gnus-article-current nil))
5061 (when gnus-use-trees
5062 (gnus-tree-close group))
5063 (gnus-async-prefetch-remove-group group)
5064 (when (get-buffer gnus-article-buffer)
5065 (bury-buffer gnus-article-buffer))
5066 ;; Return to the group buffer.
5067 (gnus-configure-windows 'group 'force)
5068 ;; Clear the current group name.
5069 (setq gnus-newsgroup-name nil)
5070 (when (equal (gnus-group-group-name) group)
5071 (gnus-group-next-unread-group 1))
5073 (gnus-handle-ephemeral-exit quit-config)))))
5075 (defun gnus-handle-ephemeral-exit (quit-config)
5076 "Handle movement when leaving an ephemeral group. The state
5077 which existed when entering the ephemeral is reset."
5078 (if (not (buffer-name (car quit-config)))
5079 (gnus-configure-windows 'group 'force)
5080 (set-buffer (car quit-config))
5081 (cond ((eq major-mode 'gnus-summary-mode)
5082 (gnus-set-global-variables))
5083 ((eq major-mode 'gnus-article-mode)
5085 ;; The `gnus-summary-buffer' variable may point
5086 ;; to the old summary buffer when using a single
5088 (unless (gnus-buffer-live-p gnus-summary-buffer)
5089 (set-buffer gnus-group-buffer))
5090 (set-buffer gnus-summary-buffer)
5091 (gnus-set-global-variables))))
5092 (if (or (eq (cdr quit-config) 'article)
5093 (eq (cdr quit-config) 'pick))
5095 ;; The current article may be from the ephemeral group
5096 ;; thus it is best that we reload this article
5097 (gnus-summary-show-article)
5098 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5099 (gnus-configure-windows 'pick 'force)
5100 (gnus-configure-windows (cdr quit-config) 'force)))
5101 (gnus-configure-windows (cdr quit-config) 'force))
5102 (when (eq major-mode 'gnus-summary-mode)
5103 (gnus-summary-next-subject 1 nil t)
5104 (gnus-summary-recenter)
5105 (gnus-summary-position-point))))
5109 (defvar gnus-dead-summary-mode-map nil)
5111 (unless gnus-dead-summary-mode-map
5112 (setq gnus-dead-summary-mode-map (make-keymap))
5113 (suppress-keymap gnus-dead-summary-mode-map)
5114 (substitute-key-definition
5115 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5116 (let ((keys '("\C-d" "\r" "\177")))
5118 (define-key gnus-dead-summary-mode-map
5119 (pop keys) 'gnus-summary-wake-up-the-dead))))
5121 (defvar gnus-dead-summary-mode nil
5122 "Minor mode for Gnus summary buffers.")
5124 (defun gnus-dead-summary-mode (&optional arg)
5125 "Minor mode for Gnus summary buffers."
5127 (when (eq major-mode 'gnus-summary-mode)
5128 (make-local-variable 'gnus-dead-summary-mode)
5129 (setq gnus-dead-summary-mode
5130 (if (null arg) (not gnus-dead-summary-mode)
5131 (> (prefix-numeric-value arg) 0)))
5132 (when gnus-dead-summary-mode
5133 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
5134 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
5135 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
5136 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
5137 minor-mode-map-alist)))))
5139 (defun gnus-deaden-summary ()
5140 "Make the current summary buffer into a dead summary buffer."
5141 ;; Kill any previous dead summary buffer.
5142 (when (and gnus-dead-summary
5143 (buffer-name gnus-dead-summary))
5145 (set-buffer gnus-dead-summary)
5146 (when gnus-dead-summary-mode
5147 (kill-buffer (current-buffer)))))
5148 ;; Make this the current dead summary.
5149 (setq gnus-dead-summary (current-buffer))
5150 (gnus-dead-summary-mode 1)
5151 (let ((name (buffer-name)))
5152 (when (string-match "Summary" name)
5154 (concat (substring name 0 (match-beginning 0)) "Dead "
5155 (substring name (match-beginning 0)))
5158 (defun gnus-kill-or-deaden-summary (buffer)
5159 "Kill or deaden the summary BUFFER."
5160 (when (and (buffer-name buffer)
5161 (not gnus-single-article-buffer))
5164 (gnus-kill-buffer gnus-article-buffer)
5165 (gnus-kill-buffer gnus-original-article-buffer)))
5166 (cond (gnus-kill-summary-on-exit
5167 (when (and gnus-use-trees
5168 (and (get-buffer buffer)
5169 (buffer-name (get-buffer buffer))))
5171 (set-buffer (get-buffer buffer))
5172 (gnus-tree-close gnus-newsgroup-name)))
5173 (gnus-kill-buffer buffer))
5174 ((and (get-buffer buffer)
5175 (buffer-name (get-buffer buffer)))
5178 (gnus-deaden-summary)))))
5180 (defun gnus-summary-wake-up-the-dead (&rest args)
5181 "Wake up the dead summary buffer."
5183 (gnus-dead-summary-mode -1)
5184 (let ((name (buffer-name)))
5185 (when (string-match "Dead " name)
5187 (concat (substring name 0 (match-beginning 0))
5188 (substring name (match-end 0)))
5190 (gnus-message 3 "This dead summary is now alive again"))
5192 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5193 (defun gnus-summary-fetch-faq (&optional faq-dir)
5194 "Fetch the FAQ for the current group.
5195 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5199 (when current-prefix-arg
5201 "Faq dir: " (and (listp gnus-group-faq-directory)
5202 gnus-group-faq-directory)))))
5203 (let (gnus-faq-buffer)
5204 (when (setq gnus-faq-buffer
5205 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5206 (gnus-configure-windows 'summary-faq))))
5208 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5209 (defun gnus-summary-describe-group (&optional force)
5210 "Describe the current newsgroup."
5212 (gnus-group-describe-group force gnus-newsgroup-name))
5214 (defun gnus-summary-describe-briefly ()
5215 "Describe summary mode commands briefly."
5218 (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")))
5220 ;; Walking around group mode buffer from summary mode.
5222 (defun gnus-summary-next-group (&optional no-article target-group backward)
5223 "Exit current newsgroup and then select next unread newsgroup.
5224 If prefix argument NO-ARTICLE is non-nil, no article is selected
5225 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5226 previous group instead."
5228 (gnus-set-global-variables)
5229 ;; Stop pre-fetching.
5230 (gnus-async-halt-prefetch)
5231 (let ((current-group gnus-newsgroup-name)
5232 (current-buffer (current-buffer))
5234 ;; First we semi-exit this group to update Xrefs and all variables.
5235 ;; We can't do a real exit, because the window conf must remain
5236 ;; the same in case the user is prompted for info, and we don't
5237 ;; want the window conf to change before that...
5238 (gnus-summary-exit t)
5239 (while (not entered)
5240 ;; Then we find what group we are supposed to enter.
5241 (set-buffer gnus-group-buffer)
5242 (gnus-group-jump-to-group current-group)
5245 (if (eq gnus-keep-same-level 'best)
5246 (gnus-summary-best-group gnus-newsgroup-name)
5247 (gnus-summary-search-group backward gnus-keep-same-level))))
5248 (if (not target-group)
5249 ;; There are no further groups, so we return to the group
5252 (gnus-message 5 "Returning to the group buffer")
5254 (set-buffer current-buffer)
5256 (run-hooks 'gnus-group-no-more-groups-hook))
5257 ;; We try to enter the target group.
5258 (gnus-group-jump-to-group target-group)
5259 (let ((unreads (gnus-group-group-unread)))
5260 (if (and (or (eq t unreads)
5261 (and unreads (not (zerop unreads))))
5262 (gnus-summary-read-group
5263 target-group nil no-article current-buffer))
5265 (setq current-group target-group
5266 target-group nil)))))))
5268 (defun gnus-summary-prev-group (&optional no-article)
5269 "Exit current newsgroup and then select previous unread newsgroup.
5270 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5272 (gnus-summary-next-group no-article nil t))
5274 ;; Walking around summary lines.
5276 (defun gnus-summary-first-subject (&optional unread)
5277 "Go to the first unread subject.
5278 If UNREAD is non-nil, go to the first unread article.
5279 Returns the article selected or nil if there are no unread articles."
5284 ((null gnus-newsgroup-data)
5285 (gnus-message 3 "No articles in the group")
5287 ;; Pick the first article.
5289 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5290 (gnus-data-number (car gnus-newsgroup-data)))
5291 ;; No unread articles.
5292 ((null gnus-newsgroup-unreads)
5293 (gnus-message 3 "No more unread articles")
5295 ;; Find the first unread article.
5297 (let ((data gnus-newsgroup-data))
5299 (not (gnus-data-unread-p (car data))))
5300 (setq data (cdr data)))
5302 (goto-char (gnus-data-pos (car data)))
5303 (gnus-data-number (car data))))))
5304 (gnus-summary-position-point)))
5306 (defun gnus-summary-next-subject (n &optional unread dont-display)
5307 "Go to next N'th summary line.
5308 If N is negative, go to the previous N'th subject line.
5309 If UNREAD is non-nil, only unread articles are selected.
5310 The difference between N and the actual number of steps taken is
5313 (let ((backward (< n 0))
5317 (gnus-summary-find-prev unread)
5318 (gnus-summary-find-next unread)))
5321 (gnus-message 7 "No more%s articles"
5322 (if unread " unread" "")))
5323 (unless dont-display
5324 (gnus-summary-recenter)
5325 (gnus-summary-position-point))
5328 (defun gnus-summary-next-unread-subject (n)
5329 "Go to next N'th unread summary line."
5331 (gnus-summary-next-subject n t))
5333 (defun gnus-summary-prev-subject (n &optional unread)
5334 "Go to previous N'th summary line.
5335 If optional argument UNREAD is non-nil, only unread article is selected."
5337 (gnus-summary-next-subject (- n) unread))
5339 (defun gnus-summary-prev-unread-subject (n)
5340 "Go to previous N'th unread summary line."
5342 (gnus-summary-next-subject (- n) t))
5344 (defun gnus-summary-goto-subject (article &optional force silent)
5345 "Go the subject line of ARTICLE.
5346 If FORCE, also allow jumping to articles not currently shown."
5347 (interactive "nArticle number: ")
5349 (data (gnus-data-find article)))
5350 ;; We read in the article if we have to.
5353 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5354 (setq data (gnus-data-find article)))
5359 (gnus-message 3 "Can't find article %d" article))
5361 (goto-char (gnus-data-pos data))
5364 ;; Walking around summary lines with displaying articles.
5366 (defun gnus-summary-expand-window (&optional arg)
5367 "Make the summary buffer take up the entire Emacs frame.
5368 Given a prefix, will force an `article' buffer configuration."
5370 (gnus-set-global-variables)
5372 (gnus-configure-windows 'article 'force)
5373 (gnus-configure-windows 'summary 'force)))
5375 (defun gnus-summary-display-article (article &optional all-header)
5376 "Display ARTICLE in article buffer."
5377 (gnus-set-global-variables)
5381 (if gnus-summary-display-article-function
5382 (funcall gnus-summary-display-article-function article all-header)
5383 (gnus-article-prepare article all-header))
5384 (run-hooks 'gnus-select-article-hook)
5385 (when (and gnus-current-article
5386 (not (zerop gnus-current-article)))
5387 (gnus-summary-goto-subject gnus-current-article))
5388 (gnus-summary-recenter)
5389 (when (and gnus-use-trees gnus-show-threads)
5390 (gnus-possibly-generate-tree article)
5391 (gnus-highlight-selected-tree article))
5392 ;; Successfully display article.
5393 (gnus-article-set-window-start
5394 (cdr (assq article gnus-newsgroup-bookmarks))))))
5396 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5397 "Select the current article.
5398 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5399 non-nil, the article will be re-fetched even if it already present in
5400 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5402 ;; Make sure we are in the summary buffer to work around bbdb bug.
5403 (unless (eq major-mode 'gnus-summary-mode)
5404 (set-buffer gnus-summary-buffer))
5405 (let ((article (or article (gnus-summary-article-number)))
5406 (all-headers (not (not all-headers))) ;Must be T or NIL.
5407 gnus-summary-display-article-function
5410 (gnus-summary-article-pseudo-p article)
5411 (error "This is a pseudo-article."))
5414 (set-buffer gnus-summary-buffer)
5415 (if (or (and gnus-single-article-buffer
5416 (or (null gnus-current-article)
5417 (null gnus-article-current)
5418 (null (get-buffer gnus-article-buffer))
5419 (not (eq article (cdr gnus-article-current)))
5420 (not (equal (car gnus-article-current)
5421 gnus-newsgroup-name))))
5422 (and (not gnus-single-article-buffer)
5423 (or (null gnus-current-article)
5424 (not (eq gnus-current-article article))))
5426 ;; The requested article is different from the current article.
5428 (gnus-summary-display-article article all-headers)
5430 (when (or all-headers gnus-show-all-headers)
5431 (gnus-article-show-all-headers))
5434 (gnus-article-set-window-start
5435 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5437 (defun gnus-summary-set-current-mark (&optional current-mark)
5438 "Obsolete function."
5441 (defun gnus-summary-next-article (&optional unread subject backward push)
5442 "Select the next article.
5443 If UNREAD, only unread articles are selected.
5444 If SUBJECT, only articles with SUBJECT are selected.
5445 If BACKWARD, the previous article is selected instead of the next."
5447 (gnus-set-global-variables)
5449 ;; Is there such an article?
5450 ((and (gnus-summary-search-forward unread subject backward)
5451 (or (gnus-summary-display-article (gnus-summary-article-number))
5452 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5453 (gnus-summary-position-point))
5454 ;; If not, we try the first unread, if that is wanted.
5456 gnus-auto-select-same
5457 ;; Make sure that we don't select the current article.
5458 (not (eq (gnus-summary-article-number)
5460 (gnus-summary-first-subject t)
5461 (gnus-summary-article-number))))
5462 (gnus-summary-first-unread-article))
5463 (gnus-summary-position-point)
5464 (gnus-message 6 "Wrapped"))
5465 ;; Try to get next/previous article not displayed in this group.
5466 ((and gnus-auto-extend-newsgroup
5467 (not unread) (not subject))
5468 (gnus-summary-goto-article
5469 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5471 ;; Go to next/previous group.
5473 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5474 (gnus-summary-jump-to-group gnus-newsgroup-name))
5475 (let ((cmd last-command-char)
5477 (if (eq gnus-keep-same-level 'best)
5478 (gnus-summary-best-group gnus-newsgroup-name)
5479 (gnus-summary-search-group backward gnus-keep-same-level))))
5480 ;; For some reason, the group window gets selected. We change
5482 (select-window (get-buffer-window (current-buffer)))
5483 ;; Select next unread newsgroup automagically.
5485 ((or (not gnus-auto-select-next)
5487 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5488 ((or (eq gnus-auto-select-next 'quietly)
5489 (and (eq gnus-auto-select-next 'slightly-quietly)
5491 (and (eq gnus-auto-select-next 'almost-quietly)
5492 (gnus-summary-last-article-p)))
5494 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5496 (gnus-message 7 "No more%s articles (%s)..."
5497 (if unread " unread" "")
5498 (if group (concat "selecting " group)
5500 (gnus-summary-next-group nil group backward)))
5502 (when (gnus-key-press-event-p last-input-event)
5503 (gnus-summary-walk-group-buffer
5504 gnus-newsgroup-name cmd unread backward))))))))
5506 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward)
5507 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5508 (?\C-p (gnus-group-prev-unread-group 1))))
5509 (cursor-in-echo-area t)
5510 keve key group ended)
5512 (set-buffer gnus-group-buffer)
5513 (gnus-summary-jump-to-group from-group)
5515 (if (eq gnus-keep-same-level 'best)
5516 (gnus-summary-best-group gnus-newsgroup-name)
5517 (gnus-summary-search-group backward gnus-keep-same-level))))
5520 5 "No more%s articles%s" (if unread " unread" "")
5522 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5523 (format " (Type %s for %s [%s])"
5524 (single-key-description cmd) group
5525 (car (gnus-gethash group gnus-newsrc-hashtb)))
5526 (format " (Type %s to exit %s)"
5527 (single-key-description cmd)
5528 gnus-newsgroup-name)))
5529 ;; Confirm auto selection.
5530 (setq key (car (setq keve (gnus-read-event-char))))
5533 ((assq key keystrokes)
5534 (let ((obuf (current-buffer)))
5535 (switch-to-buffer gnus-group-buffer)
5537 (gnus-group-jump-to-group group))
5538 (eval (cadr (assq key keystrokes)))
5539 (setq group (gnus-group-group-name))
5540 (switch-to-buffer obuf))
5544 (gnus-ephemeral-group-p gnus-newsgroup-name))
5546 (gnus-summary-next-group nil group backward)))
5548 (push (cdr keve) unread-command-events))))))
5550 (defun gnus-summary-next-unread-article ()
5551 "Select unread article after current one."
5553 (gnus-summary-next-article
5554 (or (not (eq gnus-summary-goto-unread 'never))
5555 (gnus-summary-last-article-p (gnus-summary-article-number)))
5556 (and gnus-auto-select-same
5557 (gnus-summary-article-subject))))
5559 (defun gnus-summary-prev-article (&optional unread subject)
5560 "Select the article after the current one.
5561 If UNREAD is non-nil, only unread articles are selected."
5563 (gnus-summary-next-article unread subject t))
5565 (defun gnus-summary-prev-unread-article ()
5566 "Select unread article before current one."
5568 (gnus-summary-prev-article
5569 (or (not (eq gnus-summary-goto-unread 'never))
5570 (gnus-summary-first-article-p (gnus-summary-article-number)))
5571 (and gnus-auto-select-same
5572 (gnus-summary-article-subject))))
5574 (defun gnus-summary-next-page (&optional lines circular)
5575 "Show next page of the selected article.
5576 If at the end of the current article, select the next article.
5577 LINES says how many lines should be scrolled up.
5579 If CIRCULAR is non-nil, go to the start of the article instead of
5580 selecting the next article when reaching the end of the current
5583 (setq gnus-summary-buffer (current-buffer))
5584 (gnus-set-global-variables)
5585 (let ((article (gnus-summary-article-number))
5587 (gnus-configure-windows 'article)
5588 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5589 (if (and (eq gnus-summary-goto-unread 'never)
5590 (not (gnus-summary-last-article-p article)))
5591 (gnus-summary-next-article)
5592 (gnus-summary-next-unread-article))
5593 (if (or (null gnus-current-article)
5594 (null gnus-article-current)
5595 (/= article (cdr gnus-article-current))
5596 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5597 ;; Selected subject is different from current article's.
5598 (gnus-summary-display-article article)
5599 (gnus-eval-in-buffer-window gnus-article-buffer
5600 (setq endp (gnus-article-next-page lines)))
5603 (gnus-summary-beginning-of-article))
5605 (gnus-message 3 "End of message"))
5607 (if (and (eq gnus-summary-goto-unread 'never)
5608 (not (gnus-summary-last-article-p article)))
5609 (gnus-summary-next-article)
5610 (gnus-summary-next-unread-article)))))))
5611 (gnus-summary-recenter)
5612 (gnus-summary-position-point)))
5614 (defun gnus-summary-prev-page (&optional lines)
5615 "Show previous page of selected article.
5616 Argument LINES specifies lines to be scrolled down."
5618 (gnus-set-global-variables)
5619 (let ((article (gnus-summary-article-number)))
5620 (gnus-configure-windows 'article)
5621 (if (or (null gnus-current-article)
5622 (null gnus-article-current)
5623 (/= article (cdr gnus-article-current))
5624 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5625 ;; Selected subject is different from current article's.
5626 (gnus-summary-display-article article)
5627 (gnus-summary-recenter)
5628 (gnus-eval-in-buffer-window gnus-article-buffer
5629 (gnus-article-prev-page lines))))
5630 (gnus-summary-position-point))
5632 (defun gnus-summary-scroll-up (lines)
5633 "Scroll up (or down) one line current article.
5634 Argument LINES specifies lines to be scrolled up (or down if negative)."
5636 (gnus-set-global-variables)
5637 (gnus-configure-windows 'article)
5638 (gnus-summary-show-thread)
5639 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5640 (gnus-eval-in-buffer-window gnus-article-buffer
5642 (when (gnus-article-next-page lines)
5643 (gnus-message 3 "End of message")))
5645 (gnus-article-prev-page (- lines))))))
5646 (gnus-summary-recenter)
5647 (gnus-summary-position-point))
5649 (defun gnus-summary-next-same-subject ()
5650 "Select next article which has the same subject as current one."
5652 (gnus-set-global-variables)
5653 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5655 (defun gnus-summary-prev-same-subject ()
5656 "Select previous article which has the same subject as current one."
5658 (gnus-set-global-variables)
5659 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5661 (defun gnus-summary-next-unread-same-subject ()
5662 "Select next unread article which has the same subject as current one."
5664 (gnus-set-global-variables)
5665 (gnus-summary-next-article t (gnus-summary-article-subject)))
5667 (defun gnus-summary-prev-unread-same-subject ()
5668 "Select previous unread article which has the same subject as current one."
5670 (gnus-set-global-variables)
5671 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5673 (defun gnus-summary-first-unread-article ()
5674 "Select the first unread article.
5675 Return nil if there are no unread articles."
5677 (gnus-set-global-variables)
5679 (when (gnus-summary-first-subject t)
5680 (gnus-summary-show-thread)
5681 (gnus-summary-first-subject t)
5682 (gnus-summary-display-article (gnus-summary-article-number)))
5683 (gnus-summary-position-point)))
5685 (defun gnus-summary-first-article ()
5686 "Select the first article.
5687 Return nil if there are no articles."
5689 (gnus-set-global-variables)
5691 (when (gnus-summary-first-subject)
5692 (gnus-summary-show-thread)
5693 (gnus-summary-first-subject)
5694 (gnus-summary-display-article (gnus-summary-article-number)))
5695 (gnus-summary-position-point)))
5697 (defun gnus-summary-best-unread-article ()
5698 "Select the unread article with the highest score."
5700 (gnus-set-global-variables)
5701 (let ((best -1000000)
5702 (data gnus-newsgroup-data)
5705 (and (gnus-data-unread-p (car data))
5707 (gnus-summary-article-score (gnus-data-number (car data))))
5710 article (gnus-data-number (car data))))
5711 (setq data (cdr data)))
5714 (gnus-summary-goto-article article)
5715 (error "No unread articles"))
5716 (gnus-summary-position-point))))
5718 (defun gnus-summary-last-subject ()
5719 "Go to the last displayed subject line in the group."
5720 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5722 (gnus-summary-goto-subject article))))
5724 (defun gnus-summary-goto-article (article &optional all-headers force)
5725 "Fetch ARTICLE and display it if it exists.
5726 If ALL-HEADERS is non-nil, no header lines are hidden."
5732 (mapcar (lambda (number) (list (int-to-string number)))
5733 gnus-newsgroup-limit)))
5737 (if (gnus-summary-goto-subject article force)
5738 (gnus-summary-display-article article all-headers)
5739 (gnus-message 4 "Couldn't go to article %s" article) nil)
5740 (gnus-summary-position-point)))
5742 (defun gnus-summary-goto-last-article ()
5743 "Go to the previously read article."
5746 (when gnus-last-article
5747 (gnus-summary-goto-article gnus-last-article))
5748 (gnus-summary-position-point)))
5750 (defun gnus-summary-pop-article (number)
5751 "Pop one article off the history and go to the previous.
5752 NUMBER articles will be popped off."
5755 (setq gnus-newsgroup-history
5756 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5758 (gnus-summary-goto-article (car to))
5759 (error "Article history empty")))
5760 (gnus-summary-position-point))
5762 ;; Summary commands and functions for limiting the summary buffer.
5764 (defun gnus-summary-limit-to-articles (n)
5765 "Limit the summary buffer to the next N articles.
5766 If not given a prefix, use the process marked articles instead."
5768 (gnus-set-global-variables)
5770 (let ((articles (gnus-summary-work-articles n)))
5771 (setq gnus-newsgroup-processable nil)
5772 (gnus-summary-limit articles))
5773 (gnus-summary-position-point)))
5775 (defun gnus-summary-pop-limit (&optional total)
5776 "Restore the previous limit.
5777 If given a prefix, remove all limits."
5779 (gnus-set-global-variables)
5781 (setq gnus-newsgroup-limits
5782 (list (mapcar (lambda (h) (mail-header-number h))
5783 gnus-newsgroup-headers))))
5784 (unless gnus-newsgroup-limits
5785 (error "No limit to pop"))
5787 (gnus-summary-limit nil 'pop)
5788 (gnus-summary-position-point)))
5790 (defun gnus-summary-limit-to-subject (subject &optional header)
5791 "Limit the summary buffer to articles that have subjects that match a regexp."
5792 (interactive "sRegexp: ")
5794 (setq header "subject"))
5795 (when (not (equal "" subject))
5797 (let ((articles (gnus-summary-find-matching
5798 (or header "subject") subject 'all)))
5800 (error "Found no matches for \"%s\"" subject))
5801 (gnus-summary-limit articles))
5802 (gnus-summary-position-point))))
5804 (defun gnus-summary-limit-to-author (from)
5805 "Limit the summary buffer to articles that have authors that match a regexp."
5806 (interactive "sRegexp: ")
5807 (gnus-summary-limit-to-subject from "from"))
5809 (defun gnus-summary-limit-to-age (age &optional younger-p)
5810 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5811 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5812 articles that are younger than AGE days."
5813 (interactive "nTime in days: \nP")
5815 (let ((data gnus-newsgroup-data)
5816 (cutoff (nnmail-days-to-time age))
5817 articles d date is-younger)
5818 (while (setq d (pop data))
5819 (when (and (vectorp (gnus-data-header d))
5820 (setq date (mail-header-date (gnus-data-header d))))
5821 (setq is-younger (nnmail-time-less
5822 (nnmail-time-since (nnmail-date-to-time date))
5824 (when (if younger-p is-younger (not is-younger))
5825 (push (gnus-data-number d) articles))))
5826 (gnus-summary-limit (nreverse articles)))
5827 (gnus-summary-position-point)))
5829 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5831 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5833 (defun gnus-summary-limit-to-unread (&optional all)
5834 "Limit the summary buffer to articles that are not marked as read.
5835 If ALL is non-nil, limit strictly to unread articles."
5838 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5839 (gnus-summary-limit-to-marks
5840 ;; Concat all the marks that say that an article is read and have
5842 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5843 gnus-killed-mark gnus-kill-file-mark
5844 gnus-low-score-mark gnus-expirable-mark
5845 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5846 gnus-duplicate-mark)
5849 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5850 (make-obsolete 'gnus-summary-delete-marked-with
5851 'gnus-summary-limit-exlude-marks)
5853 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5854 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5855 If REVERSE, limit the summary buffer to articles that are marked
5856 with MARKS. MARKS can either be a string of marks or a list of marks.
5857 Returns how many articles were removed."
5858 (interactive "sMarks: ")
5859 (gnus-summary-limit-to-marks marks t))
5861 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5862 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5863 If REVERSE (the prefix), limit the summary buffer to articles that are
5864 not marked with MARKS. MARKS can either be a string of marks or a
5866 Returns how many articles were removed."
5867 (interactive (list (read-string "Marks: ") current-prefix-arg))
5868 (gnus-set-global-variables)
5870 (let ((data gnus-newsgroup-data)
5871 (marks (if (listp marks) marks
5872 (append marks nil))) ; Transform to list.
5875 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5876 (memq (gnus-data-mark (car data)) marks))
5877 (push (gnus-data-number (car data)) articles))
5878 (setq data (cdr data)))
5879 (gnus-summary-limit articles))
5880 (gnus-summary-position-point)))
5882 (defun gnus-summary-limit-to-score (&optional score)
5883 "Limit to articles with score at or above SCORE."
5885 (gnus-set-global-variables)
5886 (setq score (if score
5887 (prefix-numeric-value score)
5888 (or gnus-summary-default-score 0)))
5889 (let ((data gnus-newsgroup-data)
5892 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5894 (push (gnus-data-number (car data)) articles))
5895 (setq data (cdr data)))
5897 (gnus-summary-limit articles)
5898 (gnus-summary-position-point))))
5900 (defun gnus-summary-limit-include-dormant ()
5901 "Display all the hidden articles that are marked as dormant."
5903 (gnus-set-global-variables)
5904 (unless gnus-newsgroup-dormant
5905 (error "There are no dormant articles in this group"))
5907 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5908 (gnus-summary-position-point)))
5910 (defun gnus-summary-limit-exclude-dormant ()
5911 "Hide all dormant articles."
5913 (gnus-set-global-variables)
5915 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5916 (gnus-summary-position-point)))
5918 (defun gnus-summary-limit-exclude-childless-dormant ()
5919 "Hide all dormant articles that have no children."
5921 (gnus-set-global-variables)
5922 (let ((data (gnus-data-list t))
5923 articles d children)
5924 ;; Find all articles that are either not dormant or have
5926 (while (setq d (pop data))
5927 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5929 (gnus-article-children (gnus-data-number d)))
5932 (when (memq (car children) articles)
5937 (push (gnus-data-number d) articles)))
5940 (gnus-summary-limit articles)
5941 (gnus-summary-position-point))))
5943 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5944 "Mark all unread excluded articles as read.
5945 If ALL, mark even excluded ticked and dormants as read."
5947 (let ((articles (gnus-sorted-complement
5949 (mapcar (lambda (h) (mail-header-number h))
5950 gnus-newsgroup-headers)
5952 (sort gnus-newsgroup-limit '<)))
5954 (setq gnus-newsgroup-unreads nil)
5956 (setq gnus-newsgroup-dormant nil
5957 gnus-newsgroup-marked nil
5958 gnus-newsgroup-reads
5960 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5961 gnus-newsgroup-reads))
5962 (while (setq article (pop articles))
5963 (unless (or (memq article gnus-newsgroup-dormant)
5964 (memq article gnus-newsgroup-marked))
5965 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5967 (defun gnus-summary-limit (articles &optional pop)
5969 ;; We pop the previous limit off the stack and use that.
5970 (setq articles (car gnus-newsgroup-limits)
5971 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5972 ;; We use the new limit, so we push the old limit on the stack.
5973 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5975 (setq gnus-newsgroup-limit articles)
5976 (let ((total (length gnus-newsgroup-data))
5977 (data (gnus-data-find-list (gnus-summary-article-number)))
5978 (gnus-summary-mark-below nil) ; Inhibit this.
5980 ;; This will do all the work of generating the new summary buffer
5981 ;; according to the new limit.
5982 (gnus-summary-prepare)
5983 ;; Hide any threads, possibly.
5984 (and gnus-show-threads
5985 gnus-thread-hide-subtree
5986 (gnus-summary-hide-all-threads))
5987 ;; Try to return to the article you were at, or one in the
5990 ;; We try to find some article after the current one.
5992 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5995 (setq data (cdr data))))
5997 ;; If there is no data, that means that we were after the last
5998 ;; article. The same goes when we can't find any articles
5999 ;; after the current one.
6000 (goto-char (point-max))
6001 (gnus-summary-find-prev))
6002 ;; We return how many articles were removed from the summary
6003 ;; buffer as a result of the new limit.
6004 (- total (length gnus-newsgroup-data))))
6006 (defsubst gnus-invisible-cut-children (threads)
6009 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6014 (defsubst gnus-cut-thread (thread)
6015 "Go forwards in the thread until we find an article that we want to display."
6016 (when (or (eq gnus-fetch-old-headers 'some)
6017 (eq gnus-build-sparse-threads 'some)
6018 (eq gnus-build-sparse-threads 'more))
6019 ;; Deal with old-fetched headers and sparse threads.
6023 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6024 (gnus-summary-article-ancient-p
6025 (mail-header-number (car thread))))
6027 (if (<= (length (cdr thread)) 1)
6028 (setq thread (cadr thread))
6029 (when (gnus-invisible-cut-children (cdr thread))
6030 (let ((th (cdr thread)))
6032 (if (memq (mail-header-number (caar th))
6033 gnus-newsgroup-limit)
6034 (setq thread (car th)
6036 (setq th (cdr th)))))))))
6040 (defun gnus-cut-threads (threads)
6041 "Cut off all uninteresting articles from the beginning of threads."
6042 (when (or (eq gnus-fetch-old-headers 'some)
6043 (eq gnus-build-sparse-threads 'some)
6044 (eq gnus-build-sparse-threads 'more))
6047 (setcar th (gnus-cut-thread (car th)))
6048 (setq th (cdr th)))))
6049 ;; Remove nixed out threads.
6052 (defun gnus-summary-initial-limit (&optional show-if-empty)
6053 "Figure out what the initial limit is supposed to be on group entry.
6054 This entails weeding out unwanted dormants, low-scored articles,
6055 fetch-old-headers verbiage, and so on."
6056 ;; Most groups have nothing to remove.
6057 (if (or gnus-inhibit-limiting
6058 (and (null gnus-newsgroup-dormant)
6059 (not (eq gnus-fetch-old-headers 'some))
6060 (null gnus-summary-expunge-below)
6061 (not (eq gnus-build-sparse-threads 'some))
6062 (not (eq gnus-build-sparse-threads 'more))
6063 (null gnus-thread-expunge-below)
6064 (not gnus-use-nocem)))
6066 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6067 (setq gnus-newsgroup-limit nil)
6070 (unless (car (symbol-value node))
6071 ;; These threads have no parents -- they are roots.
6072 (let ((nodes (cdr (symbol-value node)))
6075 (if (and gnus-thread-expunge-below
6076 (< (gnus-thread-total-score (car nodes))
6077 gnus-thread-expunge-below))
6078 (gnus-expunge-thread (pop nodes))
6079 (setq thread (pop nodes))
6080 (gnus-summary-limit-children thread))))))
6081 gnus-newsgroup-dependencies)
6082 ;; If this limitation resulted in an empty group, we might
6083 ;; pop the previous limit and use it instead.
6084 (when (and (not gnus-newsgroup-limit)
6086 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6087 gnus-newsgroup-limit))
6089 (defun gnus-summary-limit-children (thread)
6090 "Return 1 if this subthread is visible and 0 if it is not."
6091 ;; First we get the number of visible children to this thread. This
6092 ;; is done by recursing down the thread using this function, so this
6093 ;; will really go down to a leaf article first, before slowly
6094 ;; working its way up towards the root.
6098 (apply '+ (mapcar 'gnus-summary-limit-children
6101 (number (mail-header-number (car thread)))
6104 (not (memq number gnus-newsgroup-marked))
6106 ;; If this article is dormant and has absolutely no visible
6107 ;; children, then this article isn't visible.
6108 (and (memq number gnus-newsgroup-dormant)
6110 ;; If this is "fetch-old-headered" and there is no
6111 ;; visible children, then we don't want this article.
6112 (and (eq gnus-fetch-old-headers 'some)
6113 (gnus-summary-article-ancient-p number)
6115 ;; If this is a sparsely inserted article with no children,
6116 ;; we don't want it.
6117 (and (eq gnus-build-sparse-threads 'some)
6118 (gnus-summary-article-sparse-p number)
6120 ;; If we use expunging, and this article is really
6121 ;; low-scored, then we don't want this article.
6122 (when (and gnus-summary-expunge-below
6124 (or (cdr (assq number gnus-newsgroup-scored))
6125 gnus-summary-default-score))
6126 gnus-summary-expunge-below))
6127 ;; We increase the expunge-tally here, but that has
6128 ;; nothing to do with the limits, really.
6129 (incf gnus-newsgroup-expunged-tally)
6130 ;; We also mark as read here, if that's wanted.
6131 (when (and gnus-summary-mark-below
6132 (< score gnus-summary-mark-below))
6133 (setq gnus-newsgroup-unreads
6134 (delq number gnus-newsgroup-unreads))
6135 (if gnus-newsgroup-auto-expire
6136 (push number gnus-newsgroup-expirable)
6137 (push (cons number gnus-low-score-mark)
6138 gnus-newsgroup-reads)))
6140 ;; Check NoCeM things.
6142 (gnus-nocem-unwanted-article-p
6143 (mail-header-id (car thread))))))
6144 ;; Nope, invisible article.
6146 ;; Ok, this article is to be visible, so we add it to the limit
6148 (push number gnus-newsgroup-limit)
6151 (defun gnus-expunge-thread (thread)
6152 "Mark all articles in THREAD as read."
6153 (let* ((number (mail-header-number (car thread))))
6154 (incf gnus-newsgroup-expunged-tally)
6155 ;; We also mark as read here, if that's wanted.
6156 (setq gnus-newsgroup-unreads
6157 (delq number gnus-newsgroup-unreads))
6158 (if gnus-newsgroup-auto-expire
6159 (push number gnus-newsgroup-expirable)
6160 (push (cons number gnus-low-score-mark)
6161 gnus-newsgroup-reads)))
6162 ;; Go recursively through all subthreads.
6163 (mapcar 'gnus-expunge-thread (cdr thread)))
6165 ;; Summary article oriented commands
6167 (defun gnus-summary-refer-parent-article (n)
6168 "Refer parent article N times.
6169 If N is negative, go to ancestor -N instead.
6170 The difference between N and the number of articles fetched is returned."
6172 (gnus-set-global-variables)
6175 (when (not (natnump n))
6180 (setq header (gnus-summary-article-header))
6181 (if (and (eq (mail-header-number header)
6182 (cdr gnus-article-current))
6183 (equal gnus-newsgroup-name
6184 (car gnus-article-current)))
6185 ;; If we try to find the parent of the currently
6186 ;; displayed article, then we take a look at the actual
6187 ;; References header, since this is slightly more
6188 ;; reliable than the References field we got from the
6191 (set-buffer gnus-original-article-buffer)
6192 (nnheader-narrow-to-headers)
6193 (unless (setq ref (message-fetch-field "references"))
6194 (setq ref (message-fetch-field "in-reply-to")))
6197 ;; It's not the current article, so we take a bet on
6198 ;; the value we got from the server.
6199 (mail-header-references header)))
6201 (not (equal ref "")))
6202 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6203 (gnus-message 1 "Couldn't find parent"))
6204 (gnus-message 1 "No references in article %d"
6205 (gnus-summary-article-number))
6208 (gnus-summary-position-point)
6211 (defun gnus-summary-refer-references ()
6212 "Fetch all articles mentioned in the References header.
6213 Return how many articles were fetched."
6215 (gnus-set-global-variables)
6216 (let ((ref (mail-header-references (gnus-summary-article-header)))
6217 (current (gnus-summary-article-number))
6221 (error "No References in the current article")
6222 ;; For each Message-ID in the References header...
6223 (while (string-match "<[^>]*>" ref)
6225 ;; ... fetch that article.
6226 (gnus-summary-refer-article
6227 (prog1 (match-string 0 ref)
6228 (setq ref (substring ref (match-end 0))))))
6229 (gnus-summary-goto-subject current)
6230 (gnus-summary-position-point)
6233 (defun gnus-summary-refer-article (message-id)
6234 "Fetch an article specified by MESSAGE-ID."
6235 (interactive "sMessage-ID: ")
6236 (when (and (stringp message-id)
6237 (not (zerop (length message-id))))
6238 ;; Construct the correct Message-ID if necessary.
6239 ;; Suggested by tale@pawl.rpi.edu.
6240 (unless (string-match "^<" message-id)
6241 (setq message-id (concat "<" message-id)))
6242 (unless (string-match ">$" message-id)
6243 (setq message-id (concat message-id ">")))
6244 (let* ((header (gnus-id-to-header message-id))
6246 (gnus-summary-article-sparse-p
6247 (mail-header-number header)))))
6250 ;; The article is present in the buffer, to we just go to it.
6251 (gnus-summary-goto-article
6252 (mail-header-number header) nil header)
6254 (gnus-summary-update-article (mail-header-number header))))
6255 ;; We fetch the article
6256 (let ((gnus-override-method
6257 (and (gnus-news-group-p gnus-newsgroup-name)
6258 gnus-refer-article-method))
6260 ;; Start the special refer-article method, if necessary.
6261 (when (and gnus-refer-article-method
6262 (gnus-news-group-p gnus-newsgroup-name))
6263 (gnus-check-server gnus-refer-article-method))
6264 ;; Fetch the header, and display the article.
6265 (if (setq number (gnus-summary-insert-subject message-id))
6266 (gnus-summary-select-article nil nil nil number)
6267 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6269 (defun gnus-summary-enter-digest-group (&optional force)
6270 "Enter an nndoc group based on the current article.
6271 If FORCE, force a digest interpretation. If not, try
6272 to guess what the document format is."
6274 (gnus-set-global-variables)
6275 (let ((conf gnus-current-window-configuration))
6277 (gnus-summary-select-article))
6278 (setq gnus-current-window-configuration conf)
6279 (let* ((name (format "%s-%d"
6280 (gnus-group-prefixed-name
6281 gnus-newsgroup-name (list 'nndoc ""))
6283 (set-buffer gnus-summary-buffer)
6284 gnus-current-article)))
6285 (ogroup gnus-newsgroup-name)
6286 (params (append (gnus-info-params (gnus-get-info ogroup))
6287 (list (cons 'to-group ogroup))))
6288 (case-fold-search t)
6289 (buf (current-buffer))
6292 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6293 (insert-buffer-substring gnus-original-article-buffer)
6294 ;; Remove lines that may lead nndoc to misinterpret the
6297 (goto-char (point-min))
6298 (or (search-forward "\n\n" nil t) (point)))
6299 (goto-char (point-min))
6300 (delete-matching-lines "^\\(Path\\):\\|^From ")
6303 (if (gnus-group-read-ephemeral-group
6304 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6306 ,(if force 'digest 'guess))) t)
6307 ;; Make all postings to this group go to the parent group.
6308 (nconc (gnus-info-params (gnus-get-info name))
6310 ;; Couldn't select this doc group.
6311 (switch-to-buffer buf)
6312 (gnus-set-global-variables)
6313 (gnus-configure-windows 'summary)
6314 (gnus-message 3 "Article couldn't be entered?"))
6315 (kill-buffer dig)))))
6317 (defun gnus-summary-read-document (n)
6318 "Open a new group based on the current article(s).
6319 This will allow you to read digests and other similar
6320 documents as newsgroups.
6321 Obeys the standard process/prefix convention."
6323 (let* ((articles (gnus-summary-work-articles n))
6324 (ogroup gnus-newsgroup-name)
6325 (params (append (gnus-info-params (gnus-get-info ogroup))
6326 (list (cons 'to-group ogroup))))
6327 article group egroup groups vgroup)
6328 (while (setq article (pop articles))
6329 (setq group (format "%s-%d" gnus-newsgroup-name article))
6330 (gnus-summary-remove-process-mark article)
6331 (when (gnus-summary-display-article article)
6333 (nnheader-temp-write nil
6334 (insert-buffer-substring gnus-original-article-buffer)
6335 ;; Remove some headers that may lead nndoc to make
6337 (message-narrow-to-head)
6338 (goto-char (point-min))
6339 (delete-matching-lines "^\\(Path\\):\\|^From ")
6342 (gnus-group-read-ephemeral-group
6343 group `(nndoc ,group (nndoc-address ,(current-buffer))
6344 (nndoc-article-type guess))
6347 ;; Make all postings to this group go to the parent group.
6348 (nconc (gnus-info-params (gnus-get-info egroup))
6350 (push egroup groups))
6351 ;; Couldn't select this doc group.
6352 (gnus-error 3 "Article couldn't be entered"))))))
6353 ;; Now we have selected all the documents.
6356 (error "None of the articles could be interpreted as documents"))
6357 ((gnus-group-read-ephemeral-group
6358 (setq vgroup (format
6359 "nnvirtual:%s-%s" gnus-newsgroup-name
6360 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6361 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6363 (cons (current-buffer) 'summary)))
6365 (error "Couldn't select virtual nndoc group")))))
6367 (defun gnus-summary-isearch-article (&optional regexp-p)
6368 "Do incremental search forward on the current article.
6369 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6371 (gnus-set-global-variables)
6372 (gnus-summary-select-article)
6373 (gnus-configure-windows 'article)
6374 (gnus-eval-in-buffer-window gnus-article-buffer
6375 ;;(goto-char (point-min))
6376 (isearch-forward regexp-p)))
6378 (defun gnus-summary-search-article-forward (regexp &optional backward)
6379 "Search for an article containing REGEXP forward.
6380 If BACKWARD, search backward instead."
6383 (format "Search article %s (regexp%s): "
6384 (if current-prefix-arg "backward" "forward")
6385 (if gnus-last-search-regexp
6386 (concat ", default " gnus-last-search-regexp)
6388 current-prefix-arg))
6389 (gnus-set-global-variables)
6390 (if (string-equal regexp "")
6391 (setq regexp (or gnus-last-search-regexp ""))
6392 (setq gnus-last-search-regexp regexp))
6393 (if (gnus-summary-search-article regexp backward)
6394 (gnus-summary-show-thread)
6395 (error "Search failed: \"%s\"" regexp)))
6397 (defun gnus-summary-search-article-backward (regexp)
6398 "Search for an article containing REGEXP backward."
6401 (format "Search article backward (regexp%s): "
6402 (if gnus-last-search-regexp
6403 (concat ", default " gnus-last-search-regexp)
6405 (gnus-summary-search-article-forward regexp 'backward))
6407 (defun gnus-summary-search-article (regexp &optional backward)
6408 "Search for an article containing REGEXP.
6409 Optional argument BACKWARD means do search for backward.
6410 `gnus-select-article-hook' is not called during the search."
6411 (let ((gnus-select-article-hook nil) ;Disable hook.
6412 (gnus-article-display-hook nil)
6413 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6414 (gnus-use-article-prefetch nil)
6415 (sum (current-buffer))
6418 (gnus-save-hidden-threads
6419 (gnus-summary-select-article)
6420 (set-buffer gnus-article-buffer)
6424 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6426 (re-search-backward regexp nil t)
6427 (re-search-forward regexp nil t))
6428 ;; We found the regexp.
6433 (get-buffer-window (current-buffer))
6437 (setq point (point)))
6438 ;; We didn't find it, so we go to the next article.
6441 (while (eq found 'not)
6442 (if (not (if backward (gnus-summary-find-prev)
6443 (gnus-summary-find-next)))
6444 ;; No more articles.
6446 ;; Select the next article and adjust point.
6447 (unless (gnus-summary-article-sparse-p
6448 (gnus-summary-article-number))
6450 (gnus-summary-select-article)
6451 (set-buffer gnus-article-buffer)
6453 (goto-char (if backward (point-max) (point-min))))))))
6454 (gnus-message 7 ""))
6455 ;; Return whether we found the regexp.
6456 (when (eq found 'found)
6458 (gnus-summary-show-thread)
6459 (gnus-summary-goto-subject gnus-current-article)
6460 (gnus-summary-position-point)
6463 (defun gnus-summary-find-matching (header regexp &optional backward unread
6465 "Return a list of all articles that match REGEXP on HEADER.
6466 The search stars on the current article and goes forwards unless
6467 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6468 If UNREAD is non-nil, only unread articles will
6469 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6470 in the comparisons."
6471 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6472 (gnus-data-find-list
6473 (gnus-summary-article-number) (gnus-data-list backward))))
6474 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6475 (case-fold-search (not not-case-fold))
6477 (unless (fboundp (intern (concat "mail-header-" header)))
6478 (error "%s is not a valid header" header))
6481 (and (or (not unread) ; We want all articles...
6482 (gnus-data-unread-p d)) ; Or just unreads.
6483 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6484 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6485 (push (gnus-data-number d) articles)) ; Success!
6486 (setq data (cdr data)))
6487 (nreverse articles)))
6489 (defun gnus-summary-execute-command (header regexp command &optional backward)
6490 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6491 If HEADER is an empty string (or nil), the match is done on the entire
6492 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6494 (list (let ((completion-ignore-case t))
6497 (mapcar (lambda (string) (list string))
6498 '("Number" "Subject" "From" "Lines" "Date"
6499 "Message-ID" "Xref" "References" "Body"))
6500 nil 'require-match))
6501 (read-string "Regexp: ")
6502 (read-key-sequence "Command: ")
6503 current-prefix-arg))
6504 (when (equal header "Body")
6506 (gnus-set-global-variables)
6507 ;; Hidden thread subtrees must be searched as well.
6508 (gnus-summary-show-all-threads)
6509 ;; We don't want to change current point nor window configuration.
6511 (save-window-excursion
6512 (gnus-message 6 "Executing %s..." (key-description command))
6513 ;; We'd like to execute COMMAND interactively so as to give arguments.
6514 (gnus-execute header regexp
6515 `(call-interactively ',(key-binding command))
6517 (gnus-message 6 "Executing %s...done" (key-description command)))))
6519 (defun gnus-summary-beginning-of-article ()
6520 "Scroll the article back to the beginning."
6522 (gnus-set-global-variables)
6523 (gnus-summary-select-article)
6524 (gnus-configure-windows 'article)
6525 (gnus-eval-in-buffer-window gnus-article-buffer
6527 (goto-char (point-min))
6528 (when gnus-break-pages
6529 (gnus-narrow-to-page))))
6531 (defun gnus-summary-end-of-article ()
6532 "Scroll to the end of the article."
6534 (gnus-set-global-variables)
6535 (gnus-summary-select-article)
6536 (gnus-configure-windows 'article)
6537 (gnus-eval-in-buffer-window gnus-article-buffer
6539 (goto-char (point-max))
6541 (when gnus-break-pages
6542 (gnus-narrow-to-page))))
6544 (defun gnus-summary-print-article (&optional filename)
6545 "Generate and print a PostScript image of the article buffer.
6547 If the optional argument FILENAME is nil, send the image to the printer.
6548 If FILENAME is a string, save the PostScript image in a file with that
6549 name. If FILENAME is a number, prompt the user for the name of the file
6551 (interactive (list (ps-print-preprint current-prefix-arg)))
6552 (gnus-summary-select-article)
6553 (gnus-eval-in-buffer-window gnus-article-buffer
6554 (let ((buffer (generate-new-buffer " *print*")))
6557 (copy-to-buffer buffer (point-min) (point-max))
6559 (article-delete-invisible-text)
6560 (ps-print-buffer-with-faces filename))
6561 (kill-buffer buffer)))))
6563 (defun gnus-summary-show-article (&optional arg)
6564 "Force re-fetching of the current article.
6565 If ARG (the prefix) is non-nil, show the raw article without any
6566 article massaging functions being run."
6568 (gnus-set-global-variables)
6570 ;; Select the article the normal way.
6571 (gnus-summary-select-article nil 'force)
6572 ;; Bind the article treatment functions to nil.
6573 (let ((gnus-have-all-headers t)
6574 gnus-article-display-hook
6575 gnus-article-prepare-hook
6578 (gnus-summary-select-article nil 'force)))
6579 (gnus-summary-goto-subject gnus-current-article)
6580 ; (gnus-configure-windows 'article)
6581 (gnus-summary-position-point))
6583 (defun gnus-summary-verbose-headers (&optional arg)
6584 "Toggle permanent full header display.
6585 If ARG is a positive number, turn header display on.
6586 If ARG is a negative number, turn header display off."
6588 (gnus-set-global-variables)
6589 (setq gnus-show-all-headers
6590 (cond ((or (not (numberp arg))
6592 (not gnus-show-all-headers))
6595 (gnus-summary-show-article))
6597 (defun gnus-summary-toggle-header (&optional arg)
6598 "Show the headers if they are hidden, or hide them if they are shown.
6599 If ARG is a positive number, show the entire header.
6600 If ARG is a negative number, hide the unwanted header lines."
6602 (gnus-set-global-variables)
6604 (set-buffer gnus-article-buffer)
6605 (let* ((buffer-read-only nil)
6606 (inhibit-point-motion-hooks t)
6607 (hidden (text-property-any
6608 (goto-char (point-min)) (search-forward "\n\n")
6611 (goto-char (point-min))
6612 (when (search-forward "\n\n" nil t)
6613 (delete-region (point-min) (1- (point))))
6614 (goto-char (point-min))
6616 (set-buffer gnus-original-article-buffer)
6617 (goto-char (point-min))
6618 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6619 (insert-buffer-substring gnus-original-article-buffer 1 e)
6620 (let ((article-inhibit-hiding t))
6621 (run-hooks 'gnus-article-display-hook))
6622 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6623 (gnus-article-hide-headers)))))
6625 (defun gnus-summary-show-all-headers ()
6626 "Make all header lines visible."
6628 (gnus-set-global-variables)
6629 (gnus-article-show-all-headers))
6631 (defun gnus-summary-toggle-mime (&optional arg)
6632 "Toggle MIME processing.
6633 If ARG is a positive number, turn MIME processing on."
6635 (gnus-set-global-variables)
6636 (setq gnus-show-mime
6637 (if (null arg) (not gnus-show-mime)
6638 (> (prefix-numeric-value arg) 0)))
6639 (gnus-summary-select-article t 'force))
6641 (defun gnus-summary-caesar-message (&optional arg)
6642 "Caesar rotate the current article by 13.
6643 The numerical prefix specifies how manu places to rotate each letter
6646 (gnus-set-global-variables)
6647 (gnus-summary-select-article)
6648 (let ((mail-header-separator ""))
6649 (gnus-eval-in-buffer-window gnus-article-buffer
6652 (let ((start (window-start))
6654 (message-caesar-buffer-body arg)
6655 (set-window-start (get-buffer-window (current-buffer)) start))))))
6657 (defun gnus-summary-stop-page-breaking ()
6658 "Stop page breaking in the current article."
6660 (gnus-set-global-variables)
6661 (gnus-summary-select-article)
6662 (gnus-eval-in-buffer-window gnus-article-buffer
6664 (when (gnus-visual-p 'page-marker)
6665 (let ((buffer-read-only nil))
6666 (gnus-remove-text-with-property 'gnus-prev)
6667 (gnus-remove-text-with-property 'gnus-next)))))
6669 (defun gnus-summary-move-article (&optional n to-newsgroup
6670 select-method action)
6671 "Move the current article to a different newsgroup.
6672 If N is a positive number, move the N next articles.
6673 If N is a negative number, move the N previous articles.
6674 If N is nil and any articles have been marked with the process mark,
6675 move those articles instead.
6676 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6677 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6678 re-spool using this method.
6680 For this function to work, both the current newsgroup and the
6681 newsgroup that you want to move to have to support the `request-move'
6682 and `request-accept' functions."
6685 (setq action 'move))
6686 (gnus-set-global-variables)
6687 ;; Disable marking as read.
6688 (let (gnus-mark-article-hook)
6689 (save-window-excursion
6690 (gnus-summary-select-article)))
6691 ;; Check whether the source group supports the required functions.
6692 (cond ((and (eq action 'move)
6693 (not (gnus-check-backend-function
6694 'request-move-article gnus-newsgroup-name)))
6695 (error "The current group does not support article moving"))
6696 ((and (eq action 'crosspost)
6697 (not (gnus-check-backend-function
6698 'request-replace-article gnus-newsgroup-name)))
6699 (error "The current group does not support article editing")))
6700 (let ((articles (gnus-summary-work-articles n))
6701 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6702 (names '((move "Move" "Moving")
6703 (copy "Copy" "Copying")
6704 (crosspost "Crosspost" "Crossposting")))
6705 (copy-buf (save-excursion
6706 (nnheader-set-temp-buffer " *copy article*")))
6707 art-group to-method new-xref article to-groups)
6708 (unless (assq action names)
6709 (error "Unknown action %s" action))
6710 ;; Read the newsgroup name.
6711 (when (and (not to-newsgroup)
6712 (not select-method))
6714 (gnus-read-move-group-name
6715 (cadr (assq action names))
6716 (symbol-value (intern (format "gnus-current-%s-group" action)))
6718 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6719 (setq to-method (or select-method
6720 (gnus-group-name-to-method to-newsgroup)))
6721 ;; Check the method we are to move this article to...
6722 (unless (gnus-check-backend-function
6723 'request-accept-article (car to-method))
6724 (error "%s does not support article copying" (car to-method)))
6725 (unless (gnus-check-server to-method)
6726 (error "Can't open server %s" (car to-method)))
6727 (gnus-message 6 "%s to %s: %s..."
6728 (caddr (assq action names))
6729 (or (car select-method) to-newsgroup) articles)
6731 (setq article (pop articles))
6735 ;; Move the article.
6737 (gnus-request-move-article
6738 article ; Article to move
6739 gnus-newsgroup-name ; From newsgroup
6740 (nth 1 (gnus-find-method-for-group
6741 gnus-newsgroup-name)) ; Server
6742 (list 'gnus-request-accept-article
6743 to-newsgroup (list 'quote select-method)
6744 (not articles)) ; Accept form
6745 (not articles))) ; Only save nov last time
6746 ;; Copy the article.
6749 (set-buffer copy-buf)
6750 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6751 (gnus-request-accept-article
6752 to-newsgroup select-method (not articles))))
6753 ;; Crosspost the article.
6754 ((eq action 'crosspost)
6755 (let ((xref (message-tokenize-header
6756 (mail-header-xref (gnus-summary-article-header article))
6758 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6761 (setq xref (list (system-name))))
6764 (mapconcat 'identity
6765 (delete "Xref:" (delete new-xref xref))
6769 (set-buffer copy-buf)
6770 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6771 (nnheader-replace-header "xref" new-xref)
6772 (gnus-request-accept-article
6773 to-newsgroup select-method (not articles)))))))
6775 (gnus-message 1 "Couldn't %s article %s"
6776 (cadr (assq action names)) article)
6779 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6781 (gnus-group-prefixed-name
6784 (gnus-find-method-for-group to-newsgroup)))
6785 gnus-newsrc-hashtb)))
6786 (info (nth 2 entry))
6787 (to-group (gnus-info-group info)))
6788 ;; Update the group that has been moved to.
6790 (memq action '(move copy)))
6791 (unless (member to-group to-groups)
6792 (push to-group to-groups))
6794 (unless (memq article gnus-newsgroup-unreads)
6796 info (gnus-add-to-range (gnus-info-read info)
6797 (list (cdr art-group)))))
6799 ;; Copy any marks over to the new group.
6800 (let ((marks gnus-article-mark-lists)
6801 (to-article (cdr art-group)))
6803 ;; See whether the article is to be put in the cache.
6804 (when gnus-use-cache
6805 (gnus-cache-possibly-enter-article
6807 (let ((header (copy-sequence
6808 (gnus-summary-article-header article))))
6809 (mail-header-set-number header to-article)
6811 (memq article gnus-newsgroup-marked)
6812 (memq article gnus-newsgroup-dormant)
6813 (memq article gnus-newsgroup-unreads)))
6816 (when (memq article (symbol-value
6817 (intern (format "gnus-newsgroup-%s"
6819 ;; If the other group is the same as this group,
6820 ;; then we have to add the mark to the list.
6821 (when (equal to-group gnus-newsgroup-name)
6822 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6825 (intern (format "gnus-newsgroup-%s"
6827 ;; Copy mark to other group.
6828 (gnus-add-marked-articles
6829 to-group (cdar marks) (list to-article) info))
6830 (setq marks (cdr marks)))))
6832 ;; Update the Xref header in this article to point to
6833 ;; the new crossposted article we have just created.
6834 (when (eq action 'crosspost)
6836 (set-buffer copy-buf)
6837 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6838 (nnheader-replace-header
6839 "xref" (concat new-xref " " (car art-group)
6840 ":" (cdr art-group)))
6841 (gnus-request-replace-article
6842 article gnus-newsgroup-name (current-buffer)))))
6844 (gnus-summary-goto-subject article)
6845 (when (eq action 'move)
6846 (gnus-summary-mark-article article gnus-canceled-mark)))
6847 (gnus-summary-remove-process-mark article))
6848 ;; Re-activate all groups that have been moved to.
6850 (gnus-activate-group (pop to-groups)))
6852 (gnus-kill-buffer copy-buf)
6853 (gnus-summary-position-point)
6854 (gnus-set-mode-line 'summary)))
6856 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6857 "Move the current article to a different newsgroup.
6858 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6859 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6860 re-spool using this method."
6862 (gnus-summary-move-article n nil select-method 'copy))
6864 (defun gnus-summary-crosspost-article (&optional n)
6865 "Crosspost the current article to some other group."
6867 (gnus-summary-move-article n nil nil 'crosspost))
6869 (defcustom gnus-summary-respool-default-method nil
6870 "Default method for respooling an article.
6871 If nil, use to the current newsgroup method."
6872 :type 'gnus-select-method-name
6873 :group 'gnus-summary-mail)
6875 (defun gnus-summary-respool-article (&optional n method)
6876 "Respool the current article.
6877 The article will be squeezed through the mail spooling process again,
6878 which means that it will be put in some mail newsgroup or other
6879 depending on `nnmail-split-methods'.
6880 If N is a positive number, respool the N next articles.
6881 If N is a negative number, respool the N previous articles.
6882 If N is nil and any articles have been marked with the process mark,
6883 respool those articles instead.
6885 Respooling can be done both from mail groups and \"real\" newsgroups.
6886 In the former case, the articles in question will be moved from the
6887 current group into whatever groups they are destined to. In the
6888 latter case, they will be copied into the relevant groups."
6890 (list current-prefix-arg
6891 (let* ((methods (gnus-methods-using 'respool))
6893 (symbol-name (or gnus-summary-respool-default-method
6894 (car (gnus-find-method-for-group
6895 gnus-newsgroup-name)))))
6897 (gnus-completing-read
6898 methname "What backend do you want to use when respooling?"
6899 methods nil t nil 'gnus-mail-method-history))
6902 ((zerop (length (setq ms (gnus-servers-using-backend
6904 (list (intern method) ""))
6908 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6909 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6911 (gnus-set-global-variables)
6913 (error "No method given for respooling"))
6914 (if (assoc (symbol-name
6915 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6916 (gnus-methods-using 'respool))
6917 (gnus-summary-move-article n nil method)
6918 (gnus-summary-copy-article n nil method)))
6920 (defun gnus-summary-import-article (file)
6921 "Import a random file into a mail newsgroup."
6922 (interactive "fImport file: ")
6923 (gnus-set-global-variables)
6924 (let ((group gnus-newsgroup-name)
6925 (now (current-time))
6927 (unless (gnus-check-backend-function 'request-accept-article group)
6928 (error "%s does not support article importing" group))
6929 (or (file-readable-p file)
6930 (not (file-regular-p file))
6931 (error "Can't read %s" file))
6933 (set-buffer (get-buffer-create " *import file*"))
6934 (buffer-disable-undo (current-buffer))
6936 (insert-file-contents file)
6937 (goto-char (point-min))
6938 (unless (nnheader-article-p)
6939 ;; This doesn't look like an article, so we fudge some headers.
6940 (setq atts (file-attributes file)
6941 lines (count-lines (point-min) (point-max)))
6942 (insert "From: " (read-string "From: ") "\n"
6943 "Subject: " (read-string "Subject: ") "\n"
6944 "Date: " (timezone-make-date-arpa-standard
6945 (current-time-string (nth 5 atts))
6946 (current-time-zone now)
6947 (current-time-zone now))
6949 "Message-ID: " (message-make-message-id) "\n"
6950 "Lines: " (int-to-string lines) "\n"
6951 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6952 (gnus-request-accept-article group nil t)
6953 (kill-buffer (current-buffer)))))
6955 (defun gnus-summary-article-posted-p ()
6956 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6957 This will be the case if the article has both been mailed and posted."
6959 (let ((id (mail-header-references (gnus-summary-article-header)))
6960 (gnus-override-method
6961 (or gnus-refer-article-method gnus-select-method)))
6962 (if (gnus-request-head id "")
6963 (gnus-message 2 "The current message was found on %s"
6964 gnus-override-method)
6965 (gnus-message 2 "The current message couldn't be found on %s"
6966 gnus-override-method)
6969 (defun gnus-summary-expire-articles (&optional now)
6970 "Expire all articles that are marked as expirable in the current group."
6972 (gnus-set-global-variables)
6973 (when (gnus-check-backend-function
6974 'request-expire-articles gnus-newsgroup-name)
6975 ;; This backend supports expiry.
6976 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6977 (expirable (if total
6979 ;; We need to update the info for
6980 ;; this group for `gnus-list-of-read-articles'
6981 ;; to give us the right answer.
6982 (run-hooks 'gnus-exit-group-hook)
6983 (gnus-summary-update-info)
6984 (gnus-list-of-read-articles gnus-newsgroup-name))
6985 (setq gnus-newsgroup-expirable
6986 (sort gnus-newsgroup-expirable '<))))
6987 (expiry-wait (if now 'immediate
6988 (gnus-group-find-parameter
6989 gnus-newsgroup-name 'expiry-wait)))
6992 ;; There are expirable articles in this group, so we run them
6993 ;; through the expiry process.
6994 (gnus-message 6 "Expiring articles...")
6995 ;; The list of articles that weren't expired is returned.
6997 (let ((nnmail-expiry-wait-function nil)
6998 (nnmail-expiry-wait expiry-wait))
6999 (setq es (gnus-request-expire-articles
7000 expirable gnus-newsgroup-name)))
7001 (setq es (gnus-request-expire-articles
7002 expirable gnus-newsgroup-name)))
7004 (setq gnus-newsgroup-expirable es))
7005 ;; We go through the old list of expirable, and mark all
7006 ;; really expired articles as nonexistent.
7007 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7008 (let ((gnus-use-cache nil))
7010 (unless (memq (car expirable) es)
7011 (when (gnus-data-find (car expirable))
7012 (gnus-summary-mark-article
7013 (car expirable) gnus-canceled-mark)))
7014 (setq expirable (cdr expirable)))))
7015 (gnus-message 6 "Expiring articles...done")))))
7017 (defun gnus-summary-expire-articles-now ()
7018 "Expunge all expirable articles in the current group.
7019 This means that *all* articles that are marked as expirable will be
7020 deleted forever, right now."
7022 (gnus-set-global-variables)
7023 (or gnus-expert-user
7025 "Are you really, really, really sure you want to delete all these messages? ")
7027 (gnus-summary-expire-articles t))
7029 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7030 (defun gnus-summary-delete-article (&optional n)
7031 "Delete the N next (mail) articles.
7032 This command actually deletes articles. This is not a marking
7033 command. The article will disappear forever from your life, never to
7035 If N is negative, delete backwards.
7036 If N is nil and articles have been marked with the process mark,
7037 delete these instead."
7039 (gnus-set-global-variables)
7040 (unless (gnus-check-backend-function 'request-expire-articles
7041 gnus-newsgroup-name)
7042 (error "The current newsgroup does not support article deletion."))
7043 ;; Compute the list of articles to delete.
7044 (let ((articles (gnus-summary-work-articles n))
7046 (if (and gnus-novice-user
7048 (format "Do you really want to delete %s forever? "
7049 (if (> (length articles) 1)
7050 (format "these %s articles" (length articles))
7053 ;; Delete the articles.
7054 (setq not-deleted (gnus-request-expire-articles
7055 articles gnus-newsgroup-name 'force))
7057 (gnus-summary-remove-process-mark (car articles))
7058 ;; The backend might not have been able to delete the article
7060 (unless (memq (car articles) not-deleted)
7061 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7062 (setq articles (cdr articles))))
7063 (gnus-summary-position-point)
7064 (gnus-set-mode-line 'summary)
7067 (defun gnus-summary-edit-article (&optional force)
7068 "Edit the current article.
7069 This will have permanent effect only in mail groups.
7070 If FORCE is non-nil, allow editing of articles even in read-only
7074 (set-buffer gnus-summary-buffer)
7075 (gnus-set-global-variables)
7076 (when (and (not force)
7077 (gnus-group-read-only-p))
7078 (error "The current newsgroup does not support article editing."))
7079 ;; Select article if needed.
7080 (unless (eq (gnus-summary-article-number)
7081 gnus-current-article)
7082 (gnus-summary-select-article t))
7083 (gnus-article-edit-article
7085 (gnus-summary-edit-article-done
7086 ,(or (mail-header-references gnus-current-headers) "")
7087 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
7089 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7091 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
7092 "Make edits to the current article permanent."
7094 ;; Replace the article.
7095 (if (and (not read-only)
7096 (not (gnus-request-replace-article
7097 (cdr gnus-article-current) (car gnus-article-current)
7099 (error "Couldn't replace article.")
7100 ;; Update the summary buffer.
7102 (equal (message-tokenize-header references " ")
7103 (message-tokenize-header
7104 (or (message-fetch-field "references") "") " ")))
7105 ;; We only have to update this line.
7108 (message-narrow-to-head)
7109 (let ((header (nnheader-parse-head t)))
7111 (mail-header-set-number header (cdr gnus-article-current))
7112 (gnus-summary-update-article-line
7113 (cdr gnus-article-current) header))))
7115 (set-buffer (or buffer gnus-summary-buffer))
7116 (gnus-summary-update-article (cdr gnus-article-current)))
7117 ;; Prettify the article buffer again.
7119 (set-buffer gnus-article-buffer)
7120 (run-hooks 'gnus-article-display-hook))
7121 ;; Prettify the summary buffer line.
7122 (when (gnus-visual-p 'summary-highlight 'highlight)
7123 (run-hooks 'gnus-visual-mark-article-hook))))
7125 (defun gnus-summary-edit-wash (key)
7126 "Perform editing command in the article buffer."
7130 (message "%s" (concat (this-command-keys) "- "))
7133 (gnus-summary-edit-article)
7134 (execute-kbd-macro (concat (this-command-keys) key))
7135 (gnus-article-edit-done))
7139 (defun gnus-summary-respool-query ()
7140 "Query where the respool algorithm would put this article."
7142 (gnus-set-global-variables)
7143 (gnus-summary-select-article)
7145 (set-buffer gnus-article-buffer)
7147 (goto-char (point-min))
7148 (search-forward "\n\n")
7149 (narrow-to-region (point-min) (point))
7150 (message "This message would go to %s"
7151 (mapconcat 'car (nnmail-article-group 'identity) ", ")))))
7153 ;; Summary marking commands.
7155 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7156 "Mark articles which has the same subject as read, and then select the next.
7157 If UNMARK is positive, remove any kind of mark.
7158 If UNMARK is negative, tick articles."
7160 (gnus-set-global-variables)
7162 (setq unmark (prefix-numeric-value unmark)))
7164 (gnus-summary-mark-same-subject
7165 (gnus-summary-article-subject) unmark)))
7166 ;; Select next unread article. If auto-select-same mode, should
7167 ;; select the first unread article.
7168 (gnus-summary-next-article t (and gnus-auto-select-same
7169 (gnus-summary-article-subject)))
7170 (gnus-message 7 "%d article%s marked as %s"
7171 count (if (= count 1) " is" "s are")
7172 (if unmark "unread" "read"))))
7174 (defun gnus-summary-kill-same-subject (&optional unmark)
7175 "Mark articles which has the same subject as read.
7176 If UNMARK is positive, remove any kind of mark.
7177 If UNMARK is negative, tick articles."
7179 (gnus-set-global-variables)
7181 (setq unmark (prefix-numeric-value unmark)))
7183 (gnus-summary-mark-same-subject
7184 (gnus-summary-article-subject) unmark)))
7185 ;; If marked as read, go to next unread subject.
7187 ;; Go to next unread subject.
7188 (gnus-summary-next-subject 1 t))
7189 (gnus-message 7 "%d articles are marked as %s"
7190 count (if unmark "unread" "read"))))
7192 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7193 "Mark articles with same SUBJECT as read, and return marked number.
7194 If optional argument UNMARK is positive, remove any kinds of marks.
7195 If optional argument UNMARK is negative, mark articles as unread instead."
7199 ((null unmark) ; Mark as read.
7202 (gnus-summary-mark-article-as-read gnus-killed-mark)
7203 (gnus-summary-show-thread) t)
7204 (gnus-summary-find-subject subject))
7205 (setq count (1+ count))))
7206 ((> unmark 0) ; Tick.
7209 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7210 (gnus-summary-show-thread) t)
7211 (gnus-summary-find-subject subject))
7212 (setq count (1+ count))))
7213 (t ; Mark as unread.
7216 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7217 (gnus-summary-show-thread) t)
7218 (gnus-summary-find-subject subject))
7219 (setq count (1+ count)))))
7220 (gnus-set-mode-line 'summary)
7221 ;; Return the number of marked articles.
7224 (defun gnus-summary-mark-as-processable (n &optional unmark)
7225 "Set the process mark on the next N articles.
7226 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7227 the process mark instead. The difference between N and the actual
7228 number of articles marked is returned."
7230 (gnus-set-global-variables)
7231 (let ((backward (< n 0))
7236 (gnus-summary-remove-process-mark
7237 (gnus-summary-article-number))
7238 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7239 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7242 (gnus-message 7 "No more articles"))
7243 (gnus-summary-recenter)
7244 (gnus-summary-position-point)
7247 (defun gnus-summary-unmark-as-processable (n)
7248 "Remove the process mark from the next N articles.
7249 If N is negative, mark backward instead. The difference between N and
7250 the actual number of articles marked is returned."
7252 (gnus-set-global-variables)
7253 (gnus-summary-mark-as-processable n t))
7255 (defun gnus-summary-unmark-all-processable ()
7256 "Remove the process mark from all articles."
7258 (gnus-set-global-variables)
7260 (while gnus-newsgroup-processable
7261 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7262 (gnus-summary-position-point))
7264 (defun gnus-summary-mark-as-expirable (n)
7265 "Mark N articles forward as expirable.
7266 If N is negative, mark backward instead. The difference between N and
7267 the actual number of articles marked is returned."
7269 (gnus-set-global-variables)
7270 (gnus-summary-mark-forward n gnus-expirable-mark))
7272 (defun gnus-summary-mark-article-as-replied (article)
7273 "Mark ARTICLE replied and update the summary line."
7274 (push article gnus-newsgroup-replied)
7275 (let ((buffer-read-only nil))
7276 (when (gnus-summary-goto-subject article)
7277 (gnus-summary-update-secondary-mark article))))
7279 (defun gnus-summary-set-bookmark (article)
7280 "Set a bookmark in current article."
7281 (interactive (list (gnus-summary-article-number)))
7282 (gnus-set-global-variables)
7283 (when (or (not (get-buffer gnus-article-buffer))
7284 (not gnus-current-article)
7285 (not gnus-article-current)
7286 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7287 (error "No current article selected"))
7288 ;; Remove old bookmark, if one exists.
7289 (let ((old (assq article gnus-newsgroup-bookmarks)))
7291 (setq gnus-newsgroup-bookmarks
7292 (delq old gnus-newsgroup-bookmarks))))
7293 ;; Set the new bookmark, which is on the form
7294 ;; (article-number . line-number-in-body).
7298 (set-buffer gnus-article-buffer)
7302 (goto-char (point-min))
7303 (search-forward "\n\n" nil t)
7306 gnus-newsgroup-bookmarks)
7307 (gnus-message 6 "A bookmark has been added to the current article."))
7309 (defun gnus-summary-remove-bookmark (article)
7310 "Remove the bookmark from the current article."
7311 (interactive (list (gnus-summary-article-number)))
7312 (gnus-set-global-variables)
7313 ;; Remove old bookmark, if one exists.
7314 (let ((old (assq article gnus-newsgroup-bookmarks)))
7317 (setq gnus-newsgroup-bookmarks
7318 (delq old gnus-newsgroup-bookmarks))
7319 (gnus-message 6 "Removed bookmark."))
7320 (gnus-message 6 "No bookmark in current article."))))
7322 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7323 (defun gnus-summary-mark-as-dormant (n)
7324 "Mark N articles forward as dormant.
7325 If N is negative, mark backward instead. The difference between N and
7326 the actual number of articles marked is returned."
7328 (gnus-set-global-variables)
7329 (gnus-summary-mark-forward n gnus-dormant-mark))
7331 (defun gnus-summary-set-process-mark (article)
7332 "Set the process mark on ARTICLE and update the summary line."
7333 (setq gnus-newsgroup-processable
7335 (delq article gnus-newsgroup-processable)))
7336 (when (gnus-summary-goto-subject article)
7337 (gnus-summary-show-thread)
7338 (gnus-summary-update-secondary-mark article)))
7340 (defun gnus-summary-remove-process-mark (article)
7341 "Remove the process mark from ARTICLE and update the summary line."
7342 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7343 (when (gnus-summary-goto-subject article)
7344 (gnus-summary-show-thread)
7345 (gnus-summary-update-secondary-mark article)))
7347 (defun gnus-summary-set-saved-mark (article)
7348 "Set the process mark on ARTICLE and update the summary line."
7349 (push article gnus-newsgroup-saved)
7350 (when (gnus-summary-goto-subject article)
7351 (gnus-summary-update-secondary-mark article)))
7353 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7354 "Mark N articles as read forwards.
7355 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7356 The difference between N and the actual number of articles marked is
7359 (gnus-set-global-variables)
7360 (let ((backward (< n 0))
7361 (gnus-summary-goto-unread
7362 (and gnus-summary-goto-unread
7363 (not (eq gnus-summary-goto-unread 'never))
7364 (not (memq mark (list gnus-unread-mark
7365 gnus-ticked-mark gnus-dormant-mark)))))
7367 (mark (or mark gnus-del-mark)))
7369 (gnus-summary-mark-article nil mark no-expire)
7370 (zerop (gnus-summary-next-subject
7372 (and gnus-summary-goto-unread
7373 (not (eq gnus-summary-goto-unread 'never)))
7377 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7378 (gnus-summary-recenter)
7379 (gnus-summary-position-point)
7380 (gnus-set-mode-line 'summary)
7383 (defun gnus-summary-mark-article-as-read (mark)
7384 "Mark the current article quickly as read with MARK."
7385 (let ((article (gnus-summary-article-number)))
7386 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7387 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7388 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7389 (push (cons article mark) gnus-newsgroup-reads)
7390 ;; Possibly remove from cache, if that is used.
7391 (when gnus-use-cache
7392 (gnus-cache-enter-remove-article article))
7393 ;; Allow the backend to change the mark.
7394 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7395 ;; Check for auto-expiry.
7396 (when (and gnus-newsgroup-auto-expire
7397 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7398 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7399 (= mark gnus-ancient-mark)
7400 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7401 (= mark gnus-duplicate-mark)))
7402 (setq mark gnus-expirable-mark)
7403 (push article gnus-newsgroup-expirable))
7404 ;; Set the mark in the buffer.
7405 (gnus-summary-update-mark mark 'unread)
7408 (defun gnus-summary-mark-article-as-unread (mark)
7409 "Mark the current article quickly as unread with MARK."
7410 (let ((article (gnus-summary-article-number)))
7412 (gnus-error 1 "Unmarkable article")
7413 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7414 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7415 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7416 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7417 (cond ((= mark gnus-ticked-mark)
7418 (push article gnus-newsgroup-marked))
7419 ((= mark gnus-dormant-mark)
7420 (push article gnus-newsgroup-dormant))
7422 (push article gnus-newsgroup-unreads)))
7423 (setq gnus-newsgroup-reads
7424 (delq (assq article gnus-newsgroup-reads)
7425 gnus-newsgroup-reads))
7427 ;; See whether the article is to be put in the cache.
7429 (vectorp (gnus-summary-article-header article))
7431 (gnus-cache-possibly-enter-article
7432 gnus-newsgroup-name article
7433 (gnus-summary-article-header article)
7434 (= mark gnus-ticked-mark)
7435 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7438 (gnus-summary-update-mark mark 'unread))
7441 (defun gnus-summary-mark-article (&optional article mark no-expire)
7442 "Mark ARTICLE with MARK. MARK can be any character.
7443 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7444 `??' (dormant) and `?E' (expirable).
7445 If MARK is nil, then the default character `?D' is used.
7446 If ARTICLE is nil, then the article on the current line will be
7448 ;; The mark might be a string.
7449 (when (stringp mark)
7450 (setq mark (aref mark 0)))
7451 ;; If no mark is given, then we check auto-expiring.
7452 (and (not no-expire)
7453 gnus-newsgroup-auto-expire
7456 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7457 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7458 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7459 (= mark gnus-duplicate-mark))))
7460 (setq mark gnus-expirable-mark))
7461 (let* ((mark (or mark gnus-del-mark))
7462 (article (or article (gnus-summary-article-number))))
7464 (error "No article on current line"))
7465 (if (or (= mark gnus-unread-mark)
7466 (= mark gnus-ticked-mark)
7467 (= mark gnus-dormant-mark))
7468 (gnus-mark-article-as-unread article mark)
7469 (gnus-mark-article-as-read article mark))
7471 ;; See whether the article is to be put in the cache.
7473 (not (= mark gnus-canceled-mark))
7474 (vectorp (gnus-summary-article-header article))
7476 (gnus-cache-possibly-enter-article
7477 gnus-newsgroup-name article
7478 (gnus-summary-article-header article)
7479 (= mark gnus-ticked-mark)
7480 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7482 (when (gnus-summary-goto-subject article nil t)
7483 (let ((buffer-read-only nil))
7484 (gnus-summary-show-thread)
7486 (gnus-summary-update-mark mark 'unread)
7489 (defun gnus-summary-update-secondary-mark (article)
7490 "Update the secondary (read, process, cache) mark."
7491 (gnus-summary-update-mark
7492 (cond ((memq article gnus-newsgroup-processable)
7494 ((memq article gnus-newsgroup-cached)
7496 ((memq article gnus-newsgroup-replied)
7498 ((memq article gnus-newsgroup-saved)
7500 (t gnus-unread-mark))
7502 (when (gnus-visual-p 'summary-highlight 'highlight)
7503 (run-hooks 'gnus-summary-update-hook))
7506 (defun gnus-summary-update-mark (mark type)
7507 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7508 (buffer-read-only nil))
7509 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7510 (when (looking-at "\r")
7513 (<= (+ forward (point)) (point-max)))
7514 ;; Go to the right position on the line.
7515 (goto-char (+ forward (point)))
7516 ;; Replace the old mark with the new mark.
7517 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7518 ;; Optionally update the marks by some user rule.
7519 (when (eq type 'unread)
7521 (gnus-data-find (gnus-summary-article-number)) mark)
7522 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7524 (defun gnus-mark-article-as-read (article &optional mark)
7525 "Enter ARTICLE in the pertinent lists and remove it from others."
7526 ;; Make the article expirable.
7527 (let ((mark (or mark gnus-del-mark)))
7528 (if (= mark gnus-expirable-mark)
7529 (push article gnus-newsgroup-expirable)
7530 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7531 ;; Remove from unread and marked lists.
7532 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7533 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7534 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7535 (push (cons article mark) gnus-newsgroup-reads)
7536 ;; Possibly remove from cache, if that is used.
7537 (when gnus-use-cache
7538 (gnus-cache-enter-remove-article article))))
7540 (defun gnus-mark-article-as-unread (article &optional mark)
7541 "Enter ARTICLE in the pertinent lists and remove it from others."
7542 (let ((mark (or mark gnus-ticked-mark)))
7543 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7544 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7545 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7546 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7548 ;; Unsuppress duplicates?
7549 (when gnus-suppress-duplicates
7550 (gnus-dup-unsuppress-article article))
7552 (cond ((= mark gnus-ticked-mark)
7553 (push article gnus-newsgroup-marked))
7554 ((= mark gnus-dormant-mark)
7555 (push article gnus-newsgroup-dormant))
7557 (push article gnus-newsgroup-unreads)))
7558 (setq gnus-newsgroup-reads
7559 (delq (assq article gnus-newsgroup-reads)
7560 gnus-newsgroup-reads))))
7562 (defalias 'gnus-summary-mark-as-unread-forward
7563 'gnus-summary-tick-article-forward)
7564 (make-obsolete 'gnus-summary-mark-as-unread-forward
7565 'gnus-summary-tick-article-forward)
7566 (defun gnus-summary-tick-article-forward (n)
7567 "Tick N articles forwards.
7568 If N is negative, tick backwards instead.
7569 The difference between N and the number of articles ticked is returned."
7571 (gnus-summary-mark-forward n gnus-ticked-mark))
7573 (defalias 'gnus-summary-mark-as-unread-backward
7574 'gnus-summary-tick-article-backward)
7575 (make-obsolete 'gnus-summary-mark-as-unread-backward
7576 'gnus-summary-tick-article-backward)
7577 (defun gnus-summary-tick-article-backward (n)
7578 "Tick N articles backwards.
7579 The difference between N and the number of articles ticked is returned."
7581 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7583 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7584 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7585 (defun gnus-summary-tick-article (&optional article clear-mark)
7586 "Mark current article as unread.
7587 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7588 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7590 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7593 (defun gnus-summary-mark-as-read-forward (n)
7594 "Mark N articles as read forwards.
7595 If N is negative, mark backwards instead.
7596 The difference between N and the actual number of articles marked is
7599 (gnus-summary-mark-forward n gnus-del-mark t))
7601 (defun gnus-summary-mark-as-read-backward (n)
7602 "Mark the N articles as read backwards.
7603 The difference between N and the actual number of articles marked is
7606 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7608 (defun gnus-summary-mark-as-read (&optional article mark)
7609 "Mark current article as read.
7610 ARTICLE specifies the article to be marked as read.
7611 MARK specifies a string to be inserted at the beginning of the line."
7612 (gnus-summary-mark-article article mark))
7614 (defun gnus-summary-clear-mark-forward (n)
7615 "Clear marks from N articles forward.
7616 If N is negative, clear backward instead.
7617 The difference between N and the number of marks cleared is returned."
7619 (gnus-summary-mark-forward n gnus-unread-mark))
7621 (defun gnus-summary-clear-mark-backward (n)
7622 "Clear marks from N articles backward.
7623 The difference between N and the number of marks cleared is returned."
7625 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7627 (defun gnus-summary-mark-unread-as-read ()
7628 "Intended to be used by `gnus-summary-mark-article-hook'."
7629 (when (memq gnus-current-article gnus-newsgroup-unreads)
7630 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7632 (defun gnus-summary-mark-read-and-unread-as-read ()
7633 "Intended to be used by `gnus-summary-mark-article-hook'."
7634 (let ((mark (gnus-summary-article-mark)))
7635 (when (or (gnus-unread-mark-p mark)
7636 (gnus-read-mark-p mark))
7637 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7639 (defun gnus-summary-mark-region-as-read (point mark all)
7640 "Mark all unread articles between point and mark as read.
7641 If given a prefix, mark all articles between point and mark as read,
7642 even ticked and dormant ones."
7643 (interactive "r\nP")
7652 (memq (setq article (gnus-summary-article-number))
7653 gnus-newsgroup-unreads))
7654 (gnus-summary-mark-article article gnus-del-mark))
7656 (gnus-summary-find-next))))))
7658 (defun gnus-summary-mark-below (score mark)
7659 "Mark articles with score less than SCORE with MARK."
7660 (interactive "P\ncMark: ")
7661 (gnus-set-global-variables)
7662 (setq score (if score
7663 (prefix-numeric-value score)
7664 (or gnus-summary-default-score 0)))
7666 (set-buffer gnus-summary-buffer)
7667 (goto-char (point-min))
7670 (and (< (gnus-summary-article-score) score)
7671 (gnus-summary-mark-article nil mark))
7672 (gnus-summary-find-next)))))
7674 (defun gnus-summary-kill-below (&optional score)
7675 "Mark articles with score below SCORE as read."
7677 (gnus-set-global-variables)
7678 (gnus-summary-mark-below score gnus-killed-mark))
7680 (defun gnus-summary-clear-above (&optional score)
7681 "Clear all marks from articles with score above SCORE."
7683 (gnus-set-global-variables)
7684 (gnus-summary-mark-above score gnus-unread-mark))
7686 (defun gnus-summary-tick-above (&optional score)
7687 "Tick all articles with score above SCORE."
7689 (gnus-set-global-variables)
7690 (gnus-summary-mark-above score gnus-ticked-mark))
7692 (defun gnus-summary-mark-above (score mark)
7693 "Mark articles with score over SCORE with MARK."
7694 (interactive "P\ncMark: ")
7695 (gnus-set-global-variables)
7696 (setq score (if score
7697 (prefix-numeric-value score)
7698 (or gnus-summary-default-score 0)))
7700 (set-buffer gnus-summary-buffer)
7701 (goto-char (point-min))
7703 (when (> (gnus-summary-article-score) score)
7704 (gnus-summary-mark-article nil mark))
7706 (gnus-summary-find-next)))))
7708 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7709 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7710 (defun gnus-summary-limit-include-expunged (&optional no-error)
7711 "Display all the hidden articles that were expunged for low scores."
7713 (gnus-set-global-variables)
7714 (let ((buffer-read-only nil))
7715 (let ((scored gnus-newsgroup-scored)
7718 (unless (gnus-summary-goto-subject (caar scored))
7719 (and (setq h (gnus-summary-article-header (caar scored)))
7720 (< (cdar scored) gnus-summary-expunge-below)
7722 (setq scored (cdr scored)))
7724 (when (not no-error)
7725 (error "No expunged articles hidden."))
7726 (goto-char (point-min))
7727 (gnus-summary-prepare-unthreaded (nreverse headers))
7728 (goto-char (point-min))
7729 (gnus-summary-position-point)
7732 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7733 "Mark all unread articles in this newsgroup as read.
7734 If prefix argument ALL is non-nil, ticked and dormant articles will
7735 also be marked as read.
7736 If QUIETLY is non-nil, no questions will be asked.
7737 If TO-HERE is non-nil, it should be a point in the buffer. All
7738 articles before this point will be marked as read.
7739 Note that this function will only catch up the unread article
7740 in the current summary buffer limitation.
7741 The number of articles marked as read is returned."
7743 (gnus-set-global-variables)
7747 (not gnus-interactive-catchup) ;Without confirmation?
7751 "Mark absolutely all articles as read? "
7752 "Mark all unread articles as read? ")))
7754 (not gnus-newsgroup-adaptive)
7755 (not gnus-newsgroup-auto-expire)
7756 (not gnus-suppress-duplicates))
7759 (setq gnus-newsgroup-marked nil
7760 gnus-newsgroup-dormant nil))
7761 (setq gnus-newsgroup-unreads nil))
7762 ;; We actually mark all articles as canceled, which we
7763 ;; have to do when using auto-expiry or adaptive scoring.
7764 (gnus-summary-show-all-threads)
7765 (when (gnus-summary-first-subject (not all))
7767 (if to-here (< (point) to-here) t)
7768 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7769 (gnus-summary-find-next (not all)))))
7770 (gnus-set-mode-line 'summary))
7772 (gnus-summary-position-point)))
7774 (defun gnus-summary-catchup-to-here (&optional all)
7775 "Mark all unticked articles before the current one as read.
7776 If ALL is non-nil, also mark ticked and dormant articles as read."
7778 (gnus-set-global-variables)
7780 (gnus-save-hidden-threads
7781 (let ((beg (point)))
7782 ;; We check that there are unread articles.
7783 (when (or all (gnus-summary-find-prev))
7784 (gnus-summary-catchup all t beg)))))
7785 (gnus-summary-position-point))
7787 (defun gnus-summary-catchup-all (&optional quietly)
7788 "Mark all articles in this newsgroup as read."
7790 (gnus-set-global-variables)
7791 (gnus-summary-catchup t quietly))
7793 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7794 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7795 If prefix argument ALL is non-nil, all articles are marked as read."
7797 (gnus-set-global-variables)
7798 (when (gnus-summary-catchup all quietly nil 'fast)
7799 ;; Select next newsgroup or exit.
7800 (if (eq gnus-auto-select-next 'quietly)
7801 (gnus-summary-next-group nil)
7802 (gnus-summary-exit))))
7804 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7805 "Mark all articles in this newsgroup as read, and then exit."
7807 (gnus-set-global-variables)
7808 (gnus-summary-catchup-and-exit t quietly))
7810 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7811 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7812 "Mark all articles in this group as read and select the next group.
7813 If given a prefix, mark all articles, unread as well as ticked, as
7816 (gnus-set-global-variables)
7818 (gnus-summary-catchup all))
7819 (gnus-summary-next-article t nil nil t))
7821 ;; Thread-based commands.
7823 (defun gnus-summary-articles-in-thread (&optional article)
7824 "Return a list of all articles in the current thread.
7825 If ARTICLE is non-nil, return all articles in the thread that starts
7827 (let* ((article (or article (gnus-summary-article-number)))
7828 (data (gnus-data-find-list article))
7829 (top-level (gnus-data-level (car data)))
7831 (cond ((null gnus-thread-operation-ignore-subject)
7832 (gnus-simplify-subject-re
7833 (mail-header-subject (gnus-data-header (car data)))))
7834 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7835 (gnus-simplify-subject-fuzzy
7836 (mail-header-subject (gnus-data-header (car data)))))
7838 (end-point (save-excursion
7839 (if (gnus-summary-go-to-next-thread)
7840 (point) (point-max))))
7843 (< (gnus-data-pos (car data)) end-point))
7844 (when (or (not top-subject)
7845 (string= top-subject
7846 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7847 (gnus-simplify-subject-fuzzy
7848 (mail-header-subject
7849 (gnus-data-header (car data))))
7850 (gnus-simplify-subject-re
7851 (mail-header-subject
7852 (gnus-data-header (car data)))))))
7853 (push (gnus-data-number (car data)) articles))
7854 (unless (and (setq data (cdr data))
7855 (> (gnus-data-level (car data)) top-level))
7857 ;; Return the list of articles.
7858 (nreverse articles)))
7860 (defun gnus-summary-rethread-current ()
7861 "Rethread the thread the current article is part of."
7863 (gnus-set-global-variables)
7864 (let* ((gnus-show-threads t)
7865 (article (gnus-summary-article-number))
7866 (id (mail-header-id (gnus-summary-article-header)))
7867 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7869 (error "No article on the current line"))
7870 (gnus-rebuild-thread id)
7871 (gnus-summary-goto-subject article)))
7873 (defun gnus-summary-reparent-thread ()
7874 "Make current article child of the marked (or previous) article.
7876 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7877 is non-nil or the Subject: of both articles are the same."
7879 (unless (not (gnus-group-read-only-p))
7880 (error "The current newsgroup does not support article editing."))
7881 (unless (<= (length gnus-newsgroup-processable) 1)
7882 (error "No more than one article may be marked."))
7883 (save-window-excursion
7884 (let ((gnus-article-buffer " *reparent*")
7885 (current-article (gnus-summary-article-number))
7886 ; first grab the marked article, otherwise one line up.
7887 (parent-article (if (not (null gnus-newsgroup-processable))
7888 (car gnus-newsgroup-processable)
7890 (if (eq (forward-line -1) 0)
7891 (gnus-summary-article-number)
7892 (error "Beginning of summary buffer."))))))
7893 (unless (not (eq current-article parent-article))
7894 (error "An article may not be self-referential."))
7895 (let ((message-id (mail-header-id
7896 (gnus-summary-article-header parent-article))))
7897 (unless (and message-id (not (equal message-id "")))
7898 (error "No message-id in desired parent."))
7899 (gnus-summary-select-article t t nil current-article)
7900 (set-buffer gnus-article-buffer)
7901 (setq buffer-read-only nil)
7902 (let ((buf (format "%s" (buffer-string))))
7905 (goto-char (point-min))
7906 (if (search-forward-regexp "^References: " nil t)
7907 (insert message-id " " )
7908 (insert "References: " message-id "\n"))
7909 (unless (gnus-request-replace-article current-article
7910 (car gnus-article-current)
7911 gnus-article-buffer)
7912 (error "Couldn't replace article."))
7913 (set-buffer gnus-summary-buffer)
7914 (gnus-summary-unmark-all-processable)
7915 (gnus-summary-rethread-current)
7916 (gnus-message 3 "Article %d is now the child of article %d."
7917 current-article parent-article)))))
7919 (defun gnus-summary-toggle-threads (&optional arg)
7920 "Toggle showing conversation threads.
7921 If ARG is positive number, turn showing conversation threads on."
7923 (gnus-set-global-variables)
7924 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7925 (setq gnus-show-threads
7926 (if (null arg) (not gnus-show-threads)
7927 (> (prefix-numeric-value arg) 0)))
7928 (gnus-summary-prepare)
7929 (gnus-summary-goto-subject current)
7930 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7931 (gnus-summary-position-point)))
7933 (defun gnus-summary-show-all-threads ()
7936 (gnus-set-global-variables)
7938 (let ((buffer-read-only nil))
7939 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7940 (gnus-summary-position-point))
7942 (defun gnus-summary-show-thread ()
7943 "Show thread subtrees.
7944 Returns nil if no thread was there to be shown."
7946 (gnus-set-global-variables)
7947 (let ((buffer-read-only nil)
7949 ;; first goto end then to beg, to have point at beg after let
7950 (end (progn (end-of-line) (point)))
7951 (beg (progn (beginning-of-line) (point))))
7953 ;; Any hidden lines here?
7954 (search-forward "\r" end t)
7955 (subst-char-in-region beg end ?\^M ?\n t)
7957 (gnus-summary-position-point))))
7959 (defun gnus-summary-hide-all-threads ()
7960 "Hide all thread subtrees."
7962 (gnus-set-global-variables)
7964 (goto-char (point-min))
7965 (gnus-summary-hide-thread)
7966 (while (zerop (gnus-summary-next-thread 1 t))
7967 (gnus-summary-hide-thread)))
7968 (gnus-summary-position-point))
7970 (defun gnus-summary-hide-thread ()
7971 "Hide thread subtrees.
7972 Returns nil if no threads were there to be hidden."
7974 (gnus-set-global-variables)
7975 (let ((buffer-read-only nil)
7977 (article (gnus-summary-article-number)))
7979 ;; Go forward until either the buffer ends or the subthread
7981 (when (and (not (eobp))
7982 (or (zerop (gnus-summary-next-thread 1 t))
7983 (goto-char (point-max))))
7985 (if (and (> (point) start)
7986 (search-backward "\n" start t))
7988 (subst-char-in-region start (point) ?\n ?\^M)
7989 (gnus-summary-goto-subject article))
7992 ;;(gnus-summary-position-point)
7995 (defun gnus-summary-go-to-next-thread (&optional previous)
7996 "Go to the same level (or less) next thread.
7997 If PREVIOUS is non-nil, go to previous thread instead.
7998 Return the article number moved to, or nil if moving was impossible."
7999 (let ((level (gnus-summary-thread-level))
8000 (way (if previous -1 1))
8003 (while (and (not (eobp))
8004 (< level (gnus-summary-thread-level)))
8012 (gnus-summary-article-number)
8015 (defun gnus-summary-next-thread (n &optional silent)
8016 "Go to the same level next N'th thread.
8017 If N is negative, search backward instead.
8018 Returns the difference between N and the number of skips actually
8021 If SILENT, don't output messages."
8023 (gnus-set-global-variables)
8024 (let ((backward (< n 0))
8027 (gnus-summary-go-to-next-thread backward))
8030 (gnus-summary-position-point))
8031 (when (and (not silent) (/= 0 n))
8032 (gnus-message 7 "No more threads"))
8035 (defun gnus-summary-prev-thread (n)
8036 "Go to the same level previous N'th thread.
8037 Returns the difference between N and the number of skips actually
8040 (gnus-set-global-variables)
8041 (gnus-summary-next-thread (- n)))
8043 (defun gnus-summary-go-down-thread ()
8044 "Go down one level in the current thread."
8045 (let ((children (gnus-summary-article-children)))
8047 (gnus-summary-goto-subject (car children)))))
8049 (defun gnus-summary-go-up-thread ()
8050 "Go up one level in the current thread."
8051 (let ((parent (gnus-summary-article-parent)))
8053 (gnus-summary-goto-subject parent))))
8055 (defun gnus-summary-down-thread (n)
8056 "Go down thread N steps.
8057 If N is negative, go up instead.
8058 Returns the difference between N and how many steps down that were
8061 (gnus-set-global-variables)
8065 (if up (gnus-summary-go-up-thread)
8066 (gnus-summary-go-down-thread)))
8068 (gnus-summary-position-point)
8070 (gnus-message 7 "Can't go further"))
8073 (defun gnus-summary-up-thread (n)
8074 "Go up thread N steps.
8075 If N is negative, go up instead.
8076 Returns the difference between N and how many steps down that were
8079 (gnus-set-global-variables)
8080 (gnus-summary-down-thread (- n)))
8082 (defun gnus-summary-top-thread ()
8083 "Go to the top of the thread."
8085 (gnus-set-global-variables)
8086 (while (gnus-summary-go-up-thread))
8087 (gnus-summary-article-number))
8089 (defun gnus-summary-kill-thread (&optional unmark)
8090 "Mark articles under current thread as read.
8091 If the prefix argument is positive, remove any kinds of marks.
8092 If the prefix argument is negative, tick articles instead."
8094 (gnus-set-global-variables)
8096 (setq unmark (prefix-numeric-value unmark)))
8097 (let ((articles (gnus-summary-articles-in-thread)))
8099 ;; Expand the thread.
8100 (gnus-summary-show-thread)
8101 ;; Mark all the articles.
8103 (gnus-summary-goto-subject (car articles))
8104 (cond ((null unmark)
8105 (gnus-summary-mark-article-as-read gnus-killed-mark))
8107 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8109 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8110 (setq articles (cdr articles))))
8111 ;; Hide killed subtrees.
8113 gnus-thread-hide-killed
8114 (gnus-summary-hide-thread))
8115 ;; If marked as read, go to next unread subject.
8117 ;; Go to next unread subject.
8118 (gnus-summary-next-subject 1 t)))
8119 (gnus-set-mode-line 'summary))
8121 ;; Summary sorting commands
8123 (defun gnus-summary-sort-by-number (&optional reverse)
8124 "Sort the summary buffer by article number.
8125 Argument REVERSE means reverse order."
8127 (gnus-summary-sort 'number reverse))
8129 (defun gnus-summary-sort-by-author (&optional reverse)
8130 "Sort the summary buffer by author name alphabetically.
8131 If case-fold-search is non-nil, case of letters is ignored.
8132 Argument REVERSE means reverse order."
8134 (gnus-summary-sort 'author reverse))
8136 (defun gnus-summary-sort-by-subject (&optional reverse)
8137 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8138 If case-fold-search is non-nil, case of letters is ignored.
8139 Argument REVERSE means reverse order."
8141 (gnus-summary-sort 'subject reverse))
8143 (defun gnus-summary-sort-by-date (&optional reverse)
8144 "Sort the summary buffer by date.
8145 Argument REVERSE means reverse order."
8147 (gnus-summary-sort 'date reverse))
8149 (defun gnus-summary-sort-by-score (&optional reverse)
8150 "Sort the summary buffer by score.
8151 Argument REVERSE means reverse order."
8153 (gnus-summary-sort 'score reverse))
8155 (defun gnus-summary-sort-by-lines (&optional reverse)
8156 "Sort the summary buffer by article length.
8157 Argument REVERSE means reverse order."
8159 (gnus-summary-sort 'lines reverse))
8161 (defun gnus-summary-sort (predicate reverse)
8162 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8163 (gnus-set-global-variables)
8164 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8165 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8166 (gnus-thread-sort-functions
8172 (gnus-article-sort-functions
8177 (,article t2 t1)))))
8179 (gnus-summary-prepare-hook nil))
8180 ;; We do the sorting by regenerating the threads.
8181 (gnus-summary-prepare)
8182 ;; Hide subthreads if needed.
8183 (when (and gnus-show-threads gnus-thread-hide-subtree)
8184 (gnus-summary-hide-all-threads))))
8186 ;; Summary saving commands.
8188 (defun gnus-summary-save-article (&optional n not-saved)
8189 "Save the current article using the default saver function.
8190 If N is a positive number, save the N next articles.
8191 If N is a negative number, save the N previous articles.
8192 If N is nil and any articles have been marked with the process mark,
8193 save those articles instead.
8194 The variable `gnus-default-article-saver' specifies the saver function."
8196 (gnus-set-global-variables)
8197 (let* ((articles (gnus-summary-work-articles n))
8198 (save-buffer (save-excursion
8199 (nnheader-set-temp-buffer " *Gnus Save*")))
8200 (num (length articles))
8201 header article file)
8203 (setq header (gnus-summary-article-header
8204 (setq article (pop articles))))
8205 (if (not (vectorp header))
8206 ;; This is a pseudo-article.
8207 (if (assq 'name header)
8208 (gnus-copy-file (cdr (assq 'name header)))
8209 (gnus-message 1 "Article %d is unsaveable" article))
8210 ;; This is a real article.
8211 (save-window-excursion
8212 (gnus-summary-select-article t nil nil article))
8214 (set-buffer save-buffer)
8216 (insert-buffer-substring gnus-original-article-buffer))
8217 (setq file (gnus-article-save save-buffer file num))
8218 (gnus-summary-remove-process-mark article)
8220 (gnus-summary-set-saved-mark article))))
8221 (gnus-kill-buffer save-buffer)
8222 (gnus-summary-position-point)
8225 (defun gnus-summary-pipe-output (&optional arg)
8226 "Pipe the current article to a subprocess.
8227 If N is a positive number, pipe the N next articles.
8228 If N is a negative number, pipe the N previous articles.
8229 If N is nil and any articles have been marked with the process mark,
8230 pipe those articles instead."
8232 (gnus-set-global-variables)
8233 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8234 (gnus-summary-save-article arg t))
8235 (gnus-configure-windows 'pipe))
8237 (defun gnus-summary-save-article-mail (&optional arg)
8238 "Append the current article to an mail file.
8239 If N is a positive number, save the N next articles.
8240 If N is a negative number, save the N previous articles.
8241 If N is nil and any articles have been marked with the process mark,
8242 save those articles instead."
8244 (gnus-set-global-variables)
8245 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8246 (gnus-summary-save-article arg)))
8248 (defun gnus-summary-save-article-rmail (&optional arg)
8249 "Append the current article to an rmail file.
8250 If N is a positive number, save the N next articles.
8251 If N is a negative number, save the N previous articles.
8252 If N is nil and any articles have been marked with the process mark,
8253 save those articles instead."
8255 (gnus-set-global-variables)
8256 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8257 (gnus-summary-save-article arg)))
8259 (defun gnus-summary-save-article-file (&optional arg)
8260 "Append the current article to a file.
8261 If N is a positive number, save the N next articles.
8262 If N is a negative number, save the N previous articles.
8263 If N is nil and any articles have been marked with the process mark,
8264 save those articles instead."
8266 (gnus-set-global-variables)
8267 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8268 (gnus-summary-save-article arg)))
8270 (defun gnus-summary-write-article-file (&optional arg)
8271 "Write the current article to a file, deleting the previous file.
8272 If N is a positive number, save the N next articles.
8273 If N is a negative number, save the N previous articles.
8274 If N is nil and any articles have been marked with the process mark,
8275 save those articles instead."
8277 (gnus-set-global-variables)
8278 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8279 (gnus-summary-save-article arg)))
8281 (defun gnus-summary-save-article-body-file (&optional arg)
8282 "Append the current article body to a file.
8283 If N is a positive number, save the N next articles.
8284 If N is a negative number, save the N previous articles.
8285 If N is nil and any articles have been marked with the process mark,
8286 save those articles instead."
8288 (gnus-set-global-variables)
8289 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8290 (gnus-summary-save-article arg)))
8292 (defun gnus-get-split-value (methods)
8293 "Return a value based on the split METHODS."
8294 (let (split-name method result match)
8297 (set-buffer gnus-original-article-buffer)
8299 (nnheader-narrow-to-headers)
8301 (goto-char (point-min))
8302 (setq method (pop methods))
8303 (setq match (car method))
8306 ;; Regular expression.
8308 (re-search-forward match nil t)))
8309 ((gnus-functionp match)
8313 (setq result (funcall match gnus-newsgroup-name))))
8318 (setq result (eval match)))))
8319 (setq split-name (append (cdr method) split-name))
8320 (cond ((stringp result)
8321 (push (expand-file-name
8322 result gnus-article-save-directory)
8325 (setq split-name (append result split-name)))))))))
8328 (defun gnus-valid-move-group-p (group)
8333 (car (gnus-find-method-for-group
8334 (symbol-name group))))
8335 gnus-valid-select-methods))))
8337 (defun gnus-read-move-group-name (prompt default articles prefix)
8338 "Read a group name."
8339 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8340 (minibuffer-confirm-incomplete nil) ; XEmacs
8344 (if (> (length articles) 1)
8345 (format "these %d articles" (length articles))
8350 (gnus-completing-read default prom
8352 'gnus-valid-move-group-p
8354 'gnus-group-history))
8355 ((= 1 (length split-name))
8356 (gnus-completing-read (car split-name) prom
8358 'gnus-valid-move-group-p
8360 'gnus-group-history))
8362 (gnus-completing-read nil prom
8363 (mapcar (lambda (el) (list el))
8364 (nreverse split-name))
8366 'gnus-group-history)))))
8368 (if (or (string= to-newsgroup "")
8369 (string= to-newsgroup prefix))
8370 (setq to-newsgroup (or default "")))
8371 (or (gnus-active to-newsgroup)
8372 (gnus-activate-group to-newsgroup)
8373 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8375 (or (and (gnus-request-create-group
8376 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8377 (gnus-activate-group to-newsgroup nil nil
8378 (gnus-group-name-to-method
8380 (error "Couldn't create group %s" to-newsgroup)))
8381 (error "No such group: %s" to-newsgroup)))
8384 ;; Summary extract commands
8386 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8387 (let ((buffer-read-only nil)
8388 (article (gnus-summary-article-number))
8390 (unless (gnus-summary-goto-subject article)
8391 (error "No such article: %d" article))
8392 (gnus-summary-position-point)
8393 ;; If all commands are to be bunched up on one line, we collect
8395 (unless gnus-view-pseudos-separately
8396 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8399 (setq action (cdr (assq 'action (car ps))))
8400 (setq files (list (cdr (assq 'name (car ps)))))
8401 (while (and ps (cdr ps)
8402 (string= (or action "1")
8403 (or (cdr (assq 'action (cadr ps))) "2")))
8404 (push (cdr (assq 'name (cadr ps))) files)
8405 (setcdr ps (cddr ps)))
8407 (when (not (string-match "%s" action))
8410 (when (assq 'execute (car ps))
8411 (setcdr (assq 'execute (car ps))
8412 (funcall (if (string-match "%s" action)
8415 (mapconcat (lambda (f) f) files " ")))))
8416 (setq ps (cdr ps)))))
8417 (if (and gnus-view-pseudos (not not-view))
8419 (when (assq 'execute (car pslist))
8420 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8421 (eq gnus-view-pseudos 'not-confirm)))
8422 (setq pslist (cdr pslist)))
8425 (setq after-article (or (cdr (assq 'article (car pslist)))
8426 (gnus-summary-article-number)))
8427 (gnus-summary-goto-subject after-article)
8430 (insert " " (file-name-nondirectory
8431 (cdr (assq 'name (car pslist))))
8432 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8434 (forward-line -1) ; back to `b'
8435 (gnus-add-text-properties
8436 b (1- e) (list 'gnus-number gnus-reffed-article-number
8437 gnus-mouse-face-prop gnus-mouse-face))
8439 after-article gnus-reffed-article-number
8440 gnus-unread-mark b (car pslist) 0 (- e b))
8441 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8442 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8443 (setq pslist (cdr pslist)))))))
8445 (defun gnus-pseudos< (p1 p2)
8446 (let ((c1 (cdr (assq 'action p1)))
8447 (c2 (cdr (assq 'action p2))))
8448 (and c1 c2 (string< c1 c2))))
8450 (defun gnus-request-pseudo-article (props)
8451 (cond ((assq 'execute props)
8452 (gnus-execute-command (cdr (assq 'execute props)))))
8453 (let ((gnus-current-article (gnus-summary-article-number)))
8454 (run-hooks 'gnus-mark-article-hook)))
8456 (defun gnus-execute-command (command &optional automatic)
8458 (gnus-article-setup-buffer)
8459 (set-buffer gnus-article-buffer)
8460 (setq buffer-read-only nil)
8461 (let ((command (if automatic command (read-string "Command: " command)))
8462 ;; Just binding this here doesn't help, because there might
8463 ;; be output from the process after exiting the scope of
8465 ;; (buffer-read-only nil)
8468 (insert "$ " command "\n\n")
8469 (if gnus-view-pseudo-asynchronously
8470 (start-process "gnus-execute" nil shell-file-name
8471 shell-command-switch command)
8472 (call-process shell-file-name nil t nil
8473 shell-command-switch command)))))
8475 ;; Summary kill commands.
8477 (defun gnus-summary-edit-global-kill (article)
8478 "Edit the \"global\" kill file."
8479 (interactive (list (gnus-summary-article-number)))
8480 (gnus-set-global-variables)
8481 (gnus-group-edit-global-kill article))
8483 (defun gnus-summary-edit-local-kill ()
8484 "Edit a local kill file applied to the current newsgroup."
8486 (gnus-set-global-variables)
8487 (setq gnus-current-headers (gnus-summary-article-header))
8488 (gnus-set-global-variables)
8489 (gnus-group-edit-local-kill
8490 (gnus-summary-article-number) gnus-newsgroup-name))
8494 (defun gnus-read-header (id &optional header)
8495 "Read the headers of article ID and enter them into the Gnus system."
8496 (let ((group gnus-newsgroup-name)
8497 (gnus-override-method
8498 (and (gnus-news-group-p gnus-newsgroup-name)
8499 gnus-refer-article-method))
8501 ;; First we check to see whether the header in question is already
8504 ;; This is a Message-ID.
8505 (setq header (or header (gnus-id-to-header id)))
8506 ;; This is an article number.
8507 (setq header (or header (gnus-summary-article-header id))))
8509 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8510 ;; We have found the header.
8512 ;; We have to really fetch the header to this article.
8514 (set-buffer nntp-server-buffer)
8515 (when (setq where (gnus-request-head id group))
8516 (nnheader-fold-continuation-lines)
8517 (goto-char (point-max))
8519 (goto-char (point-min))
8523 ((cdr where) (cdr where))
8524 (header (mail-header-number header))
8525 (t gnus-reffed-article-number))
8527 (insert " Article retrieved.\n"))
8528 (if (not (setq header (car (gnus-get-newsgroup-headers nil t))))
8529 () ; Malformed head.
8530 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8531 (when (and (stringp id)
8532 (not (string= (gnus-group-real-name group)
8534 ;; If we fetched by Message-ID and the article came
8535 ;; from a different group, we fudge some bogus article
8536 ;; numbers for this article.
8537 (mail-header-set-number header gnus-reffed-article-number))
8539 (set-buffer gnus-summary-buffer)
8540 (decf gnus-reffed-article-number)
8541 (gnus-remove-header (mail-header-number header))
8542 (push header gnus-newsgroup-headers)
8543 (setq gnus-current-headers header)
8544 (push (mail-header-number header) gnus-newsgroup-limit)))
8547 (defun gnus-remove-header (number)
8548 "Remove header NUMBER from `gnus-newsgroup-headers'."
8549 (if (and gnus-newsgroup-headers
8550 (= number (mail-header-number (car gnus-newsgroup-headers))))
8551 (pop gnus-newsgroup-headers)
8552 (let ((headers gnus-newsgroup-headers))
8553 (while (and (cdr headers)
8554 (not (= number (mail-header-number (cadr headers)))))
8557 (setcdr headers (cddr headers))))))
8560 ;;; summary highlights
8563 (defun gnus-highlight-selected-summary ()
8564 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8565 ;; Highlight selected article in summary buffer
8566 (when gnus-summary-selected-face
8568 (let* ((beg (progn (beginning-of-line) (point)))
8569 (end (progn (end-of-line) (point)))
8570 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8571 (from (if (get-text-property beg gnus-mouse-face-prop)
8573 (or (next-single-property-change
8574 beg gnus-mouse-face-prop nil end)
8579 (or (next-single-property-change
8580 from gnus-mouse-face-prop nil end)
8582 ;; If no mouse-face prop on line we will have to = from = end,
8583 ;; so we highlight the entire line instead.
8584 (when (= (+ to 2) from)
8587 (if gnus-newsgroup-selected-overlay
8588 ;; Move old overlay.
8590 gnus-newsgroup-selected-overlay from to (current-buffer))
8591 ;; Create new overlay.
8593 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8594 'face gnus-summary-selected-face))))))
8596 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8597 (defun gnus-summary-highlight-line ()
8598 "Highlight current line according to `gnus-summary-highlight'."
8599 (let* ((list gnus-summary-highlight)
8601 (end (progn (end-of-line) (point)))
8602 ;; now find out where the line starts and leave point there.
8603 (beg (progn (beginning-of-line) (point)))
8604 (article (gnus-summary-article-number))
8605 (score (or (cdr (assq (or article gnus-current-article)
8606 gnus-newsgroup-scored))
8607 gnus-summary-default-score 0))
8608 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8609 (inhibit-read-only t))
8610 ;; Eval the cars of the lists until we find a match.
8611 (let ((default gnus-summary-default-score))
8613 (not (eval (caar list))))
8614 (setq list (cdr list))))
8615 (let ((face (cdar list)))
8616 (unless (eq face (get-text-property beg 'face))
8617 (gnus-put-text-property
8619 (setq face (if (boundp face) (symbol-value face) face)))
8620 (when gnus-summary-highlight-line-function
8621 (funcall gnus-summary-highlight-line-function article face))))
8624 (defun gnus-update-read-articles (group unread)
8625 "Update the list of read articles in GROUP."
8626 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8627 (entry (gnus-gethash group gnus-newsrc-hashtb))
8628 (info (nth 2 entry))
8630 (unread (sort (copy-sequence unread) '<))
8632 (if (or (not info) (not active))
8633 ;; There is no info on this group if it was, in fact,
8634 ;; killed. Gnus stores no information on killed groups, so
8635 ;; there's nothing to be done.
8636 ;; One could store the information somewhere temporarily,
8637 ;; perhaps... Hmmm...
8639 ;; Remove any negative articles numbers.
8640 (while (and unread (< (car unread) 0))
8641 (setq unread (cdr unread)))
8642 ;; Remove any expired article numbers
8643 (while (and unread (< (car unread) (car active)))
8644 (setq unread (cdr unread)))
8645 ;; Compute the ranges of read articles by looking at the list of
8648 (when (/= (car unread) prev)
8649 (push (if (= prev (1- (car unread))) prev
8650 (cons prev (1- (car unread))))
8652 (setq prev (1+ (car unread)))
8653 (setq unread (cdr unread)))
8654 (when (<= prev (cdr active))
8655 (push (cons prev (cdr active)) read))
8657 (set-buffer gnus-group-buffer)
8660 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8661 (gnus-info-set-read ',info ',(gnus-info-read info))
8662 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8663 (gnus-group-update-group ,group t))))
8664 ;; Enter this list into the group info.
8666 info (if (> (length read) 1) (nreverse read) read))
8667 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8668 (gnus-get-unread-articles-in-group info (gnus-active group))
8673 (run-hooks 'gnus-sum-load-hook)
8675 ;;; gnus-sum.el ends here