1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
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.
28 (eval-when-compile (require 'cl))
38 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
40 (defcustom gnus-kill-summary-on-exit t
41 "*If non-nil, kill the summary buffer when you exit from it.
42 If nil, the summary will become a \"*Dead Summary*\" buffer, and
43 it will be killed sometime later."
44 :group 'gnus-summary-exit
47 (defcustom gnus-fetch-old-headers nil
48 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
49 If an unread article in the group refers to an older, already read (or
50 just marked as read) article, the old article will not normally be
51 displayed in the Summary buffer. If this variable is non-nil, Gnus
52 will attempt to grab the headers to the old articles, and thereby
53 build complete threads. If it has the value `some', only enough
54 headers to connect otherwise loose threads will be displayed. This
55 variable can also be a number. In that case, no more than that number
56 of old headers will be fetched. If it has the value `invisible', all
57 old headers will be fetched, but none will be displayed.
59 The server has to support NOV for any of this to work."
61 :type '(choice (const :tag "off" nil)
64 (sexp :menu-tag "other" t)))
66 (defcustom gnus-refer-thread-limit 200
67 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
68 If t, fetch all the available old headers."
71 (sexp :menu-tag "other" t)))
73 (defcustom gnus-summary-make-false-root 'adopt
74 "*nil means that Gnus won't gather loose threads.
75 If the root of a thread has expired or been read in a previous
76 session, the information necessary to build a complete thread has been
77 lost. Instead of having many small sub-threads from this original thread
78 scattered all over the summary buffer, Gnus can gather them.
80 If non-nil, Gnus will try to gather all loose sub-threads from an
81 original thread into one large thread.
83 If this variable is non-nil, it should be one of `none', `adopt',
86 If this variable is `none', Gnus will not make a false root, but just
87 present the sub-threads after another.
88 If this variable is `dummy', Gnus will create a dummy root that will
89 have all the sub-threads as children.
90 If this variable is `adopt', Gnus will make one of the \"children\"
91 the parent and mark all the step-children as such.
92 If this variable is `empty', the \"children\" are printed with empty
93 subject fields. (Or rather, they will be printed with a string
94 given by the `gnus-summary-same-subject' variable.)"
96 :type '(choice (const :tag "off" nil)
102 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
103 "*A regexp to match subjects to be excluded from loose thread gathering.
104 As loose thread gathering is done on subjects only, that means that
105 there can be many false gatherings performed. By rooting out certain
106 common subjects, gathering might become saner."
110 (defcustom gnus-summary-gather-subject-limit nil
111 "*Maximum length of subject comparisons when gathering loose threads.
112 Use nil to compare full subjects. Setting this variable to a low
113 number will help gather threads that have been corrupted by
114 newsreaders chopping off subject lines, but it might also mean that
115 unrelated articles that have subject that happen to begin with the
116 same few characters will be incorrectly gathered.
118 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
121 :type '(choice (const :tag "off" nil)
123 (sexp :menu-tag "on" t)))
125 (defcustom gnus-simplify-subject-functions nil
126 "List of functions taking a string argument that simplify subjects.
127 The functions are applied recursively.
129 Useful functions to put in this list include: `gnus-simplify-subject-re',
130 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
132 :type '(repeat function))
134 (defcustom gnus-simplify-ignored-prefixes nil
135 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
137 :type '(choice (const :tag "off" nil)
140 (defcustom gnus-build-sparse-threads nil
141 "*If non-nil, fill in the gaps in threads.
142 If `some', only fill in the gaps that are needed to tie loose threads
143 together. If `more', fill in all leaf nodes that Gnus can find. If
144 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
146 :type '(choice (const :tag "off" nil)
149 (sexp :menu-tag "all" t)))
151 (defcustom gnus-summary-thread-gathering-function
152 'gnus-gather-threads-by-subject
153 "*Function used for gathering loose threads.
154 There are two pre-defined functions: `gnus-gather-threads-by-subject',
155 which only takes Subjects into consideration; and
156 `gnus-gather-threads-by-references', which compared the References
157 headers of the articles to find matches."
159 :type '(radio (function-item gnus-gather-threads-by-subject)
160 (function-item gnus-gather-threads-by-references)
161 (function :tag "other")))
163 (defcustom gnus-summary-same-subject ""
164 "*String indicating that the current article has the same subject as the previous.
165 This variable will only be used if the value of
166 `gnus-summary-make-false-root' is `empty'."
167 :group 'gnus-summary-format
170 (defcustom gnus-summary-goto-unread t
171 "*If t, marking commands will go to the next unread article.
172 If `never', commands that usually go to the next unread article, will
173 go to the next article, whether it is read or not.
174 If nil, only the marking commands will go to the next (un)read article."
175 :group 'gnus-summary-marks
176 :link '(custom-manual "(gnus)Setting Marks")
177 :type '(choice (const :tag "off" nil)
179 (sexp :menu-tag "on" t)))
181 (defcustom gnus-summary-default-score 0
182 "*Default article score level.
183 All scores generated by the score files will be added to this score.
184 If this variable is nil, scoring will be disabled."
185 :group 'gnus-score-default
186 :type '(choice (const :tag "disable")
189 (defcustom gnus-summary-zcore-fuzz 0
190 "*Fuzziness factor for the zcore in the summary buffer.
191 Articles with scores closer than this to `gnus-summary-default-score'
193 :group 'gnus-summary-format
196 (defcustom gnus-simplify-subject-fuzzy-regexp nil
197 "*Strings to be removed when doing fuzzy matches.
198 This can either be a regular expression or list of regular expressions
199 that will be removed from subject strings if fuzzy subject
200 simplification is selected."
202 :type '(repeat regexp))
204 (defcustom gnus-show-threads t
205 "*If non-nil, display threads in summary mode."
209 (defcustom gnus-thread-hide-subtree nil
210 "*If non-nil, hide all threads initially.
211 If threads are hidden, you have to run the command
212 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
213 to expose hidden threads."
217 (defcustom gnus-thread-hide-killed t
218 "*If non-nil, hide killed threads automatically."
222 (defcustom gnus-thread-ignore-subject t
223 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
224 If nil, articles that have different subjects from their parents will
225 start separate threads."
229 (defcustom gnus-thread-operation-ignore-subject t
230 "*If non-nil, subjects will be ignored when doing thread commands.
231 This affects commands like `gnus-summary-kill-thread' and
232 `gnus-summary-lower-thread'.
234 If this variable is nil, articles in the same thread with different
235 subjects will not be included in the operation in question. If this
236 variable is `fuzzy', only articles that have subjects that are fuzzily
237 equal will be included."
239 :type '(choice (const :tag "off" nil)
243 (defcustom gnus-thread-indent-level 4
244 "*Number that says how much each sub-thread should be indented."
248 (defcustom gnus-auto-extend-newsgroup t
249 "*If non-nil, extend newsgroup forward and backward when requested."
250 :group 'gnus-summary-choose
253 (defcustom gnus-auto-select-first t
254 "*If nil, don't select the first unread article when entering a group.
255 If this variable is `best', select the highest-scored unread article
256 in the group. If t, select the first unread article.
258 This variable can also be a function to place point on a likely
259 subject line. Useful values include `gnus-summary-first-unread-subject',
260 `gnus-summary-first-unread-article' and
261 `gnus-summary-best-unread-article'.
263 If you want to prevent automatic selection of the first unread article
264 in some newsgroups, set the variable to nil in
265 `gnus-select-group-hook'."
266 :group 'gnus-group-select
267 :type '(choice (const :tag "none" nil)
269 (sexp :menu-tag "first" t)
270 (function-item gnus-summary-first-unread-subject)
271 (function-item gnus-summary-first-unread-article)
272 (function-item gnus-summary-best-unread-article)))
274 (defcustom gnus-auto-select-next t
275 "*If non-nil, offer to go to the next group from the end of the previous.
276 If the value is t and the next newsgroup is empty, Gnus will exit
277 summary mode and go back to group mode. If the value is neither nil
278 nor t, Gnus will select the following unread newsgroup. In
279 particular, if the value is the symbol `quietly', the next unread
280 newsgroup will be selected without any confirmation, and if it is
281 `almost-quietly', the next group will be selected without any
282 confirmation if you are located on the last article in the group.
283 Finally, if this variable is `slightly-quietly', the `Z n' command
284 will go to the next group without confirmation."
285 :group 'gnus-summary-maneuvering
286 :type '(choice (const :tag "off" nil)
288 (const almost-quietly)
289 (const slightly-quietly)
290 (sexp :menu-tag "on" t)))
292 (defcustom gnus-auto-select-same nil
293 "*If non-nil, select the next article with the same subject.
294 If there are no more articles with the same subject, go to
295 the first unread article."
296 :group 'gnus-summary-maneuvering
299 (defcustom gnus-summary-check-current nil
300 "*If non-nil, consider the current article when moving.
301 The \"unread\" movement commands will stay on the same line if the
302 current article is unread."
303 :group 'gnus-summary-maneuvering
306 (defcustom gnus-auto-center-summary t
307 "*If non-nil, always center the current summary buffer.
308 In particular, if `vertical' do only vertical recentering. If non-nil
309 and non-`vertical', do both horizontal and vertical recentering."
310 :group 'gnus-summary-maneuvering
311 :type '(choice (const :tag "none" nil)
313 (integer :tag "height")
314 (sexp :menu-tag "both" t)))
316 (defcustom gnus-show-all-headers nil
317 "*If non-nil, don't hide any headers."
318 :group 'gnus-article-hiding
319 :group 'gnus-article-headers
322 (defcustom gnus-summary-ignore-duplicates nil
323 "*If non-nil, ignore articles with identical Message-ID headers."
327 (defcustom gnus-single-article-buffer t
328 "*If non-nil, display all articles in the same buffer.
329 If nil, each group will get its own article buffer."
330 :group 'gnus-article-various
333 (defcustom gnus-break-pages t
334 "*If non-nil, do page breaking on articles.
335 The page delimiter is specified by the `gnus-page-delimiter'
337 :group 'gnus-article-various
340 (defcustom gnus-move-split-methods nil
341 "*Variable used to suggest where articles are to be moved to.
342 It uses the same syntax as the `gnus-split-methods' variable."
343 :group 'gnus-summary-mail
344 :type '(repeat (choice (list :value (fun) function)
345 (cons :value ("" "") regexp (repeat string))
348 (defcustom gnus-unread-mark ? ;Whitespace
349 "*Mark used for unread articles."
350 :group 'gnus-summary-marks
353 (defcustom gnus-ticked-mark ?!
354 "*Mark used for ticked articles."
355 :group 'gnus-summary-marks
358 (defcustom gnus-dormant-mark ??
359 "*Mark used for dormant articles."
360 :group 'gnus-summary-marks
363 (defcustom gnus-del-mark ?r
364 "*Mark used for del'd articles."
365 :group 'gnus-summary-marks
368 (defcustom gnus-read-mark ?R
369 "*Mark used for read articles."
370 :group 'gnus-summary-marks
373 (defcustom gnus-expirable-mark ?E
374 "*Mark used for expirable articles."
375 :group 'gnus-summary-marks
378 (defcustom gnus-killed-mark ?K
379 "*Mark used for killed articles."
380 :group 'gnus-summary-marks
383 (defcustom gnus-souped-mark ?F
384 "*Mark used for killed articles."
385 :group 'gnus-summary-marks
388 (defcustom gnus-kill-file-mark ?X
389 "*Mark used for articles killed by kill files."
390 :group 'gnus-summary-marks
393 (defcustom gnus-low-score-mark ?Y
394 "*Mark used for articles with a low score."
395 :group 'gnus-summary-marks
398 (defcustom gnus-catchup-mark ?C
399 "*Mark used for articles that are caught up."
400 :group 'gnus-summary-marks
403 (defcustom gnus-replied-mark ?A
404 "*Mark used for articles that have been replied to."
405 :group 'gnus-summary-marks
408 (defcustom gnus-cached-mark ?*
409 "*Mark used for articles that are in the cache."
410 :group 'gnus-summary-marks
413 (defcustom gnus-saved-mark ?S
414 "*Mark used for articles that have been saved to."
415 :group 'gnus-summary-marks
418 (defcustom gnus-ancient-mark ?O
419 "*Mark used for ancient articles."
420 :group 'gnus-summary-marks
423 (defcustom gnus-sparse-mark ?Q
424 "*Mark used for sparsely reffed articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-canceled-mark ?G
429 "*Mark used for canceled articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-duplicate-mark ?M
434 "*Mark used for duplicate articles."
435 :group 'gnus-summary-marks
438 (defcustom gnus-undownloaded-mark ?@
439 "*Mark used for articles that weren't downloaded."
440 :group 'gnus-summary-marks
443 (defcustom gnus-downloadable-mark ?%
444 "*Mark used for articles that are to be downloaded."
445 :group 'gnus-summary-marks
448 (defcustom gnus-unsendable-mark ?=
449 "*Mark used for articles that won't be sent."
450 :group 'gnus-summary-marks
453 (defcustom gnus-score-over-mark ?+
454 "*Score mark used for articles with high scores."
455 :group 'gnus-summary-marks
458 (defcustom gnus-score-below-mark ?-
459 "*Score mark used for articles with low scores."
460 :group 'gnus-summary-marks
463 (defcustom gnus-empty-thread-mark ? ;Whitespace
464 "*There is no thread under the article."
465 :group 'gnus-summary-marks
468 (defcustom gnus-not-empty-thread-mark ?=
469 "*There is a thread under the article."
470 :group 'gnus-summary-marks
473 (defcustom gnus-view-pseudo-asynchronously nil
474 "*If non-nil, Gnus will view pseudo-articles asynchronously."
475 :group 'gnus-extract-view
478 (defcustom gnus-auto-expirable-marks
479 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
480 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
481 gnus-souped-mark gnus-duplicate-mark)
482 "*The list of marks converted into expiration if a group is auto-expirable."
484 :type '(repeat character))
486 (defcustom gnus-inhibit-user-auto-expire t
487 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
491 (defcustom gnus-view-pseudos nil
492 "*If `automatic', pseudo-articles will be viewed automatically.
493 If `not-confirm', pseudos will be viewed automatically, and the user
494 will not be asked to confirm the command."
495 :group 'gnus-extract-view
496 :type '(choice (const :tag "off" nil)
498 (const not-confirm)))
500 (defcustom gnus-view-pseudos-separately t
501 "*If non-nil, one pseudo-article will be created for each file to be viewed.
502 If nil, all files that use the same viewing command will be given as a
503 list of parameters to that command."
504 :group 'gnus-extract-view
507 (defcustom gnus-insert-pseudo-articles t
508 "*If non-nil, insert pseudo-articles when decoding articles."
509 :group 'gnus-extract-view
512 (defcustom gnus-summary-dummy-line-format
514 "*The format specification for the dummy roots in the summary buffer.
515 It works along the same lines as a normal formatting string,
516 with some simple extensions.
519 :group 'gnus-threading
522 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
523 "*The format specification for the summary mode line.
524 It works along the same lines as a normal formatting string,
525 with some simple extensions:
528 %p Unprefixed group name
529 %A Current article number
530 %z Current article score
532 %U Number of unread articles in the group
533 %e Number of unselected articles in the group
534 %Z A string with unread/unselected article counts
535 %g Shortish group name
536 %S Subject of the current article
538 %s Current score file name
539 %d Number of dormant articles
540 %r Number of articles that have been marked as read in this session
541 %E Number of articles expunged by the score files"
542 :group 'gnus-summary-format
545 (defcustom gnus-summary-mark-below 0
546 "*Mark all articles with a score below this variable as read.
547 This variable is local to each summary buffer and usually set by the
549 :group 'gnus-score-default
552 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
553 "*List of functions used for sorting articles in the summary buffer.
554 This variable is only used when not using a threaded display."
555 :group 'gnus-summary-sort
556 :type '(repeat (choice (function-item gnus-article-sort-by-number)
557 (function-item gnus-article-sort-by-author)
558 (function-item gnus-article-sort-by-subject)
559 (function-item gnus-article-sort-by-date)
560 (function-item gnus-article-sort-by-score)
561 (function :tag "other"))))
563 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
564 "*List of functions used for sorting threads in the summary buffer.
565 By default, threads are sorted by article number.
567 Each function takes two threads and return non-nil if the first thread
568 should be sorted before the other. If you use more than one function,
569 the primary sort function should be the last. You should probably
570 always include `gnus-thread-sort-by-number' in the list of sorting
571 functions -- preferably first.
573 Ready-made functions include `gnus-thread-sort-by-number',
574 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
575 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
576 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
577 :group 'gnus-summary-sort
578 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
579 (function-item gnus-thread-sort-by-author)
580 (function-item gnus-thread-sort-by-subject)
581 (function-item gnus-thread-sort-by-date)
582 (function-item gnus-thread-sort-by-score)
583 (function-item gnus-thread-sort-by-total-score)
584 (function :tag "other"))))
586 (defcustom gnus-thread-score-function '+
587 "*Function used for calculating the total score of a thread.
589 The function is called with the scores of the article and each
590 subthread and should then return the score of the thread.
592 Some functions you can use are `+', `max', or `min'."
593 :group 'gnus-summary-sort
596 (defcustom gnus-summary-expunge-below nil
597 "All articles that have a score less than this variable will be expunged.
598 This variable is local to the summary buffers."
599 :group 'gnus-score-default
600 :type '(choice (const :tag "off" nil)
603 (defcustom gnus-thread-expunge-below nil
604 "All threads that have a total score less than this variable will be expunged.
605 See `gnus-thread-score-function' for en explanation of what a
608 This variable is local to the summary buffers."
609 :group 'gnus-threading
610 :group 'gnus-score-default
611 :type '(choice (const :tag "off" nil)
614 (defcustom gnus-summary-mode-hook nil
615 "*A hook for Gnus summary mode.
616 This hook is run before any variables are set in the summary buffer."
617 :group 'gnus-summary-various
620 (defcustom gnus-summary-menu-hook nil
621 "*Hook run after the creation of the summary mode menu."
622 :group 'gnus-summary-visual
625 (defcustom gnus-summary-exit-hook nil
626 "*A hook called on exit from the summary buffer.
627 It will be called with point in the group buffer."
628 :group 'gnus-summary-exit
631 (defcustom gnus-summary-prepare-hook nil
632 "*A hook called after the summary buffer has been generated.
633 If you want to modify the summary buffer, you can use this hook."
634 :group 'gnus-summary-various
637 (defcustom gnus-summary-prepared-hook nil
638 "*A hook called as the last thing after the summary buffer has been generated."
639 :group 'gnus-summary-various
642 (defcustom gnus-summary-generate-hook nil
643 "*A hook run just before generating the summary buffer.
644 This hook is commonly used to customize threading variables and the
646 :group 'gnus-summary-various
649 (defcustom gnus-select-group-hook nil
650 "*A hook called when a newsgroup is selected.
652 If you'd like to simplify subjects like the
653 `gnus-summary-next-same-subject' command does, you can use the
656 (setq gnus-select-group-hook
659 (mapcar (lambda (header)
660 (mail-header-set-subject
662 (gnus-simplify-subject
663 (mail-header-subject header) 're-only)))
664 gnus-newsgroup-headers))))"
665 :group 'gnus-group-select
668 (defcustom gnus-select-article-hook nil
669 "*A hook called when an article is selected."
670 :group 'gnus-summary-choose
673 (defcustom gnus-visual-mark-article-hook
674 (list 'gnus-highlight-selected-summary)
675 "*Hook run after selecting an article in the summary buffer.
676 It is meant to be used for highlighting the article in some way. It
677 is not run if `gnus-visual' is nil."
678 :group 'gnus-summary-visual
681 (defcustom gnus-parse-headers-hook nil
682 "*A hook called before parsing the headers."
686 (defcustom gnus-exit-group-hook nil
687 "*A hook called when exiting (not quitting) summary mode."
691 (defcustom gnus-summary-update-hook
692 (list 'gnus-summary-highlight-line)
693 "*A hook called when a summary line is changed.
694 The hook will not be called if `gnus-visual' is nil.
696 The default function `gnus-summary-highlight-line' will
697 highlight the line according to the `gnus-summary-highlight'
699 :group 'gnus-summary-visual
702 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
703 "*A hook called when an article is selected for the first time.
704 The hook is intended to mark an article as read (or unread)
705 automatically when it is selected."
706 :group 'gnus-summary-choose
709 (defcustom gnus-group-no-more-groups-hook nil
710 "*A hook run when returning to group mode having no more (unread) groups."
711 :group 'gnus-group-select
714 (defcustom gnus-ps-print-hook nil
715 "*A hook run before ps-printing something from Gnus."
719 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
720 "Face used for highlighting the current article in the summary buffer."
721 :group 'gnus-summary-visual
724 (defcustom gnus-summary-highlight
725 '(((= mark gnus-canceled-mark)
726 . gnus-summary-cancelled-face)
727 ((and (> score default)
728 (or (= mark gnus-dormant-mark)
729 (= mark gnus-ticked-mark)))
730 . gnus-summary-high-ticked-face)
731 ((and (< score default)
732 (or (= mark gnus-dormant-mark)
733 (= mark gnus-ticked-mark)))
734 . gnus-summary-low-ticked-face)
735 ((or (= mark gnus-dormant-mark)
736 (= mark gnus-ticked-mark))
737 . gnus-summary-normal-ticked-face)
738 ((and (> score default) (= mark gnus-ancient-mark))
739 . gnus-summary-high-ancient-face)
740 ((and (< score default) (= mark gnus-ancient-mark))
741 . gnus-summary-low-ancient-face)
742 ((= mark gnus-ancient-mark)
743 . gnus-summary-normal-ancient-face)
744 ((and (> score default) (= mark gnus-unread-mark))
745 . gnus-summary-high-unread-face)
746 ((and (< score default) (= mark gnus-unread-mark))
747 . gnus-summary-low-unread-face)
748 ((= mark gnus-unread-mark)
749 . gnus-summary-normal-unread-face)
750 ((and (> score default) (memq mark (list gnus-downloadable-mark
751 gnus-undownloaded-mark)))
752 . gnus-summary-high-unread-face)
753 ((and (< score default) (memq mark (list gnus-downloadable-mark
754 gnus-undownloaded-mark)))
755 . gnus-summary-low-unread-face)
756 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
757 . gnus-summary-normal-unread-face)
759 . gnus-summary-high-read-face)
761 . gnus-summary-low-read-face)
763 . gnus-summary-normal-read-face))
764 "*Controls the highlighting of summary buffer lines.
766 A list of (FORM . FACE) pairs. When deciding how a a particular
767 summary line should be displayed, each form is evaluated. The content
768 of the face field after the first true form is used. You can change
769 how those summary lines are displayed, by editing the face field.
771 You can use the following variables in the FORM field.
773 score: The articles score
774 default: The default article score.
775 below: The score below which articles are automatically marked as read.
776 mark: The articles mark."
777 :group 'gnus-summary-visual
778 :type '(repeat (cons (sexp :tag "Form" nil)
781 (defcustom gnus-alter-header-function nil
782 "Function called to allow alteration of article header structures.
783 The function is called with one parameter, the article header vector,
784 which it may alter in any way.")
786 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
787 "Variable that says which function should be used to decode a string with encoded words.")
789 (defcustom gnus-extra-headers nil
790 "*Extra headers to parse."
792 :type '(repeat symbol))
794 (defcustom gnus-ignored-from-addresses
795 (and user-mail-address (regexp-quote user-mail-address))
796 "*Regexp of From headers that may be suppressed in favor of To headers."
800 (defcustom gnus-group-charset-alist
801 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
802 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
803 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
804 ("^relcom\\>" koi8-r)
805 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
806 ("^israel\\>" iso-8859-1)
808 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
810 "Alist of regexps (to match group names) and default charsets to be used when reading."
811 :type '(repeat (list (regexp :tag "Group")
812 (symbol :tag "Charset")))
813 :group 'gnus-charset)
815 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit)
816 "List of charsets that should be ignored.
817 When these charsets are used in the \"charset\" parameter, the
818 default charset will be used instead."
819 :type '(repeat symbol)
820 :group 'gnus-charset)
822 (defcustom gnus-group-ignored-charsets-alist
823 '(("alt\\.chinese\\.text" iso-8859-1))
824 "Alist of regexps (to match group names) and charsets that should be ignored.
825 When these charsets are used in the \"charset\" parameter, the
826 default charset will be used instead."
827 :type '(repeat (cons (regexp :tag "Group")
829 :group 'gnus-charset)
831 (defcustom gnus-group-highlight-words-alist nil
832 "Alist of group regexps and highlight regexps.
833 This variable uses the same syntax as `gnus-emphasis-alist'."
834 :type '(repeat (cons (regexp :tag "Group")
835 (repeat (list (regexp :tag "Highlight regexp")
836 (number :tag "Group for entire word" 0)
837 (number :tag "Group for displayed part" 0)
839 gnus-emphasis-highlight-words)))))
840 :group 'gnus-summary-visual)
842 ;;; Internal variables
844 (defvar gnus-article-mime-handles nil)
845 (defvar gnus-article-decoded-p nil)
846 (defvar gnus-scores-exclude-files nil)
847 (defvar gnus-page-broken nil)
848 (defvar gnus-inhibit-mime-unbuttonizing nil)
850 (defvar gnus-original-article nil)
851 (defvar gnus-article-internal-prepare-hook nil)
852 (defvar gnus-newsgroup-process-stack nil)
854 (defvar gnus-thread-indent-array nil)
855 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
857 ;; Avoid highlighting in kill files.
858 (defvar gnus-summary-inhibit-highlight nil)
859 (defvar gnus-newsgroup-selected-overlay nil)
860 (defvar gnus-inhibit-limiting nil)
861 (defvar gnus-newsgroup-adaptive-score-file nil)
862 (defvar gnus-current-score-file nil)
863 (defvar gnus-current-move-group nil)
864 (defvar gnus-current-copy-group nil)
865 (defvar gnus-current-crosspost-group nil)
867 (defvar gnus-newsgroup-dependencies nil)
868 (defvar gnus-newsgroup-adaptive nil)
869 (defvar gnus-summary-display-article-function nil)
870 (defvar gnus-summary-highlight-line-function nil
871 "Function called after highlighting a summary line.")
873 (defvar gnus-summary-line-format-alist
874 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
875 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
876 (?s gnus-tmp-subject-or-nil ?s)
877 (?n gnus-tmp-name ?s)
878 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
880 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
882 (?F gnus-tmp-from ?s)
883 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
884 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
885 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
886 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
887 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
888 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
889 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
890 (?L gnus-tmp-lines ?d)
891 (?I gnus-tmp-indentation ?s)
892 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
893 (?R gnus-tmp-replied ?c)
894 (?\[ gnus-tmp-opening-bracket ?c)
895 (?\] gnus-tmp-closing-bracket ?c)
896 (?\> (make-string gnus-tmp-level ? ) ?s)
897 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
898 (?i gnus-tmp-score ?d)
899 (?z gnus-tmp-score-char ?c)
900 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
901 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
902 (?U gnus-tmp-unread ?c)
903 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
904 (?t (gnus-summary-number-of-articles-in-thread
905 (and (boundp 'thread) (car thread)) gnus-tmp-level)
907 (?e (gnus-summary-number-of-articles-in-thread
908 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
910 (?u gnus-tmp-user-defined ?s)
911 (?P (gnus-pick-line-number) ?d))
912 "An alist of format specifications that can appear in summary lines,
913 and what variables they correspond with, along with the type of the
914 variable (string, integer, character, etc).")
916 (defvar gnus-summary-dummy-line-format-alist
917 `((?S gnus-tmp-subject ?s)
918 (?N gnus-tmp-number ?d)
919 (?u gnus-tmp-user-defined ?s)))
921 (defvar gnus-summary-mode-line-format-alist
922 `((?G gnus-tmp-group-name ?s)
923 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
924 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
925 (?A gnus-tmp-article-number ?d)
926 (?Z gnus-tmp-unread-and-unselected ?s)
928 (?U gnus-tmp-unread-and-unticked ?d)
929 (?S gnus-tmp-subject ?s)
930 (?e gnus-tmp-unselected ?d)
931 (?u gnus-tmp-user-defined ?s)
932 (?d (length gnus-newsgroup-dormant) ?d)
933 (?t (length gnus-newsgroup-marked) ?d)
934 (?r (length gnus-newsgroup-reads) ?d)
935 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
936 (?E gnus-newsgroup-expunged-tally ?d)
937 (?s (gnus-current-score-file-nondirectory) ?s)))
939 (defvar gnus-last-search-regexp nil
940 "Default regexp for article search command.")
942 (defvar gnus-last-shell-command nil
943 "Default shell command on article.")
945 (defvar gnus-newsgroup-begin nil)
946 (defvar gnus-newsgroup-end nil)
947 (defvar gnus-newsgroup-last-rmail nil)
948 (defvar gnus-newsgroup-last-mail nil)
949 (defvar gnus-newsgroup-last-folder nil)
950 (defvar gnus-newsgroup-last-file nil)
951 (defvar gnus-newsgroup-auto-expire nil)
952 (defvar gnus-newsgroup-active nil)
954 (defvar gnus-newsgroup-data nil)
955 (defvar gnus-newsgroup-data-reverse nil)
956 (defvar gnus-newsgroup-limit nil)
957 (defvar gnus-newsgroup-limits nil)
959 (defvar gnus-newsgroup-unreads nil
960 "List of unread articles in the current newsgroup.")
962 (defvar gnus-newsgroup-unselected nil
963 "List of unselected unread articles in the current newsgroup.")
965 (defvar gnus-newsgroup-reads nil
966 "Alist of read articles and article marks in the current newsgroup.")
968 (defvar gnus-newsgroup-expunged-tally nil)
970 (defvar gnus-newsgroup-marked nil
971 "List of ticked articles in the current newsgroup (a subset of unread art).")
973 (defvar gnus-newsgroup-killed nil
974 "List of ranges of articles that have been through the scoring process.")
976 (defvar gnus-newsgroup-cached nil
977 "List of articles that come from the article cache.")
979 (defvar gnus-newsgroup-saved nil
980 "List of articles that have been saved.")
982 (defvar gnus-newsgroup-kill-headers nil)
984 (defvar gnus-newsgroup-replied nil
985 "List of articles that have been replied to in the current newsgroup.")
987 (defvar gnus-newsgroup-expirable nil
988 "List of articles in the current newsgroup that can be expired.")
990 (defvar gnus-newsgroup-processable nil
991 "List of articles in the current newsgroup that can be processed.")
993 (defvar gnus-newsgroup-downloadable nil
994 "List of articles in the current newsgroup that can be processed.")
996 (defvar gnus-newsgroup-undownloaded nil
997 "List of articles in the current newsgroup that haven't been downloaded..")
999 (defvar gnus-newsgroup-unsendable nil
1000 "List of articles in the current newsgroup that won't be sent.")
1002 (defvar gnus-newsgroup-bookmarks nil
1003 "List of articles in the current newsgroup that have bookmarks.")
1005 (defvar gnus-newsgroup-dormant nil
1006 "List of dormant articles in the current newsgroup.")
1008 (defvar gnus-newsgroup-scored nil
1009 "List of scored articles in the current newsgroup.")
1011 (defvar gnus-newsgroup-headers nil
1012 "List of article headers in the current newsgroup.")
1014 (defvar gnus-newsgroup-threads nil)
1016 (defvar gnus-newsgroup-prepared nil
1017 "Whether the current group has been prepared properly.")
1019 (defvar gnus-newsgroup-ancient nil
1020 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1022 (defvar gnus-newsgroup-sparse nil)
1024 (defvar gnus-current-article nil)
1025 (defvar gnus-article-current nil)
1026 (defvar gnus-current-headers nil)
1027 (defvar gnus-have-all-headers nil)
1028 (defvar gnus-last-article nil)
1029 (defvar gnus-newsgroup-history nil)
1030 (defvar gnus-newsgroup-charset nil)
1031 (defvar gnus-newsgroup-ephemeral-charset nil)
1032 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1034 (defconst gnus-summary-local-variables
1035 '(gnus-newsgroup-name
1036 gnus-newsgroup-begin gnus-newsgroup-end
1037 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1038 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1039 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1040 gnus-newsgroup-unselected gnus-newsgroup-marked
1041 gnus-newsgroup-reads gnus-newsgroup-saved
1042 gnus-newsgroup-replied gnus-newsgroup-expirable
1043 gnus-newsgroup-processable gnus-newsgroup-killed
1044 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1045 gnus-newsgroup-unsendable
1046 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1047 gnus-newsgroup-headers gnus-newsgroup-threads
1048 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1049 gnus-current-article gnus-current-headers gnus-have-all-headers
1050 gnus-last-article gnus-article-internal-prepare-hook
1051 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1052 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1053 gnus-thread-expunge-below
1054 gnus-score-alist gnus-current-score-file
1055 (gnus-summary-expunge-below . global)
1056 (gnus-summary-mark-below . global)
1057 gnus-newsgroup-active gnus-scores-exclude-files
1058 gnus-newsgroup-history gnus-newsgroup-ancient
1059 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1060 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1061 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1062 (gnus-newsgroup-expunged-tally . 0)
1063 gnus-cache-removable-articles gnus-newsgroup-cached
1064 gnus-newsgroup-data gnus-newsgroup-data-reverse
1065 gnus-newsgroup-limit gnus-newsgroup-limits
1066 gnus-newsgroup-charset)
1067 "Variables that are buffer-local to the summary buffers.")
1069 ;; Byte-compiler warning.
1070 (defvar gnus-article-mode-map)
1074 (defvar gnus-decode-encoded-word-methods
1075 '(mail-decode-encoded-word-string)
1076 "List of methods used to decode encoded words.
1078 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1079 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1080 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1081 whose names match REGEXP.
1084 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1085 mail-decode-encoded-word-string
1086 (\"chinese\" . rfc1843-decode-string))
1089 (defvar gnus-decode-encoded-word-methods-cache nil)
1091 (defun gnus-multi-decode-encoded-word-string (string)
1092 "Apply the functions from `gnus-encoded-word-methods' that match."
1093 (unless (and gnus-decode-encoded-word-methods-cache
1094 (eq gnus-newsgroup-name
1095 (car gnus-decode-encoded-word-methods-cache)))
1096 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1099 (nconc gnus-decode-encoded-word-methods-cache (list x))
1100 (if (and gnus-newsgroup-name
1101 (string-match (car x) gnus-newsgroup-name))
1102 (nconc gnus-decode-encoded-word-methods-cache
1104 gnus-decode-encoded-word-methods))
1105 (let ((xlist gnus-decode-encoded-word-methods-cache))
1108 (setq string (funcall (pop xlist) string))))
1111 ;; Subject simplification.
1113 (defun gnus-simplify-whitespace (str)
1114 "Remove excessive whitespace."
1117 (while (string-match "[ \t][ \t]+" mystr)
1118 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1120 (substring mystr (match-end 0)))))
1122 (when (string-match "^[ \t]+" mystr)
1123 (setq mystr (substring mystr (match-end 0))))
1125 (when (string-match "[ \t]+$" mystr)
1126 (setq mystr (substring mystr 0 (match-beginning 0))))
1129 (defsubst gnus-simplify-subject-re (subject)
1130 "Remove \"Re:\" from subject lines."
1131 (if (string-match "^[Rr][Ee]: *" subject)
1132 (substring subject (match-end 0))
1135 (defun gnus-simplify-subject (subject &optional re-only)
1136 "Remove `Re:' and words in parentheses.
1137 If RE-ONLY is non-nil, strip leading `Re:'s only."
1138 (let ((case-fold-search t)) ;Ignore case.
1139 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1140 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1141 (setq subject (substring subject (match-end 0))))
1142 ;; Remove uninteresting prefixes.
1143 (when (and (not re-only)
1144 gnus-simplify-ignored-prefixes
1145 (string-match gnus-simplify-ignored-prefixes subject))
1146 (setq subject (substring subject (match-end 0))))
1147 ;; Remove words in parentheses from end.
1149 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1150 (setq subject (substring subject 0 (match-beginning 0)))))
1151 ;; Return subject string.
1154 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1156 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1157 (goto-char (point-min))
1158 (while (re-search-forward regexp nil t)
1159 (replace-match (or newtext ""))))
1161 (defun gnus-simplify-buffer-fuzzy ()
1162 "Simplify string in the buffer fuzzily.
1163 The string in the accessible portion of the current buffer is simplified.
1164 It is assumed to be a single-line subject.
1165 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1166 matter is removed. Additional things can be deleted by setting
1167 gnus-simplify-subject-fuzzy-regexp."
1168 (let ((case-fold-search t)
1170 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1172 (while (not (eq modified-tick (buffer-modified-tick)))
1173 (setq modified-tick (buffer-modified-tick))
1175 ((listp gnus-simplify-subject-fuzzy-regexp)
1176 (mapcar 'gnus-simplify-buffer-fuzzy-step
1177 gnus-simplify-subject-fuzzy-regexp))
1178 (gnus-simplify-subject-fuzzy-regexp
1179 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1180 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1181 (gnus-simplify-buffer-fuzzy-step
1182 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1183 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1185 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1186 (gnus-simplify-buffer-fuzzy-step " +" " ")
1187 (gnus-simplify-buffer-fuzzy-step " $")
1188 (gnus-simplify-buffer-fuzzy-step "^ +")))
1190 (defun gnus-simplify-subject-fuzzy (subject)
1191 "Simplify a subject string fuzzily.
1192 See `gnus-simplify-buffer-fuzzy' for details."
1194 (gnus-set-work-buffer)
1195 (let ((case-fold-search t))
1196 ;; Remove uninteresting prefixes.
1197 (when (and gnus-simplify-ignored-prefixes
1198 (string-match gnus-simplify-ignored-prefixes subject))
1199 (setq subject (substring subject (match-end 0))))
1201 (inline (gnus-simplify-buffer-fuzzy))
1204 (defsubst gnus-simplify-subject-fully (subject)
1205 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1207 (gnus-simplify-subject-functions
1208 (gnus-map-function gnus-simplify-subject-functions subject))
1209 ((null gnus-summary-gather-subject-limit)
1210 (gnus-simplify-subject-re subject))
1211 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1212 (gnus-simplify-subject-fuzzy subject))
1213 ((numberp gnus-summary-gather-subject-limit)
1214 (gnus-limit-string (gnus-simplify-subject-re subject)
1215 gnus-summary-gather-subject-limit))
1219 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1220 "Check whether two subjects are equal.
1221 If optional argument simple-first is t, first argument is already
1224 ((null simple-first)
1225 (equal (gnus-simplify-subject-fully s1)
1226 (gnus-simplify-subject-fully s2)))
1229 (gnus-simplify-subject-fully s2)))))
1231 (defun gnus-summary-bubble-group ()
1232 "Increase the score of the current group.
1233 This is a handy function to add to `gnus-summary-exit-hook' to
1234 increase the score of each group you read."
1235 (gnus-group-add-score gnus-newsgroup-name))
1239 ;;; Gnus summary mode
1242 (put 'gnus-summary-mode 'mode-class 'special)
1245 ;; Non-orthogonal keys
1247 (gnus-define-keys gnus-summary-mode-map
1248 " " gnus-summary-next-page
1249 "\177" gnus-summary-prev-page
1250 [delete] gnus-summary-prev-page
1251 [backspace] gnus-summary-prev-page
1252 "\r" gnus-summary-scroll-up
1253 "\M-\r" gnus-summary-scroll-down
1254 "n" gnus-summary-next-unread-article
1255 "p" gnus-summary-prev-unread-article
1256 "N" gnus-summary-next-article
1257 "P" gnus-summary-prev-article
1258 "\M-\C-n" gnus-summary-next-same-subject
1259 "\M-\C-p" gnus-summary-prev-same-subject
1260 "\M-n" gnus-summary-next-unread-subject
1261 "\M-p" gnus-summary-prev-unread-subject
1262 "." gnus-summary-first-unread-article
1263 "," gnus-summary-best-unread-article
1264 "\M-s" gnus-summary-search-article-forward
1265 "\M-r" gnus-summary-search-article-backward
1266 "<" gnus-summary-beginning-of-article
1267 ">" gnus-summary-end-of-article
1268 "j" gnus-summary-goto-article
1269 "^" gnus-summary-refer-parent-article
1270 "\M-^" gnus-summary-refer-article
1271 "u" gnus-summary-tick-article-forward
1272 "!" gnus-summary-tick-article-forward
1273 "U" gnus-summary-tick-article-backward
1274 "d" gnus-summary-mark-as-read-forward
1275 "D" gnus-summary-mark-as-read-backward
1276 "E" gnus-summary-mark-as-expirable
1277 "\M-u" gnus-summary-clear-mark-forward
1278 "\M-U" gnus-summary-clear-mark-backward
1279 "k" gnus-summary-kill-same-subject-and-select
1280 "\C-k" gnus-summary-kill-same-subject
1281 "\M-\C-k" gnus-summary-kill-thread
1282 "\M-\C-l" gnus-summary-lower-thread
1283 "e" gnus-summary-edit-article
1284 "#" gnus-summary-mark-as-processable
1285 "\M-#" gnus-summary-unmark-as-processable
1286 "\M-\C-t" gnus-summary-toggle-threads
1287 "\M-\C-s" gnus-summary-show-thread
1288 "\M-\C-h" gnus-summary-hide-thread
1289 "\M-\C-f" gnus-summary-next-thread
1290 "\M-\C-b" gnus-summary-prev-thread
1291 "\M-\C-u" gnus-summary-up-thread
1292 "\M-\C-d" gnus-summary-down-thread
1293 "&" gnus-summary-execute-command
1294 "c" gnus-summary-catchup-and-exit
1295 "\C-w" gnus-summary-mark-region-as-read
1296 "\C-t" gnus-summary-toggle-truncation
1297 "?" gnus-summary-mark-as-dormant
1298 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1299 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1300 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1301 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1302 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1303 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1304 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1305 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1306 "=" gnus-summary-expand-window
1307 "\C-x\C-s" gnus-summary-reselect-current-group
1308 "\M-g" gnus-summary-rescan-group
1309 "w" gnus-summary-stop-page-breaking
1310 "\C-c\C-r" gnus-summary-caesar-message
1311 "f" gnus-summary-followup
1312 "F" gnus-summary-followup-with-original
1313 "C" gnus-summary-cancel-article
1314 "r" gnus-summary-reply
1315 "R" gnus-summary-reply-with-original
1316 "\C-c\C-f" gnus-summary-mail-forward
1317 "o" gnus-summary-save-article
1318 "\C-o" gnus-summary-save-article-mail
1319 "|" gnus-summary-pipe-output
1320 "\M-k" gnus-summary-edit-local-kill
1321 "\M-K" gnus-summary-edit-global-kill
1323 "\C-c\C-d" gnus-summary-describe-group
1324 "q" gnus-summary-exit
1325 "Q" gnus-summary-exit-no-update
1326 "\C-c\C-i" gnus-info-find-node
1327 gnus-mouse-2 gnus-mouse-pick-article
1328 "m" gnus-summary-mail-other-window
1329 "a" gnus-summary-post-news
1330 "x" gnus-summary-limit-to-unread
1331 "s" gnus-summary-isearch-article
1332 "t" gnus-summary-toggle-header
1333 "g" gnus-summary-show-article
1334 "l" gnus-summary-goto-last-article
1335 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1336 "\C-d" gnus-summary-enter-digest-group
1337 "\M-\C-d" gnus-summary-read-document
1338 "\M-\C-e" gnus-summary-edit-parameters
1339 "\M-\C-g" gnus-summary-customize-parameters
1341 "*" gnus-cache-enter-article
1342 "\M-*" gnus-cache-remove-article
1343 "\M-&" gnus-summary-universal-argument
1344 "\C-l" gnus-recenter
1345 "I" gnus-summary-increase-score
1346 "L" gnus-summary-lower-score
1347 "\M-i" gnus-symbolic-argument
1348 "h" gnus-summary-select-article-buffer
1350 "b" gnus-article-view-part
1351 "\M-t" gnus-summary-toggle-display-buttonized
1353 "V" gnus-summary-score-map
1354 "X" gnus-uu-extract-map
1355 "S" gnus-summary-send-map)
1357 ;; Sort of orthogonal keymap
1358 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1359 "t" gnus-summary-tick-article-forward
1360 "!" gnus-summary-tick-article-forward
1361 "d" gnus-summary-mark-as-read-forward
1362 "r" gnus-summary-mark-as-read-forward
1363 "c" gnus-summary-clear-mark-forward
1364 " " gnus-summary-clear-mark-forward
1365 "e" gnus-summary-mark-as-expirable
1366 "x" gnus-summary-mark-as-expirable
1367 "?" gnus-summary-mark-as-dormant
1368 "b" gnus-summary-set-bookmark
1369 "B" gnus-summary-remove-bookmark
1370 "#" gnus-summary-mark-as-processable
1371 "\M-#" gnus-summary-unmark-as-processable
1372 "S" gnus-summary-limit-include-expunged
1373 "C" gnus-summary-catchup
1374 "H" gnus-summary-catchup-to-here
1375 "\C-c" gnus-summary-catchup-all
1376 "k" gnus-summary-kill-same-subject-and-select
1377 "K" gnus-summary-kill-same-subject
1378 "P" gnus-uu-mark-map)
1380 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1381 "c" gnus-summary-clear-above
1382 "u" gnus-summary-tick-above
1383 "m" gnus-summary-mark-above
1384 "k" gnus-summary-kill-below)
1386 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1387 "/" gnus-summary-limit-to-subject
1388 "n" gnus-summary-limit-to-articles
1389 "w" gnus-summary-pop-limit
1390 "s" gnus-summary-limit-to-subject
1391 "a" gnus-summary-limit-to-author
1392 "u" gnus-summary-limit-to-unread
1393 "m" gnus-summary-limit-to-marks
1394 "M" gnus-summary-limit-exclude-marks
1395 "v" gnus-summary-limit-to-score
1396 "*" gnus-summary-limit-include-cached
1397 "D" gnus-summary-limit-include-dormant
1398 "T" gnus-summary-limit-include-thread
1399 "d" gnus-summary-limit-exclude-dormant
1400 "t" gnus-summary-limit-to-age
1401 "x" gnus-summary-limit-to-extra
1402 "E" gnus-summary-limit-include-expunged
1403 "c" gnus-summary-limit-exclude-childless-dormant
1404 "C" gnus-summary-limit-mark-excluded-as-read)
1406 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1407 "n" gnus-summary-next-unread-article
1408 "p" gnus-summary-prev-unread-article
1409 "N" gnus-summary-next-article
1410 "P" gnus-summary-prev-article
1411 "\C-n" gnus-summary-next-same-subject
1412 "\C-p" gnus-summary-prev-same-subject
1413 "\M-n" gnus-summary-next-unread-subject
1414 "\M-p" gnus-summary-prev-unread-subject
1415 "f" gnus-summary-first-unread-article
1416 "b" gnus-summary-best-unread-article
1417 "j" gnus-summary-goto-article
1418 "g" gnus-summary-goto-subject
1419 "l" gnus-summary-goto-last-article
1420 "o" gnus-summary-pop-article)
1422 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1423 "k" gnus-summary-kill-thread
1424 "l" gnus-summary-lower-thread
1425 "i" gnus-summary-raise-thread
1426 "T" gnus-summary-toggle-threads
1427 "t" gnus-summary-rethread-current
1428 "^" gnus-summary-reparent-thread
1429 "s" gnus-summary-show-thread
1430 "S" gnus-summary-show-all-threads
1431 "h" gnus-summary-hide-thread
1432 "H" gnus-summary-hide-all-threads
1433 "n" gnus-summary-next-thread
1434 "p" gnus-summary-prev-thread
1435 "u" gnus-summary-up-thread
1436 "o" gnus-summary-top-thread
1437 "d" gnus-summary-down-thread
1438 "#" gnus-uu-mark-thread
1439 "\M-#" gnus-uu-unmark-thread)
1441 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1442 "g" gnus-summary-prepare
1443 "c" gnus-summary-insert-cached-articles)
1445 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1446 "c" gnus-summary-catchup-and-exit
1447 "C" gnus-summary-catchup-all-and-exit
1448 "E" gnus-summary-exit-no-update
1449 "Q" gnus-summary-exit
1450 "Z" gnus-summary-exit
1451 "n" gnus-summary-catchup-and-goto-next-group
1452 "R" gnus-summary-reselect-current-group
1453 "G" gnus-summary-rescan-group
1454 "N" gnus-summary-next-group
1455 "s" gnus-summary-save-newsrc
1456 "P" gnus-summary-prev-group)
1458 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1459 " " gnus-summary-next-page
1460 "n" gnus-summary-next-page
1461 "\177" gnus-summary-prev-page
1462 [delete] gnus-summary-prev-page
1463 "p" gnus-summary-prev-page
1464 "\r" gnus-summary-scroll-up
1465 "\M-\r" gnus-summary-scroll-down
1466 "<" gnus-summary-beginning-of-article
1467 ">" gnus-summary-end-of-article
1468 "b" gnus-summary-beginning-of-article
1469 "e" gnus-summary-end-of-article
1470 "^" gnus-summary-refer-parent-article
1471 "r" gnus-summary-refer-parent-article
1472 "D" gnus-summary-enter-digest-group
1473 "R" gnus-summary-refer-references
1474 "T" gnus-summary-refer-thread
1475 "g" gnus-summary-show-article
1476 "s" gnus-summary-isearch-article
1477 "P" gnus-summary-print-article
1478 "t" gnus-article-babel)
1480 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1481 "b" gnus-article-add-buttons
1482 "B" gnus-article-add-buttons-to-head
1483 "o" gnus-article-treat-overstrike
1484 "e" gnus-article-emphasize
1485 "w" gnus-article-fill-cited-article
1486 "Q" gnus-article-fill-long-lines
1487 "C" gnus-article-capitalize-sentences
1488 "c" gnus-article-remove-cr
1489 "q" gnus-article-de-quoted-unreadable
1490 "f" gnus-article-display-x-face
1491 "l" gnus-summary-stop-page-breaking
1492 "r" gnus-summary-caesar-message
1493 "t" gnus-article-hide-headers
1494 "v" gnus-summary-verbose-headers
1495 "h" gnus-article-treat-html
1496 "H" gnus-article-strip-headers-in-body
1497 "d" gnus-article-treat-dumbquotes)
1499 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1500 "a" gnus-article-hide
1501 "h" gnus-article-hide-headers
1502 "b" gnus-article-hide-boring-headers
1503 "s" gnus-article-hide-signature
1504 "c" gnus-article-hide-citation
1505 "C" gnus-article-hide-citation-in-followups
1506 "p" gnus-article-hide-pgp
1507 "B" gnus-article-strip-banner
1508 "P" gnus-article-hide-pem
1509 "\C-c" gnus-article-hide-citation-maybe)
1511 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1512 "a" gnus-article-highlight
1513 "h" gnus-article-highlight-headers
1514 "c" gnus-article-highlight-citation
1515 "s" gnus-article-highlight-signature)
1517 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1518 "w" gnus-article-decode-mime-words
1519 "c" gnus-article-decode-charset
1520 "v" gnus-mime-view-all-parts
1521 "b" gnus-article-view-part)
1523 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1524 "z" gnus-article-date-ut
1525 "u" gnus-article-date-ut
1526 "l" gnus-article-date-local
1527 "e" gnus-article-date-lapsed
1528 "o" gnus-article-date-original
1529 "i" gnus-article-date-iso8601
1530 "s" gnus-article-date-user)
1532 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1533 "t" gnus-article-remove-trailing-blank-lines
1534 "l" gnus-article-strip-leading-blank-lines
1535 "m" gnus-article-strip-multiple-blank-lines
1536 "a" gnus-article-strip-blank-lines
1537 "A" gnus-article-strip-all-blank-lines
1538 "s" gnus-article-strip-leading-space
1539 "e" gnus-article-strip-trailing-space)
1541 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1543 "f" gnus-summary-fetch-faq
1544 "d" gnus-summary-describe-group
1545 "h" gnus-summary-describe-briefly
1546 "i" gnus-info-find-node)
1548 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1549 "e" gnus-summary-expire-articles
1550 "\M-\C-e" gnus-summary-expire-articles-now
1551 "\177" gnus-summary-delete-article
1552 [delete] gnus-summary-delete-article
1553 [backspace] gnus-summary-delete-article
1554 "m" gnus-summary-move-article
1555 "r" gnus-summary-respool-article
1556 "w" gnus-summary-edit-article
1557 "c" gnus-summary-copy-article
1558 "B" gnus-summary-crosspost-article
1559 "q" gnus-summary-respool-query
1560 "t" gnus-summary-respool-trace
1561 "i" gnus-summary-import-article
1562 "p" gnus-summary-article-posted-p)
1564 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1565 "o" gnus-summary-save-article
1566 "m" gnus-summary-save-article-mail
1567 "F" gnus-summary-write-article-file
1568 "r" gnus-summary-save-article-rmail
1569 "f" gnus-summary-save-article-file
1570 "b" gnus-summary-save-article-body-file
1571 "h" gnus-summary-save-article-folder
1572 "v" gnus-summary-save-article-vm
1573 "p" gnus-summary-pipe-output
1574 "s" gnus-soup-add-article)
1576 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1577 "b" gnus-summary-display-buttonized
1578 "m" gnus-summary-repair-multipart
1579 "v" gnus-article-view-part
1580 "o" gnus-article-save-part
1581 "c" gnus-article-copy-part
1582 "e" gnus-article-externalize-part
1583 "i" gnus-article-inline-part
1584 "|" gnus-article-pipe-part)
1587 (defun gnus-summary-make-menu-bar ()
1588 (gnus-turn-off-edit-menu 'summary)
1590 (unless (boundp 'gnus-summary-misc-menu)
1593 gnus-summary-kill-menu gnus-summary-mode-map ""
1598 ["Enter score..." gnus-summary-score-entry t]
1599 ["Customize" gnus-score-customize t])
1600 (gnus-make-score-map 'increase)
1601 (gnus-make-score-map 'lower)
1603 ["Kill below" gnus-summary-kill-below t]
1604 ["Mark above" gnus-summary-mark-above t]
1605 ["Tick above" gnus-summary-tick-above t]
1606 ["Clear above" gnus-summary-clear-above t])
1607 ["Current score" gnus-summary-current-score t]
1608 ["Set score" gnus-summary-set-score t]
1609 ["Switch current score file..." gnus-score-change-score-file t]
1610 ["Set mark below..." gnus-score-set-mark-below t]
1611 ["Set expunge below..." gnus-score-set-expunge-below t]
1612 ["Edit current score file" gnus-score-edit-current-scores t]
1613 ["Edit score file" gnus-score-edit-file t]
1614 ["Trace score" gnus-score-find-trace t]
1615 ["Find words" gnus-score-find-favourite-words t]
1616 ["Rescore buffer" gnus-summary-rescore t]
1617 ["Increase score..." gnus-summary-increase-score t]
1618 ["Lower score..." gnus-summary-lower-score t]))))
1620 ;; Define both the Article menu in the summary buffer and the equivalent
1621 ;; Commands menu in the article buffer here for consistency.
1624 ["All" gnus-article-hide t]
1625 ["Headers" gnus-article-hide-headers t]
1626 ["Signature" gnus-article-hide-signature t]
1627 ["Citation" gnus-article-hide-citation t]
1628 ["PGP" gnus-article-hide-pgp t]
1629 ["Banner" gnus-article-strip-banner t]
1630 ["Boring headers" gnus-article-hide-boring-headers t])
1632 ["All" gnus-article-highlight t]
1633 ["Headers" gnus-article-highlight-headers t]
1634 ["Signature" gnus-article-highlight-signature t]
1635 ["Citation" gnus-article-highlight-citation t])
1637 ["Words" gnus-article-decode-mime-words t]
1638 ["Charset" gnus-article-decode-charset t]
1639 ["QP" gnus-article-de-quoted-unreadable t]
1640 ["View all" gnus-mime-view-all-parts t])
1642 ["Local" gnus-article-date-local t]
1643 ["ISO8601" gnus-article-date-iso8601 t]
1644 ["UT" gnus-article-date-ut t]
1645 ["Original" gnus-article-date-original t]
1646 ["Lapsed" gnus-article-date-lapsed t]
1647 ["User-defined" gnus-article-date-user t])
1650 ["Leading" gnus-article-strip-leading-blank-lines t]
1651 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1652 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1653 ["All of the above" gnus-article-strip-blank-lines t]
1654 ["All" gnus-article-strip-all-blank-lines t]
1655 ["Leading space" gnus-article-strip-leading-space t]
1656 ["Trailing space" gnus-article-strip-trailing-space t])
1657 ["Overstrike" gnus-article-treat-overstrike t]
1658 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1659 ["Emphasis" gnus-article-emphasize t]
1660 ["Word wrap" gnus-article-fill-cited-article t]
1661 ["Fill long lines" gnus-article-fill-long-lines t]
1662 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1663 ["CR" gnus-article-remove-cr t]
1664 ["Show X-Face" gnus-article-display-x-face t]
1665 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1666 ["UnHTMLize" gnus-article-treat-html t]
1667 ["Rot 13" gnus-summary-caesar-message t]
1668 ["Unix pipe" gnus-summary-pipe-message t]
1669 ["Add buttons" gnus-article-add-buttons t]
1670 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1671 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1672 ["Verbose header" gnus-summary-verbose-headers t]
1673 ["Toggle header" gnus-summary-toggle-header t])
1675 ["Save in default format" gnus-summary-save-article t]
1676 ["Save in file" gnus-summary-save-article-file t]
1677 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1678 ["Save in MH folder" gnus-summary-save-article-folder t]
1679 ["Save in VM folder" gnus-summary-save-article-vm t]
1680 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1681 ["Save body in file" gnus-summary-save-article-body-file t]
1682 ["Pipe through a filter" gnus-summary-pipe-output t]
1683 ["Add to SOUP packet" gnus-soup-add-article t]
1684 ["Print" gnus-summary-print-article t])
1686 ["Respool article..." gnus-summary-respool-article t]
1687 ["Move article..." gnus-summary-move-article
1688 (gnus-check-backend-function
1689 'request-move-article gnus-newsgroup-name)]
1690 ["Copy article..." gnus-summary-copy-article t]
1691 ["Crosspost article..." gnus-summary-crosspost-article
1692 (gnus-check-backend-function
1693 'request-replace-article gnus-newsgroup-name)]
1694 ["Import file..." gnus-summary-import-article t]
1695 ["Check if posted" gnus-summary-article-posted-p t]
1696 ["Edit article" gnus-summary-edit-article
1697 (not (gnus-group-read-only-p))]
1698 ["Delete article" gnus-summary-delete-article
1699 (gnus-check-backend-function
1700 'request-expire-articles gnus-newsgroup-name)]
1701 ["Query respool" gnus-summary-respool-query t]
1702 ["Trace respool" gnus-summary-respool-trace t]
1703 ["Delete expirable articles" gnus-summary-expire-articles-now
1704 (gnus-check-backend-function
1705 'request-expire-articles gnus-newsgroup-name)])
1707 ["Uudecode" gnus-uu-decode-uu t]
1708 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1709 ["Unshar" gnus-uu-decode-unshar t]
1710 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1711 ["Save" gnus-uu-decode-save t]
1712 ["Binhex" gnus-uu-decode-binhex t]
1713 ["Postscript" gnus-uu-decode-postscript t])
1715 ["Enter article" gnus-cache-enter-article t]
1716 ["Remove article" gnus-cache-remove-article t])
1717 ["Translate" gnus-article-babel t]
1718 ["Select article buffer" gnus-summary-select-article-buffer t]
1719 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1720 ["Isearch article..." gnus-summary-isearch-article t]
1721 ["Beginning of the article" gnus-summary-beginning-of-article t]
1722 ["End of the article" gnus-summary-end-of-article t]
1723 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1724 ["Fetch referenced articles" gnus-summary-refer-references t]
1725 ["Fetch current thread" gnus-summary-refer-thread t]
1726 ["Fetch article with id..." gnus-summary-refer-article t]
1727 ["Redisplay" gnus-summary-show-article t])))
1729 gnus-summary-article-menu gnus-summary-mode-map ""
1730 (cons "Article" innards))
1733 gnus-article-commands-menu gnus-article-mode-map ""
1734 (cons "Commands" innards)))
1737 gnus-summary-thread-menu gnus-summary-mode-map ""
1739 ["Toggle threading" gnus-summary-toggle-threads t]
1740 ["Hide threads" gnus-summary-hide-all-threads t]
1741 ["Show threads" gnus-summary-show-all-threads t]
1742 ["Hide thread" gnus-summary-hide-thread t]
1743 ["Show thread" gnus-summary-show-thread t]
1744 ["Go to next thread" gnus-summary-next-thread t]
1745 ["Go to previous thread" gnus-summary-prev-thread t]
1746 ["Go down thread" gnus-summary-down-thread t]
1747 ["Go up thread" gnus-summary-up-thread t]
1748 ["Top of thread" gnus-summary-top-thread t]
1749 ["Mark thread as read" gnus-summary-kill-thread t]
1750 ["Lower thread score" gnus-summary-lower-thread t]
1751 ["Raise thread score" gnus-summary-raise-thread t]
1752 ["Rethread current" gnus-summary-rethread-current t]
1756 gnus-summary-post-menu gnus-summary-mode-map ""
1758 ["Post an article" gnus-summary-post-news t]
1759 ["Followup" gnus-summary-followup t]
1760 ["Followup and yank" gnus-summary-followup-with-original t]
1761 ["Supersede article" gnus-summary-supersede-article t]
1762 ["Cancel article" gnus-summary-cancel-article t]
1763 ["Reply" gnus-summary-reply t]
1764 ["Reply and yank" gnus-summary-reply-with-original t]
1765 ["Wide reply" gnus-summary-wide-reply t]
1766 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1767 ["Mail forward" gnus-summary-mail-forward t]
1768 ["Post forward" gnus-summary-post-forward t]
1769 ["Digest and mail" gnus-uu-digest-mail-forward t]
1770 ["Digest and post" gnus-uu-digest-post-forward t]
1771 ["Resend message" gnus-summary-resend-message t]
1772 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1773 ["Send a mail" gnus-summary-mail-other-window t]
1774 ["Uuencode and post" gnus-uu-post-news t]
1775 ["Followup via news" gnus-summary-followup-to-mail t]
1776 ["Followup via news and yank"
1777 gnus-summary-followup-to-mail-with-original t]
1779 ;;["Send" gnus-summary-send-draft t]
1780 ;;["Send bounced" gnus-resend-bounced-mail t])
1784 gnus-summary-misc-menu gnus-summary-mode-map ""
1787 ["Mark as read" gnus-summary-mark-as-read-forward t]
1788 ["Mark same subject and select"
1789 gnus-summary-kill-same-subject-and-select t]
1790 ["Mark same subject" gnus-summary-kill-same-subject t]
1791 ["Catchup" gnus-summary-catchup t]
1792 ["Catchup all" gnus-summary-catchup-all t]
1793 ["Catchup to here" gnus-summary-catchup-to-here t]
1794 ["Catchup region" gnus-summary-mark-region-as-read t]
1795 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1797 ["Tick" gnus-summary-tick-article-forward t]
1798 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1799 ["Remove marks" gnus-summary-clear-mark-forward t]
1800 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1801 ["Set bookmark" gnus-summary-set-bookmark t]
1802 ["Remove bookmark" gnus-summary-remove-bookmark t])
1804 ["Marks..." gnus-summary-limit-to-marks t]
1805 ["Subject..." gnus-summary-limit-to-subject t]
1806 ["Author..." gnus-summary-limit-to-author t]
1807 ["Age..." gnus-summary-limit-to-age t]
1808 ["Extra..." gnus-summary-limit-to-extra t]
1809 ["Score" gnus-summary-limit-to-score t]
1810 ["Unread" gnus-summary-limit-to-unread t]
1811 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1812 ["Articles" gnus-summary-limit-to-articles t]
1813 ["Pop limit" gnus-summary-pop-limit t]
1814 ["Show dormant" gnus-summary-limit-include-dormant t]
1815 ["Hide childless dormant"
1816 gnus-summary-limit-exclude-childless-dormant t]
1817 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1818 ["Hide marked" gnus-summary-limit-exclude-marks t]
1819 ["Show expunged" gnus-summary-show-all-expunged t])
1821 ["Set mark" gnus-summary-mark-as-processable t]
1822 ["Remove mark" gnus-summary-unmark-as-processable t]
1823 ["Remove all marks" gnus-summary-unmark-all-processable t]
1824 ["Mark above" gnus-uu-mark-over t]
1825 ["Mark series" gnus-uu-mark-series t]
1826 ["Mark region" gnus-uu-mark-region t]
1827 ["Unmark region" gnus-uu-unmark-region t]
1828 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1829 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1830 ["Mark all" gnus-uu-mark-all t]
1831 ["Mark buffer" gnus-uu-mark-buffer t]
1832 ["Mark sparse" gnus-uu-mark-sparse t]
1833 ["Mark thread" gnus-uu-mark-thread t]
1834 ["Unmark thread" gnus-uu-unmark-thread t]
1835 ("Process Mark Sets"
1836 ["Kill" gnus-summary-kill-process-mark t]
1837 ["Yank" gnus-summary-yank-process-mark
1838 gnus-newsgroup-process-stack]
1839 ["Save" gnus-summary-save-process-mark t]))
1841 ["Page forward" gnus-summary-next-page t]
1842 ["Page backward" gnus-summary-prev-page t]
1843 ["Line forward" gnus-summary-scroll-up t])
1845 ["Next unread article" gnus-summary-next-unread-article t]
1846 ["Previous unread article" gnus-summary-prev-unread-article t]
1847 ["Next article" gnus-summary-next-article t]
1848 ["Previous article" gnus-summary-prev-article t]
1849 ["Next unread subject" gnus-summary-next-unread-subject t]
1850 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1851 ["Next article same subject" gnus-summary-next-same-subject t]
1852 ["Previous article same subject" gnus-summary-prev-same-subject t]
1853 ["First unread article" gnus-summary-first-unread-article t]
1854 ["Best unread article" gnus-summary-best-unread-article t]
1855 ["Go to subject number..." gnus-summary-goto-subject t]
1856 ["Go to article number..." gnus-summary-goto-article t]
1857 ["Go to the last article" gnus-summary-goto-last-article t]
1858 ["Pop article off history" gnus-summary-pop-article t])
1860 ["Sort by number" gnus-summary-sort-by-number t]
1861 ["Sort by author" gnus-summary-sort-by-author t]
1862 ["Sort by subject" gnus-summary-sort-by-subject t]
1863 ["Sort by date" gnus-summary-sort-by-date t]
1864 ["Sort by score" gnus-summary-sort-by-score t]
1865 ["Sort by lines" gnus-summary-sort-by-lines t]
1866 ["Sort by characters" gnus-summary-sort-by-chars t])
1868 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1869 ["Describe group" gnus-summary-describe-group t]
1870 ["Read manual" gnus-info-find-node t])
1872 ["Pick and read" gnus-pick-mode t]
1873 ["Binary" gnus-binary-mode t])
1875 ["Regenerate" gnus-summary-prepare t]
1876 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1877 ["Toggle threading" gnus-summary-toggle-threads t])
1878 ["Filter articles..." gnus-summary-execute-command t]
1879 ["Run command on subjects..." gnus-summary-universal-argument t]
1880 ["Search articles forward..." gnus-summary-search-article-forward t]
1881 ["Search articles backward..." gnus-summary-search-article-backward t]
1882 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1883 ["Expand window" gnus-summary-expand-window t]
1884 ["Expire expirable articles" gnus-summary-expire-articles
1885 (gnus-check-backend-function
1886 'request-expire-articles gnus-newsgroup-name)]
1887 ["Edit local kill file" gnus-summary-edit-local-kill t]
1888 ["Edit main kill file" gnus-summary-edit-global-kill t]
1889 ["Edit group parameters" gnus-summary-edit-parameters t]
1890 ["Customize group parameters" gnus-summary-customize-parameters t]
1891 ["Send a bug report" gnus-bug t]
1893 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1894 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1895 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1896 ["Exit group" gnus-summary-exit t]
1897 ["Exit group without updating" gnus-summary-exit-no-update t]
1898 ["Exit and goto next group" gnus-summary-next-group t]
1899 ["Exit and goto prev group" gnus-summary-prev-group t]
1900 ["Reselect group" gnus-summary-reselect-current-group t]
1901 ["Rescan group" gnus-summary-rescan-group t]
1902 ["Update dribble" gnus-summary-save-newsrc t])))
1904 (gnus-run-hooks 'gnus-summary-menu-hook)))
1906 (defun gnus-score-set-default (var value)
1907 "A version of set that updates the GNU Emacs menu-bar."
1909 ;; It is the message that forces the active status to be updated.
1912 (defun gnus-make-score-map (type)
1913 "Make a summary score map of type TYPE."
1916 (let ((headers '(("author" "from" string)
1917 ("subject" "subject" string)
1918 ("article body" "body" string)
1919 ("article head" "head" string)
1920 ("xref" "xref" string)
1921 ("extra header" "extra" string)
1922 ("lines" "lines" number)
1923 ("followups to author" "followup" string)))
1924 (types '((number ("less than" <)
1927 (string ("substring" s)
1931 (perms '(("temporary" (current-time-string))
1939 (if (eq type 'lower)
1944 (setq header (car headers))
1950 (let ((ts (cdr (assoc (nth 2 header) types)))
1966 'gnus-summary-score-entry
1968 (if (or (string= (nth 1 header)
1970 (string= (nth 1 header)
1973 (list 'gnus-summary-header
1975 (list 'quote (nth 1 (car ts)))
1976 (list 'gnus-score-default nil)
1982 (list (nreverse outp))))
1985 (list (nreverse outt))))
1987 (setq headers (cdr headers)))
1988 (list (nreverse outh))))))))
1992 (defun gnus-summary-mode (&optional group)
1993 "Major mode for reading articles.
1995 All normal editing commands are switched off.
1996 \\<gnus-summary-mode-map>
1997 Each line in this buffer represents one article. To read an
1998 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1999 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2002 You can also post articles and send mail from this buffer. To
2003 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2004 of an article, type `\\[gnus-summary-reply]'.
2006 There are approx. one gazillion commands you can execute in this
2007 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2009 The following commands are available:
2011 \\{gnus-summary-mode-map}"
2013 (when (gnus-visual-p 'summary-menu 'menu)
2014 (gnus-summary-make-menu-bar))
2015 (kill-all-local-variables)
2016 (gnus-summary-make-local-variables)
2017 (gnus-make-thread-indent-array)
2018 (gnus-simplify-mode-line)
2019 (setq major-mode 'gnus-summary-mode)
2020 (setq mode-name "Summary")
2021 (make-local-variable 'minor-mode-alist)
2022 (use-local-map gnus-summary-mode-map)
2023 (buffer-disable-undo)
2024 (setq buffer-read-only t) ;Disable modification
2025 (setq truncate-lines t)
2026 (setq selective-display t)
2027 (setq selective-display-ellipses t) ;Display `...'
2028 (gnus-summary-set-display-table)
2029 (gnus-set-default-directory)
2030 (setq gnus-newsgroup-name group)
2031 (make-local-variable 'gnus-summary-line-format)
2032 (make-local-variable 'gnus-summary-line-format-spec)
2033 (make-local-variable 'gnus-summary-dummy-line-format)
2034 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2035 (make-local-variable 'gnus-summary-mark-positions)
2036 (make-local-hook 'pre-command-hook)
2037 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2038 (gnus-run-hooks 'gnus-summary-mode-hook)
2039 (mm-enable-multibyte)
2040 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2041 (gnus-update-summary-mark-positions))
2043 (defun gnus-summary-make-local-variables ()
2044 "Make all the local summary buffer variables."
2046 (dolist (local gnus-summary-local-variables)
2049 (if (eq (cdr local) 'global)
2050 ;; Copy the global value of the variable.
2051 (setq global (symbol-value (car local)))
2052 ;; Use the value from the list.
2053 (setq global (eval (cdr local))))
2054 (set (make-local-variable (car local)) global))
2055 ;; Simple nil-valued local variable.
2056 (set (make-local-variable local) nil)))))
2058 (defun gnus-summary-clear-local-variables ()
2059 (let ((locals gnus-summary-local-variables))
2061 (if (consp (car locals))
2062 (and (vectorp (caar locals))
2063 (set (caar locals) nil))
2064 (and (vectorp (car locals))
2065 (set (car locals) nil)))
2066 (setq locals (cdr locals)))))
2068 ;; Summary data functions.
2070 (defmacro gnus-data-number (data)
2073 (defmacro gnus-data-set-number (data number)
2074 `(setcar ,data ,number))
2076 (defmacro gnus-data-mark (data)
2079 (defmacro gnus-data-set-mark (data mark)
2080 `(setcar (nthcdr 1 ,data) ,mark))
2082 (defmacro gnus-data-pos (data)
2085 (defmacro gnus-data-set-pos (data pos)
2086 `(setcar (nthcdr 2 ,data) ,pos))
2088 (defmacro gnus-data-header (data)
2091 (defmacro gnus-data-set-header (data header)
2092 `(setf (nth 3 ,data) ,header))
2094 (defmacro gnus-data-level (data)
2097 (defmacro gnus-data-unread-p (data)
2098 `(= (nth 1 ,data) gnus-unread-mark))
2100 (defmacro gnus-data-read-p (data)
2101 `(/= (nth 1 ,data) gnus-unread-mark))
2103 (defmacro gnus-data-pseudo-p (data)
2104 `(consp (nth 3 ,data)))
2106 (defmacro gnus-data-find (number)
2107 `(assq ,number gnus-newsgroup-data))
2109 (defmacro gnus-data-find-list (number &optional data)
2110 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2111 (memq (assq ,number bdata)
2114 (defmacro gnus-data-make (number mark pos header level)
2115 `(list ,number ,mark ,pos ,header ,level))
2117 (defun gnus-data-enter (after-article number mark pos header level offset)
2118 (let ((data (gnus-data-find-list after-article)))
2120 (error "No such article: %d" after-article))
2121 (setcdr data (cons (gnus-data-make number mark pos header level)
2123 (setq gnus-newsgroup-data-reverse nil)
2124 (gnus-data-update-list (cddr data) offset)))
2126 (defun gnus-data-enter-list (after-article list &optional offset)
2128 (let ((data (and after-article (gnus-data-find-list after-article)))
2132 (let ((odata gnus-newsgroup-data))
2133 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2135 (gnus-data-update-list odata offset)))
2136 ;; Find the last element in the list to be spliced into the main
2139 (setq list (cdr list)))
2142 (setcdr list gnus-newsgroup-data)
2143 (setq gnus-newsgroup-data ilist)
2145 (gnus-data-update-list (cdr list) offset)))
2146 (setcdr list (cdr data))
2149 (gnus-data-update-list (cdr list) offset))))
2150 (setq gnus-newsgroup-data-reverse nil))))
2152 (defun gnus-data-remove (article &optional offset)
2153 (let ((data gnus-newsgroup-data))
2154 (if (= (gnus-data-number (car data)) article)
2156 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2157 gnus-newsgroup-data-reverse nil)
2159 (gnus-data-update-list gnus-newsgroup-data offset)))
2161 (when (= (gnus-data-number (cadr data)) article)
2162 (setcdr data (cddr data))
2164 (gnus-data-update-list (cdr data) offset))
2166 gnus-newsgroup-data-reverse nil))
2167 (setq data (cdr data))))))
2169 (defmacro gnus-data-list (backward)
2171 (or gnus-newsgroup-data-reverse
2172 (setq gnus-newsgroup-data-reverse
2173 (reverse gnus-newsgroup-data)))
2174 gnus-newsgroup-data))
2176 (defun gnus-data-update-list (data offset)
2177 "Add OFFSET to the POS of all data entries in DATA."
2178 (setq gnus-newsgroup-data-reverse nil)
2180 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2181 (setq data (cdr data))))
2183 (defun gnus-summary-article-pseudo-p (article)
2184 "Say whether this article is a pseudo article or not."
2185 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2187 (defmacro gnus-summary-article-sparse-p (article)
2188 "Say whether this article is a sparse article or not."
2189 `(memq ,article gnus-newsgroup-sparse))
2191 (defmacro gnus-summary-article-ancient-p (article)
2192 "Say whether this article is a sparse article or not."
2193 `(memq ,article gnus-newsgroup-ancient))
2195 (defun gnus-article-parent-p (number)
2196 "Say whether this article is a parent or not."
2197 (let ((data (gnus-data-find-list number)))
2198 (and (cdr data) ; There has to be an article after...
2199 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2200 (gnus-data-level (nth 1 data))))))
2202 (defun gnus-article-children (number)
2203 "Return a list of all children to NUMBER."
2204 (let* ((data (gnus-data-find-list number))
2205 (level (gnus-data-level (car data)))
2207 (setq data (cdr data))
2209 (= (gnus-data-level (car data)) (1+ level)))
2210 (push (gnus-data-number (car data)) children)
2211 (setq data (cdr data)))
2214 (defmacro gnus-summary-skip-intangible ()
2215 "If the current article is intangible, then jump to a different article."
2216 '(let ((to (get-text-property (point) 'gnus-intangible)))
2217 (and to (gnus-summary-goto-subject to))))
2219 (defmacro gnus-summary-article-intangible-p ()
2220 "Say whether this article is intangible or not."
2221 '(get-text-property (point) 'gnus-intangible))
2223 (defun gnus-article-read-p (article)
2224 "Say whether ARTICLE is read or not."
2225 (not (or (memq article gnus-newsgroup-marked)
2226 (memq article gnus-newsgroup-unreads)
2227 (memq article gnus-newsgroup-unselected)
2228 (memq article gnus-newsgroup-dormant))))
2230 ;; Some summary mode macros.
2232 (defmacro gnus-summary-article-number ()
2233 "The article number of the article on the current line.
2234 If there isn's an article number here, then we return the current
2237 (gnus-summary-skip-intangible)
2238 (or (get-text-property (point) 'gnus-number)
2239 (gnus-summary-last-subject))))
2241 (defmacro gnus-summary-article-header (&optional number)
2242 "Return the header of article NUMBER."
2243 `(gnus-data-header (gnus-data-find
2244 ,(or number '(gnus-summary-article-number)))))
2246 (defmacro gnus-summary-thread-level (&optional number)
2247 "Return the level of thread that starts with article NUMBER."
2248 `(if (and (eq gnus-summary-make-false-root 'dummy)
2249 (get-text-property (point) 'gnus-intangible))
2251 (gnus-data-level (gnus-data-find
2252 ,(or number '(gnus-summary-article-number))))))
2254 (defmacro gnus-summary-article-mark (&optional number)
2255 "Return the mark of article NUMBER."
2256 `(gnus-data-mark (gnus-data-find
2257 ,(or number '(gnus-summary-article-number)))))
2259 (defmacro gnus-summary-article-pos (&optional number)
2260 "Return the position of the line of article NUMBER."
2261 `(gnus-data-pos (gnus-data-find
2262 ,(or number '(gnus-summary-article-number)))))
2264 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2265 (defmacro gnus-summary-article-subject (&optional number)
2266 "Return current subject string or nil if nothing."
2269 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2270 '(gnus-data-header (assq (gnus-summary-article-number)
2271 gnus-newsgroup-data)))))
2274 (mail-header-subject headers))))
2276 (defmacro gnus-summary-article-score (&optional number)
2277 "Return current article score."
2278 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2279 gnus-newsgroup-scored))
2280 gnus-summary-default-score 0))
2282 (defun gnus-summary-article-children (&optional number)
2283 "Return a list of article numbers that are children of article NUMBER."
2284 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2285 (level (gnus-data-level (car data)))
2287 (while (and (setq data (cdr data))
2288 (> (setq l (gnus-data-level (car data))) level))
2289 (and (= (1+ level) l)
2290 (push (gnus-data-number (car data))
2292 (nreverse children)))
2294 (defun gnus-summary-article-parent (&optional number)
2295 "Return the article number of the parent of article NUMBER."
2296 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2297 (gnus-data-list t)))
2298 (level (gnus-data-level (car data))))
2300 () ; This is a root.
2301 ;; We search until we find an article with a level less than
2302 ;; this one. That function has to be the parent.
2303 (while (and (setq data (cdr data))
2304 (not (< (gnus-data-level (car data)) level))))
2305 (and data (gnus-data-number (car data))))))
2307 (defun gnus-unread-mark-p (mark)
2308 "Say whether MARK is the unread mark."
2309 (= mark gnus-unread-mark))
2311 (defun gnus-read-mark-p (mark)
2312 "Say whether MARK is one of the marks that mark as read.
2313 This is all marks except unread, ticked, dormant, and expirable."
2314 (not (or (= mark gnus-unread-mark)
2315 (= mark gnus-ticked-mark)
2316 (= mark gnus-dormant-mark)
2317 (= mark gnus-expirable-mark))))
2319 (defmacro gnus-article-mark (number)
2320 "Return the MARK of article NUMBER.
2321 This macro should only be used when computing the mark the \"first\"
2322 time; i.e., when generating the summary lines. After that,
2323 `gnus-summary-article-mark' should be used to examine the
2326 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2327 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2328 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2329 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2330 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2331 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2332 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2333 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2334 gnus-ancient-mark))))
2336 ;; Saving hidden threads.
2338 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2339 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2341 (defmacro gnus-save-hidden-threads (&rest forms)
2342 "Save hidden threads, eval FORMS, and restore the hidden threads."
2343 (let ((config (make-symbol "config")))
2344 `(let ((,config (gnus-hidden-threads-configuration)))
2348 (gnus-restore-hidden-threads-configuration ,config)))))
2350 (defun gnus-data-compute-positions ()
2351 "Compute the positions of all articles."
2352 (setq gnus-newsgroup-data-reverse nil)
2353 (let ((data gnus-newsgroup-data))
2355 (gnus-save-hidden-threads
2356 (gnus-summary-show-all-threads)
2357 (goto-char (point-min))
2359 (while (get-text-property (point) 'gnus-intangible)
2361 (gnus-data-set-pos (car data) (+ (point) 3))
2362 (setq data (cdr data))
2363 (forward-line 1))))))
2365 (defun gnus-hidden-threads-configuration ()
2366 "Return the current hidden threads configuration."
2369 (goto-char (point-min))
2370 (while (search-forward "\r" nil t)
2371 (push (1- (point)) config))
2374 (defun gnus-restore-hidden-threads-configuration (config)
2375 "Restore hidden threads configuration from CONFIG."
2376 (let (point buffer-read-only)
2377 (while (setq point (pop config))
2378 (when (and (< point (point-max))
2380 (eq (char-after) ?\n))
2381 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2383 ;; Various summary mode internalish functions.
2385 (defun gnus-mouse-pick-article (e)
2388 (gnus-summary-next-page nil t))
2390 (defun gnus-summary-set-display-table ()
2391 ;; Change the display table. Odd characters have a tendency to mess
2392 ;; up nicely formatted displays - we make all possible glyphs
2393 ;; display only a single character.
2395 ;; We start from the standard display table, if any.
2396 (let ((table (or (copy-sequence standard-display-table)
2397 (make-display-table)))
2399 ;; Nix out all the control chars...
2400 (while (>= (setq i (1- i)) 0)
2401 (aset table i [??]))
2402 ;; ... but not newline and cr, of course. (cr is necessary for the
2403 ;; selective display).
2404 (aset table ?\n nil)
2405 (aset table ?\r nil)
2406 ;; We keep TAB as well.
2407 (aset table ?\t nil)
2408 ;; We nix out any glyphs over 126 that are not set already.
2410 (while (>= (setq i (1- i)) 127)
2411 ;; Only modify if the entry is nil.
2412 (unless (aref table i)
2413 (aset table i [??]))))
2414 (setq buffer-display-table table)))
2416 (defun gnus-summary-setup-buffer (group)
2417 "Initialize summary buffer."
2418 (let ((buffer (concat "*Summary " group "*")))
2419 (if (get-buffer buffer)
2422 (setq gnus-summary-buffer (current-buffer))
2423 (not gnus-newsgroup-prepared))
2424 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2425 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2426 (gnus-summary-mode group)
2428 (gnus-carpal-setup-buffer 'summary))
2429 (unless gnus-single-article-buffer
2430 (make-local-variable 'gnus-article-buffer)
2431 (make-local-variable 'gnus-article-current)
2432 (make-local-variable 'gnus-original-article-buffer))
2433 (setq gnus-newsgroup-name group)
2436 (defun gnus-set-global-variables ()
2437 ;; Set the global equivalents of the summary buffer-local variables
2438 ;; to the latest values they had. These reflect the summary buffer
2439 ;; that was in action when the last article was fetched.
2440 (when (eq major-mode 'gnus-summary-mode)
2441 (setq gnus-summary-buffer (current-buffer))
2442 (let ((name gnus-newsgroup-name)
2443 (marked gnus-newsgroup-marked)
2444 (unread gnus-newsgroup-unreads)
2445 (headers gnus-current-headers)
2446 (data gnus-newsgroup-data)
2447 (summary gnus-summary-buffer)
2448 (article-buffer gnus-article-buffer)
2449 (original gnus-original-article-buffer)
2450 (gac gnus-article-current)
2451 (reffed gnus-reffed-article-number)
2452 (score-file gnus-current-score-file)
2453 (default-charset gnus-newsgroup-charset))
2455 (set-buffer gnus-group-buffer)
2456 (setq gnus-newsgroup-name name
2457 gnus-newsgroup-marked marked
2458 gnus-newsgroup-unreads unread
2459 gnus-current-headers headers
2460 gnus-newsgroup-data data
2461 gnus-article-current gac
2462 gnus-summary-buffer summary
2463 gnus-article-buffer article-buffer
2464 gnus-original-article-buffer original
2465 gnus-reffed-article-number reffed
2466 gnus-current-score-file score-file
2467 gnus-newsgroup-charset default-charset)
2468 ;; The article buffer also has local variables.
2469 (when (gnus-buffer-live-p gnus-article-buffer)
2470 (set-buffer gnus-article-buffer)
2471 (setq gnus-summary-buffer summary))))))
2473 (defun gnus-summary-article-unread-p (article)
2474 "Say whether ARTICLE is unread or not."
2475 (memq article gnus-newsgroup-unreads))
2477 (defun gnus-summary-first-article-p (&optional article)
2478 "Return whether ARTICLE is the first article in the buffer."
2479 (if (not (setq article (or article (gnus-summary-article-number))))
2481 (eq article (caar gnus-newsgroup-data))))
2483 (defun gnus-summary-last-article-p (&optional article)
2484 "Return whether ARTICLE is the last article in the buffer."
2485 (if (not (setq article (or article (gnus-summary-article-number))))
2486 ;; All non-existent numbers are the last article. :-)
2488 (not (cdr (gnus-data-find-list article)))))
2490 (defun gnus-make-thread-indent-array ()
2492 (unless (and gnus-thread-indent-array
2493 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2494 (setq gnus-thread-indent-array (make-vector 201 "")
2495 gnus-thread-indent-array-level gnus-thread-indent-level)
2497 (aset gnus-thread-indent-array n
2498 (make-string (* n gnus-thread-indent-level) ? ))
2501 (defun gnus-update-summary-mark-positions ()
2502 "Compute where the summary marks are to go."
2504 (when (gnus-buffer-exists-p gnus-summary-buffer)
2505 (set-buffer gnus-summary-buffer))
2506 (let ((gnus-replied-mark 129)
2507 (gnus-score-below-mark 130)
2508 (gnus-score-over-mark 130)
2509 (gnus-download-mark 131)
2510 (spec gnus-summary-line-format-spec)
2513 (gnus-set-work-buffer)
2514 (let ((gnus-summary-line-format-spec spec)
2515 (gnus-newsgroup-downloadable '((0 . t))))
2516 (gnus-summary-insert-line
2517 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2518 (goto-char (point-min))
2519 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2521 (goto-char (point-min))
2522 (push (cons 'replied (and (search-forward "\201" nil t)
2525 (goto-char (point-min))
2526 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2528 (goto-char (point-min))
2529 (push (cons 'download
2530 (and (search-forward "\203" nil t) (- (point) 2)))
2532 (setq gnus-summary-mark-positions pos))))
2534 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2535 "Insert a dummy root in the summary buffer."
2537 (gnus-add-text-properties
2538 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2539 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2541 (defun gnus-summary-from-or-to-or-newsgroups (header)
2542 (let ((to (cdr (assq 'To (mail-header-extra header))))
2543 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2544 (mail-parse-charset gnus-newsgroup-charset)
2545 (mail-parse-ignored-charsets
2546 (save-excursion (set-buffer gnus-summary-buffer)
2547 gnus-newsgroup-ignored-charsets)))
2550 gnus-ignored-from-addresses
2551 (string-match gnus-ignored-from-addresses
2552 (mail-header-from header)))
2554 (or (car (funcall gnus-extract-address-components
2556 gnus-decode-encoded-word-function to)))
2557 (funcall gnus-decode-encoded-word-function to))))
2559 gnus-ignored-from-addresses
2560 (string-match gnus-ignored-from-addresses
2561 (mail-header-from header)))
2562 (concat "=> " newsgroups))
2564 (or (car (funcall gnus-extract-address-components
2565 (mail-header-from header)))
2566 (mail-header-from header))))))
2568 (defun gnus-summary-insert-line (gnus-tmp-header
2569 gnus-tmp-level gnus-tmp-current
2570 gnus-tmp-unread gnus-tmp-replied
2571 gnus-tmp-expirable gnus-tmp-subject-or-nil
2572 &optional gnus-tmp-dummy gnus-tmp-score
2574 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2575 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2576 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2577 (gnus-tmp-score-char
2578 (if (or (null gnus-summary-default-score)
2579 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2580 gnus-summary-zcore-fuzz))
2582 (if (< gnus-tmp-score gnus-summary-default-score)
2583 gnus-score-below-mark gnus-score-over-mark)))
2585 (cond (gnus-tmp-process gnus-process-mark)
2586 ((memq gnus-tmp-current gnus-newsgroup-cached)
2588 (gnus-tmp-replied gnus-replied-mark)
2589 ((memq gnus-tmp-current gnus-newsgroup-saved)
2591 (t gnus-unread-mark)))
2592 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2595 ((string-match "<[^>]+> *$" gnus-tmp-from)
2596 (let ((beg (match-beginning 0)))
2597 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2598 (substring gnus-tmp-from (1+ (match-beginning 0))
2599 (1- (match-end 0))))
2600 (substring gnus-tmp-from 0 beg))))
2601 ((string-match "(.+)" gnus-tmp-from)
2602 (substring gnus-tmp-from
2603 (1+ (match-beginning 0)) (1- (match-end 0))))
2605 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2606 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2607 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2608 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2609 (buffer-read-only nil))
2610 (when (string= gnus-tmp-name "")
2611 (setq gnus-tmp-name gnus-tmp-from))
2612 (unless (numberp gnus-tmp-lines)
2613 (setq gnus-tmp-lines 0))
2614 (gnus-put-text-property
2616 (progn (eval gnus-summary-line-format-spec) (point))
2617 'gnus-number gnus-tmp-number)
2618 (when (gnus-visual-p 'summary-highlight 'highlight)
2620 (gnus-run-hooks 'gnus-summary-update-hook)
2623 (defun gnus-summary-update-line (&optional dont-update)
2624 ;; Update summary line after change.
2625 (when (and gnus-summary-default-score
2626 (not gnus-summary-inhibit-highlight))
2627 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2628 (article (gnus-summary-article-number))
2629 (score (gnus-summary-article-score article)))
2631 (if (and gnus-summary-mark-below
2632 (< (gnus-summary-article-score)
2633 gnus-summary-mark-below))
2634 ;; This article has a low score, so we mark it as read.
2635 (when (memq article gnus-newsgroup-unreads)
2636 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2637 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2638 ;; This article was previously marked as read on account
2639 ;; of a low score, but now it has risen, so we mark it as
2641 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2642 (gnus-summary-update-mark
2643 (if (or (null gnus-summary-default-score)
2644 (<= (abs (- score gnus-summary-default-score))
2645 gnus-summary-zcore-fuzz))
2647 (if (< score gnus-summary-default-score)
2648 gnus-score-below-mark gnus-score-over-mark))
2650 ;; Do visual highlighting.
2651 (when (gnus-visual-p 'summary-highlight 'highlight)
2652 (gnus-run-hooks 'gnus-summary-update-hook)))))
2654 (defvar gnus-tmp-new-adopts nil)
2656 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2657 "Return the number of articles in THREAD.
2658 This may be 0 in some cases -- if none of the articles in
2659 the thread are to be displayed."
2661 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2663 ((not (listp thread))
2665 ((and (consp thread) (cdr thread))
2668 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2671 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2674 (when (and level (zerop level) gnus-tmp-new-adopts)
2677 'gnus-summary-number-of-articles-in-thread
2678 gnus-tmp-new-adopts))))
2680 (if (> number 1) gnus-not-empty-thread-mark
2681 gnus-empty-thread-mark)
2684 (defun gnus-summary-set-local-parameters (group)
2685 "Go through the local params of GROUP and set all variable specs in that list."
2686 (let ((params (gnus-group-find-parameter group))
2689 (setq elem (car params)
2690 params (cdr params))
2691 (and (consp elem) ; Has to be a cons.
2692 (consp (cdr elem)) ; The cdr has to be a list.
2693 (symbolp (car elem)) ; Has to be a symbol in there.
2694 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2695 (ignore-errors ; So we set it.
2696 (make-local-variable (car elem))
2697 (set (car elem) (eval (nth 1 elem))))))))
2699 (defun gnus-summary-read-group (group &optional show-all no-article
2700 kill-buffer no-display backward
2702 "Start reading news in newsgroup GROUP.
2703 If SHOW-ALL is non-nil, already read articles are also listed.
2704 If NO-ARTICLE is non-nil, no article is selected initially.
2705 If NO-DISPLAY, don't generate a summary buffer."
2709 (let ((gnus-auto-select-next nil))
2710 (or (gnus-summary-read-group-1
2711 group show-all no-article
2712 kill-buffer no-display
2715 select-articles nil)))))
2716 (eq gnus-auto-select-next 'quietly))
2717 (set-buffer gnus-group-buffer)
2718 ;; The entry function called above goes to the next
2719 ;; group automatically, so we go two groups back
2720 ;; if we are searching for the previous group.
2722 (gnus-group-prev-unread-group 2))
2723 (if (not (equal group (gnus-group-group-name)))
2724 (setq group (gnus-group-group-name))
2728 (defun gnus-summary-read-group-1 (group show-all no-article
2729 kill-buffer no-display
2730 &optional select-articles)
2731 ;; Killed foreign groups can't be entered.
2732 (when (and (not (gnus-group-native-p group))
2733 (not (gnus-gethash group gnus-newsrc-hashtb)))
2734 (error "Dead non-native groups can't be entered"))
2735 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2736 (let* ((new-group (gnus-summary-setup-buffer group))
2737 (quit-config (gnus-group-quit-config group))
2738 (did-select (and new-group (gnus-select-newsgroup
2739 group show-all select-articles))))
2741 ;; This summary buffer exists already, so we just select it.
2743 (gnus-set-global-variables)
2745 (gnus-kill-or-deaden-summary kill-buffer))
2746 (gnus-configure-windows 'summary 'force)
2747 (gnus-set-mode-line 'summary)
2748 (gnus-summary-position-point)
2751 ;; We couldn't select this group.
2753 (when (and (eq major-mode 'gnus-summary-mode)
2754 (not (equal (current-buffer) kill-buffer)))
2755 (kill-buffer (current-buffer))
2756 (if (not quit-config)
2758 ;; Update the info -- marks might need to be removed,
2760 (gnus-summary-update-info)
2761 (set-buffer gnus-group-buffer)
2762 (gnus-group-jump-to-group group)
2763 (gnus-group-next-unread-group 1))
2764 (gnus-handle-ephemeral-exit quit-config)))
2765 (gnus-message 3 "Can't select group")
2767 ;; The user did a `C-g' while prompting for number of articles,
2768 ;; so we exit this group.
2769 ((eq did-select 'quit)
2770 (and (eq major-mode 'gnus-summary-mode)
2771 (not (equal (current-buffer) kill-buffer))
2772 (kill-buffer (current-buffer)))
2774 (gnus-kill-or-deaden-summary kill-buffer))
2775 (if (not quit-config)
2777 (set-buffer gnus-group-buffer)
2778 (gnus-group-jump-to-group group)
2779 (gnus-group-next-unread-group 1)
2780 (gnus-configure-windows 'group 'force))
2781 (gnus-handle-ephemeral-exit quit-config))
2782 ;; Finally signal the quit.
2784 ;; The group was successfully selected.
2786 (gnus-set-global-variables)
2787 ;; Save the active value in effect when the group was entered.
2788 (setq gnus-newsgroup-active
2790 (gnus-active gnus-newsgroup-name)))
2791 ;; You can change the summary buffer in some way with this hook.
2792 (gnus-run-hooks 'gnus-select-group-hook)
2793 ;; Set any local variables in the group parameters.
2794 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2795 (gnus-update-format-specifications
2796 nil 'summary 'summary-mode 'summary-dummy)
2797 ;; Do score processing.
2798 (when gnus-use-scoring
2799 (gnus-possibly-score-headers))
2800 ;; Check whether to fill in the gaps in the threads.
2801 (when gnus-build-sparse-threads
2802 (gnus-build-sparse-threads))
2803 ;; Find the initial limit.
2804 (if gnus-show-threads
2806 (let ((gnus-newsgroup-dormant nil))
2807 (gnus-summary-initial-limit show-all))
2808 (gnus-summary-initial-limit show-all))
2809 (setq gnus-newsgroup-limit
2811 (lambda (header) (mail-header-number header))
2812 gnus-newsgroup-headers)))
2813 ;; Generate the summary buffer.
2815 (gnus-summary-prepare))
2816 (when gnus-use-trees
2817 (gnus-tree-open group)
2818 (setq gnus-summary-highlight-line-function
2819 'gnus-tree-highlight-article))
2820 ;; If the summary buffer is empty, but there are some low-scored
2821 ;; articles or some excluded dormants, we include these in the
2823 (when (and (zerop (buffer-size))
2825 (cond (gnus-newsgroup-dormant
2826 (gnus-summary-limit-include-dormant))
2827 ((and gnus-newsgroup-scored show-all)
2828 (gnus-summary-limit-include-expunged t))))
2829 ;; Function `gnus-apply-kill-file' must be called in this hook.
2830 (gnus-run-hooks 'gnus-apply-kill-hook)
2831 (if (and (zerop (buffer-size))
2834 ;; This newsgroup is empty.
2835 (gnus-summary-catchup-and-exit nil t)
2836 (gnus-message 6 "No unread news")
2838 (gnus-kill-or-deaden-summary kill-buffer))
2839 ;; Return nil from this function.
2841 ;; Hide conversation thread subtrees. We cannot do this in
2842 ;; gnus-summary-prepare-hook since kill processing may not
2843 ;; work with hidden articles.
2844 (and gnus-show-threads
2845 gnus-thread-hide-subtree
2846 (gnus-summary-hide-all-threads))
2848 (gnus-kill-or-deaden-summary kill-buffer))
2849 ;; Show first unread article if requested.
2850 (if (and (not no-article)
2852 gnus-newsgroup-unreads
2853 gnus-auto-select-first)
2855 (gnus-configure-windows 'summary)
2857 ((eq gnus-auto-select-first 'best)
2858 (gnus-summary-best-unread-article))
2859 ((eq gnus-auto-select-first t)
2860 (gnus-summary-first-unread-article))
2861 ((gnus-functionp gnus-auto-select-first)
2862 (funcall gnus-auto-select-first))))
2863 ;; Don't select any articles, just move point to the first
2864 ;; article in the group.
2865 (goto-char (point-min))
2866 (gnus-summary-position-point)
2867 (gnus-configure-windows 'summary 'force)
2868 (gnus-set-mode-line 'summary))
2869 (when (get-buffer-window gnus-group-buffer t)
2870 ;; Gotta use windows, because recenter does weird stuff if
2871 ;; the current buffer ain't the displayed window.
2872 (let ((owin (selected-window)))
2873 (select-window (get-buffer-window gnus-group-buffer t))
2874 (when (gnus-group-goto-group group)
2876 (select-window owin)))
2877 ;; Mark this buffer as "prepared".
2878 (setq gnus-newsgroup-prepared t)
2879 (gnus-run-hooks 'gnus-summary-prepared-hook)
2882 (defun gnus-summary-prepare ()
2883 "Generate the summary buffer."
2885 (let ((buffer-read-only nil))
2887 (setq gnus-newsgroup-data nil
2888 gnus-newsgroup-data-reverse nil)
2889 (gnus-run-hooks 'gnus-summary-generate-hook)
2890 ;; Generate the buffer, either with threads or without.
2891 (when gnus-newsgroup-headers
2892 (gnus-summary-prepare-threads
2893 (if gnus-show-threads
2894 (gnus-sort-gathered-threads
2895 (funcall gnus-summary-thread-gathering-function
2897 (gnus-cut-threads (gnus-make-threads)))))
2898 ;; Unthreaded display.
2899 (gnus-sort-articles gnus-newsgroup-headers))))
2900 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2901 ;; Call hooks for modifying summary buffer.
2902 (goto-char (point-min))
2903 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2905 (defsubst gnus-general-simplify-subject (subject)
2906 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2909 ;; Truncate the subject.
2910 (gnus-simplify-subject-functions
2911 (gnus-map-function gnus-simplify-subject-functions subject))
2912 ((numberp gnus-summary-gather-subject-limit)
2913 (setq subject (gnus-simplify-subject-re subject))
2914 (if (> (length subject) gnus-summary-gather-subject-limit)
2915 (substring subject 0 gnus-summary-gather-subject-limit)
2917 ;; Fuzzily simplify it.
2918 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2919 (gnus-simplify-subject-fuzzy subject))
2920 ;; Just remove the leading "Re:".
2922 (gnus-simplify-subject-re subject))))
2924 (if (and gnus-summary-gather-exclude-subject
2925 (string-match gnus-summary-gather-exclude-subject subject))
2926 nil ; This article shouldn't be gathered
2929 (defun gnus-summary-simplify-subject-query ()
2930 "Query where the respool algorithm would put this article."
2932 (gnus-summary-select-article)
2933 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2935 (defun gnus-gather-threads-by-subject (threads)
2936 "Gather threads by looking at Subject headers."
2937 (if (not gnus-summary-make-false-root)
2939 (let ((hashtb (gnus-make-hashtable 1024))
2942 subject hthread whole-subject)
2944 (setq subject (gnus-general-simplify-subject
2945 (setq whole-subject (mail-header-subject
2948 (if (setq hthread (gnus-gethash subject hashtb))
2950 ;; We enter a dummy root into the thread, if we
2951 ;; haven't done that already.
2952 (unless (stringp (caar hthread))
2953 (setcar hthread (list whole-subject (car hthread))))
2954 ;; We add this new gathered thread to this gathered
2956 (setcdr (car hthread)
2957 (nconc (cdar hthread) (list (car threads))))
2958 ;; Remove it from the list of threads.
2959 (setcdr prev (cdr threads))
2960 (setq threads prev))
2961 ;; Enter this thread into the hash table.
2962 (gnus-sethash subject threads hashtb)))
2964 (setq threads (cdr threads)))
2967 (defun gnus-gather-threads-by-references (threads)
2968 "Gather threads by looking at References headers."
2969 (let ((idhashtb (gnus-make-hashtable 1024))
2970 (thhashtb (gnus-make-hashtable 1024))
2973 ids references id gthread gid entered ref)
2975 (when (setq references (mail-header-references (caar threads)))
2976 (setq id (mail-header-id (caar threads))
2977 ids (gnus-split-references references)
2979 (while (setq ref (pop ids))
2980 (setq ids (delete ref ids))
2981 (if (not (setq gid (gnus-gethash ref idhashtb)))
2983 (gnus-sethash ref id idhashtb)
2984 (gnus-sethash id threads thhashtb))
2985 (setq gthread (gnus-gethash gid thhashtb))
2987 ;; We enter a dummy root into the thread, if we
2988 ;; haven't done that already.
2989 (unless (stringp (caar gthread))
2990 (setcar gthread (list (mail-header-subject (caar gthread))
2992 ;; We add this new gathered thread to this gathered
2994 (setcdr (car gthread)
2995 (nconc (cdar gthread) (list (car threads)))))
2996 ;; Add it into the thread hash table.
2997 (gnus-sethash id gthread thhashtb)
2999 ;; Remove it from the list of threads.
3000 (setcdr prev (cdr threads))
3001 (setq threads prev))))
3003 (setq threads (cdr threads)))
3006 (defun gnus-sort-gathered-threads (threads)
3007 "Sort subtreads inside each gathered thread by article number."
3008 (let ((result threads))
3010 (when (stringp (caar threads))
3011 (setcdr (car threads)
3012 (sort (cdar threads) 'gnus-thread-sort-by-number)))
3013 (setq threads (cdr threads)))
3016 (defun gnus-thread-loop-p (root thread)
3017 "Say whether ROOT is in THREAD."
3018 (let ((stack (list thread))
3021 (while (setq thread (pop stack))
3022 (setq th (cdr thread))
3024 (not (eq (caar th) root)))
3027 ;; We have found a loop.
3029 (setcdr thread (delq (car th) (cdr thread)))
3030 (if (boundp (setq ref-dep (intern "none"
3031 gnus-newsgroup-dependencies)))
3032 (setcdr (symbol-value ref-dep)
3033 (nconc (cdr (symbol-value ref-dep))
3035 (set ref-dep (list nil (car th))))
3038 ;; Push all the subthreads onto the stack.
3039 (push (cdr thread) stack)))
3042 (defun gnus-make-threads ()
3043 "Go through the dependency hashtb and find the roots. Return all threads."
3045 (while (catch 'infloop
3048 ;; Deal with self-referencing References loops.
3049 (when (and (car (symbol-value refs))
3056 (car (symbol-value refs)) thread))
3057 (cdr (symbol-value refs)))))))
3060 (unless (car (symbol-value refs))
3061 ;; These threads do not refer back to any other articles,
3062 ;; so they're roots.
3063 (setq threads (append (cdr (symbol-value refs)) threads))))
3064 gnus-newsgroup-dependencies)))
3067 ;; Build the thread tree.
3068 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3069 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3071 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3072 if it was already present.
3074 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3075 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3076 Message-IDs will be renamed be renamed to a unique Message-ID before
3079 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3080 (let* ((id (mail-header-id header))
3081 (id-dep (and id (intern id dependencies)))
3082 ref ref-dep ref-header)
3083 ;; Enter this `header' in the `dependencies' table.
3087 ;; The first two cases do the normal part: enter a new `header'
3088 ;; in the `dependencies' table.
3089 ((not (boundp id-dep))
3090 (set id-dep (list header)))
3091 ((null (car (symbol-value id-dep)))
3092 (setcar (symbol-value id-dep) header))
3094 ;; From here the `header' was already present in the
3095 ;; `dependencies' table.
3097 ;; Overrides an existing entry;
3098 ;; just set the header part of the entry.
3099 (setcar (symbol-value id-dep) header))
3101 ;; Renames the existing `header' to a unique Message-ID.
3102 ((not gnus-summary-ignore-duplicates)
3103 ;; An article with this Message-ID has already been seen.
3104 ;; We rename the Message-ID.
3105 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3107 (mail-header-set-id header id))
3109 ;; The last case ignores an existing entry, except it adds any
3110 ;; additional Xrefs (in case the two articles came from different
3112 ;; Also sets `header' to `nil' meaning that the `dependencies'
3113 ;; table was *not* modified.
3115 (mail-header-set-xref
3116 (car (symbol-value id-dep))
3117 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3119 (or (mail-header-xref header) "")))
3123 ;; First check if that we are not creating a References loop.
3124 (setq ref (gnus-parent-id (mail-header-references header)))
3126 (setq ref-dep (intern-soft ref dependencies))
3128 (setq ref-header (car (symbol-value ref-dep))))
3129 (if (string= id ref)
3130 ;; Yuk! This is a reference loop. Make the article be a
3133 (mail-header-set-references (car (symbol-value id-dep)) "none")
3135 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3136 (setq ref (gnus-parent-id (mail-header-references header)))
3137 (setq ref-dep (intern (or ref "none") dependencies))
3138 (if (boundp ref-dep)
3139 (setcdr (symbol-value ref-dep)
3140 (nconc (cdr (symbol-value ref-dep))
3141 (list (symbol-value id-dep))))
3142 (set ref-dep (list nil (symbol-value id-dep)))))
3145 (defun gnus-build-sparse-threads ()
3146 (let ((headers gnus-newsgroup-headers)
3147 (gnus-summary-ignore-duplicates t)
3148 header references generation relations
3149 subject child end new-child date)
3150 ;; First we create an alist of generations/relations, where
3151 ;; generations is how much we trust the relation, and the relation
3153 (gnus-message 7 "Making sparse threads...")
3155 (nnheader-set-temp-buffer " *gnus sparse threads*")
3156 (while (setq header (pop headers))
3157 (when (and (setq references (mail-header-references header))
3158 (not (string= references "")))
3160 (setq child (mail-header-id header)
3161 subject (mail-header-subject header)
3162 date (mail-header-date header)
3164 (while (search-backward ">" nil t)
3165 (setq end (1+ (point)))
3166 (when (search-backward "<" nil t)
3167 (setq new-child (buffer-substring (point) end))
3168 (push (list (incf generation)
3169 child (setq child new-child)
3173 (push (list (1+ generation) child nil subject) relations))
3175 (kill-buffer (current-buffer)))
3176 ;; Sort over trustworthiness.
3179 (when (gnus-dependencies-add-header
3180 (make-full-mail-header
3181 gnus-reffed-article-number
3182 (nth 3 relation) "" (or (nth 4 relation) "")
3184 (or (nth 2 relation) "") 0 0 "")
3185 gnus-newsgroup-dependencies nil)
3186 (push gnus-reffed-article-number gnus-newsgroup-limit)
3187 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3188 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3189 gnus-newsgroup-reads)
3190 (decf gnus-reffed-article-number)))
3191 (sort relations 'car-less-than-car))
3192 (gnus-message 7 "Making sparse threads...done")))
3194 (defun gnus-build-old-threads ()
3195 ;; Look at all the articles that refer back to old articles, and
3196 ;; fetch the headers for the articles that aren't there. This will
3197 ;; build complete threads - if the roots haven't been expired by the
3202 (when (not (car (symbol-value refs)))
3203 (setq heads (cdr (symbol-value refs)))
3205 (if (memq (mail-header-number (caar heads))
3206 gnus-newsgroup-dormant)
3207 (setq heads (cdr heads))
3208 (setq id (symbol-name refs))
3209 (while (and (setq id (gnus-build-get-header id))
3210 (not (car (gnus-id-to-thread id)))))
3211 (setq heads nil)))))
3212 gnus-newsgroup-dependencies)))
3214 ;; This function has to be called with point after the article number
3215 ;; on the beginning of the line.
3216 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3217 (let ((eol (gnus-point-at-eol))
3218 (buffer (current-buffer))
3221 ;; overview: [num subject from date id refs chars lines misc]
3224 (narrow-to-region (point) eol)
3229 (make-full-mail-header
3231 (funcall gnus-decode-encoded-word-function
3232 (nnheader-nov-field)) ; subject
3233 (funcall gnus-decode-encoded-word-function
3234 (nnheader-nov-field)) ; from
3235 (nnheader-nov-field) ; date
3236 (nnheader-nov-read-message-id) ; id
3237 (nnheader-nov-field) ; refs
3238 (nnheader-nov-read-integer) ; chars
3239 (nnheader-nov-read-integer) ; lines
3241 (nnheader-nov-field)) ; misc
3242 (nnheader-nov-parse-extra)))) ; extra
3246 (when gnus-alter-header-function
3247 (funcall gnus-alter-header-function header))
3248 (gnus-dependencies-add-header header dependencies force-new)))
3250 (defun gnus-build-get-header (id)
3251 ;; Look through the buffer of NOV lines and find the header to
3252 ;; ID. Enter this line into the dependencies hash table, and return
3253 ;; the id of the parent article (if any).
3254 (let ((deps gnus-newsgroup-dependencies)
3258 (set-buffer nntp-server-buffer)
3259 (let ((case-fold-search nil))
3260 (goto-char (point-min))
3261 (while (and (not found)
3262 (search-forward id nil t))
3264 (setq found (looking-at
3265 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3266 (regexp-quote id))))
3267 (or found (beginning-of-line 2)))
3271 (setq header (gnus-nov-parse-line
3272 (read (current-buffer)) deps))
3273 (gnus-parent-id (mail-header-references header))))))
3275 (let ((number (mail-header-number header)))
3276 (push number gnus-newsgroup-limit)
3277 (push header gnus-newsgroup-headers)
3278 (if (memq number gnus-newsgroup-unselected)
3280 (push number gnus-newsgroup-unreads)
3281 (setq gnus-newsgroup-unselected
3282 (delq number gnus-newsgroup-unselected)))
3283 (push number gnus-newsgroup-ancient)))))))
3285 (defun gnus-build-all-threads ()
3286 "Read all the headers."
3287 (let ((gnus-summary-ignore-duplicates t)
3288 (dependencies gnus-newsgroup-dependencies)
3291 (set-buffer nntp-server-buffer)
3292 (let ((case-fold-search nil))
3293 (goto-char (point-min))
3296 (setq article (read (current-buffer))
3297 header (gnus-nov-parse-line
3298 article dependencies)))
3301 (set-buffer gnus-summary-buffer)
3302 (push header gnus-newsgroup-headers)
3303 (if (memq (setq article (mail-header-number header))
3304 gnus-newsgroup-unselected)
3306 (push article gnus-newsgroup-unreads)
3307 (setq gnus-newsgroup-unselected
3308 (delq article gnus-newsgroup-unselected)))
3309 (push article gnus-newsgroup-ancient)))
3310 (forward-line 1)))))))
3312 (defun gnus-summary-update-article-line (article header)
3313 "Update the line for ARTICLE using HEADERS."
3314 (let* ((id (mail-header-id header))
3315 (thread (gnus-id-to-thread id)))
3317 (error "Article in no thread"))
3318 ;; Update the thread.
3319 (setcar thread header)
3320 (gnus-summary-goto-subject article)
3321 (let* ((datal (gnus-data-find-list article))
3323 (length (when (cdr datal)
3324 (- (gnus-data-pos data)
3325 (gnus-data-pos (cadr datal)))))
3326 (buffer-read-only nil)
3327 (level (gnus-summary-thread-level)))
3329 (gnus-summary-insert-line
3330 header level nil (gnus-article-mark article)
3331 (memq article gnus-newsgroup-replied)
3332 (memq article gnus-newsgroup-expirable)
3333 ;; Only insert the Subject string when it's different
3334 ;; from the previous Subject string.
3335 (if (gnus-subject-equal
3337 (mail-header-subject
3340 (gnus-data-find-list
3342 (gnus-data-list t)))))
3343 ;; Error on the side of excessive subjects.
3345 (mail-header-subject header))
3347 (mail-header-subject header))
3348 nil (cdr (assq article gnus-newsgroup-scored))
3349 (memq article gnus-newsgroup-processable))
3351 (gnus-data-update-list
3352 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3354 (defun gnus-summary-update-article (article &optional iheader)
3355 "Update ARTICLE in the summary buffer."
3356 (set-buffer gnus-summary-buffer)
3357 (let* ((header (gnus-summary-article-header article))
3358 (id (mail-header-id header))
3359 (data (gnus-data-find article))
3360 (thread (gnus-id-to-thread id))
3361 (references (mail-header-references header))
3365 (when (and references
3366 (not (equal "" references)))
3369 (buffer-read-only nil)
3375 (delq thread parent)))
3376 (if (gnus-summary-insert-subject id header)
3377 ;; Set the (possibly) new article number in the data structure.
3378 (gnus-data-set-number data (gnus-id-to-article id))
3382 (defun gnus-rebuild-thread (id &optional line)
3383 "Rebuild the thread containing ID.
3384 If LINE, insert the rebuilt thread starting on line LINE."
3385 (let ((buffer-read-only nil)
3386 old-pos current thread data)
3387 (if (not gnus-show-threads)
3388 (setq thread (list (car (gnus-id-to-thread id))))
3389 ;; Get the thread this article is part of.
3390 (setq thread (gnus-remove-thread id)))
3391 (setq old-pos (gnus-point-at-bol))
3392 (setq current (save-excursion
3393 (and (zerop (forward-line -1))
3394 (gnus-summary-article-number))))
3395 ;; If this is a gathered thread, we have to go some re-gathering.
3396 (when (stringp (car thread))
3397 (let ((subject (car thread))
3399 (setq thread (cdr thread))
3401 (unless (memq (setq thr (gnus-id-to-thread
3403 (mail-header-id (caar thread)))))
3406 (setq thread (cdr thread)))
3407 ;; We now have all (unique) roots.
3408 (if (= (length roots) 1)
3409 ;; All the loose roots are now one solid root.
3410 (setq thread (car roots))
3411 (setq thread (cons subject (gnus-sort-threads roots))))))
3413 ;; We then insert this thread into the summary buffer.
3415 (goto-char (point-min))
3416 (forward-line (1- line)))
3417 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3418 (if gnus-show-threads
3419 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3420 (gnus-summary-prepare-unthreaded thread))
3421 (setq data (nreverse gnus-newsgroup-data))
3422 (setq threads gnus-newsgroup-threads))
3423 ;; We splice the new data into the data structure.
3424 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3425 ;;!!! then we want to insert at the beginning of the buffer.
3426 ;;!!! That happens to be true with Gnus now, but that may
3427 ;;!!! change in the future. Perhaps.
3428 (gnus-data-enter-list
3429 (if line nil current) data (- (point) old-pos))
3430 (setq gnus-newsgroup-threads
3431 (nconc threads gnus-newsgroup-threads))
3432 (gnus-data-compute-positions))))
3434 (defun gnus-number-to-header (number)
3435 "Return the header for article NUMBER."
3436 (let ((headers gnus-newsgroup-headers))
3438 (not (= number (mail-header-number (car headers)))))
3443 (defun gnus-parent-headers (in-headers &optional generation)
3444 "Return the headers of the GENERATIONeth parent of HEADERS."
3446 (setq generation 1))
3448 (headers in-headers)
3451 (not (zerop generation))
3452 (setq references (mail-header-references headers)))
3453 (setq headers (if (and references
3454 (setq parent (gnus-parent-id references)))
3455 (car (gnus-id-to-thread parent))
3458 (and (not (eq headers in-headers))
3461 (defun gnus-id-to-thread (id)
3462 "Return the (sub-)thread where ID appears."
3463 (gnus-gethash id gnus-newsgroup-dependencies))
3465 (defun gnus-id-to-article (id)
3466 "Return the article number of ID."
3467 (let ((thread (gnus-id-to-thread id)))
3470 (mail-header-number (car thread)))))
3472 (defun gnus-id-to-header (id)
3473 "Return the article headers of ID."
3474 (car (gnus-id-to-thread id)))
3476 (defun gnus-article-displayed-root-p (article)
3477 "Say whether ARTICLE is a root(ish) article."
3478 (let ((level (gnus-summary-thread-level article))
3479 (refs (mail-header-references (gnus-summary-article-header article)))
3485 ((null (gnus-parent-id refs)) t)
3487 (null (setq particle (gnus-id-to-article
3488 (gnus-parent-id refs))))
3489 (null (gnus-summary-thread-level particle)))))))
3491 (defun gnus-root-id (id)
3492 "Return the id of the root of the thread where ID appears."
3494 (while (and id (setq prev (car (gnus-id-to-thread id))))
3496 id (gnus-parent-id (mail-header-references prev))))
3499 (defun gnus-articles-in-thread (thread)
3500 "Return the list of articles in THREAD."
3501 (cons (mail-header-number (car thread))
3502 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3504 (defun gnus-remove-thread (id &optional dont-remove)
3505 "Remove the thread that has ID in it."
3506 (let (headers thread last-id)
3507 ;; First go up in this thread until we find the root.
3508 (setq last-id (gnus-root-id id)
3509 headers (message-flatten-list (gnus-id-to-thread last-id)))
3510 ;; We have now found the real root of this thread. It might have
3511 ;; been gathered into some loose thread, so we have to search
3512 ;; through the threads to find the thread we wanted.
3513 (let ((threads gnus-newsgroup-threads)
3516 (setq sub (car threads))
3517 (if (stringp (car sub))
3518 ;; This is a gathered thread, so we look at the roots
3519 ;; below it to find whether this article is in this
3522 (setq sub (cdr sub))
3524 (when (member (caar sub) headers)
3525 (setq thread (car threads)
3528 (setq sub (cdr sub))))
3529 ;; It's an ordinary thread, so we check it.
3530 (when (eq (car sub) (car headers))
3533 (setq threads (cdr threads)))
3534 ;; If this article is in no thread, then it's a root.
3537 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3538 (setq thread (gnus-id-to-thread last-id)))
3541 thread ; We return this thread.
3543 (if (stringp (car thread))
3545 ;; If we use dummy roots, then we have to remove the
3546 ;; dummy root as well.
3547 (when (eq gnus-summary-make-false-root 'dummy)
3548 ;; We go to the dummy root by going to
3549 ;; the first sub-"thread", and then one line up.
3550 (gnus-summary-goto-article
3551 (mail-header-number (caadr thread)))
3554 (gnus-data-compute-positions))
3555 (setq thread (cdr thread))
3557 (gnus-remove-thread-1 (car thread))
3558 (setq thread (cdr thread))))
3559 (gnus-summary-show-all-threads)
3560 (gnus-remove-thread-1 thread))))))))
3562 (defun gnus-remove-thread-1 (thread)
3563 "Remove the thread THREAD recursively."
3564 (let ((number (mail-header-number (pop thread)))
3566 (setq thread (reverse thread))
3568 (gnus-remove-thread-1 (pop thread)))
3569 (when (setq d (gnus-data-find number))
3570 (goto-char (gnus-data-pos d))
3573 (- (gnus-point-at-bol)
3575 (1+ (gnus-point-at-eol))
3576 (gnus-delete-line)))))))
3578 (defun gnus-sort-threads (threads)
3580 (if (not gnus-thread-sort-functions)
3582 (gnus-message 8 "Sorting threads...")
3584 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3585 (gnus-message 8 "Sorting threads...done"))))
3587 (defun gnus-sort-articles (articles)
3589 (when gnus-article-sort-functions
3590 (gnus-message 7 "Sorting articles...")
3592 (setq gnus-newsgroup-headers
3593 (sort articles (gnus-make-sort-function
3594 gnus-article-sort-functions)))
3595 (gnus-message 7 "Sorting articles...done"))))
3597 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3598 (defmacro gnus-thread-header (thread)
3599 ;; Return header of first article in THREAD.
3600 ;; Note that THREAD must never, ever be anything else than a variable -
3601 ;; using some other form will lead to serious barfage.
3602 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3603 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3604 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3607 (defsubst gnus-article-sort-by-number (h1 h2)
3608 "Sort articles by article number."
3609 (< (mail-header-number h1)
3610 (mail-header-number h2)))
3612 (defun gnus-thread-sort-by-number (h1 h2)
3613 "Sort threads by root article number."
3614 (gnus-article-sort-by-number
3615 (gnus-thread-header h1) (gnus-thread-header h2)))
3617 (defsubst gnus-article-sort-by-lines (h1 h2)
3618 "Sort articles by article Lines header."
3619 (< (mail-header-lines h1)
3620 (mail-header-lines h2)))
3622 (defun gnus-thread-sort-by-lines (h1 h2)
3623 "Sort threads by root article Lines header."
3624 (gnus-article-sort-by-lines
3625 (gnus-thread-header h1) (gnus-thread-header h2)))
3627 (defsubst gnus-article-sort-by-chars (h1 h2)
3628 "Sort articles by octet length."
3629 (< (mail-header-chars h1)
3630 (mail-header-chars h2)))
3632 (defun gnus-thread-sort-by-chars (h1 h2)
3633 "Sort threads by root article octet length."
3634 (gnus-article-sort-by-chars
3635 (gnus-thread-header h1) (gnus-thread-header h2)))
3637 (defsubst gnus-article-sort-by-author (h1 h2)
3638 "Sort articles by root author."
3640 (let ((extract (funcall
3641 gnus-extract-address-components
3642 (mail-header-from h1))))
3643 (or (car extract) (cadr extract) ""))
3644 (let ((extract (funcall
3645 gnus-extract-address-components
3646 (mail-header-from h2))))
3647 (or (car extract) (cadr extract) ""))))
3649 (defun gnus-thread-sort-by-author (h1 h2)
3650 "Sort threads by root author."
3651 (gnus-article-sort-by-author
3652 (gnus-thread-header h1) (gnus-thread-header h2)))
3654 (defsubst gnus-article-sort-by-subject (h1 h2)
3655 "Sort articles by root subject."
3657 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3658 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3660 (defun gnus-thread-sort-by-subject (h1 h2)
3661 "Sort threads by root subject."
3662 (gnus-article-sort-by-subject
3663 (gnus-thread-header h1) (gnus-thread-header h2)))
3665 (defsubst gnus-article-sort-by-date (h1 h2)
3666 "Sort articles by root article date."
3668 (gnus-date-get-time (mail-header-date h1))
3669 (gnus-date-get-time (mail-header-date h2))))
3671 (defun gnus-thread-sort-by-date (h1 h2)
3672 "Sort threads by root article date."
3673 (gnus-article-sort-by-date
3674 (gnus-thread-header h1) (gnus-thread-header h2)))
3676 (defsubst gnus-article-sort-by-score (h1 h2)
3677 "Sort articles by root article score.
3678 Unscored articles will be counted as having a score of zero."
3679 (> (or (cdr (assq (mail-header-number h1)
3680 gnus-newsgroup-scored))
3681 gnus-summary-default-score 0)
3682 (or (cdr (assq (mail-header-number h2)
3683 gnus-newsgroup-scored))
3684 gnus-summary-default-score 0)))
3686 (defun gnus-thread-sort-by-score (h1 h2)
3687 "Sort threads by root article score."
3688 (gnus-article-sort-by-score
3689 (gnus-thread-header h1) (gnus-thread-header h2)))
3691 (defun gnus-thread-sort-by-total-score (h1 h2)
3692 "Sort threads by the sum of all scores in the thread.
3693 Unscored articles will be counted as having a score of zero."
3694 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3696 (defun gnus-thread-total-score (thread)
3697 ;; This function find the total score of THREAD.
3698 (cond ((null thread)
3701 (if (stringp (car thread))
3702 (apply gnus-thread-score-function 0
3703 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3704 (gnus-thread-total-score-1 thread)))
3706 (gnus-thread-total-score-1 (list thread)))))
3708 (defun gnus-thread-total-score-1 (root)
3709 ;; This function find the total score of the thread below ROOT.
3710 (setq root (car root))
3711 (apply gnus-thread-score-function
3713 (mapcar 'gnus-thread-total-score
3714 (cdr (gnus-id-to-thread (mail-header-id root))))
3715 (when (> (mail-header-number root) 0)
3716 (list (or (cdr (assq (mail-header-number root)
3717 gnus-newsgroup-scored))
3718 gnus-summary-default-score 0))))
3719 (list gnus-summary-default-score)
3722 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3723 (defvar gnus-tmp-prev-subject nil)
3724 (defvar gnus-tmp-false-parent nil)
3725 (defvar gnus-tmp-root-expunged nil)
3726 (defvar gnus-tmp-dummy-line nil)
3728 (defvar gnus-tmp-header)
3729 (defun gnus-extra-header (type &optional header)
3730 "Return the extra header of TYPE."
3731 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3734 (defun gnus-summary-prepare-threads (threads)
3735 "Prepare summary buffer from THREADS and indentation LEVEL.
3736 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3737 or a straight list of headers."
3738 (gnus-message 7 "Generating summary...")
3740 (setq gnus-newsgroup-threads threads)
3743 (let ((gnus-tmp-level 0)
3744 (default-score (or gnus-summary-default-score 0))
3745 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3746 thread number subject stack state gnus-tmp-gathered beg-match
3747 new-roots gnus-tmp-new-adopts thread-end
3748 gnus-tmp-header gnus-tmp-unread
3749 gnus-tmp-replied gnus-tmp-subject-or-nil
3750 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3751 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3752 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3754 (setq gnus-tmp-prev-subject nil)
3756 (if (vectorp (car threads))
3757 ;; If this is a straight (sic) list of headers, then a
3758 ;; threaded summary display isn't required, so we just create
3759 ;; an unthreaded one.
3760 (gnus-summary-prepare-unthreaded threads)
3762 ;; Do the threaded display.
3764 (while (or threads stack gnus-tmp-new-adopts new-roots)
3766 (if (and (= gnus-tmp-level 0)
3769 (not gnus-tmp-false-parent)
3770 (or gnus-tmp-new-adopts new-roots))
3771 (if gnus-tmp-new-adopts
3772 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3773 thread (list (car gnus-tmp-new-adopts))
3774 gnus-tmp-header (caar thread)
3775 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3777 (setq thread (list (car new-roots))
3778 gnus-tmp-header (caar thread)
3779 new-roots (cdr new-roots))))
3782 ;; If there are some threads, we do them before the
3783 ;; threads on the stack.
3784 (setq thread threads
3785 gnus-tmp-header (caar thread))
3786 ;; There were no current threads, so we pop something off
3788 (setq state (car stack)
3789 gnus-tmp-level (car state)
3792 gnus-tmp-header (caar thread))))
3794 (setq gnus-tmp-false-parent nil)
3795 (setq gnus-tmp-root-expunged nil)
3796 (setq thread-end nil)
3798 (if (stringp gnus-tmp-header)
3799 ;; The header is a dummy root.
3801 ((eq gnus-summary-make-false-root 'adopt)
3802 ;; We let the first article adopt the rest.
3803 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3805 (setq gnus-tmp-gathered
3807 (lambda (h) (mail-header-number (car h)))
3810 (setq thread (cons (list (caar thread)
3813 (setq gnus-tmp-level -1
3814 gnus-tmp-false-parent t))
3815 ((eq gnus-summary-make-false-root 'empty)
3816 ;; We print adopted articles with empty subject fields.
3817 (setq gnus-tmp-gathered
3819 (lambda (h) (mail-header-number (car h)))
3822 (setq gnus-tmp-level -1))
3823 ((eq gnus-summary-make-false-root 'dummy)
3824 ;; We remember that we probably want to output a dummy
3826 (setq gnus-tmp-dummy-line gnus-tmp-header)
3827 (setq gnus-tmp-prev-subject gnus-tmp-header))
3829 ;; We do not make a root for the gathered
3830 ;; sub-threads at all.
3831 (setq gnus-tmp-level -1)))
3833 (setq number (mail-header-number gnus-tmp-header)
3834 subject (mail-header-subject gnus-tmp-header))
3837 ;; If the thread has changed subject, we might want to make
3838 ;; this subthread into a root.
3839 ((and (null gnus-thread-ignore-subject)
3840 (not (zerop gnus-tmp-level))
3841 gnus-tmp-prev-subject
3843 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3844 (setq new-roots (nconc new-roots (list (car thread)))
3846 gnus-tmp-header nil))
3847 ;; If the article lies outside the current limit,
3848 ;; then we do not display it.
3849 ((not (memq number gnus-newsgroup-limit))
3850 (setq gnus-tmp-gathered
3852 (lambda (h) (mail-header-number (car h)))
3855 (setq gnus-tmp-new-adopts (if (cdar thread)
3856 (append gnus-tmp-new-adopts
3858 gnus-tmp-new-adopts)
3860 gnus-tmp-header nil)
3861 (when (zerop gnus-tmp-level)
3862 (setq gnus-tmp-root-expunged t)))
3863 ;; Perhaps this article is to be marked as read?
3864 ((and gnus-summary-mark-below
3865 (< (or (cdr (assq number gnus-newsgroup-scored))
3867 gnus-summary-mark-below)
3868 ;; Don't touch sparse articles.
3869 (not (gnus-summary-article-sparse-p number))
3870 (not (gnus-summary-article-ancient-p number)))
3871 (setq gnus-newsgroup-unreads
3872 (delq number gnus-newsgroup-unreads))
3873 (if gnus-newsgroup-auto-expire
3874 (push number gnus-newsgroup-expirable)
3875 (push (cons number gnus-low-score-mark)
3876 gnus-newsgroup-reads))))
3878 (when gnus-tmp-header
3879 ;; We may have an old dummy line to output before this
3881 (when (and gnus-tmp-dummy-line
3884 (mail-header-subject gnus-tmp-header)))
3885 (gnus-summary-insert-dummy-line
3886 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3887 (setq gnus-tmp-dummy-line nil))
3889 ;; Compute the mark.
3890 (setq gnus-tmp-unread (gnus-article-mark number))
3892 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3893 gnus-tmp-header gnus-tmp-level)
3894 gnus-newsgroup-data)
3896 ;; Actually insert the line.
3898 gnus-tmp-subject-or-nil
3900 ((and gnus-thread-ignore-subject
3901 gnus-tmp-prev-subject
3902 (not (inline (gnus-subject-equal
3903 gnus-tmp-prev-subject subject))))
3905 ((zerop gnus-tmp-level)
3906 (if (and (eq gnus-summary-make-false-root 'empty)
3907 (memq number gnus-tmp-gathered)
3908 gnus-tmp-prev-subject
3909 (inline (gnus-subject-equal
3910 gnus-tmp-prev-subject subject)))
3911 gnus-summary-same-subject
3913 (t gnus-summary-same-subject)))
3914 (if (and (eq gnus-summary-make-false-root 'adopt)
3915 (= gnus-tmp-level 1)
3916 (memq number gnus-tmp-gathered))
3917 (setq gnus-tmp-opening-bracket ?\<
3918 gnus-tmp-closing-bracket ?\>)
3919 (setq gnus-tmp-opening-bracket ?\[
3920 gnus-tmp-closing-bracket ?\]))
3922 gnus-tmp-indentation
3923 (aref gnus-thread-indent-array gnus-tmp-level)
3924 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3925 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3926 gnus-summary-default-score 0)
3928 (if (or (null gnus-summary-default-score)
3929 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3930 gnus-summary-zcore-fuzz))
3932 (if (< gnus-tmp-score gnus-summary-default-score)
3933 gnus-score-below-mark gnus-score-over-mark))
3935 (cond ((memq number gnus-newsgroup-processable)
3937 ((memq number gnus-newsgroup-cached)
3939 ((memq number gnus-newsgroup-replied)
3941 ((memq number gnus-newsgroup-saved)
3943 (t gnus-unread-mark))
3944 gnus-tmp-from (mail-header-from gnus-tmp-header)
3947 ((string-match "<[^>]+> *$" gnus-tmp-from)
3948 (setq beg-match (match-beginning 0))
3949 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3950 (substring gnus-tmp-from (1+ (match-beginning 0))
3951 (1- (match-end 0))))
3952 (substring gnus-tmp-from 0 beg-match)))
3953 ((string-match "(.+)" gnus-tmp-from)
3954 (substring gnus-tmp-from
3955 (1+ (match-beginning 0)) (1- (match-end 0))))
3957 (when (string= gnus-tmp-name "")
3958 (setq gnus-tmp-name gnus-tmp-from))
3959 (unless (numberp gnus-tmp-lines)
3960 (setq gnus-tmp-lines 0))
3961 (gnus-put-text-property
3963 (progn (eval gnus-summary-line-format-spec) (point))
3964 'gnus-number number)
3967 (gnus-run-hooks 'gnus-summary-update-hook)
3970 (setq gnus-tmp-prev-subject subject)))
3972 (when (nth 1 thread)
3973 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3974 (incf gnus-tmp-level)
3975 (setq threads (if thread-end nil (cdar thread)))
3977 (setq gnus-tmp-level 0)))))
3978 (gnus-message 7 "Generating summary...done"))
3980 (defun gnus-summary-prepare-unthreaded (headers)
3981 "Generate an unthreaded summary buffer based on HEADERS."
3982 (let (header number mark)
3987 ;; We may have to root out some bad articles...
3988 (when (memq (setq number (mail-header-number
3989 (setq header (pop headers))))
3990 gnus-newsgroup-limit)
3991 ;; Mark article as read when it has a low score.
3992 (when (and gnus-summary-mark-below
3993 (< (or (cdr (assq number gnus-newsgroup-scored))
3994 gnus-summary-default-score 0)
3995 gnus-summary-mark-below)
3996 (not (gnus-summary-article-ancient-p number)))
3997 (setq gnus-newsgroup-unreads
3998 (delq number gnus-newsgroup-unreads))
3999 (if gnus-newsgroup-auto-expire
4000 (push number gnus-newsgroup-expirable)
4001 (push (cons number gnus-low-score-mark)
4002 gnus-newsgroup-reads)))
4004 (setq mark (gnus-article-mark number))
4005 (push (gnus-data-make number mark (1+ (point)) header 0)
4006 gnus-newsgroup-data)
4007 (gnus-summary-insert-line
4009 mark (memq number gnus-newsgroup-replied)
4010 (memq number gnus-newsgroup-expirable)
4011 (mail-header-subject header) nil
4012 (cdr (assq number gnus-newsgroup-scored))
4013 (memq number gnus-newsgroup-processable))))))
4015 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4016 "Select newsgroup GROUP.
4017 If READ-ALL is non-nil, all articles in the group are selected.
4018 If SELECT-ARTICLES, only select those articles from GROUP."
4019 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4020 ;;!!! Dirty hack; should be removed.
4021 (gnus-summary-ignore-duplicates
4022 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4024 gnus-summary-ignore-duplicates))
4025 (info (nth 2 entry))
4026 articles fetched-articles cached)
4028 (unless (gnus-check-server
4029 (setq gnus-current-select-method
4030 (gnus-find-method-for-group group)))
4031 (error "Couldn't open server"))
4033 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4034 (gnus-activate-group group) ; Or we can activate it...
4035 (progn ; Or we bug out.
4036 (when (equal major-mode 'gnus-summary-mode)
4037 (kill-buffer (current-buffer)))
4038 (error "Couldn't request group %s: %s"
4039 group (gnus-status-message group))))
4041 (unless (gnus-request-group group t)
4042 (when (equal major-mode 'gnus-summary-mode)
4043 (kill-buffer (current-buffer)))
4044 (error "Couldn't request group %s: %s"
4045 group (gnus-status-message group)))
4047 (setq gnus-newsgroup-name group)
4048 (setq gnus-newsgroup-unselected nil)
4049 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4050 (gnus-summary-setup-default-charset)
4052 ;; Adjust and set lists of article marks.
4054 (gnus-adjust-marked-articles info))
4056 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4057 (when (gnus-virtual-group-p group)
4058 (setq cached gnus-newsgroup-cached))
4060 (setq gnus-newsgroup-unreads
4061 (gnus-set-difference
4062 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4063 gnus-newsgroup-dormant))
4065 (setq gnus-newsgroup-processable nil)
4067 (gnus-update-read-articles group gnus-newsgroup-unreads)
4069 (if (setq articles select-articles)
4070 (setq gnus-newsgroup-unselected
4071 (gnus-sorted-intersection
4072 gnus-newsgroup-unreads
4073 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4074 (setq articles (gnus-articles-to-read group read-all)))
4078 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4080 ((eq articles 0) nil)
4082 ;; Init the dependencies hash table.
4083 (setq gnus-newsgroup-dependencies
4084 (gnus-make-hashtable (length articles)))
4085 (gnus-set-global-variables)
4086 ;; Retrieve the headers and read them in.
4087 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4088 (setq gnus-newsgroup-headers
4090 (setq gnus-headers-retrieved-by
4091 (gnus-retrieve-headers
4092 articles gnus-newsgroup-name
4093 ;; We might want to fetch old headers, but
4094 ;; not if there is only 1 article.
4096 (not (eq gnus-fetch-old-headers 'some))
4097 (not (numberp gnus-fetch-old-headers)))
4098 (> (length articles) 1))
4099 gnus-fetch-old-headers))))
4100 (gnus-get-newsgroup-headers-xover
4101 articles nil nil gnus-newsgroup-name t)
4102 (gnus-get-newsgroup-headers)))
4103 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4105 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4107 (setq gnus-newsgroup-cached cached))
4109 ;; Suppress duplicates?
4110 (when gnus-suppress-duplicates
4111 (gnus-dup-suppress-articles))
4113 ;; Set the initial limit.
4114 (setq gnus-newsgroup-limit (copy-sequence articles))
4115 ;; Remove canceled articles from the list of unread articles.
4116 (setq gnus-newsgroup-unreads
4117 (gnus-set-sorted-intersection
4118 gnus-newsgroup-unreads
4119 (setq fetched-articles
4120 (mapcar (lambda (headers) (mail-header-number headers))
4121 gnus-newsgroup-headers))))
4122 ;; Removed marked articles that do not exist.
4123 (gnus-update-missing-marks
4124 (gnus-sorted-complement fetched-articles articles))
4125 ;; We might want to build some more threads first.
4126 (when (and gnus-fetch-old-headers
4127 (eq gnus-headers-retrieved-by 'nov))
4128 (if (eq gnus-fetch-old-headers 'invisible)
4129 (gnus-build-all-threads)
4130 (gnus-build-old-threads)))
4131 ;; Let the Gnus agent mark articles as read.
4133 (gnus-agent-get-undownloaded-list))
4134 ;; Check whether auto-expire is to be done in this group.
4135 (setq gnus-newsgroup-auto-expire
4136 (gnus-group-auto-expirable-p group))
4137 ;; Set up the article buffer now, if necessary.
4138 (unless gnus-single-article-buffer
4139 (gnus-article-setup-buffer))
4140 ;; First and last article in this newsgroup.
4141 (when gnus-newsgroup-headers
4142 (setq gnus-newsgroup-begin
4143 (mail-header-number (car gnus-newsgroup-headers))
4146 (gnus-last-element gnus-newsgroup-headers))))
4147 ;; GROUP is successfully selected.
4148 (or gnus-newsgroup-headers t)))))
4150 (defun gnus-articles-to-read (group &optional read-all)
4151 ;; Find out what articles the user wants to read.
4153 ;; Select all articles if `read-all' is non-nil, or if there
4154 ;; are no unread articles.
4156 (and (zerop (length gnus-newsgroup-marked))
4157 (zerop (length gnus-newsgroup-unreads)))
4158 (eq (gnus-group-find-parameter group 'display)
4160 (gnus-uncompress-range (gnus-active group))
4161 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4162 (copy-sequence gnus-newsgroup-unreads))
4164 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4165 (scored (length scored-list))
4166 (number (length articles))
4167 (marked (+ (length gnus-newsgroup-marked)
4168 (length gnus-newsgroup-dormant)))
4176 ((and (or (<= scored marked) (= scored number))
4177 (numberp gnus-large-newsgroup)
4178 (> number gnus-large-newsgroup))
4182 "How many articles from %s (default %d): "
4183 (gnus-limit-string gnus-newsgroup-name 35)
4185 (if (string-match "^[ \t]*$" input) number input)))
4186 ((and (> scored marked) (< scored number)
4187 (> (- scored number) 20))
4190 (format "%s %s (%d scored, %d total): "
4191 "How many articles from"
4192 group scored number))))
4193 (if (string-match "^[ \t]*$" input)
4197 (setq select (if (stringp select) (string-to-number select) select))
4198 (if (or (null select) (zerop select))
4200 (if (and (not (zerop scored)) (<= (abs select) scored))
4202 (setq articles (sort scored-list '<))
4203 (setq number (length articles)))
4204 (setq articles (copy-sequence articles)))
4206 (when (< (abs select) number)
4208 ;; Select the N oldest articles.
4209 (setcdr (nthcdr (1- (abs select)) articles) nil)
4210 ;; Select the N most recent articles.
4211 (setq articles (nthcdr (- number select) articles))))
4212 (setq gnus-newsgroup-unselected
4213 (gnus-sorted-intersection
4214 gnus-newsgroup-unreads
4215 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4218 (defun gnus-killed-articles (killed articles)
4221 (when (inline (gnus-member-of-range (car articles) killed))
4222 (push (car articles) out))
4223 (setq articles (cdr articles)))
4226 (defun gnus-uncompress-marks (marks)
4227 "Uncompress the mark ranges in MARKS."
4228 (let ((uncompressed '(score bookmark))
4231 (if (memq (caar marks) uncompressed)
4232 (push (car marks) out)
4233 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4234 (setq marks (cdr marks)))
4237 (defun gnus-adjust-marked-articles (info)
4238 "Set all article lists and remove all marks that are no longer valid."
4239 (let* ((marked-lists (gnus-info-marks info))
4240 (active (gnus-active (gnus-info-group info)))
4243 (types gnus-article-mark-lists)
4244 (uncompressed '(score bookmark killed))
4245 marks var articles article mark)
4248 (setq marks (pop marked-lists))
4249 (set (setq var (intern (format "gnus-newsgroup-%s"
4250 (car (rassq (setq mark (car marks))
4252 (if (memq (car marks) uncompressed) (cdr marks)
4253 (gnus-uncompress-range (cdr marks))))
4255 (setq articles (symbol-value var))
4257 ;; All articles have to be subsets of the active articles.
4259 ;; Adjust "simple" lists.
4260 ((memq mark '(tick dormant expire reply save))
4262 (when (or (< (setq article (pop articles)) min) (> article max))
4263 (set var (delq article (symbol-value var))))))
4265 ((memq mark uncompressed)
4266 (when (not (listp (cdr (symbol-value var))))
4267 (set var (list (symbol-value var))))
4268 (when (not (listp (cdr articles)))
4269 (setq articles (list articles)))
4271 (when (or (not (consp (setq article (pop articles))))
4272 (< (car article) min)
4273 (> (car article) max))
4274 (set var (delq article (symbol-value var))))))))))
4276 (defun gnus-update-missing-marks (missing)
4277 "Go through the list of MISSING articles and remove them from the mark lists."
4279 (let ((types gnus-article-mark-lists)
4281 ;; Go through all types.
4283 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4284 (when (symbol-value var)
4285 ;; This list has articles. So we delete all missing articles
4289 (set var (delq (pop m) (symbol-value var)))))))))
4291 (defun gnus-update-marks ()
4292 "Enter the various lists of marked articles into the newsgroup info list."
4293 (let ((types gnus-article-mark-lists)
4294 (info (gnus-get-info gnus-newsgroup-name))
4295 (uncompressed '(score bookmark killed))
4296 type list newmarked symbol delta-marks)
4298 ;; Add all marks lists to the list of marks lists.
4299 (while (setq type (pop types))
4300 (setq list (symbol-value
4302 (intern (format "gnus-newsgroup-%s"
4306 ;; Get rid of the entries of the articles that have the
4308 (when (and (eq (cdr type) 'score)
4312 (prev (cons nil list))
4315 (if (or (not (consp (car arts)))
4316 (= (cdar arts) gnus-summary-default-score))
4317 (setcdr prev (cdr arts))
4319 (setq arts (cdr arts)))
4320 (setq list (cdr all)))))
4322 (or (memq (cdr type) uncompressed)
4323 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4325 (when (gnus-check-backend-function 'request-set-mark
4326 gnus-newsgroup-name)
4327 ;; uncompressed:s are not proper flags (they are cons cells)
4328 ;; cache is a internal gnus flag
4329 (unless (memq (cdr type) (cons 'cache uncompressed))
4330 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4331 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4332 (add (gnus-remove-from-range (gnus-copy-sequence list) old)))
4334 (push (list add 'add (list (cdr type))) delta-marks))
4336 (push (list del 'del (list (cdr type))) delta-marks)))))
4339 (push (cons (cdr type) list) newmarked)))
4342 (unless (gnus-check-group gnus-newsgroup-name)
4343 (error "Can't open server for %s" gnus-newsgroup-name))
4344 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4346 ;; Enter these new marks into the info of the group.
4348 (setcar (nthcdr 3 info) newmarked)
4349 ;; Add the marks lists to the end of the info.
4351 (setcdr (nthcdr 2 info) (list newmarked))))
4353 ;; Cut off the end of the info if there's nothing else there.
4357 (when (nthcdr (decf i) info)
4358 (setcdr (nthcdr i info) nil)))))))
4360 (defun gnus-set-mode-line (where)
4361 "This function sets the mode line of the article or summary buffers.
4362 If WHERE is `summary', the summary mode line format will be used."
4363 ;; Is this mode line one we keep updated?
4364 (when (and (memq where gnus-updated-mode-lines)
4366 (intern (format "gnus-%s-mode-line-format-spec" where))))
4369 ;; We evaluate this in the summary buffer since these
4370 ;; variables are buffer-local to that buffer.
4371 (set-buffer gnus-summary-buffer)
4372 ;; We bind all these variables that are used in the `eval' form
4374 (let* ((mformat (symbol-value
4376 (format "gnus-%s-mode-line-format-spec" where))))
4377 (gnus-tmp-group-name gnus-newsgroup-name)
4378 (gnus-tmp-article-number (or gnus-current-article 0))
4379 (gnus-tmp-unread gnus-newsgroup-unreads)
4380 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4381 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4382 (gnus-tmp-unread-and-unselected
4383 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4384 (zerop gnus-tmp-unselected))
4386 ((zerop gnus-tmp-unselected)
4387 (format "{%d more}" gnus-tmp-unread-and-unticked))
4388 (t (format "{%d(+%d) more}"
4389 gnus-tmp-unread-and-unticked
4390 gnus-tmp-unselected))))
4392 (if (and gnus-current-headers
4393 (vectorp gnus-current-headers))
4394 (gnus-mode-string-quote
4395 (mail-header-subject gnus-current-headers))
4397 bufname-length max-len
4398 gnus-tmp-header);; passed as argument to any user-format-funcs
4399 (setq mode-string (eval mformat))
4400 (setq bufname-length (if (string-match "%b" mode-string)
4403 (if (eq where 'summary)
4405 (get-buffer gnus-article-buffer))))
4408 (setq max-len (max 4 (if gnus-mode-non-string-length
4410 gnus-mode-non-string-length
4412 (length mode-string))))
4413 ;; We might have to chop a bit of the string off...
4414 (when (> (length mode-string) max-len)
4416 (concat (truncate-string-to-width mode-string (- max-len 3))
4418 ;; Pad the mode string a bit.
4419 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4420 ;; Update the mode line.
4421 (setq mode-line-buffer-identification
4422 (gnus-mode-line-buffer-identification (list mode-string)))
4423 (set-buffer-modified-p t))))
4425 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4426 "Go through the HEADERS list and add all Xrefs to a hash table.
4427 The resulting hash table is returned, or nil if no Xrefs were found."
4428 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4429 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4430 (xref-hashtb (gnus-make-hashtable))
4431 start group entry number xrefs header)
4433 (setq header (pop headers))
4434 (when (and (setq xrefs (mail-header-xref header))
4435 (not (memq (setq number (mail-header-number header))
4438 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4439 (setq start (match-end 0))
4440 (setq group (if prefix
4441 (concat prefix (substring xrefs (match-beginning 1)
4443 (substring xrefs (match-beginning 1) (match-end 1))))
4445 (string-to-int (substring xrefs (match-beginning 2)
4447 (if (setq entry (gnus-gethash group xref-hashtb))
4448 (setcdr entry (cons number (cdr entry)))
4449 (gnus-sethash group (cons number nil) xref-hashtb)))))
4450 (and start xref-hashtb)))
4452 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4453 "Look through all the headers and mark the Xrefs as read."
4454 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4455 name entry info xref-hashtb idlist method nth4)
4457 (set-buffer gnus-group-buffer)
4458 (when (setq xref-hashtb
4459 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4462 (unless (string= from-newsgroup (setq name (symbol-name group)))
4463 (setq idlist (symbol-value group))
4464 ;; Dead groups are not updated.
4466 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4468 (when (stringp (setq nth4 (gnus-info-method info)))
4469 (setq nth4 (gnus-server-to-method nth4))))
4470 ;; Only do the xrefs if the group has the same
4471 ;; select method as the group we have just read.
4472 (or (gnus-methods-equal-p
4473 nth4 (gnus-find-method-for-group from-newsgroup))
4475 (equal nth4 (setq method (gnus-find-method-for-group
4477 (and (equal (car nth4) (car method))
4478 (equal (nth 1 nth4) (nth 1 method))))
4479 gnus-use-cross-reference
4480 (or (not (eq gnus-use-cross-reference t))
4482 ;; Only do cross-references on subscribed
4483 ;; groups, if that is what is wanted.
4484 (<= (gnus-info-level info) gnus-level-subscribed))
4485 (gnus-group-make-articles-read name idlist))))
4488 (defun gnus-compute-read-articles (group articles)
4489 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4490 (info (nth 2 entry))
4491 (active (gnus-active group))
4494 ;; First peel off all invalid article numbers.
4496 (let ((ids articles)
4498 (while (setq id (pop ids))
4499 (when (and first (> id (cdr active)))
4500 ;; We'll end up in this situation in one particular
4501 ;; obscure situation. If you re-scan a group and get
4502 ;; a new article that is cross-posted to a different
4503 ;; group that has not been re-scanned, you might get
4504 ;; crossposted article that has a higher number than
4505 ;; Gnus believes possible. So we re-activate this
4506 ;; group as well. This might mean doing the
4507 ;; crossposting thingy will *increase* the number
4508 ;; of articles in some groups. Tsk, tsk.
4509 (setq active (or (gnus-activate-group group) active)))
4510 (when (or (> id (cdr active))
4511 (< id (car active)))
4512 (setq articles (delq id articles))))))
4513 ;; If the read list is nil, we init it.
4515 (null (gnus-info-read info))
4517 (setq ninfo (cons 1 (1- (car active))))
4518 (setq ninfo (gnus-info-read info)))
4519 ;; Then we add the read articles to the range.
4521 ninfo (setq articles (sort articles '<))))))
4523 (defun gnus-group-make-articles-read (group articles)
4524 "Update the info of GROUP to say that ARTICLES are read."
4526 (entry (gnus-gethash group gnus-newsrc-hashtb))
4527 (info (nth 2 entry))
4528 (active (gnus-active group))
4531 (setq range (gnus-compute-read-articles group articles))
4533 (set-buffer gnus-group-buffer)
4536 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4537 (gnus-info-set-read ',info ',(gnus-info-read info))
4538 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4539 (gnus-group-update-group ,group t))))
4540 ;; Add the read articles to the range.
4541 (gnus-info-set-read info range)
4542 ;; Then we have to re-compute how many unread
4543 ;; articles there are in this group.
4547 (setq num (- (1+ (cdr active)) (car active))))
4548 ((not (listp (cdr range)))
4549 (setq num (- (cdr active) (- (1+ (cdr range))
4553 (if (numberp (car range))
4555 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4556 (setq range (cdr range)))
4557 (setq num (- (cdr active) num))))
4558 ;; Update the number of unread articles.
4560 ;; Update the group buffer.
4561 (gnus-group-update-group group t)))))
4563 (defvar gnus-newsgroup-none-id 0)
4565 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4566 (let ((cur nntp-server-buffer)
4569 (save-excursion (set-buffer gnus-summary-buffer)
4570 gnus-newsgroup-dependencies)))
4572 (mail-parse-charset gnus-newsgroup-charset)
4573 (mail-parse-ignored-charsets
4574 (save-excursion (set-buffer gnus-summary-buffer)
4575 gnus-newsgroup-ignored-charsets)))
4577 (set-buffer nntp-server-buffer)
4578 ;; Translate all TAB characters into SPACE characters.
4579 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4580 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4581 (gnus-run-hooks 'gnus-parse-headers-hook)
4582 (let ((case-fold-search t)
4583 in-reply-to header p lines chars)
4584 (goto-char (point-min))
4585 ;; Search to the beginning of the next header. Error messages
4586 ;; do not begin with 2 or 3.
4587 (while (re-search-forward "^[23][0-9]+ " nil t)
4590 ;; This implementation of this function, with nine
4591 ;; search-forwards instead of the one re-search-forward and
4592 ;; a case (which basically was the old function) is actually
4593 ;; about twice as fast, even though it looks messier. You
4594 ;; can't have everything, I guess. Speed and elegance
4595 ;; doesn't always go hand in hand.
4604 (narrow-to-region (point)
4605 (or (and (search-forward "\n.\n" nil t)
4611 (if (search-forward "\nsubject: " nil t)
4612 (funcall gnus-decode-encoded-word-function
4613 (nnheader-header-value))
4618 (if (search-forward "\nfrom: " nil t)
4619 (funcall gnus-decode-encoded-word-function
4620 (nnheader-header-value))
4625 (if (search-forward "\ndate: " nil t)
4626 (nnheader-header-value) ""))
4630 (setq id (if (re-search-forward
4631 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4632 ;; We do it this way to make sure the Message-ID
4633 ;; is (somewhat) syntactically valid.
4634 (buffer-substring (match-beginning 1)
4636 ;; If there was no message-id, we just fake one
4637 ;; to make subsequent routines simpler.
4638 (nnheader-generate-fake-message-id))))
4642 (if (search-forward "\nreferences: " nil t)
4646 (nnheader-header-value)
4651 (search-backward ">" end t)
4654 (search-backward "<" end t)
4656 ;; Get the references from the in-reply-to header if there
4657 ;; were no references and the in-reply-to header looks
4659 (if (and (search-forward "\nin-reply-to: " nil t)
4660 (setq in-reply-to (nnheader-header-value))
4661 (string-match "<[^>]+>" in-reply-to))
4663 (setq ref (substring in-reply-to (match-beginning 0)
4665 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4666 (setq ref2 (substring in-reply-to (match-beginning 0)
4668 (when (> (length ref2) (length ref))
4675 (if (search-forward "\nchars: " nil t)
4676 (if (numberp (setq chars (ignore-errors (read cur))))
4682 (if (search-forward "\nlines: " nil t)
4683 (if (numberp (setq lines (ignore-errors (read cur))))
4689 (and (search-forward "\nxref: " nil t)
4690 (nnheader-header-value)))
4692 (when gnus-extra-headers
4693 (let ((extra gnus-extra-headers)
4697 (when (search-forward
4698 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4699 (push (cons (car extra) (nnheader-header-value))
4703 (when (equal id ref)
4706 (when gnus-alter-header-function
4707 (funcall gnus-alter-header-function header)
4708 (setq id (mail-header-id header)
4709 ref (gnus-parent-id (mail-header-references header))))
4712 (gnus-dependencies-add-header
4713 header dependencies force-new))
4714 (push header headers))
4715 (goto-char (point-max))
4717 (nreverse headers)))))
4719 ;; Goes through the xover lines and returns a list of vectors
4720 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4721 force-new dependencies
4722 group also-fetch-heads)
4723 "Parse the news overview data in the server buffer, and return a
4724 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4725 ;; Get the Xref when the users reads the articles since most/some
4726 ;; NNTP servers do not include Xrefs when using XOVER.
4727 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4728 (let ((mail-parse-charset gnus-newsgroup-charset)
4729 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4730 (cur nntp-server-buffer)
4731 (dependencies (or dependencies gnus-newsgroup-dependencies))
4732 number headers header)
4734 (set-buffer nntp-server-buffer)
4735 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4736 ;; Allow the user to mangle the headers before parsing them.
4737 (gnus-run-hooks 'gnus-parse-headers-hook)
4738 (goto-char (point-min))
4741 (while (and sequence (not (eobp)))
4742 (setq number (read cur))
4743 (while (and sequence
4744 (< (car sequence) number))
4745 (setq sequence (cdr sequence)))
4747 (eq number (car sequence))
4749 (setq sequence (cdr sequence))
4750 (setq header (inline
4751 (gnus-nov-parse-line
4752 number dependencies force-new))))
4753 (push header headers))
4756 (gnus-error 4 "Strange nov line (%d)"
4757 (count-lines (point-min) (point)))))
4759 ;; A common bug in inn is that if you have posted an article and
4760 ;; then retrieves the active file, it will answer correctly --
4761 ;; the new article is included. However, a NOV entry for the
4762 ;; article may not have been generated yet, so this may fail.
4763 ;; We work around this problem by retrieving the last few
4764 ;; headers using HEAD.
4765 (if (or (not also-fetch-heads)
4767 ;; We (probably) got all the headers.
4769 (let ((gnus-nov-is-evil t))
4772 (when (gnus-retrieve-headers sequence group)
4773 (gnus-get-newsgroup-headers))))))))
4775 (defun gnus-article-get-xrefs ()
4776 "Fill in the Xref value in `gnus-current-headers', if necessary.
4777 This is meant to be called in `gnus-article-internal-prepare-hook'."
4778 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4779 gnus-current-headers)))
4780 (or (not gnus-use-cross-reference)
4782 (and (mail-header-xref headers)
4783 (not (string= (mail-header-xref headers) "")))
4784 (let ((case-fold-search t)
4787 (nnheader-narrow-to-headers)
4788 (goto-char (point-min))
4789 (when (or (and (eq (downcase (char-after)) ?x)
4790 (looking-at "Xref:"))
4791 (search-forward "\nXref:" nil t))
4792 (goto-char (1+ (match-end 0)))
4793 (setq xref (buffer-substring (point)
4794 (progn (end-of-line) (point))))
4795 (mail-header-set-xref headers xref)))))))
4797 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4798 "Find article ID and insert the summary line for that article.
4799 OLD-HEADER can either be a header or a line number to insert
4800 the subject line on."
4801 (let* ((line (and (numberp old-header) old-header))
4802 (old-header (and (vectorp old-header) old-header))
4803 (header (cond ((and old-header use-old-header)
4806 (gnus-number-to-header id))
4807 (gnus-number-to-header id))
4809 (gnus-read-header id))))
4810 (number (and (numberp id) id))
4813 ;; Rebuild the thread that this article is part of and go to the
4814 ;; article we have fetched.
4815 (when (and (not gnus-show-threads)
4818 (setq d (gnus-data-find (mail-header-number old-header))))
4819 (goto-char (gnus-data-pos d))
4822 (- (gnus-point-at-bol)
4824 (1+ (gnus-point-at-eol))
4825 (gnus-delete-line))))))
4827 (mail-header-set-number header (mail-header-number old-header)))
4828 (setq gnus-newsgroup-sparse
4829 (delq (setq number (mail-header-number header))
4830 gnus-newsgroup-sparse))
4831 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4832 (push number gnus-newsgroup-limit)
4833 (gnus-rebuild-thread (mail-header-id header) line)
4834 (gnus-summary-goto-subject number nil t))
4835 (when (and (numberp number)
4837 ;; We have to update the boundaries even if we can't fetch the
4838 ;; article if ID is a number -- so that the next `P' or `N'
4839 ;; command will fetch the previous (or next) article even
4840 ;; if the one we tried to fetch this time has been canceled.
4841 (when (> number gnus-newsgroup-end)
4842 (setq gnus-newsgroup-end number))
4843 (when (< number gnus-newsgroup-begin)
4844 (setq gnus-newsgroup-begin number))
4845 (setq gnus-newsgroup-unselected
4846 (delq number gnus-newsgroup-unselected)))
4847 ;; Report back a success?
4848 (and header (mail-header-number header))))
4850 ;;; Process/prefix in the summary buffer
4852 (defun gnus-summary-work-articles (n)
4853 "Return a list of articles to be worked upon.
4854 The prefix argument, the list of process marked articles, and the
4855 current article will be taken into consideration."
4857 (set-buffer gnus-summary-buffer)
4860 ;; A numerical prefix has been given.
4861 (setq n (prefix-numeric-value n))
4862 (let ((backward (< n 0))
4863 (n (abs (prefix-numeric-value n)))
4868 (push (setq article (gnus-summary-article-number))
4871 (gnus-summary-find-prev nil article)
4872 (gnus-summary-find-next nil article)))
4874 (nreverse articles)))
4875 ((and (gnus-region-active-p) (mark))
4876 (message "region active")
4877 ;; Work on the region between point and mark.
4878 (let ((max (max (point) (mark)))
4881 (goto-char (min (min (point) (mark))))
4884 (push (setq article (gnus-summary-article-number)) articles)
4885 (gnus-summary-find-next nil article)
4887 (nreverse articles))))
4888 (gnus-newsgroup-processable
4889 ;; There are process-marked articles present.
4890 ;; Save current state.
4891 (gnus-summary-save-process-mark)
4893 (reverse gnus-newsgroup-processable))
4895 ;; Just return the current article.
4896 (list (gnus-summary-article-number))))))
4898 (defmacro gnus-summary-iterate (arg &rest forms)
4899 "Iterate over the process/prefixed articles and do FORMS.
4900 ARG is the interactive prefix given to the command. FORMS will be
4901 executed with point over the summary line of the articles."
4902 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4903 `(let ((,articles (gnus-summary-work-articles ,arg)))
4905 (gnus-summary-goto-subject (car ,articles))
4909 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4910 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4912 (defun gnus-summary-save-process-mark ()
4913 "Push the current set of process marked articles on the stack."
4915 (push (copy-sequence gnus-newsgroup-processable)
4916 gnus-newsgroup-process-stack))
4918 (defun gnus-summary-kill-process-mark ()
4919 "Push the current set of process marked articles on the stack and unmark."
4921 (gnus-summary-save-process-mark)
4922 (gnus-summary-unmark-all-processable))
4924 (defun gnus-summary-yank-process-mark ()
4925 "Pop the last process mark state off the stack and restore it."
4927 (unless gnus-newsgroup-process-stack
4928 (error "Empty mark stack"))
4929 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4931 (defun gnus-summary-process-mark-set (set)
4932 "Make SET into the current process marked articles."
4933 (gnus-summary-unmark-all-processable)
4935 (gnus-summary-set-process-mark (pop set))))
4937 ;;; Searching and stuff
4939 (defun gnus-summary-search-group (&optional backward use-level)
4940 "Search for next unread newsgroup.
4941 If optional argument BACKWARD is non-nil, search backward instead."
4943 (set-buffer gnus-group-buffer)
4944 (when (gnus-group-search-forward
4945 backward nil (if use-level (gnus-group-group-level) nil))
4946 (gnus-group-group-name))))
4948 (defun gnus-summary-best-group (&optional exclude-group)
4949 "Find the name of the best unread group.
4950 If EXCLUDE-GROUP, do not go to this group."
4952 (set-buffer gnus-group-buffer)
4954 (gnus-group-best-unread-group exclude-group))))
4956 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4957 (if backward (gnus-summary-find-prev)
4958 (let* ((dummy (gnus-summary-article-intangible-p))
4959 (article (or article (gnus-summary-article-number)))
4960 (arts (gnus-data-find-list article))
4962 (when (and (not dummy)
4963 (or (not gnus-summary-check-current)
4965 (not (gnus-data-unread-p (car arts)))))
4966 (setq arts (cdr arts)))
4971 (when (or (and undownloaded
4972 (eq gnus-undownloaded-mark
4973 (gnus-data-mark (car arts))))
4974 (gnus-data-unread-p (car arts)))
4975 (setq result (car arts)
4977 (setq arts (cdr arts)))
4980 (goto-char (gnus-data-pos result))
4981 (gnus-data-number result)))))
4983 (defun gnus-summary-find-prev (&optional unread article)
4984 (let* ((eobp (eobp))
4985 (article (or article (gnus-summary-article-number)))
4986 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4988 (when (and (not eobp)
4989 (or (not gnus-summary-check-current)
4991 (not (gnus-data-unread-p (car arts)))))
4992 (setq arts (cdr arts)))
4997 (when (gnus-data-unread-p (car arts))
4998 (setq result (car arts)
5000 (setq arts (cdr arts)))
5003 (goto-char (gnus-data-pos result))
5004 (gnus-data-number result))))
5006 (defun gnus-summary-find-subject (subject &optional unread backward article)
5007 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5008 (article (or article (gnus-summary-article-number)))
5009 (articles (gnus-data-list backward))
5010 (arts (gnus-data-find-list article articles))
5012 (when (or (not gnus-summary-check-current)
5014 (not (gnus-data-unread-p (car arts))))
5015 (setq arts (cdr arts)))
5017 (and (or (not unread)
5018 (gnus-data-unread-p (car arts)))
5019 (vectorp (gnus-data-header (car arts)))
5021 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5022 (setq result (car arts)
5024 (setq arts (cdr arts)))
5026 (goto-char (gnus-data-pos result))
5027 (gnus-data-number result))))
5029 (defun gnus-summary-search-forward (&optional unread subject backward)
5030 "Search forward for an article.
5031 If UNREAD, look for unread articles. If SUBJECT, look for
5032 articles with that subject. If BACKWARD, search backward instead."
5033 (cond (subject (gnus-summary-find-subject subject unread backward))
5034 (backward (gnus-summary-find-prev unread))
5035 (t (gnus-summary-find-next unread))))
5037 (defun gnus-recenter (&optional n)
5038 "Center point in window and redisplay frame.
5039 Also do horizontal recentering."
5041 (when (and gnus-auto-center-summary
5042 (not (eq gnus-auto-center-summary 'vertical)))
5043 (gnus-horizontal-recenter))
5046 (defun gnus-summary-recenter ()
5047 "Center point in the summary window.
5048 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5049 displayed, no centering will be performed."
5050 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5051 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5052 (let* ((top (cond ((< (window-height) 4) 0)
5053 ((< (window-height) 7) 1)
5054 (t (if (numberp gnus-auto-center-summary)
5055 gnus-auto-center-summary
5057 (height (1- (window-height)))
5058 (bottom (save-excursion (goto-char (point-max))
5059 (forward-line (- height))
5061 (window (get-buffer-window (current-buffer))))
5062 ;; The user has to want it.
5063 (when gnus-auto-center-summary
5064 (when (get-buffer-window gnus-article-buffer)
5065 ;; Only do recentering when the article buffer is displayed,
5066 ;; Set the window start to either `bottom', which is the biggest
5067 ;; possible valid number, or the second line from the top,
5068 ;; whichever is the least.
5070 window (min bottom (save-excursion
5071 (forward-line (- top)) (point)))))
5072 ;; Do horizontal recentering while we're at it.
5073 (when (and (get-buffer-window (current-buffer) t)
5074 (not (eq gnus-auto-center-summary 'vertical)))
5075 (let ((selected (selected-window)))
5076 (select-window (get-buffer-window (current-buffer) t))
5077 (gnus-summary-position-point)
5078 (gnus-horizontal-recenter)
5079 (select-window selected))))))
5081 (defun gnus-summary-jump-to-group (newsgroup)
5082 "Move point to NEWSGROUP in group mode buffer."
5083 ;; Keep update point of group mode buffer if visible.
5084 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5085 (save-window-excursion
5086 ;; Take care of tree window mode.
5087 (when (get-buffer-window gnus-group-buffer)
5088 (pop-to-buffer gnus-group-buffer))
5089 (gnus-group-jump-to-group newsgroup))
5091 ;; Take care of tree window mode.
5092 (if (get-buffer-window gnus-group-buffer)
5093 (pop-to-buffer gnus-group-buffer)
5094 (set-buffer gnus-group-buffer))
5095 (gnus-group-jump-to-group newsgroup))))
5097 ;; This function returns a list of article numbers based on the
5098 ;; difference between the ranges of read articles in this group and
5099 ;; the range of active articles.
5100 (defun gnus-list-of-unread-articles (group)
5101 (let* ((read (gnus-info-read (gnus-get-info group)))
5102 (active (or (gnus-active group) (gnus-activate-group group)))
5105 ;; If none are read, then all are unread.
5107 (setq first (car active))
5108 ;; If the range of read articles is a single range, then the
5109 ;; first unread article is the article after the last read
5110 ;; article. Sounds logical, doesn't it?
5111 (if (not (listp (cdr read)))
5112 (setq first (max (car active) (1+ (cdr read))))
5113 ;; `read' is a list of ranges.
5114 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5117 (setq first (car active)))
5120 (while (< first nlast)
5122 (setq first (1+ first))))
5123 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5124 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5125 (setq read (cdr read)))))
5126 ;; And add the last unread articles.
5127 (while (<= first last)
5129 (setq first (1+ first)))
5130 ;; Return the list of unread articles.
5131 (delq 0 (nreverse unread))))
5133 (defun gnus-list-of-read-articles (group)
5134 "Return a list of unread, unticked and non-dormant articles."
5135 (let* ((info (gnus-get-info group))
5136 (marked (gnus-info-marks info))
5137 (active (gnus-active group)))
5139 (gnus-set-difference
5140 (gnus-sorted-complement
5141 (gnus-uncompress-range active)
5142 (gnus-list-of-unread-articles group))
5144 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5145 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5147 ;; Various summary commands
5149 (defun gnus-summary-select-article-buffer ()
5150 "Reconfigure windows to show article buffer."
5152 (if (not (gnus-buffer-live-p gnus-article-buffer))
5153 (error "There is no article buffer for this summary buffer")
5154 (gnus-configure-windows 'article)
5155 (select-window (get-buffer-window gnus-article-buffer))))
5157 (defun gnus-summary-universal-argument (arg)
5158 "Perform any operation on all articles that are process/prefixed."
5160 (let ((articles (gnus-summary-work-articles arg))
5167 (substitute-command-keys
5168 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5171 (gnus-error 1 "Undefined key")
5174 (gnus-summary-goto-subject (setq article (pop articles)))
5175 (let (gnus-newsgroup-processable)
5176 (command-execute func))
5177 (gnus-summary-remove-process-mark article)))))
5178 (gnus-summary-position-point))
5180 (defun gnus-summary-toggle-truncation (&optional arg)
5181 "Toggle truncation of summary lines.
5182 With arg, turn line truncation on iff arg is positive."
5184 (setq truncate-lines
5185 (if (null arg) (not truncate-lines)
5186 (> (prefix-numeric-value arg) 0)))
5189 (defun gnus-summary-reselect-current-group (&optional all rescan)
5190 "Exit and then reselect the current newsgroup.
5191 The prefix argument ALL means to select all articles."
5193 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5194 (error "Ephemeral groups can't be reselected"))
5195 (let ((current-subject (gnus-summary-article-number))
5196 (group gnus-newsgroup-name))
5197 (setq gnus-newsgroup-begin nil)
5199 ;; We have to adjust the point of group mode buffer because
5200 ;; point was moved to the next unread newsgroup by exiting.
5201 (gnus-summary-jump-to-group group)
5204 (gnus-group-get-new-news-this-group 1)))
5205 (gnus-group-read-group all t)
5206 (gnus-summary-goto-subject current-subject nil t)))
5208 (defun gnus-summary-rescan-group (&optional all)
5209 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5211 (gnus-summary-reselect-current-group all t))
5213 (defun gnus-summary-update-info (&optional non-destructive)
5215 (let ((group gnus-newsgroup-name))
5217 (when gnus-newsgroup-kill-headers
5218 (setq gnus-newsgroup-killed
5219 (gnus-compress-sequence
5221 (gnus-set-sorted-intersection
5222 (gnus-uncompress-range gnus-newsgroup-killed)
5223 (setq gnus-newsgroup-unselected
5224 (sort gnus-newsgroup-unselected '<)))
5225 (setq gnus-newsgroup-unreads
5226 (sort gnus-newsgroup-unreads '<)))
5228 (unless (listp (cdr gnus-newsgroup-killed))
5229 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5230 (let ((headers gnus-newsgroup-headers))
5231 ;; Set the new ranges of read articles.
5233 (set-buffer gnus-group-buffer)
5234 (gnus-undo-force-boundary))
5235 (gnus-update-read-articles
5236 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5237 ;; Set the current article marks.
5238 (let ((gnus-newsgroup-scored
5239 (if (and (not gnus-save-score)
5240 (not non-destructive))
5242 gnus-newsgroup-scored)))
5244 (gnus-update-marks)))
5245 ;; Do the cross-ref thing.
5246 (when gnus-use-cross-reference
5247 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5248 ;; Do not switch windows but change the buffer to work.
5249 (set-buffer gnus-group-buffer)
5250 (unless (gnus-ephemeral-group-p group)
5251 (gnus-group-update-group group)))))))
5253 (defun gnus-summary-save-newsrc (&optional force)
5254 "Save the current number of read/marked articles in the dribble buffer.
5255 The dribble buffer will then be saved.
5256 If FORCE (the prefix), also save the .newsrc file(s)."
5258 (gnus-summary-update-info t)
5260 (gnus-save-newsrc-file)
5261 (gnus-dribble-save)))
5263 (defun gnus-summary-exit (&optional temporary)
5264 "Exit reading current newsgroup, and then return to group selection mode.
5265 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5267 (gnus-set-global-variables)
5268 (when (gnus-buffer-live-p gnus-article-buffer)
5270 (set-buffer gnus-article-buffer)
5271 (mm-destroy-parts gnus-article-mime-handles)))
5272 (gnus-kill-save-kill-buffer)
5273 (gnus-async-halt-prefetch)
5274 (let* ((group gnus-newsgroup-name)
5275 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5278 (buf (current-buffer)))
5280 ;; Do adaptive scoring, and possibly save score files.
5281 (when gnus-newsgroup-adaptive
5282 (gnus-score-adaptive))
5283 (when gnus-use-scoring
5285 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5286 ;; If we have several article buffers, we kill them at exit.
5287 (unless gnus-single-article-buffer
5288 (gnus-kill-buffer gnus-original-article-buffer)
5289 (setq gnus-article-current nil))
5290 (when gnus-use-cache
5291 (gnus-cache-possibly-remove-articles)
5292 (gnus-cache-save-buffers))
5293 (gnus-async-prefetch-remove-group group)
5294 (when gnus-suppress-duplicates
5295 (gnus-dup-enter-articles))
5296 (when gnus-use-trees
5297 (gnus-tree-close group))
5298 ;; Remove entries for this group.
5299 (nnmail-purge-split-history (gnus-group-real-name group))
5300 ;; Make all changes in this group permanent.
5302 (gnus-run-hooks 'gnus-exit-group-hook)
5303 (gnus-summary-update-info))
5304 (gnus-close-group group)
5305 ;; Make sure where we were, and go to next newsgroup.
5306 (set-buffer gnus-group-buffer)
5308 (gnus-group-jump-to-group group))
5309 (gnus-run-hooks 'gnus-summary-exit-hook)
5310 (unless (or quit-config
5311 ;; If this group has disappeared from the summary
5312 ;; buffer, don't skip forwards.
5313 (not (string= group (gnus-group-group-name))))
5314 (gnus-group-next-unread-group 1))
5315 (setq group-point (point))
5318 ;; If we have several article buffers, we kill them at exit.
5319 (unless gnus-single-article-buffer
5320 (gnus-kill-buffer gnus-article-buffer)
5321 (gnus-kill-buffer gnus-original-article-buffer)
5322 (setq gnus-article-current nil))
5324 (if (not gnus-kill-summary-on-exit)
5325 (gnus-deaden-summary)
5326 ;; We set all buffer-local variables to nil. It is unclear why
5327 ;; this is needed, but if we don't, buffer-local variables are
5328 ;; not garbage-collected, it seems. This would the lead to en
5329 ;; ever-growing Emacs.
5330 (gnus-summary-clear-local-variables)
5331 (when (get-buffer gnus-article-buffer)
5332 (bury-buffer gnus-article-buffer))
5333 ;; We clear the global counterparts of the buffer-local
5334 ;; variables as well, just to be on the safe side.
5335 (set-buffer gnus-group-buffer)
5336 (gnus-summary-clear-local-variables)
5337 ;; Return to group mode buffer.
5338 (when (eq mode 'gnus-summary-mode)
5339 (gnus-kill-buffer buf)))
5340 (setq gnus-current-select-method gnus-select-method)
5341 (pop-to-buffer gnus-group-buffer)
5342 (if (not quit-config)
5344 (goto-char group-point)
5345 (gnus-configure-windows 'group 'force))
5346 (gnus-handle-ephemeral-exit quit-config))
5347 ;; Clear the current group name.
5349 (setq gnus-newsgroup-name nil)))))
5351 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5352 (defun gnus-summary-exit-no-update (&optional no-questions)
5353 "Quit reading current newsgroup without updating read article info."
5355 (let* ((group gnus-newsgroup-name)
5356 (quit-config (gnus-group-quit-config group)))
5357 (when (or no-questions
5359 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5360 (gnus-async-halt-prefetch)
5362 (delq 'gnus-summary-expire-articles
5363 (copy-list gnus-summary-prepare-exit-hook)))
5364 (when (gnus-buffer-live-p gnus-article-buffer)
5366 (set-buffer gnus-article-buffer)
5367 (mm-destroy-parts gnus-article-mime-handles)))
5368 ;; If we have several article buffers, we kill them at exit.
5369 (unless gnus-single-article-buffer
5370 (gnus-kill-buffer gnus-article-buffer)
5371 (gnus-kill-buffer gnus-original-article-buffer)
5372 (setq gnus-article-current nil))
5373 (if (not gnus-kill-summary-on-exit)
5374 (gnus-deaden-summary)
5375 (gnus-close-group group)
5376 (gnus-summary-clear-local-variables)
5377 (set-buffer gnus-group-buffer)
5378 (gnus-summary-clear-local-variables)
5379 (when (get-buffer gnus-summary-buffer)
5380 (kill-buffer gnus-summary-buffer)))
5381 (unless gnus-single-article-buffer
5382 (setq gnus-article-current nil))
5383 (when gnus-use-trees
5384 (gnus-tree-close group))
5385 (gnus-async-prefetch-remove-group group)
5386 (when (get-buffer gnus-article-buffer)
5387 (bury-buffer gnus-article-buffer))
5388 ;; Return to the group buffer.
5389 (gnus-configure-windows 'group 'force)
5390 ;; Clear the current group name.
5391 (setq gnus-newsgroup-name nil)
5392 (when (equal (gnus-group-group-name) group)
5393 (gnus-group-next-unread-group 1))
5395 (gnus-handle-ephemeral-exit quit-config)))))
5397 (defun gnus-handle-ephemeral-exit (quit-config)
5398 "Handle movement when leaving an ephemeral group.
5399 The state which existed when entering the ephemeral is reset."
5400 (if (not (buffer-name (car quit-config)))
5401 (gnus-configure-windows 'group 'force)
5402 (set-buffer (car quit-config))
5403 (cond ((eq major-mode 'gnus-summary-mode)
5404 (gnus-set-global-variables))
5405 ((eq major-mode 'gnus-article-mode)
5407 ;; The `gnus-summary-buffer' variable may point
5408 ;; to the old summary buffer when using a single
5410 (unless (gnus-buffer-live-p gnus-summary-buffer)
5411 (set-buffer gnus-group-buffer))
5412 (set-buffer gnus-summary-buffer)
5413 (gnus-set-global-variables))))
5414 (if (or (eq (cdr quit-config) 'article)
5415 (eq (cdr quit-config) 'pick))
5417 ;; The current article may be from the ephemeral group
5418 ;; thus it is best that we reload this article
5419 (gnus-summary-show-article)
5420 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5421 (gnus-configure-windows 'pick 'force)
5422 (gnus-configure-windows (cdr quit-config) 'force)))
5423 (gnus-configure-windows (cdr quit-config) 'force))
5424 (when (eq major-mode 'gnus-summary-mode)
5425 (gnus-summary-next-subject 1 nil t)
5426 (gnus-summary-recenter)
5427 (gnus-summary-position-point))))
5431 (defvar gnus-dead-summary-mode-map nil)
5433 (unless gnus-dead-summary-mode-map
5434 (setq gnus-dead-summary-mode-map (make-keymap))
5435 (suppress-keymap gnus-dead-summary-mode-map)
5436 (substitute-key-definition
5437 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5438 (let ((keys '("\C-d" "\r" "\177" [delete])))
5440 (define-key gnus-dead-summary-mode-map
5441 (pop keys) 'gnus-summary-wake-up-the-dead))))
5443 (defvar gnus-dead-summary-mode nil
5444 "Minor mode for Gnus summary buffers.")
5446 (defun gnus-dead-summary-mode (&optional arg)
5447 "Minor mode for Gnus summary buffers."
5449 (when (eq major-mode 'gnus-summary-mode)
5450 (make-local-variable 'gnus-dead-summary-mode)
5451 (setq gnus-dead-summary-mode
5452 (if (null arg) (not gnus-dead-summary-mode)
5453 (> (prefix-numeric-value arg) 0)))
5454 (when gnus-dead-summary-mode
5455 (gnus-add-minor-mode
5456 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5458 (defun gnus-deaden-summary ()
5459 "Make the current summary buffer into a dead summary buffer."
5460 ;; Kill any previous dead summary buffer.
5461 (when (and gnus-dead-summary
5462 (buffer-name gnus-dead-summary))
5464 (set-buffer gnus-dead-summary)
5465 (when gnus-dead-summary-mode
5466 (kill-buffer (current-buffer)))))
5467 ;; Make this the current dead summary.
5468 (setq gnus-dead-summary (current-buffer))
5469 (gnus-dead-summary-mode 1)
5470 (let ((name (buffer-name)))
5471 (when (string-match "Summary" name)
5473 (concat (substring name 0 (match-beginning 0)) "Dead "
5474 (substring name (match-beginning 0)))
5477 (defun gnus-kill-or-deaden-summary (buffer)
5478 "Kill or deaden the summary BUFFER."
5480 (when (and (buffer-name buffer)
5481 (not gnus-single-article-buffer))
5484 (gnus-kill-buffer gnus-article-buffer)
5485 (gnus-kill-buffer gnus-original-article-buffer)))
5486 (cond (gnus-kill-summary-on-exit
5487 (when (and gnus-use-trees
5488 (gnus-buffer-exists-p buffer))
5491 (gnus-tree-close gnus-newsgroup-name)))
5492 (gnus-kill-buffer buffer))
5493 ((gnus-buffer-exists-p buffer)
5496 (gnus-deaden-summary))))))
5498 (defun gnus-summary-wake-up-the-dead (&rest args)
5499 "Wake up the dead summary buffer."
5501 (gnus-dead-summary-mode -1)
5502 (let ((name (buffer-name)))
5503 (when (string-match "Dead " name)
5505 (concat (substring name 0 (match-beginning 0))
5506 (substring name (match-end 0)))
5508 (gnus-message 3 "This dead summary is now alive again"))
5510 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5511 (defun gnus-summary-fetch-faq (&optional faq-dir)
5512 "Fetch the FAQ for the current group.
5513 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5517 (when current-prefix-arg
5519 "Faq dir: " (and (listp gnus-group-faq-directory)
5520 (mapcar (lambda (file) (list file))
5521 gnus-group-faq-directory))))))
5522 (let (gnus-faq-buffer)
5523 (when (setq gnus-faq-buffer
5524 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5525 (gnus-configure-windows 'summary-faq))))
5527 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5528 (defun gnus-summary-describe-group (&optional force)
5529 "Describe the current newsgroup."
5531 (gnus-group-describe-group force gnus-newsgroup-name))
5533 (defun gnus-summary-describe-briefly ()
5534 "Describe summary mode commands briefly."
5536 (gnus-message 6 (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")))
5538 ;; Walking around group mode buffer from summary mode.
5540 (defun gnus-summary-next-group (&optional no-article target-group backward)
5541 "Exit current newsgroup and then select next unread newsgroup.
5542 If prefix argument NO-ARTICLE is non-nil, no article is selected
5543 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5544 previous group instead."
5546 ;; Stop pre-fetching.
5547 (gnus-async-halt-prefetch)
5548 (let ((current-group gnus-newsgroup-name)
5549 (current-buffer (current-buffer))
5551 ;; First we semi-exit this group to update Xrefs and all variables.
5552 ;; We can't do a real exit, because the window conf must remain
5553 ;; the same in case the user is prompted for info, and we don't
5554 ;; want the window conf to change before that...
5555 (gnus-summary-exit t)
5556 (while (not entered)
5557 ;; Then we find what group we are supposed to enter.
5558 (set-buffer gnus-group-buffer)
5559 (gnus-group-jump-to-group current-group)
5562 (if (eq gnus-keep-same-level 'best)
5563 (gnus-summary-best-group gnus-newsgroup-name)
5564 (gnus-summary-search-group backward gnus-keep-same-level))))
5565 (if (not target-group)
5566 ;; There are no further groups, so we return to the group
5569 (gnus-message 5 "Returning to the group buffer")
5571 (when (gnus-buffer-live-p current-buffer)
5572 (set-buffer current-buffer)
5573 (gnus-summary-exit))
5574 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5575 ;; We try to enter the target group.
5576 (gnus-group-jump-to-group target-group)
5577 (let ((unreads (gnus-group-group-unread)))
5578 (if (and (or (eq t unreads)
5579 (and unreads (not (zerop unreads))))
5580 (gnus-summary-read-group
5581 target-group nil no-article
5582 (and (buffer-name current-buffer) current-buffer)
5585 (setq current-group target-group
5586 target-group nil)))))))
5588 (defun gnus-summary-prev-group (&optional no-article)
5589 "Exit current newsgroup and then select previous unread newsgroup.
5590 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5592 (gnus-summary-next-group no-article nil t))
5594 ;; Walking around summary lines.
5596 (defun gnus-summary-first-subject (&optional unread undownloaded)
5597 "Go to the first unread subject.
5598 If UNREAD is non-nil, go to the first unread article.
5599 Returns the article selected or nil if there are no unread articles."
5604 ((null gnus-newsgroup-data)
5605 (gnus-message 3 "No articles in the group")
5607 ;; Pick the first article.
5609 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5610 (gnus-data-number (car gnus-newsgroup-data)))
5611 ;; No unread articles.
5612 ((null gnus-newsgroup-unreads)
5613 (gnus-message 3 "No more unread articles")
5615 ;; Find the first unread article.
5617 (let ((data gnus-newsgroup-data))
5619 (and (not (and undownloaded
5620 (eq gnus-undownloaded-mark
5621 (gnus-data-mark (car data)))))
5622 (not (gnus-data-unread-p (car data)))))
5623 (setq data (cdr data)))
5625 (goto-char (gnus-data-pos (car data)))
5626 (gnus-data-number (car data))))))
5627 (gnus-summary-position-point)))
5629 (defun gnus-summary-next-subject (n &optional unread dont-display)
5630 "Go to next N'th summary line.
5631 If N is negative, go to the previous N'th subject line.
5632 If UNREAD is non-nil, only unread articles are selected.
5633 The difference between N and the actual number of steps taken is
5636 (let ((backward (< n 0))
5640 (gnus-summary-find-prev unread)
5641 (gnus-summary-find-next unread)))
5642 (gnus-summary-show-thread)
5645 (gnus-message 7 "No more%s articles"
5646 (if unread " unread" "")))
5647 (unless dont-display
5648 (gnus-summary-recenter)
5649 (gnus-summary-position-point))
5652 (defun gnus-summary-next-unread-subject (n)
5653 "Go to next N'th unread summary line."
5655 (gnus-summary-next-subject n t))
5657 (defun gnus-summary-prev-subject (n &optional unread)
5658 "Go to previous N'th summary line.
5659 If optional argument UNREAD is non-nil, only unread article is selected."
5661 (gnus-summary-next-subject (- n) unread))
5663 (defun gnus-summary-prev-unread-subject (n)
5664 "Go to previous N'th unread summary line."
5666 (gnus-summary-next-subject (- n) t))
5668 (defun gnus-summary-goto-subject (article &optional force silent)
5669 "Go the subject line of ARTICLE.
5670 If FORCE, also allow jumping to articles not currently shown."
5671 (interactive "nArticle number: ")
5673 (data (gnus-data-find article)))
5674 ;; We read in the article if we have to.
5677 (gnus-summary-insert-subject
5679 (if (or (numberp force) (vectorp force)) force)
5681 (setq data (gnus-data-find article)))
5686 (gnus-message 3 "Can't find article %d" article))
5688 (goto-char (gnus-data-pos data))
5689 (gnus-summary-position-point)
5692 ;; Walking around summary lines with displaying articles.
5694 (defun gnus-summary-expand-window (&optional arg)
5695 "Make the summary buffer take up the entire Emacs frame.
5696 Given a prefix, will force an `article' buffer configuration."
5699 (gnus-configure-windows 'article 'force)
5700 (gnus-configure-windows 'summary 'force)))
5702 (defun gnus-summary-display-article (article &optional all-header)
5703 "Display ARTICLE in article buffer."
5704 (gnus-set-global-variables)
5708 (if gnus-summary-display-article-function
5709 (funcall gnus-summary-display-article-function article all-header)
5710 (gnus-article-prepare article all-header))
5711 (gnus-run-hooks 'gnus-select-article-hook)
5712 (when (and gnus-current-article
5713 (not (zerop gnus-current-article)))
5714 (gnus-summary-goto-subject gnus-current-article))
5715 (gnus-summary-recenter)
5716 (when (and gnus-use-trees gnus-show-threads)
5717 (gnus-possibly-generate-tree article)
5718 (gnus-highlight-selected-tree article))
5719 ;; Successfully display article.
5720 (gnus-article-set-window-start
5721 (cdr (assq article gnus-newsgroup-bookmarks))))))
5723 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5724 "Select the current article.
5725 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5726 non-nil, the article will be re-fetched even if it already present in
5727 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5729 ;; Make sure we are in the summary buffer to work around bbdb bug.
5730 (unless (eq major-mode 'gnus-summary-mode)
5731 (set-buffer gnus-summary-buffer))
5732 (let ((article (or article (gnus-summary-article-number)))
5733 (all-headers (not (not all-headers))) ;Must be T or NIL.
5734 gnus-summary-display-article-function
5737 (gnus-summary-article-pseudo-p article)
5738 (error "This is a pseudo-article"))
5741 (set-buffer gnus-summary-buffer)
5742 (if (or (and gnus-single-article-buffer
5743 (or (null gnus-current-article)
5744 (null gnus-article-current)
5745 (null (get-buffer gnus-article-buffer))
5746 (not (eq article (cdr gnus-article-current)))
5747 (not (equal (car gnus-article-current)
5748 gnus-newsgroup-name))))
5749 (and (not gnus-single-article-buffer)
5750 (or (null gnus-current-article)
5751 (not (eq gnus-current-article article))))
5753 ;; The requested article is different from the current article.
5755 (gnus-summary-display-article article all-headers)
5757 (when (or all-headers gnus-show-all-headers)
5758 (gnus-article-show-all-headers)))
5759 (when (or all-headers gnus-show-all-headers)
5760 (gnus-article-show-all-headers))
5763 (gnus-article-set-window-start
5764 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5766 (defun gnus-summary-set-current-mark (&optional current-mark)
5767 "Obsolete function."
5770 (defun gnus-summary-next-article (&optional unread subject backward push)
5771 "Select the next article.
5772 If UNREAD, only unread articles are selected.
5773 If SUBJECT, only articles with SUBJECT are selected.
5774 If BACKWARD, the previous article is selected instead of the next."
5777 ;; Is there such an article?
5778 ((and (gnus-summary-search-forward unread subject backward)
5779 (or (gnus-summary-display-article (gnus-summary-article-number))
5780 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5781 (gnus-summary-position-point))
5782 ;; If not, we try the first unread, if that is wanted.
5784 gnus-auto-select-same
5785 (gnus-summary-first-unread-article))
5786 (gnus-summary-position-point)
5787 (gnus-message 6 "Wrapped"))
5788 ;; Try to get next/previous article not displayed in this group.
5789 ((and gnus-auto-extend-newsgroup
5790 (not unread) (not subject))
5791 (gnus-summary-goto-article
5792 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5793 nil (count-lines (point-min) (point))))
5794 ;; Go to next/previous group.
5796 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5797 (gnus-summary-jump-to-group gnus-newsgroup-name))
5798 (let ((cmd last-command-char)
5801 (set-buffer gnus-group-buffer)
5804 (if (eq gnus-keep-same-level 'best)
5805 (gnus-summary-best-group gnus-newsgroup-name)
5806 (gnus-summary-search-group backward gnus-keep-same-level))))
5807 ;; For some reason, the group window gets selected. We change
5809 (select-window (get-buffer-window (current-buffer)))
5810 ;; Select next unread newsgroup automagically.
5812 ((or (not gnus-auto-select-next)
5814 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5815 ((or (eq gnus-auto-select-next 'quietly)
5816 (and (eq gnus-auto-select-next 'slightly-quietly)
5818 (and (eq gnus-auto-select-next 'almost-quietly)
5819 (gnus-summary-last-article-p)))
5821 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5823 (gnus-message 7 "No more%s articles (%s)..."
5824 (if unread " unread" "")
5825 (if group (concat "selecting " group)
5827 (gnus-summary-next-group nil group backward)))
5829 (when (gnus-key-press-event-p last-input-event)
5830 (gnus-summary-walk-group-buffer
5831 gnus-newsgroup-name cmd unread backward point))))))))
5833 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5834 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5835 (?\C-p (gnus-group-prev-unread-group 1))))
5836 (cursor-in-echo-area t)
5837 keve key group ended)
5839 (set-buffer gnus-group-buffer)
5842 (if (eq gnus-keep-same-level 'best)
5843 (gnus-summary-best-group gnus-newsgroup-name)
5844 (gnus-summary-search-group backward gnus-keep-same-level))))
5847 5 "No more%s articles%s" (if unread " unread" "")
5849 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5850 (format " (Type %s for %s [%s])"
5851 (single-key-description cmd) group
5852 (car (gnus-gethash group gnus-newsrc-hashtb)))
5853 (format " (Type %s to exit %s)"
5854 (single-key-description cmd)
5855 gnus-newsgroup-name)))
5856 ;; Confirm auto selection.
5857 (setq key (car (setq keve (gnus-read-event-char))))
5860 ((assq key keystrokes)
5861 (let ((obuf (current-buffer)))
5862 (switch-to-buffer gnus-group-buffer)
5864 (gnus-group-jump-to-group group))
5865 (eval (cadr (assq key keystrokes)))
5866 (setq group (gnus-group-group-name))
5867 (switch-to-buffer obuf))
5871 (gnus-ephemeral-group-p gnus-newsgroup-name))
5873 (gnus-summary-next-group nil group backward)))
5875 (push (cdr keve) unread-command-events))))))
5877 (defun gnus-summary-next-unread-article ()
5878 "Select unread article after current one."
5880 (gnus-summary-next-article
5881 (or (not (eq gnus-summary-goto-unread 'never))
5882 (gnus-summary-last-article-p (gnus-summary-article-number)))
5883 (and gnus-auto-select-same
5884 (gnus-summary-article-subject))))
5886 (defun gnus-summary-prev-article (&optional unread subject)
5887 "Select the article after the current one.
5888 If UNREAD is non-nil, only unread articles are selected."
5890 (gnus-summary-next-article unread subject t))
5892 (defun gnus-summary-prev-unread-article ()
5893 "Select unread article before current one."
5895 (gnus-summary-prev-article
5896 (or (not (eq gnus-summary-goto-unread 'never))
5897 (gnus-summary-first-article-p (gnus-summary-article-number)))
5898 (and gnus-auto-select-same
5899 (gnus-summary-article-subject))))
5901 (defun gnus-summary-next-page (&optional lines circular)
5902 "Show next page of the selected article.
5903 If at the end of the current article, select the next article.
5904 LINES says how many lines should be scrolled up.
5906 If CIRCULAR is non-nil, go to the start of the article instead of
5907 selecting the next article when reaching the end of the current
5910 (setq gnus-summary-buffer (current-buffer))
5911 (gnus-set-global-variables)
5912 (let ((article (gnus-summary-article-number))
5913 (article-window (get-buffer-window gnus-article-buffer t))
5915 ;; If the buffer is empty, we have no article.
5917 (error "No article to select"))
5918 (gnus-configure-windows 'article)
5919 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5920 (if (and (eq gnus-summary-goto-unread 'never)
5921 (not (gnus-summary-last-article-p article)))
5922 (gnus-summary-next-article)
5923 (gnus-summary-next-unread-article))
5924 (if (or (null gnus-current-article)
5925 (null gnus-article-current)
5926 (/= article (cdr gnus-article-current))
5927 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5928 ;; Selected subject is different from current article's.
5929 (gnus-summary-display-article article)
5930 (when article-window
5931 (gnus-eval-in-buffer-window gnus-article-buffer
5932 (setq endp (gnus-article-next-page lines)))
5935 (gnus-summary-beginning-of-article))
5937 (gnus-message 3 "End of message"))
5939 (if (and (eq gnus-summary-goto-unread 'never)
5940 (not (gnus-summary-last-article-p article)))
5941 (gnus-summary-next-article)
5942 (gnus-summary-next-unread-article))))))))
5943 (gnus-summary-recenter)
5944 (gnus-summary-position-point)))
5946 (defun gnus-summary-prev-page (&optional lines move)
5947 "Show previous page of selected article.
5948 Argument LINES specifies lines to be scrolled down.
5949 If MOVE, move to the previous unread article if point is at
5950 the beginning of the buffer."
5952 (let ((article (gnus-summary-article-number))
5953 (article-window (get-buffer-window gnus-article-buffer t))
5955 (gnus-configure-windows 'article)
5956 (if (or (null gnus-current-article)
5957 (null gnus-article-current)
5958 (/= article (cdr gnus-article-current))
5959 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5960 ;; Selected subject is different from current article's.
5961 (gnus-summary-display-article article)
5962 (gnus-summary-recenter)
5963 (when article-window
5964 (gnus-eval-in-buffer-window gnus-article-buffer
5965 (setq endp (gnus-article-prev-page lines)))
5966 (when (and move endp)
5968 (gnus-message 3 "Beginning of message"))
5970 (if (and (eq gnus-summary-goto-unread 'never)
5971 (not (gnus-summary-first-article-p article)))
5972 (gnus-summary-prev-article)
5973 (gnus-summary-prev-unread-article))))))))
5974 (gnus-summary-position-point))
5976 (defun gnus-summary-prev-page-or-article (&optional lines)
5977 "Show previous page of selected article.
5978 Argument LINES specifies lines to be scrolled down.
5979 If at the beginning of the article, go to the next article."
5981 (gnus-summary-prev-page lines t))
5983 (defun gnus-summary-scroll-up (lines)
5984 "Scroll up (or down) one line current article.
5985 Argument LINES specifies lines to be scrolled up (or down if negative)."
5987 (gnus-configure-windows 'article)
5988 (gnus-summary-show-thread)
5989 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5990 (gnus-eval-in-buffer-window gnus-article-buffer
5992 (when (gnus-article-next-page lines)
5993 (gnus-message 3 "End of message")))
5995 (gnus-article-prev-page (- lines))))))
5996 (gnus-summary-recenter)
5997 (gnus-summary-position-point))
5999 (defun gnus-summary-scroll-down (lines)
6000 "Scroll down (or up) one line current article.
6001 Argument LINES specifies lines to be scrolled down (or up if negative)."
6003 (gnus-summary-scroll-up (- lines)))
6005 (defun gnus-summary-next-same-subject ()
6006 "Select next article which has the same subject as current one."
6008 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6010 (defun gnus-summary-prev-same-subject ()
6011 "Select previous article which has the same subject as current one."
6013 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6015 (defun gnus-summary-next-unread-same-subject ()
6016 "Select next unread article which has the same subject as current one."
6018 (gnus-summary-next-article t (gnus-summary-article-subject)))
6020 (defun gnus-summary-prev-unread-same-subject ()
6021 "Select previous unread article which has the same subject as current one."
6023 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6025 (defun gnus-summary-first-unread-article ()
6026 "Select the first unread article.
6027 Return nil if there are no unread articles."
6030 (when (gnus-summary-first-subject t)
6031 (gnus-summary-show-thread)
6032 (gnus-summary-first-subject t)
6033 (gnus-summary-display-article (gnus-summary-article-number)))
6034 (gnus-summary-position-point)))
6036 (defun gnus-summary-first-unread-subject ()
6037 "Place the point on the subject line of the first unread article.
6038 Return nil if there are no unread articles."
6041 (when (gnus-summary-first-subject t)
6042 (gnus-summary-show-thread)
6043 (gnus-summary-first-subject t))
6044 (gnus-summary-position-point)))
6046 (defun gnus-summary-first-article ()
6047 "Select the first article.
6048 Return nil if there are no articles."
6051 (when (gnus-summary-first-subject)
6052 (gnus-summary-show-thread)
6053 (gnus-summary-first-subject)
6054 (gnus-summary-display-article (gnus-summary-article-number)))
6055 (gnus-summary-position-point)))
6057 (defun gnus-summary-best-unread-article ()
6058 "Select the unread article with the highest score."
6060 (let ((best -1000000)
6061 (data gnus-newsgroup-data)
6064 (and (gnus-data-unread-p (car data))
6066 (gnus-summary-article-score (gnus-data-number (car data))))
6069 article (gnus-data-number (car data))))
6070 (setq data (cdr data)))
6073 (gnus-summary-goto-article article)
6074 (error "No unread articles"))
6075 (gnus-summary-position-point))))
6077 (defun gnus-summary-last-subject ()
6078 "Go to the last displayed subject line in the group."
6079 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6081 (gnus-summary-goto-subject article))))
6083 (defun gnus-summary-goto-article (article &optional all-headers force)
6084 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6085 If ALL-HEADERS is non-nil, no header lines are hidden.
6086 If FORCE, go to the article even if it isn't displayed. If FORCE
6087 is a number, it is the line the article is to be displayed on."
6091 "Article number or Message-ID: "
6092 (mapcar (lambda (number) (list (int-to-string number)))
6093 gnus-newsgroup-limit))
6097 (if (and (stringp article)
6098 (string-match "@" article))
6099 (gnus-summary-refer-article article)
6100 (when (stringp article)
6101 (setq article (string-to-number article)))
6102 (if (gnus-summary-goto-subject article force)
6103 (gnus-summary-display-article article all-headers)
6104 (gnus-message 4 "Couldn't go to article %s" article) nil))
6105 (gnus-summary-position-point)))
6107 (defun gnus-summary-goto-last-article ()
6108 "Go to the previously read article."
6111 (when gnus-last-article
6112 (gnus-summary-goto-article gnus-last-article nil t))
6113 (gnus-summary-position-point)))
6115 (defun gnus-summary-pop-article (number)
6116 "Pop one article off the history and go to the previous.
6117 NUMBER articles will be popped off."
6120 (setq gnus-newsgroup-history
6121 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6123 (gnus-summary-goto-article (car to) nil t)
6124 (error "Article history empty")))
6125 (gnus-summary-position-point))
6127 ;; Summary commands and functions for limiting the summary buffer.
6129 (defun gnus-summary-limit-to-articles (n)
6130 "Limit the summary buffer to the next N articles.
6131 If not given a prefix, use the process marked articles instead."
6134 (let ((articles (gnus-summary-work-articles n)))
6135 (setq gnus-newsgroup-processable nil)
6136 (gnus-summary-limit articles))
6137 (gnus-summary-position-point)))
6139 (defun gnus-summary-pop-limit (&optional total)
6140 "Restore the previous limit.
6141 If given a prefix, remove all limits."
6144 (setq gnus-newsgroup-limits
6145 (list (mapcar (lambda (h) (mail-header-number h))
6146 gnus-newsgroup-headers))))
6147 (unless gnus-newsgroup-limits
6148 (error "No limit to pop"))
6150 (gnus-summary-limit nil 'pop)
6151 (gnus-summary-position-point)))
6153 (defun gnus-summary-limit-to-subject (subject &optional header)
6154 "Limit the summary buffer to articles that have subjects that match a regexp."
6155 (interactive "sLimit to subject (regexp): ")
6157 (setq header "subject"))
6158 (when (not (equal "" subject))
6160 (let ((articles (gnus-summary-find-matching
6161 (or header "subject") subject 'all)))
6163 (error "Found no matches for \"%s\"" subject))
6164 (gnus-summary-limit articles))
6165 (gnus-summary-position-point))))
6167 (defun gnus-summary-limit-to-author (from)
6168 "Limit the summary buffer to articles that have authors that match a regexp."
6169 (interactive "sLimit to author (regexp): ")
6170 (gnus-summary-limit-to-subject from "from"))
6172 (defun gnus-summary-limit-to-age (age &optional younger-p)
6173 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6174 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6175 articles that are younger than AGE days."
6176 (interactive "nLimit to articles older than (in days): \nP")
6178 (let ((data gnus-newsgroup-data)
6179 (cutoff (days-to-time age))
6180 articles d date is-younger)
6181 (while (setq d (pop data))
6182 (when (and (vectorp (gnus-data-header d))
6183 (setq date (mail-header-date (gnus-data-header d))))
6184 (setq is-younger (time-less-p
6185 (time-since (date-to-time date))
6190 (push (gnus-data-number d) articles))))
6191 (gnus-summary-limit (nreverse articles)))
6192 (gnus-summary-position-point)))
6194 (defun gnus-summary-limit-to-extra (header regexp)
6195 "Limit the summary buffer to articles that match an 'extra' header."
6199 (gnus-completing-read
6200 (symbol-name (car gnus-extra-headers))
6201 "Score extra header:"
6203 (cons (symbol-name x) x))
6208 (read-string (format "Limit to header %s (regexp): " header)))))
6209 (when (not (equal "" regexp))
6211 (let ((articles (gnus-summary-find-matching
6212 (cons 'extra header) regexp 'all)))
6214 (error "Found no matches for \"%s\"" regexp))
6215 (gnus-summary-limit articles))
6216 (gnus-summary-position-point))))
6218 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6220 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6222 (defun gnus-summary-limit-to-unread (&optional all)
6223 "Limit the summary buffer to articles that are not marked as read.
6224 If ALL is non-nil, limit strictly to unread articles."
6227 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6228 (gnus-summary-limit-to-marks
6229 ;; Concat all the marks that say that an article is read and have
6231 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6232 gnus-killed-mark gnus-kill-file-mark
6233 gnus-low-score-mark gnus-expirable-mark
6234 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6235 gnus-duplicate-mark gnus-souped-mark)
6238 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6239 (make-obsolete 'gnus-summary-delete-marked-with
6240 'gnus-summary-limit-exlude-marks)
6242 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6243 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6244 If REVERSE, limit the summary buffer to articles that are marked
6245 with MARKS. MARKS can either be a string of marks or a list of marks.
6246 Returns how many articles were removed."
6247 (interactive "sMarks: ")
6248 (gnus-summary-limit-to-marks marks t))
6250 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6251 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6252 If REVERSE (the prefix), limit the summary buffer to articles that are
6253 not marked with MARKS. MARKS can either be a string of marks or a
6255 Returns how many articles were removed."
6256 (interactive "sMarks: \nP")
6258 (let ((data gnus-newsgroup-data)
6259 (marks (if (listp marks) marks
6260 (append marks nil))) ; Transform to list.
6263 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6264 (memq (gnus-data-mark (car data)) marks))
6265 (push (gnus-data-number (car data)) articles))
6266 (setq data (cdr data)))
6267 (gnus-summary-limit articles))
6268 (gnus-summary-position-point)))
6270 (defun gnus-summary-limit-to-score (&optional score)
6271 "Limit to articles with score at or above SCORE."
6273 (setq score (if score
6274 (prefix-numeric-value score)
6275 (or gnus-summary-default-score 0)))
6276 (let ((data gnus-newsgroup-data)
6279 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6281 (push (gnus-data-number (car data)) articles))
6282 (setq data (cdr data)))
6284 (gnus-summary-limit articles)
6285 (gnus-summary-position-point))))
6287 (defun gnus-summary-limit-include-thread (id)
6288 "Display all the hidden articles that in the current thread."
6289 (interactive (list (mail-header-id (gnus-summary-article-header))))
6290 (let ((articles (gnus-articles-in-thread
6291 (gnus-id-to-thread (gnus-root-id id)))))
6293 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6294 (gnus-summary-position-point))))
6296 (defun gnus-summary-limit-include-dormant ()
6297 "Display all the hidden articles that are marked as dormant.
6298 Note that this command only works on a subset of the articles currently
6299 fetched for this group."
6301 (unless gnus-newsgroup-dormant
6302 (error "There are no dormant articles in this group"))
6304 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6305 (gnus-summary-position-point)))
6307 (defun gnus-summary-limit-exclude-dormant ()
6308 "Hide all dormant articles."
6311 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6312 (gnus-summary-position-point)))
6314 (defun gnus-summary-limit-exclude-childless-dormant ()
6315 "Hide all dormant articles that have no children."
6317 (let ((data (gnus-data-list t))
6318 articles d children)
6319 ;; Find all articles that are either not dormant or have
6321 (while (setq d (pop data))
6322 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6324 (gnus-article-children (gnus-data-number d)))
6327 (when (memq (car children) articles)
6332 (push (gnus-data-number d) articles)))
6335 (gnus-summary-limit articles)
6336 (gnus-summary-position-point))))
6338 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6339 "Mark all unread excluded articles as read.
6340 If ALL, mark even excluded ticked and dormants as read."
6342 (let ((articles (gnus-sorted-complement
6344 (mapcar (lambda (h) (mail-header-number h))
6345 gnus-newsgroup-headers)
6347 (sort gnus-newsgroup-limit '<)))
6349 (setq gnus-newsgroup-unreads
6350 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6352 (setq gnus-newsgroup-dormant nil
6353 gnus-newsgroup-marked nil
6354 gnus-newsgroup-reads
6356 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6357 gnus-newsgroup-reads))
6358 (while (setq article (pop articles))
6359 (unless (or (memq article gnus-newsgroup-dormant)
6360 (memq article gnus-newsgroup-marked))
6361 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6363 (defun gnus-summary-limit (articles &optional pop)
6365 ;; We pop the previous limit off the stack and use that.
6366 (setq articles (car gnus-newsgroup-limits)
6367 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6368 ;; We use the new limit, so we push the old limit on the stack.
6369 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6371 (setq gnus-newsgroup-limit articles)
6372 (let ((total (length gnus-newsgroup-data))
6373 (data (gnus-data-find-list (gnus-summary-article-number)))
6374 (gnus-summary-mark-below nil) ; Inhibit this.
6376 ;; This will do all the work of generating the new summary buffer
6377 ;; according to the new limit.
6378 (gnus-summary-prepare)
6379 ;; Hide any threads, possibly.
6380 (and gnus-show-threads
6381 gnus-thread-hide-subtree
6382 (gnus-summary-hide-all-threads))
6383 ;; Try to return to the article you were at, or one in the
6386 ;; We try to find some article after the current one.
6388 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6391 (setq data (cdr data))))
6393 ;; If there is no data, that means that we were after the last
6394 ;; article. The same goes when we can't find any articles
6395 ;; after the current one.
6396 (goto-char (point-max))
6397 (gnus-summary-find-prev))
6398 (gnus-set-mode-line 'summary)
6399 ;; We return how many articles were removed from the summary
6400 ;; buffer as a result of the new limit.
6401 (- total (length gnus-newsgroup-data))))
6403 (defsubst gnus-invisible-cut-children (threads)
6406 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6411 (defsubst gnus-cut-thread (thread)
6412 "Go forwards in the thread until we find an article that we want to display."
6413 (when (or (eq gnus-fetch-old-headers 'some)
6414 (eq gnus-fetch-old-headers 'invisible)
6415 (eq gnus-build-sparse-threads 'some)
6416 (eq gnus-build-sparse-threads 'more))
6417 ;; Deal with old-fetched headers and sparse threads.
6421 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6422 (gnus-summary-article-ancient-p
6423 (mail-header-number (car thread))))
6424 (if (or (<= (length (cdr thread)) 1)
6425 (eq gnus-fetch-old-headers 'invisible))
6426 (setq gnus-newsgroup-limit
6427 (delq (mail-header-number (car thread))
6428 gnus-newsgroup-limit)
6429 thread (cadr thread))
6430 (when (gnus-invisible-cut-children (cdr thread))
6431 (let ((th (cdr thread)))
6433 (if (memq (mail-header-number (caar th))
6434 gnus-newsgroup-limit)
6435 (setq thread (car th)
6437 (setq th (cdr th))))))))))
6440 (defun gnus-cut-threads (threads)
6441 "Cut off all uninteresting articles from the beginning of threads."
6442 (when (or (eq gnus-fetch-old-headers 'some)
6443 (eq gnus-fetch-old-headers 'invisible)
6444 (eq gnus-build-sparse-threads 'some)
6445 (eq gnus-build-sparse-threads 'more))
6448 (setcar th (gnus-cut-thread (car th)))
6449 (setq th (cdr th)))))
6450 ;; Remove nixed out threads.
6453 (defun gnus-summary-initial-limit (&optional show-if-empty)
6454 "Figure out what the initial limit is supposed to be on group entry.
6455 This entails weeding out unwanted dormants, low-scored articles,
6456 fetch-old-headers verbiage, and so on."
6457 ;; Most groups have nothing to remove.
6458 (if (or gnus-inhibit-limiting
6459 (and (null gnus-newsgroup-dormant)
6460 (not (eq gnus-fetch-old-headers 'some))
6461 (not (eq gnus-fetch-old-headers 'invisible))
6462 (null gnus-summary-expunge-below)
6463 (not (eq gnus-build-sparse-threads 'some))
6464 (not (eq gnus-build-sparse-threads 'more))
6465 (null gnus-thread-expunge-below)
6466 (not gnus-use-nocem)))
6468 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6469 (setq gnus-newsgroup-limit nil)
6472 (unless (car (symbol-value node))
6473 ;; These threads have no parents -- they are roots.
6474 (let ((nodes (cdr (symbol-value node)))
6477 (if (and gnus-thread-expunge-below
6478 (< (gnus-thread-total-score (car nodes))
6479 gnus-thread-expunge-below))
6480 (gnus-expunge-thread (pop nodes))
6481 (setq thread (pop nodes))
6482 (gnus-summary-limit-children thread))))))
6483 gnus-newsgroup-dependencies)
6484 ;; If this limitation resulted in an empty group, we might
6485 ;; pop the previous limit and use it instead.
6486 (when (and (not gnus-newsgroup-limit)
6488 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6489 gnus-newsgroup-limit))
6491 (defun gnus-summary-limit-children (thread)
6492 "Return 1 if this subthread is visible and 0 if it is not."
6493 ;; First we get the number of visible children to this thread. This
6494 ;; is done by recursing down the thread using this function, so this
6495 ;; will really go down to a leaf article first, before slowly
6496 ;; working its way up towards the root.
6500 (apply '+ (mapcar 'gnus-summary-limit-children
6503 (number (mail-header-number (car thread)))
6506 (not (memq number gnus-newsgroup-marked))
6508 ;; If this article is dormant and has absolutely no visible
6509 ;; children, then this article isn't visible.
6510 (and (memq number gnus-newsgroup-dormant)
6512 ;; If this is "fetch-old-headered" and there is no
6513 ;; visible children, then we don't want this article.
6514 (and (eq gnus-fetch-old-headers 'some)
6515 (gnus-summary-article-ancient-p number)
6517 ;; If this is "fetch-old-headered" and `invisible', then
6518 ;; we don't want this article.
6519 (and (eq gnus-fetch-old-headers 'invisible)
6520 (gnus-summary-article-ancient-p number))
6521 ;; If this is a sparsely inserted article with no children,
6522 ;; we don't want it.
6523 (and (eq gnus-build-sparse-threads 'some)
6524 (gnus-summary-article-sparse-p number)
6526 ;; If we use expunging, and this article is really
6527 ;; low-scored, then we don't want this article.
6528 (when (and gnus-summary-expunge-below
6530 (or (cdr (assq number gnus-newsgroup-scored))
6531 gnus-summary-default-score))
6532 gnus-summary-expunge-below))
6533 ;; We increase the expunge-tally here, but that has
6534 ;; nothing to do with the limits, really.
6535 (incf gnus-newsgroup-expunged-tally)
6536 ;; We also mark as read here, if that's wanted.
6537 (when (and gnus-summary-mark-below
6538 (< score gnus-summary-mark-below))
6539 (setq gnus-newsgroup-unreads
6540 (delq number gnus-newsgroup-unreads))
6541 (if gnus-newsgroup-auto-expire
6542 (push number gnus-newsgroup-expirable)
6543 (push (cons number gnus-low-score-mark)
6544 gnus-newsgroup-reads)))
6546 ;; Check NoCeM things.
6547 (if (and gnus-use-nocem
6548 (gnus-nocem-unwanted-article-p
6549 (mail-header-id (car thread))))
6551 (setq gnus-newsgroup-unreads
6552 (delq number gnus-newsgroup-unreads))
6554 ;; Nope, invisible article.
6556 ;; Ok, this article is to be visible, so we add it to the limit
6558 (push number gnus-newsgroup-limit)
6561 (defun gnus-expunge-thread (thread)
6562 "Mark all articles in THREAD as read."
6563 (let* ((number (mail-header-number (car thread))))
6564 (incf gnus-newsgroup-expunged-tally)
6565 ;; We also mark as read here, if that's wanted.
6566 (setq gnus-newsgroup-unreads
6567 (delq number gnus-newsgroup-unreads))
6568 (if gnus-newsgroup-auto-expire
6569 (push number gnus-newsgroup-expirable)
6570 (push (cons number gnus-low-score-mark)
6571 gnus-newsgroup-reads)))
6572 ;; Go recursively through all subthreads.
6573 (mapcar 'gnus-expunge-thread (cdr thread)))
6575 ;; Summary article oriented commands
6577 (defun gnus-summary-refer-parent-article (n)
6578 "Refer parent article N times.
6579 If N is negative, go to ancestor -N instead.
6580 The difference between N and the number of articles fetched is returned."
6584 (when (not (natnump n))
6589 (setq header (gnus-summary-article-header))
6590 (if (and (eq (mail-header-number header)
6591 (cdr gnus-article-current))
6592 (equal gnus-newsgroup-name
6593 (car gnus-article-current)))
6594 ;; If we try to find the parent of the currently
6595 ;; displayed article, then we take a look at the actual
6596 ;; References header, since this is slightly more
6597 ;; reliable than the References field we got from the
6600 (set-buffer gnus-original-article-buffer)
6601 (nnheader-narrow-to-headers)
6602 (unless (setq ref (message-fetch-field "references"))
6603 (setq ref (message-fetch-field "in-reply-to")))
6606 ;; It's not the current article, so we take a bet on
6607 ;; the value we got from the server.
6608 (mail-header-references header)))
6610 (not (equal ref "")))
6611 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6612 (gnus-message 1 "Couldn't find parent"))
6613 (gnus-message 1 "No references in article %d"
6614 (gnus-summary-article-number))
6617 (gnus-summary-position-point)
6620 (defun gnus-summary-refer-references ()
6621 "Fetch all articles mentioned in the References header.
6622 Return the number of articles fetched."
6624 (let ((ref (mail-header-references (gnus-summary-article-header)))
6625 (current (gnus-summary-article-number))
6629 (error "No References in the current article")
6630 ;; For each Message-ID in the References header...
6631 (while (string-match "<[^>]*>" ref)
6633 ;; ... fetch that article.
6634 (gnus-summary-refer-article
6635 (prog1 (match-string 0 ref)
6636 (setq ref (substring ref (match-end 0))))))
6637 (gnus-summary-goto-subject current)
6638 (gnus-summary-position-point)
6641 (defun gnus-summary-refer-thread (&optional limit)
6642 "Fetch all articles in the current thread.
6643 If LIMIT (the numerical prefix), fetch that many old headers instead
6644 of what's specified by the `gnus-refer-thread-limit' variable."
6646 (let ((id (mail-header-id (gnus-summary-article-header)))
6647 (limit (if limit (prefix-numeric-value limit)
6648 gnus-refer-thread-limit)))
6649 ;; We want to fetch LIMIT *old* headers, but we also have to
6650 ;; re-fetch all the headers in the current buffer, because many of
6651 ;; them may be undisplayed. So we adjust LIMIT.
6652 (when (numberp limit)
6653 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6654 (unless (eq gnus-fetch-old-headers 'invisible)
6655 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6656 ;; Retrieve the headers and read them in.
6657 (if (eq (gnus-retrieve-headers
6658 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6660 (gnus-build-all-threads)
6661 (error "Can't fetch thread from backends that don't support NOV"))
6662 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6663 (gnus-summary-limit-include-thread id)))
6665 (defun gnus-summary-refer-article (message-id &optional arg)
6666 "Fetch an article specified by MESSAGE-ID.
6667 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6668 or `gnus-select-method', no matter what backend the article comes from."
6669 (interactive "sMessage-ID: \nP")
6670 (when (and (stringp message-id)
6671 (not (zerop (length message-id))))
6672 ;; Construct the correct Message-ID if necessary.
6673 ;; Suggested by tale@pawl.rpi.edu.
6674 (unless (string-match "^<" message-id)
6675 (setq message-id (concat "<" message-id)))
6676 (unless (string-match ">$" message-id)
6677 (setq message-id (concat message-id ">")))
6678 (let* ((header (gnus-id-to-header message-id))
6680 (gnus-summary-article-sparse-p
6681 (mail-header-number header))
6682 (memq (mail-header-number header)
6683 gnus-newsgroup-limit))))
6685 ;; If the article is present in the buffer we just go to it.
6687 (or (not (gnus-summary-article-sparse-p
6688 (mail-header-number header)))
6691 (gnus-summary-goto-article
6692 (mail-header-number header) nil t)
6694 (gnus-summary-update-article (mail-header-number header)))))
6696 ;; We fetch the article
6697 (let ((gnus-override-method
6698 (cond ((gnus-news-group-p gnus-newsgroup-name)
6699 gnus-refer-article-method)
6701 (or gnus-refer-article-method gnus-select-method))
6704 ;; Start the special refer-article method, if necessary.
6705 (when (and gnus-refer-article-method
6706 (gnus-news-group-p gnus-newsgroup-name))
6707 (gnus-check-server gnus-refer-article-method))
6708 ;; Fetch the header, and display the article.
6709 (if (setq number (gnus-summary-insert-subject message-id))
6710 (gnus-summary-select-article nil nil nil number)
6711 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6713 (defun gnus-summary-edit-parameters ()
6714 "Edit the group parameters of the current group."
6716 (gnus-group-edit-group gnus-newsgroup-name 'params))
6718 (defun gnus-summary-customize-parameters ()
6719 "Customize the group parameters of the current group."
6721 (gnus-group-customize gnus-newsgroup-name))
6723 (defun gnus-summary-enter-digest-group (&optional force)
6724 "Enter an nndoc group based on the current article.
6725 If FORCE, force a digest interpretation. If not, try
6726 to guess what the document format is."
6728 (let ((conf gnus-current-window-configuration))
6730 (gnus-summary-select-article))
6731 (setq gnus-current-window-configuration conf)
6732 (let* ((name (format "%s-%d"
6733 (gnus-group-prefixed-name
6734 gnus-newsgroup-name (list 'nndoc ""))
6736 (set-buffer gnus-summary-buffer)
6737 gnus-current-article)))
6738 (ogroup gnus-newsgroup-name)
6739 (params (append (gnus-info-params (gnus-get-info ogroup))
6740 (list (cons 'to-group ogroup))
6741 (list (cons 'save-article-group ogroup))))
6742 (case-fold-search t)
6743 (buf (current-buffer))
6746 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6747 (insert-buffer-substring gnus-original-article-buffer)
6748 ;; Remove lines that may lead nndoc to misinterpret the
6751 (goto-char (point-min))
6752 (or (search-forward "\n\n" nil t) (point)))
6753 (goto-char (point-min))
6754 (delete-matching-lines "^\\(Path\\):\\|^From ")
6757 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
6758 (gnus-newsgroup-ephemeral-ignored-charsets
6759 gnus-newsgroup-ignored-charsets))
6760 (gnus-group-read-ephemeral-group
6761 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6763 ,(if force 'digest 'guess))) t))
6764 ;; Make all postings to this group go to the parent group.
6765 (nconc (gnus-info-params (gnus-get-info name))
6767 ;; Couldn't select this doc group.
6768 (switch-to-buffer buf)
6769 (gnus-set-global-variables)
6770 (gnus-configure-windows 'summary)
6771 (gnus-message 3 "Article couldn't be entered?"))
6772 (kill-buffer dig)))))
6774 (defun gnus-summary-read-document (n)
6775 "Open a new group based on the current article(s).
6776 This will allow you to read digests and other similar
6777 documents as newsgroups.
6778 Obeys the standard process/prefix convention."
6780 (let* ((articles (gnus-summary-work-articles n))
6781 (ogroup gnus-newsgroup-name)
6782 (params (append (gnus-info-params (gnus-get-info ogroup))
6783 (list (cons 'to-group ogroup))))
6784 article group egroup groups vgroup)
6785 (while (setq article (pop articles))
6786 (setq group (format "%s-%d" gnus-newsgroup-name article))
6787 (gnus-summary-remove-process-mark article)
6788 (when (gnus-summary-display-article article)
6791 (insert-buffer-substring gnus-original-article-buffer)
6792 ;; Remove some headers that may lead nndoc to make
6794 (message-narrow-to-head)
6795 (goto-char (point-min))
6796 (delete-matching-lines "^\\(Path\\):\\|^From ")
6799 (gnus-group-read-ephemeral-group
6800 group `(nndoc ,group (nndoc-address ,(current-buffer))
6801 (nndoc-article-type guess))
6804 ;; Make all postings to this group go to the parent group.
6805 (nconc (gnus-info-params (gnus-get-info egroup))
6807 (push egroup groups))
6808 ;; Couldn't select this doc group.
6809 (gnus-error 3 "Article couldn't be entered"))))))
6810 ;; Now we have selected all the documents.
6813 (error "None of the articles could be interpreted as documents"))
6814 ((gnus-group-read-ephemeral-group
6815 (setq vgroup (format
6816 "nnvirtual:%s-%s" gnus-newsgroup-name
6817 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6818 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6820 (cons (current-buffer) 'summary)))
6822 (error "Couldn't select virtual nndoc group")))))
6824 (defun gnus-summary-isearch-article (&optional regexp-p)
6825 "Do incremental search forward on the current article.
6826 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6828 (gnus-summary-select-article)
6829 (gnus-configure-windows 'article)
6830 (gnus-eval-in-buffer-window gnus-article-buffer
6833 (isearch-forward regexp-p))))
6835 (defun gnus-summary-search-article-forward (regexp &optional backward)
6836 "Search for an article containing REGEXP forward.
6837 If BACKWARD, search backward instead."
6840 (format "Search article %s (regexp%s): "
6841 (if current-prefix-arg "backward" "forward")
6842 (if gnus-last-search-regexp
6843 (concat ", default " gnus-last-search-regexp)
6845 current-prefix-arg))
6846 (if (string-equal regexp "")
6847 (setq regexp (or gnus-last-search-regexp ""))
6848 (setq gnus-last-search-regexp regexp))
6849 (if (gnus-summary-search-article regexp backward)
6850 (gnus-summary-show-thread)
6851 (error "Search failed: \"%s\"" regexp)))
6853 (defun gnus-summary-search-article-backward (regexp)
6854 "Search for an article containing REGEXP backward."
6857 (format "Search article backward (regexp%s): "
6858 (if gnus-last-search-regexp
6859 (concat ", default " gnus-last-search-regexp)
6861 (gnus-summary-search-article-forward regexp 'backward))
6863 (defun gnus-summary-search-article (regexp &optional backward)
6864 "Search for an article containing REGEXP.
6865 Optional argument BACKWARD means do search for backward.
6866 `gnus-select-article-hook' is not called during the search."
6867 ;; We have to require this here to make sure that the following
6868 ;; dynamic binding isn't shadowed by autoloading.
6869 (require 'gnus-async)
6871 (let ((gnus-select-article-hook nil) ;Disable hook.
6872 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6873 (gnus-use-article-prefetch nil)
6874 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6875 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6876 (sum (current-buffer))
6877 (gnus-display-mime-function nil)
6880 (gnus-save-hidden-threads
6881 (gnus-summary-select-article)
6882 (set-buffer gnus-article-buffer)
6886 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6888 (re-search-backward regexp nil t)
6889 (re-search-forward regexp nil t))
6890 ;; We found the regexp.
6895 (get-buffer-window (current-buffer))
6899 (setq point (point)))
6900 ;; We didn't find it, so we go to the next article.
6903 (while (eq found 'not)
6904 (if (not (if backward (gnus-summary-find-prev)
6905 (gnus-summary-find-next)))
6906 ;; No more articles.
6908 ;; Select the next article and adjust point.
6909 (unless (gnus-summary-article-sparse-p
6910 (gnus-summary-article-number))
6912 (gnus-summary-select-article)
6913 (set-buffer gnus-article-buffer)
6915 (goto-char (if backward (point-max) (point-min))))))))
6916 (gnus-message 7 ""))
6917 ;; Return whether we found the regexp.
6918 (when (eq found 'found)
6920 (gnus-summary-show-thread)
6921 (gnus-summary-goto-subject gnus-current-article)
6922 (gnus-summary-position-point)
6925 (defun gnus-summary-find-matching (header regexp &optional backward unread
6927 "Return a list of all articles that match REGEXP on HEADER.
6928 The search stars on the current article and goes forwards unless
6929 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6930 If UNREAD is non-nil, only unread articles will
6931 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6932 in the comparisons."
6933 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6934 (gnus-data-find-list
6935 (gnus-summary-article-number) (gnus-data-list backward))))
6936 (case-fold-search (not not-case-fold))
6939 (if (eq (car header) 'extra)
6942 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
6944 (error "%s is an invalid header" header))
6945 (unless (fboundp (intern (concat "mail-header-" header)))
6946 (error "%s is not a valid header" header))
6947 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
6950 (and (or (not unread) ; We want all articles...
6951 (gnus-data-unread-p d)) ; Or just unreads.
6952 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6953 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6954 (push (gnus-data-number d) articles)) ; Success!
6955 (setq data (cdr data)))
6956 (nreverse articles)))
6958 (defun gnus-summary-execute-command (header regexp command &optional backward)
6959 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6960 If HEADER is an empty string (or nil), the match is done on the entire
6961 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6963 (list (let ((completion-ignore-case t))
6966 (mapcar (lambda (string) (list string))
6967 '("Number" "Subject" "From" "Lines" "Date"
6968 "Message-ID" "Xref" "References" "Body"))
6969 nil 'require-match))
6970 (read-string "Regexp: ")
6971 (read-key-sequence "Command: ")
6972 current-prefix-arg))
6973 (when (equal header "Body")
6975 ;; Hidden thread subtrees must be searched as well.
6976 (gnus-summary-show-all-threads)
6977 ;; We don't want to change current point nor window configuration.
6979 (save-window-excursion
6980 (gnus-message 6 "Executing %s..." (key-description command))
6981 ;; We'd like to execute COMMAND interactively so as to give arguments.
6982 (gnus-execute header regexp
6983 `(call-interactively ',(key-binding command))
6985 (gnus-message 6 "Executing %s...done" (key-description command)))))
6987 (defun gnus-summary-beginning-of-article ()
6988 "Scroll the article back to the beginning."
6990 (gnus-summary-select-article)
6991 (gnus-configure-windows 'article)
6992 (gnus-eval-in-buffer-window gnus-article-buffer
6994 (goto-char (point-min))
6995 (when gnus-page-broken
6996 (gnus-narrow-to-page))))
6998 (defun gnus-summary-end-of-article ()
6999 "Scroll to the end of the article."
7001 (gnus-summary-select-article)
7002 (gnus-configure-windows 'article)
7003 (gnus-eval-in-buffer-window gnus-article-buffer
7005 (goto-char (point-max))
7007 (when gnus-page-broken
7008 (gnus-narrow-to-page))))
7010 (defun gnus-summary-print-article (&optional filename n)
7011 "Generate and print a PostScript image of the N next (mail) articles.
7013 If N is negative, print the N previous articles. If N is nil and articles
7014 have been marked with the process mark, print these instead.
7016 If the optional first argument FILENAME is nil, send the image to the
7017 printer. If FILENAME is a string, save the PostScript image in a file with
7018 that name. If FILENAME is a number, prompt the user for the name of the file
7020 (interactive (list (ps-print-preprint current-prefix-arg)
7021 current-prefix-arg))
7022 (dolist (article (gnus-summary-work-articles n))
7023 (gnus-summary-select-article nil nil 'pseudo article)
7024 (gnus-eval-in-buffer-window gnus-article-buffer
7025 (let ((buffer (generate-new-buffer " *print*")))
7028 (copy-to-buffer buffer (point-min) (point-max))
7030 (gnus-article-delete-invisible-text)
7031 (let ((ps-left-header
7034 (mail-header-subject gnus-current-headers) ")")
7036 (mail-header-from gnus-current-headers) ")")))
7039 "/pagenumberstring load"
7041 (mail-header-date gnus-current-headers) ")"))))
7042 (gnus-run-hooks 'gnus-ps-print-hook)
7044 (ps-print-buffer-with-faces filename))))
7045 (kill-buffer buffer))))))
7047 (defun gnus-summary-show-article (&optional arg)
7048 "Force re-fetching of the current article.
7049 If ARG (the prefix) is non-nil, show the raw article without any
7050 article massaging functions being run."
7053 ;; Select the article the normal way.
7054 (gnus-summary-select-article nil 'force)
7055 ;; We have to require this here to make sure that the following
7056 ;; dynamic binding isn't shadowed by autoloading.
7057 (require 'gnus-async)
7059 ;; Bind the article treatment functions to nil.
7060 (let ((gnus-have-all-headers t)
7061 gnus-article-prepare-hook
7062 gnus-article-decode-hook
7063 gnus-display-mime-function
7066 ;; Destroy any MIME parts.
7067 (when (gnus-buffer-live-p gnus-article-buffer)
7069 (set-buffer gnus-article-buffer)
7070 (mm-destroy-parts gnus-article-mime-handles)))
7071 (gnus-summary-select-article nil 'force)))
7072 (gnus-summary-goto-subject gnus-current-article)
7073 (gnus-summary-position-point))
7075 (defun gnus-summary-verbose-headers (&optional arg)
7076 "Toggle permanent full header display.
7077 If ARG is a positive number, turn header display on.
7078 If ARG is a negative number, turn header display off."
7080 (setq gnus-show-all-headers
7081 (cond ((or (not (numberp arg))
7083 (not gnus-show-all-headers))
7086 (gnus-summary-show-article))
7088 (defun gnus-summary-toggle-header (&optional arg)
7089 "Show the headers if they are hidden, or hide them if they are shown.
7090 If ARG is a positive number, show the entire header.
7091 If ARG is a negative number, hide the unwanted header lines."
7094 (set-buffer gnus-article-buffer)
7096 (let* ((buffer-read-only nil)
7097 (inhibit-point-motion-hooks t)
7100 (article-narrow-to-head)
7101 (setq hidden (gnus-article-hidden-text-p 'headers)))
7102 (goto-char (point-min))
7103 (when (search-forward "\n\n" nil t)
7104 (delete-region (point-min) (1- (point))))
7105 (goto-char (point-min))
7107 (set-buffer gnus-original-article-buffer)
7108 (goto-char (point-min))
7109 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7110 (insert-buffer-substring gnus-original-article-buffer 1 e)
7112 (narrow-to-region (point-min) (point))
7113 (article-decode-encoded-words)
7115 (and (numberp arg) (< arg 0)))
7116 (let ((gnus-treat-hide-headers nil)
7117 (gnus-treat-hide-boring-headers nil))
7118 (gnus-treat-article 'head))
7119 (gnus-treat-article 'head)))))))
7121 (defun gnus-summary-show-all-headers ()
7122 "Make all header lines visible."
7124 (gnus-article-show-all-headers))
7126 (defun gnus-summary-caesar-message (&optional arg)
7127 "Caesar rotate the current article by 13.
7128 The numerical prefix specifies how many places to rotate each letter
7131 (gnus-summary-select-article)
7132 (let ((mail-header-separator ""))
7133 (gnus-eval-in-buffer-window gnus-article-buffer
7136 (let ((start (window-start))
7138 (message-caesar-buffer-body arg)
7139 (set-window-start (get-buffer-window (current-buffer)) start))))))
7141 (defun gnus-summary-stop-page-breaking ()
7142 "Stop page breaking in the current article."
7144 (gnus-summary-select-article)
7145 (gnus-eval-in-buffer-window gnus-article-buffer
7147 (when (gnus-visual-p 'page-marker)
7148 (let ((buffer-read-only nil))
7149 (gnus-remove-text-with-property 'gnus-prev)
7150 (gnus-remove-text-with-property 'gnus-next))
7151 (setq gnus-page-broken nil))))
7153 (defun gnus-summary-move-article (&optional n to-newsgroup
7154 select-method action)
7155 "Move the current article to a different newsgroup.
7156 If N is a positive number, move the N next articles.
7157 If N is a negative number, move the N previous articles.
7158 If N is nil and any articles have been marked with the process mark,
7159 move those articles instead.
7160 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7161 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7162 re-spool using this method.
7164 For this function to work, both the current newsgroup and the
7165 newsgroup that you want to move to have to support the `request-move'
7166 and `request-accept' functions."
7169 (setq action 'move))
7170 ;; Disable marking as read.
7171 (let (gnus-mark-article-hook)
7172 (save-window-excursion
7173 (gnus-summary-select-article)))
7174 ;; Check whether the source group supports the required functions.
7175 (cond ((and (eq action 'move)
7176 (not (gnus-check-backend-function
7177 'request-move-article gnus-newsgroup-name)))
7178 (error "The current group does not support article moving"))
7179 ((and (eq action 'crosspost)
7180 (not (gnus-check-backend-function
7181 'request-replace-article gnus-newsgroup-name)))
7182 (error "The current group does not support article editing")))
7183 (let ((articles (gnus-summary-work-articles n))
7184 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7185 (names '((move "Move" "Moving")
7186 (copy "Copy" "Copying")
7187 (crosspost "Crosspost" "Crossposting")))
7188 (copy-buf (save-excursion
7189 (nnheader-set-temp-buffer " *copy article*")))
7190 art-group to-method new-xref article to-groups)
7191 (unless (assq action names)
7192 (error "Unknown action %s" action))
7193 ;; Read the newsgroup name.
7194 (when (and (not to-newsgroup)
7195 (not select-method))
7197 (gnus-read-move-group-name
7198 (cadr (assq action names))
7199 (symbol-value (intern (format "gnus-current-%s-group" action)))
7201 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7202 (setq to-method (or select-method
7203 (gnus-group-name-to-method to-newsgroup)))
7204 ;; Check the method we are to move this article to...
7205 (unless (gnus-check-backend-function
7206 'request-accept-article (car to-method))
7207 (error "%s does not support article copying" (car to-method)))
7208 (unless (gnus-check-server to-method)
7209 (error "Can't open server %s" (car to-method)))
7210 (gnus-message 6 "%s to %s: %s..."
7211 (caddr (assq action names))
7212 (or (car select-method) to-newsgroup) articles)
7214 (setq article (pop articles))
7218 ;; Move the article.
7220 ;; Remove this article from future suppression.
7221 (gnus-dup-unsuppress-article article)
7222 (gnus-request-move-article
7223 article ; Article to move
7224 gnus-newsgroup-name ; From newsgroup
7225 (nth 1 (gnus-find-method-for-group
7226 gnus-newsgroup-name)) ; Server
7227 (list 'gnus-request-accept-article
7228 to-newsgroup (list 'quote select-method)
7229 (not articles) t) ; Accept form
7230 (not articles))) ; Only save nov last time
7231 ;; Copy the article.
7234 (set-buffer copy-buf)
7235 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7236 (gnus-request-accept-article
7237 to-newsgroup select-method (not articles) t))))
7238 ;; Crosspost the article.
7239 ((eq action 'crosspost)
7240 (let ((xref (message-tokenize-header
7241 (mail-header-xref (gnus-summary-article-header article))
7243 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7246 (setq xref (list (system-name))))
7249 (mapconcat 'identity
7250 (delete "Xref:" (delete new-xref xref))
7254 (set-buffer copy-buf)
7255 ;; First put the article in the destination group.
7256 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7257 (when (consp (setq art-group
7258 (gnus-request-accept-article
7259 to-newsgroup select-method (not articles))))
7260 (setq new-xref (concat new-xref " " (car art-group)
7261 ":" (cdr art-group)))
7262 ;; Now we have the new Xrefs header, so we insert
7263 ;; it and replace the new article.
7264 (nnheader-replace-header "Xref" new-xref)
7265 (gnus-request-replace-article
7266 (cdr art-group) to-newsgroup (current-buffer))
7270 (gnus-message 1 "Couldn't %s article %s"
7271 (cadr (assq action names)) article))
7272 ((and (eq art-group 'junk)
7274 (gnus-summary-mark-article article gnus-canceled-mark)
7275 (gnus-message 4 "Deleted article %s" article))
7277 (let* ((pto-group (gnus-group-prefixed-name
7278 (car art-group) to-method))
7280 (gnus-gethash pto-group gnus-newsrc-hashtb))
7281 (info (nth 2 entry))
7282 (to-group (gnus-info-group info))
7284 ;; Update the group that has been moved to.
7286 (memq action '(move copy)))
7287 (unless (member to-group to-groups)
7288 (push to-group to-groups))
7290 (unless (memq article gnus-newsgroup-unreads)
7291 (push 'read to-marks)
7293 info (gnus-add-to-range (gnus-info-read info)
7294 (list (cdr art-group)))))
7296 ;; Copy any marks over to the new group.
7297 (let ((marks gnus-article-mark-lists)
7298 (to-article (cdr art-group)))
7300 ;; See whether the article is to be put in the cache.
7301 (when gnus-use-cache
7302 (gnus-cache-possibly-enter-article
7304 (memq article gnus-newsgroup-marked)
7305 (memq article gnus-newsgroup-dormant)
7306 (memq article gnus-newsgroup-unreads)))
7308 (when (and (equal to-group gnus-newsgroup-name)
7309 (not (memq article gnus-newsgroup-unreads)))
7310 ;; Mark this article as read in this group.
7311 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7312 (setcdr (gnus-active to-group) to-article)
7313 (setcdr gnus-newsgroup-active to-article))
7316 (when (memq article (symbol-value
7317 (intern (format "gnus-newsgroup-%s"
7319 (push (cdar marks) to-marks)
7320 ;; If the other group is the same as this group,
7321 ;; then we have to add the mark to the list.
7322 (when (equal to-group gnus-newsgroup-name)
7323 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7326 (intern (format "gnus-newsgroup-%s"
7328 ;; Copy the marks to other group.
7329 (gnus-add-marked-articles
7330 to-group (cdar marks) (list to-article) info))
7331 (setq marks (cdr marks)))
7333 (gnus-request-set-mark to-group (list (list (list to-article)
7338 (concat "(gnus-group-set-info '"
7339 (gnus-prin1-to-string (gnus-get-info to-group))
7342 ;; Update the Xref header in this article to point to
7343 ;; the new crossposted article we have just created.
7344 (when (eq action 'crosspost)
7346 (set-buffer copy-buf)
7347 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7348 (nnheader-replace-header "Xref" new-xref)
7349 (gnus-request-replace-article
7350 article gnus-newsgroup-name (current-buffer)))))
7352 ;;;!!!Why is this necessary?
7353 (set-buffer gnus-summary-buffer)
7355 (gnus-summary-goto-subject article)
7356 (when (eq action 'move)
7357 (gnus-summary-mark-article article gnus-canceled-mark))))
7358 (gnus-summary-remove-process-mark article))
7359 ;; Re-activate all groups that have been moved to.
7362 (set-buffer gnus-group-buffer)
7363 (when (gnus-group-goto-group (car to-groups) t)
7364 (gnus-group-get-new-news-this-group 1 t))
7367 (gnus-kill-buffer copy-buf)
7368 (gnus-summary-position-point)
7369 (gnus-set-mode-line 'summary)))
7371 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7372 "Move the current article to a different newsgroup.
7373 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7374 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7375 re-spool using this method."
7377 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7379 (defun gnus-summary-crosspost-article (&optional n)
7380 "Crosspost the current article to some other group."
7382 (gnus-summary-move-article n nil nil 'crosspost))
7384 (defcustom gnus-summary-respool-default-method nil
7385 "Default method for respooling an article.
7386 If nil, use to the current newsgroup method."
7387 :type '(choice (gnus-select-method :value (nnml ""))
7389 :group 'gnus-summary-mail)
7391 (defun gnus-summary-respool-article (&optional n method)
7392 "Respool the current article.
7393 The article will be squeezed through the mail spooling process again,
7394 which means that it will be put in some mail newsgroup or other
7395 depending on `nnmail-split-methods'.
7396 If N is a positive number, respool the N next articles.
7397 If N is a negative number, respool the N previous articles.
7398 If N is nil and any articles have been marked with the process mark,
7399 respool those articles instead.
7401 Respooling can be done both from mail groups and \"real\" newsgroups.
7402 In the former case, the articles in question will be moved from the
7403 current group into whatever groups they are destined to. In the
7404 latter case, they will be copied into the relevant groups."
7406 (list current-prefix-arg
7407 (let* ((methods (gnus-methods-using 'respool))
7409 (symbol-name (or gnus-summary-respool-default-method
7410 (car (gnus-find-method-for-group
7411 gnus-newsgroup-name)))))
7413 (gnus-completing-read
7414 methname "What backend do you want to use when respooling?"
7415 methods nil t nil 'gnus-mail-method-history))
7418 ((zerop (length (setq ms (gnus-servers-using-backend
7420 (list (intern method) ""))
7424 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7425 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7428 (error "No method given for respooling"))
7429 (if (assoc (symbol-name
7430 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7431 (gnus-methods-using 'respool))
7432 (gnus-summary-move-article n nil method)
7433 (gnus-summary-copy-article n nil method)))
7435 (defun gnus-summary-import-article (file)
7436 "Import an arbitrary file into a mail newsgroup."
7437 (interactive "fImport file: ")
7438 (let ((group gnus-newsgroup-name)
7439 (now (current-time))
7441 (unless (gnus-check-backend-function 'request-accept-article group)
7442 (error "%s does not support article importing" group))
7443 (or (file-readable-p file)
7444 (not (file-regular-p file))
7445 (error "Can't read %s" file))
7447 (set-buffer (gnus-get-buffer-create " *import file*"))
7449 (insert-file-contents file)
7450 (goto-char (point-min))
7451 (unless (nnheader-article-p)
7452 ;; This doesn't look like an article, so we fudge some headers.
7453 (setq atts (file-attributes file)
7454 lines (count-lines (point-min) (point-max)))
7455 (insert "From: " (read-string "From: ") "\n"
7456 "Subject: " (read-string "Subject: ") "\n"
7457 "Date: " (message-make-date (nth 5 atts))
7459 "Message-ID: " (message-make-message-id) "\n"
7460 "Lines: " (int-to-string lines) "\n"
7461 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7462 (gnus-request-accept-article group nil t)
7463 (kill-buffer (current-buffer)))))
7465 (defun gnus-summary-article-posted-p ()
7466 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7467 This will be the case if the article has both been mailed and posted."
7469 (let ((id (mail-header-references (gnus-summary-article-header)))
7470 (gnus-override-method
7471 (or gnus-refer-article-method gnus-select-method)))
7472 (if (gnus-request-head id "")
7473 (gnus-message 2 "The current message was found on %s"
7474 gnus-override-method)
7475 (gnus-message 2 "The current message couldn't be found on %s"
7476 gnus-override-method)
7479 (defun gnus-summary-expire-articles (&optional now)
7480 "Expire all articles that are marked as expirable in the current group."
7482 (when (gnus-check-backend-function
7483 'request-expire-articles gnus-newsgroup-name)
7484 ;; This backend supports expiry.
7485 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7486 (expirable (if total
7488 ;; We need to update the info for
7489 ;; this group for `gnus-list-of-read-articles'
7490 ;; to give us the right answer.
7491 (gnus-run-hooks 'gnus-exit-group-hook)
7492 (gnus-summary-update-info)
7493 (gnus-list-of-read-articles gnus-newsgroup-name))
7494 (setq gnus-newsgroup-expirable
7495 (sort gnus-newsgroup-expirable '<))))
7496 (expiry-wait (if now 'immediate
7497 (gnus-group-find-parameter
7498 gnus-newsgroup-name 'expiry-wait)))
7501 ;; There are expirable articles in this group, so we run them
7502 ;; through the expiry process.
7503 (gnus-message 6 "Expiring articles...")
7504 (unless (gnus-check-group gnus-newsgroup-name)
7505 (error "Can't open server for %s" gnus-newsgroup-name))
7506 ;; The list of articles that weren't expired is returned.
7509 (let ((nnmail-expiry-wait-function nil)
7510 (nnmail-expiry-wait expiry-wait))
7511 (setq es (gnus-request-expire-articles
7512 expirable gnus-newsgroup-name)))
7513 (setq es (gnus-request-expire-articles
7514 expirable gnus-newsgroup-name))))
7516 (setq gnus-newsgroup-expirable es))
7517 ;; We go through the old list of expirable, and mark all
7518 ;; really expired articles as nonexistent.
7519 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7520 (let ((gnus-use-cache nil))
7522 (unless (memq (car expirable) es)
7523 (when (gnus-data-find (car expirable))
7524 (gnus-summary-mark-article
7525 (car expirable) gnus-canceled-mark)))
7526 (setq expirable (cdr expirable)))))
7527 (gnus-message 6 "Expiring articles...done")))))
7529 (defun gnus-summary-expire-articles-now ()
7530 "Expunge all expirable articles in the current group.
7531 This means that *all* articles that are marked as expirable will be
7532 deleted forever, right now."
7534 (or gnus-expert-user
7536 "Are you really, really, really sure you want to delete all these messages? ")
7538 (gnus-summary-expire-articles t))
7540 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7541 (defun gnus-summary-delete-article (&optional n)
7542 "Delete the N next (mail) articles.
7543 This command actually deletes articles. This is not a marking
7544 command. The article will disappear forever from your life, never to
7546 If N is negative, delete backwards.
7547 If N is nil and articles have been marked with the process mark,
7548 delete these instead."
7550 (unless (gnus-check-backend-function 'request-expire-articles
7551 gnus-newsgroup-name)
7552 (error "The current newsgroup does not support article deletion"))
7553 ;; Compute the list of articles to delete.
7554 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7556 (if (and gnus-novice-user
7557 (not (gnus-yes-or-no-p
7558 (format "Do you really want to delete %s forever? "
7559 (if (> (length articles) 1)
7560 (format "these %s articles" (length articles))
7563 ;; Delete the articles.
7564 (setq not-deleted (gnus-request-expire-articles
7565 articles gnus-newsgroup-name 'force))
7567 (gnus-summary-remove-process-mark (car articles))
7568 ;; The backend might not have been able to delete the article
7570 (unless (memq (car articles) not-deleted)
7571 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7572 (setq articles (cdr articles)))
7574 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7575 (gnus-summary-position-point)
7576 (gnus-set-mode-line 'summary)
7579 (defun gnus-summary-edit-article (&optional force)
7580 "Edit the current article.
7581 This will have permanent effect only in mail groups.
7582 If FORCE is non-nil, allow editing of articles even in read-only
7586 (set-buffer gnus-summary-buffer)
7587 (let ((mail-parse-charset gnus-newsgroup-charset)
7588 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
7589 (gnus-set-global-variables)
7590 (when (and (not force)
7591 (gnus-group-read-only-p))
7592 (error "The current newsgroup does not support article editing"))
7593 (gnus-summary-show-article t)
7594 (gnus-article-edit-article
7596 `(lambda (no-highlight)
7597 (let ((mail-parse-charset ',gnus-newsgroup-charset)
7598 (mail-parse-ignored-charsets
7599 ',gnus-newsgroup-ignored-charsets))
7601 (gnus-summary-edit-article-done
7602 ,(or (mail-header-references gnus-current-headers) "")
7603 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
7605 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7607 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7609 "Make edits to the current article permanent."
7611 ;; Replace the article.
7612 (let ((buf (current-buffer)))
7614 (insert-buffer-substring buf)
7615 (if (and (not read-only)
7616 (not (gnus-request-replace-article
7617 (cdr gnus-article-current) (car gnus-article-current)
7618 (current-buffer) t)))
7619 (error "Couldn't replace article")
7620 ;; Update the summary buffer.
7622 (equal (message-tokenize-header references " ")
7623 (message-tokenize-header
7624 (or (message-fetch-field "references") "") " ")))
7625 ;; We only have to update this line.
7628 (message-narrow-to-head)
7629 (let ((head (buffer-string))
7632 (insert (format "211 %d Article retrieved.\n"
7633 (cdr gnus-article-current)))
7636 (let ((nntp-server-buffer (current-buffer)))
7637 (setq header (car (gnus-get-newsgroup-headers
7639 (set-buffer gnus-summary-buffer)
7640 gnus-newsgroup-dependencies)
7643 (set-buffer gnus-summary-buffer)
7644 (gnus-data-set-header
7645 (gnus-data-find (cdr gnus-article-current))
7647 (gnus-summary-update-article-line
7648 (cdr gnus-article-current) header))))))
7650 (set-buffer (or buffer gnus-summary-buffer))
7651 (gnus-summary-update-article (cdr gnus-article-current)))
7652 ;; Prettify the article buffer again.
7653 (unless no-highlight
7655 (set-buffer gnus-article-buffer)
7656 ;;;!!! Fix this -- article should be rehighlighted.
7657 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7658 (set-buffer gnus-original-article-buffer)
7659 (gnus-request-article
7660 (cdr gnus-article-current)
7661 (car gnus-article-current) (current-buffer))))
7662 ;; Prettify the summary buffer line.
7663 (when (gnus-visual-p 'summary-highlight 'highlight)
7664 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7666 (defun gnus-summary-edit-wash (key)
7667 "Perform editing command KEY in the article buffer."
7671 (message "%s" (concat (this-command-keys) "- "))
7674 (gnus-summary-edit-article)
7675 (execute-kbd-macro (concat (this-command-keys) key))
7676 (gnus-article-edit-done))
7680 (defun gnus-summary-respool-query (&optional silent trace)
7681 "Query where the respool algorithm would put this article."
7683 (let (gnus-mark-article-hook)
7684 (gnus-summary-select-article)
7686 (set-buffer gnus-original-article-buffer)
7688 (message-narrow-to-head)
7689 (let ((groups (nnmail-article-group 'identity trace)))
7692 (message "This message would go to %s"
7693 (mapconcat 'car groups ", "))
7694 (message "This message would go to no groups"))
7697 (defun gnus-summary-respool-trace ()
7698 "Trace where the respool algorithm would put this article.
7699 Display a buffer showing all fancy splitting patterns which matched."
7701 (gnus-summary-respool-query nil t))
7703 ;; Summary marking commands.
7705 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7706 "Mark articles which has the same subject as read, and then select the next.
7707 If UNMARK is positive, remove any kind of mark.
7708 If UNMARK is negative, tick articles."
7711 (setq unmark (prefix-numeric-value unmark)))
7713 (gnus-summary-mark-same-subject
7714 (gnus-summary-article-subject) unmark)))
7715 ;; Select next unread article. If auto-select-same mode, should
7716 ;; select the first unread article.
7717 (gnus-summary-next-article t (and gnus-auto-select-same
7718 (gnus-summary-article-subject)))
7719 (gnus-message 7 "%d article%s marked as %s"
7720 count (if (= count 1) " is" "s are")
7721 (if unmark "unread" "read"))))
7723 (defun gnus-summary-kill-same-subject (&optional unmark)
7724 "Mark articles which has the same subject as read.
7725 If UNMARK is positive, remove any kind of mark.
7726 If UNMARK is negative, tick articles."
7729 (setq unmark (prefix-numeric-value unmark)))
7731 (gnus-summary-mark-same-subject
7732 (gnus-summary-article-subject) unmark)))
7733 ;; If marked as read, go to next unread subject.
7735 ;; Go to next unread subject.
7736 (gnus-summary-next-subject 1 t))
7737 (gnus-message 7 "%d articles are marked as %s"
7738 count (if unmark "unread" "read"))))
7740 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7741 "Mark articles with same SUBJECT as read, and return marked number.
7742 If optional argument UNMARK is positive, remove any kinds of marks.
7743 If optional argument UNMARK is negative, mark articles as unread instead."
7747 ((null unmark) ; Mark as read.
7750 (gnus-summary-mark-article-as-read gnus-killed-mark)
7751 (gnus-summary-show-thread) t)
7752 (gnus-summary-find-subject subject))
7753 (setq count (1+ count))))
7754 ((> unmark 0) ; Tick.
7757 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7758 (gnus-summary-show-thread) t)
7759 (gnus-summary-find-subject subject))
7760 (setq count (1+ count))))
7761 (t ; Mark as unread.
7764 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7765 (gnus-summary-show-thread) t)
7766 (gnus-summary-find-subject subject))
7767 (setq count (1+ count)))))
7768 (gnus-set-mode-line 'summary)
7769 ;; Return the number of marked articles.
7772 (defun gnus-summary-mark-as-processable (n &optional unmark)
7773 "Set the process mark on the next N articles.
7774 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7775 the process mark instead. The difference between N and the actual
7776 number of articles marked is returned."
7778 (let ((backward (< n 0))
7783 (gnus-summary-remove-process-mark
7784 (gnus-summary-article-number))
7785 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7786 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7789 (gnus-message 7 "No more articles"))
7790 (gnus-summary-recenter)
7791 (gnus-summary-position-point)
7794 (defun gnus-summary-unmark-as-processable (n)
7795 "Remove the process mark from the next N articles.
7796 If N is negative, unmark backward instead. The difference between N and
7797 the actual number of articles unmarked is returned."
7799 (gnus-summary-mark-as-processable n t))
7801 (defun gnus-summary-unmark-all-processable ()
7802 "Remove the process mark from all articles."
7805 (while gnus-newsgroup-processable
7806 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7807 (gnus-summary-position-point))
7809 (defun gnus-summary-mark-as-expirable (n)
7810 "Mark N articles forward as expirable.
7811 If N is negative, mark backward instead. The difference between N and
7812 the actual number of articles marked is returned."
7814 (gnus-summary-mark-forward n gnus-expirable-mark))
7816 (defun gnus-summary-mark-article-as-replied (article)
7817 "Mark ARTICLE replied and update the summary line."
7818 (push article gnus-newsgroup-replied)
7819 (let ((buffer-read-only nil))
7820 (when (gnus-summary-goto-subject article nil t)
7821 (gnus-summary-update-secondary-mark article))))
7823 (defun gnus-summary-set-bookmark (article)
7824 "Set a bookmark in current article."
7825 (interactive (list (gnus-summary-article-number)))
7826 (when (or (not (get-buffer gnus-article-buffer))
7827 (not gnus-current-article)
7828 (not gnus-article-current)
7829 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7830 (error "No current article selected"))
7831 ;; Remove old bookmark, if one exists.
7832 (let ((old (assq article gnus-newsgroup-bookmarks)))
7834 (setq gnus-newsgroup-bookmarks
7835 (delq old gnus-newsgroup-bookmarks))))
7836 ;; Set the new bookmark, which is on the form
7837 ;; (article-number . line-number-in-body).
7841 (set-buffer gnus-article-buffer)
7845 (goto-char (point-min))
7846 (search-forward "\n\n" nil t)
7849 gnus-newsgroup-bookmarks)
7850 (gnus-message 6 "A bookmark has been added to the current article."))
7852 (defun gnus-summary-remove-bookmark (article)
7853 "Remove the bookmark from the current article."
7854 (interactive (list (gnus-summary-article-number)))
7855 ;; Remove old bookmark, if one exists.
7856 (let ((old (assq article gnus-newsgroup-bookmarks)))
7859 (setq gnus-newsgroup-bookmarks
7860 (delq old gnus-newsgroup-bookmarks))
7861 (gnus-message 6 "Removed bookmark."))
7862 (gnus-message 6 "No bookmark in current article."))))
7864 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7865 (defun gnus-summary-mark-as-dormant (n)
7866 "Mark N articles forward as dormant.
7867 If N is negative, mark backward instead. The difference between N and
7868 the actual number of articles marked is returned."
7870 (gnus-summary-mark-forward n gnus-dormant-mark))
7872 (defun gnus-summary-set-process-mark (article)
7873 "Set the process mark on ARTICLE and update the summary line."
7874 (setq gnus-newsgroup-processable
7876 (delq article gnus-newsgroup-processable)))
7877 (when (gnus-summary-goto-subject article)
7878 (gnus-summary-show-thread)
7879 (gnus-summary-goto-subject article)
7880 (gnus-summary-update-secondary-mark article)))
7882 (defun gnus-summary-remove-process-mark (article)
7883 "Remove the process mark from ARTICLE and update the summary line."
7884 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7885 (when (gnus-summary-goto-subject article)
7886 (gnus-summary-show-thread)
7887 (gnus-summary-goto-subject article)
7888 (gnus-summary-update-secondary-mark article)))
7890 (defun gnus-summary-set-saved-mark (article)
7891 "Set the process mark on ARTICLE and update the summary line."
7892 (push article gnus-newsgroup-saved)
7893 (when (gnus-summary-goto-subject article)
7894 (gnus-summary-update-secondary-mark article)))
7896 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7897 "Mark N articles as read forwards.
7898 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7899 The difference between N and the actual number of articles marked is
7902 (gnus-summary-show-thread)
7903 (let ((backward (< n 0))
7904 (gnus-summary-goto-unread
7905 (and gnus-summary-goto-unread
7906 (not (eq gnus-summary-goto-unread 'never))
7907 (not (memq mark (list gnus-unread-mark
7908 gnus-ticked-mark gnus-dormant-mark)))))
7910 (mark (or mark gnus-del-mark)))
7912 (gnus-summary-mark-article nil mark no-expire)
7913 (zerop (gnus-summary-next-subject
7915 (and gnus-summary-goto-unread
7916 (not (eq gnus-summary-goto-unread 'never)))
7920 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7921 (gnus-summary-recenter)
7922 (gnus-summary-position-point)
7923 (gnus-set-mode-line 'summary)
7926 (defun gnus-summary-mark-article-as-read (mark)
7927 "Mark the current article quickly as read with MARK."
7928 (let ((article (gnus-summary-article-number)))
7929 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7930 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7931 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7932 (push (cons article mark) gnus-newsgroup-reads)
7933 ;; Possibly remove from cache, if that is used.
7934 (when gnus-use-cache
7935 (gnus-cache-enter-remove-article article))
7936 ;; Allow the backend to change the mark.
7937 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7938 ;; Check for auto-expiry.
7939 (when (and gnus-newsgroup-auto-expire
7940 (memq mark gnus-auto-expirable-marks))
7941 (setq mark gnus-expirable-mark)
7942 ;; Let the backend know about the mark change.
7943 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7944 (push article gnus-newsgroup-expirable))
7945 ;; Set the mark in the buffer.
7946 (gnus-summary-update-mark mark 'unread)
7949 (defun gnus-summary-mark-article-as-unread (mark)
7950 "Mark the current article quickly as unread with MARK."
7951 (let* ((article (gnus-summary-article-number))
7952 (old-mark (gnus-summary-article-mark article)))
7953 ;; Allow the backend to change the mark.
7954 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7955 (if (eq mark old-mark)
7959 (gnus-error 1 "Can't mark negative article numbers")
7961 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7962 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7963 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7964 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7965 (cond ((= mark gnus-ticked-mark)
7966 (push article gnus-newsgroup-marked))
7967 ((= mark gnus-dormant-mark)
7968 (push article gnus-newsgroup-dormant))
7970 (push article gnus-newsgroup-unreads)))
7971 (gnus-pull article gnus-newsgroup-reads)
7973 ;; See whether the article is to be put in the cache.
7975 (vectorp (gnus-summary-article-header article))
7977 (gnus-cache-possibly-enter-article
7978 gnus-newsgroup-name article
7979 (= mark gnus-ticked-mark)
7980 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7983 (gnus-summary-update-mark mark 'unread)
7986 (defun gnus-summary-mark-article (&optional article mark no-expire)
7987 "Mark ARTICLE with MARK. MARK can be any character.
7988 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7989 `??' (dormant) and `?E' (expirable).
7990 If MARK is nil, then the default character `?r' is used.
7991 If ARTICLE is nil, then the article on the current line will be
7993 ;; The mark might be a string.
7994 (when (stringp mark)
7995 (setq mark (aref mark 0)))
7996 ;; If no mark is given, then we check auto-expiring.
7998 (setq mark gnus-del-mark))
7999 (when (and (not no-expire)
8000 gnus-newsgroup-auto-expire
8001 (memq mark gnus-auto-expirable-marks))
8002 (setq mark gnus-expirable-mark))
8003 (let ((article (or article (gnus-summary-article-number)))
8004 (old-mark (gnus-summary-article-mark article)))
8005 ;; Allow the backend to change the mark.
8006 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8007 (if (eq mark old-mark)
8010 (error "No article on current line"))
8011 (if (not (if (or (= mark gnus-unread-mark)
8012 (= mark gnus-ticked-mark)
8013 (= mark gnus-dormant-mark))
8014 (gnus-mark-article-as-unread article mark)
8015 (gnus-mark-article-as-read article mark)))
8017 ;; See whether the article is to be put in the cache.
8019 (not (= mark gnus-canceled-mark))
8020 (vectorp (gnus-summary-article-header article))
8022 (gnus-cache-possibly-enter-article
8023 gnus-newsgroup-name article
8024 (= mark gnus-ticked-mark)
8025 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8027 (when (gnus-summary-goto-subject article nil t)
8028 (let ((buffer-read-only nil))
8029 (gnus-summary-show-thread)
8031 (gnus-summary-update-mark mark 'unread)
8034 (defun gnus-summary-update-secondary-mark (article)
8035 "Update the secondary (read, process, cache) mark."
8036 (gnus-summary-update-mark
8037 (cond ((memq article gnus-newsgroup-processable)
8039 ((memq article gnus-newsgroup-cached)
8041 ((memq article gnus-newsgroup-replied)
8043 ((memq article gnus-newsgroup-saved)
8045 (t gnus-unread-mark))
8047 (when (gnus-visual-p 'summary-highlight 'highlight)
8048 (gnus-run-hooks 'gnus-summary-update-hook))
8051 (defun gnus-summary-update-mark (mark type)
8052 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
8053 (buffer-read-only nil))
8054 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
8056 (when (looking-at "\r")
8058 (when (<= (+ forward (point)) (point-max))
8059 ;; Go to the right position on the line.
8060 (goto-char (+ forward (point)))
8061 ;; Replace the old mark with the new mark.
8062 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
8063 ;; Optionally update the marks by some user rule.
8064 (when (eq type 'unread)
8066 (gnus-data-find (gnus-summary-article-number)) mark)
8067 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
8069 (defun gnus-mark-article-as-read (article &optional mark)
8070 "Enter ARTICLE in the pertinent lists and remove it from others."
8071 ;; Make the article expirable.
8072 (let ((mark (or mark gnus-del-mark)))
8073 (if (= mark gnus-expirable-mark)
8074 (push article gnus-newsgroup-expirable)
8075 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
8076 ;; Remove from unread and marked lists.
8077 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8078 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8079 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8080 (push (cons article mark) gnus-newsgroup-reads)
8081 ;; Possibly remove from cache, if that is used.
8082 (when gnus-use-cache
8083 (gnus-cache-enter-remove-article article))
8086 (defun gnus-mark-article-as-unread (article &optional mark)
8087 "Enter ARTICLE in the pertinent lists and remove it from others."
8088 (let ((mark (or mark gnus-ticked-mark)))
8091 (gnus-error 1 "Can't mark negative article numbers")
8093 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8094 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8095 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8096 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8098 ;; Unsuppress duplicates?
8099 (when gnus-suppress-duplicates
8100 (gnus-dup-unsuppress-article article))
8102 (cond ((= mark gnus-ticked-mark)
8103 (push article gnus-newsgroup-marked))
8104 ((= mark gnus-dormant-mark)
8105 (push article gnus-newsgroup-dormant))
8107 (push article gnus-newsgroup-unreads)))
8108 (gnus-pull article gnus-newsgroup-reads)
8111 (defalias 'gnus-summary-mark-as-unread-forward
8112 'gnus-summary-tick-article-forward)
8113 (make-obsolete 'gnus-summary-mark-as-unread-forward
8114 'gnus-summary-tick-article-forward)
8115 (defun gnus-summary-tick-article-forward (n)
8116 "Tick N articles forwards.
8117 If N is negative, tick backwards instead.
8118 The difference between N and the number of articles ticked is returned."
8120 (gnus-summary-mark-forward n gnus-ticked-mark))
8122 (defalias 'gnus-summary-mark-as-unread-backward
8123 'gnus-summary-tick-article-backward)
8124 (make-obsolete 'gnus-summary-mark-as-unread-backward
8125 'gnus-summary-tick-article-backward)
8126 (defun gnus-summary-tick-article-backward (n)
8127 "Tick N articles backwards.
8128 The difference between N and the number of articles ticked is returned."
8130 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8132 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8133 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8134 (defun gnus-summary-tick-article (&optional article clear-mark)
8135 "Mark current article as unread.
8136 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8137 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8139 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8142 (defun gnus-summary-mark-as-read-forward (n)
8143 "Mark N articles as read forwards.
8144 If N is negative, mark backwards instead.
8145 The difference between N and the actual number of articles marked is
8148 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8150 (defun gnus-summary-mark-as-read-backward (n)
8151 "Mark the N articles as read backwards.
8152 The difference between N and the actual number of articles marked is
8155 (gnus-summary-mark-forward
8156 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8158 (defun gnus-summary-mark-as-read (&optional article mark)
8159 "Mark current article as read.
8160 ARTICLE specifies the article to be marked as read.
8161 MARK specifies a string to be inserted at the beginning of the line."
8162 (gnus-summary-mark-article article mark))
8164 (defun gnus-summary-clear-mark-forward (n)
8165 "Clear marks from N articles forward.
8166 If N is negative, clear backward instead.
8167 The difference between N and the number of marks cleared is returned."
8169 (gnus-summary-mark-forward n gnus-unread-mark))
8171 (defun gnus-summary-clear-mark-backward (n)
8172 "Clear marks from N articles backward.
8173 The difference between N and the number of marks cleared is returned."
8175 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8177 (defun gnus-summary-mark-unread-as-read ()
8178 "Intended to be used by `gnus-summary-mark-article-hook'."
8179 (when (memq gnus-current-article gnus-newsgroup-unreads)
8180 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8182 (defun gnus-summary-mark-read-and-unread-as-read ()
8183 "Intended to be used by `gnus-summary-mark-article-hook'."
8184 (let ((mark (gnus-summary-article-mark)))
8185 (when (or (gnus-unread-mark-p mark)
8186 (gnus-read-mark-p mark))
8187 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8189 (defun gnus-summary-mark-region-as-read (point mark all)
8190 "Mark all unread articles between point and mark as read.
8191 If given a prefix, mark all articles between point and mark as read,
8192 even ticked and dormant ones."
8193 (interactive "r\nP")
8202 (memq (setq article (gnus-summary-article-number))
8203 gnus-newsgroup-unreads))
8204 (gnus-summary-mark-article article gnus-del-mark))
8206 (gnus-summary-find-next))))))
8208 (defun gnus-summary-mark-below (score mark)
8209 "Mark articles with score less than SCORE with MARK."
8210 (interactive "P\ncMark: ")
8211 (setq score (if score
8212 (prefix-numeric-value score)
8213 (or gnus-summary-default-score 0)))
8215 (set-buffer gnus-summary-buffer)
8216 (goto-char (point-min))
8219 (and (< (gnus-summary-article-score) score)
8220 (gnus-summary-mark-article nil mark))
8221 (gnus-summary-find-next)))))
8223 (defun gnus-summary-kill-below (&optional score)
8224 "Mark articles with score below SCORE as read."
8226 (gnus-summary-mark-below score gnus-killed-mark))
8228 (defun gnus-summary-clear-above (&optional score)
8229 "Clear all marks from articles with score above SCORE."
8231 (gnus-summary-mark-above score gnus-unread-mark))
8233 (defun gnus-summary-tick-above (&optional score)
8234 "Tick all articles with score above SCORE."
8236 (gnus-summary-mark-above score gnus-ticked-mark))
8238 (defun gnus-summary-mark-above (score mark)
8239 "Mark articles with score over SCORE with MARK."
8240 (interactive "P\ncMark: ")
8241 (setq score (if score
8242 (prefix-numeric-value score)
8243 (or gnus-summary-default-score 0)))
8245 (set-buffer gnus-summary-buffer)
8246 (goto-char (point-min))
8248 (when (> (gnus-summary-article-score) score)
8249 (gnus-summary-mark-article nil mark))
8251 (gnus-summary-find-next)))))
8253 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8254 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8255 (defun gnus-summary-limit-include-expunged (&optional no-error)
8256 "Display all the hidden articles that were expunged for low scores."
8258 (let ((buffer-read-only nil))
8259 (let ((scored gnus-newsgroup-scored)
8262 (unless (gnus-summary-goto-subject (caar scored))
8263 (and (setq h (gnus-summary-article-header (caar scored)))
8264 (< (cdar scored) gnus-summary-expunge-below)
8266 (setq scored (cdr scored)))
8268 (when (not no-error)
8269 (error "No expunged articles hidden"))
8270 (goto-char (point-min))
8271 (gnus-summary-prepare-unthreaded (nreverse headers))
8272 (goto-char (point-min))
8273 (gnus-summary-position-point)
8276 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8277 "Mark all unread articles in this newsgroup as read.
8278 If prefix argument ALL is non-nil, ticked and dormant articles will
8279 also be marked as read.
8280 If QUIETLY is non-nil, no questions will be asked.
8281 If TO-HERE is non-nil, it should be a point in the buffer. All
8282 articles before this point will be marked as read.
8283 Note that this function will only catch up the unread article
8284 in the current summary buffer limitation.
8285 The number of articles marked as read is returned."
8290 (not gnus-interactive-catchup) ;Without confirmation?
8294 "Mark absolutely all articles as read? "
8295 "Mark all unread articles as read? ")))
8297 (not gnus-newsgroup-adaptive)
8298 (not gnus-newsgroup-auto-expire)
8299 (not gnus-suppress-duplicates)
8300 (or (not gnus-use-cache)
8301 (eq gnus-use-cache 'passive)))
8304 (setq gnus-newsgroup-marked nil
8305 gnus-newsgroup-dormant nil))
8306 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8307 ;; We actually mark all articles as canceled, which we
8308 ;; have to do when using auto-expiry or adaptive scoring.
8309 (gnus-summary-show-all-threads)
8310 (when (gnus-summary-first-subject (not all) t)
8312 (if to-here (< (point) to-here) t)
8313 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8314 (gnus-summary-find-next (not all) nil nil t))))
8315 (gnus-set-mode-line 'summary))
8317 (gnus-summary-position-point)))
8319 (defun gnus-summary-catchup-to-here (&optional all)
8320 "Mark all unticked articles before the current one as read.
8321 If ALL is non-nil, also mark ticked and dormant articles as read."
8324 (gnus-save-hidden-threads
8325 (let ((beg (point)))
8326 ;; We check that there are unread articles.
8327 (when (or all (gnus-summary-find-prev))
8328 (gnus-summary-catchup all t beg)))))
8329 (gnus-summary-position-point))
8331 (defun gnus-summary-catchup-all (&optional quietly)
8332 "Mark all articles in this newsgroup as read."
8334 (gnus-summary-catchup t quietly))
8336 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8337 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8338 If prefix argument ALL is non-nil, all articles are marked as read."
8340 (when (gnus-summary-catchup all quietly nil 'fast)
8341 ;; Select next newsgroup or exit.
8342 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8343 (eq gnus-auto-select-next 'quietly))
8344 (gnus-summary-next-group nil)
8345 (gnus-summary-exit))))
8347 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8348 "Mark all articles in this newsgroup as read, and then exit."
8350 (gnus-summary-catchup-and-exit t quietly))
8352 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8353 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8354 "Mark all articles in this group as read and select the next group.
8355 If given a prefix, mark all articles, unread as well as ticked, as
8359 (gnus-summary-catchup all))
8360 (gnus-summary-next-article t nil nil t))
8362 ;; Thread-based commands.
8364 (defun gnus-summary-articles-in-thread (&optional article)
8365 "Return a list of all articles in the current thread.
8366 If ARTICLE is non-nil, return all articles in the thread that starts
8368 (let* ((article (or article (gnus-summary-article-number)))
8369 (data (gnus-data-find-list article))
8370 (top-level (gnus-data-level (car data)))
8372 (cond ((null gnus-thread-operation-ignore-subject)
8373 (gnus-simplify-subject-re
8374 (mail-header-subject (gnus-data-header (car data)))))
8375 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8376 (gnus-simplify-subject-fuzzy
8377 (mail-header-subject (gnus-data-header (car data)))))
8379 (end-point (save-excursion
8380 (if (gnus-summary-go-to-next-thread)
8381 (point) (point-max))))
8384 (< (gnus-data-pos (car data)) end-point))
8385 (when (or (not top-subject)
8386 (string= top-subject
8387 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8388 (gnus-simplify-subject-fuzzy
8389 (mail-header-subject
8390 (gnus-data-header (car data))))
8391 (gnus-simplify-subject-re
8392 (mail-header-subject
8393 (gnus-data-header (car data)))))))
8394 (push (gnus-data-number (car data)) articles))
8395 (unless (and (setq data (cdr data))
8396 (> (gnus-data-level (car data)) top-level))
8398 ;; Return the list of articles.
8399 (nreverse articles)))
8401 (defun gnus-summary-rethread-current ()
8402 "Rethread the thread the current article is part of."
8404 (let* ((gnus-show-threads t)
8405 (article (gnus-summary-article-number))
8406 (id (mail-header-id (gnus-summary-article-header)))
8407 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8409 (error "No article on the current line"))
8410 (gnus-rebuild-thread id)
8411 (gnus-summary-goto-subject article)))
8413 (defun gnus-summary-reparent-thread ()
8414 "Make the current article child of the marked (or previous) article.
8416 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8417 is non-nil or the Subject: of both articles are the same."
8419 (unless (not (gnus-group-read-only-p))
8420 (error "The current newsgroup does not support article editing"))
8421 (unless (<= (length gnus-newsgroup-processable) 1)
8422 (error "No more than one article may be marked"))
8423 (save-window-excursion
8424 (let ((gnus-article-buffer " *reparent*")
8425 (current-article (gnus-summary-article-number))
8426 ;; First grab the marked article, otherwise one line up.
8427 (parent-article (if (not (null gnus-newsgroup-processable))
8428 (car gnus-newsgroup-processable)
8430 (if (eq (forward-line -1) 0)
8431 (gnus-summary-article-number)
8432 (error "Beginning of summary buffer"))))))
8433 (unless (not (eq current-article parent-article))
8434 (error "An article may not be self-referential"))
8435 (let ((message-id (mail-header-id
8436 (gnus-summary-article-header parent-article))))
8437 (unless (and message-id (not (equal message-id "")))
8438 (error "No message-id in desired parent"))
8439 (gnus-with-article current-article
8440 (goto-char (point-min))
8441 (if (re-search-forward "^References: " nil t)
8443 (re-search-forward "^[^ \t]" nil t)
8446 (insert " " message-id))
8447 (insert "References: " message-id "\n")))
8448 (set-buffer gnus-summary-buffer)
8449 (gnus-summary-unmark-all-processable)
8450 (gnus-summary-update-article current-article)
8451 (gnus-summary-rethread-current)
8452 (gnus-message 3 "Article %d is now the child of article %d"
8453 current-article parent-article)))))
8455 (defun gnus-summary-toggle-threads (&optional arg)
8456 "Toggle showing conversation threads.
8457 If ARG is positive number, turn showing conversation threads on."
8459 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8460 (setq gnus-show-threads
8461 (if (null arg) (not gnus-show-threads)
8462 (> (prefix-numeric-value arg) 0)))
8463 (gnus-summary-prepare)
8464 (gnus-summary-goto-subject current)
8465 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8466 (gnus-summary-position-point)))
8468 (defun gnus-summary-show-all-threads ()
8472 (let ((buffer-read-only nil))
8473 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8474 (gnus-summary-position-point))
8476 (defun gnus-summary-show-thread ()
8477 "Show thread subtrees.
8478 Returns nil if no thread was there to be shown."
8480 (let ((buffer-read-only nil)
8482 ;; first goto end then to beg, to have point at beg after let
8483 (end (progn (end-of-line) (point)))
8484 (beg (progn (beginning-of-line) (point))))
8486 ;; Any hidden lines here?
8487 (search-forward "\r" end t)
8488 (subst-char-in-region beg end ?\^M ?\n t)
8490 (gnus-summary-position-point))))
8492 (defun gnus-summary-hide-all-threads ()
8493 "Hide all thread subtrees."
8496 (goto-char (point-min))
8497 (gnus-summary-hide-thread)
8498 (while (zerop (gnus-summary-next-thread 1 t))
8499 (gnus-summary-hide-thread)))
8500 (gnus-summary-position-point))
8502 (defun gnus-summary-hide-thread ()
8503 "Hide thread subtrees.
8504 Returns nil if no threads were there to be hidden."
8506 (let ((buffer-read-only nil)
8508 (article (gnus-summary-article-number)))
8510 ;; Go forward until either the buffer ends or the subthread
8512 (when (and (not (eobp))
8513 (or (zerop (gnus-summary-next-thread 1 t))
8514 (goto-char (point-max))))
8516 (if (and (> (point) start)
8517 (search-backward "\n" start t))
8519 (subst-char-in-region start (point) ?\n ?\^M)
8520 (gnus-summary-goto-subject article))
8523 ;;(gnus-summary-position-point)
8526 (defun gnus-summary-go-to-next-thread (&optional previous)
8527 "Go to the same level (or less) next thread.
8528 If PREVIOUS is non-nil, go to previous thread instead.
8529 Return the article number moved to, or nil if moving was impossible."
8530 (let ((level (gnus-summary-thread-level))
8531 (way (if previous -1 1))
8534 (while (and (not (eobp))
8535 (< level (gnus-summary-thread-level)))
8543 (gnus-summary-article-number)
8546 (defun gnus-summary-next-thread (n &optional silent)
8547 "Go to the same level next N'th thread.
8548 If N is negative, search backward instead.
8549 Returns the difference between N and the number of skips actually
8552 If SILENT, don't output messages."
8554 (let ((backward (< n 0))
8557 (gnus-summary-go-to-next-thread backward))
8560 (gnus-summary-position-point))
8561 (when (and (not silent) (/= 0 n))
8562 (gnus-message 7 "No more threads"))
8565 (defun gnus-summary-prev-thread (n)
8566 "Go to the same level previous N'th thread.
8567 Returns the difference between N and the number of skips actually
8570 (gnus-summary-next-thread (- n)))
8572 (defun gnus-summary-go-down-thread ()
8573 "Go down one level in the current thread."
8574 (let ((children (gnus-summary-article-children)))
8576 (gnus-summary-goto-subject (car children)))))
8578 (defun gnus-summary-go-up-thread ()
8579 "Go up one level in the current thread."
8580 (let ((parent (gnus-summary-article-parent)))
8582 (gnus-summary-goto-subject parent))))
8584 (defun gnus-summary-down-thread (n)
8585 "Go down thread N steps.
8586 If N is negative, go up instead.
8587 Returns the difference between N and how many steps down that were
8593 (if up (gnus-summary-go-up-thread)
8594 (gnus-summary-go-down-thread)))
8596 (gnus-summary-position-point)
8598 (gnus-message 7 "Can't go further"))
8601 (defun gnus-summary-up-thread (n)
8602 "Go up thread N steps.
8603 If N is negative, go up instead.
8604 Returns the difference between N and how many steps down that were
8607 (gnus-summary-down-thread (- n)))
8609 (defun gnus-summary-top-thread ()
8610 "Go to the top of the thread."
8612 (while (gnus-summary-go-up-thread))
8613 (gnus-summary-article-number))
8615 (defun gnus-summary-kill-thread (&optional unmark)
8616 "Mark articles under current thread as read.
8617 If the prefix argument is positive, remove any kinds of marks.
8618 If the prefix argument is negative, tick articles instead."
8621 (setq unmark (prefix-numeric-value unmark)))
8622 (let ((articles (gnus-summary-articles-in-thread)))
8624 ;; Expand the thread.
8625 (gnus-summary-show-thread)
8626 ;; Mark all the articles.
8628 (gnus-summary-goto-subject (car articles))
8629 (cond ((null unmark)
8630 (gnus-summary-mark-article-as-read gnus-killed-mark))
8632 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8634 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8635 (setq articles (cdr articles))))
8636 ;; Hide killed subtrees.
8638 gnus-thread-hide-killed
8639 (gnus-summary-hide-thread))
8640 ;; If marked as read, go to next unread subject.
8642 ;; Go to next unread subject.
8643 (gnus-summary-next-subject 1 t)))
8644 (gnus-set-mode-line 'summary))
8646 ;; Summary sorting commands
8648 (defun gnus-summary-sort-by-number (&optional reverse)
8649 "Sort the summary buffer by article number.
8650 Argument REVERSE means reverse order."
8652 (gnus-summary-sort 'number reverse))
8654 (defun gnus-summary-sort-by-author (&optional reverse)
8655 "Sort the summary buffer by author name alphabetically.
8656 If case-fold-search is non-nil, case of letters is ignored.
8657 Argument REVERSE means reverse order."
8659 (gnus-summary-sort 'author reverse))
8661 (defun gnus-summary-sort-by-subject (&optional reverse)
8662 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8663 If case-fold-search is non-nil, case of letters is ignored.
8664 Argument REVERSE means reverse order."
8666 (gnus-summary-sort 'subject reverse))
8668 (defun gnus-summary-sort-by-date (&optional reverse)
8669 "Sort the summary buffer by date.
8670 Argument REVERSE means reverse order."
8672 (gnus-summary-sort 'date reverse))
8674 (defun gnus-summary-sort-by-score (&optional reverse)
8675 "Sort the summary buffer by score.
8676 Argument REVERSE means reverse order."
8678 (gnus-summary-sort 'score reverse))
8680 (defun gnus-summary-sort-by-lines (&optional reverse)
8681 "Sort the summary buffer by the number of lines.
8682 Argument REVERSE means reverse order."
8684 (gnus-summary-sort 'lines reverse))
8686 (defun gnus-summary-sort-by-chars (&optional reverse)
8687 "Sort the summary buffer by article length.
8688 Argument REVERSE means reverse order."
8690 (gnus-summary-sort 'chars reverse))
8692 (defun gnus-summary-sort (predicate reverse)
8693 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8694 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8695 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8696 (gnus-thread-sort-functions
8701 (gnus-article-sort-functions
8707 (gnus-summary-prepare-hook nil))
8708 ;; We do the sorting by regenerating the threads.
8709 (gnus-summary-prepare)
8710 ;; Hide subthreads if needed.
8711 (when (and gnus-show-threads gnus-thread-hide-subtree)
8712 (gnus-summary-hide-all-threads))))
8714 ;; Summary saving commands.
8716 (defun gnus-summary-save-article (&optional n not-saved)
8717 "Save the current article using the default saver function.
8718 If N is a positive number, save the N next articles.
8719 If N is a negative number, save the N previous articles.
8720 If N is nil and any articles have been marked with the process mark,
8721 save those articles instead.
8722 The variable `gnus-default-article-saver' specifies the saver function."
8724 (let* ((articles (gnus-summary-work-articles n))
8725 (save-buffer (save-excursion
8726 (nnheader-set-temp-buffer " *Gnus Save*")))
8727 (num (length articles))
8729 (dolist (article articles)
8730 (setq header (gnus-summary-article-header article))
8731 (if (not (vectorp header))
8732 ;; This is a pseudo-article.
8733 (if (assq 'name header)
8734 (gnus-copy-file (cdr (assq 'name header)))
8735 (gnus-message 1 "Article %d is unsaveable" article))
8736 ;; This is a real article.
8737 (save-window-excursion
8738 (gnus-summary-select-article t nil nil article))
8740 (set-buffer save-buffer)
8742 (insert-buffer-substring gnus-original-article-buffer))
8743 (setq file (gnus-article-save save-buffer file num))
8744 (gnus-summary-remove-process-mark article)
8746 (gnus-summary-set-saved-mark article))))
8747 (gnus-kill-buffer save-buffer)
8748 (gnus-summary-position-point)
8749 (gnus-set-mode-line 'summary)
8752 (defun gnus-summary-pipe-output (&optional arg)
8753 "Pipe the current article to a subprocess.
8754 If N is a positive number, pipe the N next articles.
8755 If N is a negative number, pipe the N previous articles.
8756 If N is nil and any articles have been marked with the process mark,
8757 pipe those articles instead."
8759 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8760 (gnus-summary-save-article arg t))
8761 (gnus-configure-windows 'pipe))
8763 (defun gnus-summary-save-article-mail (&optional arg)
8764 "Append the current article to an mail file.
8765 If N is a positive number, save the N next articles.
8766 If N is a negative number, save the N previous articles.
8767 If N is nil and any articles have been marked with the process mark,
8768 save those articles instead."
8770 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8771 (gnus-summary-save-article arg)))
8773 (defun gnus-summary-save-article-rmail (&optional arg)
8774 "Append the current article to an rmail file.
8775 If N is a positive number, save the N next articles.
8776 If N is a negative number, save the N previous articles.
8777 If N is nil and any articles have been marked with the process mark,
8778 save those articles instead."
8780 (let ((gnus-default-article-saver 'rmail-output-to-rmail-file))
8781 (gnus-summary-save-article arg)))
8783 (defun gnus-summary-save-article-file (&optional arg)
8784 "Append the current article to a file.
8785 If N is a positive number, save the N next articles.
8786 If N is a negative number, save the N previous articles.
8787 If N is nil and any articles have been marked with the process mark,
8788 save those articles instead."
8790 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8791 (gnus-summary-save-article arg)))
8793 (defun gnus-summary-write-article-file (&optional arg)
8794 "Write the current article to a file, deleting the previous file.
8795 If N is a positive number, save the N next articles.
8796 If N is a negative number, save the N previous articles.
8797 If N is nil and any articles have been marked with the process mark,
8798 save those articles instead."
8800 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8801 (gnus-summary-save-article arg)))
8803 (defun gnus-summary-save-article-body-file (&optional arg)
8804 "Append the current article body to a file.
8805 If N is a positive number, save the N next articles.
8806 If N is a negative number, save the N previous articles.
8807 If N is nil and any articles have been marked with the process mark,
8808 save those articles instead."
8810 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8811 (gnus-summary-save-article arg)))
8813 (defun gnus-summary-pipe-message (program)
8814 "Pipe the current article through PROGRAM."
8815 (interactive "sProgram: ")
8816 (gnus-summary-select-article)
8817 (let ((mail-header-separator ""))
8818 (gnus-eval-in-buffer-window gnus-article-buffer
8821 (let ((start (window-start))
8823 (message-pipe-buffer-body program)
8824 (set-window-start (get-buffer-window (current-buffer)) start))))))
8826 (defun gnus-get-split-value (methods)
8827 "Return a value based on the split METHODS."
8828 (let (split-name method result match)
8831 (set-buffer gnus-original-article-buffer)
8833 (nnheader-narrow-to-headers)
8835 (goto-char (point-min))
8836 (setq method (pop methods))
8837 (setq match (car method))
8840 ;; Regular expression.
8842 (re-search-forward match nil t)))
8843 ((gnus-functionp match)
8847 (setq result (funcall match gnus-newsgroup-name))))
8852 (setq result (eval match)))))
8853 (setq split-name (append (cdr method) split-name))
8854 (cond ((stringp result)
8855 (push (expand-file-name
8856 result gnus-article-save-directory)
8859 (setq split-name (append result split-name)))))))))
8860 (nreverse split-name)))
8862 (defun gnus-valid-move-group-p (group)
8865 (symbol-value group)
8866 (gnus-get-function (gnus-find-method-for-group
8867 (symbol-name group)) 'request-accept-article t)))
8869 (defun gnus-read-move-group-name (prompt default articles prefix)
8870 "Read a group name."
8871 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8872 (minibuffer-confirm-incomplete nil) ; XEmacs
8876 (if (> (length articles) 1)
8877 (format "these %d articles" (length articles))
8882 (gnus-completing-read default prom
8884 'gnus-valid-move-group-p
8886 'gnus-group-history))
8887 ((= 1 (length split-name))
8888 (gnus-completing-read (car split-name) prom
8890 'gnus-valid-move-group-p
8892 'gnus-group-history))
8894 (gnus-completing-read nil prom
8895 (mapcar (lambda (el) (list el))
8896 (nreverse split-name))
8898 'gnus-group-history)))))
8900 (if (or (string= to-newsgroup "")
8901 (string= to-newsgroup prefix))
8902 (setq to-newsgroup default))
8903 (unless to-newsgroup
8904 (error "No group name entered"))
8905 (or (gnus-active to-newsgroup)
8906 (gnus-activate-group to-newsgroup)
8907 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8909 (or (and (gnus-request-create-group
8910 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8911 (gnus-activate-group to-newsgroup nil nil
8912 (gnus-group-name-to-method
8914 (error "Couldn't create group %s" to-newsgroup)))
8915 (error "No such group: %s" to-newsgroup)))
8918 (defun gnus-summary-save-parts (type dir n reverse)
8919 "Save parts matching TYPE to DIR.
8920 If REVERSE, save parts that do not match TYPE."
8922 (list (read-string "Save parts of type: " "image/.*")
8923 (read-file-name "Save to directory: " t nil t)
8924 current-prefix-arg))
8925 (gnus-summary-iterate n
8926 (let ((gnus-display-mime-function nil)
8927 (gnus-inhibit-treatment t))
8928 (gnus-summary-select-article))
8930 (set-buffer gnus-article-buffer)
8931 (let ((handles (or (mm-dissect-buffer) (mm-uu-dissect))))
8933 (gnus-summary-save-parts-1 type dir handles reverse)
8934 (mm-destroy-parts handles))))))
8936 (defun gnus-summary-save-parts-1 (type dir handle reverse)
8937 (if (stringp (car handle))
8938 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
8941 (not (string-match type (car (mm-handle-type handle))))
8942 (string-match type (car (mm-handle-type handle))))
8943 (let ((file (expand-file-name
8944 (file-name-nondirectory
8946 (mail-content-type-get
8947 (mm-handle-disposition handle) 'filename)
8948 (concat gnus-newsgroup-name "." gnus-current-article)))
8950 (unless (file-exists-p file)
8951 (mm-save-part-to-file handle file))))))
8953 ;; Summary extract commands
8955 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8956 (let ((buffer-read-only nil)
8957 (article (gnus-summary-article-number))
8959 (unless (gnus-summary-goto-subject article)
8960 (error "No such article: %d" article))
8961 (gnus-summary-position-point)
8962 ;; If all commands are to be bunched up on one line, we collect
8964 (unless gnus-view-pseudos-separately
8965 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8968 (setq action (cdr (assq 'action (car ps))))
8969 (setq files (list (cdr (assq 'name (car ps)))))
8970 (while (and ps (cdr ps)
8971 (string= (or action "1")
8972 (or (cdr (assq 'action (cadr ps))) "2")))
8973 (push (cdr (assq 'name (cadr ps))) files)
8974 (setcdr ps (cddr ps)))
8976 (when (not (string-match "%s" action))
8979 (when (assq 'execute (car ps))
8980 (setcdr (assq 'execute (car ps))
8981 (funcall (if (string-match "%s" action)
8990 (setq ps (cdr ps)))))
8991 (if (and gnus-view-pseudos (not not-view))
8993 (when (assq 'execute (car pslist))
8994 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8995 (eq gnus-view-pseudos 'not-confirm)))
8996 (setq pslist (cdr pslist)))
8999 (setq after-article (or (cdr (assq 'article (car pslist)))
9000 (gnus-summary-article-number)))
9001 (gnus-summary-goto-subject after-article)
9004 (insert " " (file-name-nondirectory
9005 (cdr (assq 'name (car pslist))))
9006 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
9008 (forward-line -1) ; back to `b'
9009 (gnus-add-text-properties
9010 b (1- e) (list 'gnus-number gnus-reffed-article-number
9011 gnus-mouse-face-prop gnus-mouse-face))
9013 after-article gnus-reffed-article-number
9014 gnus-unread-mark b (car pslist) 0 (- e b))
9015 (push gnus-reffed-article-number gnus-newsgroup-unreads)
9016 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
9017 (setq pslist (cdr pslist)))))))
9019 (defun gnus-pseudos< (p1 p2)
9020 (let ((c1 (cdr (assq 'action p1)))
9021 (c2 (cdr (assq 'action p2))))
9022 (and c1 c2 (string< c1 c2))))
9024 (defun gnus-request-pseudo-article (props)
9025 (cond ((assq 'execute props)
9026 (gnus-execute-command (cdr (assq 'execute props)))))
9027 (let ((gnus-current-article (gnus-summary-article-number)))
9028 (gnus-run-hooks 'gnus-mark-article-hook)))
9030 (defun gnus-execute-command (command &optional automatic)
9032 (gnus-article-setup-buffer)
9033 (set-buffer gnus-article-buffer)
9034 (setq buffer-read-only nil)
9035 (let ((command (if automatic command
9036 (read-string "Command: " (cons command 0)))))
9038 (insert "$ " command "\n\n")
9039 (if gnus-view-pseudo-asynchronously
9040 (start-process "gnus-execute" (current-buffer) shell-file-name
9041 shell-command-switch command)
9042 (call-process shell-file-name nil t nil
9043 shell-command-switch command)))))
9045 ;; Summary kill commands.
9047 (defun gnus-summary-edit-global-kill (article)
9048 "Edit the \"global\" kill file."
9049 (interactive (list (gnus-summary-article-number)))
9050 (gnus-group-edit-global-kill article))
9052 (defun gnus-summary-edit-local-kill ()
9053 "Edit a local kill file applied to the current newsgroup."
9055 (setq gnus-current-headers (gnus-summary-article-header))
9056 (gnus-group-edit-local-kill
9057 (gnus-summary-article-number) gnus-newsgroup-name))
9061 (defun gnus-read-header (id &optional header)
9062 "Read the headers of article ID and enter them into the Gnus system."
9063 (let ((group gnus-newsgroup-name)
9064 (gnus-override-method
9065 (and (gnus-news-group-p gnus-newsgroup-name)
9066 gnus-refer-article-method))
9068 ;; First we check to see whether the header in question is already
9071 ;; This is a Message-ID.
9072 (setq header (or header (gnus-id-to-header id)))
9073 ;; This is an article number.
9074 (setq header (or header (gnus-summary-article-header id))))
9076 (not (gnus-summary-article-sparse-p (mail-header-number header))))
9077 ;; We have found the header.
9079 ;; If this is a sparse article, we have to nix out its
9080 ;; previous entry in the thread hashtb.
9082 (gnus-summary-article-sparse-p (mail-header-number header)))
9083 (let* ((parent (gnus-parent-id (mail-header-references header)))
9084 (thread (and parent (gnus-id-to-thread parent))))
9086 (delq (assq header thread) thread))))
9087 ;; We have to really fetch the header to this article.
9089 (set-buffer nntp-server-buffer)
9090 (when (setq where (gnus-request-head id group))
9091 (nnheader-fold-continuation-lines)
9092 (goto-char (point-max))
9094 (goto-char (point-min))
9098 ((cdr where) (cdr where))
9099 (header (mail-header-number header))
9100 (t gnus-reffed-article-number))
9102 (insert " Article retrieved.\n"))
9104 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
9105 () ; Malformed head.
9106 (unless (gnus-summary-article-sparse-p (mail-header-number header))
9107 (when (and (stringp id)
9108 (not (string= (gnus-group-real-name group)
9110 ;; If we fetched by Message-ID and the article came
9111 ;; from a different group, we fudge some bogus article
9112 ;; numbers for this article.
9113 (mail-header-set-number header gnus-reffed-article-number))
9115 (set-buffer gnus-summary-buffer)
9116 (decf gnus-reffed-article-number)
9117 (gnus-remove-header (mail-header-number header))
9118 (push header gnus-newsgroup-headers)
9119 (setq gnus-current-headers header)
9120 (push (mail-header-number header) gnus-newsgroup-limit)))
9123 (defun gnus-remove-header (number)
9124 "Remove header NUMBER from `gnus-newsgroup-headers'."
9125 (if (and gnus-newsgroup-headers
9126 (= number (mail-header-number (car gnus-newsgroup-headers))))
9127 (pop gnus-newsgroup-headers)
9128 (let ((headers gnus-newsgroup-headers))
9129 (while (and (cdr headers)
9130 (not (= number (mail-header-number (cadr headers)))))
9133 (setcdr headers (cddr headers))))))
9136 ;;; summary highlights
9139 (defun gnus-highlight-selected-summary ()
9140 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9141 ;; Highlight selected article in summary buffer
9142 (when gnus-summary-selected-face
9144 (let* ((beg (progn (beginning-of-line) (point)))
9145 (end (progn (end-of-line) (point)))
9146 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9147 (from (if (get-text-property beg gnus-mouse-face-prop)
9149 (or (next-single-property-change
9150 beg gnus-mouse-face-prop nil end)
9155 (or (next-single-property-change
9156 from gnus-mouse-face-prop nil end)
9158 ;; If no mouse-face prop on line we will have to = from = end,
9159 ;; so we highlight the entire line instead.
9160 (when (= (+ to 2) from)
9163 (if gnus-newsgroup-selected-overlay
9164 ;; Move old overlay.
9166 gnus-newsgroup-selected-overlay from to (current-buffer))
9167 ;; Create new overlay.
9169 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9170 'face gnus-summary-selected-face))))))
9172 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9173 (defun gnus-summary-highlight-line ()
9174 "Highlight current line according to `gnus-summary-highlight'."
9175 (let* ((list gnus-summary-highlight)
9177 (end (progn (end-of-line) (point)))
9178 ;; now find out where the line starts and leave point there.
9179 (beg (progn (beginning-of-line) (point)))
9180 (article (gnus-summary-article-number))
9181 (score (or (cdr (assq (or article gnus-current-article)
9182 gnus-newsgroup-scored))
9183 gnus-summary-default-score 0))
9184 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9185 (inhibit-read-only t))
9186 ;; Eval the cars of the lists until we find a match.
9187 (let ((default gnus-summary-default-score))
9189 (not (eval (caar list))))
9190 (setq list (cdr list))))
9191 (let ((face (cdar list)))
9192 (unless (eq face (get-text-property beg 'face))
9193 (gnus-put-text-property-excluding-characters-with-faces
9195 (setq face (if (boundp face) (symbol-value face) face)))
9196 (when gnus-summary-highlight-line-function
9197 (funcall gnus-summary-highlight-line-function article face))))
9200 (defun gnus-update-read-articles (group unread &optional compute)
9201 "Update the list of read articles in GROUP."
9202 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9203 (entry (gnus-gethash group gnus-newsrc-hashtb))
9204 (info (nth 2 entry))
9206 (unread (sort (copy-sequence unread) '<))
9208 (if (or (not info) (not active))
9209 ;; There is no info on this group if it was, in fact,
9210 ;; killed. Gnus stores no information on killed groups, so
9211 ;; there's nothing to be done.
9212 ;; One could store the information somewhere temporarily,
9213 ;; perhaps... Hmmm...
9215 ;; Remove any negative articles numbers.
9216 (while (and unread (< (car unread) 0))
9217 (setq unread (cdr unread)))
9218 ;; Remove any expired article numbers
9219 (while (and unread (< (car unread) (car active)))
9220 (setq unread (cdr unread)))
9221 ;; Compute the ranges of read articles by looking at the list of
9224 (when (/= (car unread) prev)
9225 (push (if (= prev (1- (car unread))) prev
9226 (cons prev (1- (car unread))))
9228 (setq prev (1+ (car unread)))
9229 (setq unread (cdr unread)))
9230 (when (<= prev (cdr active))
9231 (push (cons prev (cdr active)) read))
9232 (setq read (if (> (length read) 1) (nreverse read) read))
9236 (set-buffer gnus-group-buffer)
9239 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9240 (gnus-info-set-read ',info ',(gnus-info-read info))
9241 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9242 (gnus-group-update-group ,group t))))
9243 ;; Propagate the read marks to the backend.
9244 (if (gnus-check-backend-function 'request-set-mark group)
9245 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9246 (add (gnus-remove-from-range read (gnus-info-read info))))
9248 (unless (gnus-check-group group)
9249 (error "Can't open server for %s" group))
9250 (gnus-request-set-mark
9251 group (delq nil (list (if add (list add 'add '(read)))
9252 (if del (list del 'del '(read)))))))))
9253 ;; Enter this list into the group info.
9254 (gnus-info-set-read info read)
9255 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9256 (gnus-get-unread-articles-in-group info (gnus-active group))
9259 (defun gnus-offer-save-summaries ()
9260 "Offer to save all active summary buffers."
9262 (let ((buflist (buffer-list))
9264 ;; Go through all buffers and find all summaries.
9266 (and (setq bufname (buffer-name (car buflist)))
9267 (string-match "Summary" bufname)
9269 (set-buffer bufname)
9270 ;; We check that this is, indeed, a summary buffer.
9271 (and (eq major-mode 'gnus-summary-mode)
9272 ;; Also make sure this isn't bogus.
9273 gnus-newsgroup-prepared
9274 ;; Also make sure that this isn't a dead summary buffer.
9275 (not gnus-dead-summary-mode)))
9276 (push bufname buffers))
9277 (setq buflist (cdr buflist)))
9278 ;; Go through all these summary buffers and offer to save them.
9281 "Update summary buffer %s? "
9283 (switch-to-buffer buf)
9284 (gnus-summary-exit))
9287 (defun gnus-summary-setup-default-charset ()
9288 "Setup newsgroup default charset."
9289 (let* ((name (and gnus-newsgroup-name
9290 (gnus-group-real-name gnus-newsgroup-name)))
9292 (or gnus-newsgroup-ephemeral-ignored-charsets
9294 (and gnus-newsgroup-name
9295 (or (gnus-group-find-parameter gnus-newsgroup-name
9296 'ignored-charsets t)
9297 (let ((alist gnus-group-ignored-charsets-alist)
9298 elem (charsets nil))
9299 (while (setq elem (pop alist))
9301 (string-match (car elem) name))
9303 charsets (cdr elem))))
9305 gnus-newsgroup-ignored-charsets)))
9306 (setq gnus-newsgroup-charset
9307 (or gnus-newsgroup-ephemeral-charset
9308 (and gnus-newsgroup-name
9309 (or (gnus-group-find-parameter gnus-newsgroup-name
9311 (let ((alist gnus-group-charset-alist)
9313 (while (setq elem (pop alist))
9315 (string-match (car elem) name))
9317 charset (cadr elem))))
9319 gnus-default-charset))
9320 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
9327 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9328 "Display the current article buffer fully MIME-buttonized.
9329 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9330 treated as multipart/mixed."
9333 (let ((gnus-unbuttonized-mime-types nil)
9334 (gnus-mime-display-multipart-as-mixed show-all-parts))
9335 (gnus-summary-show-article)))
9337 (defun gnus-summary-repair-multipart (article)
9338 "Add a Content-Type header to a multipart article without one."
9339 (interactive (list (gnus-summary-article-number)))
9340 (gnus-with-article article
9341 (message-narrow-to-head)
9342 (goto-char (point-max))
9344 (when (search-forward "\n--" nil t)
9345 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9346 (message-narrow-to-head)
9347 (message-remove-header "Mime-Version")
9348 (message-remove-header "Content-Type")
9349 (goto-char (point-max))
9350 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9352 (insert "Mime-Version: 1.0\n")
9354 (let (gnus-mark-article-hook)
9355 (gnus-summary-select-article t t nil article)))
9357 (defun gnus-summary-toggle-display-buttonized ()
9358 "Toggle the buttonizing of the article buffer."
9361 (if (setq gnus-inhibit-mime-unbuttonizing
9362 (not gnus-inhibit-mime-unbuttonizing))
9363 (let ((gnus-unbuttonized-mime-types nil))
9364 (gnus-summary-show-article))
9365 (gnus-summary-show-article)))
9371 (defmacro gnus-with-article (article &rest forms)
9372 "Select ARTICLE and perform FORMS in the original article buffer.
9373 Then replace the article with the result."
9375 ;; We don't want the article to be marked as read.
9376 (let (gnus-mark-article-hook)
9377 (gnus-summary-select-article t t nil ,article))
9378 (set-buffer gnus-original-article-buffer)
9380 (if (not (gnus-check-backend-function
9381 'request-replace-article (car gnus-article-current)))
9382 (gnus-message 5 "Read-only group; not replacing")
9383 (unless (gnus-request-replace-article
9384 ,article (car gnus-article-current)
9386 (error "Couldn't replace article")))
9387 ;; The cache and backlog have to be flushed somewhat.
9388 (when gnus-keep-backlog
9389 (gnus-backlog-remove-article
9390 (car gnus-article-current) (cdr gnus-article-current)))
9391 (when gnus-use-cache
9392 (gnus-cache-update-article
9393 (car gnus-article-current) (cdr gnus-article-current)))))
9395 (put 'gnus-with-article 'lisp-indent-function 1)
9396 (put 'gnus-with-article 'edebug-form-spec '(form body))
9399 ;;; Generic summary marking commands
9402 (defvar gnus-summary-marking-alist
9403 '((read gnus-del-mark "d")
9404 (unread gnus-unread-mark "u")
9405 (ticked gnus-ticked-mark "!")
9406 (dormant gnus-dormant-mark "?")
9407 (expirable gnus-expirable-mark "e"))
9408 "An alist of names/marks/keystrokes.")
9410 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
9411 (defvar gnus-summary-mark-map)
9413 (defun gnus-summary-make-all-marking-commands ()
9414 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
9415 (dolist (elem gnus-summary-marking-alist)
9416 (apply 'gnus-summary-make-marking-command elem)))
9418 (defun gnus-summary-make-marking-command (name mark keystroke)
9419 (let ((map (make-sparse-keymap)))
9420 (define-key gnus-summary-generic-mark-map keystroke map)
9421 (dolist (lway `((next "next" next nil "n")
9422 (next-unread "next unread" next t "N")
9423 (prev "previous" prev nil "p")
9424 (prev-unread "previous unread" prev t "P")
9425 (nomove "" nil nil ,keystroke)))
9426 (let ((func (gnus-summary-make-marking-command-1
9427 mark (car lway) lway name)))
9428 (setq func (eval func))
9429 (define-key map (nth 4 lway) func)))))
9431 (defun gnus-summary-make-marking-command-1 (mark way lway name)
9433 (format "gnus-summary-put-mark-as-%s%s"
9434 name (if (eq way 'nomove)
9436 (concat "-" (symbol-name way)))))
9439 "Mark the current article as %s%s.
9440 If N, the prefix, then repeat N times.
9441 If N is negative, move in reverse order.
9442 The difference between N and the actual number of articles marked is
9446 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
9448 (defun gnus-summary-generic-mark (n mark move unread)
9449 "Mark N articles with MARK."
9450 (unless (eq major-mode 'gnus-summary-mode)
9451 (error "This command can only be used in the summary buffer"))
9452 (gnus-summary-show-thread)
9456 ((eq move 'prev) -1)
9462 nummove (* -1 nummove))))
9464 (gnus-summary-mark-article nil mark)
9465 (zerop (gnus-summary-next-subject nummove unread t)))
9468 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9469 (gnus-summary-recenter)
9470 (gnus-summary-position-point)
9471 (gnus-set-mode-line 'summary)
9474 (gnus-summary-make-all-marking-commands)
9480 (run-hooks 'gnus-sum-load-hook)
9482 ;;; gnus-sum.el ends here