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 ""
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))
1192 (looking-at gnus-simplify-subject-fuzzy-regexp)
1193 (looking-at "^ *\\(re\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1194 (looking-at "^[[].*: .*[]]$"))
1195 (goto-char (point-min))
1196 (while (re-search-forward gnus-simplify-subject-fuzzy-regexp
1198 (replace-match "" t t))
1199 (goto-char (point-min))
1200 (while (re-search-forward "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *"
1202 (replace-match "" t t))
1203 (goto-char (point-min))
1204 (while (re-search-forward "^[[].*: .*[]]$" nil t)
1205 (goto-char (match-end 0))
1208 (progn (goto-char (match-beginning 0)))
1209 (re-search-forward ":"))))
1210 (goto-char (point-min))
1211 (while (re-search-forward " *[[{(][^()\n]*[]})] *$" nil t)
1212 (replace-match "" t t))
1213 (goto-char (point-min))
1214 (while (re-search-forward " +" 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))))
1223 (defun gnus-simplify-subject-fuzzy (subject)
1224 "Simplify a subject string fuzzily."
1226 (gnus-set-work-buffer)
1227 (let ((case-fold-search t))
1229 (inline (gnus-simplify-buffer-fuzzy))
1232 (defsubst gnus-simplify-subject-fully (subject)
1233 "Simplify a subject string according to the user's wishes."
1235 ((null gnus-summary-gather-subject-limit)
1236 (gnus-simplify-subject-re subject))
1237 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1238 (gnus-simplify-subject-fuzzy subject))
1239 ((numberp gnus-summary-gather-subject-limit)
1240 (gnus-limit-string (gnus-simplify-subject-re subject)
1241 gnus-summary-gather-subject-limit))
1245 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1246 "Check whether two subjects are equal. If optional argument
1247 simple-first is t, first argument is already simplified."
1249 ((null simple-first)
1250 (equal (gnus-simplify-subject-fully s1)
1251 (gnus-simplify-subject-fully s2)))
1254 (gnus-simplify-subject-fully s2)))))
1256 (defun gnus-offer-save-summaries ()
1257 "Offer to save all active summary buffers."
1259 (let ((buflist (buffer-list))
1261 ;; Go through all buffers and find all summaries.
1263 (and (setq bufname (buffer-name (car buflist)))
1264 (string-match "Summary" bufname)
1266 (set-buffer bufname)
1267 ;; We check that this is, indeed, a summary buffer.
1268 (and (eq major-mode 'gnus-summary-mode)
1269 ;; Also make sure this isn't bogus.
1270 gnus-newsgroup-prepared))
1271 (push bufname buffers))
1272 (setq buflist (cdr buflist)))
1273 ;; Go through all these summary buffers and offer to save them.
1276 "Update summary buffer %s? "
1277 (lambda (buf) (set-buffer buf) (gnus-summary-exit))
1280 (defun gnus-summary-bubble-group ()
1281 "Increase the score of the current group.
1282 This is a handy function to add to `gnus-summary-exit-hook' to
1283 increase the score of each group you read."
1284 (gnus-group-add-score gnus-newsgroup-name))
1288 ;;; Gnus summary mode
1291 (put 'gnus-summary-mode 'mode-class 'special)
1294 ;; Non-orthogonal keys
1296 (gnus-define-keys gnus-summary-mode-map
1297 " " gnus-summary-next-page
1298 "\177" gnus-summary-prev-page
1299 [delete] gnus-summary-prev-page
1300 "\r" gnus-summary-scroll-up
1301 "n" gnus-summary-next-unread-article
1302 "p" gnus-summary-prev-unread-article
1303 "N" gnus-summary-next-article
1304 "P" gnus-summary-prev-article
1305 "\M-\C-n" gnus-summary-next-same-subject
1306 "\M-\C-p" gnus-summary-prev-same-subject
1307 "\M-n" gnus-summary-next-unread-subject
1308 "\M-p" gnus-summary-prev-unread-subject
1309 "." gnus-summary-first-unread-article
1310 "," gnus-summary-best-unread-article
1311 "\M-s" gnus-summary-search-article-forward
1312 "\M-r" gnus-summary-search-article-backward
1313 "<" gnus-summary-beginning-of-article
1314 ">" gnus-summary-end-of-article
1315 "j" gnus-summary-goto-article
1316 "^" gnus-summary-refer-parent-article
1317 "\M-^" gnus-summary-refer-article
1318 "u" gnus-summary-tick-article-forward
1319 "!" gnus-summary-tick-article-forward
1320 "U" gnus-summary-tick-article-backward
1321 "d" gnus-summary-mark-as-read-forward
1322 "D" gnus-summary-mark-as-read-backward
1323 "E" gnus-summary-mark-as-expirable
1324 "\M-u" gnus-summary-clear-mark-forward
1325 "\M-U" gnus-summary-clear-mark-backward
1326 "k" gnus-summary-kill-same-subject-and-select
1327 "\C-k" gnus-summary-kill-same-subject
1328 "\M-\C-k" gnus-summary-kill-thread
1329 "\M-\C-l" gnus-summary-lower-thread
1330 "e" gnus-summary-edit-article
1331 "#" gnus-summary-mark-as-processable
1332 "\M-#" gnus-summary-unmark-as-processable
1333 "\M-\C-t" gnus-summary-toggle-threads
1334 "\M-\C-s" gnus-summary-show-thread
1335 "\M-\C-h" gnus-summary-hide-thread
1336 "\M-\C-f" gnus-summary-next-thread
1337 "\M-\C-b" gnus-summary-prev-thread
1338 "\M-\C-u" gnus-summary-up-thread
1339 "\M-\C-d" gnus-summary-down-thread
1340 "&" gnus-summary-execute-command
1341 "c" gnus-summary-catchup-and-exit
1342 "\C-w" gnus-summary-mark-region-as-read
1343 "\C-t" gnus-summary-toggle-truncation
1344 "?" gnus-summary-mark-as-dormant
1345 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1346 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1347 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1348 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1349 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1350 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1351 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1352 "=" gnus-summary-expand-window
1353 "\C-x\C-s" gnus-summary-reselect-current-group
1354 "\M-g" gnus-summary-rescan-group
1355 "w" gnus-summary-stop-page-breaking
1356 "\C-c\C-r" gnus-summary-caesar-message
1357 "\M-t" gnus-summary-toggle-mime
1358 "f" gnus-summary-followup
1359 "F" gnus-summary-followup-with-original
1360 "C" gnus-summary-cancel-article
1361 "r" gnus-summary-reply
1362 "R" gnus-summary-reply-with-original
1363 "\C-c\C-f" gnus-summary-mail-forward
1364 "o" gnus-summary-save-article
1365 "\C-o" gnus-summary-save-article-mail
1366 "|" gnus-summary-pipe-output
1367 "\M-k" gnus-summary-edit-local-kill
1368 "\M-K" gnus-summary-edit-global-kill
1370 "\C-c\C-d" gnus-summary-describe-group
1371 "q" gnus-summary-exit
1372 "Q" gnus-summary-exit-no-update
1373 "\C-c\C-i" gnus-info-find-node
1374 gnus-mouse-2 gnus-mouse-pick-article
1375 "m" gnus-summary-mail-other-window
1376 "a" gnus-summary-post-news
1377 "x" gnus-summary-limit-to-unread
1378 "s" gnus-summary-isearch-article
1379 "t" gnus-article-hide-headers
1380 "g" gnus-summary-show-article
1381 "l" gnus-summary-goto-last-article
1382 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1383 "\C-d" gnus-summary-enter-digest-group
1384 "\M-\C-d" gnus-summary-read-document
1386 "*" gnus-cache-enter-article
1387 "\M-*" gnus-cache-remove-article
1388 "\M-&" gnus-summary-universal-argument
1389 "\C-l" gnus-recenter
1390 "I" gnus-summary-increase-score
1391 "L" gnus-summary-lower-score
1393 "V" gnus-summary-score-map
1394 "X" gnus-uu-extract-map
1395 "S" gnus-summary-send-map)
1397 ;; Sort of orthogonal keymap
1398 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1399 "t" gnus-summary-tick-article-forward
1400 "!" gnus-summary-tick-article-forward
1401 "d" gnus-summary-mark-as-read-forward
1402 "r" gnus-summary-mark-as-read-forward
1403 "c" gnus-summary-clear-mark-forward
1404 " " gnus-summary-clear-mark-forward
1405 "e" gnus-summary-mark-as-expirable
1406 "x" gnus-summary-mark-as-expirable
1407 "?" gnus-summary-mark-as-dormant
1408 "b" gnus-summary-set-bookmark
1409 "B" gnus-summary-remove-bookmark
1410 "#" gnus-summary-mark-as-processable
1411 "\M-#" gnus-summary-unmark-as-processable
1412 "S" gnus-summary-limit-include-expunged
1413 "C" gnus-summary-catchup
1414 "H" gnus-summary-catchup-to-here
1415 "\C-c" gnus-summary-catchup-all
1416 "k" gnus-summary-kill-same-subject-and-select
1417 "K" gnus-summary-kill-same-subject
1418 "P" gnus-uu-mark-map)
1420 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1421 "c" gnus-summary-clear-above
1422 "u" gnus-summary-tick-above
1423 "m" gnus-summary-mark-above
1424 "k" gnus-summary-kill-below)
1426 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1427 "/" gnus-summary-limit-to-subject
1428 "n" gnus-summary-limit-to-articles
1429 "w" gnus-summary-pop-limit
1430 "s" gnus-summary-limit-to-subject
1431 "a" gnus-summary-limit-to-author
1432 "u" gnus-summary-limit-to-unread
1433 "m" gnus-summary-limit-to-marks
1434 "v" gnus-summary-limit-to-score
1435 "D" gnus-summary-limit-include-dormant
1436 "d" gnus-summary-limit-exclude-dormant
1437 "t" gnus-summary-limit-to-age
1438 "E" gnus-summary-limit-include-expunged
1439 "c" gnus-summary-limit-exclude-childless-dormant
1440 "C" gnus-summary-limit-mark-excluded-as-read)
1442 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1443 "n" gnus-summary-next-unread-article
1444 "p" gnus-summary-prev-unread-article
1445 "N" gnus-summary-next-article
1446 "P" gnus-summary-prev-article
1447 "\C-n" gnus-summary-next-same-subject
1448 "\C-p" gnus-summary-prev-same-subject
1449 "\M-n" gnus-summary-next-unread-subject
1450 "\M-p" gnus-summary-prev-unread-subject
1451 "f" gnus-summary-first-unread-article
1452 "b" gnus-summary-best-unread-article
1453 "j" gnus-summary-goto-article
1454 "g" gnus-summary-goto-subject
1455 "l" gnus-summary-goto-last-article
1456 "p" gnus-summary-pop-article)
1458 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1459 "k" gnus-summary-kill-thread
1460 "l" gnus-summary-lower-thread
1461 "i" gnus-summary-raise-thread
1462 "T" gnus-summary-toggle-threads
1463 "t" gnus-summary-rethread-current
1464 "^" gnus-summary-reparent-thread
1465 "s" gnus-summary-show-thread
1466 "S" gnus-summary-show-all-threads
1467 "h" gnus-summary-hide-thread
1468 "H" gnus-summary-hide-all-threads
1469 "n" gnus-summary-next-thread
1470 "p" gnus-summary-prev-thread
1471 "u" gnus-summary-up-thread
1472 "o" gnus-summary-top-thread
1473 "d" gnus-summary-down-thread
1474 "#" gnus-uu-mark-thread
1475 "\M-#" gnus-uu-unmark-thread)
1477 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1478 "g" gnus-summary-prepare
1479 "c" gnus-summary-insert-cached-articles)
1481 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1482 "c" gnus-summary-catchup-and-exit
1483 "C" gnus-summary-catchup-all-and-exit
1484 "E" gnus-summary-exit-no-update
1485 "Q" gnus-summary-exit
1486 "Z" gnus-summary-exit
1487 "n" gnus-summary-catchup-and-goto-next-group
1488 "R" gnus-summary-reselect-current-group
1489 "G" gnus-summary-rescan-group
1490 "N" gnus-summary-next-group
1491 "s" gnus-summary-save-newsrc
1492 "P" gnus-summary-prev-group)
1494 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1495 " " gnus-summary-next-page
1496 "n" gnus-summary-next-page
1497 "\177" gnus-summary-prev-page
1498 [delete] gnus-summary-prev-page
1499 "p" gnus-summary-prev-page
1500 "\r" gnus-summary-scroll-up
1501 "<" gnus-summary-beginning-of-article
1502 ">" gnus-summary-end-of-article
1503 "b" gnus-summary-beginning-of-article
1504 "e" gnus-summary-end-of-article
1505 "^" gnus-summary-refer-parent-article
1506 "r" gnus-summary-refer-parent-article
1507 "R" gnus-summary-refer-references
1508 "g" gnus-summary-show-article
1509 "s" gnus-summary-isearch-article
1510 "P" gnus-summary-print-article)
1512 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1513 "b" gnus-article-add-buttons
1514 "B" gnus-article-add-buttons-to-head
1515 "o" gnus-article-treat-overstrike
1516 "e" gnus-article-emphasize
1517 "w" gnus-article-fill-cited-article
1518 "c" gnus-article-remove-cr
1519 "q" gnus-article-de-quoted-unreadable
1520 "f" gnus-article-display-x-face
1521 "l" gnus-summary-stop-page-breaking
1522 "r" gnus-summary-caesar-message
1523 "t" gnus-article-hide-headers
1524 "v" gnus-summary-verbose-headers
1525 "m" gnus-summary-toggle-mime)
1527 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1528 "a" gnus-article-hide
1529 "h" gnus-article-hide-headers
1530 "b" gnus-article-hide-boring-headers
1531 "s" gnus-article-hide-signature
1532 "c" gnus-article-hide-citation
1533 "p" gnus-article-hide-pgp
1534 "P" gnus-article-hide-pem
1535 "\C-c" gnus-article-hide-citation-maybe)
1537 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1538 "a" gnus-article-highlight
1539 "h" gnus-article-highlight-headers
1540 "c" gnus-article-highlight-citation
1541 "s" gnus-article-highlight-signature)
1543 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1544 "z" gnus-article-date-ut
1545 "u" gnus-article-date-ut
1546 "l" gnus-article-date-local
1547 "e" gnus-article-date-lapsed
1548 "o" gnus-article-date-original)
1550 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1551 "t" gnus-article-remove-trailing-blank-lines
1552 "l" gnus-article-strip-leading-blank-lines
1553 "m" gnus-article-strip-multiple-blank-lines
1554 "a" gnus-article-strip-blank-lines)
1556 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1558 "f" gnus-summary-fetch-faq
1559 "d" gnus-summary-describe-group
1560 "h" gnus-summary-describe-briefly
1561 "i" gnus-info-find-node)
1563 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1564 "e" gnus-summary-expire-articles
1565 "\M-\C-e" gnus-summary-expire-articles-now
1566 "\177" gnus-summary-delete-article
1567 [delete] gnus-summary-delete-article
1568 "m" gnus-summary-move-article
1569 "r" gnus-summary-respool-article
1570 "w" gnus-summary-edit-article
1571 "c" gnus-summary-copy-article
1572 "B" gnus-summary-crosspost-article
1573 "q" gnus-summary-respool-query
1574 "i" gnus-summary-import-article
1575 "p" gnus-summary-article-posted-p)
1577 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1578 "o" gnus-summary-save-article
1579 "m" gnus-summary-save-article-mail
1580 "F" gnus-summary-write-article-file
1581 "r" gnus-summary-save-article-rmail
1582 "f" gnus-summary-save-article-file
1583 "b" gnus-summary-save-article-body-file
1584 "h" gnus-summary-save-article-folder
1585 "v" gnus-summary-save-article-vm
1586 "p" gnus-summary-pipe-output
1587 "s" gnus-soup-add-article))
1589 (defun gnus-summary-make-menu-bar ()
1590 (gnus-turn-off-edit-menu 'summary)
1592 (unless (boundp 'gnus-summary-misc-menu)
1595 gnus-summary-kill-menu gnus-summary-mode-map ""
1600 ["Enter score..." gnus-summary-score-entry t]
1601 ["Customize" gnus-score-customize t])
1602 (gnus-make-score-map 'increase)
1603 (gnus-make-score-map 'lower)
1605 ["Kill below" gnus-summary-kill-below t]
1606 ["Mark above" gnus-summary-mark-above t]
1607 ["Tick above" gnus-summary-tick-above t]
1608 ["Clear above" gnus-summary-clear-above t])
1609 ["Current score" gnus-summary-current-score t]
1610 ["Set score" gnus-summary-set-score t]
1611 ["Switch current score file..." gnus-score-change-score-file t]
1612 ["Set mark below..." gnus-score-set-mark-below t]
1613 ["Set expunge below..." gnus-score-set-expunge-below t]
1614 ["Edit current score file" gnus-score-edit-current-scores t]
1615 ["Edit score file" gnus-score-edit-file t]
1616 ["Trace score" gnus-score-find-trace t]
1617 ["Find words" gnus-score-find-favourite-words t]
1618 ["Rescore buffer" gnus-summary-rescore t]
1619 ["Increase score..." gnus-summary-increase-score t]
1620 ["Lower score..." gnus-summary-lower-score t]))))
1623 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
1625 :selected (null gnus-score-default-header)]
1626 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
1628 :selected (eq gnus-score-default-header 'a)]
1629 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
1631 :selected (eq gnus-score-default-header 's)]
1633 (gnus-score-set-default 'gnus-score-default-header 'b)
1635 :selected (eq gnus-score-default-header 'b )]
1637 (gnus-score-set-default 'gnus-score-default-header 'h)
1639 :selected (eq gnus-score-default-header 'h )]
1640 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
1642 :selected (eq gnus-score-default-header 'i )]
1643 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
1645 :selected (eq gnus-score-default-header 't )]
1647 (gnus-score-set-default 'gnus-score-default-header 'x)
1649 :selected (eq gnus-score-default-header 'x )]
1650 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
1652 :selected (eq gnus-score-default-header 'l )]
1653 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
1655 :selected (eq gnus-score-default-header 'd )]
1656 ["Followups to author"
1657 (gnus-score-set-default 'gnus-score-default-header 'f)
1659 :selected (eq gnus-score-default-header 'f )])
1661 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
1663 :selected (null gnus-score-default-type)]
1664 ;; The `:active' key is commented out in the following,
1665 ;; because the GNU Emacs hack to support radio buttons use
1666 ;; active to indicate which button is selected.
1667 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
1669 ;; :active (not (memq gnus-score-default-header '(l d)))
1670 :selected (eq gnus-score-default-type 's)]
1671 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
1673 ;; :active (not (memq gnus-score-default-header '(l d)))
1674 :selected (eq gnus-score-default-type 'r)]
1675 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
1677 ;; :active (not (memq gnus-score-default-header '(l d)))
1678 :selected (eq gnus-score-default-type 'e)]
1679 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
1681 ;; :active (not (memq gnus-score-default-header '(l d)))
1682 :selected (eq gnus-score-default-type 'f)]
1683 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
1685 ;; :active (eq (gnus-score-default-header 'd))
1686 :selected (eq gnus-score-default-type 'b)]
1687 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
1689 ;; :active (eq (gnus-score-default-header 'd))
1690 :selected (eq gnus-score-default-type 'n)]
1691 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
1693 ;; :active (eq (gnus-score-default-header 'd))
1694 :selected (eq gnus-score-default-type 'a)]
1696 (gnus-score-set-default 'gnus-score-default-type '<)
1698 ;; :active (eq (gnus-score-default-header 'l))
1699 :selected (eq gnus-score-default-type '<)]
1701 (gnus-score-set-default 'gnus-score-default-type '=)
1703 ;; :active (eq (gnus-score-default-header 'l))
1704 :selected (eq gnus-score-default-type '=)]
1705 ["Greater than number"
1706 (gnus-score-set-default 'gnus-score-default-type '>)
1708 ;; :active (eq (gnus-score-default-header 'l))
1709 :selected (eq gnus-score-default-type '>)])
1710 ["Default fold" gnus-score-default-fold-toggle
1712 :selected gnus-score-default-fold]
1714 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
1716 :selected (null gnus-score-default-duration)]
1718 (gnus-score-set-default 'gnus-score-default-duration 'p)
1720 :selected (eq gnus-score-default-duration 'p)]
1722 (gnus-score-set-default 'gnus-score-default-duration 't)
1724 :selected (eq gnus-score-default-duration 't)]
1726 (gnus-score-set-default 'gnus-score-default-duration 'i)
1728 :selected (eq gnus-score-default-duration 'i)]))
1731 gnus-summary-article-menu gnus-summary-mode-map ""
1734 ["All" gnus-article-hide t]
1735 ["Headers" gnus-article-hide-headers t]
1736 ["Signature" gnus-article-hide-signature t]
1737 ["Citation" gnus-article-hide-citation t]
1738 ["PGP" gnus-article-hide-pgp t]
1739 ["Boring headers" gnus-article-hide-boring-headers t])
1741 ["All" gnus-article-highlight t]
1742 ["Headers" gnus-article-highlight-headers t]
1743 ["Signature" gnus-article-highlight-signature t]
1744 ["Citation" gnus-article-highlight-citation t])
1746 ["Local" gnus-article-date-local t]
1747 ["UT" gnus-article-date-ut t]
1748 ["Original" gnus-article-date-original t]
1749 ["Lapsed" gnus-article-date-lapsed t])
1752 ["Leading" gnus-article-strip-leading-blank-lines t]
1753 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1754 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1755 ["All of the above" gnus-article-strip-blank-lines t])
1756 ["Overstrike" gnus-article-treat-overstrike t]
1757 ["Emphasis" gnus-article-emphasize t]
1758 ["Word wrap" gnus-article-fill-cited-article t]
1759 ["CR" gnus-article-remove-cr t]
1760 ["Show X-Face" gnus-article-display-x-face t]
1761 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1762 ["Rot 13" gnus-summary-caesar-message t]
1763 ["Add buttons" gnus-article-add-buttons t]
1764 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1765 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1766 ["Toggle MIME" gnus-summary-toggle-mime t]
1767 ["Verbose header" gnus-summary-verbose-headers t]
1768 ["Toggle header" gnus-summary-toggle-header t])
1770 ["Save in default format" gnus-summary-save-article t]
1771 ["Save in file" gnus-summary-save-article-file t]
1772 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1773 ["Write to file" gnus-summary-write-article-mail t]
1774 ["Save in MH folder" gnus-summary-save-article-folder t]
1775 ["Save in VM folder" gnus-summary-save-article-vm t]
1776 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1777 ["Save body in file" gnus-summary-save-article-body-file t]
1778 ["Pipe through a filter" gnus-summary-pipe-output t]
1779 ["Add to SOUP packet" gnus-soup-add-article t]
1780 ["Print" gnus-summary-print-article t])
1782 ["Respool article..." gnus-summary-respool-article t]
1783 ["Move article..." gnus-summary-move-article
1784 (gnus-check-backend-function
1785 'request-move-article gnus-newsgroup-name)]
1786 ["Copy article..." gnus-summary-copy-article t]
1787 ["Crosspost article..." gnus-summary-crosspost-article
1788 (gnus-check-backend-function
1789 'request-replace-article gnus-newsgroup-name)]
1790 ["Import file..." gnus-summary-import-article t]
1791 ["Check if posted" gnus-summary-article-posted-p t]
1792 ["Edit article" gnus-summary-edit-article
1793 (not (gnus-group-read-only-p))]
1794 ["Delete article" gnus-summary-delete-article
1795 (gnus-check-backend-function
1796 'request-expire-articles gnus-newsgroup-name)]
1797 ["Query respool" gnus-summary-respool-query t]
1798 ["Delete expirable articles" gnus-summary-expire-articles-now
1799 (gnus-check-backend-function
1800 'request-expire-articles gnus-newsgroup-name)])
1802 ["Uudecode" gnus-uu-decode-uu t]
1803 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1804 ["Unshar" gnus-uu-decode-unshar t]
1805 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1806 ["Save" gnus-uu-decode-save t]
1807 ["Binhex" gnus-uu-decode-binhex t]
1808 ["Postscript" gnus-uu-decode-postscript t])
1809 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1810 ["Isearch article..." gnus-summary-isearch-article t]
1811 ["Search articles forward..." gnus-summary-search-article-forward t]
1812 ["Search articles backward..." gnus-summary-search-article-backward t]
1813 ["Beginning of the article" gnus-summary-beginning-of-article t]
1814 ["End of the article" gnus-summary-end-of-article t]
1815 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1816 ["Fetch referenced articles" gnus-summary-refer-references t]
1817 ["Fetch article with id..." gnus-summary-refer-article t]
1818 ["Redisplay" gnus-summary-show-article t]))
1821 gnus-summary-thread-menu gnus-summary-mode-map ""
1823 ["Toggle threading" gnus-summary-toggle-threads t]
1824 ["Hide threads" gnus-summary-hide-all-threads t]
1825 ["Show threads" gnus-summary-show-all-threads t]
1826 ["Hide thread" gnus-summary-hide-thread t]
1827 ["Show thread" gnus-summary-show-thread t]
1828 ["Go to next thread" gnus-summary-next-thread t]
1829 ["Go to previous thread" gnus-summary-prev-thread t]
1830 ["Go down thread" gnus-summary-down-thread t]
1831 ["Go up thread" gnus-summary-up-thread t]
1832 ["Top of thread" gnus-summary-top-thread t]
1833 ["Mark thread as read" gnus-summary-kill-thread t]
1834 ["Lower thread score" gnus-summary-lower-thread t]
1835 ["Raise thread score" gnus-summary-raise-thread t]
1836 ["Rethread current" gnus-summary-rethread-current t]
1840 gnus-summary-post-menu gnus-summary-mode-map ""
1842 ["Post an article" gnus-summary-post-news t]
1843 ["Followup" gnus-summary-followup t]
1844 ["Followup and yank" gnus-summary-followup-with-original t]
1845 ["Supersede article" gnus-summary-supersede-article t]
1846 ["Cancel article" gnus-summary-cancel-article t]
1847 ["Reply" gnus-summary-reply t]
1848 ["Reply and yank" gnus-summary-reply-with-original t]
1849 ["Mail forward" gnus-summary-mail-forward t]
1850 ["Post forward" gnus-summary-post-forward t]
1851 ["Digest and mail" gnus-uu-digest-mail-forward t]
1852 ["Digest and post" gnus-uu-digest-post-forward t]
1853 ["Resend message" gnus-summary-resend-message t]
1854 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1855 ["Send a mail" gnus-summary-mail-other-window t]
1856 ["Uuencode and post" gnus-uu-post-news t]
1857 ["Followup via news" gnus-summary-followup-to-mail t]
1858 ["Followup via news and yank"
1859 gnus-summary-followup-to-mail-with-original t]
1861 ;;["Send" gnus-summary-send-draft t]
1862 ;;["Send bounced" gnus-resend-bounced-mail t])
1866 gnus-summary-misc-menu gnus-summary-mode-map ""
1869 ["Mark as read" gnus-summary-mark-as-read-forward t]
1870 ["Mark same subject and select"
1871 gnus-summary-kill-same-subject-and-select t]
1872 ["Mark same subject" gnus-summary-kill-same-subject t]
1873 ["Catchup" gnus-summary-catchup t]
1874 ["Catchup all" gnus-summary-catchup-all t]
1875 ["Catchup to here" gnus-summary-catchup-to-here t]
1876 ["Catchup region" gnus-summary-mark-region-as-read t]
1877 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1879 ["Tick" gnus-summary-tick-article-forward t]
1880 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1881 ["Remove marks" gnus-summary-clear-mark-forward t]
1882 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1883 ["Set bookmark" gnus-summary-set-bookmark t]
1884 ["Remove bookmark" gnus-summary-remove-bookmark t])
1886 ["Marks..." gnus-summary-limit-to-marks t]
1887 ["Subject..." gnus-summary-limit-to-subject t]
1888 ["Author..." gnus-summary-limit-to-author t]
1889 ["Age..." gnus-summary-limit-to-age t]
1890 ["Score" gnus-summary-limit-to-score t]
1891 ["Unread" gnus-summary-limit-to-unread t]
1892 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1893 ["Articles" gnus-summary-limit-to-articles t]
1894 ["Pop limit" gnus-summary-pop-limit t]
1895 ["Show dormant" gnus-summary-limit-include-dormant t]
1896 ["Hide childless dormant"
1897 gnus-summary-limit-exclude-childless-dormant t]
1898 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1899 ["Show expunged" gnus-summary-show-all-expunged t])
1901 ["Set mark" gnus-summary-mark-as-processable t]
1902 ["Remove mark" gnus-summary-unmark-as-processable t]
1903 ["Remove all marks" gnus-summary-unmark-all-processable t]
1904 ["Mark above" gnus-uu-mark-over t]
1905 ["Mark series" gnus-uu-mark-series t]
1906 ["Mark region" gnus-uu-mark-region t]
1907 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1908 ["Mark all" gnus-uu-mark-all t]
1909 ["Mark buffer" gnus-uu-mark-buffer t]
1910 ["Mark sparse" gnus-uu-mark-sparse t]
1911 ["Mark thread" gnus-uu-mark-thread t]
1912 ["Unmark thread" gnus-uu-unmark-thread t]
1913 ("Process Mark Sets"
1914 ["Kill" gnus-summary-kill-process-mark t]
1915 ["Yank" gnus-summary-yank-process-mark
1916 gnus-newsgroup-process-stack]
1917 ["Save" gnus-summary-save-process-mark t]))
1919 ["Page forward" gnus-summary-next-page t]
1920 ["Page backward" gnus-summary-prev-page t]
1921 ["Line forward" gnus-summary-scroll-up t])
1923 ["Next unread article" gnus-summary-next-unread-article t]
1924 ["Previous unread article" gnus-summary-prev-unread-article t]
1925 ["Next article" gnus-summary-next-article t]
1926 ["Previous article" gnus-summary-prev-article t]
1927 ["Next unread subject" gnus-summary-next-unread-subject t]
1928 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1929 ["Next article same subject" gnus-summary-next-same-subject t]
1930 ["Previous article same subject" gnus-summary-prev-same-subject t]
1931 ["First unread article" gnus-summary-first-unread-article t]
1932 ["Best unread article" gnus-summary-best-unread-article t]
1933 ["Go to subject number..." gnus-summary-goto-subject t]
1934 ["Go to article number..." gnus-summary-goto-article t]
1935 ["Go to the last article" gnus-summary-goto-last-article t]
1936 ["Pop article off history" gnus-summary-pop-article t])
1938 ["Sort by number" gnus-summary-sort-by-number t]
1939 ["Sort by author" gnus-summary-sort-by-author t]
1940 ["Sort by subject" gnus-summary-sort-by-subject t]
1941 ["Sort by date" gnus-summary-sort-by-date t]
1942 ["Sort by score" gnus-summary-sort-by-score t]
1943 ["Sort by lines" gnus-summary-sort-by-lines t])
1945 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1946 ["Describe group" gnus-summary-describe-group t]
1947 ["Read manual" gnus-info-find-node t])
1949 ["Enter article" gnus-cache-enter-article t]
1950 ["Remove article" gnus-cache-remove-article t])
1952 ["Pick and read" gnus-pick-mode t]
1953 ["Binary" gnus-binary-mode t])
1955 ["Regenerate" gnus-summary-prepare t]
1956 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1957 ["Toggle threading" gnus-summary-toggle-threads t])
1958 ["Filter articles..." gnus-summary-execute-command t]
1959 ["Run command on subjects..." gnus-summary-universal-argument t]
1960 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1961 ["Expand window" gnus-summary-expand-window t]
1962 ["Expire expirable articles" gnus-summary-expire-articles
1963 (gnus-check-backend-function
1964 'request-expire-articles gnus-newsgroup-name)]
1965 ["Regenerate buffer" gnus-summary-prepare t]
1966 ["Edit local kill file" gnus-summary-edit-local-kill t]
1967 ["Edit main kill file" gnus-summary-edit-global-kill t]
1969 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1970 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
1971 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1972 ["Exit group" gnus-summary-exit t]
1973 ["Exit group without updating" gnus-summary-exit-no-update t]
1974 ["Exit and goto next group" gnus-summary-next-group t]
1975 ["Exit and goto prev group" gnus-summary-prev-group t]
1976 ["Reselect group" gnus-summary-reselect-current-group t]
1977 ["Rescan group" gnus-summary-rescan-group t]
1978 ["Save newsrc" gnus-summary-save-newsrc t])))
1980 (run-hooks 'gnus-summary-menu-hook)))
1982 (defun gnus-score-set-default (var value)
1983 "A version of set that updates the GNU Emacs menu-bar."
1985 ;; It is the message that forces the active status to be updated.
1988 (defun gnus-make-score-map (type)
1989 "Make a summary score map of type TYPE."
1992 (let ((headers '(("author" "from" string)
1993 ("subject" "subject" string)
1994 ("article body" "body" string)
1995 ("article head" "head" string)
1996 ("xref" "xref" string)
1997 ("lines" "lines" number)
1998 ("followups to author" "followup" string)))
1999 (types '((number ("less than" <)
2002 (string ("substring" s)
2006 (perms '(("temporary" (current-time-string))
2014 (if (eq type 'lower)
2019 (setq header (car headers))
2025 (let ((ts (cdr (assoc (nth 2 header) types)))
2041 'gnus-summary-score-entry
2043 (if (or (string= (nth 1 header)
2045 (string= (nth 1 header)
2048 (list 'gnus-summary-header
2050 (list 'quote (nth 1 (car ts)))
2051 (list 'gnus-score-default nil)
2057 (list (nreverse outp))))
2060 (list (nreverse outt))))
2062 (setq headers (cdr headers)))
2063 (list (nreverse outh))))))))
2067 (defun gnus-summary-mode (&optional group)
2068 "Major mode for reading articles.
2070 All normal editing commands are switched off.
2071 \\<gnus-summary-mode-map>
2072 Each line in this buffer represents one article. To read an
2073 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2074 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2077 You can also post articles and send mail from this buffer. To
2078 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2079 of an article, type `\\[gnus-summary-reply]'.
2081 There are approx. one gazillion commands you can execute in this
2082 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2084 The following commands are available:
2086 \\{gnus-summary-mode-map}"
2088 (when (gnus-visual-p 'summary-menu 'menu)
2089 (gnus-summary-make-menu-bar))
2090 (kill-all-local-variables)
2091 (gnus-summary-make-local-variables)
2092 (gnus-make-thread-indent-array)
2093 (gnus-simplify-mode-line)
2094 (setq major-mode 'gnus-summary-mode)
2095 (setq mode-name "Summary")
2096 (make-local-variable 'minor-mode-alist)
2097 (use-local-map gnus-summary-mode-map)
2098 (buffer-disable-undo (current-buffer))
2099 (setq buffer-read-only t) ;Disable modification
2100 (setq truncate-lines t)
2101 (setq selective-display t)
2102 (setq selective-display-ellipses t) ;Display `...'
2103 (setq buffer-display-table gnus-summary-display-table)
2104 (gnus-set-default-directory)
2105 (setq gnus-newsgroup-name group)
2106 (make-local-variable 'gnus-summary-line-format)
2107 (make-local-variable 'gnus-summary-line-format-spec)
2108 (make-local-variable 'gnus-summary-mark-positions)
2109 (gnus-make-local-hook 'post-command-hook)
2110 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
2111 (run-hooks 'gnus-summary-mode-hook)
2112 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2113 (gnus-update-summary-mark-positions))
2115 (defun gnus-summary-make-local-variables ()
2116 "Make all the local summary buffer variables."
2117 (let ((locals gnus-summary-local-variables)
2119 (while (setq local (pop locals))
2122 (if (eq (cdr local) 'global)
2123 ;; Copy the global value of the variable.
2124 (setq global (symbol-value (car local)))
2125 ;; Use the value from the list.
2126 (setq global (eval (cdr local))))
2127 (make-local-variable (car local))
2128 (set (car local) global))
2129 ;; Simple nil-valued local variable.
2130 (make-local-variable local)
2133 (defun gnus-summary-clear-local-variables ()
2134 (let ((locals gnus-summary-local-variables))
2136 (if (consp (car locals))
2137 (and (vectorp (caar locals))
2138 (set (caar locals) nil))
2139 (and (vectorp (car locals))
2140 (set (car locals) nil)))
2141 (setq locals (cdr locals)))))
2143 ;; Summary data functions.
2145 (defmacro gnus-data-number (data)
2148 (defmacro gnus-data-set-number (data number)
2149 `(setcar ,data ,number))
2151 (defmacro gnus-data-mark (data)
2154 (defmacro gnus-data-set-mark (data mark)
2155 `(setcar (nthcdr 1 ,data) ,mark))
2157 (defmacro gnus-data-pos (data)
2160 (defmacro gnus-data-set-pos (data pos)
2161 `(setcar (nthcdr 2 ,data) ,pos))
2163 (defmacro gnus-data-header (data)
2166 (defmacro gnus-data-level (data)
2169 (defmacro gnus-data-unread-p (data)
2170 `(= (nth 1 ,data) gnus-unread-mark))
2172 (defmacro gnus-data-read-p (data)
2173 `(/= (nth 1 ,data) gnus-unread-mark))
2175 (defmacro gnus-data-pseudo-p (data)
2176 `(consp (nth 3 ,data)))
2178 (defmacro gnus-data-find (number)
2179 `(assq ,number gnus-newsgroup-data))
2181 (defmacro gnus-data-find-list (number &optional data)
2182 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2183 (memq (assq ,number bdata)
2186 (defmacro gnus-data-make (number mark pos header level)
2187 `(list ,number ,mark ,pos ,header ,level))
2189 (defun gnus-data-enter (after-article number mark pos header level offset)
2190 (let ((data (gnus-data-find-list after-article)))
2192 (error "No such article: %d" after-article))
2193 (setcdr data (cons (gnus-data-make number mark pos header level)
2195 (setq gnus-newsgroup-data-reverse nil)
2196 (gnus-data-update-list (cddr data) offset)))
2198 (defun gnus-data-enter-list (after-article list &optional offset)
2200 (let ((data (and after-article (gnus-data-find-list after-article)))
2202 (or data (not after-article) (error "No such article: %d" after-article))
2203 ;; Find the last element in the list to be spliced into the main
2206 (setq list (cdr list)))
2209 (setcdr list gnus-newsgroup-data)
2210 (setq gnus-newsgroup-data ilist)
2212 (gnus-data-update-list (cdr list) offset)))
2213 (setcdr list (cdr data))
2216 (gnus-data-update-list (cdr list) offset)))
2217 (setq gnus-newsgroup-data-reverse nil))))
2219 (defun gnus-data-remove (article &optional offset)
2220 (let ((data gnus-newsgroup-data))
2221 (if (= (gnus-data-number (car data)) article)
2223 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2224 gnus-newsgroup-data-reverse nil)
2226 (gnus-data-update-list gnus-newsgroup-data offset)))
2228 (when (= (gnus-data-number (cadr data)) article)
2229 (setcdr data (cddr data))
2231 (gnus-data-update-list (cdr data) offset))
2233 gnus-newsgroup-data-reverse nil))
2234 (setq data (cdr data))))))
2236 (defmacro gnus-data-list (backward)
2238 (or gnus-newsgroup-data-reverse
2239 (setq gnus-newsgroup-data-reverse
2240 (reverse gnus-newsgroup-data)))
2241 gnus-newsgroup-data))
2243 (defun gnus-data-update-list (data offset)
2244 "Add OFFSET to the POS of all data entries in DATA."
2246 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2247 (setq data (cdr data))))
2249 (defun gnus-summary-article-pseudo-p (article)
2250 "Say whether this article is a pseudo article or not."
2251 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2253 (defmacro gnus-summary-article-sparse-p (article)
2254 "Say whether this article is a sparse article or not."
2255 ` (memq ,article gnus-newsgroup-sparse))
2257 (defmacro gnus-summary-article-ancient-p (article)
2258 "Say whether this article is a sparse article or not."
2259 `(memq ,article gnus-newsgroup-ancient))
2261 (defun gnus-article-parent-p (number)
2262 "Say whether this article is a parent or not."
2263 (let ((data (gnus-data-find-list number)))
2264 (and (cdr data) ; There has to be an article after...
2265 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2266 (gnus-data-level (nth 1 data))))))
2268 (defun gnus-article-children (number)
2269 "Return a list of all children to NUMBER."
2270 (let* ((data (gnus-data-find-list number))
2271 (level (gnus-data-level (car data)))
2273 (setq data (cdr data))
2275 (= (gnus-data-level (car data)) (1+ level)))
2276 (push (gnus-data-number (car data)) children)
2277 (setq data (cdr data)))
2280 (defmacro gnus-summary-skip-intangible ()
2281 "If the current article is intangible, then jump to a different article."
2282 '(let ((to (get-text-property (point) 'gnus-intangible)))
2283 (and to (gnus-summary-goto-subject to))))
2285 (defmacro gnus-summary-article-intangible-p ()
2286 "Say whether this article is intangible or not."
2287 '(get-text-property (point) 'gnus-intangible))
2289 (defun gnus-article-read-p (article)
2290 "Say whether ARTICLE is read or not."
2291 (not (or (memq article gnus-newsgroup-marked)
2292 (memq article gnus-newsgroup-unreads)
2293 (memq article gnus-newsgroup-unselected)
2294 (memq article gnus-newsgroup-dormant))))
2296 ;; Some summary mode macros.
2298 (defmacro gnus-summary-article-number ()
2299 "The article number of the article on the current line.
2300 If there isn's an article number here, then we return the current
2303 (gnus-summary-skip-intangible)
2304 (or (get-text-property (point) 'gnus-number)
2305 (gnus-summary-last-subject))))
2307 (defmacro gnus-summary-article-header (&optional number)
2308 `(gnus-data-header (gnus-data-find
2309 ,(or number '(gnus-summary-article-number)))))
2311 (defmacro gnus-summary-thread-level (&optional number)
2312 `(if (and (eq gnus-summary-make-false-root 'dummy)
2313 (get-text-property (point) 'gnus-intangible))
2315 (gnus-data-level (gnus-data-find
2316 ,(or number '(gnus-summary-article-number))))))
2318 (defmacro gnus-summary-article-mark (&optional number)
2319 `(gnus-data-mark (gnus-data-find
2320 ,(or number '(gnus-summary-article-number)))))
2322 (defmacro gnus-summary-article-pos (&optional number)
2323 `(gnus-data-pos (gnus-data-find
2324 ,(or number '(gnus-summary-article-number)))))
2326 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2327 (defmacro gnus-summary-article-subject (&optional number)
2328 "Return current subject string or nil if nothing."
2331 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2332 '(gnus-data-header (assq (gnus-summary-article-number)
2333 gnus-newsgroup-data)))))
2336 (mail-header-subject headers))))
2338 (defmacro gnus-summary-article-score (&optional number)
2339 "Return current article score."
2340 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2341 gnus-newsgroup-scored))
2342 gnus-summary-default-score 0))
2344 (defun gnus-summary-article-children (&optional number)
2345 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2346 (level (gnus-data-level (car data)))
2348 (while (and (setq data (cdr data))
2349 (> (setq l (gnus-data-level (car data))) level))
2350 (and (= (1+ level) l)
2351 (push (gnus-data-number (car data))
2353 (nreverse children)))
2355 (defun gnus-summary-article-parent (&optional number)
2356 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2357 (gnus-data-list t)))
2358 (level (gnus-data-level (car data))))
2360 () ; This is a root.
2361 ;; We search until we find an article with a level less than
2362 ;; this one. That function has to be the parent.
2363 (while (and (setq data (cdr data))
2364 (not (< (gnus-data-level (car data)) level))))
2365 (and data (gnus-data-number (car data))))))
2367 (defun gnus-unread-mark-p (mark)
2368 "Say whether MARK is the unread mark."
2369 (= mark gnus-unread-mark))
2371 (defun gnus-read-mark-p (mark)
2372 "Say whether MARK is one of the marks that mark as read.
2373 This is all marks except unread, ticked, dormant, and expirable."
2374 (not (or (= mark gnus-unread-mark)
2375 (= mark gnus-ticked-mark)
2376 (= mark gnus-dormant-mark)
2377 (= mark gnus-expirable-mark))))
2379 (defmacro gnus-article-mark (number)
2381 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2382 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2383 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2384 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2385 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2386 gnus-ancient-mark))))
2388 ;; Saving hidden threads.
2390 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2391 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2393 (defmacro gnus-save-hidden-threads (&rest forms)
2394 "Save hidden threads, eval FORMS, and restore the hidden threads."
2395 (let ((config (make-symbol "config")))
2396 `(let ((,config (gnus-hidden-threads-configuration)))
2400 (gnus-restore-hidden-threads-configuration ,config)))))
2402 (defun gnus-hidden-threads-configuration ()
2403 "Return the current hidden threads configuration."
2406 (goto-char (point-min))
2407 (while (search-forward "\r" nil t)
2408 (push (1- (point)) config))
2411 (defun gnus-restore-hidden-threads-configuration (config)
2412 "Restore hidden threads configuration from CONFIG."
2413 (let (point buffer-read-only)
2414 (while (setq point (pop config))
2415 (when (and (< point (point-max))
2417 (= (following-char) ?\n))
2418 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2420 ;; Various summary mode internalish functions.
2422 (defun gnus-mouse-pick-article (e)
2425 (gnus-summary-next-page nil t))
2427 (defun gnus-summary-setup-buffer (group)
2428 "Initialize summary buffer."
2429 (let ((buffer (concat "*Summary " group "*")))
2430 (if (get-buffer buffer)
2433 (setq gnus-summary-buffer (current-buffer))
2434 (not gnus-newsgroup-prepared))
2435 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2436 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
2437 (gnus-add-current-to-buffer-list)
2438 (gnus-summary-mode group)
2440 (gnus-carpal-setup-buffer 'summary))
2441 (unless gnus-single-article-buffer
2442 (make-local-variable 'gnus-article-buffer)
2443 (make-local-variable 'gnus-article-current)
2444 (make-local-variable 'gnus-original-article-buffer))
2445 (setq gnus-newsgroup-name group)
2448 (defun gnus-set-global-variables ()
2449 ;; Set the global equivalents of the summary buffer-local variables
2450 ;; to the latest values they had. These reflect the summary buffer
2451 ;; that was in action when the last article was fetched.
2452 (when (eq major-mode 'gnus-summary-mode)
2453 (setq gnus-summary-buffer (current-buffer))
2454 (let ((name gnus-newsgroup-name)
2455 (marked gnus-newsgroup-marked)
2456 (unread gnus-newsgroup-unreads)
2457 (headers gnus-current-headers)
2458 (data gnus-newsgroup-data)
2459 (summary gnus-summary-buffer)
2460 (article-buffer gnus-article-buffer)
2461 (original gnus-original-article-buffer)
2462 (gac gnus-article-current)
2463 (reffed gnus-reffed-article-number)
2464 (score-file gnus-current-score-file))
2466 (set-buffer gnus-group-buffer)
2467 (setq gnus-newsgroup-name name)
2468 (setq gnus-newsgroup-marked marked)
2469 (setq gnus-newsgroup-unreads unread)
2470 (setq gnus-current-headers headers)
2471 (setq gnus-newsgroup-data data)
2472 (setq gnus-article-current gac)
2473 (setq gnus-summary-buffer summary)
2474 (setq gnus-article-buffer article-buffer)
2475 (setq gnus-original-article-buffer original)
2476 (setq gnus-reffed-article-number reffed)
2477 (setq gnus-current-score-file score-file)
2478 ;; The article buffer also has local variables.
2479 (when (gnus-buffer-live-p gnus-article-buffer)
2480 (set-buffer gnus-article-buffer)
2481 (setq gnus-summary-buffer summary))))))
2483 (defun gnus-summary-article-unread-p (article)
2484 "Say whether ARTICLE is unread or not."
2485 (memq article gnus-newsgroup-unreads))
2487 (defun gnus-summary-first-article-p (&optional article)
2488 "Return whether ARTICLE is the first article in the buffer."
2489 (if (not (setq article (or article (gnus-summary-article-number))))
2491 (eq article (caar gnus-newsgroup-data))))
2493 (defun gnus-summary-last-article-p (&optional article)
2494 "Return whether ARTICLE is the last article in the buffer."
2495 (if (not (setq article (or article (gnus-summary-article-number))))
2496 t ; All non-existent numbers are the last article. :-)
2497 (not (cdr (gnus-data-find-list article)))))
2499 (defun gnus-make-thread-indent-array ()
2501 (unless (and gnus-thread-indent-array
2502 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2503 (setq gnus-thread-indent-array (make-vector 201 "")
2504 gnus-thread-indent-array-level gnus-thread-indent-level)
2506 (aset gnus-thread-indent-array n
2507 (make-string (* n gnus-thread-indent-level) ? ))
2510 (defun gnus-update-summary-mark-positions ()
2511 "Compute where the summary marks are to go."
2513 (when (and gnus-summary-buffer
2514 (get-buffer gnus-summary-buffer)
2515 (buffer-name (get-buffer gnus-summary-buffer)))
2516 (set-buffer gnus-summary-buffer))
2517 (let ((gnus-replied-mark 129)
2518 (gnus-score-below-mark 130)
2519 (gnus-score-over-mark 130)
2520 (spec gnus-summary-line-format-spec)
2521 thread gnus-visual pos)
2523 (gnus-set-work-buffer)
2524 (let ((gnus-summary-line-format-spec spec))
2525 (gnus-summary-insert-line
2526 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2527 (goto-char (point-min))
2528 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2530 (goto-char (point-min))
2531 (push (cons 'replied (and (search-forward "\201" nil t)
2534 (goto-char (point-min))
2535 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2537 (setq gnus-summary-mark-positions pos))))
2539 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2540 "Insert a dummy root in the summary buffer."
2542 (gnus-add-text-properties
2543 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2544 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2546 (defun gnus-summary-insert-line (gnus-tmp-header
2547 gnus-tmp-level gnus-tmp-current
2548 gnus-tmp-unread gnus-tmp-replied
2549 gnus-tmp-expirable gnus-tmp-subject-or-nil
2550 &optional gnus-tmp-dummy gnus-tmp-score
2552 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2553 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2554 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2555 (gnus-tmp-score-char
2556 (if (or (null gnus-summary-default-score)
2557 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2558 gnus-summary-zcore-fuzz))
2560 (if (< gnus-tmp-score gnus-summary-default-score)
2561 gnus-score-below-mark gnus-score-over-mark)))
2563 (cond (gnus-tmp-process gnus-process-mark)
2564 ((memq gnus-tmp-current gnus-newsgroup-cached)
2566 (gnus-tmp-replied gnus-replied-mark)
2567 ((memq gnus-tmp-current gnus-newsgroup-saved)
2569 (t gnus-unread-mark)))
2570 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2573 ((string-match "<[^>]+> *$" gnus-tmp-from)
2574 (let ((beg (match-beginning 0)))
2575 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2576 (substring gnus-tmp-from (1+ (match-beginning 0))
2577 (1- (match-end 0))))
2578 (substring gnus-tmp-from 0 beg))))
2579 ((string-match "(.+)" gnus-tmp-from)
2580 (substring gnus-tmp-from
2581 (1+ (match-beginning 0)) (1- (match-end 0))))
2583 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2584 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2585 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2586 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2587 (buffer-read-only nil))
2588 (when (string= gnus-tmp-name "")
2589 (setq gnus-tmp-name gnus-tmp-from))
2590 (unless (numberp gnus-tmp-lines)
2591 (setq gnus-tmp-lines 0))
2592 (gnus-put-text-property
2594 (progn (eval gnus-summary-line-format-spec) (point))
2595 'gnus-number gnus-tmp-number)
2596 (when (gnus-visual-p 'summary-highlight 'highlight)
2598 (run-hooks 'gnus-summary-update-hook)
2601 (defun gnus-summary-update-line (&optional dont-update)
2602 ;; Update summary line after change.
2603 (when (and gnus-summary-default-score
2604 (not gnus-summary-inhibit-highlight))
2605 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2606 (article (gnus-summary-article-number))
2607 (score (gnus-summary-article-score article)))
2609 (if (and gnus-summary-mark-below
2610 (< (gnus-summary-article-score)
2611 gnus-summary-mark-below))
2612 ;; This article has a low score, so we mark it as read.
2613 (when (memq article gnus-newsgroup-unreads)
2614 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2615 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2616 ;; This article was previously marked as read on account
2617 ;; of a low score, but now it has risen, so we mark it as
2619 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2620 (gnus-summary-update-mark
2621 (if (or (null gnus-summary-default-score)
2622 (<= (abs (- score gnus-summary-default-score))
2623 gnus-summary-zcore-fuzz))
2625 (if (< score gnus-summary-default-score)
2626 gnus-score-below-mark gnus-score-over-mark))
2628 ;; Do visual highlighting.
2629 (when (gnus-visual-p 'summary-highlight 'highlight)
2630 (run-hooks 'gnus-summary-update-hook)))))
2632 (defvar gnus-tmp-new-adopts nil)
2634 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2635 "Return the number of articles in THREAD.
2636 This may be 0 in some cases -- if none of the articles in
2637 the thread are to be displayed."
2639 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2641 ((not (listp thread))
2643 ((and (consp thread) (cdr thread))
2646 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2649 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2652 (when (and level (zerop level) gnus-tmp-new-adopts)
2655 'gnus-summary-number-of-articles-in-thread
2656 gnus-tmp-new-adopts))))
2658 (if (> number 1) gnus-not-empty-thread-mark
2659 gnus-empty-thread-mark)
2662 (defun gnus-summary-set-local-parameters (group)
2663 "Go through the local params of GROUP and set all variable specs in that list."
2664 (let ((params (gnus-group-find-parameter group))
2667 (setq elem (car params)
2668 params (cdr params))
2669 (and (consp elem) ; Has to be a cons.
2670 (consp (cdr elem)) ; The cdr has to be a list.
2671 (symbolp (car elem)) ; Has to be a symbol in there.
2672 (not (memq (car elem)
2673 '(quit-config to-address to-list to-group)))
2674 (progn ; So we set it.
2675 (make-local-variable (car elem))
2676 (set (car elem) (eval (nth 1 elem))))))))
2678 (defun gnus-summary-read-group (group &optional show-all no-article
2679 kill-buffer no-display)
2680 "Start reading news in newsgroup GROUP.
2681 If SHOW-ALL is non-nil, already read articles are also listed.
2682 If NO-ARTICLE is non-nil, no article is selected initially.
2683 If NO-DISPLAY, don't generate a summary buffer."
2684 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2685 (let* ((new-group (gnus-summary-setup-buffer group))
2686 (quit-config (gnus-group-quit-config group))
2687 (did-select (and new-group (gnus-select-newsgroup group show-all))))
2689 ;; This summary buffer exists already, so we just select it.
2691 (gnus-set-global-variables)
2693 (gnus-kill-or-deaden-summary kill-buffer))
2694 (gnus-configure-windows 'summary 'force)
2695 (gnus-set-mode-line 'summary)
2696 (gnus-summary-position-point)
2699 ;; We couldn't select this group.
2701 (when (and (eq major-mode 'gnus-summary-mode)
2702 (not (equal (current-buffer) kill-buffer)))
2703 (kill-buffer (current-buffer))
2704 (if (not quit-config)
2706 (set-buffer gnus-group-buffer)
2707 (gnus-group-jump-to-group group)
2708 (gnus-group-next-unread-group 1))
2709 (gnus-handle-ephemeral-exit quit-config)))
2710 (gnus-message 3 "Can't select group")
2712 ;; The user did a `C-g' while prompting for number of articles,
2713 ;; so we exit this group.
2714 ((eq did-select 'quit)
2715 (and (eq major-mode 'gnus-summary-mode)
2716 (not (equal (current-buffer) kill-buffer))
2717 (kill-buffer (current-buffer)))
2719 (gnus-kill-or-deaden-summary kill-buffer))
2720 (if (not quit-config)
2722 (set-buffer gnus-group-buffer)
2723 (gnus-group-jump-to-group group)
2724 (gnus-group-next-unread-group 1)
2725 (gnus-configure-windows 'group 'force))
2726 (gnus-handle-ephemeral-exit quit-config))
2727 ;; Finally signal the quit.
2729 ;; The group was successfully selected.
2731 (gnus-set-global-variables)
2732 ;; Save the active value in effect when the group was entered.
2733 (setq gnus-newsgroup-active
2735 (gnus-active gnus-newsgroup-name)))
2736 ;; You can change the summary buffer in some way with this hook.
2737 (run-hooks 'gnus-select-group-hook)
2738 ;; Set any local variables in the group parameters.
2739 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2740 (gnus-update-format-specifications
2741 nil 'summary 'summary-mode 'summary-dummy)
2742 ;; Do score processing.
2743 (when gnus-use-scoring
2744 (gnus-possibly-score-headers))
2745 ;; Check whether to fill in the gaps in the threads.
2746 (when gnus-build-sparse-threads
2747 (gnus-build-sparse-threads))
2748 ;; Find the initial limit.
2749 (if gnus-show-threads
2751 (let ((gnus-newsgroup-dormant nil))
2752 (gnus-summary-initial-limit show-all))
2753 (gnus-summary-initial-limit show-all))
2754 (setq gnus-newsgroup-limit
2756 (lambda (header) (mail-header-number header))
2757 gnus-newsgroup-headers)))
2758 ;; Generate the summary buffer.
2760 (gnus-summary-prepare))
2761 (when gnus-use-trees
2762 (gnus-tree-open group)
2763 (setq gnus-summary-highlight-line-function
2764 'gnus-tree-highlight-article))
2765 ;; If the summary buffer is empty, but there are some low-scored
2766 ;; articles or some excluded dormants, we include these in the
2768 (when (and (zerop (buffer-size))
2770 (cond (gnus-newsgroup-dormant
2771 (gnus-summary-limit-include-dormant))
2772 ((and gnus-newsgroup-scored show-all)
2773 (gnus-summary-limit-include-expunged t))))
2774 ;; Function `gnus-apply-kill-file' must be called in this hook.
2775 (run-hooks 'gnus-apply-kill-hook)
2776 (if (and (zerop (buffer-size))
2779 ;; This newsgroup is empty.
2780 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
2781 (gnus-message 6 "No unread news")
2783 (gnus-kill-or-deaden-summary kill-buffer))
2784 ;; Return nil from this function.
2786 ;; Hide conversation thread subtrees. We cannot do this in
2787 ;; gnus-summary-prepare-hook since kill processing may not
2788 ;; work with hidden articles.
2789 (and gnus-show-threads
2790 gnus-thread-hide-subtree
2791 (gnus-summary-hide-all-threads))
2792 ;; Show first unread article if requested.
2793 (if (and (not no-article)
2795 gnus-newsgroup-unreads
2796 gnus-auto-select-first)
2797 (unless (if (eq gnus-auto-select-first 'best)
2798 (gnus-summary-best-unread-article)
2799 (gnus-summary-first-unread-article))
2800 (gnus-configure-windows 'summary))
2801 ;; Don't select any articles, just move point to the first
2802 ;; article in the group.
2803 (goto-char (point-min))
2804 (gnus-summary-position-point)
2805 (gnus-set-mode-line 'summary)
2806 (gnus-configure-windows 'summary 'force))
2808 (gnus-kill-or-deaden-summary kill-buffer))
2809 (when (get-buffer-window gnus-group-buffer t)
2810 ;; Gotta use windows, because recenter does weird stuff if
2811 ;; the current buffer ain't the displayed window.
2812 (let ((owin (selected-window)))
2813 (select-window (get-buffer-window gnus-group-buffer t))
2814 (when (gnus-group-goto-group group)
2816 (select-window owin))))
2817 ;; Mark this buffer as "prepared".
2818 (setq gnus-newsgroup-prepared t)
2821 (defun gnus-summary-prepare ()
2822 "Generate the summary buffer."
2824 (let ((buffer-read-only nil))
2826 (setq gnus-newsgroup-data nil
2827 gnus-newsgroup-data-reverse nil)
2828 (run-hooks 'gnus-summary-generate-hook)
2829 ;; Generate the buffer, either with threads or without.
2830 (when gnus-newsgroup-headers
2831 (gnus-summary-prepare-threads
2832 (if gnus-show-threads
2833 (gnus-sort-gathered-threads
2834 (funcall gnus-summary-thread-gathering-function
2836 (gnus-cut-threads (gnus-make-threads)))))
2837 ;; Unthreaded display.
2838 (gnus-sort-articles gnus-newsgroup-headers))))
2839 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2840 ;; Call hooks for modifying summary buffer.
2841 (goto-char (point-min))
2842 (run-hooks 'gnus-summary-prepare-hook)))
2844 (defsubst gnus-general-simplify-subject (subject)
2845 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2848 ;; Truncate the subject.
2849 ((numberp gnus-summary-gather-subject-limit)
2850 (setq subject (gnus-simplify-subject-re subject))
2851 (if (> (length subject) gnus-summary-gather-subject-limit)
2852 (substring subject 0 gnus-summary-gather-subject-limit)
2854 ;; Fuzzily simplify it.
2855 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2856 (gnus-simplify-subject-fuzzy subject))
2857 ;; Just remove the leading "Re:".
2859 (gnus-simplify-subject-re subject))))
2861 (if (and gnus-summary-gather-exclude-subject
2862 (string-match gnus-summary-gather-exclude-subject subject))
2863 nil ; This article shouldn't be gathered
2866 (defun gnus-summary-simplify-subject-query ()
2867 "Query where the respool algorithm would put this article."
2869 (gnus-set-global-variables)
2870 (gnus-summary-select-article)
2871 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2873 (defun gnus-gather-threads-by-subject (threads)
2874 "Gather threads by looking at Subject headers."
2875 (if (not gnus-summary-make-false-root)
2877 (let ((hashtb (gnus-make-hashtable 1023))
2880 subject hthread whole-subject)
2882 (setq subject (gnus-general-simplify-subject
2883 (setq whole-subject (mail-header-subject
2886 (if (setq hthread (gnus-gethash subject hashtb))
2888 ;; We enter a dummy root into the thread, if we
2889 ;; haven't done that already.
2890 (unless (stringp (caar hthread))
2891 (setcar hthread (list whole-subject (car hthread))))
2892 ;; We add this new gathered thread to this gathered
2894 (setcdr (car hthread)
2895 (nconc (cdar hthread) (list (car threads))))
2896 ;; Remove it from the list of threads.
2897 (setcdr prev (cdr threads))
2898 (setq threads prev))
2899 ;; Enter this thread into the hash table.
2900 (gnus-sethash subject threads hashtb)))
2902 (setq threads (cdr threads)))
2905 (defun gnus-gather-threads-by-references (threads)
2906 "Gather threads by looking at References headers."
2907 (let ((idhashtb (gnus-make-hashtable 1023))
2908 (thhashtb (gnus-make-hashtable 1023))
2911 ids references id gthread gid entered ref)
2913 (when (setq references (mail-header-references (caar threads)))
2914 (setq id (mail-header-id (caar threads))
2915 ids (gnus-split-references references)
2917 (while (setq ref (pop ids))
2918 (setq ids (delete ref ids))
2919 (if (not (setq gid (gnus-gethash ref idhashtb)))
2921 (gnus-sethash ref id idhashtb)
2922 (gnus-sethash id threads thhashtb))
2923 (setq gthread (gnus-gethash gid thhashtb))
2925 ;; We enter a dummy root into the thread, if we
2926 ;; haven't done that already.
2927 (unless (stringp (caar gthread))
2928 (setcar gthread (list (mail-header-subject (caar gthread))
2930 ;; We add this new gathered thread to this gathered
2932 (setcdr (car gthread)
2933 (nconc (cdar gthread) (list (car threads)))))
2934 ;; Add it into the thread hash table.
2935 (gnus-sethash id gthread thhashtb)
2937 ;; Remove it from the list of threads.
2938 (setcdr prev (cdr threads))
2939 (setq threads prev))))
2941 (setq threads (cdr threads)))
2944 (defun gnus-sort-gathered-threads (threads)
2945 "Sort subtreads inside each gathered thread by article number."
2946 (let ((result threads))
2948 (when (stringp (caar threads))
2949 (setcdr (car threads)
2950 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2951 (setq threads (cdr threads)))
2954 (defun gnus-thread-loop-p (root thread)
2955 "Say whether ROOT is in THREAD."
2956 (let ((th (cdr thread)))
2958 (not (eq (caar th) root)))
2961 ;; We have found a loop.
2963 (setcdr thread (delq (car th) (cdr thread)))
2964 (if (boundp (setq ref-dep (intern "none"
2965 gnus-newsgroup-dependencies)))
2966 (setcdr (symbol-value ref-dep)
2967 (nconc (cdr (symbol-value ref-dep))
2969 (set ref-dep (list nil (car th))))
2971 ;; Recurse down into the sub-threads and look for loops.
2974 (lambda (thread) (gnus-thread-loop-p root thread))
2977 (defun gnus-make-threads ()
2978 "Go through the dependency hashtb and find the roots. Return all threads."
2980 (while (catch 'infloop
2983 ;; Deal with self-referencing References loops.
2984 (when (and (car (symbol-value refs))
2991 (car (symbol-value refs)) thread))
2992 (cdr (symbol-value refs)))))))
2995 (unless (car (symbol-value refs))
2996 ;; These threads do not refer back to any other articles,
2997 ;; so they're roots.
2998 (setq threads (append (cdr (symbol-value refs)) threads))))
2999 gnus-newsgroup-dependencies)))
3002 (defun gnus-build-sparse-threads ()
3003 (let ((headers gnus-newsgroup-headers)
3004 (deps gnus-newsgroup-dependencies)
3005 header references generation relations
3006 cthread subject child end pthread relation)
3007 ;; First we create an alist of generations/relations, where
3008 ;; generations is how much we trust the relation, and the relation
3010 (gnus-message 7 "Making sparse threads...")
3012 (nnheader-set-temp-buffer " *gnus sparse threads*")
3013 (while (setq header (pop headers))
3014 (when (and (setq references (mail-header-references header))
3015 (not (string= references "")))
3017 (setq child (mail-header-id header)
3018 subject (mail-header-subject header))
3020 (while (search-backward ">" nil t)
3021 (setq end (1+ (point)))
3022 (when (search-backward "<" nil t)
3023 (push (list (incf generation)
3024 child (setq child (buffer-substring (point) end))
3027 (push (list (1+ generation) child nil subject) relations)
3029 (kill-buffer (current-buffer)))
3030 ;; Sort over trustworthiness.
3031 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
3032 (while (setq relation (pop relations))
3033 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
3034 (unless (car (symbol-value cthread))
3035 ;; Make this article the parent of these threads.
3036 (setcar (symbol-value cthread)
3037 (vector gnus-reffed-article-number
3041 (or (caddr relation) "") 0 0 "")))
3042 (set cthread (list (vector gnus-reffed-article-number
3044 "" "" (cadr relation)
3045 (or (caddr relation) "") 0 0 ""))))
3046 (push gnus-reffed-article-number gnus-newsgroup-limit)
3047 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3048 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3049 gnus-newsgroup-reads)
3050 (decf gnus-reffed-article-number)
3051 ;; Make this new thread the child of its parent.
3052 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
3053 (setcdr (symbol-value pthread)
3054 (nconc (cdr (symbol-value pthread))
3055 (list (symbol-value cthread))))
3056 (set pthread (list nil (symbol-value cthread))))))
3057 (gnus-message 7 "Making sparse threads...done")))
3059 (defun gnus-build-old-threads ()
3060 ;; Look at all the articles that refer back to old articles, and
3061 ;; fetch the headers for the articles that aren't there. This will
3062 ;; build complete threads - if the roots haven't been expired by the
3067 (when (not (car (symbol-value refs)))
3068 (setq heads (cdr (symbol-value refs)))
3070 (if (memq (mail-header-number (caar heads))
3071 gnus-newsgroup-dormant)
3072 (setq heads (cdr heads))
3073 (setq id (symbol-name refs))
3074 (while (and (setq id (gnus-build-get-header id))
3075 (not (car (gnus-gethash
3076 id gnus-newsgroup-dependencies)))))
3077 (setq heads nil)))))
3078 gnus-newsgroup-dependencies)))
3080 (defun gnus-build-get-header (id)
3081 ;; Look through the buffer of NOV lines and find the header to
3082 ;; ID. Enter this line into the dependencies hash table, and return
3083 ;; the id of the parent article (if any).
3084 (let ((deps gnus-newsgroup-dependencies)
3088 (set-buffer nntp-server-buffer)
3089 (goto-char (point-min))
3090 (while (and (not found) (search-forward id nil t))
3092 (setq found (looking-at
3093 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3094 (regexp-quote id))))
3095 (or found (beginning-of-line 2)))
3099 (setq header (gnus-nov-parse-line
3100 (read (current-buffer)) deps))
3101 (gnus-parent-id (mail-header-references header)))))
3103 (let ((number (mail-header-number header)))
3104 (push number gnus-newsgroup-limit)
3105 (push header gnus-newsgroup-headers)
3106 (if (memq number gnus-newsgroup-unselected)
3108 (push number gnus-newsgroup-unreads)
3109 (setq gnus-newsgroup-unselected
3110 (delq number gnus-newsgroup-unselected)))
3111 (push number gnus-newsgroup-ancient)))))))
3113 (defun gnus-summary-update-article-line (article header)
3114 "Update the line for ARTICLE using HEADERS."
3115 (let* ((id (mail-header-id header))
3116 (thread (gnus-id-to-thread id)))
3118 (error "Article in no thread"))
3119 ;; Update the thread.
3120 (setcar thread header)
3121 (gnus-summary-goto-subject article)
3122 (let* ((datal (gnus-data-find-list article))
3124 (length (when (cdr datal)
3125 (- (gnus-data-pos data)
3126 (gnus-data-pos (cadr datal)))))
3127 (buffer-read-only nil)
3128 (level (gnus-summary-thread-level)))
3130 (gnus-summary-insert-line
3131 header level nil (gnus-article-mark article)
3132 (memq article gnus-newsgroup-replied)
3133 (memq article gnus-newsgroup-expirable)
3134 (mail-header-subject header)
3135 nil (cdr (assq article gnus-newsgroup-scored))
3136 (memq article gnus-newsgroup-processable))
3138 (gnus-data-update-list
3139 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3141 (defun gnus-summary-update-article (article &optional iheader)
3142 "Update ARTICLE in the summary buffer."
3143 (set-buffer gnus-summary-buffer)
3144 (let* ((header (or iheader (gnus-summary-article-header article)))
3145 (id (mail-header-id header))
3146 (data (gnus-data-find article))
3147 (thread (gnus-id-to-thread id))
3148 (references (mail-header-references header))
3152 (when (and references
3153 (not (equal "" references)))
3156 (buffer-read-only nil)
3158 (number (mail-header-number header))
3161 ;; !!! Should this be in or not?
3163 (setcar thread nil))
3165 (delq thread parent))
3166 (if (gnus-summary-insert-subject id header iheader)
3167 ;; Set the (possibly) new article number in the data structure.
3168 (gnus-data-set-number data (gnus-id-to-article id))
3172 (defun gnus-rebuild-thread (id)
3173 "Rebuild the thread containing ID."
3174 (let ((buffer-read-only nil)
3175 old-pos current thread data)
3176 (if (not gnus-show-threads)
3177 (setq thread (list (car (gnus-id-to-thread id))))
3178 ;; Get the thread this article is part of.
3179 (setq thread (gnus-remove-thread id)))
3180 (setq old-pos (gnus-point-at-bol))
3181 (setq current (save-excursion
3182 (and (zerop (forward-line -1))
3183 (gnus-summary-article-number))))
3184 ;; If this is a gathered thread, we have to go some re-gathering.
3185 (when (stringp (car thread))
3186 (let ((subject (car thread))
3188 (setq thread (cdr thread))
3190 (unless (memq (setq thr (gnus-id-to-thread
3192 (mail-header-id (caar thread)))))
3195 (setq thread (cdr thread)))
3196 ;; We now have all (unique) roots.
3197 (if (= (length roots) 1)
3198 ;; All the loose roots are now one solid root.
3199 (setq thread (car roots))
3200 (setq thread (cons subject (gnus-sort-threads roots))))))
3202 ;; We then insert this thread into the summary buffer.
3203 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3204 (if gnus-show-threads
3205 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3206 (gnus-summary-prepare-unthreaded thread))
3207 (setq data (nreverse gnus-newsgroup-data))
3208 (setq threads gnus-newsgroup-threads))
3209 ;; We splice the new data into the data structure.
3210 (gnus-data-enter-list current data (- (point) old-pos))
3211 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
3213 (defun gnus-number-to-header (number)
3214 "Return the header for article NUMBER."
3215 (let ((headers gnus-newsgroup-headers))
3217 (not (= number (mail-header-number (car headers)))))
3222 (defun gnus-parent-headers (headers &optional generation)
3223 "Return the headers of the GENERATIONeth parent of HEADERS."
3225 (setq generation 1))
3226 (let (references parent)
3227 (while (and headers (not (zerop generation)))
3228 (setq references (mail-header-references headers))
3229 (when (and references
3230 (setq parent (gnus-parent-id references))
3231 (setq headers (car (gnus-id-to-thread parent))))
3235 (defun gnus-id-to-thread (id)
3236 "Return the (sub-)thread where ID appears."
3237 (gnus-gethash id gnus-newsgroup-dependencies))
3239 (defun gnus-id-to-article (id)
3240 "Return the article number of ID."
3241 (let ((thread (gnus-id-to-thread id)))
3244 (mail-header-number (car thread)))))
3246 (defun gnus-id-to-header (id)
3247 "Return the article headers of ID."
3248 (car (gnus-id-to-thread id)))
3250 (defun gnus-article-displayed-root-p (article)
3251 "Say whether ARTICLE is a root(ish) article."
3252 (let ((level (gnus-summary-thread-level article))
3253 (refs (mail-header-references (gnus-summary-article-header article)))
3259 ((null (gnus-parent-id refs)) t)
3261 (null (setq particle (gnus-id-to-article
3262 (gnus-parent-id refs))))
3263 (null (gnus-summary-thread-level particle)))))))
3265 (defun gnus-root-id (id)
3266 "Return the id of the root of the thread where ID appears."
3268 (while (and id (setq prev (car (gnus-gethash
3269 id gnus-newsgroup-dependencies))))
3271 id (gnus-parent-id (mail-header-references prev))))
3274 (defun gnus-remove-thread (id &optional dont-remove)
3275 "Remove the thread that has ID in it."
3276 (let ((dep gnus-newsgroup-dependencies)
3277 headers thread last-id)
3278 ;; First go up in this thread until we find the root.
3279 (setq last-id (gnus-root-id id))
3280 (setq headers (list (car (gnus-id-to-thread last-id))
3281 (caadr (gnus-id-to-thread last-id))))
3282 ;; We have now found the real root of this thread. It might have
3283 ;; been gathered into some loose thread, so we have to search
3284 ;; through the threads to find the thread we wanted.
3285 (let ((threads gnus-newsgroup-threads)
3288 (setq sub (car threads))
3289 (if (stringp (car sub))
3290 ;; This is a gathered thread, so we look at the roots
3291 ;; below it to find whether this article is in this
3294 (setq sub (cdr sub))
3296 (when (member (caar sub) headers)
3297 (setq thread (car threads)
3300 (setq sub (cdr sub))))
3301 ;; It's an ordinary thread, so we check it.
3302 (when (eq (car sub) (car headers))
3305 (setq threads (cdr threads)))
3306 ;; If this article is in no thread, then it's a root.
3309 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3310 (setq thread (gnus-gethash last-id dep)))
3313 thread ; We return this thread.
3315 (if (stringp (car thread))
3317 ;; If we use dummy roots, then we have to remove the
3318 ;; dummy root as well.
3319 (when (eq gnus-summary-make-false-root 'dummy)
3322 (setq thread (cdr thread))
3324 (gnus-remove-thread-1 (car thread))
3325 (setq thread (cdr thread))))
3326 (gnus-remove-thread-1 thread))))))))
3328 (defun gnus-remove-thread-1 (thread)
3329 "Remove the thread THREAD recursively."
3330 (let ((number (mail-header-number (pop thread)))
3332 (setq thread (reverse thread))
3334 (gnus-remove-thread-1 (pop thread)))
3335 (when (setq d (gnus-data-find number))
3336 (goto-char (gnus-data-pos d))
3339 (- (gnus-point-at-bol)
3341 (1+ (gnus-point-at-eol))
3342 (gnus-delete-line)))))))
3344 (defun gnus-sort-threads (threads)
3346 (if (not gnus-thread-sort-functions)
3348 (gnus-message 7 "Sorting threads...")
3350 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3351 (gnus-message 7 "Sorting threads...done"))))
3353 (defun gnus-sort-articles (articles)
3355 (when gnus-article-sort-functions
3356 (gnus-message 7 "Sorting articles...")
3358 (setq gnus-newsgroup-headers
3359 (sort articles (gnus-make-sort-function
3360 gnus-article-sort-functions)))
3361 (gnus-message 7 "Sorting articles...done"))))
3363 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3364 (defmacro gnus-thread-header (thread)
3365 ;; Return header of first article in THREAD.
3366 ;; Note that THREAD must never, ever be anything else than a variable -
3367 ;; using some other form will lead to serious barfage.
3368 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3369 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3370 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3373 (defsubst gnus-article-sort-by-number (h1 h2)
3374 "Sort articles by article number."
3375 (< (mail-header-number h1)
3376 (mail-header-number h2)))
3378 (defun gnus-thread-sort-by-number (h1 h2)
3379 "Sort threads by root article number."
3380 (gnus-article-sort-by-number
3381 (gnus-thread-header h1) (gnus-thread-header h2)))
3383 (defsubst gnus-article-sort-by-lines (h1 h2)
3384 "Sort articles by article Lines header."
3385 (< (mail-header-lines h1)
3386 (mail-header-lines h2)))
3388 (defun gnus-thread-sort-by-lines (h1 h2)
3389 "Sort threads by root article Lines header."
3390 (gnus-article-sort-by-lines
3391 (gnus-thread-header h1) (gnus-thread-header h2)))
3393 (defsubst gnus-article-sort-by-author (h1 h2)
3394 "Sort articles by root author."
3396 (let ((extract (funcall
3397 gnus-extract-address-components
3398 (mail-header-from h1))))
3399 (or (car extract) (cdr extract)))
3400 (let ((extract (funcall
3401 gnus-extract-address-components
3402 (mail-header-from h2))))
3403 (or (car extract) (cdr extract)))))
3405 (defun gnus-thread-sort-by-author (h1 h2)
3406 "Sort threads by root author."
3407 (gnus-article-sort-by-author
3408 (gnus-thread-header h1) (gnus-thread-header h2)))
3410 (defsubst gnus-article-sort-by-subject (h1 h2)
3411 "Sort articles by root subject."
3413 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3414 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3416 (defun gnus-thread-sort-by-subject (h1 h2)
3417 "Sort threads by root subject."
3418 (gnus-article-sort-by-subject
3419 (gnus-thread-header h1) (gnus-thread-header h2)))
3421 (defsubst gnus-article-sort-by-date (h1 h2)
3422 "Sort articles by root article date."
3424 (gnus-date-get-time (mail-header-date h1))
3425 (gnus-date-get-time (mail-header-date h2))))
3427 (defun gnus-thread-sort-by-date (h1 h2)
3428 "Sort threads by root article date."
3429 (gnus-article-sort-by-date
3430 (gnus-thread-header h1) (gnus-thread-header h2)))
3432 (defsubst gnus-article-sort-by-score (h1 h2)
3433 "Sort articles by root article score.
3434 Unscored articles will be counted as having a score of zero."
3435 (> (or (cdr (assq (mail-header-number h1)
3436 gnus-newsgroup-scored))
3437 gnus-summary-default-score 0)
3438 (or (cdr (assq (mail-header-number h2)
3439 gnus-newsgroup-scored))
3440 gnus-summary-default-score 0)))
3442 (defun gnus-thread-sort-by-score (h1 h2)
3443 "Sort threads by root article score."
3444 (gnus-article-sort-by-score
3445 (gnus-thread-header h1) (gnus-thread-header h2)))
3447 (defun gnus-thread-sort-by-total-score (h1 h2)
3448 "Sort threads by the sum of all scores in the thread.
3449 Unscored articles will be counted as having a score of zero."
3450 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3452 (defun gnus-thread-total-score (thread)
3453 ;; This function find the total score of THREAD.
3454 (cond ((null thread)
3457 (if (stringp (car thread))
3458 (apply gnus-thread-score-function 0
3459 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3460 (gnus-thread-total-score-1 thread)))
3462 (gnus-thread-total-score-1 (list thread)))))
3464 (defun gnus-thread-total-score-1 (root)
3465 ;; This function find the total score of the thread below ROOT.
3466 (setq root (car root))
3467 (apply gnus-thread-score-function
3469 (mapcar 'gnus-thread-total-score
3470 (cdr (gnus-gethash (mail-header-id root)
3471 gnus-newsgroup-dependencies)))
3472 (when (> (mail-header-number root) 0)
3473 (list (or (cdr (assq (mail-header-number root)
3474 gnus-newsgroup-scored))
3475 gnus-summary-default-score 0))))
3476 (list gnus-summary-default-score)
3479 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3480 (defvar gnus-tmp-prev-subject nil)
3481 (defvar gnus-tmp-false-parent nil)
3482 (defvar gnus-tmp-root-expunged nil)
3483 (defvar gnus-tmp-dummy-line nil)
3485 (defun gnus-summary-prepare-threads (threads)
3486 "Prepare summary buffer from THREADS and indentation LEVEL.
3487 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3488 or a straight list of headers."
3489 (gnus-message 7 "Generating summary...")
3491 (setq gnus-newsgroup-threads threads)
3494 (let ((gnus-tmp-level 0)
3495 (default-score (or gnus-summary-default-score 0))
3496 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3497 thread number subject stack state gnus-tmp-gathered beg-match
3498 new-roots gnus-tmp-new-adopts thread-end
3499 gnus-tmp-header gnus-tmp-unread
3500 gnus-tmp-replied gnus-tmp-subject-or-nil
3501 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3502 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3503 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3505 (setq gnus-tmp-prev-subject nil)
3507 (if (vectorp (car threads))
3508 ;; If this is a straight (sic) list of headers, then a
3509 ;; threaded summary display isn't required, so we just create
3510 ;; an unthreaded one.
3511 (gnus-summary-prepare-unthreaded threads)
3513 ;; Do the threaded display.
3515 (while (or threads stack gnus-tmp-new-adopts new-roots)
3517 (if (and (= gnus-tmp-level 0)
3518 (not (setq gnus-tmp-dummy-line nil))
3521 (not gnus-tmp-false-parent)
3522 (or gnus-tmp-new-adopts new-roots))
3523 (if gnus-tmp-new-adopts
3524 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3525 thread (list (car gnus-tmp-new-adopts))
3526 gnus-tmp-header (caar thread)
3527 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3529 (setq thread (list (car new-roots))
3530 gnus-tmp-header (caar thread)
3531 new-roots (cdr new-roots))))
3534 ;; If there are some threads, we do them before the
3535 ;; threads on the stack.
3536 (setq thread threads
3537 gnus-tmp-header (caar thread))
3538 ;; There were no current threads, so we pop something off
3540 (setq state (car stack)
3541 gnus-tmp-level (car state)
3544 gnus-tmp-header (caar thread))))
3546 (setq gnus-tmp-false-parent nil)
3547 (setq gnus-tmp-root-expunged nil)
3548 (setq thread-end nil)
3550 (if (stringp gnus-tmp-header)
3551 ;; The header is a dummy root.
3553 ((eq gnus-summary-make-false-root 'adopt)
3554 ;; We let the first article adopt the rest.
3555 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3557 (setq gnus-tmp-gathered
3559 (lambda (h) (mail-header-number (car h)))
3562 (setq thread (cons (list (caar thread)
3565 (setq gnus-tmp-level -1
3566 gnus-tmp-false-parent t))
3567 ((eq gnus-summary-make-false-root 'empty)
3568 ;; We print adopted articles with empty subject fields.
3569 (setq gnus-tmp-gathered
3571 (lambda (h) (mail-header-number (car h)))
3574 (setq gnus-tmp-level -1))
3575 ((eq gnus-summary-make-false-root 'dummy)
3576 ;; We remember that we probably want to output a dummy
3578 (setq gnus-tmp-dummy-line gnus-tmp-header)
3579 (setq gnus-tmp-prev-subject gnus-tmp-header))
3581 ;; We do not make a root for the gathered
3582 ;; sub-threads at all.
3583 (setq gnus-tmp-level -1)))
3585 (setq number (mail-header-number gnus-tmp-header)
3586 subject (mail-header-subject gnus-tmp-header))
3589 ;; If the thread has changed subject, we might want to make
3590 ;; this subthread into a root.
3591 ((and (null gnus-thread-ignore-subject)
3592 (not (zerop gnus-tmp-level))
3593 gnus-tmp-prev-subject
3595 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3596 (setq new-roots (nconc new-roots (list (car thread)))
3598 gnus-tmp-header nil))
3599 ;; If the article lies outside the current limit,
3600 ;; then we do not display it.
3601 ((not (memq number gnus-newsgroup-limit))
3602 (setq gnus-tmp-gathered
3604 (lambda (h) (mail-header-number (car h)))
3607 (setq gnus-tmp-new-adopts (if (cdar thread)
3608 (append gnus-tmp-new-adopts
3610 gnus-tmp-new-adopts)
3612 gnus-tmp-header nil)
3613 (when (zerop gnus-tmp-level)
3614 (setq gnus-tmp-root-expunged t)))
3615 ;; Perhaps this article is to be marked as read?
3616 ((and gnus-summary-mark-below
3617 (< (or (cdr (assq number gnus-newsgroup-scored))
3619 gnus-summary-mark-below)
3620 ;; Don't touch sparse articles.
3621 (not (gnus-summary-article-sparse-p number))
3622 (not (gnus-summary-article-ancient-p number)))
3623 (setq gnus-newsgroup-unreads
3624 (delq number gnus-newsgroup-unreads))
3625 (if gnus-newsgroup-auto-expire
3626 (push number gnus-newsgroup-expirable)
3627 (push (cons number gnus-low-score-mark)
3628 gnus-newsgroup-reads))))
3630 (when gnus-tmp-header
3631 ;; We may have an old dummy line to output before this
3633 (when gnus-tmp-dummy-line
3634 (gnus-summary-insert-dummy-line
3635 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3636 (setq gnus-tmp-dummy-line nil))
3638 ;; Compute the mark.
3639 (setq gnus-tmp-unread (gnus-article-mark number))
3641 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3642 gnus-tmp-header gnus-tmp-level)
3643 gnus-newsgroup-data)
3645 ;; Actually insert the line.
3647 gnus-tmp-subject-or-nil
3649 ((and gnus-thread-ignore-subject
3650 gnus-tmp-prev-subject
3651 (not (inline (gnus-subject-equal
3652 gnus-tmp-prev-subject subject))))
3654 ((zerop gnus-tmp-level)
3655 (if (and (eq gnus-summary-make-false-root 'empty)
3656 (memq number gnus-tmp-gathered)
3657 gnus-tmp-prev-subject
3658 (inline (gnus-subject-equal
3659 gnus-tmp-prev-subject subject)))
3660 gnus-summary-same-subject
3662 (t gnus-summary-same-subject)))
3663 (if (and (eq gnus-summary-make-false-root 'adopt)
3664 (= gnus-tmp-level 1)
3665 (memq number gnus-tmp-gathered))
3666 (setq gnus-tmp-opening-bracket ?\<
3667 gnus-tmp-closing-bracket ?\>)
3668 (setq gnus-tmp-opening-bracket ?\[
3669 gnus-tmp-closing-bracket ?\]))
3671 gnus-tmp-indentation
3672 (aref gnus-thread-indent-array gnus-tmp-level)
3673 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3674 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3675 gnus-summary-default-score 0)
3677 (if (or (null gnus-summary-default-score)
3678 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3679 gnus-summary-zcore-fuzz))
3681 (if (< gnus-tmp-score gnus-summary-default-score)
3682 gnus-score-below-mark gnus-score-over-mark))
3684 (cond ((memq number gnus-newsgroup-processable)
3686 ((memq number gnus-newsgroup-cached)
3688 ((memq number gnus-newsgroup-replied)
3690 ((memq number gnus-newsgroup-saved)
3692 (t gnus-unread-mark))
3693 gnus-tmp-from (mail-header-from gnus-tmp-header)
3696 ((string-match "<[^>]+> *$" gnus-tmp-from)
3697 (setq beg-match (match-beginning 0))
3698 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3699 (substring gnus-tmp-from (1+ (match-beginning 0))
3700 (1- (match-end 0))))
3701 (substring gnus-tmp-from 0 beg-match)))
3702 ((string-match "(.+)" gnus-tmp-from)
3703 (substring gnus-tmp-from
3704 (1+ (match-beginning 0)) (1- (match-end 0))))
3706 (when (string= gnus-tmp-name "")
3707 (setq gnus-tmp-name gnus-tmp-from))
3708 (unless (numberp gnus-tmp-lines)
3709 (setq gnus-tmp-lines 0))
3710 (gnus-put-text-property
3712 (progn (eval gnus-summary-line-format-spec) (point))
3713 'gnus-number number)
3716 (run-hooks 'gnus-summary-update-hook)
3719 (setq gnus-tmp-prev-subject subject)))
3721 (when (nth 1 thread)
3722 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3723 (incf gnus-tmp-level)
3724 (setq threads (if thread-end nil (cdar thread)))
3726 (setq gnus-tmp-level 0)))))
3727 (gnus-message 7 "Generating summary...done"))
3729 (defun gnus-summary-prepare-unthreaded (headers)
3730 "Generate an unthreaded summary buffer based on HEADERS."
3731 (let (header number mark)
3734 ;; We may have to root out some bad articles...
3735 (when (memq (setq number (mail-header-number
3736 (setq header (pop headers))))
3737 gnus-newsgroup-limit)
3738 ;; Mark article as read when it has a low score.
3739 (when (and gnus-summary-mark-below
3740 (< (or (cdr (assq number gnus-newsgroup-scored))
3741 gnus-summary-default-score 0)
3742 gnus-summary-mark-below)
3743 (not (gnus-summary-article-ancient-p number)))
3744 (setq gnus-newsgroup-unreads
3745 (delq number gnus-newsgroup-unreads))
3746 (if gnus-newsgroup-auto-expire
3747 (push number gnus-newsgroup-expirable)
3748 (push (cons number gnus-low-score-mark)
3749 gnus-newsgroup-reads)))
3751 (setq mark (gnus-article-mark number))
3752 (push (gnus-data-make number mark (1+ (point)) header 0)
3753 gnus-newsgroup-data)
3754 (gnus-summary-insert-line
3756 mark (memq number gnus-newsgroup-replied)
3757 (memq number gnus-newsgroup-expirable)
3758 (mail-header-subject header) nil
3759 (cdr (assq number gnus-newsgroup-scored))
3760 (memq number gnus-newsgroup-processable))))))
3762 (defun gnus-select-newsgroup (group &optional read-all)
3763 "Select newsgroup GROUP.
3764 If READ-ALL is non-nil, all articles in the group are selected."
3765 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3766 (info (nth 2 entry))
3767 articles fetched-articles cached)
3769 (unless (gnus-check-server
3770 (setq gnus-current-select-method (gnus-find-method-for-group group)))
3771 (error "Couldn't open server"))
3773 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3774 (gnus-activate-group group) ; Or we can activate it...
3775 (progn ; Or we bug out.
3776 (when (equal major-mode 'gnus-summary-mode)
3777 (kill-buffer (current-buffer)))
3778 (error "Couldn't request group %s: %s"
3779 group (gnus-status-message group))))
3781 (unless (gnus-request-group group t)
3782 (when (equal major-mode 'gnus-summary-mode)
3783 (kill-buffer (current-buffer)))
3784 (error "Couldn't request group %s: %s"
3785 group (gnus-status-message group)))
3787 (setq gnus-newsgroup-name group)
3788 (setq gnus-newsgroup-unselected nil)
3789 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3791 ;; Adjust and set lists of article marks.
3793 (gnus-adjust-marked-articles info))
3795 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3796 (when (gnus-virtual-group-p group)
3797 (setq cached gnus-newsgroup-cached))
3799 (setq gnus-newsgroup-unreads
3800 (gnus-set-difference
3801 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3802 gnus-newsgroup-dormant))
3804 (setq gnus-newsgroup-processable nil)
3806 (setq articles (gnus-articles-to-read group read-all))
3810 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3812 ((eq articles 0) nil)
3814 ;; Init the dependencies hash table.
3815 (setq gnus-newsgroup-dependencies
3816 (gnus-make-hashtable (length articles)))
3817 ;; Retrieve the headers and read them in.
3818 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
3819 (setq gnus-newsgroup-headers
3821 (setq gnus-headers-retrieved-by
3822 (gnus-retrieve-headers
3823 articles gnus-newsgroup-name
3824 ;; We might want to fetch old headers, but
3825 ;; not if there is only 1 article.
3826 (and gnus-fetch-old-headers
3828 (not (eq gnus-fetch-old-headers 'some))
3829 (not (numberp gnus-fetch-old-headers)))
3830 (> (length articles) 1))))))
3831 (gnus-get-newsgroup-headers-xover articles)
3832 (gnus-get-newsgroup-headers)))
3833 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
3835 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3837 (setq gnus-newsgroup-cached cached))
3839 ;; Suppress duplicates?
3840 (when gnus-suppress-duplicates
3841 (gnus-dup-suppress-articles))
3843 ;; Set the initial limit.
3844 (setq gnus-newsgroup-limit (copy-sequence articles))
3845 ;; Remove canceled articles from the list of unread articles.
3846 (setq gnus-newsgroup-unreads
3847 (gnus-set-sorted-intersection
3848 gnus-newsgroup-unreads
3849 (setq fetched-articles
3850 (mapcar (lambda (headers) (mail-header-number headers))
3851 gnus-newsgroup-headers))))
3852 ;; Removed marked articles that do not exist.
3853 (gnus-update-missing-marks
3854 (gnus-sorted-complement fetched-articles articles))
3855 ;; We might want to build some more threads first.
3856 (and gnus-fetch-old-headers
3857 (eq gnus-headers-retrieved-by 'nov)
3858 (gnus-build-old-threads))
3859 ;; Check whether auto-expire is to be done in this group.
3860 (setq gnus-newsgroup-auto-expire
3861 (gnus-group-auto-expirable-p group))
3862 ;; Set up the article buffer now, if necessary.
3863 (unless gnus-single-article-buffer
3864 (gnus-article-setup-buffer))
3865 ;; First and last article in this newsgroup.
3866 (when gnus-newsgroup-headers
3867 (setq gnus-newsgroup-begin
3868 (mail-header-number (car gnus-newsgroup-headers))
3871 (gnus-last-element gnus-newsgroup-headers))))
3872 ;; GROUP is successfully selected.
3873 (or gnus-newsgroup-headers t)))))
3875 (defun gnus-articles-to-read (group &optional read-all)
3876 ;; Find out what articles the user wants to read.
3878 ;; Select all articles if `read-all' is non-nil, or if there
3879 ;; are no unread articles.
3881 (and (zerop (length gnus-newsgroup-marked))
3882 (zerop (length gnus-newsgroup-unreads)))
3883 (eq (gnus-group-find-parameter group 'display)
3885 (gnus-uncompress-range (gnus-active group))
3886 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
3887 (copy-sequence gnus-newsgroup-unreads))
3889 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
3890 (scored (length scored-list))
3891 (number (length articles))
3892 (marked (+ (length gnus-newsgroup-marked)
3893 (length gnus-newsgroup-dormant)))
3901 ((and (or (<= scored marked) (= scored number))
3902 (numberp gnus-large-newsgroup)
3903 (> number gnus-large-newsgroup))
3907 "How many articles from %s (default %d): "
3908 gnus-newsgroup-name number))))
3909 (if (string-match "^[ \t]*$" input) number input)))
3910 ((and (> scored marked) (< scored number)
3911 (> (- scored number) 20))
3914 (format "%s %s (%d scored, %d total): "
3915 "How many articles from"
3916 group scored number))))
3917 (if (string-match "^[ \t]*$" input)
3921 (setq select (if (stringp select) (string-to-number select) select))
3922 (if (or (null select) (zerop select))
3924 (if (and (not (zerop scored)) (<= (abs select) scored))
3926 (setq articles (sort scored-list '<))
3927 (setq number (length articles)))
3928 (setq articles (copy-sequence articles)))
3930 (when (< (abs select) number)
3932 ;; Select the N oldest articles.
3933 (setcdr (nthcdr (1- (abs select)) articles) nil)
3934 ;; Select the N most recent articles.
3935 (setq articles (nthcdr (- number select) articles))))
3936 (setq gnus-newsgroup-unselected
3937 (gnus-sorted-intersection
3938 gnus-newsgroup-unreads
3939 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3942 (defun gnus-killed-articles (killed articles)
3945 (when (inline (gnus-member-of-range (car articles) killed))
3946 (push (car articles) out))
3947 (setq articles (cdr articles)))
3950 (defun gnus-uncompress-marks (marks)
3951 "Uncompress the mark ranges in MARKS."
3952 (let ((uncompressed '(score bookmark))
3955 (if (memq (caar marks) uncompressed)
3956 (push (car marks) out)
3957 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
3958 (setq marks (cdr marks)))
3961 (defun gnus-adjust-marked-articles (info)
3962 "Set all article lists and remove all marks that are no longer legal."
3963 (let* ((marked-lists (gnus-info-marks info))
3964 (active (gnus-active (gnus-info-group info)))
3967 (types gnus-article-mark-lists)
3968 (uncompressed '(score bookmark killed))
3969 marks var articles article mark)
3972 (setq marks (pop marked-lists))
3973 (set (setq var (intern (format "gnus-newsgroup-%s"
3974 (car (rassq (setq mark (car marks))
3976 (if (memq (car marks) uncompressed) (cdr marks)
3977 (gnus-uncompress-range (cdr marks))))
3979 (setq articles (symbol-value var))
3981 ;; All articles have to be subsets of the active articles.
3983 ;; Adjust "simple" lists.
3984 ((memq mark '(tick dormant expirable reply save))
3986 (when (or (< (setq article (pop articles)) min) (> article max))
3987 (set var (delq article (symbol-value var))))))
3989 ((memq mark uncompressed)
3991 (when (or (not (consp (setq article (pop articles))))
3992 (< (car article) min)
3993 (> (car article) max))
3994 (set var (delq article (symbol-value var))))))))))
3996 (defun gnus-update-missing-marks (missing)
3997 "Go through the list of MISSING articles and remove them mark lists."
3999 (let ((types gnus-article-mark-lists)
4001 ;; Go through all types.
4003 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4004 (when (symbol-value var)
4005 ;; This list has articles. So we delete all missing articles
4009 (set var (delq (pop m) (symbol-value var)))))))))
4011 (defun gnus-update-marks ()
4012 "Enter the various lists of marked articles into the newsgroup info list."
4013 (let ((types gnus-article-mark-lists)
4014 (info (gnus-get-info gnus-newsgroup-name))
4015 (uncompressed '(score bookmark killed))
4016 type list newmarked symbol)
4018 ;; Add all marks lists that are non-nil to the list of marks lists.
4020 (setq type (pop types))
4021 (when (setq list (symbol-value
4023 (intern (format "gnus-newsgroup-%s"
4025 (push (cons (cdr type)
4026 (if (memq (cdr type) uncompressed) list
4027 (gnus-compress-sequence
4028 (set symbol (sort list '<)) t)))
4031 ;; Enter these new marks into the info of the group.
4033 (setcar (nthcdr 3 info) newmarked)
4034 ;; Add the marks lists to the end of the info.
4036 (setcdr (nthcdr 2 info) (list newmarked))))
4038 ;; Cut off the end of the info if there's nothing else there.
4042 (when (nthcdr (decf i) info)
4043 (setcdr (nthcdr i info) nil)))))))
4045 (defun gnus-set-mode-line (where)
4046 "This function sets the mode line of the article or summary buffers.
4047 If WHERE is `summary', the summary mode line format will be used."
4048 ;; Is this mode line one we keep updated?
4049 (when (memq where gnus-updated-mode-lines)
4052 ;; We evaluate this in the summary buffer since these
4053 ;; variables are buffer-local to that buffer.
4054 (set-buffer gnus-summary-buffer)
4055 ;; We bind all these variables that are used in the `eval' form
4057 (let* ((mformat (symbol-value
4059 (format "gnus-%s-mode-line-format-spec" where))))
4060 (gnus-tmp-group-name gnus-newsgroup-name)
4061 (gnus-tmp-article-number (or gnus-current-article 0))
4062 (gnus-tmp-unread gnus-newsgroup-unreads)
4063 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4064 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4065 (gnus-tmp-unread-and-unselected
4066 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4067 (zerop gnus-tmp-unselected))
4069 ((zerop gnus-tmp-unselected)
4070 (format "{%d more}" gnus-tmp-unread-and-unticked))
4071 (t (format "{%d(+%d) more}"
4072 gnus-tmp-unread-and-unticked
4073 gnus-tmp-unselected))))
4075 (if (and gnus-current-headers
4076 (vectorp gnus-current-headers))
4077 (gnus-mode-string-quote
4078 (mail-header-subject gnus-current-headers))
4081 gnus-tmp-header);; passed as argument to any user-format-funcs
4082 (setq mode-string (eval mformat))
4083 (setq max-len (max 4 (if gnus-mode-non-string-length
4085 gnus-mode-non-string-length)
4086 (length mode-string))))
4087 ;; We might have to chop a bit of the string off...
4088 (when (> (length mode-string) max-len)
4090 (concat (gnus-truncate-string mode-string (- max-len 3))
4092 ;; Pad the mode string a bit.
4093 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4094 ;; Update the mode line.
4095 (setq mode-line-buffer-identification
4096 (gnus-mode-line-buffer-identification
4097 (list mode-string)))
4098 (set-buffer-modified-p t))))
4100 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4101 "Go through the HEADERS list and add all Xrefs to a hash table.
4102 The resulting hash table is returned, or nil if no Xrefs were found."
4103 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4104 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4105 (xref-hashtb (make-vector 63 0))
4106 start group entry number xrefs header)
4108 (setq header (pop headers))
4109 (when (and (setq xrefs (mail-header-xref header))
4110 (not (memq (setq number (mail-header-number header))
4113 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4114 (setq start (match-end 0))
4115 (setq group (if prefix
4116 (concat prefix (substring xrefs (match-beginning 1)
4118 (substring xrefs (match-beginning 1) (match-end 1))))
4120 (string-to-int (substring xrefs (match-beginning 2)
4122 (if (setq entry (gnus-gethash group xref-hashtb))
4123 (setcdr entry (cons number (cdr entry)))
4124 (gnus-sethash group (cons number nil) xref-hashtb)))))
4125 (and start xref-hashtb)))
4127 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4128 "Look through all the headers and mark the Xrefs as read."
4129 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4130 name entry info xref-hashtb idlist method nth4)
4132 (set-buffer gnus-group-buffer)
4133 (when (setq xref-hashtb
4134 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4137 (unless (string= from-newsgroup (setq name (symbol-name group)))
4138 (setq idlist (symbol-value group))
4139 ;; Dead groups are not updated.
4141 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4143 (when (stringp (setq nth4 (gnus-info-method info)))
4144 (setq nth4 (gnus-server-to-method nth4))))
4145 ;; Only do the xrefs if the group has the same
4146 ;; select method as the group we have just read.
4147 (or (gnus-methods-equal-p
4148 nth4 (gnus-find-method-for-group from-newsgroup))
4150 (equal nth4 (setq method (gnus-find-method-for-group
4152 (and (equal (car nth4) (car method))
4153 (equal (nth 1 nth4) (nth 1 method))))
4154 gnus-use-cross-reference
4155 (or (not (eq gnus-use-cross-reference t))
4157 ;; Only do cross-references on subscribed
4158 ;; groups, if that is what is wanted.
4159 (<= (gnus-info-level info) gnus-level-subscribed))
4160 (gnus-group-make-articles-read name idlist))))
4163 (defun gnus-group-make-articles-read (group articles)
4164 "Update the info of GROUP to say that only ARTICLES are unread."
4166 (entry (gnus-gethash group gnus-newsrc-hashtb))
4167 (info (nth 2 entry))
4168 (active (gnus-active group))
4170 ;; First peel off all illegal article numbers.
4172 (let ((ids articles)
4174 (while (setq id (pop ids))
4175 (when (and first (> id (cdr active)))
4176 ;; We'll end up in this situation in one particular
4177 ;; obscure situation. If you re-scan a group and get
4178 ;; a new article that is cross-posted to a different
4179 ;; group that has not been re-scanned, you might get
4180 ;; crossposted article that has a higher number than
4181 ;; Gnus believes possible. So we re-activate this
4182 ;; group as well. This might mean doing the
4183 ;; crossposting thingy will *increase* the number
4184 ;; of articles in some groups. Tsk, tsk.
4185 (setq active (or (gnus-activate-group group) active)))
4186 (when (or (> id (cdr active))
4187 (< id (car active)))
4188 (setq articles (delq id articles))))))
4190 (set-buffer gnus-group-buffer)
4193 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4194 (gnus-info-set-read ',info ',(gnus-info-read info))
4195 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4196 (gnus-group-update-group ,group t))))
4197 ;; If the read list is nil, we init it.
4199 (null (gnus-info-read info))
4201 (gnus-info-set-read info (cons 1 (1- (car active)))))
4202 ;; Then we add the read articles to the range.
4207 (gnus-info-read info) (setq articles (sort articles '<)))))
4208 ;; Then we have to re-compute how many unread
4209 ;; articles there are in this group.
4213 (setq num (- (1+ (cdr active)) (car active))))
4214 ((not (listp (cdr range)))
4215 (setq num (- (cdr active) (- (1+ (cdr range))
4219 (if (numberp (car range))
4221 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4222 (setq range (cdr range)))
4223 (setq num (- (cdr active) num))))
4224 ;; Update the number of unread articles.
4226 ;; Update the group buffer.
4227 (gnus-group-update-group group t))))
4229 (defun gnus-methods-equal-p (m1 m2)
4230 (let ((m1 (or m1 gnus-select-method))
4231 (m2 (or m2 gnus-select-method)))
4233 (and (eq (car m1) (car m2))
4234 (or (not (memq 'address (assoc (symbol-name (car m1))
4235 gnus-valid-select-methods)))
4236 (equal (nth 1 m1) (nth 1 m2)))))))
4238 (defvar gnus-newsgroup-none-id 0)
4240 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4241 (let ((cur nntp-server-buffer)
4244 (save-excursion (set-buffer gnus-summary-buffer)
4245 gnus-newsgroup-dependencies)))
4246 headers id id-dep ref-dep end ref)
4248 (set-buffer nntp-server-buffer)
4249 ;; Translate all TAB characters into SPACE characters.
4250 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4251 (run-hooks 'gnus-parse-headers-hook)
4252 (let ((case-fold-search t)
4253 in-reply-to header p lines)
4254 (goto-char (point-min))
4255 ;; Search to the beginning of the next header. Error messages
4256 ;; do not begin with 2 or 3.
4257 (while (re-search-forward "^[23][0-9]+ " nil t)
4260 ;; This implementation of this function, with nine
4261 ;; search-forwards instead of the one re-search-forward and
4262 ;; a case (which basically was the old function) is actually
4263 ;; about twice as fast, even though it looks messier. You
4264 ;; can't have everything, I guess. Speed and elegance
4265 ;; doesn't always go hand in hand.
4274 (narrow-to-region (point)
4275 (or (and (search-forward "\n.\n" nil t)
4281 (if (search-forward "\nsubject: " nil t)
4282 (nnheader-header-value) "(none)"))
4286 (if (search-forward "\nfrom: " nil t)
4287 (nnheader-header-value) "(nobody)"))
4291 (if (search-forward "\ndate: " nil t)
4292 (nnheader-header-value) ""))
4296 (setq id (if (search-forward "\nmessage-id: " nil t)
4297 (nnheader-header-value)
4298 ;; If there was no message-id, we just fake one
4299 ;; to make subsequent routines simpler.
4300 (nnheader-generate-fake-message-id))))
4304 (if (search-forward "\nreferences: " nil t)
4308 (nnheader-header-value)
4313 (search-backward ">" end t)
4316 (search-backward "<" end t)
4318 ;; Get the references from the in-reply-to header if there
4319 ;; were no references and the in-reply-to header looks
4321 (if (and (search-forward "\nin-reply-to: " nil t)
4322 (setq in-reply-to (nnheader-header-value))
4323 (string-match "<[^>]+>" in-reply-to))
4324 (setq ref (substring in-reply-to (match-beginning 0)
4332 (if (search-forward "\nlines: " nil t)
4333 (if (numberp (setq lines (read cur)))
4339 (and (search-forward "\nxref: " nil t)
4340 (nnheader-header-value)))))
4341 (when (equal id ref)
4343 ;; We do the threading while we read the headers. The
4344 ;; message-id and the last reference are both entered into
4345 ;; the same hash table. Some tippy-toeing around has to be
4346 ;; done in case an article has arrived before the article
4347 ;; which it refers to.
4348 (if (boundp (setq id-dep (intern id dependencies)))
4349 (if (and (car (symbol-value id-dep))
4351 ;; An article with this Message-ID has already
4352 ;; been seen, so we ignore this one, except we add
4353 ;; any additional Xrefs (in case the two articles
4354 ;; came from different servers).
4356 (mail-header-set-xref
4357 (car (symbol-value id-dep))
4358 (concat (or (mail-header-xref
4359 (car (symbol-value id-dep)))
4361 (or (mail-header-xref header) "")))
4363 (setcar (symbol-value id-dep) header))
4364 (set id-dep (list header)))
4366 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4367 (setcdr (symbol-value ref-dep)
4368 (nconc (cdr (symbol-value ref-dep))
4369 (list (symbol-value id-dep))))
4370 (set ref-dep (list nil (symbol-value id-dep))))
4371 (push header headers))
4372 (goto-char (point-max))
4374 (nreverse headers)))))
4376 ;; The following macros and functions were written by Felix Lee
4377 ;; <flee@cse.psu.edu>.
4379 (defmacro gnus-nov-read-integer ()
4381 (if (= (following-char) ?\t)
4383 (let ((num (ignore-errors (read buffer))))
4384 (if (numberp num) num 0)))
4388 (defmacro gnus-nov-skip-field ()
4389 '(search-forward "\t" eol 'move))
4391 (defmacro gnus-nov-field ()
4392 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
4394 ;; (defvar gnus-nov-none-counter 0)
4396 ;; This function has to be called with point after the article number
4397 ;; on the beginning of the line.
4398 (defun gnus-nov-parse-line (number dependencies &optional force-new)
4399 (let ((eol (gnus-point-at-eol))
4400 (buffer (current-buffer))
4401 header ref id id-dep ref-dep)
4403 ;; overview: [num subject from date id refs chars lines misc]
4406 (narrow-to-region (point) eol)
4413 (gnus-nov-field) ; subject
4414 (gnus-nov-field) ; from
4415 (gnus-nov-field) ; date
4416 (setq id (or (gnus-nov-field)
4417 (nnheader-generate-fake-message-id))) ; id
4419 (let ((beg (point)))
4420 (search-forward "\t" eol)
4421 (if (search-backward ">" beg t)
4425 (search-backward "<" beg t)))
4428 (gnus-nov-field)) ; refs
4429 (gnus-nov-read-integer) ; chars
4430 (gnus-nov-read-integer) ; lines
4431 (if (= (following-char) ?\n)
4433 (gnus-nov-field)) ; misc
4438 ;; We build the thread tree.
4439 (when (equal id ref)
4440 ;; This article refers back to itself. Naughty, naughty.
4442 (if (boundp (setq id-dep (intern id dependencies)))
4443 (if (and (car (symbol-value id-dep))
4445 ;; An article with this Message-ID has already been seen,
4446 ;; so we ignore this one, except we add any additional
4447 ;; Xrefs (in case the two articles came from different
4450 (mail-header-set-xref
4451 (car (symbol-value id-dep))
4452 (concat (or (mail-header-xref
4453 (car (symbol-value id-dep)))
4455 (or (mail-header-xref header) "")))
4457 (setcar (symbol-value id-dep) header))
4458 (set id-dep (list header)))
4460 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
4461 (setcdr (symbol-value ref-dep)
4462 (nconc (cdr (symbol-value ref-dep))
4463 (list (symbol-value id-dep))))
4464 (set ref-dep (list nil (symbol-value id-dep)))))
4467 ;; Goes through the xover lines and returns a list of vectors
4468 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4469 force-new dependencies)
4470 "Parse the news overview data in the server buffer, and return a
4471 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4472 ;; Get the Xref when the users reads the articles since most/some
4473 ;; NNTP servers do not include Xrefs when using XOVER.
4474 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4475 (let ((cur nntp-server-buffer)
4476 (dependencies (or dependencies gnus-newsgroup-dependencies))
4477 number headers header)
4479 (set-buffer nntp-server-buffer)
4480 ;; Allow the user to mangle the headers before parsing them.
4481 (run-hooks 'gnus-parse-headers-hook)
4482 (goto-char (point-min))
4485 (while (and sequence (not (eobp)))
4486 (setq number (read cur))
4487 (while (and sequence
4488 (< (car sequence) number))
4489 (setq sequence (cdr sequence)))
4491 (eq number (car sequence))
4493 (setq sequence (cdr sequence))
4494 (setq header (inline
4495 (gnus-nov-parse-line
4496 number dependencies force-new))))
4497 (push header headers))
4500 (gnus-error 4 "Strange nov line (%d)"
4501 (count-lines (point-min) (point)))))
4503 (nreverse headers))))
4505 (defun gnus-article-get-xrefs ()
4506 "Fill in the Xref value in `gnus-current-headers', if necessary.
4507 This is meant to be called in `gnus-article-internal-prepare-hook'."
4508 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4509 gnus-current-headers)))
4510 (or (not gnus-use-cross-reference)
4512 (and (mail-header-xref headers)
4513 (not (string= (mail-header-xref headers) "")))
4514 (let ((case-fold-search t)
4517 (nnheader-narrow-to-headers)
4518 (goto-char (point-min))
4519 (when (or (and (eq (downcase (following-char)) ?x)
4520 (looking-at "Xref:"))
4521 (search-forward "\nXref:" nil t))
4522 (goto-char (1+ (match-end 0)))
4523 (setq xref (buffer-substring (point)
4524 (progn (end-of-line) (point))))
4525 (mail-header-set-xref headers xref)))))))
4527 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4528 "Find article ID and insert the summary line for that article."
4529 (let ((header (if (and old-header use-old-header)
4530 old-header (gnus-read-header id)))
4531 (number (and (numberp id) id))
4534 ;; Rebuild the thread that this article is part of and go to the
4535 ;; article we have fetched.
4536 (when (and (not gnus-show-threads)
4538 (when (setq d (gnus-data-find (mail-header-number old-header)))
4539 (goto-char (gnus-data-pos d))
4542 (- (gnus-point-at-bol)
4544 (1+ (gnus-point-at-eol))
4545 (gnus-delete-line))))))
4547 (mail-header-set-number header (mail-header-number old-header)))
4548 (setq gnus-newsgroup-sparse
4549 (delq (setq number (mail-header-number header))
4550 gnus-newsgroup-sparse))
4551 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4552 (gnus-rebuild-thread (mail-header-id header))
4553 (gnus-summary-goto-subject number nil t))
4554 (when (and (numberp number)
4556 ;; We have to update the boundaries even if we can't fetch the
4557 ;; article if ID is a number -- so that the next `P' or `N'
4558 ;; command will fetch the previous (or next) article even
4559 ;; if the one we tried to fetch this time has been canceled.
4560 (when (> number gnus-newsgroup-end)
4561 (setq gnus-newsgroup-end number))
4562 (when (< number gnus-newsgroup-begin)
4563 (setq gnus-newsgroup-begin number))
4564 (setq gnus-newsgroup-unselected
4565 (delq number gnus-newsgroup-unselected)))
4566 ;; Report back a success?
4567 (and header (mail-header-number header))))
4569 ;;; Process/prefix in the summary buffer
4571 (defun gnus-summary-work-articles (n)
4572 "Return a list of articles to be worked upon. The prefix argument,
4573 the list of process marked articles, and the current article will be
4574 taken into consideration."
4577 ;; A numerical prefix has been given.
4578 (let ((backward (< n 0))
4579 (n (abs (prefix-numeric-value n)))
4584 (push (setq article (gnus-summary-article-number))
4587 (gnus-summary-find-prev nil article)
4588 (gnus-summary-find-next nil article)))
4590 (nreverse articles)))
4591 ((and (boundp 'transient-mark-mode)
4594 ;; Work on the region between point and mark.
4595 (let ((max (max (point) (mark)))
4598 (goto-char (min (point) (mark)))
4601 (push (setq article (gnus-summary-article-number)) articles)
4602 (gnus-summary-find-next nil article)
4604 (nreverse articles))))
4605 (gnus-newsgroup-processable
4606 ;; There are process-marked articles present.
4607 ;; Save current state.
4608 (gnus-summary-save-process-mark)
4610 (reverse gnus-newsgroup-processable))
4612 ;; Just return the current article.
4613 (list (gnus-summary-article-number)))))
4615 (defun gnus-summary-save-process-mark ()
4616 "Push the current set of process marked articles on the stack."
4618 (push (copy-sequence gnus-newsgroup-processable)
4619 gnus-newsgroup-process-stack))
4621 (defun gnus-summary-kill-process-mark ()
4622 "Push the current set of process marked articles on the stack and unmark."
4624 (gnus-summary-save-process-mark)
4625 (gnus-summary-unmark-all-processable))
4627 (defun gnus-summary-yank-process-mark ()
4628 "Pop the last process mark state off the stack and restore it."
4630 (unless gnus-newsgroup-process-stack
4631 (error "Empty mark stack"))
4632 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4634 (defun gnus-summary-process-mark-set (set)
4635 "Make SET into the current process marked articles."
4636 (gnus-summary-unmark-all-processable)
4638 (gnus-summary-set-process-mark (pop set))))
4640 ;;; Searching and stuff
4642 (defun gnus-summary-search-group (&optional backward use-level)
4643 "Search for next unread newsgroup.
4644 If optional argument BACKWARD is non-nil, search backward instead."
4646 (set-buffer gnus-group-buffer)
4647 (when (gnus-group-search-forward
4648 backward nil (if use-level (gnus-group-group-level) nil))
4649 (gnus-group-group-name))))
4651 (defun gnus-summary-best-group (&optional exclude-group)
4652 "Find the name of the best unread group.
4653 If EXCLUDE-GROUP, do not go to this group."
4655 (set-buffer gnus-group-buffer)
4657 (gnus-group-best-unread-group exclude-group))))
4659 (defun gnus-summary-find-next (&optional unread article backward)
4660 (if backward (gnus-summary-find-prev)
4661 (let* ((dummy (gnus-summary-article-intangible-p))
4662 (article (or article (gnus-summary-article-number)))
4663 (arts (gnus-data-find-list article))
4665 (when (and (not dummy)
4666 (or (not gnus-summary-check-current)
4668 (not (gnus-data-unread-p (car arts)))))
4669 (setq arts (cdr arts)))
4674 (when (gnus-data-unread-p (car arts))
4675 (setq result (car arts)
4677 (setq arts (cdr arts)))
4680 (goto-char (gnus-data-pos result))
4681 (gnus-data-number result)))))
4683 (defun gnus-summary-find-prev (&optional unread article)
4684 (let* ((eobp (eobp))
4685 (article (or article (gnus-summary-article-number)))
4686 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4688 (when (and (not eobp)
4689 (or (not gnus-summary-check-current)
4691 (not (gnus-data-unread-p (car arts)))))
4692 (setq arts (cdr arts)))
4697 (when (gnus-data-unread-p (car arts))
4698 (setq result (car arts)
4700 (setq arts (cdr arts)))
4703 (goto-char (gnus-data-pos result))
4704 (gnus-data-number result))))
4706 (defun gnus-summary-find-subject (subject &optional unread backward article)
4707 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4708 (article (or article (gnus-summary-article-number)))
4709 (articles (gnus-data-list backward))
4710 (arts (gnus-data-find-list article articles))
4712 (when (or (not gnus-summary-check-current)
4714 (not (gnus-data-unread-p (car arts))))
4715 (setq arts (cdr arts)))
4717 (and (or (not unread)
4718 (gnus-data-unread-p (car arts)))
4719 (vectorp (gnus-data-header (car arts)))
4721 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4722 (setq result (car arts)
4724 (setq arts (cdr arts)))
4726 (goto-char (gnus-data-pos result))
4727 (gnus-data-number result))))
4729 (defun gnus-summary-search-forward (&optional unread subject backward)
4730 "Search forward for an article.
4731 If UNREAD, look for unread articles. If SUBJECT, look for
4732 articles with that subject. If BACKWARD, search backward instead."
4733 (cond (subject (gnus-summary-find-subject subject unread backward))
4734 (backward (gnus-summary-find-prev unread))
4735 (t (gnus-summary-find-next unread))))
4737 (defun gnus-recenter (&optional n)
4738 "Center point in window and redisplay frame.
4739 Also do horizontal recentering."
4741 (when (and gnus-auto-center-summary
4742 (not (eq gnus-auto-center-summary 'vertical)))
4743 (gnus-horizontal-recenter))
4746 (defun gnus-summary-recenter ()
4747 "Center point in the summary window.
4748 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4749 displayed, no centering will be performed."
4750 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4751 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4752 (let* ((top (cond ((< (window-height) 4) 0)
4753 ((< (window-height) 7) 1)
4755 (height (1- (window-height)))
4756 (bottom (save-excursion (goto-char (point-max))
4757 (forward-line (- height))
4759 (window (get-buffer-window (current-buffer))))
4760 ;; The user has to want it.
4761 (when gnus-auto-center-summary
4762 (when (get-buffer-window gnus-article-buffer)
4763 ;; Only do recentering when the article buffer is displayed,
4764 ;; Set the window start to either `bottom', which is the biggest
4765 ;; possible valid number, or the second line from the top,
4766 ;; whichever is the least.
4768 window (min bottom (save-excursion
4769 (forward-line (- top)) (point)))))
4770 ;; Do horizontal recentering while we're at it.
4771 (when (and (get-buffer-window (current-buffer) t)
4772 (not (eq gnus-auto-center-summary 'vertical)))
4773 (let ((selected (selected-window)))
4774 (select-window (get-buffer-window (current-buffer) t))
4775 (gnus-summary-position-point)
4776 (gnus-horizontal-recenter)
4777 (select-window selected))))))
4779 (defun gnus-summary-jump-to-group (newsgroup)
4780 "Move point to NEWSGROUP in group mode buffer."
4781 ;; Keep update point of group mode buffer if visible.
4782 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4783 (save-window-excursion
4784 ;; Take care of tree window mode.
4785 (when (get-buffer-window gnus-group-buffer)
4786 (pop-to-buffer gnus-group-buffer))
4787 (gnus-group-jump-to-group newsgroup))
4789 ;; Take care of tree window mode.
4790 (if (get-buffer-window gnus-group-buffer)
4791 (pop-to-buffer gnus-group-buffer)
4792 (set-buffer gnus-group-buffer))
4793 (gnus-group-jump-to-group newsgroup))))
4795 ;; This function returns a list of article numbers based on the
4796 ;; difference between the ranges of read articles in this group and
4797 ;; the range of active articles.
4798 (defun gnus-list-of-unread-articles (group)
4799 (let* ((read (gnus-info-read (gnus-get-info group)))
4800 (active (or (gnus-active group) (gnus-activate-group group)))
4803 ;; If none are read, then all are unread.
4805 (setq first (car active))
4806 ;; If the range of read articles is a single range, then the
4807 ;; first unread article is the article after the last read
4808 ;; article. Sounds logical, doesn't it?
4809 (if (not (listp (cdr read)))
4810 (setq first (1+ (cdr read)))
4811 ;; `read' is a list of ranges.
4812 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
4818 (while (< first nlast)
4820 (setq first (1+ first))))
4821 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
4822 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
4823 (setq read (cdr read)))))
4824 ;; And add the last unread articles.
4825 (while (<= first last)
4827 (setq first (1+ first)))
4828 ;; Return the list of unread articles.
4831 (defun gnus-list-of-read-articles (group)
4832 "Return a list of unread, unticked and non-dormant articles."
4833 (let* ((info (gnus-get-info group))
4834 (marked (gnus-info-marks info))
4835 (active (gnus-active group)))
4837 (gnus-set-difference
4838 (gnus-sorted-complement
4839 (gnus-uncompress-range active)
4840 (gnus-list-of-unread-articles group))
4842 (gnus-uncompress-range (cdr (assq 'dormant marked)))
4843 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
4845 ;; Various summary commands
4847 (defun gnus-summary-universal-argument (arg)
4848 "Perform any operation on all articles that are process/prefixed."
4850 (gnus-set-global-variables)
4851 (let ((articles (gnus-summary-work-articles arg))
4858 (substitute-command-keys
4859 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
4862 (gnus-error 1 "Undefined key")
4865 (gnus-summary-goto-subject (setq article (pop articles)))
4866 (let (gnus-newsgroup-processable)
4867 (command-execute func))
4868 (gnus-summary-remove-process-mark article)))))
4869 (gnus-summary-position-point))
4871 (defun gnus-summary-toggle-truncation (&optional arg)
4872 "Toggle truncation of summary lines.
4873 With arg, turn line truncation on iff arg is positive."
4875 (setq truncate-lines
4876 (if (null arg) (not truncate-lines)
4877 (> (prefix-numeric-value arg) 0)))
4880 (defun gnus-summary-reselect-current-group (&optional all rescan)
4881 "Exit and then reselect the current newsgroup.
4882 The prefix argument ALL means to select all articles."
4884 (gnus-set-global-variables)
4885 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
4886 (error "Ephemeral groups can't be reselected"))
4887 (let ((current-subject (gnus-summary-article-number))
4888 (group gnus-newsgroup-name))
4889 (setq gnus-newsgroup-begin nil)
4891 ;; We have to adjust the point of group mode buffer because the
4892 ;; current point was moved to the next unread newsgroup by
4894 (gnus-summary-jump-to-group group)
4897 (gnus-group-get-new-news-this-group 1)))
4898 (gnus-group-read-group all t)
4899 (gnus-summary-goto-subject current-subject nil t)))
4901 (defun gnus-summary-rescan-group (&optional all)
4902 "Exit the newsgroup, ask for new articles, and select the newsgroup."
4904 (gnus-summary-reselect-current-group all t))
4906 (defun gnus-summary-update-info ()
4908 (let ((group gnus-newsgroup-name))
4909 (when gnus-newsgroup-kill-headers
4910 (setq gnus-newsgroup-killed
4911 (gnus-compress-sequence
4913 (gnus-set-sorted-intersection
4914 (gnus-uncompress-range gnus-newsgroup-killed)
4915 (setq gnus-newsgroup-unselected
4916 (sort gnus-newsgroup-unselected '<)))
4917 (setq gnus-newsgroup-unreads
4918 (sort gnus-newsgroup-unreads '<)))
4920 (unless (listp (cdr gnus-newsgroup-killed))
4921 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
4922 (let ((headers gnus-newsgroup-headers))
4923 (unless gnus-save-score
4924 (setq gnus-newsgroup-scored nil))
4925 ;; Set the new ranges of read articles.
4926 (gnus-update-read-articles
4927 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
4928 ;; Set the current article marks.
4930 ;; Do the cross-ref thing.
4931 (when gnus-use-cross-reference
4932 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
4933 ;; Do adaptive scoring, and possibly save score files.
4934 (when gnus-newsgroup-adaptive
4935 (gnus-score-adaptive))
4936 (when gnus-use-scoring
4938 ;; Do not switch windows but change the buffer to work.
4939 (set-buffer gnus-group-buffer)
4940 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
4941 (gnus-group-update-group group))))))
4943 (defun gnus-summary-save-newsrc ()
4944 "Save the .newsrc file.
4945 The current number of read/marked articles in the summary buffer
4946 will also be saved."
4948 (gnus-summary-update-info)
4949 (gnus-save-newsrc-file))
4951 (defun gnus-summary-exit (&optional temporary)
4952 "Exit reading current newsgroup, and then return to group selection mode.
4953 gnus-exit-group-hook is called with no arguments if that value is non-nil."
4955 (gnus-set-global-variables)
4956 (gnus-kill-save-kill-buffer)
4957 (let* ((group gnus-newsgroup-name)
4958 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
4960 (buf (current-buffer)))
4961 (run-hooks 'gnus-summary-prepare-exit-hook)
4962 ;; If we have several article buffers, we kill them at exit.
4963 (unless gnus-single-article-buffer
4964 (gnus-kill-buffer gnus-original-article-buffer)
4965 (setq gnus-article-current nil))
4966 (when gnus-use-cache
4967 (gnus-cache-possibly-remove-articles)
4968 (gnus-cache-save-buffers))
4969 (gnus-async-prefetch-remove-group group)
4970 (when gnus-suppress-duplicates
4971 (gnus-dup-enter-articles))
4972 (when gnus-use-trees
4973 (gnus-tree-close group))
4974 ;; Make all changes in this group permanent.
4976 (run-hooks 'gnus-exit-group-hook)
4977 (gnus-summary-update-info))
4978 (gnus-close-group group)
4979 ;; Make sure where I was, and go to next newsgroup.
4980 (set-buffer gnus-group-buffer)
4982 (gnus-group-jump-to-group group))
4983 (run-hooks 'gnus-summary-exit-hook)
4985 (gnus-group-next-unread-group 1))
4988 ;; If we have several article buffers, we kill them at exit.
4989 (unless gnus-single-article-buffer
4990 (gnus-kill-buffer gnus-article-buffer)
4991 (gnus-kill-buffer gnus-original-article-buffer)
4992 (setq gnus-article-current nil))
4994 (if (not gnus-kill-summary-on-exit)
4995 (gnus-deaden-summary)
4996 ;; We set all buffer-local variables to nil. It is unclear why
4997 ;; this is needed, but if we don't, buffer-local variables are
4998 ;; not garbage-collected, it seems. This would the lead to en
4999 ;; ever-growing Emacs.
5000 (gnus-summary-clear-local-variables)
5001 (when (get-buffer gnus-article-buffer)
5002 (bury-buffer gnus-article-buffer))
5003 ;; We clear the global counterparts of the buffer-local
5004 ;; variables as well, just to be on the safe side.
5005 (set-buffer gnus-group-buffer)
5006 (gnus-summary-clear-local-variables)
5007 ;; Return to group mode buffer.
5008 (when (eq mode 'gnus-summary-mode)
5009 (gnus-kill-buffer buf)))
5010 (setq gnus-current-select-method gnus-select-method)
5011 (pop-to-buffer gnus-group-buffer)
5012 ;; Clear the current group name.
5013 (if (not quit-config)
5015 (gnus-group-jump-to-group group)
5016 (gnus-group-next-unread-group 1)
5017 (gnus-configure-windows 'group 'force))
5018 (gnus-handle-ephemeral-exit quit-config))
5020 (setq gnus-newsgroup-name nil)))))
5022 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5023 (defun gnus-summary-exit-no-update (&optional no-questions)
5024 "Quit reading current newsgroup without updating read article info."
5026 (gnus-set-global-variables)
5027 (let* ((group gnus-newsgroup-name)
5028 (quit-config (gnus-group-quit-config group)))
5029 (when (or no-questions
5031 (gnus-y-or-n-p "Do you really wanna quit reading this group? "))
5032 ;; If we have several article buffers, we kill them at exit.
5033 (unless gnus-single-article-buffer
5034 (gnus-kill-buffer gnus-article-buffer)
5035 (gnus-kill-buffer gnus-original-article-buffer)
5036 (setq gnus-article-current nil))
5037 (if (not gnus-kill-summary-on-exit)
5038 (gnus-deaden-summary)
5039 (gnus-close-group group)
5040 (gnus-summary-clear-local-variables)
5041 (set-buffer gnus-group-buffer)
5042 (gnus-summary-clear-local-variables)
5043 (when (get-buffer gnus-summary-buffer)
5044 (kill-buffer gnus-summary-buffer)))
5045 (unless gnus-single-article-buffer
5046 (setq gnus-article-current nil))
5047 (when gnus-use-trees
5048 (gnus-tree-close group))
5049 (gnus-async-prefetch-remove-group group)
5050 (when (get-buffer gnus-article-buffer)
5051 (bury-buffer gnus-article-buffer))
5052 ;; Return to the group buffer.
5053 (gnus-configure-windows 'group 'force)
5054 ;; Clear the current group name.
5055 (setq gnus-newsgroup-name nil)
5056 (when (equal (gnus-group-group-name) group)
5057 (gnus-group-next-unread-group 1))
5059 (gnus-handle-ephemeral-exit quit-config)))))
5061 (defun gnus-handle-ephemeral-exit (quit-config)
5062 "Handle movement when leaving an ephemeral group. The state
5063 which existed when entering the ephemeral is reset."
5064 (if (not (buffer-name (car quit-config)))
5065 (gnus-configure-windows 'group 'force)
5066 (set-buffer (car quit-config))
5067 (cond ((eq major-mode 'gnus-summary-mode)
5068 (gnus-set-global-variables))
5069 ((eq major-mode 'gnus-article-mode)
5071 ;; The `gnus-summary-buffer' variable may point
5072 ;; to the old summary buffer when using a single
5074 (unless (gnus-buffer-live-p gnus-summary-buffer)
5075 (set-buffer gnus-group-buffer))
5076 (set-buffer gnus-summary-buffer)
5077 (gnus-set-global-variables))))
5078 (if (or (eq (cdr quit-config) 'article)
5079 (eq (cdr quit-config) 'pick))
5081 ;; The current article may be from the ephemeral group
5082 ;; thus it is best that we reload this article
5083 (gnus-summary-show-article)
5084 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5085 (gnus-configure-windows 'pick 'force)
5086 (gnus-configure-windows (cdr quit-config) 'force)))
5087 (gnus-configure-windows (cdr quit-config) 'force))
5088 (when (eq major-mode 'gnus-summary-mode)
5089 (gnus-summary-next-subject 1 nil t)
5090 (gnus-summary-recenter)
5091 (gnus-summary-position-point))))
5095 (defvar gnus-dead-summary-mode-map nil)
5097 (unless gnus-dead-summary-mode-map
5098 (setq gnus-dead-summary-mode-map (make-keymap))
5099 (suppress-keymap gnus-dead-summary-mode-map)
5100 (substitute-key-definition
5101 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5102 (let ((keys '("\C-d" "\r" "\177")))
5104 (define-key gnus-dead-summary-mode-map
5105 (pop keys) 'gnus-summary-wake-up-the-dead))))
5107 (defvar gnus-dead-summary-mode nil
5108 "Minor mode for Gnus summary buffers.")
5110 (defun gnus-dead-summary-mode (&optional arg)
5111 "Minor mode for Gnus summary buffers."
5113 (when (eq major-mode 'gnus-summary-mode)
5114 (make-local-variable 'gnus-dead-summary-mode)
5115 (setq gnus-dead-summary-mode
5116 (if (null arg) (not gnus-dead-summary-mode)
5117 (> (prefix-numeric-value arg) 0)))
5118 (when gnus-dead-summary-mode
5119 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
5120 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
5121 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
5122 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
5123 minor-mode-map-alist)))))
5125 (defun gnus-deaden-summary ()
5126 "Make the current summary buffer into a dead summary buffer."
5127 ;; Kill any previous dead summary buffer.
5128 (when (and gnus-dead-summary
5129 (buffer-name gnus-dead-summary))
5131 (set-buffer gnus-dead-summary)
5132 (when gnus-dead-summary-mode
5133 (kill-buffer (current-buffer)))))
5134 ;; Make this the current dead summary.
5135 (setq gnus-dead-summary (current-buffer))
5136 (gnus-dead-summary-mode 1)
5137 (let ((name (buffer-name)))
5138 (when (string-match "Summary" name)
5140 (concat (substring name 0 (match-beginning 0)) "Dead "
5141 (substring name (match-beginning 0)))
5144 (defun gnus-kill-or-deaden-summary (buffer)
5145 "Kill or deaden the summary BUFFER."
5146 (when (and (buffer-name buffer)
5147 (not gnus-single-article-buffer))
5150 (gnus-kill-buffer gnus-article-buffer)
5151 (gnus-kill-buffer gnus-original-article-buffer)))
5152 (cond (gnus-kill-summary-on-exit
5153 (when (and gnus-use-trees
5154 (and (get-buffer buffer)
5155 (buffer-name (get-buffer buffer))))
5157 (set-buffer (get-buffer buffer))
5158 (gnus-tree-close gnus-newsgroup-name)))
5159 (gnus-kill-buffer buffer))
5160 ((and (get-buffer buffer)
5161 (buffer-name (get-buffer buffer)))
5164 (gnus-deaden-summary)))))
5166 (defun gnus-summary-wake-up-the-dead (&rest args)
5167 "Wake up the dead summary buffer."
5169 (gnus-dead-summary-mode -1)
5170 (let ((name (buffer-name)))
5171 (when (string-match "Dead " name)
5173 (concat (substring name 0 (match-beginning 0))
5174 (substring name (match-end 0)))
5176 (gnus-message 3 "This dead summary is now alive again"))
5178 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5179 (defun gnus-summary-fetch-faq (&optional faq-dir)
5180 "Fetch the FAQ for the current group.
5181 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5185 (when current-prefix-arg
5187 "Faq dir: " (and (listp gnus-group-faq-directory)
5188 gnus-group-faq-directory)))))
5189 (let (gnus-faq-buffer)
5190 (when (setq gnus-faq-buffer
5191 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5192 (gnus-configure-windows 'summary-faq))))
5194 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5195 (defun gnus-summary-describe-group (&optional force)
5196 "Describe the current newsgroup."
5198 (gnus-group-describe-group force gnus-newsgroup-name))
5200 (defun gnus-summary-describe-briefly ()
5201 "Describe summary mode commands briefly."
5204 (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")))
5206 ;; Walking around group mode buffer from summary mode.
5208 (defun gnus-summary-next-group (&optional no-article target-group backward)
5209 "Exit current newsgroup and then select next unread newsgroup.
5210 If prefix argument NO-ARTICLE is non-nil, no article is selected
5211 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5212 previous group instead."
5214 (gnus-set-global-variables)
5215 ;; Stop pre-fetching.
5216 (gnus-async-halt-prefetch)
5217 (let ((current-group gnus-newsgroup-name)
5218 (current-buffer (current-buffer))
5220 ;; First we semi-exit this group to update Xrefs and all variables.
5221 ;; We can't do a real exit, because the window conf must remain
5222 ;; the same in case the user is prompted for info, and we don't
5223 ;; want the window conf to change before that...
5224 (gnus-summary-exit t)
5225 (while (not entered)
5226 ;; Then we find what group we are supposed to enter.
5227 (set-buffer gnus-group-buffer)
5228 (gnus-group-jump-to-group current-group)
5231 (if (eq gnus-keep-same-level 'best)
5232 (gnus-summary-best-group gnus-newsgroup-name)
5233 (gnus-summary-search-group backward gnus-keep-same-level))))
5234 (if (not target-group)
5235 ;; There are no further groups, so we return to the group
5238 (gnus-message 5 "Returning to the group buffer")
5240 (set-buffer current-buffer)
5242 (run-hooks 'gnus-group-no-more-groups-hook))
5243 ;; We try to enter the target group.
5244 (gnus-group-jump-to-group target-group)
5245 (let ((unreads (gnus-group-group-unread)))
5246 (if (and (or (eq t unreads)
5247 (and unreads (not (zerop unreads))))
5248 (gnus-summary-read-group
5249 target-group nil no-article current-buffer))
5251 (setq current-group target-group
5252 target-group nil)))))))
5254 (defun gnus-summary-prev-group (&optional no-article)
5255 "Exit current newsgroup and then select previous unread newsgroup.
5256 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5258 (gnus-summary-next-group no-article nil t))
5260 ;; Walking around summary lines.
5262 (defun gnus-summary-first-subject (&optional unread)
5263 "Go to the first unread subject.
5264 If UNREAD is non-nil, go to the first unread article.
5265 Returns the article selected or nil if there are no unread articles."
5270 ((null gnus-newsgroup-data)
5271 (gnus-message 3 "No articles in the group")
5273 ;; Pick the first article.
5275 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5276 (gnus-data-number (car gnus-newsgroup-data)))
5277 ;; No unread articles.
5278 ((null gnus-newsgroup-unreads)
5279 (gnus-message 3 "No more unread articles")
5281 ;; Find the first unread article.
5283 (let ((data gnus-newsgroup-data))
5285 (not (gnus-data-unread-p (car data))))
5286 (setq data (cdr data)))
5288 (goto-char (gnus-data-pos (car data)))
5289 (gnus-data-number (car data))))))
5290 (gnus-summary-position-point)))
5292 (defun gnus-summary-next-subject (n &optional unread dont-display)
5293 "Go to next N'th summary line.
5294 If N is negative, go to the previous N'th subject line.
5295 If UNREAD is non-nil, only unread articles are selected.
5296 The difference between N and the actual number of steps taken is
5299 (let ((backward (< n 0))
5303 (gnus-summary-find-prev unread)
5304 (gnus-summary-find-next unread)))
5307 (gnus-message 7 "No more%s articles"
5308 (if unread " unread" "")))
5309 (unless dont-display
5310 (gnus-summary-recenter)
5311 (gnus-summary-position-point))
5314 (defun gnus-summary-next-unread-subject (n)
5315 "Go to next N'th unread summary line."
5317 (gnus-summary-next-subject n t))
5319 (defun gnus-summary-prev-subject (n &optional unread)
5320 "Go to previous N'th summary line.
5321 If optional argument UNREAD is non-nil, only unread article is selected."
5323 (gnus-summary-next-subject (- n) unread))
5325 (defun gnus-summary-prev-unread-subject (n)
5326 "Go to previous N'th unread summary line."
5328 (gnus-summary-next-subject (- n) t))
5330 (defun gnus-summary-goto-subject (article &optional force silent)
5331 "Go the subject line of ARTICLE.
5332 If FORCE, also allow jumping to articles not currently shown."
5333 (interactive "nArticle number: ")
5335 (data (gnus-data-find article)))
5336 ;; We read in the article if we have to.
5339 (gnus-summary-insert-subject article (and (vectorp force) force) t)
5340 (setq data (gnus-data-find article)))
5345 (gnus-message 3 "Can't find article %d" article))
5347 (goto-char (gnus-data-pos data))
5350 ;; Walking around summary lines with displaying articles.
5352 (defun gnus-summary-expand-window (&optional arg)
5353 "Make the summary buffer take up the entire Emacs frame.
5354 Given a prefix, will force an `article' buffer configuration."
5356 (gnus-set-global-variables)
5358 (gnus-configure-windows 'article 'force)
5359 (gnus-configure-windows 'summary 'force)))
5361 (defun gnus-summary-display-article (article &optional all-header)
5362 "Display ARTICLE in article buffer."
5363 (gnus-set-global-variables)
5367 (if gnus-summary-display-article-function
5368 (funcall gnus-summary-display-article-function article all-header)
5369 (gnus-article-prepare article all-header))
5370 (run-hooks 'gnus-select-article-hook)
5371 (when (and gnus-current-article
5372 (not (zerop gnus-current-article)))
5373 (gnus-summary-goto-subject gnus-current-article))
5374 (gnus-summary-recenter)
5375 (when (and gnus-use-trees gnus-show-threads)
5376 (gnus-possibly-generate-tree article)
5377 (gnus-highlight-selected-tree article))
5378 ;; Successfully display article.
5379 (gnus-article-set-window-start
5380 (cdr (assq article gnus-newsgroup-bookmarks))))))
5382 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5383 "Select the current article.
5384 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5385 non-nil, the article will be re-fetched even if it already present in
5386 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5388 ;; Make sure we are in the summary buffer to work around bbdb bug.
5389 (unless (eq major-mode 'gnus-summary-mode)
5390 (set-buffer gnus-summary-buffer))
5391 (let ((article (or article (gnus-summary-article-number)))
5392 (all-headers (not (not all-headers))) ;Must be T or NIL.
5393 gnus-summary-display-article-function
5396 (gnus-summary-article-pseudo-p article)
5397 (error "This is a pseudo-article."))
5400 (set-buffer gnus-summary-buffer)
5401 (if (or (and gnus-single-article-buffer
5402 (or (null gnus-current-article)
5403 (null gnus-article-current)
5404 (null (get-buffer gnus-article-buffer))
5405 (not (eq article (cdr gnus-article-current)))
5406 (not (equal (car gnus-article-current)
5407 gnus-newsgroup-name))))
5408 (and (not gnus-single-article-buffer)
5409 (or (null gnus-current-article)
5410 (not (eq gnus-current-article article))))
5412 ;; The requested article is different from the current article.
5414 (gnus-summary-display-article article all-headers)
5416 (when (or all-headers gnus-show-all-headers)
5417 (gnus-article-show-all-headers))
5420 (gnus-article-set-window-start
5421 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5423 (defun gnus-summary-set-current-mark (&optional current-mark)
5424 "Obsolete function."
5427 (defun gnus-summary-next-article (&optional unread subject backward push)
5428 "Select the next article.
5429 If UNREAD, only unread articles are selected.
5430 If SUBJECT, only articles with SUBJECT are selected.
5431 If BACKWARD, the previous article is selected instead of the next."
5433 (gnus-set-global-variables)
5435 ;; Is there such an article?
5436 ((and (gnus-summary-search-forward unread subject backward)
5437 (or (gnus-summary-display-article (gnus-summary-article-number))
5438 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5439 (gnus-summary-position-point))
5440 ;; If not, we try the first unread, if that is wanted.
5442 gnus-auto-select-same
5443 ;; Make sure that we don't select the current article.
5444 (not (eq (gnus-summary-article-number)
5446 (gnus-summary-first-subject t)
5447 (gnus-summary-article-number))))
5448 (gnus-summary-first-unread-article))
5449 (gnus-summary-position-point)
5450 (gnus-message 6 "Wrapped"))
5451 ;; Try to get next/previous article not displayed in this group.
5452 ((and gnus-auto-extend-newsgroup
5453 (not unread) (not subject))
5454 (gnus-summary-goto-article
5455 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5457 ;; Go to next/previous group.
5459 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5460 (gnus-summary-jump-to-group gnus-newsgroup-name))
5461 (let ((cmd last-command-char)
5463 (if (eq gnus-keep-same-level 'best)
5464 (gnus-summary-best-group gnus-newsgroup-name)
5465 (gnus-summary-search-group backward gnus-keep-same-level))))
5466 ;; For some reason, the group window gets selected. We change
5468 (select-window (get-buffer-window (current-buffer)))
5469 ;; Select next unread newsgroup automagically.
5471 ((or (not gnus-auto-select-next)
5473 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5474 ((or (eq gnus-auto-select-next 'quietly)
5475 (and (eq gnus-auto-select-next 'slightly-quietly)
5477 (and (eq gnus-auto-select-next 'almost-quietly)
5478 (gnus-summary-last-article-p)))
5480 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5482 (gnus-message 7 "No more%s articles (%s)..."
5483 (if unread " unread" "")
5484 (if group (concat "selecting " group)
5486 (gnus-summary-next-group nil group backward)))
5488 (when (gnus-key-press-event-p last-input-event)
5489 (gnus-summary-walk-group-buffer
5490 gnus-newsgroup-name cmd unread backward))))))))
5492 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward)
5493 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5494 (?\C-p (gnus-group-prev-unread-group 1))))
5495 (cursor-in-echo-area t)
5496 keve key group ended)
5498 (set-buffer gnus-group-buffer)
5499 (gnus-summary-jump-to-group from-group)
5501 (if (eq gnus-keep-same-level 'best)
5502 (gnus-summary-best-group gnus-newsgroup-name)
5503 (gnus-summary-search-group backward gnus-keep-same-level))))
5506 5 "No more%s articles%s" (if unread " unread" "")
5508 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5509 (format " (Type %s for %s [%s])"
5510 (single-key-description cmd) group
5511 (car (gnus-gethash group gnus-newsrc-hashtb)))
5512 (format " (Type %s to exit %s)"
5513 (single-key-description cmd)
5514 gnus-newsgroup-name)))
5515 ;; Confirm auto selection.
5516 (setq key (car (setq keve (gnus-read-event-char))))
5519 ((assq key keystrokes)
5520 (let ((obuf (current-buffer)))
5521 (switch-to-buffer gnus-group-buffer)
5523 (gnus-group-jump-to-group group))
5524 (eval (cadr (assq key keystrokes)))
5525 (setq group (gnus-group-group-name))
5526 (switch-to-buffer obuf))
5530 (gnus-ephemeral-group-p gnus-newsgroup-name))
5532 (gnus-summary-next-group nil group backward)))
5534 (push (cdr keve) unread-command-events))))))
5536 (defun gnus-summary-next-unread-article ()
5537 "Select unread article after current one."
5539 (gnus-summary-next-article
5540 (or (not (eq gnus-summary-goto-unread 'never))
5541 (gnus-summary-last-article-p (gnus-summary-article-number)))
5542 (and gnus-auto-select-same
5543 (gnus-summary-article-subject))))
5545 (defun gnus-summary-prev-article (&optional unread subject)
5546 "Select the article after the current one.
5547 If UNREAD is non-nil, only unread articles are selected."
5549 (gnus-summary-next-article unread subject t))
5551 (defun gnus-summary-prev-unread-article ()
5552 "Select unread article before current one."
5554 (gnus-summary-prev-article
5555 (or (not (eq gnus-summary-goto-unread 'never))
5556 (gnus-summary-first-article-p (gnus-summary-article-number)))
5557 (and gnus-auto-select-same
5558 (gnus-summary-article-subject))))
5560 (defun gnus-summary-next-page (&optional lines circular)
5561 "Show next page of the selected article.
5562 If at the end of the current article, select the next article.
5563 LINES says how many lines should be scrolled up.
5565 If CIRCULAR is non-nil, go to the start of the article instead of
5566 selecting the next article when reaching the end of the current
5569 (setq gnus-summary-buffer (current-buffer))
5570 (gnus-set-global-variables)
5571 (let ((article (gnus-summary-article-number))
5573 (gnus-configure-windows 'article)
5574 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5575 (if (and (eq gnus-summary-goto-unread 'never)
5576 (not (gnus-summary-last-article-p article)))
5577 (gnus-summary-next-article)
5578 (gnus-summary-next-unread-article))
5579 (if (or (null gnus-current-article)
5580 (null gnus-article-current)
5581 (/= article (cdr gnus-article-current))
5582 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5583 ;; Selected subject is different from current article's.
5584 (gnus-summary-display-article article)
5585 (gnus-eval-in-buffer-window gnus-article-buffer
5586 (setq endp (gnus-article-next-page lines)))
5589 (gnus-summary-beginning-of-article))
5591 (gnus-message 3 "End of message"))
5593 (if (and (eq gnus-summary-goto-unread 'never)
5594 (not (gnus-summary-last-article-p article)))
5595 (gnus-summary-next-article)
5596 (gnus-summary-next-unread-article)))))))
5597 (gnus-summary-recenter)
5598 (gnus-summary-position-point)))
5600 (defun gnus-summary-prev-page (&optional lines)
5601 "Show previous page of selected article.
5602 Argument LINES specifies lines to be scrolled down."
5604 (gnus-set-global-variables)
5605 (let ((article (gnus-summary-article-number)))
5606 (gnus-configure-windows 'article)
5607 (if (or (null gnus-current-article)
5608 (null gnus-article-current)
5609 (/= article (cdr gnus-article-current))
5610 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5611 ;; Selected subject is different from current article's.
5612 (gnus-summary-display-article article)
5613 (gnus-summary-recenter)
5614 (gnus-eval-in-buffer-window gnus-article-buffer
5615 (gnus-article-prev-page lines))))
5616 (gnus-summary-position-point))
5618 (defun gnus-summary-scroll-up (lines)
5619 "Scroll up (or down) one line current article.
5620 Argument LINES specifies lines to be scrolled up (or down if negative)."
5622 (gnus-set-global-variables)
5623 (gnus-configure-windows 'article)
5624 (gnus-summary-show-thread)
5625 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5626 (gnus-eval-in-buffer-window gnus-article-buffer
5628 (when (gnus-article-next-page lines)
5629 (gnus-message 3 "End of message")))
5631 (gnus-article-prev-page (- lines))))))
5632 (gnus-summary-recenter)
5633 (gnus-summary-position-point))
5635 (defun gnus-summary-next-same-subject ()
5636 "Select next article which has the same subject as current one."
5638 (gnus-set-global-variables)
5639 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5641 (defun gnus-summary-prev-same-subject ()
5642 "Select previous article which has the same subject as current one."
5644 (gnus-set-global-variables)
5645 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5647 (defun gnus-summary-next-unread-same-subject ()
5648 "Select next unread article which has the same subject as current one."
5650 (gnus-set-global-variables)
5651 (gnus-summary-next-article t (gnus-summary-article-subject)))
5653 (defun gnus-summary-prev-unread-same-subject ()
5654 "Select previous unread article which has the same subject as current one."
5656 (gnus-set-global-variables)
5657 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5659 (defun gnus-summary-first-unread-article ()
5660 "Select the first unread article.
5661 Return nil if there are no unread articles."
5663 (gnus-set-global-variables)
5665 (when (gnus-summary-first-subject t)
5666 (gnus-summary-show-thread)
5667 (gnus-summary-first-subject t)
5668 (gnus-summary-display-article (gnus-summary-article-number)))
5669 (gnus-summary-position-point)))
5671 (defun gnus-summary-first-article ()
5672 "Select the first article.
5673 Return nil if there are no articles."
5675 (gnus-set-global-variables)
5677 (when (gnus-summary-first-subject)
5678 (gnus-summary-show-thread)
5679 (gnus-summary-first-subject)
5680 (gnus-summary-display-article (gnus-summary-article-number)))
5681 (gnus-summary-position-point)))
5683 (defun gnus-summary-best-unread-article ()
5684 "Select the unread article with the highest score."
5686 (gnus-set-global-variables)
5687 (let ((best -1000000)
5688 (data gnus-newsgroup-data)
5691 (and (gnus-data-unread-p (car data))
5693 (gnus-summary-article-score (gnus-data-number (car data))))
5696 article (gnus-data-number (car data))))
5697 (setq data (cdr data)))
5700 (gnus-summary-goto-article article)
5701 (error "No unread articles"))
5702 (gnus-summary-position-point))))
5704 (defun gnus-summary-last-subject ()
5705 "Go to the last displayed subject line in the group."
5706 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5708 (gnus-summary-goto-subject article))))
5710 (defun gnus-summary-goto-article (article &optional all-headers force)
5711 "Fetch ARTICLE and display it if it exists.
5712 If ALL-HEADERS is non-nil, no header lines are hidden."
5718 (mapcar (lambda (number) (list (int-to-string number)))
5719 gnus-newsgroup-limit)))
5723 (if (gnus-summary-goto-subject article force)
5724 (gnus-summary-display-article article all-headers)
5725 (gnus-message 4 "Couldn't go to article %s" article) nil)
5726 (gnus-summary-position-point)))
5728 (defun gnus-summary-goto-last-article ()
5729 "Go to the previously read article."
5732 (when gnus-last-article
5733 (gnus-summary-goto-article gnus-last-article))
5734 (gnus-summary-position-point)))
5736 (defun gnus-summary-pop-article (number)
5737 "Pop one article off the history and go to the previous.
5738 NUMBER articles will be popped off."
5741 (setq gnus-newsgroup-history
5742 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
5744 (gnus-summary-goto-article (car to))
5745 (error "Article history empty")))
5746 (gnus-summary-position-point))
5748 ;; Summary commands and functions for limiting the summary buffer.
5750 (defun gnus-summary-limit-to-articles (n)
5751 "Limit the summary buffer to the next N articles.
5752 If not given a prefix, use the process marked articles instead."
5754 (gnus-set-global-variables)
5756 (let ((articles (gnus-summary-work-articles n)))
5757 (setq gnus-newsgroup-processable nil)
5758 (gnus-summary-limit articles))
5759 (gnus-summary-position-point)))
5761 (defun gnus-summary-pop-limit (&optional total)
5762 "Restore the previous limit.
5763 If given a prefix, remove all limits."
5765 (gnus-set-global-variables)
5767 (setq gnus-newsgroup-limits
5768 (list (mapcar (lambda (h) (mail-header-number h))
5769 gnus-newsgroup-headers))))
5770 (unless gnus-newsgroup-limits
5771 (error "No limit to pop"))
5773 (gnus-summary-limit nil 'pop)
5774 (gnus-summary-position-point)))
5776 (defun gnus-summary-limit-to-subject (subject &optional header)
5777 "Limit the summary buffer to articles that have subjects that match a regexp."
5778 (interactive "sRegexp: ")
5780 (setq header "subject"))
5781 (when (not (equal "" subject))
5783 (let ((articles (gnus-summary-find-matching
5784 (or header "subject") subject 'all)))
5786 (error "Found no matches for \"%s\"" subject))
5787 (gnus-summary-limit articles))
5788 (gnus-summary-position-point))))
5790 (defun gnus-summary-limit-to-author (from)
5791 "Limit the summary buffer to articles that have authors that match a regexp."
5792 (interactive "sRegexp: ")
5793 (gnus-summary-limit-to-subject from "from"))
5795 (defun gnus-summary-limit-to-age (age &optional younger-p)
5796 "Limit the summary buffer to articles that are older than (or equal) AGE days.
5797 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
5798 articles that are younger than AGE days."
5799 (interactive "nTime in days: \nP")
5801 (let ((data gnus-newsgroup-data)
5802 (cutoff (nnmail-days-to-time age))
5803 articles d date is-younger)
5804 (while (setq d (pop data))
5805 (when (and (vectorp (gnus-data-header d))
5806 (setq date (mail-header-date (gnus-data-header d))))
5807 (setq is-younger (nnmail-time-less
5808 (nnmail-time-since (nnmail-date-to-time date))
5810 (when (if younger-p is-younger (not is-younger))
5811 (push (gnus-data-number d) articles))))
5812 (gnus-summary-limit (nreverse articles)))
5813 (gnus-summary-position-point)))
5815 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5817 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
5819 (defun gnus-summary-limit-to-unread (&optional all)
5820 "Limit the summary buffer to articles that are not marked as read.
5821 If ALL is non-nil, limit strictly to unread articles."
5824 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
5825 (gnus-summary-limit-to-marks
5826 ;; Concat all the marks that say that an article is read and have
5828 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
5829 gnus-killed-mark gnus-kill-file-mark
5830 gnus-low-score-mark gnus-expirable-mark
5831 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
5832 gnus-duplicate-mark)
5835 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
5836 (make-obsolete 'gnus-summary-delete-marked-with
5837 'gnus-summary-limit-exlude-marks)
5839 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
5840 "Exclude articles that are marked with MARKS (e.g. \"DK\").
5841 If REVERSE, limit the summary buffer to articles that are marked
5842 with MARKS. MARKS can either be a string of marks or a list of marks.
5843 Returns how many articles were removed."
5844 (interactive "sMarks: ")
5845 (gnus-summary-limit-to-marks marks t))
5847 (defun gnus-summary-limit-to-marks (marks &optional reverse)
5848 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
5849 If REVERSE (the prefix), limit the summary buffer to articles that are
5850 not marked with MARKS. MARKS can either be a string of marks or a
5852 Returns how many articles were removed."
5853 (interactive (list (read-string "Marks: ") current-prefix-arg))
5854 (gnus-set-global-variables)
5856 (let ((data gnus-newsgroup-data)
5857 (marks (if (listp marks) marks
5858 (append marks nil))) ; Transform to list.
5861 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
5862 (memq (gnus-data-mark (car data)) marks))
5863 (push (gnus-data-number (car data)) articles))
5864 (setq data (cdr data)))
5865 (gnus-summary-limit articles))
5866 (gnus-summary-position-point)))
5868 (defun gnus-summary-limit-to-score (&optional score)
5869 "Limit to articles with score at or above SCORE."
5871 (gnus-set-global-variables)
5872 (setq score (if score
5873 (prefix-numeric-value score)
5874 (or gnus-summary-default-score 0)))
5875 (let ((data gnus-newsgroup-data)
5878 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
5880 (push (gnus-data-number (car data)) articles))
5881 (setq data (cdr data)))
5883 (gnus-summary-limit articles)
5884 (gnus-summary-position-point))))
5886 (defun gnus-summary-limit-include-dormant ()
5887 "Display all the hidden articles that are marked as dormant."
5889 (gnus-set-global-variables)
5890 (unless gnus-newsgroup-dormant
5891 (error "There are no dormant articles in this group"))
5893 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
5894 (gnus-summary-position-point)))
5896 (defun gnus-summary-limit-exclude-dormant ()
5897 "Hide all dormant articles."
5899 (gnus-set-global-variables)
5901 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
5902 (gnus-summary-position-point)))
5904 (defun gnus-summary-limit-exclude-childless-dormant ()
5905 "Hide all dormant articles that have no children."
5907 (gnus-set-global-variables)
5908 (let ((data (gnus-data-list t))
5909 articles d children)
5910 ;; Find all articles that are either not dormant or have
5912 (while (setq d (pop data))
5913 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
5915 (gnus-article-children (gnus-data-number d)))
5918 (when (memq (car children) articles)
5923 (push (gnus-data-number d) articles)))
5926 (gnus-summary-limit articles)
5927 (gnus-summary-position-point))))
5929 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
5930 "Mark all unread excluded articles as read.
5931 If ALL, mark even excluded ticked and dormants as read."
5933 (let ((articles (gnus-sorted-complement
5935 (mapcar (lambda (h) (mail-header-number h))
5936 gnus-newsgroup-headers)
5938 (sort gnus-newsgroup-limit '<)))
5940 (setq gnus-newsgroup-unreads nil)
5942 (setq gnus-newsgroup-dormant nil
5943 gnus-newsgroup-marked nil
5944 gnus-newsgroup-reads
5946 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
5947 gnus-newsgroup-reads))
5948 (while (setq article (pop articles))
5949 (unless (or (memq article gnus-newsgroup-dormant)
5950 (memq article gnus-newsgroup-marked))
5951 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
5953 (defun gnus-summary-limit (articles &optional pop)
5955 ;; We pop the previous limit off the stack and use that.
5956 (setq articles (car gnus-newsgroup-limits)
5957 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
5958 ;; We use the new limit, so we push the old limit on the stack.
5959 (push gnus-newsgroup-limit gnus-newsgroup-limits))
5961 (setq gnus-newsgroup-limit articles)
5962 (let ((total (length gnus-newsgroup-data))
5963 (data (gnus-data-find-list (gnus-summary-article-number)))
5964 (gnus-summary-mark-below nil) ; Inhibit this.
5966 ;; This will do all the work of generating the new summary buffer
5967 ;; according to the new limit.
5968 (gnus-summary-prepare)
5969 ;; Hide any threads, possibly.
5970 (and gnus-show-threads
5971 gnus-thread-hide-subtree
5972 (gnus-summary-hide-all-threads))
5973 ;; Try to return to the article you were at, or one in the
5976 ;; We try to find some article after the current one.
5978 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
5981 (setq data (cdr data))))
5983 ;; If there is no data, that means that we were after the last
5984 ;; article. The same goes when we can't find any articles
5985 ;; after the current one.
5986 (goto-char (point-max))
5987 (gnus-summary-find-prev))
5988 ;; We return how many articles were removed from the summary
5989 ;; buffer as a result of the new limit.
5990 (- total (length gnus-newsgroup-data))))
5992 (defsubst gnus-invisible-cut-children (threads)
5995 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6000 (defsubst gnus-cut-thread (thread)
6001 "Go forwards in the thread until we find an article that we want to display."
6002 (when (or (eq gnus-fetch-old-headers 'some)
6003 (eq gnus-build-sparse-threads 'some)
6004 (eq gnus-build-sparse-threads 'more))
6005 ;; Deal with old-fetched headers and sparse threads.
6009 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6010 (gnus-summary-article-ancient-p
6011 (mail-header-number (car thread))))
6013 (if (<= (length (cdr thread)) 1)
6014 (setq thread (cadr thread))
6015 (when (gnus-invisible-cut-children (cdr thread))
6016 (let ((th (cdr thread)))
6018 (if (memq (mail-header-number (caar th))
6019 gnus-newsgroup-limit)
6020 (setq thread (car th)
6022 (setq th (cdr th)))))))))
6026 (defun gnus-cut-threads (threads)
6027 "Cut off all uninteresting articles from the beginning of threads."
6028 (when (or (eq gnus-fetch-old-headers 'some)
6029 (eq gnus-build-sparse-threads 'some)
6030 (eq gnus-build-sparse-threads 'more))
6033 (setcar th (gnus-cut-thread (car th)))
6034 (setq th (cdr th)))))
6035 ;; Remove nixed out threads.
6038 (defun gnus-summary-initial-limit (&optional show-if-empty)
6039 "Figure out what the initial limit is supposed to be on group entry.
6040 This entails weeding out unwanted dormants, low-scored articles,
6041 fetch-old-headers verbiage, and so on."
6042 ;; Most groups have nothing to remove.
6043 (if (or gnus-inhibit-limiting
6044 (and (null gnus-newsgroup-dormant)
6045 (not (eq gnus-fetch-old-headers 'some))
6046 (null gnus-summary-expunge-below)
6047 (not (eq gnus-build-sparse-threads 'some))
6048 (not (eq gnus-build-sparse-threads 'more))
6049 (null gnus-thread-expunge-below)
6050 (not gnus-use-nocem)))
6052 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6053 (setq gnus-newsgroup-limit nil)
6056 (unless (car (symbol-value node))
6057 ;; These threads have no parents -- they are roots.
6058 (let ((nodes (cdr (symbol-value node)))
6061 (if (and gnus-thread-expunge-below
6062 (< (gnus-thread-total-score (car nodes))
6063 gnus-thread-expunge-below))
6064 (gnus-expunge-thread (pop nodes))
6065 (setq thread (pop nodes))
6066 (gnus-summary-limit-children thread))))))
6067 gnus-newsgroup-dependencies)
6068 ;; If this limitation resulted in an empty group, we might
6069 ;; pop the previous limit and use it instead.
6070 (when (and (not gnus-newsgroup-limit)
6072 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6073 gnus-newsgroup-limit))
6075 (defun gnus-summary-limit-children (thread)
6076 "Return 1 if this subthread is visible and 0 if it is not."
6077 ;; First we get the number of visible children to this thread. This
6078 ;; is done by recursing down the thread using this function, so this
6079 ;; will really go down to a leaf article first, before slowly
6080 ;; working its way up towards the root.
6084 (apply '+ (mapcar 'gnus-summary-limit-children
6087 (number (mail-header-number (car thread)))
6090 (not (memq number gnus-newsgroup-marked))
6092 ;; If this article is dormant and has absolutely no visible
6093 ;; children, then this article isn't visible.
6094 (and (memq number gnus-newsgroup-dormant)
6096 ;; If this is "fetch-old-headered" and there is no
6097 ;; visible children, then we don't want this article.
6098 (and (eq gnus-fetch-old-headers 'some)
6099 (gnus-summary-article-ancient-p number)
6101 ;; If this is a sparsely inserted article with no children,
6102 ;; we don't want it.
6103 (and (eq gnus-build-sparse-threads 'some)
6104 (gnus-summary-article-sparse-p number)
6106 ;; If we use expunging, and this article is really
6107 ;; low-scored, then we don't want this article.
6108 (when (and gnus-summary-expunge-below
6110 (or (cdr (assq number gnus-newsgroup-scored))
6111 gnus-summary-default-score))
6112 gnus-summary-expunge-below))
6113 ;; We increase the expunge-tally here, but that has
6114 ;; nothing to do with the limits, really.
6115 (incf gnus-newsgroup-expunged-tally)
6116 ;; We also mark as read here, if that's wanted.
6117 (when (and gnus-summary-mark-below
6118 (< score gnus-summary-mark-below))
6119 (setq gnus-newsgroup-unreads
6120 (delq number gnus-newsgroup-unreads))
6121 (if gnus-newsgroup-auto-expire
6122 (push number gnus-newsgroup-expirable)
6123 (push (cons number gnus-low-score-mark)
6124 gnus-newsgroup-reads)))
6126 ;; Check NoCeM things.
6128 (gnus-nocem-unwanted-article-p
6129 (mail-header-id (car thread))))))
6130 ;; Nope, invisible article.
6132 ;; Ok, this article is to be visible, so we add it to the limit
6134 (push number gnus-newsgroup-limit)
6137 (defun gnus-expunge-thread (thread)
6138 "Mark all articles in THREAD as read."
6139 (let* ((number (mail-header-number (car thread))))
6140 (incf gnus-newsgroup-expunged-tally)
6141 ;; We also mark as read here, if that's wanted.
6142 (setq gnus-newsgroup-unreads
6143 (delq number gnus-newsgroup-unreads))
6144 (if gnus-newsgroup-auto-expire
6145 (push number gnus-newsgroup-expirable)
6146 (push (cons number gnus-low-score-mark)
6147 gnus-newsgroup-reads)))
6148 ;; Go recursively through all subthreads.
6149 (mapcar 'gnus-expunge-thread (cdr thread)))
6151 ;; Summary article oriented commands
6153 (defun gnus-summary-refer-parent-article (n)
6154 "Refer parent article N times.
6155 If N is negative, go to ancestor -N instead.
6156 The difference between N and the number of articles fetched is returned."
6158 (gnus-set-global-variables)
6161 (when (not (natnump n))
6166 (setq header (gnus-summary-article-header))
6168 ;; If we try to find the parent of the currently
6169 ;; displayed article, then we take a look at the actual
6170 ;; References header, since this is slightly more
6171 ;; reliable than the References field we got from the
6173 (if (and (eq (mail-header-number header)
6174 (cdr gnus-article-current))
6175 (equal gnus-newsgroup-name
6176 (car gnus-article-current)))
6178 (set-buffer gnus-original-article-buffer)
6179 (nnheader-narrow-to-headers)
6181 (message-fetch-field "references")
6183 ;; It's not the current article, so we take a bet on
6184 ;; the value we got from the server.
6185 (mail-header-references header)))
6187 (not (equal ref "")))
6188 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6189 (gnus-message 1 "Couldn't find parent"))
6190 (gnus-message 1 "No references in article %d"
6191 (gnus-summary-article-number))
6194 (gnus-summary-position-point)
6197 (defun gnus-summary-refer-references ()
6198 "Fetch all articles mentioned in the References header.
6199 Return how many articles were fetched."
6201 (gnus-set-global-variables)
6202 (let ((ref (mail-header-references (gnus-summary-article-header)))
6203 (current (gnus-summary-article-number))
6207 (error "No References in the current article")
6208 ;; For each Message-ID in the References header...
6209 (while (string-match "<[^>]*>" ref)
6211 ;; ... fetch that article.
6212 (gnus-summary-refer-article
6213 (prog1 (match-string 0 ref)
6214 (setq ref (substring ref (match-end 0))))))
6215 (gnus-summary-goto-subject current)
6216 (gnus-summary-position-point)
6219 (defun gnus-summary-refer-article (message-id)
6220 "Fetch an article specified by MESSAGE-ID."
6221 (interactive "sMessage-ID: ")
6222 (when (and (stringp message-id)
6223 (not (zerop (length message-id))))
6224 ;; Construct the correct Message-ID if necessary.
6225 ;; Suggested by tale@pawl.rpi.edu.
6226 (unless (string-match "^<" message-id)
6227 (setq message-id (concat "<" message-id)))
6228 (unless (string-match ">$" message-id)
6229 (setq message-id (concat message-id ">")))
6230 (let* ((header (gnus-id-to-header message-id))
6232 (gnus-summary-article-sparse-p
6233 (mail-header-number header)))))
6236 ;; The article is present in the buffer, to we just go to it.
6237 (gnus-summary-goto-article
6238 (mail-header-number header) nil header)
6240 (gnus-summary-update-article (mail-header-number header))))
6241 ;; We fetch the article
6242 (let ((gnus-override-method
6243 (and (gnus-news-group-p gnus-newsgroup-name)
6244 gnus-refer-article-method))
6246 ;; Start the special refer-article method, if necessary.
6247 (when (and gnus-refer-article-method
6248 (gnus-news-group-p gnus-newsgroup-name))
6249 (gnus-check-server gnus-refer-article-method))
6250 ;; Fetch the header, and display the article.
6251 (if (setq number (gnus-summary-insert-subject message-id))
6252 (gnus-summary-select-article nil nil nil number)
6253 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6255 (defun gnus-summary-enter-digest-group (&optional force)
6256 "Enter an nndoc group based on the current article.
6257 If FORCE, force a digest interpretation. If not, try
6258 to guess what the document format is."
6260 (gnus-set-global-variables)
6261 (let ((conf gnus-current-window-configuration))
6263 (gnus-summary-select-article))
6264 (setq gnus-current-window-configuration conf)
6265 (let* ((name (format "%s-%d"
6266 (gnus-group-prefixed-name
6267 gnus-newsgroup-name (list 'nndoc ""))
6269 (set-buffer gnus-summary-buffer)
6270 gnus-current-article)))
6271 (ogroup gnus-newsgroup-name)
6272 (params (append (gnus-info-params (gnus-get-info ogroup))
6273 (list (cons 'to-group ogroup))))
6274 (case-fold-search t)
6275 (buf (current-buffer))
6278 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6279 (insert-buffer-substring gnus-original-article-buffer)
6280 ;; Remove lines that may lead nndoc to misinterpret the
6283 (goto-char (point-min))
6284 (or (search-forward "\n\n" nil t) (point)))
6285 (goto-char (point-min))
6286 (delete-matching-lines "^\\(Path\\):\\|^From ")
6289 (if (gnus-group-read-ephemeral-group
6290 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6292 ,(if force 'digest 'guess))) t)
6293 ;; Make all postings to this group go to the parent group.
6294 (nconc (gnus-info-params (gnus-get-info name))
6296 ;; Couldn't select this doc group.
6297 (switch-to-buffer buf)
6298 (gnus-set-global-variables)
6299 (gnus-configure-windows 'summary)
6300 (gnus-message 3 "Article couldn't be entered?"))
6301 (kill-buffer dig)))))
6303 (defun gnus-summary-read-document (n)
6304 "Open a new group based on the current article(s).
6305 This will allow you to read digests and other similar
6306 documents as newsgroups.
6307 Obeys the standard process/prefix convention."
6309 (let* ((articles (gnus-summary-work-articles n))
6310 (ogroup gnus-newsgroup-name)
6311 (params (append (gnus-info-params (gnus-get-info ogroup))
6312 (list (cons 'to-group ogroup))))
6313 article group egroup groups vgroup)
6314 (while (setq article (pop articles))
6315 (setq group (format "%s-%d" gnus-newsgroup-name article))
6316 (gnus-summary-remove-process-mark article)
6317 (when (gnus-summary-display-article article)
6319 (nnheader-temp-write nil
6320 (insert-buffer-substring gnus-original-article-buffer)
6321 ;; Remove some headers that may lead nndoc to make
6323 (message-narrow-to-head)
6324 (goto-char (point-min))
6325 (delete-matching-lines "^\\(Path\\):\\|^From ")
6328 (gnus-group-read-ephemeral-group
6329 group `(nndoc ,group (nndoc-address ,(current-buffer))
6330 (nndoc-article-type guess))
6333 ;; Make all postings to this group go to the parent group.
6334 (nconc (gnus-info-params (gnus-get-info egroup))
6336 (push egroup groups))
6337 ;; Couldn't select this doc group.
6338 (gnus-error 3 "Article couldn't be entered"))))))
6339 ;; Now we have selected all the documents.
6342 (error "None of the articles could be interpreted as documents"))
6343 ((gnus-group-read-ephemeral-group
6344 (setq vgroup (format
6345 "nnvirtual:%s-%s" gnus-newsgroup-name
6346 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6347 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6349 (cons (current-buffer) 'summary)))
6351 (error "Couldn't select virtual nndoc group")))))
6353 (defun gnus-summary-isearch-article (&optional regexp-p)
6354 "Do incremental search forward on the current article.
6355 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6357 (gnus-set-global-variables)
6358 (gnus-summary-select-article)
6359 (gnus-configure-windows 'article)
6360 (gnus-eval-in-buffer-window gnus-article-buffer
6361 ;;(goto-char (point-min))
6362 (isearch-forward regexp-p)))
6364 (defun gnus-summary-search-article-forward (regexp &optional backward)
6365 "Search for an article containing REGEXP forward.
6366 If BACKWARD, search backward instead."
6369 (format "Search article %s (regexp%s): "
6370 (if current-prefix-arg "backward" "forward")
6371 (if gnus-last-search-regexp
6372 (concat ", default " gnus-last-search-regexp)
6374 current-prefix-arg))
6375 (gnus-set-global-variables)
6376 (if (string-equal regexp "")
6377 (setq regexp (or gnus-last-search-regexp ""))
6378 (setq gnus-last-search-regexp regexp))
6379 (if (gnus-summary-search-article regexp backward)
6380 (gnus-summary-show-thread)
6381 (error "Search failed: \"%s\"" regexp)))
6383 (defun gnus-summary-search-article-backward (regexp)
6384 "Search for an article containing REGEXP backward."
6387 (format "Search article backward (regexp%s): "
6388 (if gnus-last-search-regexp
6389 (concat ", default " gnus-last-search-regexp)
6391 (gnus-summary-search-article-forward regexp 'backward))
6393 (defun gnus-summary-search-article (regexp &optional backward)
6394 "Search for an article containing REGEXP.
6395 Optional argument BACKWARD means do search for backward.
6396 `gnus-select-article-hook' is not called during the search."
6397 (let ((gnus-select-article-hook nil) ;Disable hook.
6398 (gnus-article-display-hook nil)
6399 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6400 (gnus-use-article-prefetch nil)
6401 (sum (current-buffer))
6404 (gnus-save-hidden-threads
6405 (gnus-summary-select-article)
6406 (set-buffer gnus-article-buffer)
6410 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6412 (re-search-backward regexp nil t)
6413 (re-search-forward regexp nil t))
6414 ;; We found the regexp.
6419 (get-buffer-window (current-buffer))
6423 (setq point (point)))
6424 ;; We didn't find it, so we go to the next article.
6427 (while (eq found 'not)
6428 (if (not (if backward (gnus-summary-find-prev)
6429 (gnus-summary-find-next)))
6430 ;; No more articles.
6432 ;; Select the next article and adjust point.
6433 (unless (gnus-summary-article-sparse-p
6434 (gnus-summary-article-number))
6436 (gnus-summary-select-article)
6437 (set-buffer gnus-article-buffer)
6439 (goto-char (if backward (point-max) (point-min))))))))
6440 (gnus-message 7 ""))
6441 ;; Return whether we found the regexp.
6442 (when (eq found 'found)
6444 (gnus-summary-show-thread)
6445 (gnus-summary-goto-subject gnus-current-article)
6446 (gnus-summary-position-point)
6449 (defun gnus-summary-find-matching (header regexp &optional backward unread
6451 "Return a list of all articles that match REGEXP on HEADER.
6452 The search stars on the current article and goes forwards unless
6453 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6454 If UNREAD is non-nil, only unread articles will
6455 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6456 in the comparisons."
6457 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6458 (gnus-data-find-list
6459 (gnus-summary-article-number) (gnus-data-list backward))))
6460 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6461 (case-fold-search (not not-case-fold))
6463 (unless (fboundp (intern (concat "mail-header-" header)))
6464 (error "%s is not a valid header" header))
6467 (and (or (not unread) ; We want all articles...
6468 (gnus-data-unread-p d)) ; Or just unreads.
6469 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6470 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6471 (push (gnus-data-number d) articles)) ; Success!
6472 (setq data (cdr data)))
6473 (nreverse articles)))
6475 (defun gnus-summary-execute-command (header regexp command &optional backward)
6476 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6477 If HEADER is an empty string (or nil), the match is done on the entire
6478 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6480 (list (let ((completion-ignore-case t))
6483 (mapcar (lambda (string) (list string))
6484 '("Number" "Subject" "From" "Lines" "Date"
6485 "Message-ID" "Xref" "References" "Body"))
6486 nil 'require-match))
6487 (read-string "Regexp: ")
6488 (read-key-sequence "Command: ")
6489 current-prefix-arg))
6490 (when (equal header "Body")
6492 (gnus-set-global-variables)
6493 ;; Hidden thread subtrees must be searched as well.
6494 (gnus-summary-show-all-threads)
6495 ;; We don't want to change current point nor window configuration.
6497 (save-window-excursion
6498 (gnus-message 6 "Executing %s..." (key-description command))
6499 ;; We'd like to execute COMMAND interactively so as to give arguments.
6500 (gnus-execute header regexp
6501 `(call-interactively ',(key-binding command))
6503 (gnus-message 6 "Executing %s...done" (key-description command)))))
6505 (defun gnus-summary-beginning-of-article ()
6506 "Scroll the article back to the beginning."
6508 (gnus-set-global-variables)
6509 (gnus-summary-select-article)
6510 (gnus-configure-windows 'article)
6511 (gnus-eval-in-buffer-window gnus-article-buffer
6513 (goto-char (point-min))
6514 (when gnus-break-pages
6515 (gnus-narrow-to-page))))
6517 (defun gnus-summary-end-of-article ()
6518 "Scroll to the end of the article."
6520 (gnus-set-global-variables)
6521 (gnus-summary-select-article)
6522 (gnus-configure-windows 'article)
6523 (gnus-eval-in-buffer-window gnus-article-buffer
6525 (goto-char (point-max))
6527 (when gnus-break-pages
6528 (gnus-narrow-to-page))))
6530 (defun gnus-summary-print-article (&optional filename)
6531 "Generate and print a PostScript image of the article buffer.
6533 If the optional argument FILENAME is nil, send the image to the printer.
6534 If FILENAME is a string, save the PostScript image in a file with that
6535 name. If FILENAME is a number, prompt the user for the name of the file
6537 (interactive (list (ps-print-preprint current-prefix-arg)))
6538 (gnus-summary-select-article)
6539 (gnus-eval-in-buffer-window gnus-article-buffer
6540 (let ((buffer (generate-new-buffer " *print*")))
6543 (copy-to-buffer buffer (point-min) (point-max))
6545 (article-delete-invisible-text)
6546 (ps-print-buffer-with-faces filename))
6547 (kill-buffer buffer)))))
6549 (defun gnus-summary-show-article (&optional arg)
6550 "Force re-fetching of the current article.
6551 If ARG (the prefix) is non-nil, show the raw article without any
6552 article massaging functions being run."
6554 (gnus-set-global-variables)
6556 ;; Select the article the normal way.
6557 (gnus-summary-select-article nil 'force)
6558 ;; Bind the article treatment functions to nil.
6559 (let ((gnus-have-all-headers t)
6560 gnus-article-display-hook
6561 gnus-article-prepare-hook
6564 (gnus-summary-select-article nil 'force)))
6565 (gnus-summary-goto-subject gnus-current-article)
6566 ; (gnus-configure-windows 'article)
6567 (gnus-summary-position-point))
6569 (defun gnus-summary-verbose-headers (&optional arg)
6570 "Toggle permanent full header display.
6571 If ARG is a positive number, turn header display on.
6572 If ARG is a negative number, turn header display off."
6574 (gnus-set-global-variables)
6575 (setq gnus-show-all-headers
6576 (cond ((or (not (numberp arg))
6578 (not gnus-show-all-headers))
6581 (gnus-summary-show-article))
6583 (defun gnus-summary-toggle-header (&optional arg)
6584 "Show the headers if they are hidden, or hide them if they are shown.
6585 If ARG is a positive number, show the entire header.
6586 If ARG is a negative number, hide the unwanted header lines."
6588 (gnus-set-global-variables)
6590 (set-buffer gnus-article-buffer)
6591 (let* ((buffer-read-only nil)
6592 (inhibit-point-motion-hooks t)
6593 (hidden (text-property-any
6594 (goto-char (point-min)) (search-forward "\n\n")
6597 (goto-char (point-min))
6598 (when (search-forward "\n\n" nil t)
6599 (delete-region (point-min) (1- (point))))
6600 (goto-char (point-min))
6602 (set-buffer gnus-original-article-buffer)
6603 (goto-char (point-min))
6604 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6605 (insert-buffer-substring gnus-original-article-buffer 1 e)
6606 (let ((article-inhibit-hiding t))
6607 (run-hooks 'gnus-article-display-hook))
6608 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6609 (gnus-article-hide-headers)))))
6611 (defun gnus-summary-show-all-headers ()
6612 "Make all header lines visible."
6614 (gnus-set-global-variables)
6615 (gnus-article-show-all-headers))
6617 (defun gnus-summary-toggle-mime (&optional arg)
6618 "Toggle MIME processing.
6619 If ARG is a positive number, turn MIME processing on."
6621 (gnus-set-global-variables)
6622 (setq gnus-show-mime
6623 (if (null arg) (not gnus-show-mime)
6624 (> (prefix-numeric-value arg) 0)))
6625 (gnus-summary-select-article t 'force))
6627 (defun gnus-summary-caesar-message (&optional arg)
6628 "Caesar rotate the current article by 13.
6629 The numerical prefix specifies how manu places to rotate each letter
6632 (gnus-set-global-variables)
6633 (gnus-summary-select-article)
6634 (let ((mail-header-separator ""))
6635 (gnus-eval-in-buffer-window gnus-article-buffer
6638 (let ((start (window-start))
6640 (message-caesar-buffer-body arg)
6641 (set-window-start (get-buffer-window (current-buffer)) start))))))
6643 (defun gnus-summary-stop-page-breaking ()
6644 "Stop page breaking in the current article."
6646 (gnus-set-global-variables)
6647 (gnus-summary-select-article)
6648 (gnus-eval-in-buffer-window gnus-article-buffer
6650 (when (gnus-visual-p 'page-marker)
6651 (let ((buffer-read-only nil))
6652 (gnus-remove-text-with-property 'gnus-prev)
6653 (gnus-remove-text-with-property 'gnus-next)))))
6655 (defun gnus-summary-move-article (&optional n to-newsgroup
6656 select-method action)
6657 "Move the current article to a different newsgroup.
6658 If N is a positive number, move the N next articles.
6659 If N is a negative number, move the N previous articles.
6660 If N is nil and any articles have been marked with the process mark,
6661 move those articles instead.
6662 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6663 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6664 re-spool using this method.
6666 For this function to work, both the current newsgroup and the
6667 newsgroup that you want to move to have to support the `request-move'
6668 and `request-accept' functions."
6671 (setq action 'move))
6672 (gnus-set-global-variables)
6673 ;; Disable marking as read.
6674 (let (gnus-mark-article-hook)
6675 (save-window-excursion
6676 (gnus-summary-select-article)))
6677 ;; Check whether the source group supports the required functions.
6678 (cond ((and (eq action 'move)
6679 (not (gnus-check-backend-function
6680 'request-move-article gnus-newsgroup-name)))
6681 (error "The current group does not support article moving"))
6682 ((and (eq action 'crosspost)
6683 (not (gnus-check-backend-function
6684 'request-replace-article gnus-newsgroup-name)))
6685 (error "The current group does not support article editing")))
6686 (let ((articles (gnus-summary-work-articles n))
6687 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
6688 (names '((move "Move" "Moving")
6689 (copy "Copy" "Copying")
6690 (crosspost "Crosspost" "Crossposting")))
6691 (copy-buf (save-excursion
6692 (nnheader-set-temp-buffer " *copy article*")))
6693 art-group to-method new-xref article to-groups)
6694 (unless (assq action names)
6695 (error "Unknown action %s" action))
6696 ;; Read the newsgroup name.
6697 (when (and (not to-newsgroup)
6698 (not select-method))
6700 (gnus-read-move-group-name
6701 (cadr (assq action names))
6702 (symbol-value (intern (format "gnus-current-%s-group" action)))
6704 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
6705 (setq to-method (or select-method
6706 (gnus-group-name-to-method to-newsgroup)))
6707 ;; Check the method we are to move this article to...
6708 (unless (gnus-check-backend-function
6709 'request-accept-article (car to-method))
6710 (error "%s does not support article copying" (car to-method)))
6711 (unless (gnus-check-server to-method)
6712 (error "Can't open server %s" (car to-method)))
6713 (gnus-message 6 "%s to %s: %s..."
6714 (caddr (assq action names))
6715 (or (car select-method) to-newsgroup) articles)
6717 (setq article (pop articles))
6721 ;; Move the article.
6723 (gnus-request-move-article
6724 article ; Article to move
6725 gnus-newsgroup-name ; From newsgroup
6726 (nth 1 (gnus-find-method-for-group
6727 gnus-newsgroup-name)) ; Server
6728 (list 'gnus-request-accept-article
6729 to-newsgroup (list 'quote select-method)
6730 (not articles)) ; Accept form
6731 (not articles))) ; Only save nov last time
6732 ;; Copy the article.
6735 (set-buffer copy-buf)
6736 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6737 (gnus-request-accept-article
6738 to-newsgroup select-method (not articles))))
6739 ;; Crosspost the article.
6740 ((eq action 'crosspost)
6741 (let ((xref (message-tokenize-header
6742 (mail-header-xref (gnus-summary-article-header article))
6744 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
6747 (setq xref (list (system-name))))
6750 (mapconcat 'identity
6751 (delete "Xref:" (delete new-xref xref))
6755 (set-buffer copy-buf)
6756 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6757 (nnheader-replace-header "xref" new-xref)
6758 (gnus-request-accept-article
6759 to-newsgroup select-method (not articles)))))))
6761 (gnus-message 1 "Couldn't %s article %s"
6762 (cadr (assq action names)) article)
6765 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6767 (gnus-group-prefixed-name
6770 (gnus-find-method-for-group to-newsgroup)))
6771 gnus-newsrc-hashtb)))
6772 (info (nth 2 entry))
6773 (to-group (gnus-info-group info)))
6774 ;; Update the group that has been moved to.
6776 (memq action '(move copy)))
6777 (unless (member to-group to-groups)
6778 (push to-group to-groups))
6780 (unless (memq article gnus-newsgroup-unreads)
6782 info (gnus-add-to-range (gnus-info-read info)
6783 (list (cdr art-group)))))
6785 ;; Copy any marks over to the new group.
6786 (let ((marks gnus-article-mark-lists)
6787 (to-article (cdr art-group)))
6789 ;; See whether the article is to be put in the cache.
6790 (when gnus-use-cache
6791 (gnus-cache-possibly-enter-article
6793 (let ((header (copy-sequence
6794 (gnus-summary-article-header article))))
6795 (mail-header-set-number header to-article)
6797 (memq article gnus-newsgroup-marked)
6798 (memq article gnus-newsgroup-dormant)
6799 (memq article gnus-newsgroup-unreads)))
6802 (when (memq article (symbol-value
6803 (intern (format "gnus-newsgroup-%s"
6805 ;; If the other group is the same as this group,
6806 ;; then we have to add the mark to the list.
6807 (when (equal to-group gnus-newsgroup-name)
6808 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
6811 (intern (format "gnus-newsgroup-%s"
6813 ;; Copy mark to other group.
6814 (gnus-add-marked-articles
6815 to-group (cdar marks) (list to-article) info))
6816 (setq marks (cdr marks)))))
6818 ;; Update the Xref header in this article to point to
6819 ;; the new crossposted article we have just created.
6820 (when (eq action 'crosspost)
6822 (set-buffer copy-buf)
6823 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6824 (nnheader-replace-header
6825 "xref" (concat new-xref " " (car art-group)
6826 ":" (cdr art-group)))
6827 (gnus-request-replace-article
6828 article gnus-newsgroup-name (current-buffer)))))
6830 (gnus-summary-goto-subject article)
6831 (when (eq action 'move)
6832 (gnus-summary-mark-article article gnus-canceled-mark)))
6833 (gnus-summary-remove-process-mark article))
6834 ;; Re-activate all groups that have been moved to.
6836 (gnus-activate-group (pop to-groups)))
6838 (gnus-kill-buffer copy-buf)
6839 (gnus-summary-position-point)
6840 (gnus-set-mode-line 'summary)))
6842 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
6843 "Move the current article to a different newsgroup.
6844 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
6845 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
6846 re-spool using this method."
6848 (gnus-summary-move-article n nil select-method 'copy))
6850 (defun gnus-summary-crosspost-article (&optional n)
6851 "Crosspost the current article to some other group."
6853 (gnus-summary-move-article n nil nil 'crosspost))
6855 (defcustom gnus-summary-respool-default-method nil
6856 "Default method for respooling an article.
6857 If nil, use to the current newsgroup method."
6858 :type 'gnus-select-method-name
6859 :group 'gnus-summary-mail)
6861 (defun gnus-summary-respool-article (&optional n method)
6862 "Respool the current article.
6863 The article will be squeezed through the mail spooling process again,
6864 which means that it will be put in some mail newsgroup or other
6865 depending on `nnmail-split-methods'.
6866 If N is a positive number, respool the N next articles.
6867 If N is a negative number, respool the N previous articles.
6868 If N is nil and any articles have been marked with the process mark,
6869 respool those articles instead.
6871 Respooling can be done both from mail groups and \"real\" newsgroups.
6872 In the former case, the articles in question will be moved from the
6873 current group into whatever groups they are destined to. In the
6874 latter case, they will be copied into the relevant groups."
6876 (list current-prefix-arg
6877 (let* ((methods (gnus-methods-using 'respool))
6879 (symbol-name (or gnus-summary-respool-default-method
6880 (car (gnus-find-method-for-group
6881 gnus-newsgroup-name)))))
6883 (gnus-completing-read
6884 methname "What backend do you want to use when respooling?"
6885 methods nil t nil 'gnus-mail-method-history))
6888 ((zerop (length (setq ms (gnus-servers-using-backend
6890 (list (intern method) ""))
6894 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
6895 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
6897 (gnus-set-global-variables)
6899 (error "No method given for respooling"))
6900 (if (assoc (symbol-name
6901 (car (gnus-find-method-for-group gnus-newsgroup-name)))
6902 (gnus-methods-using 'respool))
6903 (gnus-summary-move-article n nil method)
6904 (gnus-summary-copy-article n nil method)))
6906 (defun gnus-summary-import-article (file)
6907 "Import a random file into a mail newsgroup."
6908 (interactive "fImport file: ")
6909 (gnus-set-global-variables)
6910 (let ((group gnus-newsgroup-name)
6911 (now (current-time))
6913 (unless (gnus-check-backend-function 'request-accept-article group)
6914 (error "%s does not support article importing" group))
6915 (or (file-readable-p file)
6916 (not (file-regular-p file))
6917 (error "Can't read %s" file))
6919 (set-buffer (get-buffer-create " *import file*"))
6920 (buffer-disable-undo (current-buffer))
6922 (insert-file-contents file)
6923 (goto-char (point-min))
6924 (unless (nnheader-article-p)
6925 ;; This doesn't look like an article, so we fudge some headers.
6926 (setq atts (file-attributes file)
6927 lines (count-lines (point-min) (point-max)))
6928 (insert "From: " (read-string "From: ") "\n"
6929 "Subject: " (read-string "Subject: ") "\n"
6930 "Date: " (timezone-make-date-arpa-standard
6931 (current-time-string (nth 5 atts))
6932 (current-time-zone now)
6933 (current-time-zone now))
6935 "Message-ID: " (message-make-message-id) "\n"
6936 "Lines: " (int-to-string lines) "\n"
6937 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
6938 (gnus-request-accept-article group nil t)
6939 (kill-buffer (current-buffer)))))
6941 (defun gnus-summary-article-posted-p ()
6942 "Say whether the current (mail) article is available from `gnus-select-method' as well.
6943 This will be the case if the article has both been mailed and posted."
6945 (let ((id (mail-header-references (gnus-summary-article-header)))
6946 (gnus-override-method
6947 (or gnus-refer-article-method gnus-select-method)))
6948 (if (gnus-request-head id "")
6949 (gnus-message 2 "The current message was found on %s"
6950 gnus-override-method)
6951 (gnus-message 2 "The current message couldn't be found on %s"
6952 gnus-override-method)
6955 (defun gnus-summary-expire-articles (&optional now)
6956 "Expire all articles that are marked as expirable in the current group."
6958 (gnus-set-global-variables)
6959 (when (gnus-check-backend-function
6960 'request-expire-articles gnus-newsgroup-name)
6961 ;; This backend supports expiry.
6962 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
6963 (expirable (if total
6965 ;; We need to update the info for
6966 ;; this group for `gnus-list-of-read-articles'
6967 ;; to give us the right answer.
6968 (run-hooks 'gnus-exit-group-hook)
6969 (gnus-summary-update-info)
6970 (gnus-list-of-read-articles gnus-newsgroup-name))
6971 (setq gnus-newsgroup-expirable
6972 (sort gnus-newsgroup-expirable '<))))
6973 (expiry-wait (if now 'immediate
6974 (gnus-group-find-parameter
6975 gnus-newsgroup-name 'expiry-wait)))
6978 ;; There are expirable articles in this group, so we run them
6979 ;; through the expiry process.
6980 (gnus-message 6 "Expiring articles...")
6981 ;; The list of articles that weren't expired is returned.
6983 (let ((nnmail-expiry-wait-function nil)
6984 (nnmail-expiry-wait expiry-wait))
6985 (setq es (gnus-request-expire-articles
6986 expirable gnus-newsgroup-name)))
6987 (setq es (gnus-request-expire-articles
6988 expirable gnus-newsgroup-name)))
6990 (setq gnus-newsgroup-expirable es))
6991 ;; We go through the old list of expirable, and mark all
6992 ;; really expired articles as nonexistent.
6993 (unless (eq es expirable) ;If nothing was expired, we don't mark.
6994 (let ((gnus-use-cache nil))
6996 (unless (memq (car expirable) es)
6997 (when (gnus-data-find (car expirable))
6998 (gnus-summary-mark-article
6999 (car expirable) gnus-canceled-mark)))
7000 (setq expirable (cdr expirable)))))
7001 (gnus-message 6 "Expiring articles...done")))))
7003 (defun gnus-summary-expire-articles-now ()
7004 "Expunge all expirable articles in the current group.
7005 This means that *all* articles that are marked as expirable will be
7006 deleted forever, right now."
7008 (gnus-set-global-variables)
7009 (or gnus-expert-user
7011 "Are you really, really, really sure you want to delete all these messages? ")
7013 (gnus-summary-expire-articles t))
7015 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7016 (defun gnus-summary-delete-article (&optional n)
7017 "Delete the N next (mail) articles.
7018 This command actually deletes articles. This is not a marking
7019 command. The article will disappear forever from your life, never to
7021 If N is negative, delete backwards.
7022 If N is nil and articles have been marked with the process mark,
7023 delete these instead."
7025 (gnus-set-global-variables)
7026 (unless (gnus-check-backend-function 'request-expire-articles
7027 gnus-newsgroup-name)
7028 (error "The current newsgroup does not support article deletion."))
7029 ;; Compute the list of articles to delete.
7030 (let ((articles (gnus-summary-work-articles n))
7032 (if (and gnus-novice-user
7034 (format "Do you really want to delete %s forever? "
7035 (if (> (length articles) 1)
7036 (format "these %s articles" (length articles))
7039 ;; Delete the articles.
7040 (setq not-deleted (gnus-request-expire-articles
7041 articles gnus-newsgroup-name 'force))
7043 (gnus-summary-remove-process-mark (car articles))
7044 ;; The backend might not have been able to delete the article
7046 (unless (memq (car articles) not-deleted)
7047 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7048 (setq articles (cdr articles))))
7049 (gnus-summary-position-point)
7050 (gnus-set-mode-line 'summary)
7053 (defun gnus-summary-edit-article (&optional force)
7054 "Edit the current article.
7055 This will have permanent effect only in mail groups.
7056 If FORCE is non-nil, allow editing of articles even in read-only
7060 (set-buffer gnus-summary-buffer)
7061 (gnus-set-global-variables)
7062 (when (and (not force)
7063 (gnus-group-read-only-p))
7064 (error "The current newsgroup does not support article editing."))
7065 ;; Select article if needed.
7066 (unless (eq (gnus-summary-article-number)
7067 gnus-current-article)
7068 (gnus-summary-select-article t))
7069 (gnus-article-edit-article
7071 (gnus-summary-edit-article-done
7072 ,(or (mail-header-references gnus-current-headers) "")
7073 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
7075 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7077 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
7078 "Make edits to the current article permanent."
7080 ;; Replace the article.
7081 (if (and (not read-only)
7082 (not (gnus-request-replace-article
7083 (cdr gnus-article-current) (car gnus-article-current)
7085 (error "Couldn't replace article.")
7086 ;; Update the summary buffer.
7088 (equal (message-tokenize-header references " ")
7089 (message-tokenize-header
7090 (or (message-fetch-field "references") "") " ")))
7091 ;; We only have to update this line.
7094 (message-narrow-to-head)
7095 (let ((header (nnheader-parse-head t)))
7097 (mail-header-set-number header (cdr gnus-article-current))
7098 (gnus-summary-update-article-line
7099 (cdr gnus-article-current) header))))
7101 (set-buffer (or buffer gnus-summary-buffer))
7102 (gnus-summary-update-article (cdr gnus-article-current)))
7103 ;; Prettify the article buffer again.
7105 (set-buffer gnus-article-buffer)
7106 (run-hooks 'gnus-article-display-hook))
7107 ;; Prettify the summary buffer line.
7108 (when (gnus-visual-p 'summary-highlight 'highlight)
7109 (run-hooks 'gnus-visual-mark-article-hook))))
7111 (defun gnus-summary-edit-wash (key)
7112 "Perform editing command in the article buffer."
7116 (message "%s" (concat (this-command-keys) "- "))
7119 (gnus-summary-edit-article)
7120 (execute-kbd-macro (concat (this-command-keys) key))
7121 (gnus-article-edit-done))
7125 (defun gnus-summary-respool-query ()
7126 "Query where the respool algorithm would put this article."
7128 (gnus-set-global-variables)
7129 (gnus-summary-select-article)
7131 (set-buffer gnus-article-buffer)
7133 (goto-char (point-min))
7134 (search-forward "\n\n")
7135 (narrow-to-region (point-min) (point))
7136 (message "This message would go to %s"
7137 (mapconcat 'car (nnmail-article-group 'identity) ", ")))))
7139 ;; Summary marking commands.
7141 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7142 "Mark articles which has the same subject as read, and then select the next.
7143 If UNMARK is positive, remove any kind of mark.
7144 If UNMARK is negative, tick articles."
7146 (gnus-set-global-variables)
7148 (setq unmark (prefix-numeric-value unmark)))
7150 (gnus-summary-mark-same-subject
7151 (gnus-summary-article-subject) unmark)))
7152 ;; Select next unread article. If auto-select-same mode, should
7153 ;; select the first unread article.
7154 (gnus-summary-next-article t (and gnus-auto-select-same
7155 (gnus-summary-article-subject)))
7156 (gnus-message 7 "%d article%s marked as %s"
7157 count (if (= count 1) " is" "s are")
7158 (if unmark "unread" "read"))))
7160 (defun gnus-summary-kill-same-subject (&optional unmark)
7161 "Mark articles which has the same subject as read.
7162 If UNMARK is positive, remove any kind of mark.
7163 If UNMARK is negative, tick articles."
7165 (gnus-set-global-variables)
7167 (setq unmark (prefix-numeric-value unmark)))
7169 (gnus-summary-mark-same-subject
7170 (gnus-summary-article-subject) unmark)))
7171 ;; If marked as read, go to next unread subject.
7173 ;; Go to next unread subject.
7174 (gnus-summary-next-subject 1 t))
7175 (gnus-message 7 "%d articles are marked as %s"
7176 count (if unmark "unread" "read"))))
7178 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7179 "Mark articles with same SUBJECT as read, and return marked number.
7180 If optional argument UNMARK is positive, remove any kinds of marks.
7181 If optional argument UNMARK is negative, mark articles as unread instead."
7185 ((null unmark) ; Mark as read.
7188 (gnus-summary-mark-article-as-read gnus-killed-mark)
7189 (gnus-summary-show-thread) t)
7190 (gnus-summary-find-subject subject))
7191 (setq count (1+ count))))
7192 ((> unmark 0) ; Tick.
7195 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7196 (gnus-summary-show-thread) t)
7197 (gnus-summary-find-subject subject))
7198 (setq count (1+ count))))
7199 (t ; Mark as unread.
7202 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7203 (gnus-summary-show-thread) t)
7204 (gnus-summary-find-subject subject))
7205 (setq count (1+ count)))))
7206 (gnus-set-mode-line 'summary)
7207 ;; Return the number of marked articles.
7210 (defun gnus-summary-mark-as-processable (n &optional unmark)
7211 "Set the process mark on the next N articles.
7212 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7213 the process mark instead. The difference between N and the actual
7214 number of articles marked is returned."
7216 (gnus-set-global-variables)
7217 (let ((backward (< n 0))
7222 (gnus-summary-remove-process-mark
7223 (gnus-summary-article-number))
7224 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7225 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7228 (gnus-message 7 "No more articles"))
7229 (gnus-summary-recenter)
7230 (gnus-summary-position-point)
7233 (defun gnus-summary-unmark-as-processable (n)
7234 "Remove the process mark from the next N articles.
7235 If N is negative, mark backward instead. The difference between N and
7236 the actual number of articles marked is returned."
7238 (gnus-set-global-variables)
7239 (gnus-summary-mark-as-processable n t))
7241 (defun gnus-summary-unmark-all-processable ()
7242 "Remove the process mark from all articles."
7244 (gnus-set-global-variables)
7246 (while gnus-newsgroup-processable
7247 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7248 (gnus-summary-position-point))
7250 (defun gnus-summary-mark-as-expirable (n)
7251 "Mark N articles forward as expirable.
7252 If N is negative, mark backward instead. The difference between N and
7253 the actual number of articles marked is returned."
7255 (gnus-set-global-variables)
7256 (gnus-summary-mark-forward n gnus-expirable-mark))
7258 (defun gnus-summary-mark-article-as-replied (article)
7259 "Mark ARTICLE replied and update the summary line."
7260 (push article gnus-newsgroup-replied)
7261 (let ((buffer-read-only nil))
7262 (when (gnus-summary-goto-subject article)
7263 (gnus-summary-update-secondary-mark article))))
7265 (defun gnus-summary-set-bookmark (article)
7266 "Set a bookmark in current article."
7267 (interactive (list (gnus-summary-article-number)))
7268 (gnus-set-global-variables)
7269 (when (or (not (get-buffer gnus-article-buffer))
7270 (not gnus-current-article)
7271 (not gnus-article-current)
7272 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7273 (error "No current article selected"))
7274 ;; Remove old bookmark, if one exists.
7275 (let ((old (assq article gnus-newsgroup-bookmarks)))
7277 (setq gnus-newsgroup-bookmarks
7278 (delq old gnus-newsgroup-bookmarks))))
7279 ;; Set the new bookmark, which is on the form
7280 ;; (article-number . line-number-in-body).
7284 (set-buffer gnus-article-buffer)
7288 (goto-char (point-min))
7289 (search-forward "\n\n" nil t)
7292 gnus-newsgroup-bookmarks)
7293 (gnus-message 6 "A bookmark has been added to the current article."))
7295 (defun gnus-summary-remove-bookmark (article)
7296 "Remove the bookmark from the current article."
7297 (interactive (list (gnus-summary-article-number)))
7298 (gnus-set-global-variables)
7299 ;; Remove old bookmark, if one exists.
7300 (let ((old (assq article gnus-newsgroup-bookmarks)))
7303 (setq gnus-newsgroup-bookmarks
7304 (delq old gnus-newsgroup-bookmarks))
7305 (gnus-message 6 "Removed bookmark."))
7306 (gnus-message 6 "No bookmark in current article."))))
7308 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7309 (defun gnus-summary-mark-as-dormant (n)
7310 "Mark N articles forward as dormant.
7311 If N is negative, mark backward instead. The difference between N and
7312 the actual number of articles marked is returned."
7314 (gnus-set-global-variables)
7315 (gnus-summary-mark-forward n gnus-dormant-mark))
7317 (defun gnus-summary-set-process-mark (article)
7318 "Set the process mark on ARTICLE and update the summary line."
7319 (setq gnus-newsgroup-processable
7321 (delq article gnus-newsgroup-processable)))
7322 (when (gnus-summary-goto-subject article)
7323 (gnus-summary-show-thread)
7324 (gnus-summary-update-secondary-mark article)))
7326 (defun gnus-summary-remove-process-mark (article)
7327 "Remove the process mark from ARTICLE and update the summary line."
7328 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7329 (when (gnus-summary-goto-subject article)
7330 (gnus-summary-show-thread)
7331 (gnus-summary-update-secondary-mark article)))
7333 (defun gnus-summary-set-saved-mark (article)
7334 "Set the process mark on ARTICLE and update the summary line."
7335 (push article gnus-newsgroup-saved)
7336 (when (gnus-summary-goto-subject article)
7337 (gnus-summary-update-secondary-mark article)))
7339 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7340 "Mark N articles as read forwards.
7341 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7342 The difference between N and the actual number of articles marked is
7345 (gnus-set-global-variables)
7346 (let ((backward (< n 0))
7347 (gnus-summary-goto-unread
7348 (and gnus-summary-goto-unread
7349 (not (eq gnus-summary-goto-unread 'never))
7350 (not (memq mark (list gnus-unread-mark
7351 gnus-ticked-mark gnus-dormant-mark)))))
7353 (mark (or mark gnus-del-mark)))
7355 (gnus-summary-mark-article nil mark no-expire)
7356 (zerop (gnus-summary-next-subject
7358 (and gnus-summary-goto-unread
7359 (not (eq gnus-summary-goto-unread 'never)))
7363 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7364 (gnus-summary-recenter)
7365 (gnus-summary-position-point)
7366 (gnus-set-mode-line 'summary)
7369 (defun gnus-summary-mark-article-as-read (mark)
7370 "Mark the current article quickly as read with MARK."
7371 (let ((article (gnus-summary-article-number)))
7372 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7373 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7374 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7375 (push (cons article mark) gnus-newsgroup-reads)
7376 ;; Possibly remove from cache, if that is used.
7377 (when gnus-use-cache
7378 (gnus-cache-enter-remove-article article))
7379 ;; Allow the backend to change the mark.
7380 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7381 ;; Check for auto-expiry.
7382 (when (and gnus-newsgroup-auto-expire
7383 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7384 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7385 (= mark gnus-ancient-mark)
7386 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7387 (= mark gnus-duplicate-mark)))
7388 (setq mark gnus-expirable-mark)
7389 (push article gnus-newsgroup-expirable))
7390 ;; Set the mark in the buffer.
7391 (gnus-summary-update-mark mark 'unread)
7394 (defun gnus-summary-mark-article-as-unread (mark)
7395 "Mark the current article quickly as unread with MARK."
7396 (let ((article (gnus-summary-article-number)))
7398 (gnus-error 1 "Unmarkable article")
7399 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7400 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7401 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7402 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7403 (cond ((= mark gnus-ticked-mark)
7404 (push article gnus-newsgroup-marked))
7405 ((= mark gnus-dormant-mark)
7406 (push article gnus-newsgroup-dormant))
7408 (push article gnus-newsgroup-unreads)))
7409 (setq gnus-newsgroup-reads
7410 (delq (assq article gnus-newsgroup-reads)
7411 gnus-newsgroup-reads))
7413 ;; See whether the article is to be put in the cache.
7415 (vectorp (gnus-summary-article-header article))
7417 (gnus-cache-possibly-enter-article
7418 gnus-newsgroup-name article
7419 (gnus-summary-article-header article)
7420 (= mark gnus-ticked-mark)
7421 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7424 (gnus-summary-update-mark mark 'unread))
7427 (defun gnus-summary-mark-article (&optional article mark no-expire)
7428 "Mark ARTICLE with MARK. MARK can be any character.
7429 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7430 `??' (dormant) and `?E' (expirable).
7431 If MARK is nil, then the default character `?D' is used.
7432 If ARTICLE is nil, then the article on the current line will be
7434 ;; The mark might be a string.
7435 (when (stringp mark)
7436 (setq mark (aref mark 0)))
7437 ;; If no mark is given, then we check auto-expiring.
7438 (and (not no-expire)
7439 gnus-newsgroup-auto-expire
7442 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7443 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7444 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7445 (= mark gnus-duplicate-mark))))
7446 (setq mark gnus-expirable-mark))
7447 (let* ((mark (or mark gnus-del-mark))
7448 (article (or article (gnus-summary-article-number))))
7450 (error "No article on current line"))
7451 (if (or (= mark gnus-unread-mark)
7452 (= mark gnus-ticked-mark)
7453 (= mark gnus-dormant-mark))
7454 (gnus-mark-article-as-unread article mark)
7455 (gnus-mark-article-as-read article mark))
7457 ;; See whether the article is to be put in the cache.
7459 (not (= mark gnus-canceled-mark))
7460 (vectorp (gnus-summary-article-header article))
7462 (gnus-cache-possibly-enter-article
7463 gnus-newsgroup-name article
7464 (gnus-summary-article-header article)
7465 (= mark gnus-ticked-mark)
7466 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7468 (when (gnus-summary-goto-subject article nil t)
7469 (let ((buffer-read-only nil))
7470 (gnus-summary-show-thread)
7472 (gnus-summary-update-mark mark 'unread)
7475 (defun gnus-summary-update-secondary-mark (article)
7476 "Update the secondary (read, process, cache) mark."
7477 (gnus-summary-update-mark
7478 (cond ((memq article gnus-newsgroup-processable)
7480 ((memq article gnus-newsgroup-cached)
7482 ((memq article gnus-newsgroup-replied)
7484 ((memq article gnus-newsgroup-saved)
7486 (t gnus-unread-mark))
7488 (when (gnus-visual-p 'summary-highlight 'highlight)
7489 (run-hooks 'gnus-summary-update-hook))
7492 (defun gnus-summary-update-mark (mark type)
7493 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7494 (buffer-read-only nil))
7495 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7496 (when (looking-at "\r")
7499 (<= (+ forward (point)) (point-max)))
7500 ;; Go to the right position on the line.
7501 (goto-char (+ forward (point)))
7502 ;; Replace the old mark with the new mark.
7503 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
7504 ;; Optionally update the marks by some user rule.
7505 (when (eq type 'unread)
7507 (gnus-data-find (gnus-summary-article-number)) mark)
7508 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
7510 (defun gnus-mark-article-as-read (article &optional mark)
7511 "Enter ARTICLE in the pertinent lists and remove it from others."
7512 ;; Make the article expirable.
7513 (let ((mark (or mark gnus-del-mark)))
7514 (if (= mark gnus-expirable-mark)
7515 (push article gnus-newsgroup-expirable)
7516 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7517 ;; Remove from unread and marked lists.
7518 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7519 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7520 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7521 (push (cons article mark) gnus-newsgroup-reads)
7522 ;; Possibly remove from cache, if that is used.
7523 (when gnus-use-cache
7524 (gnus-cache-enter-remove-article article))))
7526 (defun gnus-mark-article-as-unread (article &optional mark)
7527 "Enter ARTICLE in the pertinent lists and remove it from others."
7528 (let ((mark (or mark gnus-ticked-mark)))
7529 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7530 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7531 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7532 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7534 ;; Unsuppress duplicates?
7535 (when gnus-suppress-duplicates
7536 (gnus-dup-unsuppress-article article))
7538 (cond ((= mark gnus-ticked-mark)
7539 (push article gnus-newsgroup-marked))
7540 ((= mark gnus-dormant-mark)
7541 (push article gnus-newsgroup-dormant))
7543 (push article gnus-newsgroup-unreads)))
7544 (setq gnus-newsgroup-reads
7545 (delq (assq article gnus-newsgroup-reads)
7546 gnus-newsgroup-reads))))
7548 (defalias 'gnus-summary-mark-as-unread-forward
7549 'gnus-summary-tick-article-forward)
7550 (make-obsolete 'gnus-summary-mark-as-unread-forward
7551 'gnus-summary-tick-article-forward)
7552 (defun gnus-summary-tick-article-forward (n)
7553 "Tick N articles forwards.
7554 If N is negative, tick backwards instead.
7555 The difference between N and the number of articles ticked is returned."
7557 (gnus-summary-mark-forward n gnus-ticked-mark))
7559 (defalias 'gnus-summary-mark-as-unread-backward
7560 'gnus-summary-tick-article-backward)
7561 (make-obsolete 'gnus-summary-mark-as-unread-backward
7562 'gnus-summary-tick-article-backward)
7563 (defun gnus-summary-tick-article-backward (n)
7564 "Tick N articles backwards.
7565 The difference between N and the number of articles ticked is returned."
7567 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7569 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7570 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7571 (defun gnus-summary-tick-article (&optional article clear-mark)
7572 "Mark current article as unread.
7573 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7574 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7576 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7579 (defun gnus-summary-mark-as-read-forward (n)
7580 "Mark N articles as read forwards.
7581 If N is negative, mark backwards instead.
7582 The difference between N and the actual number of articles marked is
7585 (gnus-summary-mark-forward n gnus-del-mark t))
7587 (defun gnus-summary-mark-as-read-backward (n)
7588 "Mark the N articles as read backwards.
7589 The difference between N and the actual number of articles marked is
7592 (gnus-summary-mark-forward (- n) gnus-del-mark t))
7594 (defun gnus-summary-mark-as-read (&optional article mark)
7595 "Mark current article as read.
7596 ARTICLE specifies the article to be marked as read.
7597 MARK specifies a string to be inserted at the beginning of the line."
7598 (gnus-summary-mark-article article mark))
7600 (defun gnus-summary-clear-mark-forward (n)
7601 "Clear marks from N articles forward.
7602 If N is negative, clear backward instead.
7603 The difference between N and the number of marks cleared is returned."
7605 (gnus-summary-mark-forward n gnus-unread-mark))
7607 (defun gnus-summary-clear-mark-backward (n)
7608 "Clear marks from N articles backward.
7609 The difference between N and the number of marks cleared is returned."
7611 (gnus-summary-mark-forward (- n) gnus-unread-mark))
7613 (defun gnus-summary-mark-unread-as-read ()
7614 "Intended to be used by `gnus-summary-mark-article-hook'."
7615 (when (memq gnus-current-article gnus-newsgroup-unreads)
7616 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
7618 (defun gnus-summary-mark-read-and-unread-as-read ()
7619 "Intended to be used by `gnus-summary-mark-article-hook'."
7620 (let ((mark (gnus-summary-article-mark)))
7621 (when (or (gnus-unread-mark-p mark)
7622 (gnus-read-mark-p mark))
7623 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
7625 (defun gnus-summary-mark-region-as-read (point mark all)
7626 "Mark all unread articles between point and mark as read.
7627 If given a prefix, mark all articles between point and mark as read,
7628 even ticked and dormant ones."
7629 (interactive "r\nP")
7638 (memq (setq article (gnus-summary-article-number))
7639 gnus-newsgroup-unreads))
7640 (gnus-summary-mark-article article gnus-del-mark))
7642 (gnus-summary-find-next))))))
7644 (defun gnus-summary-mark-below (score mark)
7645 "Mark articles with score less than SCORE with MARK."
7646 (interactive "P\ncMark: ")
7647 (gnus-set-global-variables)
7648 (setq score (if score
7649 (prefix-numeric-value score)
7650 (or gnus-summary-default-score 0)))
7652 (set-buffer gnus-summary-buffer)
7653 (goto-char (point-min))
7656 (and (< (gnus-summary-article-score) score)
7657 (gnus-summary-mark-article nil mark))
7658 (gnus-summary-find-next)))))
7660 (defun gnus-summary-kill-below (&optional score)
7661 "Mark articles with score below SCORE as read."
7663 (gnus-set-global-variables)
7664 (gnus-summary-mark-below score gnus-killed-mark))
7666 (defun gnus-summary-clear-above (&optional score)
7667 "Clear all marks from articles with score above SCORE."
7669 (gnus-set-global-variables)
7670 (gnus-summary-mark-above score gnus-unread-mark))
7672 (defun gnus-summary-tick-above (&optional score)
7673 "Tick all articles with score above SCORE."
7675 (gnus-set-global-variables)
7676 (gnus-summary-mark-above score gnus-ticked-mark))
7678 (defun gnus-summary-mark-above (score mark)
7679 "Mark articles with score over SCORE with MARK."
7680 (interactive "P\ncMark: ")
7681 (gnus-set-global-variables)
7682 (setq score (if score
7683 (prefix-numeric-value score)
7684 (or gnus-summary-default-score 0)))
7686 (set-buffer gnus-summary-buffer)
7687 (goto-char (point-min))
7689 (when (> (gnus-summary-article-score) score)
7690 (gnus-summary-mark-article nil mark))
7692 (gnus-summary-find-next)))))
7694 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7695 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
7696 (defun gnus-summary-limit-include-expunged (&optional no-error)
7697 "Display all the hidden articles that were expunged for low scores."
7699 (gnus-set-global-variables)
7700 (let ((buffer-read-only nil))
7701 (let ((scored gnus-newsgroup-scored)
7704 (unless (gnus-summary-goto-subject (caar scored))
7705 (and (setq h (gnus-summary-article-header (caar scored)))
7706 (< (cdar scored) gnus-summary-expunge-below)
7708 (setq scored (cdr scored)))
7710 (when (not no-error)
7711 (error "No expunged articles hidden."))
7712 (goto-char (point-min))
7713 (gnus-summary-prepare-unthreaded (nreverse headers))
7714 (goto-char (point-min))
7715 (gnus-summary-position-point)
7718 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
7719 "Mark all articles not marked as unread in this newsgroup as read.
7720 If prefix argument ALL is non-nil, all articles are marked as read.
7721 If QUIETLY is non-nil, no questions will be asked.
7722 If TO-HERE is non-nil, it should be a point in the buffer. All
7723 articles before this point will be marked as read.
7724 The number of articles marked as read is returned."
7726 (gnus-set-global-variables)
7730 (not gnus-interactive-catchup) ;Without confirmation?
7734 "Mark absolutely all articles as read? "
7735 "Mark all unread articles as read? ")))
7737 (not gnus-newsgroup-adaptive)
7738 (not gnus-newsgroup-auto-expire)
7739 (not gnus-suppress-duplicates))
7742 (setq gnus-newsgroup-marked nil
7743 gnus-newsgroup-dormant nil))
7744 (setq gnus-newsgroup-unreads nil))
7745 ;; We actually mark all articles as canceled, which we
7746 ;; have to do when using auto-expiry or adaptive scoring.
7747 (gnus-summary-show-all-threads)
7748 (when (gnus-summary-first-subject (not all))
7750 (if to-here (< (point) to-here) t)
7751 (gnus-summary-mark-article-as-read gnus-catchup-mark)
7752 (gnus-summary-find-next (not all)))))
7754 (setq gnus-newsgroup-unreads nil))
7755 (gnus-set-mode-line 'summary))
7757 (gnus-summary-position-point)))
7759 (defun gnus-summary-catchup-to-here (&optional all)
7760 "Mark all unticked articles before the current one as read.
7761 If ALL is non-nil, also mark ticked and dormant articles as read."
7763 (gnus-set-global-variables)
7765 (gnus-save-hidden-threads
7766 (let ((beg (point)))
7767 ;; We check that there are unread articles.
7768 (when (or all (gnus-summary-find-prev))
7769 (gnus-summary-catchup all t beg)))))
7770 (gnus-summary-position-point))
7772 (defun gnus-summary-catchup-all (&optional quietly)
7773 "Mark all articles in this newsgroup as read."
7775 (gnus-set-global-variables)
7776 (gnus-summary-catchup t quietly))
7778 (defun gnus-summary-catchup-and-exit (&optional all quietly)
7779 "Mark all articles not marked as unread in this newsgroup as read, then exit.
7780 If prefix argument ALL is non-nil, all articles are marked as read."
7782 (gnus-set-global-variables)
7783 (when (gnus-summary-catchup all quietly nil 'fast)
7784 ;; Select next newsgroup or exit.
7785 (if (eq gnus-auto-select-next 'quietly)
7786 (gnus-summary-next-group nil)
7787 (gnus-summary-exit))))
7789 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
7790 "Mark all articles in this newsgroup as read, and then exit."
7792 (gnus-set-global-variables)
7793 (gnus-summary-catchup-and-exit t quietly))
7795 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
7796 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
7797 "Mark all articles in this group as read and select the next group.
7798 If given a prefix, mark all articles, unread as well as ticked, as
7801 (gnus-set-global-variables)
7803 (gnus-summary-catchup all))
7804 (gnus-summary-next-article t nil nil t))
7806 ;; Thread-based commands.
7808 (defun gnus-summary-articles-in-thread (&optional article)
7809 "Return a list of all articles in the current thread.
7810 If ARTICLE is non-nil, return all articles in the thread that starts
7812 (let* ((article (or article (gnus-summary-article-number)))
7813 (data (gnus-data-find-list article))
7814 (top-level (gnus-data-level (car data)))
7816 (cond ((null gnus-thread-operation-ignore-subject)
7817 (gnus-simplify-subject-re
7818 (mail-header-subject (gnus-data-header (car data)))))
7819 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
7820 (gnus-simplify-subject-fuzzy
7821 (mail-header-subject (gnus-data-header (car data)))))
7823 (end-point (save-excursion
7824 (if (gnus-summary-go-to-next-thread)
7825 (point) (point-max))))
7828 (< (gnus-data-pos (car data)) end-point))
7829 (when (or (not top-subject)
7830 (string= top-subject
7831 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
7832 (gnus-simplify-subject-fuzzy
7833 (mail-header-subject
7834 (gnus-data-header (car data))))
7835 (gnus-simplify-subject-re
7836 (mail-header-subject
7837 (gnus-data-header (car data)))))))
7838 (push (gnus-data-number (car data)) articles))
7839 (unless (and (setq data (cdr data))
7840 (> (gnus-data-level (car data)) top-level))
7842 ;; Return the list of articles.
7843 (nreverse articles)))
7845 (defun gnus-summary-rethread-current ()
7846 "Rethread the thread the current article is part of."
7848 (gnus-set-global-variables)
7849 (let* ((gnus-show-threads t)
7850 (article (gnus-summary-article-number))
7851 (id (mail-header-id (gnus-summary-article-header)))
7852 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
7854 (error "No article on the current line"))
7855 (gnus-rebuild-thread id)
7856 (gnus-summary-goto-subject article)))
7858 (defun gnus-summary-reparent-thread ()
7859 "Make current article child of the marked (or previous) article.
7861 Note that the re-threading will only work if `gnus-thread-ignore-subject'
7862 is non-nil or the Subject: of both articles are the same."
7864 (unless (not (gnus-group-read-only-p))
7865 (error "The current newsgroup does not support article editing."))
7866 (unless (<= (length gnus-newsgroup-processable) 1)
7867 (error "No more than one article may be marked."))
7868 (save-window-excursion
7869 (let ((gnus-article-buffer " *reparent*")
7870 (current-article (gnus-summary-article-number))
7871 ; first grab the marked article, otherwise one line up.
7872 (parent-article (if (not (null gnus-newsgroup-processable))
7873 (car gnus-newsgroup-processable)
7875 (if (eq (forward-line -1) 0)
7876 (gnus-summary-article-number)
7877 (error "Beginning of summary buffer."))))))
7878 (unless (not (eq current-article parent-article))
7879 (error "An article may not be self-referential."))
7880 (let ((message-id (mail-header-id
7881 (gnus-summary-article-header parent-article))))
7882 (unless (and message-id (not (equal message-id "")))
7883 (error "No message-id in desired parent."))
7884 (gnus-summary-select-article t t nil current-article)
7885 (set-buffer gnus-article-buffer)
7886 (setq buffer-read-only nil)
7887 (let ((buf (format "%s" (buffer-string))))
7890 (goto-char (point-min))
7891 (if (search-forward-regexp "^References: " nil t)
7892 (insert message-id " " )
7893 (insert "References: " message-id "\n"))
7894 (unless (gnus-request-replace-article current-article
7895 (car gnus-article-current)
7896 gnus-article-buffer)
7897 (error "Couldn't replace article."))
7898 (set-buffer gnus-summary-buffer)
7899 (gnus-summary-unmark-all-processable)
7900 (gnus-summary-rethread-current)
7901 (gnus-message 3 "Article %d is now the child of article %d."
7902 current-article parent-article)))))
7904 (defun gnus-summary-toggle-threads (&optional arg)
7905 "Toggle showing conversation threads.
7906 If ARG is positive number, turn showing conversation threads on."
7908 (gnus-set-global-variables)
7909 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
7910 (setq gnus-show-threads
7911 (if (null arg) (not gnus-show-threads)
7912 (> (prefix-numeric-value arg) 0)))
7913 (gnus-summary-prepare)
7914 (gnus-summary-goto-subject current)
7915 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
7916 (gnus-summary-position-point)))
7918 (defun gnus-summary-show-all-threads ()
7921 (gnus-set-global-variables)
7923 (let ((buffer-read-only nil))
7924 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
7925 (gnus-summary-position-point))
7927 (defun gnus-summary-show-thread ()
7928 "Show thread subtrees.
7929 Returns nil if no thread was there to be shown."
7931 (gnus-set-global-variables)
7932 (let ((buffer-read-only nil)
7934 ;; first goto end then to beg, to have point at beg after let
7935 (end (progn (end-of-line) (point)))
7936 (beg (progn (beginning-of-line) (point))))
7938 ;; Any hidden lines here?
7939 (search-forward "\r" end t)
7940 (subst-char-in-region beg end ?\^M ?\n t)
7942 (gnus-summary-position-point))))
7944 (defun gnus-summary-hide-all-threads ()
7945 "Hide all thread subtrees."
7947 (gnus-set-global-variables)
7949 (goto-char (point-min))
7950 (gnus-summary-hide-thread)
7951 (while (zerop (gnus-summary-next-thread 1 t))
7952 (gnus-summary-hide-thread)))
7953 (gnus-summary-position-point))
7955 (defun gnus-summary-hide-thread ()
7956 "Hide thread subtrees.
7957 Returns nil if no threads were there to be hidden."
7959 (gnus-set-global-variables)
7960 (let ((buffer-read-only nil)
7962 (article (gnus-summary-article-number)))
7964 ;; Go forward until either the buffer ends or the subthread
7966 (when (and (not (eobp))
7967 (or (zerop (gnus-summary-next-thread 1 t))
7968 (goto-char (point-max))))
7970 (if (and (> (point) start)
7971 (search-backward "\n" start t))
7973 (subst-char-in-region start (point) ?\n ?\^M)
7974 (gnus-summary-goto-subject article))
7977 ;;(gnus-summary-position-point)
7980 (defun gnus-summary-go-to-next-thread (&optional previous)
7981 "Go to the same level (or less) next thread.
7982 If PREVIOUS is non-nil, go to previous thread instead.
7983 Return the article number moved to, or nil if moving was impossible."
7984 (let ((level (gnus-summary-thread-level))
7985 (way (if previous -1 1))
7988 (while (and (not (eobp))
7989 (< level (gnus-summary-thread-level)))
7997 (gnus-summary-article-number)
8000 (defun gnus-summary-next-thread (n &optional silent)
8001 "Go to the same level next N'th thread.
8002 If N is negative, search backward instead.
8003 Returns the difference between N and the number of skips actually
8006 If SILENT, don't output messages."
8008 (gnus-set-global-variables)
8009 (let ((backward (< n 0))
8012 (gnus-summary-go-to-next-thread backward))
8015 (gnus-summary-position-point))
8016 (when (and (not silent) (/= 0 n))
8017 (gnus-message 7 "No more threads"))
8020 (defun gnus-summary-prev-thread (n)
8021 "Go to the same level previous N'th thread.
8022 Returns the difference between N and the number of skips actually
8025 (gnus-set-global-variables)
8026 (gnus-summary-next-thread (- n)))
8028 (defun gnus-summary-go-down-thread ()
8029 "Go down one level in the current thread."
8030 (let ((children (gnus-summary-article-children)))
8032 (gnus-summary-goto-subject (car children)))))
8034 (defun gnus-summary-go-up-thread ()
8035 "Go up one level in the current thread."
8036 (let ((parent (gnus-summary-article-parent)))
8038 (gnus-summary-goto-subject parent))))
8040 (defun gnus-summary-down-thread (n)
8041 "Go down thread N steps.
8042 If N is negative, go up instead.
8043 Returns the difference between N and how many steps down that were
8046 (gnus-set-global-variables)
8050 (if up (gnus-summary-go-up-thread)
8051 (gnus-summary-go-down-thread)))
8053 (gnus-summary-position-point)
8055 (gnus-message 7 "Can't go further"))
8058 (defun gnus-summary-up-thread (n)
8059 "Go up thread N steps.
8060 If N is negative, go up instead.
8061 Returns the difference between N and how many steps down that were
8064 (gnus-set-global-variables)
8065 (gnus-summary-down-thread (- n)))
8067 (defun gnus-summary-top-thread ()
8068 "Go to the top of the thread."
8070 (gnus-set-global-variables)
8071 (while (gnus-summary-go-up-thread))
8072 (gnus-summary-article-number))
8074 (defun gnus-summary-kill-thread (&optional unmark)
8075 "Mark articles under current thread as read.
8076 If the prefix argument is positive, remove any kinds of marks.
8077 If the prefix argument is negative, tick articles instead."
8079 (gnus-set-global-variables)
8081 (setq unmark (prefix-numeric-value unmark)))
8082 (let ((articles (gnus-summary-articles-in-thread)))
8084 ;; Expand the thread.
8085 (gnus-summary-show-thread)
8086 ;; Mark all the articles.
8088 (gnus-summary-goto-subject (car articles))
8089 (cond ((null unmark)
8090 (gnus-summary-mark-article-as-read gnus-killed-mark))
8092 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8094 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8095 (setq articles (cdr articles))))
8096 ;; Hide killed subtrees.
8098 gnus-thread-hide-killed
8099 (gnus-summary-hide-thread))
8100 ;; If marked as read, go to next unread subject.
8102 ;; Go to next unread subject.
8103 (gnus-summary-next-subject 1 t)))
8104 (gnus-set-mode-line 'summary))
8106 ;; Summary sorting commands
8108 (defun gnus-summary-sort-by-number (&optional reverse)
8109 "Sort the summary buffer by article number.
8110 Argument REVERSE means reverse order."
8112 (gnus-summary-sort 'number reverse))
8114 (defun gnus-summary-sort-by-author (&optional reverse)
8115 "Sort the summary buffer by author name alphabetically.
8116 If case-fold-search is non-nil, case of letters is ignored.
8117 Argument REVERSE means reverse order."
8119 (gnus-summary-sort 'author reverse))
8121 (defun gnus-summary-sort-by-subject (&optional reverse)
8122 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8123 If case-fold-search is non-nil, case of letters is ignored.
8124 Argument REVERSE means reverse order."
8126 (gnus-summary-sort 'subject reverse))
8128 (defun gnus-summary-sort-by-date (&optional reverse)
8129 "Sort the summary buffer by date.
8130 Argument REVERSE means reverse order."
8132 (gnus-summary-sort 'date reverse))
8134 (defun gnus-summary-sort-by-score (&optional reverse)
8135 "Sort the summary buffer by score.
8136 Argument REVERSE means reverse order."
8138 (gnus-summary-sort 'score reverse))
8140 (defun gnus-summary-sort-by-lines (&optional reverse)
8141 "Sort the summary buffer by article length.
8142 Argument REVERSE means reverse order."
8144 (gnus-summary-sort 'lines reverse))
8146 (defun gnus-summary-sort (predicate reverse)
8147 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8148 (gnus-set-global-variables)
8149 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8150 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8151 (gnus-thread-sort-functions
8157 (gnus-article-sort-functions
8162 (,article t2 t1)))))
8164 (gnus-summary-prepare-hook nil))
8165 ;; We do the sorting by regenerating the threads.
8166 (gnus-summary-prepare)
8167 ;; Hide subthreads if needed.
8168 (when (and gnus-show-threads gnus-thread-hide-subtree)
8169 (gnus-summary-hide-all-threads))))
8171 ;; Summary saving commands.
8173 (defun gnus-summary-save-article (&optional n not-saved)
8174 "Save the current article using the default saver function.
8175 If N is a positive number, save the N next articles.
8176 If N is a negative number, save the N previous articles.
8177 If N is nil and any articles have been marked with the process mark,
8178 save those articles instead.
8179 The variable `gnus-default-article-saver' specifies the saver function."
8181 (gnus-set-global-variables)
8182 (let* ((articles (gnus-summary-work-articles n))
8183 (save-buffer (save-excursion
8184 (nnheader-set-temp-buffer " *Gnus Save*")))
8185 (num (length articles))
8186 header article file)
8188 (setq header (gnus-summary-article-header
8189 (setq article (pop articles))))
8190 (if (not (vectorp header))
8191 ;; This is a pseudo-article.
8192 (if (assq 'name header)
8193 (gnus-copy-file (cdr (assq 'name header)))
8194 (gnus-message 1 "Article %d is unsaveable" article))
8195 ;; This is a real article.
8196 (save-window-excursion
8197 (gnus-summary-select-article t nil nil article))
8199 (set-buffer save-buffer)
8201 (insert-buffer-substring gnus-original-article-buffer))
8202 (setq file (gnus-article-save save-buffer file num))
8203 (gnus-summary-remove-process-mark article)
8205 (gnus-summary-set-saved-mark article))))
8206 (gnus-kill-buffer save-buffer)
8207 (gnus-summary-position-point)
8210 (defun gnus-summary-pipe-output (&optional arg)
8211 "Pipe the current article to a subprocess.
8212 If N is a positive number, pipe the N next articles.
8213 If N is a negative number, pipe the N previous articles.
8214 If N is nil and any articles have been marked with the process mark,
8215 pipe those articles instead."
8217 (gnus-set-global-variables)
8218 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8219 (gnus-summary-save-article arg t))
8220 (gnus-configure-windows 'pipe))
8222 (defun gnus-summary-save-article-mail (&optional arg)
8223 "Append the current article to an mail file.
8224 If N is a positive number, save the N next articles.
8225 If N is a negative number, save the N previous articles.
8226 If N is nil and any articles have been marked with the process mark,
8227 save those articles instead."
8229 (gnus-set-global-variables)
8230 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8231 (gnus-summary-save-article arg)))
8233 (defun gnus-summary-save-article-rmail (&optional arg)
8234 "Append the current article to an rmail file.
8235 If N is a positive number, save the N next articles.
8236 If N is a negative number, save the N previous articles.
8237 If N is nil and any articles have been marked with the process mark,
8238 save those articles instead."
8240 (gnus-set-global-variables)
8241 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
8242 (gnus-summary-save-article arg)))
8244 (defun gnus-summary-save-article-file (&optional arg)
8245 "Append the current article to a file.
8246 If N is a positive number, save the N next articles.
8247 If N is a negative number, save the N previous articles.
8248 If N is nil and any articles have been marked with the process mark,
8249 save those articles instead."
8251 (gnus-set-global-variables)
8252 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8253 (gnus-summary-save-article arg)))
8255 (defun gnus-summary-write-article-file (&optional arg)
8256 "Write the current article to a file, deleting the previous file.
8257 If N is a positive number, save the N next articles.
8258 If N is a negative number, save the N previous articles.
8259 If N is nil and any articles have been marked with the process mark,
8260 save those articles instead."
8262 (gnus-set-global-variables)
8263 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8264 (gnus-summary-save-article arg)))
8266 (defun gnus-summary-save-article-body-file (&optional arg)
8267 "Append the current article body to a file.
8268 If N is a positive number, save the N next articles.
8269 If N is a negative number, save the N previous articles.
8270 If N is nil and any articles have been marked with the process mark,
8271 save those articles instead."
8273 (gnus-set-global-variables)
8274 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8275 (gnus-summary-save-article arg)))
8277 (defun gnus-get-split-value (methods)
8278 "Return a value based on the split METHODS."
8279 (let (split-name method result match)
8282 (set-buffer gnus-original-article-buffer)
8284 (nnheader-narrow-to-headers)
8286 (goto-char (point-min))
8287 (setq method (pop methods))
8288 (setq match (car method))
8291 ;; Regular expression.
8293 (re-search-forward match nil t)))
8294 ((gnus-functionp match)
8298 (setq result (funcall match gnus-newsgroup-name))))
8303 (setq result (eval match)))))
8304 (setq split-name (append (cdr method) split-name))
8305 (cond ((stringp result)
8306 (push (expand-file-name
8307 result gnus-article-save-directory)
8310 (setq split-name (append result split-name)))))))))
8313 (defun gnus-valid-move-group-p (group)
8318 (car (gnus-find-method-for-group
8319 (symbol-name group))))
8320 gnus-valid-select-methods))))
8322 (defun gnus-read-move-group-name (prompt default articles prefix)
8323 "Read a group name."
8324 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8325 (minibuffer-confirm-incomplete nil) ; XEmacs
8329 (if (> (length articles) 1)
8330 (format "these %d articles" (length articles))
8335 (gnus-completing-read default prom
8337 'gnus-valid-move-group-p
8339 'gnus-group-history))
8340 ((= 1 (length split-name))
8341 (gnus-completing-read (car split-name) prom
8343 'gnus-valid-move-group-p
8345 'gnus-group-history))
8347 (gnus-completing-read nil prom
8348 (mapcar (lambda (el) (list el))
8349 (nreverse split-name))
8351 'gnus-group-history)))))
8353 (if (or (string= to-newsgroup "")
8354 (string= to-newsgroup prefix))
8355 (setq to-newsgroup (or default "")))
8356 (or (gnus-active to-newsgroup)
8357 (gnus-activate-group to-newsgroup)
8358 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8360 (or (and (gnus-request-create-group
8361 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8362 (gnus-activate-group to-newsgroup nil nil
8363 (gnus-group-name-to-method
8365 (error "Couldn't create group %s" to-newsgroup)))
8366 (error "No such group: %s" to-newsgroup)))
8369 ;; Summary extract commands
8371 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8372 (let ((buffer-read-only nil)
8373 (article (gnus-summary-article-number))
8375 (unless (gnus-summary-goto-subject article)
8376 (error "No such article: %d" article))
8377 (gnus-summary-position-point)
8378 ;; If all commands are to be bunched up on one line, we collect
8380 (unless gnus-view-pseudos-separately
8381 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8384 (setq action (cdr (assq 'action (car ps))))
8385 (setq files (list (cdr (assq 'name (car ps)))))
8386 (while (and ps (cdr ps)
8387 (string= (or action "1")
8388 (or (cdr (assq 'action (cadr ps))) "2")))
8389 (push (cdr (assq 'name (cadr ps))) files)
8390 (setcdr ps (cddr ps)))
8392 (when (not (string-match "%s" action))
8395 (when (assq 'execute (car ps))
8396 (setcdr (assq 'execute (car ps))
8397 (funcall (if (string-match "%s" action)
8400 (mapconcat (lambda (f) f) files " ")))))
8401 (setq ps (cdr ps)))))
8402 (if (and gnus-view-pseudos (not not-view))
8404 (when (assq 'execute (car pslist))
8405 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8406 (eq gnus-view-pseudos 'not-confirm)))
8407 (setq pslist (cdr pslist)))
8410 (setq after-article (or (cdr (assq 'article (car pslist)))
8411 (gnus-summary-article-number)))
8412 (gnus-summary-goto-subject after-article)
8415 (insert " " (file-name-nondirectory
8416 (cdr (assq 'name (car pslist))))
8417 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8419 (forward-line -1) ; back to `b'
8420 (gnus-add-text-properties
8421 b (1- e) (list 'gnus-number gnus-reffed-article-number
8422 gnus-mouse-face-prop gnus-mouse-face))
8424 after-article gnus-reffed-article-number
8425 gnus-unread-mark b (car pslist) 0 (- e b))
8426 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8427 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8428 (setq pslist (cdr pslist)))))))
8430 (defun gnus-pseudos< (p1 p2)
8431 (let ((c1 (cdr (assq 'action p1)))
8432 (c2 (cdr (assq 'action p2))))
8433 (and c1 c2 (string< c1 c2))))
8435 (defun gnus-request-pseudo-article (props)
8436 (cond ((assq 'execute props)
8437 (gnus-execute-command (cdr (assq 'execute props)))))
8438 (let ((gnus-current-article (gnus-summary-article-number)))
8439 (run-hooks 'gnus-mark-article-hook)))
8441 (defun gnus-execute-command (command &optional automatic)
8443 (gnus-article-setup-buffer)
8444 (set-buffer gnus-article-buffer)
8445 (setq buffer-read-only nil)
8446 (let ((command (if automatic command (read-string "Command: " command)))
8447 ;; Just binding this here doesn't help, because there might
8448 ;; be output from the process after exiting the scope of
8450 ;; (buffer-read-only nil)
8453 (insert "$ " command "\n\n")
8454 (if gnus-view-pseudo-asynchronously
8455 (start-process "gnus-execute" nil shell-file-name
8456 shell-command-switch command)
8457 (call-process shell-file-name nil t nil
8458 shell-command-switch command)))))
8460 ;; Summary kill commands.
8462 (defun gnus-summary-edit-global-kill (article)
8463 "Edit the \"global\" kill file."
8464 (interactive (list (gnus-summary-article-number)))
8465 (gnus-set-global-variables)
8466 (gnus-group-edit-global-kill article))
8468 (defun gnus-summary-edit-local-kill ()
8469 "Edit a local kill file applied to the current newsgroup."
8471 (gnus-set-global-variables)
8472 (setq gnus-current-headers (gnus-summary-article-header))
8473 (gnus-set-global-variables)
8474 (gnus-group-edit-local-kill
8475 (gnus-summary-article-number) gnus-newsgroup-name))
8479 (defun gnus-read-header (id &optional header)
8480 "Read the headers of article ID and enter them into the Gnus system."
8481 (let ((group gnus-newsgroup-name)
8482 (gnus-override-method
8483 (and (gnus-news-group-p gnus-newsgroup-name)
8484 gnus-refer-article-method))
8486 ;; First we check to see whether the header in question is already
8489 ;; This is a Message-ID.
8490 (setq header (or header (gnus-id-to-header id)))
8491 ;; This is an article number.
8492 (setq header (or header (gnus-summary-article-header id))))
8494 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8495 ;; We have found the header.
8497 ;; We have to really fetch the header to this article.
8499 (set-buffer nntp-server-buffer)
8500 (when (setq where (gnus-request-head id group))
8501 (nnheader-fold-continuation-lines)
8502 (goto-char (point-max))
8504 (goto-char (point-min))
8508 ((cdr where) (cdr where))
8509 (header (mail-header-number header))
8510 (t gnus-reffed-article-number))
8512 (insert " Article retrieved.\n"))
8513 (if (not (setq header (car (gnus-get-newsgroup-headers nil t))))
8514 () ; Malformed head.
8515 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8516 (when (and (stringp id)
8517 (not (string= (gnus-group-real-name group)
8519 ;; If we fetched by Message-ID and the article came
8520 ;; from a different group, we fudge some bogus article
8521 ;; numbers for this article.
8522 (mail-header-set-number header gnus-reffed-article-number))
8524 (set-buffer gnus-summary-buffer)
8525 (decf gnus-reffed-article-number)
8526 (gnus-remove-header (mail-header-number header))
8527 (push header gnus-newsgroup-headers)
8528 (setq gnus-current-headers header)
8529 (push (mail-header-number header) gnus-newsgroup-limit)))
8532 (defun gnus-remove-header (number)
8533 "Remove header NUMBER from `gnus-newsgroup-headers'."
8534 (if (and gnus-newsgroup-headers
8535 (= number (mail-header-number (car gnus-newsgroup-headers))))
8536 (pop gnus-newsgroup-headers)
8537 (let ((headers gnus-newsgroup-headers))
8538 (while (and (cdr headers)
8539 (not (= number (mail-header-number (cadr headers)))))
8542 (setcdr headers (cddr headers))))))
8545 ;;; summary highlights
8548 (defun gnus-highlight-selected-summary ()
8549 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8550 ;; Highlight selected article in summary buffer
8551 (when gnus-summary-selected-face
8553 (let* ((beg (progn (beginning-of-line) (point)))
8554 (end (progn (end-of-line) (point)))
8555 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8556 (from (if (get-text-property beg gnus-mouse-face-prop)
8558 (or (next-single-property-change
8559 beg gnus-mouse-face-prop nil end)
8564 (or (next-single-property-change
8565 from gnus-mouse-face-prop nil end)
8567 ;; If no mouse-face prop on line we will have to = from = end,
8568 ;; so we highlight the entire line instead.
8569 (when (= (+ to 2) from)
8572 (if gnus-newsgroup-selected-overlay
8573 ;; Move old overlay.
8575 gnus-newsgroup-selected-overlay from to (current-buffer))
8576 ;; Create new overlay.
8578 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8579 'face gnus-summary-selected-face))))))
8581 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8582 (defun gnus-summary-highlight-line ()
8583 "Highlight current line according to `gnus-summary-highlight'."
8584 (let* ((list gnus-summary-highlight)
8586 (end (progn (end-of-line) (point)))
8587 ;; now find out where the line starts and leave point there.
8588 (beg (progn (beginning-of-line) (point)))
8589 (article (gnus-summary-article-number))
8590 (score (or (cdr (assq (or article gnus-current-article)
8591 gnus-newsgroup-scored))
8592 gnus-summary-default-score 0))
8593 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
8594 (inhibit-read-only t))
8595 ;; Eval the cars of the lists until we find a match.
8596 (let ((default gnus-summary-default-score))
8598 (not (eval (caar list))))
8599 (setq list (cdr list))))
8600 (let ((face (cdar list)))
8601 (unless (eq face (get-text-property beg 'face))
8602 (gnus-put-text-property
8604 (setq face (if (boundp face) (symbol-value face) face)))
8605 (when gnus-summary-highlight-line-function
8606 (funcall gnus-summary-highlight-line-function article face))))
8609 (defun gnus-update-read-articles (group unread)
8610 "Update the list of read articles in GROUP."
8611 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
8612 (entry (gnus-gethash group gnus-newsrc-hashtb))
8613 (info (nth 2 entry))
8615 (unread (sort (copy-sequence unread) '<))
8617 (if (or (not info) (not active))
8618 ;; There is no info on this group if it was, in fact,
8619 ;; killed. Gnus stores no information on killed groups, so
8620 ;; there's nothing to be done.
8621 ;; One could store the information somewhere temporarily,
8622 ;; perhaps... Hmmm...
8624 ;; Remove any negative articles numbers.
8625 (while (and unread (< (car unread) 0))
8626 (setq unread (cdr unread)))
8627 ;; Remove any expired article numbers
8628 (while (and unread (< (car unread) (car active)))
8629 (setq unread (cdr unread)))
8630 ;; Compute the ranges of read articles by looking at the list of
8633 (when (/= (car unread) prev)
8634 (push (if (= prev (1- (car unread))) prev
8635 (cons prev (1- (car unread))))
8637 (setq prev (1+ (car unread)))
8638 (setq unread (cdr unread)))
8639 (when (<= prev (cdr active))
8640 (push (cons prev (cdr active)) read))
8642 (set-buffer gnus-group-buffer)
8645 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
8646 (gnus-info-set-read ',info ',(gnus-info-read info))
8647 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
8648 (gnus-group-update-group ,group t))))
8649 ;; Enter this list into the group info.
8651 info (if (> (length read) 1) (nreverse read) read))
8652 ;; Set the number of unread articles in gnus-newsrc-hashtb.
8653 (gnus-get-unread-articles-in-group info (gnus-active group))
8658 (run-hooks 'gnus-sum-load-hook)
8660 ;;; gnus-sum.el ends here