1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97,98 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 ?
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 ?
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-view-pseudos nil
479 "*If `automatic', pseudo-articles will be viewed automatically.
480 If `not-confirm', pseudos will be viewed automatically, and the user
481 will not be asked to confirm the command."
482 :group 'gnus-extract-view
483 :type '(choice (const :tag "off" nil)
485 (const not-confirm)))
487 (defcustom gnus-view-pseudos-separately t
488 "*If non-nil, one pseudo-article will be created for each file to be viewed.
489 If nil, all files that use the same viewing command will be given as a
490 list of parameters to that command."
491 :group 'gnus-extract-view
494 (defcustom gnus-insert-pseudo-articles t
495 "*If non-nil, insert pseudo-articles when decoding articles."
496 :group 'gnus-extract-view
499 (defcustom gnus-summary-dummy-line-format
501 "*The format specification for the dummy roots in the summary buffer.
502 It works along the same lines as a normal formatting string,
503 with some simple extensions.
506 :group 'gnus-threading
509 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
510 "*The format specification for the summary mode line.
511 It works along the same lines as a normal formatting string,
512 with some simple extensions:
515 %p Unprefixed group name
516 %A Current article number
517 %z Current article score
519 %U Number of unread articles in the group
520 %e Number of unselected articles in the group
521 %Z A string with unread/unselected article counts
522 %g Shortish group name
523 %S Subject of the current article
525 %s Current score file name
526 %d Number of dormant articles
527 %r Number of articles that have been marked as read in this session
528 %E Number of articles expunged by the score files"
529 :group 'gnus-summary-format
532 (defcustom gnus-summary-mark-below 0
533 "*Mark all articles with a score below this variable as read.
534 This variable is local to each summary buffer and usually set by the
536 :group 'gnus-score-default
539 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
540 "*List of functions used for sorting articles in the summary buffer.
541 This variable is only used when not using a threaded display."
542 :group 'gnus-summary-sort
543 :type '(repeat (choice (function-item gnus-article-sort-by-number)
544 (function-item gnus-article-sort-by-author)
545 (function-item gnus-article-sort-by-subject)
546 (function-item gnus-article-sort-by-date)
547 (function-item gnus-article-sort-by-score)
548 (function :tag "other"))))
550 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
551 "*List of functions used for sorting threads in the summary buffer.
552 By default, threads are sorted by article number.
554 Each function takes two threads and return non-nil if the first thread
555 should be sorted before the other. If you use more than one function,
556 the primary sort function should be the last. You should probably
557 always include `gnus-thread-sort-by-number' in the list of sorting
558 functions -- preferably first.
560 Ready-made functions include `gnus-thread-sort-by-number',
561 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
562 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
563 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
564 :group 'gnus-summary-sort
565 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
566 (function-item gnus-thread-sort-by-author)
567 (function-item gnus-thread-sort-by-subject)
568 (function-item gnus-thread-sort-by-date)
569 (function-item gnus-thread-sort-by-score)
570 (function-item gnus-thread-sort-by-total-score)
571 (function :tag "other"))))
573 (defcustom gnus-thread-score-function '+
574 "*Function used for calculating the total score of a thread.
576 The function is called with the scores of the article and each
577 subthread and should then return the score of the thread.
579 Some functions you can use are `+', `max', or `min'."
580 :group 'gnus-summary-sort
583 (defcustom gnus-summary-expunge-below nil
584 "All articles that have a score less than this variable will be expunged.
585 This variable is local to the summary buffers."
586 :group 'gnus-score-default
587 :type '(choice (const :tag "off" nil)
590 (defcustom gnus-thread-expunge-below nil
591 "All threads that have a total score less than this variable will be expunged.
592 See `gnus-thread-score-function' for en explanation of what a
595 This variable is local to the summary buffers."
596 :group 'gnus-treading
597 :group 'gnus-score-default
598 :type '(choice (const :tag "off" nil)
601 (defcustom gnus-summary-mode-hook nil
602 "*A hook for Gnus summary mode.
603 This hook is run before any variables are set in the summary buffer."
604 :group 'gnus-summary-various
607 (defcustom gnus-summary-menu-hook nil
608 "*Hook run after the creation of the summary mode menu."
609 :group 'gnus-summary-visual
612 (defcustom gnus-summary-exit-hook nil
613 "*A hook called on exit from the summary buffer.
614 It will be called with point in the group buffer."
615 :group 'gnus-summary-exit
618 (defcustom gnus-summary-prepare-hook nil
619 "*A hook called after the summary buffer has been generated.
620 If you want to modify the summary buffer, you can use this hook."
621 :group 'gnus-summary-various
624 (defcustom gnus-summary-prepared-hook nil
625 "*A hook called as the last thing after the summary buffer has been generated."
626 :group 'gnus-summary-various
629 (defcustom gnus-summary-generate-hook nil
630 "*A hook run just before generating the summary buffer.
631 This hook is commonly used to customize threading variables and the
633 :group 'gnus-summary-various
636 (defcustom gnus-select-group-hook nil
637 "*A hook called when a newsgroup is selected.
639 If you'd like to simplify subjects like the
640 `gnus-summary-next-same-subject' command does, you can use the
643 (setq gnus-select-group-hook
646 (mapcar (lambda (header)
647 (mail-header-set-subject
649 (gnus-simplify-subject
650 (mail-header-subject header) 're-only)))
651 gnus-newsgroup-headers))))"
652 :group 'gnus-group-select
655 (defcustom gnus-select-article-hook nil
656 "*A hook called when an article is selected."
657 :group 'gnus-summary-choose
660 (defcustom gnus-visual-mark-article-hook
661 (list 'gnus-highlight-selected-summary)
662 "*Hook run after selecting an article in the summary buffer.
663 It is meant to be used for highlighting the article in some way. It
664 is not run if `gnus-visual' is nil."
665 :group 'gnus-summary-visual
668 (defcustom gnus-parse-headers-hook nil
669 "*A hook called before parsing the headers."
673 (defcustom gnus-exit-group-hook nil
674 "*A hook called when exiting (not quitting) summary mode."
678 (defcustom gnus-summary-update-hook
679 (list 'gnus-summary-highlight-line)
680 "*A hook called when a summary line is changed.
681 The hook will not be called if `gnus-visual' is nil.
683 The default function `gnus-summary-highlight-line' will
684 highlight the line according to the `gnus-summary-highlight'
686 :group 'gnus-summary-visual
689 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
690 "*A hook called when an article is selected for the first time.
691 The hook is intended to mark an article as read (or unread)
692 automatically when it is selected."
693 :group 'gnus-summary-choose
696 (defcustom gnus-group-no-more-groups-hook nil
697 "*A hook run when returning to group mode having no more (unread) groups."
698 :group 'gnus-group-select
701 (defcustom gnus-ps-print-hook nil
702 "*A hook run before ps-printing something from Gnus."
706 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
707 "Face used for highlighting the current article in the summary buffer."
708 :group 'gnus-summary-visual
711 (defcustom gnus-summary-highlight
712 '(((= mark gnus-canceled-mark)
713 . gnus-summary-cancelled-face)
714 ((and (> score default)
715 (or (= mark gnus-dormant-mark)
716 (= mark gnus-ticked-mark)))
717 . gnus-summary-high-ticked-face)
718 ((and (< score default)
719 (or (= mark gnus-dormant-mark)
720 (= mark gnus-ticked-mark)))
721 . gnus-summary-low-ticked-face)
722 ((or (= mark gnus-dormant-mark)
723 (= mark gnus-ticked-mark))
724 . gnus-summary-normal-ticked-face)
725 ((and (> score default) (= mark gnus-ancient-mark))
726 . gnus-summary-high-ancient-face)
727 ((and (< score default) (= mark gnus-ancient-mark))
728 . gnus-summary-low-ancient-face)
729 ((= mark gnus-ancient-mark)
730 . gnus-summary-normal-ancient-face)
731 ((and (> score default) (= mark gnus-unread-mark))
732 . gnus-summary-high-unread-face)
733 ((and (< score default) (= mark gnus-unread-mark))
734 . gnus-summary-low-unread-face)
735 ((= mark gnus-unread-mark)
736 . gnus-summary-normal-unread-face)
737 ((and (> score default) (memq mark (list gnus-downloadable-mark
738 gnus-undownloaded-mark)))
739 . gnus-summary-high-unread-face)
740 ((and (< score default) (memq mark (list gnus-downloadable-mark
741 gnus-undownloaded-mark)))
742 . gnus-summary-low-unread-face)
743 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
744 . gnus-summary-normal-unread-face)
746 . gnus-summary-high-read-face)
748 . gnus-summary-low-read-face)
750 . gnus-summary-normal-read-face))
751 "*Controls the highlighting of summary buffer lines.
753 A list of (FORM . FACE) pairs. When deciding how a a particular
754 summary line should be displayed, each form is evaluated. The content
755 of the face field after the first true form is used. You can change
756 how those summary lines are displayed, by editing the face field.
758 You can use the following variables in the FORM field.
760 score: The articles score
761 default: The default article score.
762 below: The score below which articles are automatically marked as read.
763 mark: The articles mark."
764 :group 'gnus-summary-visual
765 :type '(repeat (cons (sexp :tag "Form" nil)
768 (defcustom gnus-alter-header-function nil
769 "Function called to allow alteration of article header structures.
770 The function is called with one parameter, the article header vector,
771 which it may alter in any way.")
773 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
774 "Variable that says which function should be used to decode a string with encoded words.")
776 (defcustom gnus-extra-headers nil
777 "*Extra headers to parse."
779 :type '(repeat symbol))
781 (defcustom gnus-ignored-from-addresses
782 (and user-mail-address (regexp-quote user-mail-address))
783 "*Regexp of From headers that may be suppressed in favor of To headers."
787 ;;; Internal variables
789 (defvar gnus-article-mime-handles nil)
790 (defvar gnus-article-decoded-p nil)
791 (defvar gnus-scores-exclude-files nil)
792 (defvar gnus-page-broken nil)
794 (defvar gnus-original-article nil)
795 (defvar gnus-article-internal-prepare-hook nil)
796 (defvar gnus-newsgroup-process-stack nil)
798 (defvar gnus-thread-indent-array nil)
799 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
801 ;; Avoid highlighting in kill files.
802 (defvar gnus-summary-inhibit-highlight nil)
803 (defvar gnus-newsgroup-selected-overlay nil)
804 (defvar gnus-inhibit-limiting nil)
805 (defvar gnus-newsgroup-adaptive-score-file nil)
806 (defvar gnus-current-score-file nil)
807 (defvar gnus-current-move-group nil)
808 (defvar gnus-current-copy-group nil)
809 (defvar gnus-current-crosspost-group nil)
811 (defvar gnus-newsgroup-dependencies nil)
812 (defvar gnus-newsgroup-adaptive nil)
813 (defvar gnus-summary-display-article-function nil)
814 (defvar gnus-summary-highlight-line-function nil
815 "Function called after highlighting a summary line.")
817 (defvar gnus-summary-line-format-alist
818 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
819 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
820 (?s gnus-tmp-subject-or-nil ?s)
821 (?n gnus-tmp-name ?s)
822 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
824 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
826 (?F gnus-tmp-from ?s)
827 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
828 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
829 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
830 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
831 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
832 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
833 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
834 (?L gnus-tmp-lines ?d)
835 (?I gnus-tmp-indentation ?s)
836 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
837 (?R gnus-tmp-replied ?c)
838 (?\[ gnus-tmp-opening-bracket ?c)
839 (?\] gnus-tmp-closing-bracket ?c)
840 (?\> (make-string gnus-tmp-level ? ) ?s)
841 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
842 (?i gnus-tmp-score ?d)
843 (?z gnus-tmp-score-char ?c)
844 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
845 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
846 (?U gnus-tmp-unread ?c)
847 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
848 (?t (gnus-summary-number-of-articles-in-thread
849 (and (boundp 'thread) (car thread)) gnus-tmp-level)
851 (?e (gnus-summary-number-of-articles-in-thread
852 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
854 (?u gnus-tmp-user-defined ?s)
855 (?P (gnus-pick-line-number) ?d))
856 "An alist of format specifications that can appear in summary lines,
857 and what variables they correspond with, along with the type of the
858 variable (string, integer, character, etc).")
860 (defvar gnus-summary-dummy-line-format-alist
861 `((?S gnus-tmp-subject ?s)
862 (?N gnus-tmp-number ?d)
863 (?u gnus-tmp-user-defined ?s)))
865 (defvar gnus-summary-mode-line-format-alist
866 `((?G gnus-tmp-group-name ?s)
867 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
868 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
869 (?A gnus-tmp-article-number ?d)
870 (?Z gnus-tmp-unread-and-unselected ?s)
872 (?U gnus-tmp-unread-and-unticked ?d)
873 (?S gnus-tmp-subject ?s)
874 (?e gnus-tmp-unselected ?d)
875 (?u gnus-tmp-user-defined ?s)
876 (?d (length gnus-newsgroup-dormant) ?d)
877 (?t (length gnus-newsgroup-marked) ?d)
878 (?r (length gnus-newsgroup-reads) ?d)
879 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
880 (?E gnus-newsgroup-expunged-tally ?d)
881 (?s (gnus-current-score-file-nondirectory) ?s)))
883 (defvar gnus-last-search-regexp nil
884 "Default regexp for article search command.")
886 (defvar gnus-last-shell-command nil
887 "Default shell command on article.")
889 (defvar gnus-newsgroup-begin nil)
890 (defvar gnus-newsgroup-end nil)
891 (defvar gnus-newsgroup-last-rmail nil)
892 (defvar gnus-newsgroup-last-mail nil)
893 (defvar gnus-newsgroup-last-folder nil)
894 (defvar gnus-newsgroup-last-file nil)
895 (defvar gnus-newsgroup-auto-expire nil)
896 (defvar gnus-newsgroup-active nil)
898 (defvar gnus-newsgroup-data nil)
899 (defvar gnus-newsgroup-data-reverse nil)
900 (defvar gnus-newsgroup-limit nil)
901 (defvar gnus-newsgroup-limits nil)
903 (defvar gnus-newsgroup-unreads nil
904 "List of unread articles in the current newsgroup.")
906 (defvar gnus-newsgroup-unselected nil
907 "List of unselected unread articles in the current newsgroup.")
909 (defvar gnus-newsgroup-reads nil
910 "Alist of read articles and article marks in the current newsgroup.")
912 (defvar gnus-newsgroup-expunged-tally nil)
914 (defvar gnus-newsgroup-marked nil
915 "List of ticked articles in the current newsgroup (a subset of unread art).")
917 (defvar gnus-newsgroup-killed nil
918 "List of ranges of articles that have been through the scoring process.")
920 (defvar gnus-newsgroup-cached nil
921 "List of articles that come from the article cache.")
923 (defvar gnus-newsgroup-saved nil
924 "List of articles that have been saved.")
926 (defvar gnus-newsgroup-kill-headers nil)
928 (defvar gnus-newsgroup-replied nil
929 "List of articles that have been replied to in the current newsgroup.")
931 (defvar gnus-newsgroup-expirable nil
932 "List of articles in the current newsgroup that can be expired.")
934 (defvar gnus-newsgroup-processable nil
935 "List of articles in the current newsgroup that can be processed.")
937 (defvar gnus-newsgroup-downloadable nil
938 "List of articles in the current newsgroup that can be processed.")
940 (defvar gnus-newsgroup-undownloaded nil
941 "List of articles in the current newsgroup that haven't been downloaded..")
943 (defvar gnus-newsgroup-unsendable nil
944 "List of articles in the current newsgroup that won't be sent.")
946 (defvar gnus-newsgroup-bookmarks nil
947 "List of articles in the current newsgroup that have bookmarks.")
949 (defvar gnus-newsgroup-dormant nil
950 "List of dormant articles in the current newsgroup.")
952 (defvar gnus-newsgroup-scored nil
953 "List of scored articles in the current newsgroup.")
955 (defvar gnus-newsgroup-headers nil
956 "List of article headers in the current newsgroup.")
958 (defvar gnus-newsgroup-threads nil)
960 (defvar gnus-newsgroup-prepared nil
961 "Whether the current group has been prepared properly.")
963 (defvar gnus-newsgroup-ancient nil
964 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
966 (defvar gnus-newsgroup-sparse nil)
968 (defvar gnus-current-article nil)
969 (defvar gnus-article-current nil)
970 (defvar gnus-current-headers nil)
971 (defvar gnus-have-all-headers nil)
972 (defvar gnus-last-article nil)
973 (defvar gnus-newsgroup-history nil)
975 (defconst gnus-summary-local-variables
976 '(gnus-newsgroup-name
977 gnus-newsgroup-begin gnus-newsgroup-end
978 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
979 gnus-newsgroup-last-folder gnus-newsgroup-last-file
980 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
981 gnus-newsgroup-unselected gnus-newsgroup-marked
982 gnus-newsgroup-reads gnus-newsgroup-saved
983 gnus-newsgroup-replied gnus-newsgroup-expirable
984 gnus-newsgroup-processable gnus-newsgroup-killed
985 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
986 gnus-newsgroup-unsendable
987 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
988 gnus-newsgroup-headers gnus-newsgroup-threads
989 gnus-newsgroup-prepared gnus-summary-highlight-line-function
990 gnus-current-article gnus-current-headers gnus-have-all-headers
991 gnus-last-article gnus-article-internal-prepare-hook
992 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
993 gnus-newsgroup-scored gnus-newsgroup-kill-headers
994 gnus-thread-expunge-below
995 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
996 (gnus-summary-mark-below . global)
997 gnus-newsgroup-active gnus-scores-exclude-files
998 gnus-newsgroup-history gnus-newsgroup-ancient
999 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1000 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1001 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1002 (gnus-newsgroup-expunged-tally . 0)
1003 gnus-cache-removable-articles gnus-newsgroup-cached
1004 gnus-newsgroup-data gnus-newsgroup-data-reverse
1005 gnus-newsgroup-limit gnus-newsgroup-limits)
1006 "Variables that are buffer-local to the summary buffers.")
1008 ;; Byte-compiler warning.
1009 (defvar gnus-article-mode-map)
1013 (defvar gnus-decode-encoded-word-methods
1014 '(mail-decode-encoded-word-string)
1015 "List of methods used to decode encoded words.
1017 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1018 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1019 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1020 whose names match REGEXP.
1023 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1024 mail-decode-encoded-word-string
1025 (\"chinese\" . rfc1843-decode-string))
1028 (defvar gnus-decode-encoded-word-methods-cache nil)
1030 (defun gnus-multi-decode-encoded-word-string (string)
1031 "Apply the functions from `gnus-encoded-word-methods' that match."
1032 (unless (and gnus-decode-encoded-word-methods-cache
1033 (eq gnus-newsgroup-name
1034 (car gnus-decode-encoded-word-methods-cache)))
1035 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1038 (nconc gnus-decode-encoded-word-methods-cache (list x))
1039 (if (and gnus-newsgroup-name
1040 (string-match (car x) gnus-newsgroup-name))
1041 (nconc gnus-decode-encoded-word-methods-cache
1043 gnus-decode-encoded-word-methods))
1044 (let ((xlist gnus-decode-encoded-word-methods-cache))
1047 (setq string (funcall (pop xlist) string))))
1050 ;; Subject simplification.
1052 (defun gnus-simplify-whitespace (str)
1053 "Remove excessive whitespace."
1056 (while (string-match "[ \t][ \t]+" mystr)
1057 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1059 (substring mystr (match-end 0)))))
1061 (when (string-match "^[ \t]+" mystr)
1062 (setq mystr (substring mystr (match-end 0))))
1064 (when (string-match "[ \t]+$" mystr)
1065 (setq mystr (substring mystr 0 (match-beginning 0))))
1068 (defsubst gnus-simplify-subject-re (subject)
1069 "Remove \"Re:\" from subject lines."
1070 (if (string-match "^[Rr][Ee]: *" subject)
1071 (substring subject (match-end 0))
1074 (defun gnus-simplify-subject (subject &optional re-only)
1075 "Remove `Re:' and words in parentheses.
1076 If RE-ONLY is non-nil, strip leading `Re:'s only."
1077 (let ((case-fold-search t)) ;Ignore case.
1078 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1079 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1080 (setq subject (substring subject (match-end 0))))
1081 ;; Remove uninteresting prefixes.
1082 (when (and (not re-only)
1083 gnus-simplify-ignored-prefixes
1084 (string-match gnus-simplify-ignored-prefixes subject))
1085 (setq subject (substring subject (match-end 0))))
1086 ;; Remove words in parentheses from end.
1088 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1089 (setq subject (substring subject 0 (match-beginning 0)))))
1090 ;; Return subject string.
1093 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1095 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1096 (goto-char (point-min))
1097 (while (re-search-forward regexp nil t)
1098 (replace-match (or newtext ""))))
1100 (defun gnus-simplify-buffer-fuzzy ()
1101 "Simplify string in the buffer fuzzily.
1102 The string in the accessible portion of the current buffer is simplified.
1103 It is assumed to be a single-line subject.
1104 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1105 matter is removed. Additional things can be deleted by setting
1106 gnus-simplify-subject-fuzzy-regexp."
1107 (let ((case-fold-search t)
1109 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1111 (while (not (eq modified-tick (buffer-modified-tick)))
1112 (setq modified-tick (buffer-modified-tick))
1114 ((listp gnus-simplify-subject-fuzzy-regexp)
1115 (mapcar 'gnus-simplify-buffer-fuzzy-step
1116 gnus-simplify-subject-fuzzy-regexp))
1117 (gnus-simplify-subject-fuzzy-regexp
1118 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1119 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1120 (gnus-simplify-buffer-fuzzy-step
1121 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1122 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1124 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1125 (gnus-simplify-buffer-fuzzy-step " +" " ")
1126 (gnus-simplify-buffer-fuzzy-step " $")
1127 (gnus-simplify-buffer-fuzzy-step "^ +")))
1129 (defun gnus-simplify-subject-fuzzy (subject)
1130 "Simplify a subject string fuzzily.
1131 See `gnus-simplify-buffer-fuzzy' for details."
1133 (gnus-set-work-buffer)
1134 (let ((case-fold-search t))
1135 ;; Remove uninteresting prefixes.
1136 (when (and gnus-simplify-ignored-prefixes
1137 (string-match gnus-simplify-ignored-prefixes subject))
1138 (setq subject (substring subject (match-end 0))))
1140 (inline (gnus-simplify-buffer-fuzzy))
1143 (defsubst gnus-simplify-subject-fully (subject)
1144 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1146 (gnus-simplify-subject-functions
1147 (gnus-map-function gnus-simplify-subject-functions subject))
1148 ((null gnus-summary-gather-subject-limit)
1149 (gnus-simplify-subject-re subject))
1150 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1151 (gnus-simplify-subject-fuzzy subject))
1152 ((numberp gnus-summary-gather-subject-limit)
1153 (gnus-limit-string (gnus-simplify-subject-re subject)
1154 gnus-summary-gather-subject-limit))
1158 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1159 "Check whether two subjects are equal.
1160 If optional argument simple-first is t, first argument is already
1163 ((null simple-first)
1164 (equal (gnus-simplify-subject-fully s1)
1165 (gnus-simplify-subject-fully s2)))
1168 (gnus-simplify-subject-fully s2)))))
1170 (defun gnus-summary-bubble-group ()
1171 "Increase the score of the current group.
1172 This is a handy function to add to `gnus-summary-exit-hook' to
1173 increase the score of each group you read."
1174 (gnus-group-add-score gnus-newsgroup-name))
1178 ;;; Gnus summary mode
1181 (put 'gnus-summary-mode 'mode-class 'special)
1184 ;; Non-orthogonal keys
1186 (gnus-define-keys gnus-summary-mode-map
1187 " " gnus-summary-next-page
1188 "\177" gnus-summary-prev-page
1189 [delete] gnus-summary-prev-page
1190 [backspace] gnus-summary-prev-page
1191 "\r" gnus-summary-scroll-up
1192 "\M-\r" gnus-summary-scroll-down
1193 "n" gnus-summary-next-unread-article
1194 "p" gnus-summary-prev-unread-article
1195 "N" gnus-summary-next-article
1196 "P" gnus-summary-prev-article
1197 "\M-\C-n" gnus-summary-next-same-subject
1198 "\M-\C-p" gnus-summary-prev-same-subject
1199 "\M-n" gnus-summary-next-unread-subject
1200 "\M-p" gnus-summary-prev-unread-subject
1201 "." gnus-summary-first-unread-article
1202 "," gnus-summary-best-unread-article
1203 "\M-s" gnus-summary-search-article-forward
1204 "\M-r" gnus-summary-search-article-backward
1205 "<" gnus-summary-beginning-of-article
1206 ">" gnus-summary-end-of-article
1207 "j" gnus-summary-goto-article
1208 "^" gnus-summary-refer-parent-article
1209 "\M-^" gnus-summary-refer-article
1210 "u" gnus-summary-tick-article-forward
1211 "!" gnus-summary-tick-article-forward
1212 "U" gnus-summary-tick-article-backward
1213 "d" gnus-summary-mark-as-read-forward
1214 "D" gnus-summary-mark-as-read-backward
1215 "E" gnus-summary-mark-as-expirable
1216 "\M-u" gnus-summary-clear-mark-forward
1217 "\M-U" gnus-summary-clear-mark-backward
1218 "k" gnus-summary-kill-same-subject-and-select
1219 "\C-k" gnus-summary-kill-same-subject
1220 "\M-\C-k" gnus-summary-kill-thread
1221 "\M-\C-l" gnus-summary-lower-thread
1222 "e" gnus-summary-edit-article
1223 "#" gnus-summary-mark-as-processable
1224 "\M-#" gnus-summary-unmark-as-processable
1225 "\M-\C-t" gnus-summary-toggle-threads
1226 "\M-\C-s" gnus-summary-show-thread
1227 "\M-\C-h" gnus-summary-hide-thread
1228 "\M-\C-f" gnus-summary-next-thread
1229 "\M-\C-b" gnus-summary-prev-thread
1230 "\M-\C-u" gnus-summary-up-thread
1231 "\M-\C-d" gnus-summary-down-thread
1232 "&" gnus-summary-execute-command
1233 "c" gnus-summary-catchup-and-exit
1234 "\C-w" gnus-summary-mark-region-as-read
1235 "\C-t" gnus-summary-toggle-truncation
1236 "?" gnus-summary-mark-as-dormant
1237 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1238 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1239 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1240 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1241 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1242 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1243 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1244 "=" gnus-summary-expand-window
1245 "\C-x\C-s" gnus-summary-reselect-current-group
1246 "\M-g" gnus-summary-rescan-group
1247 "w" gnus-summary-stop-page-breaking
1248 "\C-c\C-r" gnus-summary-caesar-message
1249 "f" gnus-summary-followup
1250 "F" gnus-summary-followup-with-original
1251 "C" gnus-summary-cancel-article
1252 "r" gnus-summary-reply
1253 "R" gnus-summary-reply-with-original
1254 "\C-c\C-f" gnus-summary-mail-forward
1255 "o" gnus-summary-save-article
1256 "\C-o" gnus-summary-save-article-mail
1257 "|" gnus-summary-pipe-output
1258 "\M-k" gnus-summary-edit-local-kill
1259 "\M-K" gnus-summary-edit-global-kill
1261 "\C-c\C-d" gnus-summary-describe-group
1262 "q" gnus-summary-exit
1263 "Q" gnus-summary-exit-no-update
1264 "\C-c\C-i" gnus-info-find-node
1265 gnus-mouse-2 gnus-mouse-pick-article
1266 "m" gnus-summary-mail-other-window
1267 "a" gnus-summary-post-news
1268 "x" gnus-summary-limit-to-unread
1269 "s" gnus-summary-isearch-article
1270 "t" gnus-article-hide-headers
1271 "g" gnus-summary-show-article
1272 "l" gnus-summary-goto-last-article
1273 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1274 "\C-d" gnus-summary-enter-digest-group
1275 "\M-\C-d" gnus-summary-read-document
1276 "\M-\C-e" gnus-summary-edit-parameters
1278 "*" gnus-cache-enter-article
1279 "\M-*" gnus-cache-remove-article
1280 "\M-&" gnus-summary-universal-argument
1281 "\C-l" gnus-recenter
1282 "I" gnus-summary-increase-score
1283 "L" gnus-summary-lower-score
1284 "\M-i" gnus-symbolic-argument
1285 "h" gnus-summary-select-article-buffer
1286 "b" gnus-article-view-part
1288 "V" gnus-summary-score-map
1289 "X" gnus-uu-extract-map
1290 "S" gnus-summary-send-map)
1292 ;; Sort of orthogonal keymap
1293 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1294 "t" gnus-summary-tick-article-forward
1295 "!" gnus-summary-tick-article-forward
1296 "d" gnus-summary-mark-as-read-forward
1297 "r" gnus-summary-mark-as-read-forward
1298 "c" gnus-summary-clear-mark-forward
1299 " " gnus-summary-clear-mark-forward
1300 "e" gnus-summary-mark-as-expirable
1301 "x" gnus-summary-mark-as-expirable
1302 "?" gnus-summary-mark-as-dormant
1303 "b" gnus-summary-set-bookmark
1304 "B" gnus-summary-remove-bookmark
1305 "#" gnus-summary-mark-as-processable
1306 "\M-#" gnus-summary-unmark-as-processable
1307 "S" gnus-summary-limit-include-expunged
1308 "C" gnus-summary-catchup
1309 "H" gnus-summary-catchup-to-here
1310 "\C-c" gnus-summary-catchup-all
1311 "k" gnus-summary-kill-same-subject-and-select
1312 "K" gnus-summary-kill-same-subject
1313 "P" gnus-uu-mark-map)
1315 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1316 "c" gnus-summary-clear-above
1317 "u" gnus-summary-tick-above
1318 "m" gnus-summary-mark-above
1319 "k" gnus-summary-kill-below)
1321 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1322 "/" gnus-summary-limit-to-subject
1323 "n" gnus-summary-limit-to-articles
1324 "w" gnus-summary-pop-limit
1325 "s" gnus-summary-limit-to-subject
1326 "a" gnus-summary-limit-to-author
1327 "u" gnus-summary-limit-to-unread
1328 "m" gnus-summary-limit-to-marks
1329 "v" gnus-summary-limit-to-score
1330 "*" gnus-summary-limit-include-cached
1331 "D" gnus-summary-limit-include-dormant
1332 "T" gnus-summary-limit-include-thread
1333 "d" gnus-summary-limit-exclude-dormant
1334 "t" gnus-summary-limit-to-age
1335 "E" gnus-summary-limit-include-expunged
1336 "c" gnus-summary-limit-exclude-childless-dormant
1337 "C" gnus-summary-limit-mark-excluded-as-read)
1339 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1340 "n" gnus-summary-next-unread-article
1341 "p" gnus-summary-prev-unread-article
1342 "N" gnus-summary-next-article
1343 "P" gnus-summary-prev-article
1344 "\C-n" gnus-summary-next-same-subject
1345 "\C-p" gnus-summary-prev-same-subject
1346 "\M-n" gnus-summary-next-unread-subject
1347 "\M-p" gnus-summary-prev-unread-subject
1348 "f" gnus-summary-first-unread-article
1349 "b" gnus-summary-best-unread-article
1350 "j" gnus-summary-goto-article
1351 "g" gnus-summary-goto-subject
1352 "l" gnus-summary-goto-last-article
1353 "o" gnus-summary-pop-article)
1355 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1356 "k" gnus-summary-kill-thread
1357 "l" gnus-summary-lower-thread
1358 "i" gnus-summary-raise-thread
1359 "T" gnus-summary-toggle-threads
1360 "t" gnus-summary-rethread-current
1361 "^" gnus-summary-reparent-thread
1362 "s" gnus-summary-show-thread
1363 "S" gnus-summary-show-all-threads
1364 "h" gnus-summary-hide-thread
1365 "H" gnus-summary-hide-all-threads
1366 "n" gnus-summary-next-thread
1367 "p" gnus-summary-prev-thread
1368 "u" gnus-summary-up-thread
1369 "o" gnus-summary-top-thread
1370 "d" gnus-summary-down-thread
1371 "#" gnus-uu-mark-thread
1372 "\M-#" gnus-uu-unmark-thread)
1374 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1375 "g" gnus-summary-prepare
1376 "c" gnus-summary-insert-cached-articles)
1378 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1379 "c" gnus-summary-catchup-and-exit
1380 "C" gnus-summary-catchup-all-and-exit
1381 "E" gnus-summary-exit-no-update
1382 "Q" gnus-summary-exit
1383 "Z" gnus-summary-exit
1384 "n" gnus-summary-catchup-and-goto-next-group
1385 "R" gnus-summary-reselect-current-group
1386 "G" gnus-summary-rescan-group
1387 "N" gnus-summary-next-group
1388 "s" gnus-summary-save-newsrc
1389 "P" gnus-summary-prev-group)
1391 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1392 " " gnus-summary-next-page
1393 "n" gnus-summary-next-page
1394 "\177" gnus-summary-prev-page
1395 [delete] gnus-summary-prev-page
1396 "p" gnus-summary-prev-page
1397 "\r" gnus-summary-scroll-up
1398 "\M-\r" gnus-summary-scroll-down
1399 "<" gnus-summary-beginning-of-article
1400 ">" gnus-summary-end-of-article
1401 "b" gnus-summary-beginning-of-article
1402 "e" gnus-summary-end-of-article
1403 "^" gnus-summary-refer-parent-article
1404 "r" gnus-summary-refer-parent-article
1405 "R" gnus-summary-refer-references
1406 "T" gnus-summary-refer-thread
1407 "g" gnus-summary-show-article
1408 "s" gnus-summary-isearch-article
1409 "P" gnus-summary-print-article)
1411 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1412 "b" gnus-article-add-buttons
1413 "B" gnus-article-add-buttons-to-head
1414 "o" gnus-article-treat-overstrike
1415 "e" gnus-article-emphasize
1416 "w" gnus-article-fill-cited-article
1417 "c" gnus-article-remove-cr
1418 "q" gnus-article-de-quoted-unreadable
1419 "f" gnus-article-display-x-face
1420 "l" gnus-summary-stop-page-breaking
1421 "r" gnus-summary-caesar-message
1422 "t" gnus-article-hide-headers
1423 "v" gnus-summary-verbose-headers
1424 "h" gnus-article-treat-html
1425 "d" gnus-article-treat-dumbquotes)
1427 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1428 "a" gnus-article-hide
1429 "h" gnus-article-hide-headers
1430 "b" gnus-article-hide-boring-headers
1431 "s" gnus-article-hide-signature
1432 "c" gnus-article-hide-citation
1433 "C" gnus-article-hide-citation-in-followups
1434 "p" gnus-article-hide-pgp
1435 "P" gnus-article-hide-pem
1436 "\C-c" gnus-article-hide-citation-maybe)
1438 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1439 "a" gnus-article-highlight
1440 "h" gnus-article-highlight-headers
1441 "c" gnus-article-highlight-citation
1442 "s" gnus-article-highlight-signature)
1444 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1445 "w" gnus-article-decode-mime-words
1446 "c" gnus-article-decode-charset
1447 "v" gnus-mime-view-all-parts
1448 "b" gnus-article-view-part)
1450 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1451 "z" gnus-article-date-ut
1452 "u" gnus-article-date-ut
1453 "l" gnus-article-date-local
1454 "e" gnus-article-date-lapsed
1455 "o" gnus-article-date-original
1456 "i" gnus-article-date-iso8601
1457 "s" gnus-article-date-user)
1459 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1460 "t" gnus-article-remove-trailing-blank-lines
1461 "l" gnus-article-strip-leading-blank-lines
1462 "m" gnus-article-strip-multiple-blank-lines
1463 "a" gnus-article-strip-blank-lines
1464 "A" gnus-article-strip-all-blank-lines
1465 "s" gnus-article-strip-leading-space)
1467 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1469 "f" gnus-summary-fetch-faq
1470 "d" gnus-summary-describe-group
1471 "h" gnus-summary-describe-briefly
1472 "i" gnus-info-find-node)
1474 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1475 "e" gnus-summary-expire-articles
1476 "\M-\C-e" gnus-summary-expire-articles-now
1477 "\177" gnus-summary-delete-article
1478 [delete] gnus-summary-delete-article
1479 "m" gnus-summary-move-article
1480 "r" gnus-summary-respool-article
1481 "w" gnus-summary-edit-article
1482 "c" gnus-summary-copy-article
1483 "B" gnus-summary-crosspost-article
1484 "q" gnus-summary-respool-query
1485 "t" gnus-summary-respool-trace
1486 "i" gnus-summary-import-article
1487 "p" gnus-summary-article-posted-p)
1489 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1490 "o" gnus-summary-save-article
1491 "m" gnus-summary-save-article-mail
1492 "F" gnus-summary-write-article-file
1493 "r" gnus-summary-save-article-rmail
1494 "f" gnus-summary-save-article-file
1495 "b" gnus-summary-save-article-body-file
1496 "h" gnus-summary-save-article-folder
1497 "v" gnus-summary-save-article-vm
1498 "p" gnus-summary-pipe-output
1499 "s" gnus-soup-add-article))
1501 (defun gnus-summary-make-menu-bar ()
1502 (gnus-turn-off-edit-menu 'summary)
1504 (unless (boundp 'gnus-summary-misc-menu)
1507 gnus-summary-kill-menu gnus-summary-mode-map ""
1512 ["Enter score..." gnus-summary-score-entry t]
1513 ["Customize" gnus-score-customize t])
1514 (gnus-make-score-map 'increase)
1515 (gnus-make-score-map 'lower)
1517 ["Kill below" gnus-summary-kill-below t]
1518 ["Mark above" gnus-summary-mark-above t]
1519 ["Tick above" gnus-summary-tick-above t]
1520 ["Clear above" gnus-summary-clear-above t])
1521 ["Current score" gnus-summary-current-score t]
1522 ["Set score" gnus-summary-set-score t]
1523 ["Switch current score file..." gnus-score-change-score-file t]
1524 ["Set mark below..." gnus-score-set-mark-below t]
1525 ["Set expunge below..." gnus-score-set-expunge-below t]
1526 ["Edit current score file" gnus-score-edit-current-scores t]
1527 ["Edit score file" gnus-score-edit-file t]
1528 ["Trace score" gnus-score-find-trace t]
1529 ["Find words" gnus-score-find-favourite-words t]
1530 ["Rescore buffer" gnus-summary-rescore t]
1531 ["Increase score..." gnus-summary-increase-score t]
1532 ["Lower score..." gnus-summary-lower-score t]))))
1534 ;; Define both the Article menu in the summary buffer and the equivalent
1535 ;; Commands menu in the article buffer here for consistency.
1538 ["All" gnus-article-hide t]
1539 ["Headers" gnus-article-hide-headers t]
1540 ["Signature" gnus-article-hide-signature t]
1541 ["Citation" gnus-article-hide-citation t]
1542 ["PGP" gnus-article-hide-pgp t]
1543 ["Boring headers" gnus-article-hide-boring-headers t])
1545 ["All" gnus-article-highlight t]
1546 ["Headers" gnus-article-highlight-headers t]
1547 ["Signature" gnus-article-highlight-signature t]
1548 ["Citation" gnus-article-highlight-citation t])
1550 ["Words" gnus-article-decode-mime-words t]
1551 ["Charset" gnus-article-decode-charset t]
1552 ["QP" gnus-article-de-quoted-unreadable t]
1553 ["View all" gnus-mime-view-all-parts t])
1555 ["Local" gnus-article-date-local t]
1556 ["ISO8601" gnus-article-date-iso8601 t]
1557 ["UT" gnus-article-date-ut t]
1558 ["Original" gnus-article-date-original t]
1559 ["Lapsed" gnus-article-date-lapsed t]
1560 ["User-defined" gnus-article-date-user t])
1563 ["Leading" gnus-article-strip-leading-blank-lines t]
1564 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1565 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1566 ["All of the above" gnus-article-strip-blank-lines t]
1567 ["All" gnus-article-strip-all-blank-lines t]
1568 ["Leading space" gnus-article-strip-leading-space t])
1569 ["Overstrike" gnus-article-treat-overstrike t]
1570 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1571 ["Emphasis" gnus-article-emphasize t]
1572 ["Word wrap" gnus-article-fill-cited-article t]
1573 ["CR" gnus-article-remove-cr t]
1574 ["Show X-Face" gnus-article-display-x-face t]
1575 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1576 ["UnHTMLize" gnus-article-treat-html t]
1577 ["Rot 13" gnus-summary-caesar-message t]
1578 ["Unix pipe" gnus-summary-pipe-message t]
1579 ["Add buttons" gnus-article-add-buttons t]
1580 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1581 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1582 ["Verbose header" gnus-summary-verbose-headers t]
1583 ["Toggle header" gnus-summary-toggle-header t])
1585 ["Save in default format" gnus-summary-save-article t]
1586 ["Save in file" gnus-summary-save-article-file t]
1587 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1588 ["Save in MH folder" gnus-summary-save-article-folder t]
1589 ["Save in VM folder" gnus-summary-save-article-vm t]
1590 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1591 ["Save body in file" gnus-summary-save-article-body-file t]
1592 ["Pipe through a filter" gnus-summary-pipe-output t]
1593 ["Add to SOUP packet" gnus-soup-add-article t]
1594 ["Print" gnus-summary-print-article t])
1596 ["Respool article..." gnus-summary-respool-article t]
1597 ["Move article..." gnus-summary-move-article
1598 (gnus-check-backend-function
1599 'request-move-article gnus-newsgroup-name)]
1600 ["Copy article..." gnus-summary-copy-article t]
1601 ["Crosspost article..." gnus-summary-crosspost-article
1602 (gnus-check-backend-function
1603 'request-replace-article gnus-newsgroup-name)]
1604 ["Import file..." gnus-summary-import-article t]
1605 ["Check if posted" gnus-summary-article-posted-p t]
1606 ["Edit article" gnus-summary-edit-article
1607 (not (gnus-group-read-only-p))]
1608 ["Delete article" gnus-summary-delete-article
1609 (gnus-check-backend-function
1610 'request-expire-articles gnus-newsgroup-name)]
1611 ["Query respool" gnus-summary-respool-query t]
1612 ["Trace respool" gnus-summary-respool-trace t]
1613 ["Delete expirable articles" gnus-summary-expire-articles-now
1614 (gnus-check-backend-function
1615 'request-expire-articles gnus-newsgroup-name)])
1617 ["Uudecode" gnus-uu-decode-uu t]
1618 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1619 ["Unshar" gnus-uu-decode-unshar t]
1620 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1621 ["Save" gnus-uu-decode-save t]
1622 ["Binhex" gnus-uu-decode-binhex t]
1623 ["Postscript" gnus-uu-decode-postscript t])
1625 ["Enter article" gnus-cache-enter-article t]
1626 ["Remove article" gnus-cache-remove-article t])
1627 ["Select article buffer" gnus-summary-select-article-buffer t]
1628 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1629 ["Isearch article..." gnus-summary-isearch-article t]
1630 ["Beginning of the article" gnus-summary-beginning-of-article t]
1631 ["End of the article" gnus-summary-end-of-article t]
1632 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1633 ["Fetch referenced articles" gnus-summary-refer-references t]
1634 ["Fetch current thread" gnus-summary-refer-thread t]
1635 ["Fetch article with id..." gnus-summary-refer-article t]
1636 ["Redisplay" gnus-summary-show-article t])))
1638 gnus-summary-article-menu gnus-summary-mode-map ""
1639 (cons "Article" innards))
1642 gnus-article-commands-menu gnus-article-mode-map ""
1643 (cons "Commands" innards)))
1646 gnus-summary-thread-menu gnus-summary-mode-map ""
1648 ["Toggle threading" gnus-summary-toggle-threads t]
1649 ["Hide threads" gnus-summary-hide-all-threads t]
1650 ["Show threads" gnus-summary-show-all-threads t]
1651 ["Hide thread" gnus-summary-hide-thread t]
1652 ["Show thread" gnus-summary-show-thread t]
1653 ["Go to next thread" gnus-summary-next-thread t]
1654 ["Go to previous thread" gnus-summary-prev-thread t]
1655 ["Go down thread" gnus-summary-down-thread t]
1656 ["Go up thread" gnus-summary-up-thread t]
1657 ["Top of thread" gnus-summary-top-thread t]
1658 ["Mark thread as read" gnus-summary-kill-thread t]
1659 ["Lower thread score" gnus-summary-lower-thread t]
1660 ["Raise thread score" gnus-summary-raise-thread t]
1661 ["Rethread current" gnus-summary-rethread-current t]
1665 gnus-summary-post-menu gnus-summary-mode-map ""
1667 ["Post an article" gnus-summary-post-news t]
1668 ["Followup" gnus-summary-followup t]
1669 ["Followup and yank" gnus-summary-followup-with-original t]
1670 ["Supersede article" gnus-summary-supersede-article t]
1671 ["Cancel article" gnus-summary-cancel-article t]
1672 ["Reply" gnus-summary-reply t]
1673 ["Reply and yank" gnus-summary-reply-with-original t]
1674 ["Wide reply" gnus-summary-wide-reply t]
1675 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1676 ["Mail forward" gnus-summary-mail-forward t]
1677 ["Post forward" gnus-summary-post-forward t]
1678 ["Digest and mail" gnus-uu-digest-mail-forward t]
1679 ["Digest and post" gnus-uu-digest-post-forward t]
1680 ["Resend message" gnus-summary-resend-message t]
1681 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1682 ["Send a mail" gnus-summary-mail-other-window t]
1683 ["Uuencode and post" gnus-uu-post-news t]
1684 ["Followup via news" gnus-summary-followup-to-mail t]
1685 ["Followup via news and yank"
1686 gnus-summary-followup-to-mail-with-original t]
1688 ;;["Send" gnus-summary-send-draft t]
1689 ;;["Send bounced" gnus-resend-bounced-mail t])
1693 gnus-summary-misc-menu gnus-summary-mode-map ""
1696 ["Mark as read" gnus-summary-mark-as-read-forward t]
1697 ["Mark same subject and select"
1698 gnus-summary-kill-same-subject-and-select t]
1699 ["Mark same subject" gnus-summary-kill-same-subject t]
1700 ["Catchup" gnus-summary-catchup t]
1701 ["Catchup all" gnus-summary-catchup-all t]
1702 ["Catchup to here" gnus-summary-catchup-to-here t]
1703 ["Catchup region" gnus-summary-mark-region-as-read t]
1704 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1706 ["Tick" gnus-summary-tick-article-forward t]
1707 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1708 ["Remove marks" gnus-summary-clear-mark-forward t]
1709 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1710 ["Set bookmark" gnus-summary-set-bookmark t]
1711 ["Remove bookmark" gnus-summary-remove-bookmark t])
1713 ["Marks..." gnus-summary-limit-to-marks t]
1714 ["Subject..." gnus-summary-limit-to-subject t]
1715 ["Author..." gnus-summary-limit-to-author t]
1716 ["Age..." gnus-summary-limit-to-age t]
1717 ["Score" gnus-summary-limit-to-score t]
1718 ["Unread" gnus-summary-limit-to-unread t]
1719 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1720 ["Articles" gnus-summary-limit-to-articles t]
1721 ["Pop limit" gnus-summary-pop-limit t]
1722 ["Show dormant" gnus-summary-limit-include-dormant t]
1723 ["Hide childless dormant"
1724 gnus-summary-limit-exclude-childless-dormant t]
1725 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1726 ["Show expunged" gnus-summary-show-all-expunged t])
1728 ["Set mark" gnus-summary-mark-as-processable t]
1729 ["Remove mark" gnus-summary-unmark-as-processable t]
1730 ["Remove all marks" gnus-summary-unmark-all-processable t]
1731 ["Mark above" gnus-uu-mark-over t]
1732 ["Mark series" gnus-uu-mark-series t]
1733 ["Mark region" gnus-uu-mark-region t]
1734 ["Unmark region" gnus-uu-unmark-region t]
1735 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1736 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1737 ["Mark all" gnus-uu-mark-all t]
1738 ["Mark buffer" gnus-uu-mark-buffer t]
1739 ["Mark sparse" gnus-uu-mark-sparse t]
1740 ["Mark thread" gnus-uu-mark-thread t]
1741 ["Unmark thread" gnus-uu-unmark-thread t]
1742 ("Process Mark Sets"
1743 ["Kill" gnus-summary-kill-process-mark t]
1744 ["Yank" gnus-summary-yank-process-mark
1745 gnus-newsgroup-process-stack]
1746 ["Save" gnus-summary-save-process-mark t]))
1748 ["Page forward" gnus-summary-next-page t]
1749 ["Page backward" gnus-summary-prev-page t]
1750 ["Line forward" gnus-summary-scroll-up t])
1752 ["Next unread article" gnus-summary-next-unread-article t]
1753 ["Previous unread article" gnus-summary-prev-unread-article t]
1754 ["Next article" gnus-summary-next-article t]
1755 ["Previous article" gnus-summary-prev-article t]
1756 ["Next unread subject" gnus-summary-next-unread-subject t]
1757 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1758 ["Next article same subject" gnus-summary-next-same-subject t]
1759 ["Previous article same subject" gnus-summary-prev-same-subject t]
1760 ["First unread article" gnus-summary-first-unread-article t]
1761 ["Best unread article" gnus-summary-best-unread-article t]
1762 ["Go to subject number..." gnus-summary-goto-subject t]
1763 ["Go to article number..." gnus-summary-goto-article t]
1764 ["Go to the last article" gnus-summary-goto-last-article t]
1765 ["Pop article off history" gnus-summary-pop-article t])
1767 ["Sort by number" gnus-summary-sort-by-number t]
1768 ["Sort by author" gnus-summary-sort-by-author t]
1769 ["Sort by subject" gnus-summary-sort-by-subject t]
1770 ["Sort by date" gnus-summary-sort-by-date t]
1771 ["Sort by score" gnus-summary-sort-by-score t]
1772 ["Sort by lines" gnus-summary-sort-by-lines t])
1774 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1775 ["Describe group" gnus-summary-describe-group t]
1776 ["Read manual" gnus-info-find-node t])
1778 ["Pick and read" gnus-pick-mode t]
1779 ["Binary" gnus-binary-mode t])
1781 ["Regenerate" gnus-summary-prepare t]
1782 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1783 ["Toggle threading" gnus-summary-toggle-threads t])
1784 ["Filter articles..." gnus-summary-execute-command t]
1785 ["Run command on subjects..." gnus-summary-universal-argument t]
1786 ["Search articles forward..." gnus-summary-search-article-forward t]
1787 ["Search articles backward..." gnus-summary-search-article-backward t]
1788 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1789 ["Expand window" gnus-summary-expand-window t]
1790 ["Expire expirable articles" gnus-summary-expire-articles
1791 (gnus-check-backend-function
1792 'request-expire-articles gnus-newsgroup-name)]
1793 ["Edit local kill file" gnus-summary-edit-local-kill t]
1794 ["Edit main kill file" gnus-summary-edit-global-kill t]
1795 ["Edit group parameters" gnus-summary-edit-parameters t]
1796 ["Send a bug report" gnus-bug t]
1798 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1799 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1800 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1801 ["Exit group" gnus-summary-exit t]
1802 ["Exit group without updating" gnus-summary-exit-no-update t]
1803 ["Exit and goto next group" gnus-summary-next-group t]
1804 ["Exit and goto prev group" gnus-summary-prev-group t]
1805 ["Reselect group" gnus-summary-reselect-current-group t]
1806 ["Rescan group" gnus-summary-rescan-group t]
1807 ["Update dribble" gnus-summary-save-newsrc t])))
1809 (gnus-run-hooks 'gnus-summary-menu-hook)))
1811 (defun gnus-score-set-default (var value)
1812 "A version of set that updates the GNU Emacs menu-bar."
1814 ;; It is the message that forces the active status to be updated.
1817 (defun gnus-make-score-map (type)
1818 "Make a summary score map of type TYPE."
1821 (let ((headers '(("author" "from" string)
1822 ("subject" "subject" string)
1823 ("article body" "body" string)
1824 ("article head" "head" string)
1825 ("xref" "xref" string)
1826 ("extra header" "extra" string)
1827 ("lines" "lines" number)
1828 ("followups to author" "followup" string)))
1829 (types '((number ("less than" <)
1832 (string ("substring" s)
1836 (perms '(("temporary" (current-time-string))
1844 (if (eq type 'lower)
1849 (setq header (car headers))
1855 (let ((ts (cdr (assoc (nth 2 header) types)))
1871 'gnus-summary-score-entry
1873 (if (or (string= (nth 1 header)
1875 (string= (nth 1 header)
1878 (list 'gnus-summary-header
1880 (list 'quote (nth 1 (car ts)))
1881 (list 'gnus-score-default nil)
1887 (list (nreverse outp))))
1890 (list (nreverse outt))))
1892 (setq headers (cdr headers)))
1893 (list (nreverse outh))))))))
1897 (defun gnus-summary-mode (&optional group)
1898 "Major mode for reading articles.
1900 All normal editing commands are switched off.
1901 \\<gnus-summary-mode-map>
1902 Each line in this buffer represents one article. To read an
1903 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1904 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1907 You can also post articles and send mail from this buffer. To
1908 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1909 of an article, type `\\[gnus-summary-reply]'.
1911 There are approx. one gazillion commands you can execute in this
1912 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1914 The following commands are available:
1916 \\{gnus-summary-mode-map}"
1918 (when (gnus-visual-p 'summary-menu 'menu)
1919 (gnus-summary-make-menu-bar))
1920 (kill-all-local-variables)
1921 (gnus-summary-make-local-variables)
1922 (gnus-make-thread-indent-array)
1923 (gnus-simplify-mode-line)
1924 (setq major-mode 'gnus-summary-mode)
1925 (setq mode-name "Summary")
1926 (make-local-variable 'minor-mode-alist)
1927 (use-local-map gnus-summary-mode-map)
1928 (buffer-disable-undo)
1929 (setq buffer-read-only t) ;Disable modification
1930 (setq truncate-lines t)
1931 (setq selective-display t)
1932 (setq selective-display-ellipses t) ;Display `...'
1933 (gnus-summary-set-display-table)
1934 (gnus-set-default-directory)
1935 (setq gnus-newsgroup-name group)
1936 (make-local-variable 'gnus-summary-line-format)
1937 (make-local-variable 'gnus-summary-line-format-spec)
1938 (make-local-variable 'gnus-summary-dummy-line-format)
1939 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1940 (make-local-variable 'gnus-summary-mark-positions)
1941 (make-local-hook 'post-command-hook)
1942 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1943 (make-local-hook 'pre-command-hook)
1944 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1945 (gnus-run-hooks 'gnus-summary-mode-hook)
1946 (mm-enable-multibyte)
1947 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1948 (gnus-update-summary-mark-positions))
1950 (defun gnus-summary-make-local-variables ()
1951 "Make all the local summary buffer variables."
1952 (let ((locals gnus-summary-local-variables)
1954 (while (setq local (pop locals))
1957 (if (eq (cdr local) 'global)
1958 ;; Copy the global value of the variable.
1959 (setq global (symbol-value (car local)))
1960 ;; Use the value from the list.
1961 (setq global (eval (cdr local))))
1962 (make-local-variable (car local))
1963 (set (car local) global))
1964 ;; Simple nil-valued local variable.
1965 (make-local-variable local)
1968 (defun gnus-summary-clear-local-variables ()
1969 (let ((locals gnus-summary-local-variables))
1971 (if (consp (car locals))
1972 (and (vectorp (caar locals))
1973 (set (caar locals) nil))
1974 (and (vectorp (car locals))
1975 (set (car locals) nil)))
1976 (setq locals (cdr locals)))))
1978 ;; Summary data functions.
1980 (defmacro gnus-data-number (data)
1983 (defmacro gnus-data-set-number (data number)
1984 `(setcar ,data ,number))
1986 (defmacro gnus-data-mark (data)
1989 (defmacro gnus-data-set-mark (data mark)
1990 `(setcar (nthcdr 1 ,data) ,mark))
1992 (defmacro gnus-data-pos (data)
1995 (defmacro gnus-data-set-pos (data pos)
1996 `(setcar (nthcdr 2 ,data) ,pos))
1998 (defmacro gnus-data-header (data)
2001 (defmacro gnus-data-set-header (data header)
2002 `(setf (nth 3 ,data) ,header))
2004 (defmacro gnus-data-level (data)
2007 (defmacro gnus-data-unread-p (data)
2008 `(= (nth 1 ,data) gnus-unread-mark))
2010 (defmacro gnus-data-read-p (data)
2011 `(/= (nth 1 ,data) gnus-unread-mark))
2013 (defmacro gnus-data-pseudo-p (data)
2014 `(consp (nth 3 ,data)))
2016 (defmacro gnus-data-find (number)
2017 `(assq ,number gnus-newsgroup-data))
2019 (defmacro gnus-data-find-list (number &optional data)
2020 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2021 (memq (assq ,number bdata)
2024 (defmacro gnus-data-make (number mark pos header level)
2025 `(list ,number ,mark ,pos ,header ,level))
2027 (defun gnus-data-enter (after-article number mark pos header level offset)
2028 (let ((data (gnus-data-find-list after-article)))
2030 (error "No such article: %d" after-article))
2031 (setcdr data (cons (gnus-data-make number mark pos header level)
2033 (setq gnus-newsgroup-data-reverse nil)
2034 (gnus-data-update-list (cddr data) offset)))
2036 (defun gnus-data-enter-list (after-article list &optional offset)
2038 (let ((data (and after-article (gnus-data-find-list after-article)))
2042 (let ((odata gnus-newsgroup-data))
2043 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2045 (gnus-data-update-list odata offset)))
2046 ;; Find the last element in the list to be spliced into the main
2049 (setq list (cdr list)))
2052 (setcdr list gnus-newsgroup-data)
2053 (setq gnus-newsgroup-data ilist)
2055 (gnus-data-update-list (cdr list) offset)))
2056 (setcdr list (cdr data))
2059 (gnus-data-update-list (cdr list) offset))))
2060 (setq gnus-newsgroup-data-reverse nil))))
2062 (defun gnus-data-remove (article &optional offset)
2063 (let ((data gnus-newsgroup-data))
2064 (if (= (gnus-data-number (car data)) article)
2066 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2067 gnus-newsgroup-data-reverse nil)
2069 (gnus-data-update-list gnus-newsgroup-data offset)))
2071 (when (= (gnus-data-number (cadr data)) article)
2072 (setcdr data (cddr data))
2074 (gnus-data-update-list (cdr data) offset))
2076 gnus-newsgroup-data-reverse nil))
2077 (setq data (cdr data))))))
2079 (defmacro gnus-data-list (backward)
2081 (or gnus-newsgroup-data-reverse
2082 (setq gnus-newsgroup-data-reverse
2083 (reverse gnus-newsgroup-data)))
2084 gnus-newsgroup-data))
2086 (defun gnus-data-update-list (data offset)
2087 "Add OFFSET to the POS of all data entries in DATA."
2088 (setq gnus-newsgroup-data-reverse nil)
2090 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2091 (setq data (cdr data))))
2093 (defun gnus-summary-article-pseudo-p (article)
2094 "Say whether this article is a pseudo article or not."
2095 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2097 (defmacro gnus-summary-article-sparse-p (article)
2098 "Say whether this article is a sparse article or not."
2099 `(memq ,article gnus-newsgroup-sparse))
2101 (defmacro gnus-summary-article-ancient-p (article)
2102 "Say whether this article is a sparse article or not."
2103 `(memq ,article gnus-newsgroup-ancient))
2105 (defun gnus-article-parent-p (number)
2106 "Say whether this article is a parent or not."
2107 (let ((data (gnus-data-find-list number)))
2108 (and (cdr data) ; There has to be an article after...
2109 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2110 (gnus-data-level (nth 1 data))))))
2112 (defun gnus-article-children (number)
2113 "Return a list of all children to NUMBER."
2114 (let* ((data (gnus-data-find-list number))
2115 (level (gnus-data-level (car data)))
2117 (setq data (cdr data))
2119 (= (gnus-data-level (car data)) (1+ level)))
2120 (push (gnus-data-number (car data)) children)
2121 (setq data (cdr data)))
2124 (defmacro gnus-summary-skip-intangible ()
2125 "If the current article is intangible, then jump to a different article."
2126 '(let ((to (get-text-property (point) 'gnus-intangible)))
2127 (and to (gnus-summary-goto-subject to))))
2129 (defmacro gnus-summary-article-intangible-p ()
2130 "Say whether this article is intangible or not."
2131 '(get-text-property (point) 'gnus-intangible))
2133 (defun gnus-article-read-p (article)
2134 "Say whether ARTICLE is read or not."
2135 (not (or (memq article gnus-newsgroup-marked)
2136 (memq article gnus-newsgroup-unreads)
2137 (memq article gnus-newsgroup-unselected)
2138 (memq article gnus-newsgroup-dormant))))
2140 ;; Some summary mode macros.
2142 (defmacro gnus-summary-article-number ()
2143 "The article number of the article on the current line.
2144 If there isn's an article number here, then we return the current
2147 (gnus-summary-skip-intangible)
2148 (or (get-text-property (point) 'gnus-number)
2149 (gnus-summary-last-subject))))
2151 (defmacro gnus-summary-article-header (&optional number)
2152 "Return the header of article NUMBER."
2153 `(gnus-data-header (gnus-data-find
2154 ,(or number '(gnus-summary-article-number)))))
2156 (defmacro gnus-summary-thread-level (&optional number)
2157 "Return the level of thread that starts with article NUMBER."
2158 `(if (and (eq gnus-summary-make-false-root 'dummy)
2159 (get-text-property (point) 'gnus-intangible))
2161 (gnus-data-level (gnus-data-find
2162 ,(or number '(gnus-summary-article-number))))))
2164 (defmacro gnus-summary-article-mark (&optional number)
2165 "Return the mark of article NUMBER."
2166 `(gnus-data-mark (gnus-data-find
2167 ,(or number '(gnus-summary-article-number)))))
2169 (defmacro gnus-summary-article-pos (&optional number)
2170 "Return the position of the line of article NUMBER."
2171 `(gnus-data-pos (gnus-data-find
2172 ,(or number '(gnus-summary-article-number)))))
2174 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2175 (defmacro gnus-summary-article-subject (&optional number)
2176 "Return current subject string or nil if nothing."
2179 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2180 '(gnus-data-header (assq (gnus-summary-article-number)
2181 gnus-newsgroup-data)))))
2184 (mail-header-subject headers))))
2186 (defmacro gnus-summary-article-score (&optional number)
2187 "Return current article score."
2188 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2189 gnus-newsgroup-scored))
2190 gnus-summary-default-score 0))
2192 (defun gnus-summary-article-children (&optional number)
2193 "Return a list of article numbers that are children of article NUMBER."
2194 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2195 (level (gnus-data-level (car data)))
2197 (while (and (setq data (cdr data))
2198 (> (setq l (gnus-data-level (car data))) level))
2199 (and (= (1+ level) l)
2200 (push (gnus-data-number (car data))
2202 (nreverse children)))
2204 (defun gnus-summary-article-parent (&optional number)
2205 "Return the article number of the parent of article NUMBER."
2206 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2207 (gnus-data-list t)))
2208 (level (gnus-data-level (car data))))
2210 () ; This is a root.
2211 ;; We search until we find an article with a level less than
2212 ;; this one. That function has to be the parent.
2213 (while (and (setq data (cdr data))
2214 (not (< (gnus-data-level (car data)) level))))
2215 (and data (gnus-data-number (car data))))))
2217 (defun gnus-unread-mark-p (mark)
2218 "Say whether MARK is the unread mark."
2219 (= mark gnus-unread-mark))
2221 (defun gnus-read-mark-p (mark)
2222 "Say whether MARK is one of the marks that mark as read.
2223 This is all marks except unread, ticked, dormant, and expirable."
2224 (not (or (= mark gnus-unread-mark)
2225 (= mark gnus-ticked-mark)
2226 (= mark gnus-dormant-mark)
2227 (= mark gnus-expirable-mark))))
2229 (defmacro gnus-article-mark (number)
2230 "Return the MARK of article NUMBER.
2231 This macro should only be used when computing the mark the \"first\"
2232 time; i.e., when generating the summary lines. After that,
2233 `gnus-summary-article-mark' should be used to examine the
2236 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2237 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2238 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2239 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2240 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2241 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2242 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2243 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2244 gnus-ancient-mark))))
2246 ;; Saving hidden threads.
2248 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2249 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2251 (defmacro gnus-save-hidden-threads (&rest forms)
2252 "Save hidden threads, eval FORMS, and restore the hidden threads."
2253 (let ((config (make-symbol "config")))
2254 `(let ((,config (gnus-hidden-threads-configuration)))
2258 (gnus-restore-hidden-threads-configuration ,config)))))
2260 (defun gnus-data-compute-positions ()
2261 "Compute the positions of all articles."
2262 (setq gnus-newsgroup-data-reverse nil)
2263 (let ((data gnus-newsgroup-data))
2265 (gnus-save-hidden-threads
2266 (gnus-summary-show-all-threads)
2267 (goto-char (point-min))
2269 (while (get-text-property (point) 'gnus-intangible)
2271 (gnus-data-set-pos (car data) (+ (point) 3))
2272 (setq data (cdr data))
2273 (forward-line 1))))))
2275 (defun gnus-hidden-threads-configuration ()
2276 "Return the current hidden threads configuration."
2279 (goto-char (point-min))
2280 (while (search-forward "\r" nil t)
2281 (push (1- (point)) config))
2284 (defun gnus-restore-hidden-threads-configuration (config)
2285 "Restore hidden threads configuration from CONFIG."
2286 (let (point buffer-read-only)
2287 (while (setq point (pop config))
2288 (when (and (< point (point-max))
2290 (eq (char-after) ?\n))
2291 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2293 ;; Various summary mode internalish functions.
2295 (defun gnus-mouse-pick-article (e)
2298 (gnus-summary-next-page nil t))
2300 (defun gnus-summary-set-display-table ()
2301 ;; Change the display table. Odd characters have a tendency to mess
2302 ;; up nicely formatted displays - we make all possible glyphs
2303 ;; display only a single character.
2305 ;; We start from the standard display table, if any.
2306 (let ((table (or (copy-sequence standard-display-table)
2307 (make-display-table)))
2309 ;; Nix out all the control chars...
2310 (while (>= (setq i (1- i)) 0)
2311 (aset table i [??]))
2312 ;; ... but not newline and cr, of course. (cr is necessary for the
2313 ;; selective display).
2314 (aset table ?\n nil)
2315 (aset table ?\r nil)
2316 ;; We keep TAB as well.
2317 (aset table ?\t nil)
2318 ;; We nix out any glyphs over 126 that are not set already.
2320 (while (>= (setq i (1- i)) 127)
2321 ;; Only modify if the entry is nil.
2322 (unless (aref table i)
2323 (aset table i [??]))))
2324 (setq buffer-display-table table)))
2326 (defun gnus-summary-setup-buffer (group)
2327 "Initialize summary buffer."
2328 (let ((buffer (concat "*Summary " group "*")))
2329 (if (get-buffer buffer)
2332 (setq gnus-summary-buffer (current-buffer))
2333 (not gnus-newsgroup-prepared))
2334 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2335 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2336 (gnus-summary-mode group)
2338 (gnus-carpal-setup-buffer 'summary))
2339 (unless gnus-single-article-buffer
2340 (make-local-variable 'gnus-article-buffer)
2341 (make-local-variable 'gnus-article-current)
2342 (make-local-variable 'gnus-original-article-buffer))
2343 (setq gnus-newsgroup-name group)
2346 (defun gnus-set-global-variables ()
2347 ;; Set the global equivalents of the summary buffer-local variables
2348 ;; to the latest values they had. These reflect the summary buffer
2349 ;; that was in action when the last article was fetched.
2350 (when (eq major-mode 'gnus-summary-mode)
2351 (setq gnus-summary-buffer (current-buffer))
2352 (let ((name gnus-newsgroup-name)
2353 (marked gnus-newsgroup-marked)
2354 (unread gnus-newsgroup-unreads)
2355 (headers gnus-current-headers)
2356 (data gnus-newsgroup-data)
2357 (summary gnus-summary-buffer)
2358 (article-buffer gnus-article-buffer)
2359 (original gnus-original-article-buffer)
2360 (gac gnus-article-current)
2361 (reffed gnus-reffed-article-number)
2362 (score-file gnus-current-score-file))
2364 (set-buffer gnus-group-buffer)
2365 (setq gnus-newsgroup-name name
2366 gnus-newsgroup-marked marked
2367 gnus-newsgroup-unreads unread
2368 gnus-current-headers headers
2369 gnus-newsgroup-data data
2370 gnus-article-current gac
2371 gnus-summary-buffer summary
2372 gnus-article-buffer article-buffer
2373 gnus-original-article-buffer original
2374 gnus-reffed-article-number reffed
2375 gnus-current-score-file score-file)
2376 ;; The article buffer also has local variables.
2377 (when (gnus-buffer-live-p gnus-article-buffer)
2378 (set-buffer gnus-article-buffer)
2379 (setq gnus-summary-buffer summary))))))
2381 (defun gnus-summary-article-unread-p (article)
2382 "Say whether ARTICLE is unread or not."
2383 (memq article gnus-newsgroup-unreads))
2385 (defun gnus-summary-first-article-p (&optional article)
2386 "Return whether ARTICLE is the first article in the buffer."
2387 (if (not (setq article (or article (gnus-summary-article-number))))
2389 (eq article (caar gnus-newsgroup-data))))
2391 (defun gnus-summary-last-article-p (&optional article)
2392 "Return whether ARTICLE is the last article in the buffer."
2393 (if (not (setq article (or article (gnus-summary-article-number))))
2394 t ; All non-existent numbers are the last article. :-)
2395 (not (cdr (gnus-data-find-list article)))))
2397 (defun gnus-make-thread-indent-array ()
2399 (unless (and gnus-thread-indent-array
2400 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2401 (setq gnus-thread-indent-array (make-vector 201 "")
2402 gnus-thread-indent-array-level gnus-thread-indent-level)
2404 (aset gnus-thread-indent-array n
2405 (make-string (* n gnus-thread-indent-level) ? ))
2408 (defun gnus-update-summary-mark-positions ()
2409 "Compute where the summary marks are to go."
2411 (when (gnus-buffer-exists-p gnus-summary-buffer)
2412 (set-buffer gnus-summary-buffer))
2413 (let ((gnus-replied-mark 129)
2414 (gnus-score-below-mark 130)
2415 (gnus-score-over-mark 130)
2416 (gnus-download-mark 131)
2417 (spec gnus-summary-line-format-spec)
2420 (gnus-set-work-buffer)
2421 (let ((gnus-summary-line-format-spec spec)
2422 (gnus-newsgroup-downloadable '((0 . t))))
2423 (gnus-summary-insert-line
2424 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2425 (goto-char (point-min))
2426 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2428 (goto-char (point-min))
2429 (push (cons 'replied (and (search-forward "\201" nil t)
2432 (goto-char (point-min))
2433 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2435 (goto-char (point-min))
2436 (push (cons 'download
2437 (and (search-forward "\203" nil t) (- (point) 2)))
2439 (setq gnus-summary-mark-positions pos))))
2441 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2442 "Insert a dummy root in the summary buffer."
2444 (gnus-add-text-properties
2445 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2446 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2448 (defun gnus-summary-from-or-to-or-newsgroups (header)
2449 (let ((to (cdr (assq 'To (mail-header-extra header))))
2450 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header)))))
2453 gnus-ignored-from-addresses
2454 (string-match gnus-ignored-from-addresses
2455 (mail-header-from header)))
2457 (or (car (funcall gnus-extract-address-components
2459 gnus-decode-encoded-word-function to)))
2460 (funcall gnus-decode-encoded-word-function to))))
2462 gnus-ignored-from-addresses
2463 (string-match gnus-ignored-from-addresses
2464 (mail-header-from header)))
2465 (concat "=> " newsgroups))
2467 (or (car (funcall gnus-extract-address-components
2468 (mail-header-from header)))
2469 (mail-header-from header))))))
2471 (defun gnus-summary-insert-line (gnus-tmp-header
2472 gnus-tmp-level gnus-tmp-current
2473 gnus-tmp-unread gnus-tmp-replied
2474 gnus-tmp-expirable gnus-tmp-subject-or-nil
2475 &optional gnus-tmp-dummy gnus-tmp-score
2477 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2478 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2479 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2480 (gnus-tmp-score-char
2481 (if (or (null gnus-summary-default-score)
2482 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2483 gnus-summary-zcore-fuzz))
2485 (if (< gnus-tmp-score gnus-summary-default-score)
2486 gnus-score-below-mark gnus-score-over-mark)))
2488 (cond (gnus-tmp-process gnus-process-mark)
2489 ((memq gnus-tmp-current gnus-newsgroup-cached)
2491 (gnus-tmp-replied gnus-replied-mark)
2492 ((memq gnus-tmp-current gnus-newsgroup-saved)
2494 (t gnus-unread-mark)))
2495 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2498 ((string-match "<[^>]+> *$" gnus-tmp-from)
2499 (let ((beg (match-beginning 0)))
2500 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2501 (substring gnus-tmp-from (1+ (match-beginning 0))
2502 (1- (match-end 0))))
2503 (substring gnus-tmp-from 0 beg))))
2504 ((string-match "(.+)" gnus-tmp-from)
2505 (substring gnus-tmp-from
2506 (1+ (match-beginning 0)) (1- (match-end 0))))
2508 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2509 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2510 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2511 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2512 (buffer-read-only nil))
2513 (when (string= gnus-tmp-name "")
2514 (setq gnus-tmp-name gnus-tmp-from))
2515 (unless (numberp gnus-tmp-lines)
2516 (setq gnus-tmp-lines 0))
2517 (gnus-put-text-property
2519 (progn (eval gnus-summary-line-format-spec) (point))
2520 'gnus-number gnus-tmp-number)
2521 (when (gnus-visual-p 'summary-highlight 'highlight)
2523 (gnus-run-hooks 'gnus-summary-update-hook)
2526 (defun gnus-summary-update-line (&optional dont-update)
2527 ;; Update summary line after change.
2528 (when (and gnus-summary-default-score
2529 (not gnus-summary-inhibit-highlight))
2530 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2531 (article (gnus-summary-article-number))
2532 (score (gnus-summary-article-score article)))
2534 (if (and gnus-summary-mark-below
2535 (< (gnus-summary-article-score)
2536 gnus-summary-mark-below))
2537 ;; This article has a low score, so we mark it as read.
2538 (when (memq article gnus-newsgroup-unreads)
2539 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2540 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2541 ;; This article was previously marked as read on account
2542 ;; of a low score, but now it has risen, so we mark it as
2544 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2545 (gnus-summary-update-mark
2546 (if (or (null gnus-summary-default-score)
2547 (<= (abs (- score gnus-summary-default-score))
2548 gnus-summary-zcore-fuzz))
2550 (if (< score gnus-summary-default-score)
2551 gnus-score-below-mark gnus-score-over-mark))
2553 ;; Do visual highlighting.
2554 (when (gnus-visual-p 'summary-highlight 'highlight)
2555 (gnus-run-hooks 'gnus-summary-update-hook)))))
2557 (defvar gnus-tmp-new-adopts nil)
2559 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2560 "Return the number of articles in THREAD.
2561 This may be 0 in some cases -- if none of the articles in
2562 the thread are to be displayed."
2564 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2566 ((not (listp thread))
2568 ((and (consp thread) (cdr thread))
2571 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2574 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2577 (when (and level (zerop level) gnus-tmp-new-adopts)
2580 'gnus-summary-number-of-articles-in-thread
2581 gnus-tmp-new-adopts))))
2583 (if (> number 1) gnus-not-empty-thread-mark
2584 gnus-empty-thread-mark)
2587 (defun gnus-summary-set-local-parameters (group)
2588 "Go through the local params of GROUP and set all variable specs in that list."
2589 (let ((params (gnus-group-find-parameter group))
2592 (setq elem (car params)
2593 params (cdr params))
2594 (and (consp elem) ; Has to be a cons.
2595 (consp (cdr elem)) ; The cdr has to be a list.
2596 (symbolp (car elem)) ; Has to be a symbol in there.
2597 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2598 (ignore-errors ; So we set it.
2599 (make-local-variable (car elem))
2600 (set (car elem) (eval (nth 1 elem))))))))
2602 (defun gnus-summary-read-group (group &optional show-all no-article
2603 kill-buffer no-display backward
2605 "Start reading news in newsgroup GROUP.
2606 If SHOW-ALL is non-nil, already read articles are also listed.
2607 If NO-ARTICLE is non-nil, no article is selected initially.
2608 If NO-DISPLAY, don't generate a summary buffer."
2612 (let ((gnus-auto-select-next nil))
2613 (or (gnus-summary-read-group-1
2614 group show-all no-article
2615 kill-buffer no-display
2618 select-articles nil)))))
2619 (eq gnus-auto-select-next 'quietly))
2620 (set-buffer gnus-group-buffer)
2621 ;; The entry function called above goes to the next
2622 ;; group automatically, so we go two groups back
2623 ;; if we are searching for the previous group.
2625 (gnus-group-prev-unread-group 2))
2626 (if (not (equal group (gnus-group-group-name)))
2627 (setq group (gnus-group-group-name))
2631 (defun gnus-summary-read-group-1 (group show-all no-article
2632 kill-buffer no-display
2633 &optional select-articles)
2634 ;; Killed foreign groups can't be entered.
2635 (when (and (not (gnus-group-native-p group))
2636 (not (gnus-gethash group gnus-newsrc-hashtb)))
2637 (error "Dead non-native groups can't be entered"))
2638 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2639 (let* ((new-group (gnus-summary-setup-buffer group))
2640 (quit-config (gnus-group-quit-config group))
2641 (did-select (and new-group (gnus-select-newsgroup
2642 group show-all select-articles))))
2644 ;; This summary buffer exists already, so we just select it.
2646 (gnus-set-global-variables)
2648 (gnus-kill-or-deaden-summary kill-buffer))
2649 (gnus-configure-windows 'summary 'force)
2650 (gnus-set-mode-line 'summary)
2651 (gnus-summary-position-point)
2654 ;; We couldn't select this group.
2656 (when (and (eq major-mode 'gnus-summary-mode)
2657 (not (equal (current-buffer) kill-buffer)))
2658 (kill-buffer (current-buffer))
2659 (if (not quit-config)
2661 ;; Update the info -- marks might need to be removed,
2663 (gnus-summary-update-info)
2664 (set-buffer gnus-group-buffer)
2665 (gnus-group-jump-to-group group)
2666 (gnus-group-next-unread-group 1))
2667 (gnus-handle-ephemeral-exit quit-config)))
2668 (gnus-message 3 "Can't select group")
2670 ;; The user did a `C-g' while prompting for number of articles,
2671 ;; so we exit this group.
2672 ((eq did-select 'quit)
2673 (and (eq major-mode 'gnus-summary-mode)
2674 (not (equal (current-buffer) kill-buffer))
2675 (kill-buffer (current-buffer)))
2677 (gnus-kill-or-deaden-summary kill-buffer))
2678 (if (not quit-config)
2680 (set-buffer gnus-group-buffer)
2681 (gnus-group-jump-to-group group)
2682 (gnus-group-next-unread-group 1)
2683 (gnus-configure-windows 'group 'force))
2684 (gnus-handle-ephemeral-exit quit-config))
2685 ;; Finally signal the quit.
2687 ;; The group was successfully selected.
2689 (gnus-set-global-variables)
2690 ;; Save the active value in effect when the group was entered.
2691 (setq gnus-newsgroup-active
2693 (gnus-active gnus-newsgroup-name)))
2694 ;; You can change the summary buffer in some way with this hook.
2695 (gnus-run-hooks 'gnus-select-group-hook)
2696 ;; Set any local variables in the group parameters.
2697 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2698 (gnus-update-format-specifications
2699 nil 'summary 'summary-mode 'summary-dummy)
2700 ;; Do score processing.
2701 (when gnus-use-scoring
2702 (gnus-possibly-score-headers))
2703 ;; Check whether to fill in the gaps in the threads.
2704 (when gnus-build-sparse-threads
2705 (gnus-build-sparse-threads))
2706 ;; Find the initial limit.
2707 (if gnus-show-threads
2709 (let ((gnus-newsgroup-dormant nil))
2710 (gnus-summary-initial-limit show-all))
2711 (gnus-summary-initial-limit show-all))
2712 (setq gnus-newsgroup-limit
2714 (lambda (header) (mail-header-number header))
2715 gnus-newsgroup-headers)))
2716 ;; Generate the summary buffer.
2718 (gnus-summary-prepare))
2719 (when gnus-use-trees
2720 (gnus-tree-open group)
2721 (setq gnus-summary-highlight-line-function
2722 'gnus-tree-highlight-article))
2723 ;; If the summary buffer is empty, but there are some low-scored
2724 ;; articles or some excluded dormants, we include these in the
2726 (when (and (zerop (buffer-size))
2728 (cond (gnus-newsgroup-dormant
2729 (gnus-summary-limit-include-dormant))
2730 ((and gnus-newsgroup-scored show-all)
2731 (gnus-summary-limit-include-expunged t))))
2732 ;; Function `gnus-apply-kill-file' must be called in this hook.
2733 (gnus-run-hooks 'gnus-apply-kill-hook)
2734 (if (and (zerop (buffer-size))
2737 ;; This newsgroup is empty.
2738 (gnus-summary-catchup-and-exit nil t)
2739 (gnus-message 6 "No unread news")
2741 (gnus-kill-or-deaden-summary kill-buffer))
2742 ;; Return nil from this function.
2744 ;; Hide conversation thread subtrees. We cannot do this in
2745 ;; gnus-summary-prepare-hook since kill processing may not
2746 ;; work with hidden articles.
2747 (and gnus-show-threads
2748 gnus-thread-hide-subtree
2749 (gnus-summary-hide-all-threads))
2751 (gnus-kill-or-deaden-summary kill-buffer))
2752 ;; Show first unread article if requested.
2753 (if (and (not no-article)
2755 gnus-newsgroup-unreads
2756 gnus-auto-select-first)
2758 (gnus-configure-windows 'summary)
2760 ((eq gnus-auto-select-first 'best)
2761 (gnus-summary-best-unread-article))
2762 ((eq gnus-auto-select-first t)
2763 (gnus-summary-first-unread-article))
2764 ((gnus-functionp gnus-auto-select-first)
2765 (funcall gnus-auto-select-first))))
2766 ;; Don't select any articles, just move point to the first
2767 ;; article in the group.
2768 (goto-char (point-min))
2769 (gnus-summary-position-point)
2770 (gnus-configure-windows 'summary 'force)
2771 (gnus-set-mode-line 'summary))
2772 (when (get-buffer-window gnus-group-buffer t)
2773 ;; Gotta use windows, because recenter does weird stuff if
2774 ;; the current buffer ain't the displayed window.
2775 (let ((owin (selected-window)))
2776 (select-window (get-buffer-window gnus-group-buffer t))
2777 (when (gnus-group-goto-group group)
2779 (select-window owin)))
2780 ;; Mark this buffer as "prepared".
2781 (setq gnus-newsgroup-prepared t)
2782 (gnus-run-hooks 'gnus-summary-prepared-hook)
2785 (defun gnus-summary-prepare ()
2786 "Generate the summary buffer."
2788 (let ((buffer-read-only nil))
2790 (setq gnus-newsgroup-data nil
2791 gnus-newsgroup-data-reverse nil)
2792 (gnus-run-hooks 'gnus-summary-generate-hook)
2793 ;; Generate the buffer, either with threads or without.
2794 (when gnus-newsgroup-headers
2795 (gnus-summary-prepare-threads
2796 (if gnus-show-threads
2797 (gnus-sort-gathered-threads
2798 (funcall gnus-summary-thread-gathering-function
2800 (gnus-cut-threads (gnus-make-threads)))))
2801 ;; Unthreaded display.
2802 (gnus-sort-articles gnus-newsgroup-headers))))
2803 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2804 ;; Call hooks for modifying summary buffer.
2805 (goto-char (point-min))
2806 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2808 (defsubst gnus-general-simplify-subject (subject)
2809 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2812 ;; Truncate the subject.
2813 (gnus-simplify-subject-functions
2814 (gnus-map-function gnus-simplify-subject-functions subject))
2815 ((numberp gnus-summary-gather-subject-limit)
2816 (setq subject (gnus-simplify-subject-re subject))
2817 (if (> (length subject) gnus-summary-gather-subject-limit)
2818 (substring subject 0 gnus-summary-gather-subject-limit)
2820 ;; Fuzzily simplify it.
2821 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2822 (gnus-simplify-subject-fuzzy subject))
2823 ;; Just remove the leading "Re:".
2825 (gnus-simplify-subject-re subject))))
2827 (if (and gnus-summary-gather-exclude-subject
2828 (string-match gnus-summary-gather-exclude-subject subject))
2829 nil ; This article shouldn't be gathered
2832 (defun gnus-summary-simplify-subject-query ()
2833 "Query where the respool algorithm would put this article."
2835 (gnus-summary-select-article)
2836 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2838 (defun gnus-gather-threads-by-subject (threads)
2839 "Gather threads by looking at Subject headers."
2840 (if (not gnus-summary-make-false-root)
2842 (let ((hashtb (gnus-make-hashtable 1024))
2845 subject hthread whole-subject)
2847 (setq subject (gnus-general-simplify-subject
2848 (setq whole-subject (mail-header-subject
2851 (if (setq hthread (gnus-gethash subject hashtb))
2853 ;; We enter a dummy root into the thread, if we
2854 ;; haven't done that already.
2855 (unless (stringp (caar hthread))
2856 (setcar hthread (list whole-subject (car hthread))))
2857 ;; We add this new gathered thread to this gathered
2859 (setcdr (car hthread)
2860 (nconc (cdar hthread) (list (car threads))))
2861 ;; Remove it from the list of threads.
2862 (setcdr prev (cdr threads))
2863 (setq threads prev))
2864 ;; Enter this thread into the hash table.
2865 (gnus-sethash subject threads hashtb)))
2867 (setq threads (cdr threads)))
2870 (defun gnus-gather-threads-by-references (threads)
2871 "Gather threads by looking at References headers."
2872 (let ((idhashtb (gnus-make-hashtable 1024))
2873 (thhashtb (gnus-make-hashtable 1024))
2876 ids references id gthread gid entered ref)
2878 (when (setq references (mail-header-references (caar threads)))
2879 (setq id (mail-header-id (caar threads))
2880 ids (gnus-split-references references)
2882 (while (setq ref (pop ids))
2883 (setq ids (delete ref ids))
2884 (if (not (setq gid (gnus-gethash ref idhashtb)))
2886 (gnus-sethash ref id idhashtb)
2887 (gnus-sethash id threads thhashtb))
2888 (setq gthread (gnus-gethash gid thhashtb))
2890 ;; We enter a dummy root into the thread, if we
2891 ;; haven't done that already.
2892 (unless (stringp (caar gthread))
2893 (setcar gthread (list (mail-header-subject (caar gthread))
2895 ;; We add this new gathered thread to this gathered
2897 (setcdr (car gthread)
2898 (nconc (cdar gthread) (list (car threads)))))
2899 ;; Add it into the thread hash table.
2900 (gnus-sethash id gthread thhashtb)
2902 ;; Remove it from the list of threads.
2903 (setcdr prev (cdr threads))
2904 (setq threads prev))))
2906 (setq threads (cdr threads)))
2909 (defun gnus-sort-gathered-threads (threads)
2910 "Sort subtreads inside each gathered thread by article number."
2911 (let ((result threads))
2913 (when (stringp (caar threads))
2914 (setcdr (car threads)
2915 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2916 (setq threads (cdr threads)))
2919 (defun gnus-thread-loop-p (root thread)
2920 "Say whether ROOT is in THREAD."
2921 (let ((stack (list thread))
2924 (while (setq thread (pop stack))
2925 (setq th (cdr thread))
2927 (not (eq (caar th) root)))
2930 ;; We have found a loop.
2932 (setcdr thread (delq (car th) (cdr thread)))
2933 (if (boundp (setq ref-dep (intern "none"
2934 gnus-newsgroup-dependencies)))
2935 (setcdr (symbol-value ref-dep)
2936 (nconc (cdr (symbol-value ref-dep))
2938 (set ref-dep (list nil (car th))))
2941 ;; Push all the subthreads onto the stack.
2942 (push (cdr thread) stack)))
2945 (defun gnus-make-threads ()
2946 "Go through the dependency hashtb and find the roots. Return all threads."
2948 (while (catch 'infloop
2951 ;; Deal with self-referencing References loops.
2952 (when (and (car (symbol-value refs))
2959 (car (symbol-value refs)) thread))
2960 (cdr (symbol-value refs)))))))
2963 (unless (car (symbol-value refs))
2964 ;; These threads do not refer back to any other articles,
2965 ;; so they're roots.
2966 (setq threads (append (cdr (symbol-value refs)) threads))))
2967 gnus-newsgroup-dependencies)))
2970 ;; Build the thread tree.
2971 (defsubst gnus-dependencies-add-header (header dependencies force-new)
2972 "Enter HEADER into the DEPENDENCIES table if it is not already there.
2974 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
2975 if it was already present.
2977 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
2978 will not be entered in the DEPENDENCIES table. Otherwise duplicate
2979 Message-IDs will be renamed be renamed to a unique Message-ID before
2982 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
2983 (let* ((id (mail-header-id header))
2984 (id-dep (and id (intern id dependencies)))
2985 ref ref-dep ref-header)
2986 ;; Enter this `header' in the `dependencies' table.
2990 ;; The first two cases do the normal part: enter a new `header'
2991 ;; in the `dependencies' table.
2992 ((not (boundp id-dep))
2993 (set id-dep (list header)))
2994 ((null (car (symbol-value id-dep)))
2995 (setcar (symbol-value id-dep) header))
2997 ;; From here the `header' was already present in the
2998 ;; `dependencies' table.
3000 ;; Overrides an existing entry;
3001 ;; just set the header part of the entry.
3002 (setcar (symbol-value id-dep) header))
3004 ;; Renames the existing `header' to a unique Message-ID.
3005 ((not gnus-summary-ignore-duplicates)
3006 ;; An article with this Message-ID has already been seen.
3007 ;; We rename the Message-ID.
3008 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3010 (mail-header-set-id header id))
3012 ;; The last case ignores an existing entry, except it adds any
3013 ;; additional Xrefs (in case the two articles came from different
3015 ;; Also sets `header' to `nil' meaning that the `dependencies'
3016 ;; table was *not* modified.
3018 (mail-header-set-xref
3019 (car (symbol-value id-dep))
3020 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3022 (or (mail-header-xref header) "")))
3026 ;; First check if that we are not creating a References loop.
3027 (setq ref (gnus-parent-id (mail-header-references header)))
3029 (setq ref-dep (intern-soft ref dependencies))
3031 (setq ref-header (car (symbol-value ref-dep))))
3032 (if (string= id ref)
3033 ;; Yuk! This is a reference loop. Make the article be a
3036 (mail-header-set-references (car (symbol-value id-dep)) "none")
3038 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3039 (setq ref (gnus-parent-id (mail-header-references header)))
3040 (setq ref-dep (intern (or ref "none") dependencies))
3041 (if (boundp ref-dep)
3042 (setcdr (symbol-value ref-dep)
3043 (nconc (cdr (symbol-value ref-dep))
3044 (list (symbol-value id-dep))))
3045 (set ref-dep (list nil (symbol-value id-dep)))))
3048 (defun gnus-build-sparse-threads ()
3049 (let ((headers gnus-newsgroup-headers)
3050 (gnus-summary-ignore-duplicates t)
3051 header references generation relations
3052 subject child end new-child date)
3053 ;; First we create an alist of generations/relations, where
3054 ;; generations is how much we trust the relation, and the relation
3056 (gnus-message 7 "Making sparse threads...")
3058 (nnheader-set-temp-buffer " *gnus sparse threads*")
3059 (while (setq header (pop headers))
3060 (when (and (setq references (mail-header-references header))
3061 (not (string= references "")))
3063 (setq child (mail-header-id header)
3064 subject (mail-header-subject header)
3065 date (mail-header-date header)
3067 (while (search-backward ">" nil t)
3068 (setq end (1+ (point)))
3069 (when (search-backward "<" nil t)
3070 (setq new-child (buffer-substring (point) end))
3071 (push (list (incf generation)
3072 child (setq child new-child)
3076 (push (list (1+ generation) child nil subject) relations))
3078 (kill-buffer (current-buffer)))
3079 ;; Sort over trustworthiness.
3082 (when (gnus-dependencies-add-header
3083 (make-full-mail-header
3084 gnus-reffed-article-number
3085 (nth 3 relation) "" (or (nth 4 relation) "")
3087 (or (nth 2 relation) "") 0 0 "")
3088 gnus-newsgroup-dependencies nil)
3089 (push gnus-reffed-article-number gnus-newsgroup-limit)
3090 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3091 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3092 gnus-newsgroup-reads)
3093 (decf gnus-reffed-article-number)))
3094 (sort relations 'car-less-than-car))
3095 (gnus-message 7 "Making sparse threads...done")))
3097 (defun gnus-build-old-threads ()
3098 ;; Look at all the articles that refer back to old articles, and
3099 ;; fetch the headers for the articles that aren't there. This will
3100 ;; build complete threads - if the roots haven't been expired by the
3105 (when (not (car (symbol-value refs)))
3106 (setq heads (cdr (symbol-value refs)))
3108 (if (memq (mail-header-number (caar heads))
3109 gnus-newsgroup-dormant)
3110 (setq heads (cdr heads))
3111 (setq id (symbol-name refs))
3112 (while (and (setq id (gnus-build-get-header id))
3113 (not (car (gnus-id-to-thread id)))))
3114 (setq heads nil)))))
3115 gnus-newsgroup-dependencies)))
3117 (defmacro gnus-nov-read-integer ()
3119 (if (eq (char-after) ?\t)
3121 (let ((num (ignore-errors (read buffer))))
3122 (if (numberp num) num 0)))
3124 (search-forward "\t" eol 'move))))
3126 (defmacro gnus-nov-skip-field ()
3127 '(search-forward "\t" eol 'move))
3129 (defmacro gnus-nov-field ()
3130 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
3132 (defmacro gnus-nov-parse-extra ()
3134 (while (not (memq (char-after) '(?\n nil)))
3135 (setq string (gnus-nov-field))
3136 (when (string-match "^\\([^ :]+\\): " string)
3137 (push (cons (intern (match-string 1 string))
3138 (substring string (match-end 0)))
3142 ;; This function has to be called with point after the article number
3143 ;; on the beginning of the line.
3144 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3145 (let ((eol (gnus-point-at-eol))
3146 (buffer (current-buffer))
3149 ;; overview: [num subject from date id refs chars lines misc]
3152 (narrow-to-region (point) eol)
3157 (make-full-mail-header
3159 (funcall gnus-decode-encoded-word-function
3160 (gnus-nov-field)) ; subject
3161 (funcall gnus-decode-encoded-word-function
3162 (gnus-nov-field)) ; from
3163 (gnus-nov-field) ; date
3164 (or (gnus-nov-field)
3165 (nnheader-generate-fake-message-id)) ; id
3166 (gnus-nov-field) ; refs
3167 (gnus-nov-read-integer) ; chars
3168 (gnus-nov-read-integer) ; lines
3169 (unless (eq (char-after) ?\n)
3170 (gnus-nov-field)) ; misc
3171 (gnus-nov-parse-extra)))) ; extra
3175 (when gnus-alter-header-function
3176 (funcall gnus-alter-header-function header))
3177 (gnus-dependencies-add-header header dependencies force-new)))
3179 (defun gnus-build-get-header (id)
3180 ;; Look through the buffer of NOV lines and find the header to
3181 ;; ID. Enter this line into the dependencies hash table, and return
3182 ;; the id of the parent article (if any).
3183 (let ((deps gnus-newsgroup-dependencies)
3187 (set-buffer nntp-server-buffer)
3188 (let ((case-fold-search nil))
3189 (goto-char (point-min))
3190 (while (and (not found)
3191 (search-forward id nil t))
3193 (setq found (looking-at
3194 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3195 (regexp-quote id))))
3196 (or found (beginning-of-line 2)))
3200 (setq header (gnus-nov-parse-line
3201 (read (current-buffer)) deps))
3202 (gnus-parent-id (mail-header-references header))))))
3204 (let ((number (mail-header-number header)))
3205 (push number gnus-newsgroup-limit)
3206 (push header gnus-newsgroup-headers)
3207 (if (memq number gnus-newsgroup-unselected)
3209 (push number gnus-newsgroup-unreads)
3210 (setq gnus-newsgroup-unselected
3211 (delq number gnus-newsgroup-unselected)))
3212 (push number gnus-newsgroup-ancient)))))))
3214 (defun gnus-build-all-threads ()
3215 "Read all the headers."
3216 (let ((gnus-summary-ignore-duplicates t)
3217 (dependencies gnus-newsgroup-dependencies)
3220 (set-buffer nntp-server-buffer)
3221 (let ((case-fold-search nil))
3222 (goto-char (point-min))
3225 (setq article (read (current-buffer))
3226 header (gnus-nov-parse-line
3227 article dependencies)))
3230 (set-buffer gnus-summary-buffer)
3231 (push header gnus-newsgroup-headers)
3232 (if (memq (setq article (mail-header-number header))
3233 gnus-newsgroup-unselected)
3235 (push article gnus-newsgroup-unreads)
3236 (setq gnus-newsgroup-unselected
3237 (delq article gnus-newsgroup-unselected)))
3238 (push article gnus-newsgroup-ancient)))
3239 (forward-line 1)))))))
3241 (defun gnus-summary-update-article-line (article header)
3242 "Update the line for ARTICLE using HEADERS."
3243 (let* ((id (mail-header-id header))
3244 (thread (gnus-id-to-thread id)))
3246 (error "Article in no thread"))
3247 ;; Update the thread.
3248 (setcar thread header)
3249 (gnus-summary-goto-subject article)
3250 (let* ((datal (gnus-data-find-list article))
3252 (length (when (cdr datal)
3253 (- (gnus-data-pos data)
3254 (gnus-data-pos (cadr datal)))))
3255 (buffer-read-only nil)
3256 (level (gnus-summary-thread-level)))
3258 (gnus-summary-insert-line
3259 header level nil (gnus-article-mark article)
3260 (memq article gnus-newsgroup-replied)
3261 (memq article gnus-newsgroup-expirable)
3262 ;; Only insert the Subject string when it's different
3263 ;; from the previous Subject string.
3264 (if (gnus-subject-equal
3266 (mail-header-subject
3269 (gnus-data-find-list
3271 (gnus-data-list t)))))
3272 ;; Error on the side of excessive subjects.
3274 (mail-header-subject header))
3276 (mail-header-subject header))
3277 nil (cdr (assq article gnus-newsgroup-scored))
3278 (memq article gnus-newsgroup-processable))
3280 (gnus-data-update-list
3281 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3283 (defun gnus-summary-update-article (article &optional iheader)
3284 "Update ARTICLE in the summary buffer."
3285 (set-buffer gnus-summary-buffer)
3286 (let* ((header (gnus-summary-article-header article))
3287 (id (mail-header-id header))
3288 (data (gnus-data-find article))
3289 (thread (gnus-id-to-thread id))
3290 (references (mail-header-references header))
3294 (when (and references
3295 (not (equal "" references)))
3298 (buffer-read-only nil)
3304 (delq thread parent)))
3305 (if (gnus-summary-insert-subject id header)
3306 ;; Set the (possibly) new article number in the data structure.
3307 (gnus-data-set-number data (gnus-id-to-article id))
3311 (defun gnus-rebuild-thread (id &optional line)
3312 "Rebuild the thread containing ID.
3313 If LINE, insert the rebuilt thread starting on line LINE."
3314 (let ((buffer-read-only nil)
3315 old-pos current thread data)
3316 (if (not gnus-show-threads)
3317 (setq thread (list (car (gnus-id-to-thread id))))
3318 ;; Get the thread this article is part of.
3319 (setq thread (gnus-remove-thread id)))
3320 (setq old-pos (gnus-point-at-bol))
3321 (setq current (save-excursion
3322 (and (zerop (forward-line -1))
3323 (gnus-summary-article-number))))
3324 ;; If this is a gathered thread, we have to go some re-gathering.
3325 (when (stringp (car thread))
3326 (let ((subject (car thread))
3328 (setq thread (cdr thread))
3330 (unless (memq (setq thr (gnus-id-to-thread
3332 (mail-header-id (caar thread)))))
3335 (setq thread (cdr thread)))
3336 ;; We now have all (unique) roots.
3337 (if (= (length roots) 1)
3338 ;; All the loose roots are now one solid root.
3339 (setq thread (car roots))
3340 (setq thread (cons subject (gnus-sort-threads roots))))))
3342 ;; We then insert this thread into the summary buffer.
3344 (goto-char (point-min))
3345 (forward-line (1- line)))
3346 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3347 (if gnus-show-threads
3348 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3349 (gnus-summary-prepare-unthreaded thread))
3350 (setq data (nreverse gnus-newsgroup-data))
3351 (setq threads gnus-newsgroup-threads))
3352 ;; We splice the new data into the data structure.
3353 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3354 ;;!!! then we want to insert at the beginning of the buffer.
3355 ;;!!! That happens to be true with Gnus now, but that may
3356 ;;!!! change in the future. Perhaps.
3357 (gnus-data-enter-list
3358 (if line nil current) data (- (point) old-pos))
3359 (setq gnus-newsgroup-threads
3360 (nconc threads gnus-newsgroup-threads))
3361 (gnus-data-compute-positions))))
3363 (defun gnus-number-to-header (number)
3364 "Return the header for article NUMBER."
3365 (let ((headers gnus-newsgroup-headers))
3367 (not (= number (mail-header-number (car headers)))))
3372 (defun gnus-parent-headers (in-headers &optional generation)
3373 "Return the headers of the GENERATIONeth parent of HEADERS."
3375 (setq generation 1))
3377 (headers in-headers)
3380 (not (zerop generation))
3381 (setq references (mail-header-references headers)))
3382 (setq headers (if (and references
3383 (setq parent (gnus-parent-id references)))
3384 (car (gnus-id-to-thread parent))
3387 (and (not (eq headers in-headers))
3390 (defun gnus-id-to-thread (id)
3391 "Return the (sub-)thread where ID appears."
3392 (gnus-gethash id gnus-newsgroup-dependencies))
3394 (defun gnus-id-to-article (id)
3395 "Return the article number of ID."
3396 (let ((thread (gnus-id-to-thread id)))
3399 (mail-header-number (car thread)))))
3401 (defun gnus-id-to-header (id)
3402 "Return the article headers of ID."
3403 (car (gnus-id-to-thread id)))
3405 (defun gnus-article-displayed-root-p (article)
3406 "Say whether ARTICLE is a root(ish) article."
3407 (let ((level (gnus-summary-thread-level article))
3408 (refs (mail-header-references (gnus-summary-article-header article)))
3414 ((null (gnus-parent-id refs)) t)
3416 (null (setq particle (gnus-id-to-article
3417 (gnus-parent-id refs))))
3418 (null (gnus-summary-thread-level particle)))))))
3420 (defun gnus-root-id (id)
3421 "Return the id of the root of the thread where ID appears."
3423 (while (and id (setq prev (car (gnus-id-to-thread id))))
3425 id (gnus-parent-id (mail-header-references prev))))
3428 (defun gnus-articles-in-thread (thread)
3429 "Return the list of articles in THREAD."
3430 (cons (mail-header-number (car thread))
3431 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3433 (defun gnus-remove-thread (id &optional dont-remove)
3434 "Remove the thread that has ID in it."
3435 (let (headers thread last-id)
3436 ;; First go up in this thread until we find the root.
3437 (setq last-id (gnus-root-id id)
3438 headers (message-flatten-list (gnus-id-to-thread last-id)))
3439 ;; We have now found the real root of this thread. It might have
3440 ;; been gathered into some loose thread, so we have to search
3441 ;; through the threads to find the thread we wanted.
3442 (let ((threads gnus-newsgroup-threads)
3445 (setq sub (car threads))
3446 (if (stringp (car sub))
3447 ;; This is a gathered thread, so we look at the roots
3448 ;; below it to find whether this article is in this
3451 (setq sub (cdr sub))
3453 (when (member (caar sub) headers)
3454 (setq thread (car threads)
3457 (setq sub (cdr sub))))
3458 ;; It's an ordinary thread, so we check it.
3459 (when (eq (car sub) (car headers))
3462 (setq threads (cdr threads)))
3463 ;; If this article is in no thread, then it's a root.
3466 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3467 (setq thread (gnus-id-to-thread last-id)))
3470 thread ; We return this thread.
3472 (if (stringp (car thread))
3474 ;; If we use dummy roots, then we have to remove the
3475 ;; dummy root as well.
3476 (when (eq gnus-summary-make-false-root 'dummy)
3477 ;; We go to the dummy root by going to
3478 ;; the first sub-"thread", and then one line up.
3479 (gnus-summary-goto-article
3480 (mail-header-number (caadr thread)))
3483 (gnus-data-compute-positions))
3484 (setq thread (cdr thread))
3486 (gnus-remove-thread-1 (car thread))
3487 (setq thread (cdr thread))))
3488 (gnus-summary-show-all-threads)
3489 (gnus-remove-thread-1 thread))))))))
3491 (defun gnus-remove-thread-1 (thread)
3492 "Remove the thread THREAD recursively."
3493 (let ((number (mail-header-number (pop thread)))
3495 (setq thread (reverse thread))
3497 (gnus-remove-thread-1 (pop thread)))
3498 (when (setq d (gnus-data-find number))
3499 (goto-char (gnus-data-pos d))
3502 (- (gnus-point-at-bol)
3504 (1+ (gnus-point-at-eol))
3505 (gnus-delete-line)))))))
3507 (defun gnus-sort-threads (threads)
3509 (if (not gnus-thread-sort-functions)
3511 (gnus-message 8 "Sorting threads...")
3513 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3514 (gnus-message 8 "Sorting threads...done"))))
3516 (defun gnus-sort-articles (articles)
3518 (when gnus-article-sort-functions
3519 (gnus-message 7 "Sorting articles...")
3521 (setq gnus-newsgroup-headers
3522 (sort articles (gnus-make-sort-function
3523 gnus-article-sort-functions)))
3524 (gnus-message 7 "Sorting articles...done"))))
3526 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3527 (defmacro gnus-thread-header (thread)
3528 ;; Return header of first article in THREAD.
3529 ;; Note that THREAD must never, ever be anything else than a variable -
3530 ;; using some other form will lead to serious barfage.
3531 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3532 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3533 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3536 (defsubst gnus-article-sort-by-number (h1 h2)
3537 "Sort articles by article number."
3538 (< (mail-header-number h1)
3539 (mail-header-number h2)))
3541 (defun gnus-thread-sort-by-number (h1 h2)
3542 "Sort threads by root article number."
3543 (gnus-article-sort-by-number
3544 (gnus-thread-header h1) (gnus-thread-header h2)))
3546 (defsubst gnus-article-sort-by-lines (h1 h2)
3547 "Sort articles by article Lines header."
3548 (< (mail-header-lines h1)
3549 (mail-header-lines h2)))
3551 (defun gnus-thread-sort-by-lines (h1 h2)
3552 "Sort threads by root article Lines header."
3553 (gnus-article-sort-by-lines
3554 (gnus-thread-header h1) (gnus-thread-header h2)))
3556 (defsubst gnus-article-sort-by-author (h1 h2)
3557 "Sort articles by root author."
3559 (let ((extract (funcall
3560 gnus-extract-address-components
3561 (mail-header-from h1))))
3562 (or (car extract) (cadr extract) ""))
3563 (let ((extract (funcall
3564 gnus-extract-address-components
3565 (mail-header-from h2))))
3566 (or (car extract) (cadr extract) ""))))
3568 (defun gnus-thread-sort-by-author (h1 h2)
3569 "Sort threads by root author."
3570 (gnus-article-sort-by-author
3571 (gnus-thread-header h1) (gnus-thread-header h2)))
3573 (defsubst gnus-article-sort-by-subject (h1 h2)
3574 "Sort articles by root subject."
3576 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3577 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3579 (defun gnus-thread-sort-by-subject (h1 h2)
3580 "Sort threads by root subject."
3581 (gnus-article-sort-by-subject
3582 (gnus-thread-header h1) (gnus-thread-header h2)))
3584 (defsubst gnus-article-sort-by-date (h1 h2)
3585 "Sort articles by root article date."
3587 (gnus-date-get-time (mail-header-date h1))
3588 (gnus-date-get-time (mail-header-date h2))))
3590 (defun gnus-thread-sort-by-date (h1 h2)
3591 "Sort threads by root article date."
3592 (gnus-article-sort-by-date
3593 (gnus-thread-header h1) (gnus-thread-header h2)))
3595 (defsubst gnus-article-sort-by-score (h1 h2)
3596 "Sort articles by root article score.
3597 Unscored articles will be counted as having a score of zero."
3598 (> (or (cdr (assq (mail-header-number h1)
3599 gnus-newsgroup-scored))
3600 gnus-summary-default-score 0)
3601 (or (cdr (assq (mail-header-number h2)
3602 gnus-newsgroup-scored))
3603 gnus-summary-default-score 0)))
3605 (defun gnus-thread-sort-by-score (h1 h2)
3606 "Sort threads by root article score."
3607 (gnus-article-sort-by-score
3608 (gnus-thread-header h1) (gnus-thread-header h2)))
3610 (defun gnus-thread-sort-by-total-score (h1 h2)
3611 "Sort threads by the sum of all scores in the thread.
3612 Unscored articles will be counted as having a score of zero."
3613 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3615 (defun gnus-thread-total-score (thread)
3616 ;; This function find the total score of THREAD.
3617 (cond ((null thread)
3620 (if (stringp (car thread))
3621 (apply gnus-thread-score-function 0
3622 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3623 (gnus-thread-total-score-1 thread)))
3625 (gnus-thread-total-score-1 (list thread)))))
3627 (defun gnus-thread-total-score-1 (root)
3628 ;; This function find the total score of the thread below ROOT.
3629 (setq root (car root))
3630 (apply gnus-thread-score-function
3632 (mapcar 'gnus-thread-total-score
3633 (cdr (gnus-id-to-thread (mail-header-id root))))
3634 (when (> (mail-header-number root) 0)
3635 (list (or (cdr (assq (mail-header-number root)
3636 gnus-newsgroup-scored))
3637 gnus-summary-default-score 0))))
3638 (list gnus-summary-default-score)
3641 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3642 (defvar gnus-tmp-prev-subject nil)
3643 (defvar gnus-tmp-false-parent nil)
3644 (defvar gnus-tmp-root-expunged nil)
3645 (defvar gnus-tmp-dummy-line nil)
3647 (defvar gnus-tmp-header)
3648 (defun gnus-extra-header (type &optional header)
3649 "Return the extra header of TYPE."
3650 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3653 (defun gnus-summary-prepare-threads (threads)
3654 "Prepare summary buffer from THREADS and indentation LEVEL.
3655 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3656 or a straight list of headers."
3657 (gnus-message 7 "Generating summary...")
3659 (setq gnus-newsgroup-threads threads)
3662 (let ((gnus-tmp-level 0)
3663 (default-score (or gnus-summary-default-score 0))
3664 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3665 thread number subject stack state gnus-tmp-gathered beg-match
3666 new-roots gnus-tmp-new-adopts thread-end
3667 gnus-tmp-header gnus-tmp-unread
3668 gnus-tmp-replied gnus-tmp-subject-or-nil
3669 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3670 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3671 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3673 (setq gnus-tmp-prev-subject nil)
3675 (if (vectorp (car threads))
3676 ;; If this is a straight (sic) list of headers, then a
3677 ;; threaded summary display isn't required, so we just create
3678 ;; an unthreaded one.
3679 (gnus-summary-prepare-unthreaded threads)
3681 ;; Do the threaded display.
3683 (while (or threads stack gnus-tmp-new-adopts new-roots)
3685 (if (and (= gnus-tmp-level 0)
3688 (not gnus-tmp-false-parent)
3689 (or gnus-tmp-new-adopts new-roots))
3690 (if gnus-tmp-new-adopts
3691 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3692 thread (list (car gnus-tmp-new-adopts))
3693 gnus-tmp-header (caar thread)
3694 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3696 (setq thread (list (car new-roots))
3697 gnus-tmp-header (caar thread)
3698 new-roots (cdr new-roots))))
3701 ;; If there are some threads, we do them before the
3702 ;; threads on the stack.
3703 (setq thread threads
3704 gnus-tmp-header (caar thread))
3705 ;; There were no current threads, so we pop something off
3707 (setq state (car stack)
3708 gnus-tmp-level (car state)
3711 gnus-tmp-header (caar thread))))
3713 (setq gnus-tmp-false-parent nil)
3714 (setq gnus-tmp-root-expunged nil)
3715 (setq thread-end nil)
3717 (if (stringp gnus-tmp-header)
3718 ;; The header is a dummy root.
3720 ((eq gnus-summary-make-false-root 'adopt)
3721 ;; We let the first article adopt the rest.
3722 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3724 (setq gnus-tmp-gathered
3726 (lambda (h) (mail-header-number (car h)))
3729 (setq thread (cons (list (caar thread)
3732 (setq gnus-tmp-level -1
3733 gnus-tmp-false-parent t))
3734 ((eq gnus-summary-make-false-root 'empty)
3735 ;; We print adopted articles with empty subject fields.
3736 (setq gnus-tmp-gathered
3738 (lambda (h) (mail-header-number (car h)))
3741 (setq gnus-tmp-level -1))
3742 ((eq gnus-summary-make-false-root 'dummy)
3743 ;; We remember that we probably want to output a dummy
3745 (setq gnus-tmp-dummy-line gnus-tmp-header)
3746 (setq gnus-tmp-prev-subject gnus-tmp-header))
3748 ;; We do not make a root for the gathered
3749 ;; sub-threads at all.
3750 (setq gnus-tmp-level -1)))
3752 (setq number (mail-header-number gnus-tmp-header)
3753 subject (mail-header-subject gnus-tmp-header))
3756 ;; If the thread has changed subject, we might want to make
3757 ;; this subthread into a root.
3758 ((and (null gnus-thread-ignore-subject)
3759 (not (zerop gnus-tmp-level))
3760 gnus-tmp-prev-subject
3762 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3763 (setq new-roots (nconc new-roots (list (car thread)))
3765 gnus-tmp-header nil))
3766 ;; If the article lies outside the current limit,
3767 ;; then we do not display it.
3768 ((not (memq number gnus-newsgroup-limit))
3769 (setq gnus-tmp-gathered
3771 (lambda (h) (mail-header-number (car h)))
3774 (setq gnus-tmp-new-adopts (if (cdar thread)
3775 (append gnus-tmp-new-adopts
3777 gnus-tmp-new-adopts)
3779 gnus-tmp-header nil)
3780 (when (zerop gnus-tmp-level)
3781 (setq gnus-tmp-root-expunged t)))
3782 ;; Perhaps this article is to be marked as read?
3783 ((and gnus-summary-mark-below
3784 (< (or (cdr (assq number gnus-newsgroup-scored))
3786 gnus-summary-mark-below)
3787 ;; Don't touch sparse articles.
3788 (not (gnus-summary-article-sparse-p number))
3789 (not (gnus-summary-article-ancient-p number)))
3790 (setq gnus-newsgroup-unreads
3791 (delq number gnus-newsgroup-unreads))
3792 (if gnus-newsgroup-auto-expire
3793 (push number gnus-newsgroup-expirable)
3794 (push (cons number gnus-low-score-mark)
3795 gnus-newsgroup-reads))))
3797 (when gnus-tmp-header
3798 ;; We may have an old dummy line to output before this
3800 (when (and gnus-tmp-dummy-line
3803 (mail-header-subject gnus-tmp-header)))
3804 (gnus-summary-insert-dummy-line
3805 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3806 (setq gnus-tmp-dummy-line nil))
3808 ;; Compute the mark.
3809 (setq gnus-tmp-unread (gnus-article-mark number))
3811 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3812 gnus-tmp-header gnus-tmp-level)
3813 gnus-newsgroup-data)
3815 ;; Actually insert the line.
3817 gnus-tmp-subject-or-nil
3819 ((and gnus-thread-ignore-subject
3820 gnus-tmp-prev-subject
3821 (not (inline (gnus-subject-equal
3822 gnus-tmp-prev-subject subject))))
3824 ((zerop gnus-tmp-level)
3825 (if (and (eq gnus-summary-make-false-root 'empty)
3826 (memq number gnus-tmp-gathered)
3827 gnus-tmp-prev-subject
3828 (inline (gnus-subject-equal
3829 gnus-tmp-prev-subject subject)))
3830 gnus-summary-same-subject
3832 (t gnus-summary-same-subject)))
3833 (if (and (eq gnus-summary-make-false-root 'adopt)
3834 (= gnus-tmp-level 1)
3835 (memq number gnus-tmp-gathered))
3836 (setq gnus-tmp-opening-bracket ?\<
3837 gnus-tmp-closing-bracket ?\>)
3838 (setq gnus-tmp-opening-bracket ?\[
3839 gnus-tmp-closing-bracket ?\]))
3841 gnus-tmp-indentation
3842 (aref gnus-thread-indent-array gnus-tmp-level)
3843 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3844 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3845 gnus-summary-default-score 0)
3847 (if (or (null gnus-summary-default-score)
3848 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3849 gnus-summary-zcore-fuzz))
3851 (if (< gnus-tmp-score gnus-summary-default-score)
3852 gnus-score-below-mark gnus-score-over-mark))
3854 (cond ((memq number gnus-newsgroup-processable)
3856 ((memq number gnus-newsgroup-cached)
3858 ((memq number gnus-newsgroup-replied)
3860 ((memq number gnus-newsgroup-saved)
3862 (t gnus-unread-mark))
3863 gnus-tmp-from (mail-header-from gnus-tmp-header)
3866 ((string-match "<[^>]+> *$" gnus-tmp-from)
3867 (setq beg-match (match-beginning 0))
3868 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3869 (substring gnus-tmp-from (1+ (match-beginning 0))
3870 (1- (match-end 0))))
3871 (substring gnus-tmp-from 0 beg-match)))
3872 ((string-match "(.+)" gnus-tmp-from)
3873 (substring gnus-tmp-from
3874 (1+ (match-beginning 0)) (1- (match-end 0))))
3876 (when (string= gnus-tmp-name "")
3877 (setq gnus-tmp-name gnus-tmp-from))
3878 (unless (numberp gnus-tmp-lines)
3879 (setq gnus-tmp-lines 0))
3880 (gnus-put-text-property
3882 (progn (eval gnus-summary-line-format-spec) (point))
3883 'gnus-number number)
3886 (gnus-run-hooks 'gnus-summary-update-hook)
3889 (setq gnus-tmp-prev-subject subject)))
3891 (when (nth 1 thread)
3892 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3893 (incf gnus-tmp-level)
3894 (setq threads (if thread-end nil (cdar thread)))
3896 (setq gnus-tmp-level 0)))))
3897 (gnus-message 7 "Generating summary...done"))
3899 (defun gnus-summary-prepare-unthreaded (headers)
3900 "Generate an unthreaded summary buffer based on HEADERS."
3901 (let (header number mark)
3906 ;; We may have to root out some bad articles...
3907 (when (memq (setq number (mail-header-number
3908 (setq header (pop headers))))
3909 gnus-newsgroup-limit)
3910 ;; Mark article as read when it has a low score.
3911 (when (and gnus-summary-mark-below
3912 (< (or (cdr (assq number gnus-newsgroup-scored))
3913 gnus-summary-default-score 0)
3914 gnus-summary-mark-below)
3915 (not (gnus-summary-article-ancient-p number)))
3916 (setq gnus-newsgroup-unreads
3917 (delq number gnus-newsgroup-unreads))
3918 (if gnus-newsgroup-auto-expire
3919 (push number gnus-newsgroup-expirable)
3920 (push (cons number gnus-low-score-mark)
3921 gnus-newsgroup-reads)))
3923 (setq mark (gnus-article-mark number))
3924 (push (gnus-data-make number mark (1+ (point)) header 0)
3925 gnus-newsgroup-data)
3926 (gnus-summary-insert-line
3928 mark (memq number gnus-newsgroup-replied)
3929 (memq number gnus-newsgroup-expirable)
3930 (mail-header-subject header) nil
3931 (cdr (assq number gnus-newsgroup-scored))
3932 (memq number gnus-newsgroup-processable))))))
3934 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3935 "Select newsgroup GROUP.
3936 If READ-ALL is non-nil, all articles in the group are selected.
3937 If SELECT-ARTICLES, only select those articles from GROUP."
3938 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3939 ;;!!! Dirty hack; should be removed.
3940 (gnus-summary-ignore-duplicates
3941 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3943 gnus-summary-ignore-duplicates))
3944 (info (nth 2 entry))
3945 articles fetched-articles cached)
3947 (unless (gnus-check-server
3948 (setq gnus-current-select-method
3949 (gnus-find-method-for-group group)))
3950 (error "Couldn't open server"))
3952 (or (and entry (not (eq (car entry) t))) ; Either it's active...
3953 (gnus-activate-group group) ; Or we can activate it...
3954 (progn ; Or we bug out.
3955 (when (equal major-mode 'gnus-summary-mode)
3956 (kill-buffer (current-buffer)))
3957 (error "Couldn't request group %s: %s"
3958 group (gnus-status-message group))))
3960 (unless (gnus-request-group group t)
3961 (when (equal major-mode 'gnus-summary-mode)
3962 (kill-buffer (current-buffer)))
3963 (error "Couldn't request group %s: %s"
3964 group (gnus-status-message group)))
3966 (setq gnus-newsgroup-name group)
3967 (setq gnus-newsgroup-unselected nil)
3968 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
3970 ;; Adjust and set lists of article marks.
3972 (gnus-adjust-marked-articles info))
3974 ;; Kludge to avoid having cached articles nixed out in virtual groups.
3975 (when (gnus-virtual-group-p group)
3976 (setq cached gnus-newsgroup-cached))
3978 (setq gnus-newsgroup-unreads
3979 (gnus-set-difference
3980 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
3981 gnus-newsgroup-dormant))
3983 (setq gnus-newsgroup-processable nil)
3985 (gnus-update-read-articles group gnus-newsgroup-unreads)
3987 (if (setq articles select-articles)
3988 (setq gnus-newsgroup-unselected
3989 (gnus-sorted-intersection
3990 gnus-newsgroup-unreads
3991 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
3992 (setq articles (gnus-articles-to-read group read-all)))
3996 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
3998 ((eq articles 0) nil)
4000 ;; Init the dependencies hash table.
4001 (setq gnus-newsgroup-dependencies
4002 (gnus-make-hashtable (length articles)))
4003 (gnus-set-global-variables)
4004 ;; Retrieve the headers and read them in.
4005 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4006 (setq gnus-newsgroup-headers
4008 (setq gnus-headers-retrieved-by
4009 (gnus-retrieve-headers
4010 articles gnus-newsgroup-name
4011 ;; We might want to fetch old headers, but
4012 ;; not if there is only 1 article.
4014 (not (eq gnus-fetch-old-headers 'some))
4015 (not (numberp gnus-fetch-old-headers)))
4016 (> (length articles) 1))
4017 gnus-fetch-old-headers))))
4018 (gnus-get-newsgroup-headers-xover
4019 articles nil nil gnus-newsgroup-name t)
4020 (gnus-get-newsgroup-headers)))
4021 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4023 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4025 (setq gnus-newsgroup-cached cached))
4027 ;; Suppress duplicates?
4028 (when gnus-suppress-duplicates
4029 (gnus-dup-suppress-articles))
4031 ;; Set the initial limit.
4032 (setq gnus-newsgroup-limit (copy-sequence articles))
4033 ;; Remove canceled articles from the list of unread articles.
4034 (setq gnus-newsgroup-unreads
4035 (gnus-set-sorted-intersection
4036 gnus-newsgroup-unreads
4037 (setq fetched-articles
4038 (mapcar (lambda (headers) (mail-header-number headers))
4039 gnus-newsgroup-headers))))
4040 ;; Removed marked articles that do not exist.
4041 (gnus-update-missing-marks
4042 (gnus-sorted-complement fetched-articles articles))
4043 ;; We might want to build some more threads first.
4044 (when (and gnus-fetch-old-headers
4045 (eq gnus-headers-retrieved-by 'nov))
4046 (if (eq gnus-fetch-old-headers 'invisible)
4047 (gnus-build-all-threads)
4048 (gnus-build-old-threads)))
4049 ;; Let the Gnus agent mark articles as read.
4051 (gnus-agent-get-undownloaded-list))
4052 ;; Check whether auto-expire is to be done in this group.
4053 (setq gnus-newsgroup-auto-expire
4054 (gnus-group-auto-expirable-p group))
4055 ;; Set up the article buffer now, if necessary.
4056 (unless gnus-single-article-buffer
4057 (gnus-article-setup-buffer))
4058 ;; First and last article in this newsgroup.
4059 (when gnus-newsgroup-headers
4060 (setq gnus-newsgroup-begin
4061 (mail-header-number (car gnus-newsgroup-headers))
4064 (gnus-last-element gnus-newsgroup-headers))))
4065 ;; GROUP is successfully selected.
4066 (or gnus-newsgroup-headers t)))))
4068 (defun gnus-articles-to-read (group &optional read-all)
4069 ;; Find out what articles the user wants to read.
4071 ;; Select all articles if `read-all' is non-nil, or if there
4072 ;; are no unread articles.
4074 (and (zerop (length gnus-newsgroup-marked))
4075 (zerop (length gnus-newsgroup-unreads)))
4076 (eq (gnus-group-find-parameter group 'display)
4078 (gnus-uncompress-range (gnus-active group))
4079 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4080 (copy-sequence gnus-newsgroup-unreads))
4082 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4083 (scored (length scored-list))
4084 (number (length articles))
4085 (marked (+ (length gnus-newsgroup-marked)
4086 (length gnus-newsgroup-dormant)))
4094 ((and (or (<= scored marked) (= scored number))
4095 (numberp gnus-large-newsgroup)
4096 (> number gnus-large-newsgroup))
4100 "How many articles from %s (default %d): "
4101 (gnus-limit-string gnus-newsgroup-name 35)
4103 (if (string-match "^[ \t]*$" input) number input)))
4104 ((and (> scored marked) (< scored number)
4105 (> (- scored number) 20))
4108 (format "%s %s (%d scored, %d total): "
4109 "How many articles from"
4110 group scored number))))
4111 (if (string-match "^[ \t]*$" input)
4115 (setq select (if (stringp select) (string-to-number select) select))
4116 (if (or (null select) (zerop select))
4118 (if (and (not (zerop scored)) (<= (abs select) scored))
4120 (setq articles (sort scored-list '<))
4121 (setq number (length articles)))
4122 (setq articles (copy-sequence articles)))
4124 (when (< (abs select) number)
4126 ;; Select the N oldest articles.
4127 (setcdr (nthcdr (1- (abs select)) articles) nil)
4128 ;; Select the N most recent articles.
4129 (setq articles (nthcdr (- number select) articles))))
4130 (setq gnus-newsgroup-unselected
4131 (gnus-sorted-intersection
4132 gnus-newsgroup-unreads
4133 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4136 (defun gnus-killed-articles (killed articles)
4139 (when (inline (gnus-member-of-range (car articles) killed))
4140 (push (car articles) out))
4141 (setq articles (cdr articles)))
4144 (defun gnus-uncompress-marks (marks)
4145 "Uncompress the mark ranges in MARKS."
4146 (let ((uncompressed '(score bookmark))
4149 (if (memq (caar marks) uncompressed)
4150 (push (car marks) out)
4151 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4152 (setq marks (cdr marks)))
4155 (defun gnus-adjust-marked-articles (info)
4156 "Set all article lists and remove all marks that are no longer legal."
4157 (let* ((marked-lists (gnus-info-marks info))
4158 (active (gnus-active (gnus-info-group info)))
4161 (types gnus-article-mark-lists)
4162 (uncompressed '(score bookmark killed))
4163 marks var articles article mark)
4166 (setq marks (pop marked-lists))
4167 (set (setq var (intern (format "gnus-newsgroup-%s"
4168 (car (rassq (setq mark (car marks))
4170 (if (memq (car marks) uncompressed) (cdr marks)
4171 (gnus-uncompress-range (cdr marks))))
4173 (setq articles (symbol-value var))
4175 ;; All articles have to be subsets of the active articles.
4177 ;; Adjust "simple" lists.
4178 ((memq mark '(tick dormant expire reply save))
4180 (when (or (< (setq article (pop articles)) min) (> article max))
4181 (set var (delq article (symbol-value var))))))
4183 ((memq mark uncompressed)
4184 (when (not (listp (cdr (symbol-value var))))
4185 (set var (list (symbol-value var))))
4186 (when (not (listp (cdr articles)))
4187 (setq articles (list articles)))
4189 (when (or (not (consp (setq article (pop articles))))
4190 (< (car article) min)
4191 (> (car article) max))
4192 (set var (delq article (symbol-value var))))))))))
4194 (defun gnus-update-missing-marks (missing)
4195 "Go through the list of MISSING articles and remove them from the mark lists."
4197 (let ((types gnus-article-mark-lists)
4199 ;; Go through all types.
4201 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4202 (when (symbol-value var)
4203 ;; This list has articles. So we delete all missing articles
4207 (set var (delq (pop m) (symbol-value var)))))))))
4209 (defun gnus-update-marks ()
4210 "Enter the various lists of marked articles into the newsgroup info list."
4211 (let ((types gnus-article-mark-lists)
4212 (info (gnus-get-info gnus-newsgroup-name))
4213 (uncompressed '(score bookmark killed))
4214 type list newmarked symbol delta-marks)
4216 ;; Add all marks lists that are non-nil to the list of marks lists.
4217 (while (setq type (pop types))
4218 (when (setq list (symbol-value
4220 (intern (format "gnus-newsgroup-%s"
4223 ;; Get rid of the entries of the articles that have the
4225 (when (and (eq (cdr type) 'score)
4229 (prev (cons nil list))
4232 (if (or (not (consp (car arts)))
4233 (= (cdar arts) gnus-summary-default-score))
4234 (setcdr prev (cdr arts))
4236 (setq arts (cdr arts)))
4237 (setq list (cdr all))))
4239 (push (cons (cdr type)
4240 (if (memq (cdr type) uncompressed) list
4241 (gnus-compress-sequence
4242 (set symbol (sort list '<)) t)))
4245 ;; Enter these new marks into the info of the group.
4247 (setcar (nthcdr 3 info) newmarked)
4248 ;; Add the marks lists to the end of the info.
4250 (setcdr (nthcdr 2 info) (list newmarked))))
4252 ;; Cut off the end of the info if there's nothing else there.
4256 (when (nthcdr (decf i) info)
4257 (setcdr (nthcdr i info) nil)))))))
4259 (defun gnus-set-mode-line (where)
4260 "This function sets the mode line of the article or summary buffers.
4261 If WHERE is `summary', the summary mode line format will be used."
4262 ;; Is this mode line one we keep updated?
4263 (when (and (memq where gnus-updated-mode-lines)
4265 (intern (format "gnus-%s-mode-line-format-spec" where))))
4268 ;; We evaluate this in the summary buffer since these
4269 ;; variables are buffer-local to that buffer.
4270 (set-buffer gnus-summary-buffer)
4271 ;; We bind all these variables that are used in the `eval' form
4273 (let* ((mformat (symbol-value
4275 (format "gnus-%s-mode-line-format-spec" where))))
4276 (gnus-tmp-group-name gnus-newsgroup-name)
4277 (gnus-tmp-article-number (or gnus-current-article 0))
4278 (gnus-tmp-unread gnus-newsgroup-unreads)
4279 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4280 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4281 (gnus-tmp-unread-and-unselected
4282 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4283 (zerop gnus-tmp-unselected))
4285 ((zerop gnus-tmp-unselected)
4286 (format "{%d more}" gnus-tmp-unread-and-unticked))
4287 (t (format "{%d(+%d) more}"
4288 gnus-tmp-unread-and-unticked
4289 gnus-tmp-unselected))))
4291 (if (and gnus-current-headers
4292 (vectorp gnus-current-headers))
4293 (gnus-mode-string-quote
4294 (mail-header-subject gnus-current-headers))
4296 bufname-length max-len
4297 gnus-tmp-header);; passed as argument to any user-format-funcs
4298 (setq mode-string (eval mformat))
4299 (setq bufname-length (if (string-match "%b" mode-string)
4302 (if (eq where 'summary)
4304 (get-buffer gnus-article-buffer))))
4307 (setq max-len (max 4 (if gnus-mode-non-string-length
4309 gnus-mode-non-string-length
4311 (length mode-string))))
4312 ;; We might have to chop a bit of the string off...
4313 (when (> (length mode-string) max-len)
4315 (concat (truncate-string-to-width mode-string (- max-len 3))
4317 ;; Pad the mode string a bit.
4318 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4319 ;; Update the mode line.
4320 (setq mode-line-buffer-identification
4321 (gnus-mode-line-buffer-identification (list mode-string)))
4322 (set-buffer-modified-p t))))
4324 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4325 "Go through the HEADERS list and add all Xrefs to a hash table.
4326 The resulting hash table is returned, or nil if no Xrefs were found."
4327 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4328 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4329 (xref-hashtb (gnus-make-hashtable))
4330 start group entry number xrefs header)
4332 (setq header (pop headers))
4333 (when (and (setq xrefs (mail-header-xref header))
4334 (not (memq (setq number (mail-header-number header))
4337 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4338 (setq start (match-end 0))
4339 (setq group (if prefix
4340 (concat prefix (substring xrefs (match-beginning 1)
4342 (substring xrefs (match-beginning 1) (match-end 1))))
4344 (string-to-int (substring xrefs (match-beginning 2)
4346 (if (setq entry (gnus-gethash group xref-hashtb))
4347 (setcdr entry (cons number (cdr entry)))
4348 (gnus-sethash group (cons number nil) xref-hashtb)))))
4349 (and start xref-hashtb)))
4351 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4352 "Look through all the headers and mark the Xrefs as read."
4353 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4354 name entry info xref-hashtb idlist method nth4)
4356 (set-buffer gnus-group-buffer)
4357 (when (setq xref-hashtb
4358 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4361 (unless (string= from-newsgroup (setq name (symbol-name group)))
4362 (setq idlist (symbol-value group))
4363 ;; Dead groups are not updated.
4365 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4367 (when (stringp (setq nth4 (gnus-info-method info)))
4368 (setq nth4 (gnus-server-to-method nth4))))
4369 ;; Only do the xrefs if the group has the same
4370 ;; select method as the group we have just read.
4371 (or (gnus-methods-equal-p
4372 nth4 (gnus-find-method-for-group from-newsgroup))
4374 (equal nth4 (setq method (gnus-find-method-for-group
4376 (and (equal (car nth4) (car method))
4377 (equal (nth 1 nth4) (nth 1 method))))
4378 gnus-use-cross-reference
4379 (or (not (eq gnus-use-cross-reference t))
4381 ;; Only do cross-references on subscribed
4382 ;; groups, if that is what is wanted.
4383 (<= (gnus-info-level info) gnus-level-subscribed))
4384 (gnus-group-make-articles-read name idlist))))
4387 (defun gnus-compute-read-articles (group articles)
4388 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4389 (info (nth 2 entry))
4390 (active (gnus-active group))
4393 ;; First peel off all illegal article numbers.
4395 (let ((ids articles)
4397 (while (setq id (pop ids))
4398 (when (and first (> id (cdr active)))
4399 ;; We'll end up in this situation in one particular
4400 ;; obscure situation. If you re-scan a group and get
4401 ;; a new article that is cross-posted to a different
4402 ;; group that has not been re-scanned, you might get
4403 ;; crossposted article that has a higher number than
4404 ;; Gnus believes possible. So we re-activate this
4405 ;; group as well. This might mean doing the
4406 ;; crossposting thingy will *increase* the number
4407 ;; of articles in some groups. Tsk, tsk.
4408 (setq active (or (gnus-activate-group group) active)))
4409 (when (or (> id (cdr active))
4410 (< id (car active)))
4411 (setq articles (delq id articles))))))
4412 ;; If the read list is nil, we init it.
4414 (null (gnus-info-read info))
4416 (setq ninfo (cons 1 (1- (car active))))
4417 (setq ninfo (gnus-info-read info)))
4418 ;; Then we add the read articles to the range.
4420 ninfo (setq articles (sort articles '<))))))
4422 (defun gnus-group-make-articles-read (group articles)
4423 "Update the info of GROUP to say that ARTICLES are read."
4425 (entry (gnus-gethash group gnus-newsrc-hashtb))
4426 (info (nth 2 entry))
4427 (active (gnus-active group))
4430 (setq range (gnus-compute-read-articles group articles))
4432 (set-buffer gnus-group-buffer)
4435 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4436 (gnus-info-set-read ',info ',(gnus-info-read info))
4437 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4438 (gnus-group-update-group ,group t))))
4439 ;; Add the read articles to the range.
4440 (gnus-info-set-read info range)
4441 ;; Then we have to re-compute how many unread
4442 ;; articles there are in this group.
4446 (setq num (- (1+ (cdr active)) (car active))))
4447 ((not (listp (cdr range)))
4448 (setq num (- (cdr active) (- (1+ (cdr range))
4452 (if (numberp (car range))
4454 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4455 (setq range (cdr range)))
4456 (setq num (- (cdr active) num))))
4457 ;; Update the number of unread articles.
4459 ;; Update the group buffer.
4460 (gnus-group-update-group group t)))))
4462 (defun gnus-methods-equal-p (m1 m2)
4463 (let ((m1 (or m1 gnus-select-method))
4464 (m2 (or m2 gnus-select-method)))
4466 (and (eq (car m1) (car m2))
4467 (or (not (memq 'address (assoc (symbol-name (car m1))
4468 gnus-valid-select-methods)))
4469 (equal (nth 1 m1) (nth 1 m2)))))))
4471 (defvar gnus-newsgroup-none-id 0)
4473 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4474 (let ((cur nntp-server-buffer)
4477 (save-excursion (set-buffer gnus-summary-buffer)
4478 gnus-newsgroup-dependencies)))
4481 (set-buffer nntp-server-buffer)
4482 ;; Translate all TAB characters into SPACE characters.
4483 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4484 (gnus-run-hooks 'gnus-parse-headers-hook)
4485 (let ((case-fold-search t)
4486 in-reply-to header p lines chars)
4487 (goto-char (point-min))
4488 ;; Search to the beginning of the next header. Error messages
4489 ;; do not begin with 2 or 3.
4490 (while (re-search-forward "^[23][0-9]+ " nil t)
4493 ;; This implementation of this function, with nine
4494 ;; search-forwards instead of the one re-search-forward and
4495 ;; a case (which basically was the old function) is actually
4496 ;; about twice as fast, even though it looks messier. You
4497 ;; can't have everything, I guess. Speed and elegance
4498 ;; doesn't always go hand in hand.
4507 (narrow-to-region (point)
4508 (or (and (search-forward "\n.\n" nil t)
4514 (if (search-forward "\nsubject: " nil t)
4515 (funcall gnus-decode-encoded-word-function
4516 (nnheader-header-value))
4521 (if (search-forward "\nfrom: " nil t)
4522 (funcall gnus-decode-encoded-word-function
4523 (nnheader-header-value))
4528 (if (search-forward "\ndate: " nil t)
4529 (nnheader-header-value) ""))
4533 (setq id (if (re-search-forward
4534 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4535 ;; We do it this way to make sure the Message-ID
4536 ;; is (somewhat) syntactically valid.
4537 (buffer-substring (match-beginning 1)
4539 ;; If there was no message-id, we just fake one
4540 ;; to make subsequent routines simpler.
4541 (nnheader-generate-fake-message-id))))
4545 (if (search-forward "\nreferences: " nil t)
4549 (nnheader-header-value)
4554 (search-backward ">" end t)
4557 (search-backward "<" end t)
4559 ;; Get the references from the in-reply-to header if there
4560 ;; were no references and the in-reply-to header looks
4562 (if (and (search-forward "\nin-reply-to: " nil t)
4563 (setq in-reply-to (nnheader-header-value))
4564 (string-match "<[^>]+>" in-reply-to))
4566 (setq ref (substring in-reply-to (match-beginning 0)
4568 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4569 (setq ref2 (substring in-reply-to (match-beginning 0)
4571 (when (> (length ref2) (length ref))
4578 (if (search-forward "\nchars: " nil t)
4579 (if (numberp (setq chars (ignore-errors (read cur))))
4585 (if (search-forward "\nlines: " nil t)
4586 (if (numberp (setq lines (ignore-errors (read cur))))
4592 (and (search-forward "\nxref: " nil t)
4593 (nnheader-header-value)))
4595 (when gnus-extra-headers
4596 (let ((extra gnus-extra-headers)
4600 (when (search-forward
4601 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4602 (push (cons (car extra) (nnheader-header-value))
4606 (when (equal id ref)
4609 (when gnus-alter-header-function
4610 (funcall gnus-alter-header-function header)
4611 (setq id (mail-header-id header)
4612 ref (gnus-parent-id (mail-header-references header))))
4615 (gnus-dependencies-add-header
4616 header dependencies force-new))
4617 (push header headers))
4618 (goto-char (point-max))
4620 (nreverse headers)))))
4622 ;; Goes through the xover lines and returns a list of vectors
4623 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4624 force-new dependencies
4625 group also-fetch-heads)
4626 "Parse the news overview data in the server buffer, and return a
4627 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4628 ;; Get the Xref when the users reads the articles since most/some
4629 ;; NNTP servers do not include Xrefs when using XOVER.
4630 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4631 (let ((cur nntp-server-buffer)
4632 (dependencies (or dependencies gnus-newsgroup-dependencies))
4633 number headers header)
4635 (set-buffer nntp-server-buffer)
4636 (goto-char (point-min))
4637 (while (search-forward "\r" nil t)
4638 (replace-match " " t t))
4639 ;; Allow the user to mangle the headers before parsing them.
4640 (gnus-run-hooks 'gnus-parse-headers-hook)
4641 (goto-char (point-min))
4644 (while (and sequence (not (eobp)))
4645 (setq number (read cur))
4646 (while (and sequence
4647 (< (car sequence) number))
4648 (setq sequence (cdr sequence)))
4650 (eq number (car sequence))
4652 (setq sequence (cdr sequence))
4653 (setq header (inline
4654 (gnus-nov-parse-line
4655 number dependencies force-new))))
4656 (push header headers))
4659 (gnus-error 4 "Strange nov line (%d)"
4660 (count-lines (point-min) (point)))))
4662 ;; A common bug in inn is that if you have posted an article and
4663 ;; then retrieves the active file, it will answer correctly --
4664 ;; the new article is included. However, a NOV entry for the
4665 ;; article may not have been generated yet, so this may fail.
4666 ;; We work around this problem by retrieving the last few
4667 ;; headers using HEAD.
4668 (if (or (not also-fetch-heads)
4670 ;; We (probably) got all the headers.
4672 (let ((gnus-nov-is-evil t))
4675 (when (gnus-retrieve-headers sequence group)
4676 (gnus-get-newsgroup-headers))))))))
4678 (defun gnus-article-get-xrefs ()
4679 "Fill in the Xref value in `gnus-current-headers', if necessary.
4680 This is meant to be called in `gnus-article-internal-prepare-hook'."
4681 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4682 gnus-current-headers)))
4683 (or (not gnus-use-cross-reference)
4685 (and (mail-header-xref headers)
4686 (not (string= (mail-header-xref headers) "")))
4687 (let ((case-fold-search t)
4690 (nnheader-narrow-to-headers)
4691 (goto-char (point-min))
4692 (when (or (and (eq (downcase (char-after)) ?x)
4693 (looking-at "Xref:"))
4694 (search-forward "\nXref:" nil t))
4695 (goto-char (1+ (match-end 0)))
4696 (setq xref (buffer-substring (point)
4697 (progn (end-of-line) (point))))
4698 (mail-header-set-xref headers xref)))))))
4700 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4701 "Find article ID and insert the summary line for that article.
4702 OLD-HEADER can either be a header or a line number to insert
4703 the subject line on."
4704 (let* ((line (and (numberp old-header) old-header))
4705 (old-header (and (vectorp old-header) old-header))
4706 (header (cond ((and old-header use-old-header)
4709 (gnus-number-to-header id))
4710 (gnus-number-to-header id))
4712 (gnus-read-header id))))
4713 (number (and (numberp id) id))
4716 ;; Rebuild the thread that this article is part of and go to the
4717 ;; article we have fetched.
4718 (when (and (not gnus-show-threads)
4721 (setq d (gnus-data-find (mail-header-number old-header))))
4722 (goto-char (gnus-data-pos d))
4725 (- (gnus-point-at-bol)
4727 (1+ (gnus-point-at-eol))
4728 (gnus-delete-line))))))
4730 (mail-header-set-number header (mail-header-number old-header)))
4731 (setq gnus-newsgroup-sparse
4732 (delq (setq number (mail-header-number header))
4733 gnus-newsgroup-sparse))
4734 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4735 (push number gnus-newsgroup-limit)
4736 (gnus-rebuild-thread (mail-header-id header) line)
4737 (gnus-summary-goto-subject number nil t))
4738 (when (and (numberp number)
4740 ;; We have to update the boundaries even if we can't fetch the
4741 ;; article if ID is a number -- so that the next `P' or `N'
4742 ;; command will fetch the previous (or next) article even
4743 ;; if the one we tried to fetch this time has been canceled.
4744 (when (> number gnus-newsgroup-end)
4745 (setq gnus-newsgroup-end number))
4746 (when (< number gnus-newsgroup-begin)
4747 (setq gnus-newsgroup-begin number))
4748 (setq gnus-newsgroup-unselected
4749 (delq number gnus-newsgroup-unselected)))
4750 ;; Report back a success?
4751 (and header (mail-header-number header))))
4753 ;;; Process/prefix in the summary buffer
4755 (defun gnus-summary-work-articles (n)
4756 "Return a list of articles to be worked upon.
4757 The prefix argument, the list of process marked articles, and the
4758 current article will be taken into consideration."
4760 (set-buffer gnus-summary-buffer)
4763 ;; A numerical prefix has been given.
4764 (setq n (prefix-numeric-value n))
4765 (let ((backward (< n 0))
4766 (n (abs (prefix-numeric-value n)))
4771 (push (setq article (gnus-summary-article-number))
4774 (gnus-summary-find-prev nil article)
4775 (gnus-summary-find-next nil article)))
4777 (nreverse articles)))
4778 ((and (gnus-region-active-p) (mark))
4779 (message "region active")
4780 ;; Work on the region between point and mark.
4781 (let ((max (max (point) (mark)))
4784 (goto-char (min (min (point) (mark))))
4787 (push (setq article (gnus-summary-article-number)) articles)
4788 (gnus-summary-find-next nil article)
4790 (nreverse articles))))
4791 (gnus-newsgroup-processable
4792 ;; There are process-marked articles present.
4793 ;; Save current state.
4794 (gnus-summary-save-process-mark)
4796 (reverse gnus-newsgroup-processable))
4798 ;; Just return the current article.
4799 (list (gnus-summary-article-number))))))
4801 (defmacro gnus-summary-iterate (arg &rest forms)
4802 "Iterate over the process/prefixed articles and do FORMS.
4803 ARG is the interactive prefix given to the command. FORMS will be
4804 executed with point over the summary line of the articles."
4805 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4806 `(let ((,articles (gnus-summary-work-articles ,arg)))
4808 (gnus-summary-goto-subject (car ,articles))
4811 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4812 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4814 (defun gnus-summary-save-process-mark ()
4815 "Push the current set of process marked articles on the stack."
4817 (push (copy-sequence gnus-newsgroup-processable)
4818 gnus-newsgroup-process-stack))
4820 (defun gnus-summary-kill-process-mark ()
4821 "Push the current set of process marked articles on the stack and unmark."
4823 (gnus-summary-save-process-mark)
4824 (gnus-summary-unmark-all-processable))
4826 (defun gnus-summary-yank-process-mark ()
4827 "Pop the last process mark state off the stack and restore it."
4829 (unless gnus-newsgroup-process-stack
4830 (error "Empty mark stack"))
4831 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4833 (defun gnus-summary-process-mark-set (set)
4834 "Make SET into the current process marked articles."
4835 (gnus-summary-unmark-all-processable)
4837 (gnus-summary-set-process-mark (pop set))))
4839 ;;; Searching and stuff
4841 (defun gnus-summary-search-group (&optional backward use-level)
4842 "Search for next unread newsgroup.
4843 If optional argument BACKWARD is non-nil, search backward instead."
4845 (set-buffer gnus-group-buffer)
4846 (when (gnus-group-search-forward
4847 backward nil (if use-level (gnus-group-group-level) nil))
4848 (gnus-group-group-name))))
4850 (defun gnus-summary-best-group (&optional exclude-group)
4851 "Find the name of the best unread group.
4852 If EXCLUDE-GROUP, do not go to this group."
4854 (set-buffer gnus-group-buffer)
4856 (gnus-group-best-unread-group exclude-group))))
4858 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4859 (if backward (gnus-summary-find-prev)
4860 (let* ((dummy (gnus-summary-article-intangible-p))
4861 (article (or article (gnus-summary-article-number)))
4862 (arts (gnus-data-find-list article))
4864 (when (and (not dummy)
4865 (or (not gnus-summary-check-current)
4867 (not (gnus-data-unread-p (car arts)))))
4868 (setq arts (cdr arts)))
4873 (when (or (and undownloaded
4874 (eq gnus-undownloaded-mark
4875 (gnus-data-mark (car arts))))
4876 (gnus-data-unread-p (car arts)))
4877 (setq result (car arts)
4879 (setq arts (cdr arts)))
4882 (goto-char (gnus-data-pos result))
4883 (gnus-data-number result)))))
4885 (defun gnus-summary-find-prev (&optional unread article)
4886 (let* ((eobp (eobp))
4887 (article (or article (gnus-summary-article-number)))
4888 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4890 (when (and (not eobp)
4891 (or (not gnus-summary-check-current)
4893 (not (gnus-data-unread-p (car arts)))))
4894 (setq arts (cdr arts)))
4899 (when (gnus-data-unread-p (car arts))
4900 (setq result (car arts)
4902 (setq arts (cdr arts)))
4905 (goto-char (gnus-data-pos result))
4906 (gnus-data-number result))))
4908 (defun gnus-summary-find-subject (subject &optional unread backward article)
4909 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4910 (article (or article (gnus-summary-article-number)))
4911 (articles (gnus-data-list backward))
4912 (arts (gnus-data-find-list article articles))
4914 (when (or (not gnus-summary-check-current)
4916 (not (gnus-data-unread-p (car arts))))
4917 (setq arts (cdr arts)))
4919 (and (or (not unread)
4920 (gnus-data-unread-p (car arts)))
4921 (vectorp (gnus-data-header (car arts)))
4923 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4924 (setq result (car arts)
4926 (setq arts (cdr arts)))
4928 (goto-char (gnus-data-pos result))
4929 (gnus-data-number result))))
4931 (defun gnus-summary-search-forward (&optional unread subject backward)
4932 "Search forward for an article.
4933 If UNREAD, look for unread articles. If SUBJECT, look for
4934 articles with that subject. If BACKWARD, search backward instead."
4935 (cond (subject (gnus-summary-find-subject subject unread backward))
4936 (backward (gnus-summary-find-prev unread))
4937 (t (gnus-summary-find-next unread))))
4939 (defun gnus-recenter (&optional n)
4940 "Center point in window and redisplay frame.
4941 Also do horizontal recentering."
4943 (when (and gnus-auto-center-summary
4944 (not (eq gnus-auto-center-summary 'vertical)))
4945 (gnus-horizontal-recenter))
4948 (defun gnus-summary-recenter ()
4949 "Center point in the summary window.
4950 If `gnus-auto-center-summary' is nil, or the article buffer isn't
4951 displayed, no centering will be performed."
4952 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
4953 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
4954 (let* ((top (cond ((< (window-height) 4) 0)
4955 ((< (window-height) 7) 1)
4956 (t (if (numberp gnus-auto-center-summary)
4957 gnus-auto-center-summary
4959 (height (1- (window-height)))
4960 (bottom (save-excursion (goto-char (point-max))
4961 (forward-line (- height))
4963 (window (get-buffer-window (current-buffer))))
4964 ;; The user has to want it.
4965 (when gnus-auto-center-summary
4966 (when (get-buffer-window gnus-article-buffer)
4967 ;; Only do recentering when the article buffer is displayed,
4968 ;; Set the window start to either `bottom', which is the biggest
4969 ;; possible valid number, or the second line from the top,
4970 ;; whichever is the least.
4972 window (min bottom (save-excursion
4973 (forward-line (- top)) (point)))))
4974 ;; Do horizontal recentering while we're at it.
4975 (when (and (get-buffer-window (current-buffer) t)
4976 (not (eq gnus-auto-center-summary 'vertical)))
4977 (let ((selected (selected-window)))
4978 (select-window (get-buffer-window (current-buffer) t))
4979 (gnus-summary-position-point)
4980 (gnus-horizontal-recenter)
4981 (select-window selected))))))
4983 (defun gnus-summary-jump-to-group (newsgroup)
4984 "Move point to NEWSGROUP in group mode buffer."
4985 ;; Keep update point of group mode buffer if visible.
4986 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
4987 (save-window-excursion
4988 ;; Take care of tree window mode.
4989 (when (get-buffer-window gnus-group-buffer)
4990 (pop-to-buffer gnus-group-buffer))
4991 (gnus-group-jump-to-group newsgroup))
4993 ;; Take care of tree window mode.
4994 (if (get-buffer-window gnus-group-buffer)
4995 (pop-to-buffer gnus-group-buffer)
4996 (set-buffer gnus-group-buffer))
4997 (gnus-group-jump-to-group newsgroup))))
4999 ;; This function returns a list of article numbers based on the
5000 ;; difference between the ranges of read articles in this group and
5001 ;; the range of active articles.
5002 (defun gnus-list-of-unread-articles (group)
5003 (let* ((read (gnus-info-read (gnus-get-info group)))
5004 (active (or (gnus-active group) (gnus-activate-group group)))
5007 ;; If none are read, then all are unread.
5009 (setq first (car active))
5010 ;; If the range of read articles is a single range, then the
5011 ;; first unread article is the article after the last read
5012 ;; article. Sounds logical, doesn't it?
5013 (if (not (listp (cdr read)))
5014 (setq first (max (car active) (1+ (cdr read))))
5015 ;; `read' is a list of ranges.
5016 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5019 (setq first (car active)))
5022 (while (< first nlast)
5024 (setq first (1+ first))))
5025 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5026 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5027 (setq read (cdr read)))))
5028 ;; And add the last unread articles.
5029 (while (<= first last)
5031 (setq first (1+ first)))
5032 ;; Return the list of unread articles.
5033 (delq 0 (nreverse unread))))
5035 (defun gnus-list-of-read-articles (group)
5036 "Return a list of unread, unticked and non-dormant articles."
5037 (let* ((info (gnus-get-info group))
5038 (marked (gnus-info-marks info))
5039 (active (gnus-active group)))
5041 (gnus-set-difference
5042 (gnus-sorted-complement
5043 (gnus-uncompress-range active)
5044 (gnus-list-of-unread-articles group))
5046 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5047 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5049 ;; Various summary commands
5051 (defun gnus-summary-select-article-buffer ()
5052 "Reconfigure windows to show article buffer."
5054 (if (not (gnus-buffer-live-p gnus-article-buffer))
5055 (error "There is no article buffer for this summary buffer")
5056 (gnus-configure-windows 'article)
5057 (select-window (get-buffer-window gnus-article-buffer))))
5059 (defun gnus-summary-universal-argument (arg)
5060 "Perform any operation on all articles that are process/prefixed."
5062 (let ((articles (gnus-summary-work-articles arg))
5069 (substitute-command-keys
5070 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5073 (gnus-error 1 "Undefined key")
5076 (gnus-summary-goto-subject (setq article (pop articles)))
5077 (let (gnus-newsgroup-processable)
5078 (command-execute func))
5079 (gnus-summary-remove-process-mark article)))))
5080 (gnus-summary-position-point))
5082 (defun gnus-summary-toggle-truncation (&optional arg)
5083 "Toggle truncation of summary lines.
5084 With arg, turn line truncation on iff arg is positive."
5086 (setq truncate-lines
5087 (if (null arg) (not truncate-lines)
5088 (> (prefix-numeric-value arg) 0)))
5091 (defun gnus-summary-reselect-current-group (&optional all rescan)
5092 "Exit and then reselect the current newsgroup.
5093 The prefix argument ALL means to select all articles."
5095 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5096 (error "Ephemeral groups can't be reselected"))
5097 (let ((current-subject (gnus-summary-article-number))
5098 (group gnus-newsgroup-name))
5099 (setq gnus-newsgroup-begin nil)
5101 ;; We have to adjust the point of group mode buffer because
5102 ;; point was moved to the next unread newsgroup by exiting.
5103 (gnus-summary-jump-to-group group)
5106 (gnus-group-get-new-news-this-group 1)))
5107 (gnus-group-read-group all t)
5108 (gnus-summary-goto-subject current-subject nil t)))
5110 (defun gnus-summary-rescan-group (&optional all)
5111 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5113 (gnus-summary-reselect-current-group all t))
5115 (defun gnus-summary-update-info (&optional non-destructive)
5117 (let ((group gnus-newsgroup-name))
5119 (when gnus-newsgroup-kill-headers
5120 (setq gnus-newsgroup-killed
5121 (gnus-compress-sequence
5123 (gnus-set-sorted-intersection
5124 (gnus-uncompress-range gnus-newsgroup-killed)
5125 (setq gnus-newsgroup-unselected
5126 (sort gnus-newsgroup-unselected '<)))
5127 (setq gnus-newsgroup-unreads
5128 (sort gnus-newsgroup-unreads '<)))
5130 (unless (listp (cdr gnus-newsgroup-killed))
5131 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5132 (let ((headers gnus-newsgroup-headers))
5133 ;; Set the new ranges of read articles.
5135 (set-buffer gnus-group-buffer)
5136 (gnus-undo-force-boundary))
5137 (gnus-update-read-articles
5138 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5139 ;; Set the current article marks.
5140 (let ((gnus-newsgroup-scored
5141 (if (and (not gnus-save-score)
5142 (not non-destructive))
5144 gnus-newsgroup-scored)))
5146 (gnus-update-marks)))
5147 ;; Do the cross-ref thing.
5148 (when gnus-use-cross-reference
5149 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5150 ;; Do not switch windows but change the buffer to work.
5151 (set-buffer gnus-group-buffer)
5152 (unless (gnus-ephemeral-group-p group)
5153 (gnus-group-update-group group)))))))
5155 (defun gnus-summary-save-newsrc (&optional force)
5156 "Save the current number of read/marked articles in the dribble buffer.
5157 The dribble buffer will then be saved.
5158 If FORCE (the prefix), also save the .newsrc file(s)."
5160 (gnus-summary-update-info t)
5162 (gnus-save-newsrc-file)
5163 (gnus-dribble-save)))
5165 (defun gnus-summary-exit (&optional temporary)
5166 "Exit reading current newsgroup, and then return to group selection mode.
5167 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5169 (gnus-set-global-variables)
5170 (gnus-kill-save-kill-buffer)
5171 (gnus-async-halt-prefetch)
5172 (let* ((group gnus-newsgroup-name)
5173 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5176 (buf (current-buffer)))
5177 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5178 ;; If we have several article buffers, we kill them at exit.
5179 (unless gnus-single-article-buffer
5180 (gnus-kill-buffer gnus-original-article-buffer)
5181 (setq gnus-article-current nil))
5182 (when gnus-use-cache
5183 (gnus-cache-possibly-remove-articles)
5184 (gnus-cache-save-buffers))
5185 (gnus-async-prefetch-remove-group group)
5186 (when gnus-suppress-duplicates
5187 (gnus-dup-enter-articles))
5188 (when gnus-use-trees
5189 (gnus-tree-close group))
5190 ;; Remove entries for this group.
5191 (nnmail-purge-split-history (gnus-group-real-name group))
5192 ;; Make all changes in this group permanent.
5194 (gnus-run-hooks 'gnus-exit-group-hook)
5195 (gnus-summary-update-info)
5196 ;; Do adaptive scoring, and possibly save score files.
5197 (when gnus-newsgroup-adaptive
5198 (gnus-score-adaptive))
5199 (when gnus-use-scoring
5201 (gnus-close-group group)
5202 ;; Make sure where we were, and go to next newsgroup.
5203 (set-buffer gnus-group-buffer)
5205 (gnus-group-jump-to-group group))
5206 (gnus-run-hooks 'gnus-summary-exit-hook)
5207 (unless (or quit-config
5208 ;; If this group has disappeared from the summary
5209 ;; buffer, don't skip forwards.
5210 (not (string= group (gnus-group-group-name))))
5211 (gnus-group-next-unread-group 1))
5212 (setq group-point (point))
5215 (when (gnus-buffer-live-p gnus-article-buffer)
5217 (set-buffer gnus-article-buffer)
5218 (mm-destroy-parts gnus-article-mime-handles)))
5219 ;; If we have several article buffers, we kill them at exit.
5220 (unless gnus-single-article-buffer
5221 (gnus-kill-buffer gnus-article-buffer)
5222 (gnus-kill-buffer gnus-original-article-buffer)
5223 (setq gnus-article-current nil))
5225 (if (not gnus-kill-summary-on-exit)
5226 (gnus-deaden-summary)
5227 ;; We set all buffer-local variables to nil. It is unclear why
5228 ;; this is needed, but if we don't, buffer-local variables are
5229 ;; not garbage-collected, it seems. This would the lead to en
5230 ;; ever-growing Emacs.
5231 (gnus-summary-clear-local-variables)
5232 (when (get-buffer gnus-article-buffer)
5233 (bury-buffer gnus-article-buffer))
5234 ;; We clear the global counterparts of the buffer-local
5235 ;; variables as well, just to be on the safe side.
5236 (set-buffer gnus-group-buffer)
5237 (gnus-summary-clear-local-variables)
5238 ;; Return to group mode buffer.
5239 (when (eq mode 'gnus-summary-mode)
5240 (gnus-kill-buffer buf)))
5241 (setq gnus-current-select-method gnus-select-method)
5242 (pop-to-buffer gnus-group-buffer)
5243 (if (not quit-config)
5245 (goto-char group-point)
5246 (gnus-configure-windows 'group 'force))
5247 (gnus-handle-ephemeral-exit quit-config))
5248 ;; Clear the current group name.
5250 (setq gnus-newsgroup-name nil)))))
5252 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5253 (defun gnus-summary-exit-no-update (&optional no-questions)
5254 "Quit reading current newsgroup without updating read article info."
5256 (let* ((group gnus-newsgroup-name)
5257 (quit-config (gnus-group-quit-config group)))
5258 (when (or no-questions
5260 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5261 (gnus-async-halt-prefetch)
5262 (gnus-run-hooks (delq 'gnus-summary-expire-articles
5263 (copy-list gnus-summary-prepare-exit-hook)))
5264 (when (gnus-buffer-live-p gnus-article-buffer)
5266 (set-buffer gnus-article-buffer)
5267 (mm-destroy-parts gnus-article-mime-handles)))
5268 ;; If we have several article buffers, we kill them at exit.
5269 (unless gnus-single-article-buffer
5270 (gnus-kill-buffer gnus-article-buffer)
5271 (gnus-kill-buffer gnus-original-article-buffer)
5272 (setq gnus-article-current nil))
5273 (if (not gnus-kill-summary-on-exit)
5274 (gnus-deaden-summary)
5275 (gnus-close-group group)
5276 (gnus-summary-clear-local-variables)
5277 (set-buffer gnus-group-buffer)
5278 (gnus-summary-clear-local-variables)
5279 (when (get-buffer gnus-summary-buffer)
5280 (kill-buffer gnus-summary-buffer)))
5281 (unless gnus-single-article-buffer
5282 (setq gnus-article-current nil))
5283 (when gnus-use-trees
5284 (gnus-tree-close group))
5285 (gnus-async-prefetch-remove-group group)
5286 (when (get-buffer gnus-article-buffer)
5287 (bury-buffer gnus-article-buffer))
5288 ;; Return to the group buffer.
5289 (gnus-configure-windows 'group 'force)
5290 ;; Clear the current group name.
5291 (setq gnus-newsgroup-name nil)
5292 (when (equal (gnus-group-group-name) group)
5293 (gnus-group-next-unread-group 1))
5295 (gnus-handle-ephemeral-exit quit-config)))))
5297 (defun gnus-handle-ephemeral-exit (quit-config)
5298 "Handle movement when leaving an ephemeral group.
5299 The state which existed when entering the ephemeral is reset."
5300 (if (not (buffer-name (car quit-config)))
5301 (gnus-configure-windows 'group 'force)
5302 (set-buffer (car quit-config))
5303 (cond ((eq major-mode 'gnus-summary-mode)
5304 (gnus-set-global-variables))
5305 ((eq major-mode 'gnus-article-mode)
5307 ;; The `gnus-summary-buffer' variable may point
5308 ;; to the old summary buffer when using a single
5310 (unless (gnus-buffer-live-p gnus-summary-buffer)
5311 (set-buffer gnus-group-buffer))
5312 (set-buffer gnus-summary-buffer)
5313 (gnus-set-global-variables))))
5314 (if (or (eq (cdr quit-config) 'article)
5315 (eq (cdr quit-config) 'pick))
5317 ;; The current article may be from the ephemeral group
5318 ;; thus it is best that we reload this article
5319 (gnus-summary-show-article)
5320 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5321 (gnus-configure-windows 'pick 'force)
5322 (gnus-configure-windows (cdr quit-config) 'force)))
5323 (gnus-configure-windows (cdr quit-config) 'force))
5324 (when (eq major-mode 'gnus-summary-mode)
5325 (gnus-summary-next-subject 1 nil t)
5326 (gnus-summary-recenter)
5327 (gnus-summary-position-point))))
5331 (defvar gnus-dead-summary-mode-map nil)
5333 (unless gnus-dead-summary-mode-map
5334 (setq gnus-dead-summary-mode-map (make-keymap))
5335 (suppress-keymap gnus-dead-summary-mode-map)
5336 (substitute-key-definition
5337 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5338 (let ((keys '("\C-d" "\r" "\177" [delete])))
5340 (define-key gnus-dead-summary-mode-map
5341 (pop keys) 'gnus-summary-wake-up-the-dead))))
5343 (defvar gnus-dead-summary-mode nil
5344 "Minor mode for Gnus summary buffers.")
5346 (defun gnus-dead-summary-mode (&optional arg)
5347 "Minor mode for Gnus summary buffers."
5349 (when (eq major-mode 'gnus-summary-mode)
5350 (make-local-variable 'gnus-dead-summary-mode)
5351 (setq gnus-dead-summary-mode
5352 (if (null arg) (not gnus-dead-summary-mode)
5353 (> (prefix-numeric-value arg) 0)))
5354 (when gnus-dead-summary-mode
5355 (gnus-add-minor-mode
5356 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5358 (defun gnus-deaden-summary ()
5359 "Make the current summary buffer into a dead summary buffer."
5360 ;; Kill any previous dead summary buffer.
5361 (when (and gnus-dead-summary
5362 (buffer-name gnus-dead-summary))
5364 (set-buffer gnus-dead-summary)
5365 (when gnus-dead-summary-mode
5366 (kill-buffer (current-buffer)))))
5367 ;; Make this the current dead summary.
5368 (setq gnus-dead-summary (current-buffer))
5369 (gnus-dead-summary-mode 1)
5370 (let ((name (buffer-name)))
5371 (when (string-match "Summary" name)
5373 (concat (substring name 0 (match-beginning 0)) "Dead "
5374 (substring name (match-beginning 0)))
5377 (defun gnus-kill-or-deaden-summary (buffer)
5378 "Kill or deaden the summary BUFFER."
5380 (when (and (buffer-name buffer)
5381 (not gnus-single-article-buffer))
5384 (gnus-kill-buffer gnus-article-buffer)
5385 (gnus-kill-buffer gnus-original-article-buffer)))
5386 (cond (gnus-kill-summary-on-exit
5387 (when (and gnus-use-trees
5388 (gnus-buffer-exists-p buffer))
5391 (gnus-tree-close gnus-newsgroup-name)))
5392 (gnus-kill-buffer buffer))
5393 ((gnus-buffer-exists-p buffer)
5396 (gnus-deaden-summary))))))
5398 (defun gnus-summary-wake-up-the-dead (&rest args)
5399 "Wake up the dead summary buffer."
5401 (gnus-dead-summary-mode -1)
5402 (let ((name (buffer-name)))
5403 (when (string-match "Dead " name)
5405 (concat (substring name 0 (match-beginning 0))
5406 (substring name (match-end 0)))
5408 (gnus-message 3 "This dead summary is now alive again"))
5410 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5411 (defun gnus-summary-fetch-faq (&optional faq-dir)
5412 "Fetch the FAQ for the current group.
5413 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5417 (when current-prefix-arg
5419 "Faq dir: " (and (listp gnus-group-faq-directory)
5420 (mapcar (lambda (file) (list file))
5421 gnus-group-faq-directory))))))
5422 (let (gnus-faq-buffer)
5423 (when (setq gnus-faq-buffer
5424 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5425 (gnus-configure-windows 'summary-faq))))
5427 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5428 (defun gnus-summary-describe-group (&optional force)
5429 "Describe the current newsgroup."
5431 (gnus-group-describe-group force gnus-newsgroup-name))
5433 (defun gnus-summary-describe-briefly ()
5434 "Describe summary mode commands briefly."
5437 (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")))
5439 ;; Walking around group mode buffer from summary mode.
5441 (defun gnus-summary-next-group (&optional no-article target-group backward)
5442 "Exit current newsgroup and then select next unread newsgroup.
5443 If prefix argument NO-ARTICLE is non-nil, no article is selected
5444 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5445 previous group instead."
5447 ;; Stop pre-fetching.
5448 (gnus-async-halt-prefetch)
5449 (let ((current-group gnus-newsgroup-name)
5450 (current-buffer (current-buffer))
5452 ;; First we semi-exit this group to update Xrefs and all variables.
5453 ;; We can't do a real exit, because the window conf must remain
5454 ;; the same in case the user is prompted for info, and we don't
5455 ;; want the window conf to change before that...
5456 (gnus-summary-exit t)
5457 (while (not entered)
5458 ;; Then we find what group we are supposed to enter.
5459 (set-buffer gnus-group-buffer)
5460 (gnus-group-jump-to-group current-group)
5463 (if (eq gnus-keep-same-level 'best)
5464 (gnus-summary-best-group gnus-newsgroup-name)
5465 (gnus-summary-search-group backward gnus-keep-same-level))))
5466 (if (not target-group)
5467 ;; There are no further groups, so we return to the group
5470 (gnus-message 5 "Returning to the group buffer")
5472 (when (gnus-buffer-live-p current-buffer)
5473 (set-buffer current-buffer)
5474 (gnus-summary-exit))
5475 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5476 ;; We try to enter the target group.
5477 (gnus-group-jump-to-group target-group)
5478 (let ((unreads (gnus-group-group-unread)))
5479 (if (and (or (eq t unreads)
5480 (and unreads (not (zerop unreads))))
5481 (gnus-summary-read-group
5482 target-group nil no-article
5483 (and (buffer-name current-buffer) current-buffer)
5486 (setq current-group target-group
5487 target-group nil)))))))
5489 (defun gnus-summary-prev-group (&optional no-article)
5490 "Exit current newsgroup and then select previous unread newsgroup.
5491 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5493 (gnus-summary-next-group no-article nil t))
5495 ;; Walking around summary lines.
5497 (defun gnus-summary-first-subject (&optional unread undownloaded)
5498 "Go to the first unread subject.
5499 If UNREAD is non-nil, go to the first unread article.
5500 Returns the article selected or nil if there are no unread articles."
5505 ((null gnus-newsgroup-data)
5506 (gnus-message 3 "No articles in the group")
5508 ;; Pick the first article.
5510 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5511 (gnus-data-number (car gnus-newsgroup-data)))
5512 ;; No unread articles.
5513 ((null gnus-newsgroup-unreads)
5514 (gnus-message 3 "No more unread articles")
5516 ;; Find the first unread article.
5518 (let ((data gnus-newsgroup-data))
5520 (and (not (and undownloaded
5521 (eq gnus-undownloaded-mark
5522 (gnus-data-mark (car data)))))
5523 (not (gnus-data-unread-p (car data)))))
5524 (setq data (cdr data)))
5526 (goto-char (gnus-data-pos (car data)))
5527 (gnus-data-number (car data))))))
5528 (gnus-summary-position-point)))
5530 (defun gnus-summary-next-subject (n &optional unread dont-display)
5531 "Go to next N'th summary line.
5532 If N is negative, go to the previous N'th subject line.
5533 If UNREAD is non-nil, only unread articles are selected.
5534 The difference between N and the actual number of steps taken is
5537 (let ((backward (< n 0))
5541 (gnus-summary-find-prev unread)
5542 (gnus-summary-find-next unread)))
5543 (gnus-summary-show-thread)
5546 (gnus-message 7 "No more%s articles"
5547 (if unread " unread" "")))
5548 (unless dont-display
5549 (gnus-summary-recenter)
5550 (gnus-summary-position-point))
5553 (defun gnus-summary-next-unread-subject (n)
5554 "Go to next N'th unread summary line."
5556 (gnus-summary-next-subject n t))
5558 (defun gnus-summary-prev-subject (n &optional unread)
5559 "Go to previous N'th summary line.
5560 If optional argument UNREAD is non-nil, only unread article is selected."
5562 (gnus-summary-next-subject (- n) unread))
5564 (defun gnus-summary-prev-unread-subject (n)
5565 "Go to previous N'th unread summary line."
5567 (gnus-summary-next-subject (- n) t))
5569 (defun gnus-summary-goto-subject (article &optional force silent)
5570 "Go the subject line of ARTICLE.
5571 If FORCE, also allow jumping to articles not currently shown."
5572 (interactive "nArticle number: ")
5574 (data (gnus-data-find article)))
5575 ;; We read in the article if we have to.
5578 (gnus-summary-insert-subject
5580 (if (or (numberp force) (vectorp force)) force)
5582 (setq data (gnus-data-find article)))
5587 (gnus-message 3 "Can't find article %d" article))
5589 (goto-char (gnus-data-pos data))
5590 (gnus-summary-position-point)
5593 ;; Walking around summary lines with displaying articles.
5595 (defun gnus-summary-expand-window (&optional arg)
5596 "Make the summary buffer take up the entire Emacs frame.
5597 Given a prefix, will force an `article' buffer configuration."
5600 (gnus-configure-windows 'article 'force)
5601 (gnus-configure-windows 'summary 'force)))
5603 (defun gnus-summary-display-article (article &optional all-header)
5604 "Display ARTICLE in article buffer."
5605 (gnus-set-global-variables)
5609 (if gnus-summary-display-article-function
5610 (funcall gnus-summary-display-article-function article all-header)
5611 (gnus-article-prepare article all-header))
5612 (gnus-run-hooks 'gnus-select-article-hook)
5613 (when (and gnus-current-article
5614 (not (zerop gnus-current-article)))
5615 (gnus-summary-goto-subject gnus-current-article))
5616 (gnus-summary-recenter)
5617 (when (and gnus-use-trees gnus-show-threads)
5618 (gnus-possibly-generate-tree article)
5619 (gnus-highlight-selected-tree article))
5620 ;; Successfully display article.
5621 (gnus-article-set-window-start
5622 (cdr (assq article gnus-newsgroup-bookmarks))))))
5624 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5625 "Select the current article.
5626 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5627 non-nil, the article will be re-fetched even if it already present in
5628 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5630 ;; Make sure we are in the summary buffer to work around bbdb bug.
5631 (unless (eq major-mode 'gnus-summary-mode)
5632 (set-buffer gnus-summary-buffer))
5633 (let ((article (or article (gnus-summary-article-number)))
5634 (all-headers (not (not all-headers))) ;Must be T or NIL.
5635 gnus-summary-display-article-function
5638 (gnus-summary-article-pseudo-p article)
5639 (error "This is a pseudo-article"))
5642 (set-buffer gnus-summary-buffer)
5643 (if (or (and gnus-single-article-buffer
5644 (or (null gnus-current-article)
5645 (null gnus-article-current)
5646 (null (get-buffer gnus-article-buffer))
5647 (not (eq article (cdr gnus-article-current)))
5648 (not (equal (car gnus-article-current)
5649 gnus-newsgroup-name))))
5650 (and (not gnus-single-article-buffer)
5651 (or (null gnus-current-article)
5652 (not (eq gnus-current-article article))))
5654 ;; The requested article is different from the current article.
5656 (gnus-summary-display-article article all-headers)
5658 (when (or all-headers gnus-show-all-headers)
5659 (gnus-article-show-all-headers))
5662 (gnus-article-set-window-start
5663 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5665 (defun gnus-summary-set-current-mark (&optional current-mark)
5666 "Obsolete function."
5669 (defun gnus-summary-next-article (&optional unread subject backward push)
5670 "Select the next article.
5671 If UNREAD, only unread articles are selected.
5672 If SUBJECT, only articles with SUBJECT are selected.
5673 If BACKWARD, the previous article is selected instead of the next."
5676 ;; Is there such an article?
5677 ((and (gnus-summary-search-forward unread subject backward)
5678 (or (gnus-summary-display-article (gnus-summary-article-number))
5679 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5680 (gnus-summary-position-point))
5681 ;; If not, we try the first unread, if that is wanted.
5683 gnus-auto-select-same
5684 (gnus-summary-first-unread-article))
5685 (gnus-summary-position-point)
5686 (gnus-message 6 "Wrapped"))
5687 ;; Try to get next/previous article not displayed in this group.
5688 ((and gnus-auto-extend-newsgroup
5689 (not unread) (not subject))
5690 (gnus-summary-goto-article
5691 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5692 nil (count-lines (point-min) (point))))
5693 ;; Go to next/previous group.
5695 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5696 (gnus-summary-jump-to-group gnus-newsgroup-name))
5697 (let ((cmd last-command-char)
5700 (set-buffer gnus-group-buffer)
5703 (if (eq gnus-keep-same-level 'best)
5704 (gnus-summary-best-group gnus-newsgroup-name)
5705 (gnus-summary-search-group backward gnus-keep-same-level))))
5706 ;; For some reason, the group window gets selected. We change
5708 (select-window (get-buffer-window (current-buffer)))
5709 ;; Select next unread newsgroup automagically.
5711 ((or (not gnus-auto-select-next)
5713 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5714 ((or (eq gnus-auto-select-next 'quietly)
5715 (and (eq gnus-auto-select-next 'slightly-quietly)
5717 (and (eq gnus-auto-select-next 'almost-quietly)
5718 (gnus-summary-last-article-p)))
5720 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5722 (gnus-message 7 "No more%s articles (%s)..."
5723 (if unread " unread" "")
5724 (if group (concat "selecting " group)
5726 (gnus-summary-next-group nil group backward)))
5728 (when (gnus-key-press-event-p last-input-event)
5729 (gnus-summary-walk-group-buffer
5730 gnus-newsgroup-name cmd unread backward point))))))))
5732 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5733 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5734 (?\C-p (gnus-group-prev-unread-group 1))))
5735 (cursor-in-echo-area t)
5736 keve key group ended)
5738 (set-buffer gnus-group-buffer)
5741 (if (eq gnus-keep-same-level 'best)
5742 (gnus-summary-best-group gnus-newsgroup-name)
5743 (gnus-summary-search-group backward gnus-keep-same-level))))
5746 5 "No more%s articles%s" (if unread " unread" "")
5748 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5749 (format " (Type %s for %s [%s])"
5750 (single-key-description cmd) group
5751 (car (gnus-gethash group gnus-newsrc-hashtb)))
5752 (format " (Type %s to exit %s)"
5753 (single-key-description cmd)
5754 gnus-newsgroup-name)))
5755 ;; Confirm auto selection.
5756 (setq key (car (setq keve (gnus-read-event-char))))
5759 ((assq key keystrokes)
5760 (let ((obuf (current-buffer)))
5761 (switch-to-buffer gnus-group-buffer)
5763 (gnus-group-jump-to-group group))
5764 (eval (cadr (assq key keystrokes)))
5765 (setq group (gnus-group-group-name))
5766 (switch-to-buffer obuf))
5770 (gnus-ephemeral-group-p gnus-newsgroup-name))
5772 (gnus-summary-next-group nil group backward)))
5774 (push (cdr keve) unread-command-events))))))
5776 (defun gnus-summary-next-unread-article ()
5777 "Select unread article after current one."
5779 (gnus-summary-next-article
5780 (or (not (eq gnus-summary-goto-unread 'never))
5781 (gnus-summary-last-article-p (gnus-summary-article-number)))
5782 (and gnus-auto-select-same
5783 (gnus-summary-article-subject))))
5785 (defun gnus-summary-prev-article (&optional unread subject)
5786 "Select the article after the current one.
5787 If UNREAD is non-nil, only unread articles are selected."
5789 (gnus-summary-next-article unread subject t))
5791 (defun gnus-summary-prev-unread-article ()
5792 "Select unread article before current one."
5794 (gnus-summary-prev-article
5795 (or (not (eq gnus-summary-goto-unread 'never))
5796 (gnus-summary-first-article-p (gnus-summary-article-number)))
5797 (and gnus-auto-select-same
5798 (gnus-summary-article-subject))))
5800 (defun gnus-summary-next-page (&optional lines circular)
5801 "Show next page of the selected article.
5802 If at the end of the current article, select the next article.
5803 LINES says how many lines should be scrolled up.
5805 If CIRCULAR is non-nil, go to the start of the article instead of
5806 selecting the next article when reaching the end of the current
5809 (setq gnus-summary-buffer (current-buffer))
5810 (gnus-set-global-variables)
5811 (let ((article (gnus-summary-article-number))
5812 (article-window (get-buffer-window gnus-article-buffer t))
5814 ;; If the buffer is empty, we have no article.
5816 (error "No article to select"))
5817 (gnus-configure-windows 'article)
5818 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5819 (if (and (eq gnus-summary-goto-unread 'never)
5820 (not (gnus-summary-last-article-p article)))
5821 (gnus-summary-next-article)
5822 (gnus-summary-next-unread-article))
5823 (if (or (null gnus-current-article)
5824 (null gnus-article-current)
5825 (/= article (cdr gnus-article-current))
5826 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5827 ;; Selected subject is different from current article's.
5828 (gnus-summary-display-article article)
5829 (when article-window
5830 (gnus-eval-in-buffer-window gnus-article-buffer
5831 (setq endp (gnus-article-next-page lines)))
5834 (gnus-summary-beginning-of-article))
5836 (gnus-message 3 "End of message"))
5838 (if (and (eq gnus-summary-goto-unread 'never)
5839 (not (gnus-summary-last-article-p article)))
5840 (gnus-summary-next-article)
5841 (gnus-summary-next-unread-article))))))))
5842 (gnus-summary-recenter)
5843 (gnus-summary-position-point)))
5845 (defun gnus-summary-prev-page (&optional lines move)
5846 "Show previous page of selected article.
5847 Argument LINES specifies lines to be scrolled down.
5848 If MOVE, move to the previous unread article if point is at
5849 the beginning of the buffer."
5851 (let ((article (gnus-summary-article-number))
5852 (article-window (get-buffer-window gnus-article-buffer t))
5854 (gnus-configure-windows 'article)
5855 (if (or (null gnus-current-article)
5856 (null gnus-article-current)
5857 (/= article (cdr gnus-article-current))
5858 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5859 ;; Selected subject is different from current article's.
5860 (gnus-summary-display-article article)
5861 (gnus-summary-recenter)
5862 (when article-window
5863 (gnus-eval-in-buffer-window gnus-article-buffer
5864 (setq endp (gnus-article-prev-page lines)))
5865 (when (and move endp)
5867 (gnus-message 3 "Beginning of message"))
5869 (if (and (eq gnus-summary-goto-unread 'never)
5870 (not (gnus-summary-first-article-p article)))
5871 (gnus-summary-prev-article)
5872 (gnus-summary-prev-unread-article))))))))
5873 (gnus-summary-position-point))
5875 (defun gnus-summary-prev-page-or-article (&optional lines)
5876 "Show previous page of selected article.
5877 Argument LINES specifies lines to be scrolled down.
5878 If at the beginning of the article, go to the next article."
5880 (gnus-summary-prev-page lines t))
5882 (defun gnus-summary-scroll-up (lines)
5883 "Scroll up (or down) one line current article.
5884 Argument LINES specifies lines to be scrolled up (or down if negative)."
5886 (gnus-configure-windows 'article)
5887 (gnus-summary-show-thread)
5888 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5889 (gnus-eval-in-buffer-window gnus-article-buffer
5891 (when (gnus-article-next-page lines)
5892 (gnus-message 3 "End of message")))
5894 (gnus-article-prev-page (- lines))))))
5895 (gnus-summary-recenter)
5896 (gnus-summary-position-point))
5898 (defun gnus-summary-scroll-down (lines)
5899 "Scroll down (or up) one line current article.
5900 Argument LINES specifies lines to be scrolled down (or up if negative)."
5902 (gnus-summary-scroll-up (- lines)))
5904 (defun gnus-summary-next-same-subject ()
5905 "Select next article which has the same subject as current one."
5907 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5909 (defun gnus-summary-prev-same-subject ()
5910 "Select previous article which has the same subject as current one."
5912 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5914 (defun gnus-summary-next-unread-same-subject ()
5915 "Select next unread article which has the same subject as current one."
5917 (gnus-summary-next-article t (gnus-summary-article-subject)))
5919 (defun gnus-summary-prev-unread-same-subject ()
5920 "Select previous unread article which has the same subject as current one."
5922 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5924 (defun gnus-summary-first-unread-article ()
5925 "Select the first unread article.
5926 Return nil if there are no unread articles."
5929 (when (gnus-summary-first-subject t)
5930 (gnus-summary-show-thread)
5931 (gnus-summary-first-subject t)
5932 (gnus-summary-display-article (gnus-summary-article-number)))
5933 (gnus-summary-position-point)))
5935 (defun gnus-summary-first-unread-subject ()
5936 "Place the point on the subject line of the first unread article.
5937 Return nil if there are no unread articles."
5940 (when (gnus-summary-first-subject t)
5941 (gnus-summary-show-thread)
5942 (gnus-summary-first-subject t))
5943 (gnus-summary-position-point)))
5945 (defun gnus-summary-first-article ()
5946 "Select the first article.
5947 Return nil if there are no articles."
5950 (when (gnus-summary-first-subject)
5951 (gnus-summary-show-thread)
5952 (gnus-summary-first-subject)
5953 (gnus-summary-display-article (gnus-summary-article-number)))
5954 (gnus-summary-position-point)))
5956 (defun gnus-summary-best-unread-article ()
5957 "Select the unread article with the highest score."
5959 (let ((best -1000000)
5960 (data gnus-newsgroup-data)
5963 (and (gnus-data-unread-p (car data))
5965 (gnus-summary-article-score (gnus-data-number (car data))))
5968 article (gnus-data-number (car data))))
5969 (setq data (cdr data)))
5972 (gnus-summary-goto-article article)
5973 (error "No unread articles"))
5974 (gnus-summary-position-point))))
5976 (defun gnus-summary-last-subject ()
5977 "Go to the last displayed subject line in the group."
5978 (let ((article (gnus-data-number (car (gnus-data-list t)))))
5980 (gnus-summary-goto-subject article))))
5982 (defun gnus-summary-goto-article (article &optional all-headers force)
5983 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
5984 If ALL-HEADERS is non-nil, no header lines are hidden.
5985 If FORCE, go to the article even if it isn't displayed. If FORCE
5986 is a number, it is the line the article is to be displayed on."
5990 "Article number or Message-ID: "
5991 (mapcar (lambda (number) (list (int-to-string number)))
5992 gnus-newsgroup-limit))
5996 (if (and (stringp article)
5997 (string-match "@" article))
5998 (gnus-summary-refer-article article)
5999 (when (stringp article)
6000 (setq article (string-to-number article)))
6001 (if (gnus-summary-goto-subject article force)
6002 (gnus-summary-display-article article all-headers)
6003 (gnus-message 4 "Couldn't go to article %s" article) nil))
6004 (gnus-summary-position-point)))
6006 (defun gnus-summary-goto-last-article ()
6007 "Go to the previously read article."
6010 (when gnus-last-article
6011 (gnus-summary-goto-article gnus-last-article nil t))
6012 (gnus-summary-position-point)))
6014 (defun gnus-summary-pop-article (number)
6015 "Pop one article off the history and go to the previous.
6016 NUMBER articles will be popped off."
6019 (setq gnus-newsgroup-history
6020 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6022 (gnus-summary-goto-article (car to) nil t)
6023 (error "Article history empty")))
6024 (gnus-summary-position-point))
6026 ;; Summary commands and functions for limiting the summary buffer.
6028 (defun gnus-summary-limit-to-articles (n)
6029 "Limit the summary buffer to the next N articles.
6030 If not given a prefix, use the process marked articles instead."
6033 (let ((articles (gnus-summary-work-articles n)))
6034 (setq gnus-newsgroup-processable nil)
6035 (gnus-summary-limit articles))
6036 (gnus-summary-position-point)))
6038 (defun gnus-summary-pop-limit (&optional total)
6039 "Restore the previous limit.
6040 If given a prefix, remove all limits."
6043 (setq gnus-newsgroup-limits
6044 (list (mapcar (lambda (h) (mail-header-number h))
6045 gnus-newsgroup-headers))))
6046 (unless gnus-newsgroup-limits
6047 (error "No limit to pop"))
6049 (gnus-summary-limit nil 'pop)
6050 (gnus-summary-position-point)))
6052 (defun gnus-summary-limit-to-subject (subject &optional header)
6053 "Limit the summary buffer to articles that have subjects that match a regexp."
6054 (interactive "sLimit to subject (regexp): ")
6056 (setq header "subject"))
6057 (when (not (equal "" subject))
6059 (let ((articles (gnus-summary-find-matching
6060 (or header "subject") subject 'all)))
6062 (error "Found no matches for \"%s\"" subject))
6063 (gnus-summary-limit articles))
6064 (gnus-summary-position-point))))
6066 (defun gnus-summary-limit-to-author (from)
6067 "Limit the summary buffer to articles that have authors that match a regexp."
6068 (interactive "sLimit to author (regexp): ")
6069 (gnus-summary-limit-to-subject from "from"))
6071 (defun gnus-summary-limit-to-age (age &optional younger-p)
6072 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6073 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6074 articles that are younger than AGE days."
6075 (interactive "nTime in days: \nP")
6077 (let ((data gnus-newsgroup-data)
6078 (cutoff (days-to-time age))
6079 articles d date is-younger)
6080 (while (setq d (pop data))
6081 (when (and (vectorp (gnus-data-header d))
6082 (setq date (mail-header-date (gnus-data-header d))))
6083 (setq is-younger (time-less-p
6084 (time-since (date-to-time date))
6089 (push (gnus-data-number d) articles))))
6090 (gnus-summary-limit (nreverse articles)))
6091 (gnus-summary-position-point)))
6093 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6095 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6097 (defun gnus-summary-limit-to-unread (&optional all)
6098 "Limit the summary buffer to articles that are not marked as read.
6099 If ALL is non-nil, limit strictly to unread articles."
6102 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6103 (gnus-summary-limit-to-marks
6104 ;; Concat all the marks that say that an article is read and have
6106 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6107 gnus-killed-mark gnus-kill-file-mark
6108 gnus-low-score-mark gnus-expirable-mark
6109 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6110 gnus-duplicate-mark gnus-souped-mark)
6113 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6114 (make-obsolete 'gnus-summary-delete-marked-with
6115 'gnus-summary-limit-exlude-marks)
6117 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6118 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6119 If REVERSE, limit the summary buffer to articles that are marked
6120 with MARKS. MARKS can either be a string of marks or a list of marks.
6121 Returns how many articles were removed."
6122 (interactive "sMarks: ")
6123 (gnus-summary-limit-to-marks marks t))
6125 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6126 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6127 If REVERSE (the prefix), limit the summary buffer to articles that are
6128 not marked with MARKS. MARKS can either be a string of marks or a
6130 Returns how many articles were removed."
6131 (interactive "sMarks: \nP")
6133 (let ((data gnus-newsgroup-data)
6134 (marks (if (listp marks) marks
6135 (append marks nil))) ; Transform to list.
6138 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6139 (memq (gnus-data-mark (car data)) marks))
6140 (push (gnus-data-number (car data)) articles))
6141 (setq data (cdr data)))
6142 (gnus-summary-limit articles))
6143 (gnus-summary-position-point)))
6145 (defun gnus-summary-limit-to-score (&optional score)
6146 "Limit to articles with score at or above SCORE."
6148 (setq score (if score
6149 (prefix-numeric-value score)
6150 (or gnus-summary-default-score 0)))
6151 (let ((data gnus-newsgroup-data)
6154 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6156 (push (gnus-data-number (car data)) articles))
6157 (setq data (cdr data)))
6159 (gnus-summary-limit articles)
6160 (gnus-summary-position-point))))
6162 (defun gnus-summary-limit-include-thread (id)
6163 "Display all the hidden articles that in the current thread."
6164 (interactive (list (mail-header-id (gnus-summary-article-header))))
6165 (let ((articles (gnus-articles-in-thread
6166 (gnus-id-to-thread (gnus-root-id id)))))
6168 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6169 (gnus-summary-position-point))))
6171 (defun gnus-summary-limit-include-dormant ()
6172 "Display all the hidden articles that are marked as dormant.
6173 Note that this command only works on a subset of the articles currently
6174 fetched for this group."
6176 (unless gnus-newsgroup-dormant
6177 (error "There are no dormant articles in this group"))
6179 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6180 (gnus-summary-position-point)))
6182 (defun gnus-summary-limit-exclude-dormant ()
6183 "Hide all dormant articles."
6186 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6187 (gnus-summary-position-point)))
6189 (defun gnus-summary-limit-exclude-childless-dormant ()
6190 "Hide all dormant articles that have no children."
6192 (let ((data (gnus-data-list t))
6193 articles d children)
6194 ;; Find all articles that are either not dormant or have
6196 (while (setq d (pop data))
6197 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6199 (gnus-article-children (gnus-data-number d)))
6202 (when (memq (car children) articles)
6207 (push (gnus-data-number d) articles)))
6210 (gnus-summary-limit articles)
6211 (gnus-summary-position-point))))
6213 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6214 "Mark all unread excluded articles as read.
6215 If ALL, mark even excluded ticked and dormants as read."
6217 (let ((articles (gnus-sorted-complement
6219 (mapcar (lambda (h) (mail-header-number h))
6220 gnus-newsgroup-headers)
6222 (sort gnus-newsgroup-limit '<)))
6224 (setq gnus-newsgroup-unreads
6225 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6227 (setq gnus-newsgroup-dormant nil
6228 gnus-newsgroup-marked nil
6229 gnus-newsgroup-reads
6231 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6232 gnus-newsgroup-reads))
6233 (while (setq article (pop articles))
6234 (unless (or (memq article gnus-newsgroup-dormant)
6235 (memq article gnus-newsgroup-marked))
6236 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6238 (defun gnus-summary-limit (articles &optional pop)
6240 ;; We pop the previous limit off the stack and use that.
6241 (setq articles (car gnus-newsgroup-limits)
6242 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6243 ;; We use the new limit, so we push the old limit on the stack.
6244 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6246 (setq gnus-newsgroup-limit articles)
6247 (let ((total (length gnus-newsgroup-data))
6248 (data (gnus-data-find-list (gnus-summary-article-number)))
6249 (gnus-summary-mark-below nil) ; Inhibit this.
6251 ;; This will do all the work of generating the new summary buffer
6252 ;; according to the new limit.
6253 (gnus-summary-prepare)
6254 ;; Hide any threads, possibly.
6255 (and gnus-show-threads
6256 gnus-thread-hide-subtree
6257 (gnus-summary-hide-all-threads))
6258 ;; Try to return to the article you were at, or one in the
6261 ;; We try to find some article after the current one.
6263 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6266 (setq data (cdr data))))
6268 ;; If there is no data, that means that we were after the last
6269 ;; article. The same goes when we can't find any articles
6270 ;; after the current one.
6271 (goto-char (point-max))
6272 (gnus-summary-find-prev))
6273 (gnus-set-mode-line 'summary)
6274 ;; We return how many articles were removed from the summary
6275 ;; buffer as a result of the new limit.
6276 (- total (length gnus-newsgroup-data))))
6278 (defsubst gnus-invisible-cut-children (threads)
6281 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6286 (defsubst gnus-cut-thread (thread)
6287 "Go forwards in the thread until we find an article that we want to display."
6288 (when (or (eq gnus-fetch-old-headers 'some)
6289 (eq gnus-fetch-old-headers 'invisible)
6290 (eq gnus-build-sparse-threads 'some)
6291 (eq gnus-build-sparse-threads 'more))
6292 ;; Deal with old-fetched headers and sparse threads.
6296 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6297 (gnus-summary-article-ancient-p
6298 (mail-header-number (car thread))))
6299 (if (or (<= (length (cdr thread)) 1)
6300 (eq gnus-fetch-old-headers 'invisible))
6301 (setq gnus-newsgroup-limit
6302 (delq (mail-header-number (car thread))
6303 gnus-newsgroup-limit)
6304 thread (cadr thread))
6305 (when (gnus-invisible-cut-children (cdr thread))
6306 (let ((th (cdr thread)))
6308 (if (memq (mail-header-number (caar th))
6309 gnus-newsgroup-limit)
6310 (setq thread (car th)
6312 (setq th (cdr th))))))))))
6315 (defun gnus-cut-threads (threads)
6316 "Cut off all uninteresting articles from the beginning of threads."
6317 (when (or (eq gnus-fetch-old-headers 'some)
6318 (eq gnus-fetch-old-headers 'invisible)
6319 (eq gnus-build-sparse-threads 'some)
6320 (eq gnus-build-sparse-threads 'more))
6323 (setcar th (gnus-cut-thread (car th)))
6324 (setq th (cdr th)))))
6325 ;; Remove nixed out threads.
6328 (defun gnus-summary-initial-limit (&optional show-if-empty)
6329 "Figure out what the initial limit is supposed to be on group entry.
6330 This entails weeding out unwanted dormants, low-scored articles,
6331 fetch-old-headers verbiage, and so on."
6332 ;; Most groups have nothing to remove.
6333 (if (or gnus-inhibit-limiting
6334 (and (null gnus-newsgroup-dormant)
6335 (not (eq gnus-fetch-old-headers 'some))
6336 (not (eq gnus-fetch-old-headers 'invisible))
6337 (null gnus-summary-expunge-below)
6338 (not (eq gnus-build-sparse-threads 'some))
6339 (not (eq gnus-build-sparse-threads 'more))
6340 (null gnus-thread-expunge-below)
6341 (not gnus-use-nocem)))
6343 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6344 (setq gnus-newsgroup-limit nil)
6347 (unless (car (symbol-value node))
6348 ;; These threads have no parents -- they are roots.
6349 (let ((nodes (cdr (symbol-value node)))
6352 (if (and gnus-thread-expunge-below
6353 (< (gnus-thread-total-score (car nodes))
6354 gnus-thread-expunge-below))
6355 (gnus-expunge-thread (pop nodes))
6356 (setq thread (pop nodes))
6357 (gnus-summary-limit-children thread))))))
6358 gnus-newsgroup-dependencies)
6359 ;; If this limitation resulted in an empty group, we might
6360 ;; pop the previous limit and use it instead.
6361 (when (and (not gnus-newsgroup-limit)
6363 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6364 gnus-newsgroup-limit))
6366 (defun gnus-summary-limit-children (thread)
6367 "Return 1 if this subthread is visible and 0 if it is not."
6368 ;; First we get the number of visible children to this thread. This
6369 ;; is done by recursing down the thread using this function, so this
6370 ;; will really go down to a leaf article first, before slowly
6371 ;; working its way up towards the root.
6375 (apply '+ (mapcar 'gnus-summary-limit-children
6378 (number (mail-header-number (car thread)))
6381 (not (memq number gnus-newsgroup-marked))
6383 ;; If this article is dormant and has absolutely no visible
6384 ;; children, then this article isn't visible.
6385 (and (memq number gnus-newsgroup-dormant)
6387 ;; If this is "fetch-old-headered" and there is no
6388 ;; visible children, then we don't want this article.
6389 (and (eq gnus-fetch-old-headers 'some)
6390 (gnus-summary-article-ancient-p number)
6392 ;; If this is "fetch-old-headered" and `invisible', then
6393 ;; we don't want this article.
6394 (and (eq gnus-fetch-old-headers 'invisible)
6395 (gnus-summary-article-ancient-p number))
6396 ;; If this is a sparsely inserted article with no children,
6397 ;; we don't want it.
6398 (and (eq gnus-build-sparse-threads 'some)
6399 (gnus-summary-article-sparse-p number)
6401 ;; If we use expunging, and this article is really
6402 ;; low-scored, then we don't want this article.
6403 (when (and gnus-summary-expunge-below
6405 (or (cdr (assq number gnus-newsgroup-scored))
6406 gnus-summary-default-score))
6407 gnus-summary-expunge-below))
6408 ;; We increase the expunge-tally here, but that has
6409 ;; nothing to do with the limits, really.
6410 (incf gnus-newsgroup-expunged-tally)
6411 ;; We also mark as read here, if that's wanted.
6412 (when (and gnus-summary-mark-below
6413 (< score gnus-summary-mark-below))
6414 (setq gnus-newsgroup-unreads
6415 (delq number gnus-newsgroup-unreads))
6416 (if gnus-newsgroup-auto-expire
6417 (push number gnus-newsgroup-expirable)
6418 (push (cons number gnus-low-score-mark)
6419 gnus-newsgroup-reads)))
6421 ;; Check NoCeM things.
6422 (if (and gnus-use-nocem
6423 (gnus-nocem-unwanted-article-p
6424 (mail-header-id (car thread))))
6426 (setq gnus-newsgroup-unreads
6427 (delq number gnus-newsgroup-unreads))
6429 ;; Nope, invisible article.
6431 ;; Ok, this article is to be visible, so we add it to the limit
6433 (push number gnus-newsgroup-limit)
6436 (defun gnus-expunge-thread (thread)
6437 "Mark all articles in THREAD as read."
6438 (let* ((number (mail-header-number (car thread))))
6439 (incf gnus-newsgroup-expunged-tally)
6440 ;; We also mark as read here, if that's wanted.
6441 (setq gnus-newsgroup-unreads
6442 (delq number gnus-newsgroup-unreads))
6443 (if gnus-newsgroup-auto-expire
6444 (push number gnus-newsgroup-expirable)
6445 (push (cons number gnus-low-score-mark)
6446 gnus-newsgroup-reads)))
6447 ;; Go recursively through all subthreads.
6448 (mapcar 'gnus-expunge-thread (cdr thread)))
6450 ;; Summary article oriented commands
6452 (defun gnus-summary-refer-parent-article (n)
6453 "Refer parent article N times.
6454 If N is negative, go to ancestor -N instead.
6455 The difference between N and the number of articles fetched is returned."
6459 (when (not (natnump n))
6464 (setq header (gnus-summary-article-header))
6465 (if (and (eq (mail-header-number header)
6466 (cdr gnus-article-current))
6467 (equal gnus-newsgroup-name
6468 (car gnus-article-current)))
6469 ;; If we try to find the parent of the currently
6470 ;; displayed article, then we take a look at the actual
6471 ;; References header, since this is slightly more
6472 ;; reliable than the References field we got from the
6475 (set-buffer gnus-original-article-buffer)
6476 (nnheader-narrow-to-headers)
6477 (unless (setq ref (message-fetch-field "references"))
6478 (setq ref (message-fetch-field "in-reply-to")))
6481 ;; It's not the current article, so we take a bet on
6482 ;; the value we got from the server.
6483 (mail-header-references header)))
6485 (not (equal ref "")))
6486 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6487 (gnus-message 1 "Couldn't find parent"))
6488 (gnus-message 1 "No references in article %d"
6489 (gnus-summary-article-number))
6492 (gnus-summary-position-point)
6495 (defun gnus-summary-refer-references ()
6496 "Fetch all articles mentioned in the References header.
6497 Return the number of articles fetched."
6499 (let ((ref (mail-header-references (gnus-summary-article-header)))
6500 (current (gnus-summary-article-number))
6504 (error "No References in the current article")
6505 ;; For each Message-ID in the References header...
6506 (while (string-match "<[^>]*>" ref)
6508 ;; ... fetch that article.
6509 (gnus-summary-refer-article
6510 (prog1 (match-string 0 ref)
6511 (setq ref (substring ref (match-end 0))))))
6512 (gnus-summary-goto-subject current)
6513 (gnus-summary-position-point)
6516 (defun gnus-summary-refer-thread (&optional limit)
6517 "Fetch all articles in the current thread.
6518 If LIMIT (the numerical prefix), fetch that many old headers instead
6519 of what's specified by the `gnus-refer-thread-limit' variable."
6521 (let ((id (mail-header-id (gnus-summary-article-header)))
6522 (limit (if limit (prefix-numeric-value limit)
6523 gnus-refer-thread-limit)))
6524 ;; We want to fetch LIMIT *old* headers, but we also have to
6525 ;; re-fetch all the headers in the current buffer, because many of
6526 ;; them may be undisplayed. So we adjust LIMIT.
6527 (when (numberp limit)
6528 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6529 (unless (eq gnus-fetch-old-headers 'invisible)
6530 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6531 ;; Retrieve the headers and read them in.
6532 (if (eq (gnus-retrieve-headers
6533 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6535 (gnus-build-all-threads)
6536 (error "Can't fetch thread from backends that don't support NOV"))
6537 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6538 (gnus-summary-limit-include-thread id)))
6540 (defun gnus-summary-refer-article (message-id &optional arg)
6541 "Fetch an article specified by MESSAGE-ID.
6542 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6543 or `gnus-select-method', no matter what backend the article comes from."
6544 (interactive "sMessage-ID: \nP")
6545 (when (and (stringp message-id)
6546 (not (zerop (length message-id))))
6547 ;; Construct the correct Message-ID if necessary.
6548 ;; Suggested by tale@pawl.rpi.edu.
6549 (unless (string-match "^<" message-id)
6550 (setq message-id (concat "<" message-id)))
6551 (unless (string-match ">$" message-id)
6552 (setq message-id (concat message-id ">")))
6553 (let* ((header (gnus-id-to-header message-id))
6555 (gnus-summary-article-sparse-p
6556 (mail-header-number header))
6557 (memq (mail-header-number header)
6558 gnus-newsgroup-limit))))
6560 ;; If the article is present in the buffer we just go to it.
6562 (or (not (gnus-summary-article-sparse-p
6563 (mail-header-number header)))
6566 (gnus-summary-goto-article
6567 (mail-header-number header) nil t)
6569 (gnus-summary-update-article (mail-header-number header)))))
6571 ;; We fetch the article
6572 (let ((gnus-override-method
6573 (cond ((gnus-news-group-p gnus-newsgroup-name)
6574 gnus-refer-article-method)
6576 (or gnus-refer-article-method gnus-select-method))
6579 ;; Start the special refer-article method, if necessary.
6580 (when (and gnus-refer-article-method
6581 (gnus-news-group-p gnus-newsgroup-name))
6582 (gnus-check-server gnus-refer-article-method))
6583 ;; Fetch the header, and display the article.
6584 (if (setq number (gnus-summary-insert-subject message-id))
6585 (gnus-summary-select-article nil nil nil number)
6586 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6588 (defun gnus-summary-edit-parameters ()
6589 "Edit the group parameters of the current group."
6591 (gnus-group-edit-group gnus-newsgroup-name 'params))
6593 (defun gnus-summary-enter-digest-group (&optional force)
6594 "Enter an nndoc group based on the current article.
6595 If FORCE, force a digest interpretation. If not, try
6596 to guess what the document format is."
6598 (let ((conf gnus-current-window-configuration))
6600 (gnus-summary-select-article))
6601 (setq gnus-current-window-configuration conf)
6602 (let* ((name (format "%s-%d"
6603 (gnus-group-prefixed-name
6604 gnus-newsgroup-name (list 'nndoc ""))
6606 (set-buffer gnus-summary-buffer)
6607 gnus-current-article)))
6608 (ogroup gnus-newsgroup-name)
6609 (params (append (gnus-info-params (gnus-get-info ogroup))
6610 (list (cons 'to-group ogroup))
6611 (list (cons 'save-article-group ogroup))))
6612 (case-fold-search t)
6613 (buf (current-buffer))
6616 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6617 (insert-buffer-substring gnus-original-article-buffer)
6618 ;; Remove lines that may lead nndoc to misinterpret the
6621 (goto-char (point-min))
6622 (or (search-forward "\n\n" nil t) (point)))
6623 (goto-char (point-min))
6624 (delete-matching-lines "^\\(Path\\):\\|^From ")
6627 (if (gnus-group-read-ephemeral-group
6628 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6630 ,(if force 'digest 'guess))) t)
6631 ;; Make all postings to this group go to the parent group.
6632 (nconc (gnus-info-params (gnus-get-info name))
6634 ;; Couldn't select this doc group.
6635 (switch-to-buffer buf)
6636 (gnus-set-global-variables)
6637 (gnus-configure-windows 'summary)
6638 (gnus-message 3 "Article couldn't be entered?"))
6639 (kill-buffer dig)))))
6641 (defun gnus-summary-read-document (n)
6642 "Open a new group based on the current article(s).
6643 This will allow you to read digests and other similar
6644 documents as newsgroups.
6645 Obeys the standard process/prefix convention."
6647 (let* ((articles (gnus-summary-work-articles n))
6648 (ogroup gnus-newsgroup-name)
6649 (params (append (gnus-info-params (gnus-get-info ogroup))
6650 (list (cons 'to-group ogroup))))
6651 article group egroup groups vgroup)
6652 (while (setq article (pop articles))
6653 (setq group (format "%s-%d" gnus-newsgroup-name article))
6654 (gnus-summary-remove-process-mark article)
6655 (when (gnus-summary-display-article article)
6658 (insert-buffer-substring gnus-original-article-buffer)
6659 ;; Remove some headers that may lead nndoc to make
6661 (message-narrow-to-head)
6662 (goto-char (point-min))
6663 (delete-matching-lines "^\\(Path\\):\\|^From ")
6666 (gnus-group-read-ephemeral-group
6667 group `(nndoc ,group (nndoc-address ,(current-buffer))
6668 (nndoc-article-type guess))
6671 ;; Make all postings to this group go to the parent group.
6672 (nconc (gnus-info-params (gnus-get-info egroup))
6674 (push egroup groups))
6675 ;; Couldn't select this doc group.
6676 (gnus-error 3 "Article couldn't be entered"))))))
6677 ;; Now we have selected all the documents.
6680 (error "None of the articles could be interpreted as documents"))
6681 ((gnus-group-read-ephemeral-group
6682 (setq vgroup (format
6683 "nnvirtual:%s-%s" gnus-newsgroup-name
6684 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6685 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6687 (cons (current-buffer) 'summary)))
6689 (error "Couldn't select virtual nndoc group")))))
6691 (defun gnus-summary-isearch-article (&optional regexp-p)
6692 "Do incremental search forward on the current article.
6693 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6695 (gnus-summary-select-article)
6696 (gnus-configure-windows 'article)
6697 (gnus-eval-in-buffer-window gnus-article-buffer
6700 (isearch-forward regexp-p))))
6702 (defun gnus-summary-search-article-forward (regexp &optional backward)
6703 "Search for an article containing REGEXP forward.
6704 If BACKWARD, search backward instead."
6707 (format "Search article %s (regexp%s): "
6708 (if current-prefix-arg "backward" "forward")
6709 (if gnus-last-search-regexp
6710 (concat ", default " gnus-last-search-regexp)
6712 current-prefix-arg))
6713 (if (string-equal regexp "")
6714 (setq regexp (or gnus-last-search-regexp ""))
6715 (setq gnus-last-search-regexp regexp))
6716 (if (gnus-summary-search-article regexp backward)
6717 (gnus-summary-show-thread)
6718 (error "Search failed: \"%s\"" regexp)))
6720 (defun gnus-summary-search-article-backward (regexp)
6721 "Search for an article containing REGEXP backward."
6724 (format "Search article backward (regexp%s): "
6725 (if gnus-last-search-regexp
6726 (concat ", default " gnus-last-search-regexp)
6728 (gnus-summary-search-article-forward regexp 'backward))
6730 (defun gnus-summary-search-article (regexp &optional backward)
6731 "Search for an article containing REGEXP.
6732 Optional argument BACKWARD means do search for backward.
6733 `gnus-select-article-hook' is not called during the search."
6734 ;; We have to require this here to make sure that the following
6735 ;; dynamic binding isn't shadowed by autoloading.
6736 (require 'gnus-async)
6738 (let ((gnus-select-article-hook nil) ;Disable hook.
6739 (gnus-article-display-hook nil)
6740 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6741 (gnus-use-article-prefetch nil)
6742 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6743 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6744 (sum (current-buffer))
6745 (gnus-display-mime-function nil)
6748 (gnus-save-hidden-threads
6749 (gnus-summary-select-article)
6750 (set-buffer gnus-article-buffer)
6754 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6756 (re-search-backward regexp nil t)
6757 (re-search-forward regexp nil t))
6758 ;; We found the regexp.
6763 (get-buffer-window (current-buffer))
6767 (setq point (point)))
6768 ;; We didn't find it, so we go to the next article.
6771 (while (eq found 'not)
6772 (if (not (if backward (gnus-summary-find-prev)
6773 (gnus-summary-find-next)))
6774 ;; No more articles.
6776 ;; Select the next article and adjust point.
6777 (unless (gnus-summary-article-sparse-p
6778 (gnus-summary-article-number))
6780 (gnus-summary-select-article)
6781 (set-buffer gnus-article-buffer)
6783 (goto-char (if backward (point-max) (point-min))))))))
6784 (gnus-message 7 ""))
6785 ;; Return whether we found the regexp.
6786 (when (eq found 'found)
6788 (gnus-summary-show-thread)
6789 (gnus-summary-goto-subject gnus-current-article)
6790 (gnus-summary-position-point)
6793 (defun gnus-summary-find-matching (header regexp &optional backward unread
6795 "Return a list of all articles that match REGEXP on HEADER.
6796 The search stars on the current article and goes forwards unless
6797 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6798 If UNREAD is non-nil, only unread articles will
6799 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6800 in the comparisons."
6801 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6802 (gnus-data-find-list
6803 (gnus-summary-article-number) (gnus-data-list backward))))
6804 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6805 (case-fold-search (not not-case-fold))
6807 (unless (fboundp (intern (concat "mail-header-" header)))
6808 (error "%s is not a valid header" header))
6811 (and (or (not unread) ; We want all articles...
6812 (gnus-data-unread-p d)) ; Or just unreads.
6813 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6814 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6815 (push (gnus-data-number d) articles)) ; Success!
6816 (setq data (cdr data)))
6817 (nreverse articles)))
6819 (defun gnus-summary-execute-command (header regexp command &optional backward)
6820 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6821 If HEADER is an empty string (or nil), the match is done on the entire
6822 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6824 (list (let ((completion-ignore-case t))
6827 (mapcar (lambda (string) (list string))
6828 '("Number" "Subject" "From" "Lines" "Date"
6829 "Message-ID" "Xref" "References" "Body"))
6830 nil 'require-match))
6831 (read-string "Regexp: ")
6832 (read-key-sequence "Command: ")
6833 current-prefix-arg))
6834 (when (equal header "Body")
6836 ;; Hidden thread subtrees must be searched as well.
6837 (gnus-summary-show-all-threads)
6838 ;; We don't want to change current point nor window configuration.
6840 (save-window-excursion
6841 (gnus-message 6 "Executing %s..." (key-description command))
6842 ;; We'd like to execute COMMAND interactively so as to give arguments.
6843 (gnus-execute header regexp
6844 `(call-interactively ',(key-binding command))
6846 (gnus-message 6 "Executing %s...done" (key-description command)))))
6848 (defun gnus-summary-beginning-of-article ()
6849 "Scroll the article back to the beginning."
6851 (gnus-summary-select-article)
6852 (gnus-configure-windows 'article)
6853 (gnus-eval-in-buffer-window gnus-article-buffer
6855 (goto-char (point-min))
6856 (when gnus-page-broken
6857 (gnus-narrow-to-page))))
6859 (defun gnus-summary-end-of-article ()
6860 "Scroll to the end of the article."
6862 (gnus-summary-select-article)
6863 (gnus-configure-windows 'article)
6864 (gnus-eval-in-buffer-window gnus-article-buffer
6866 (goto-char (point-max))
6868 (when gnus-page-broken
6869 (gnus-narrow-to-page))))
6871 (defun gnus-summary-print-article (&optional filename n)
6872 "Generate and print a PostScript image of the N next (mail) articles.
6874 If N is negative, print the N previous articles. If N is nil and articles
6875 have been marked with the process mark, print these instead.
6877 If the optional second argument FILENAME is nil, send the image to the
6878 printer. If FILENAME is a string, save the PostScript image in a file with
6879 that name. If FILENAME is a number, prompt the user for the name of the file
6881 (interactive (list (ps-print-preprint current-prefix-arg)
6882 current-prefix-arg))
6883 (dolist (article (gnus-summary-work-articles n))
6884 (gnus-summary-select-article nil nil 'pseudo article)
6885 (gnus-eval-in-buffer-window gnus-article-buffer
6886 (let ((buffer (generate-new-buffer " *print*")))
6889 (copy-to-buffer buffer (point-min) (point-max))
6891 (gnus-article-delete-invisible-text)
6892 (let ((ps-left-header
6895 (mail-header-subject gnus-current-headers) ")")
6897 (mail-header-from gnus-current-headers) ")")))
6900 "/pagenumberstring load"
6902 (mail-header-date gnus-current-headers) ")"))))
6903 (gnus-run-hooks 'gnus-ps-print-hook)
6905 (ps-print-buffer-with-faces filename))))
6906 (kill-buffer buffer))))))
6908 (defun gnus-summary-show-article (&optional arg)
6909 "Force re-fetching of the current article.
6910 If ARG (the prefix) is non-nil, show the raw article without any
6911 article massaging functions being run."
6914 ;; Select the article the normal way.
6915 (gnus-summary-select-article nil 'force)
6916 ;; Bind the article treatment functions to nil.
6917 (let ((gnus-have-all-headers t)
6918 gnus-article-display-hook
6919 gnus-article-prepare-hook
6920 gnus-article-decode-hook
6921 gnus-display-mime-function
6924 (gnus-summary-select-article nil 'force)))
6925 (gnus-summary-goto-subject gnus-current-article)
6926 (gnus-summary-position-point))
6928 (defun gnus-summary-verbose-headers (&optional arg)
6929 "Toggle permanent full header display.
6930 If ARG is a positive number, turn header display on.
6931 If ARG is a negative number, turn header display off."
6933 (setq gnus-show-all-headers
6934 (cond ((or (not (numberp arg))
6936 (not gnus-show-all-headers))
6939 (gnus-summary-show-article))
6941 (defun gnus-summary-toggle-header (&optional arg)
6942 "Show the headers if they are hidden, or hide them if they are shown.
6943 If ARG is a positive number, show the entire header.
6944 If ARG is a negative number, hide the unwanted header lines."
6947 (set-buffer gnus-article-buffer)
6948 (let* ((buffer-read-only nil)
6949 (inhibit-point-motion-hooks t)
6950 (hidden (text-property-any
6951 (goto-char (point-min)) (search-forward "\n\n")
6954 (goto-char (point-min))
6955 (when (search-forward "\n\n" nil t)
6956 (delete-region (point-min) (1- (point))))
6957 (goto-char (point-min))
6959 (set-buffer gnus-original-article-buffer)
6960 (goto-char (point-min))
6961 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
6962 (insert-buffer-substring gnus-original-article-buffer 1 e)
6963 (let ((article-inhibit-hiding t))
6964 (gnus-run-hooks 'gnus-article-display-hook))
6965 (when (or (not hidden) (and (numberp arg) (< arg 0)))
6966 (gnus-article-hide-headers)))))
6968 (defun gnus-summary-show-all-headers ()
6969 "Make all header lines visible."
6971 (gnus-article-show-all-headers))
6973 (defun gnus-summary-caesar-message (&optional arg)
6974 "Caesar rotate the current article by 13.
6975 The numerical prefix specifies how many places to rotate each letter
6978 (gnus-summary-select-article)
6979 (let ((mail-header-separator ""))
6980 (gnus-eval-in-buffer-window gnus-article-buffer
6983 (let ((start (window-start))
6985 (message-caesar-buffer-body arg)
6986 (set-window-start (get-buffer-window (current-buffer)) start))))))
6988 (defun gnus-summary-stop-page-breaking ()
6989 "Stop page breaking in the current article."
6991 (gnus-summary-select-article)
6992 (gnus-eval-in-buffer-window gnus-article-buffer
6994 (when (gnus-visual-p 'page-marker)
6995 (let ((buffer-read-only nil))
6996 (gnus-remove-text-with-property 'gnus-prev)
6997 (gnus-remove-text-with-property 'gnus-next))
6998 (setq gnus-page-broken nil))))
7000 (defun gnus-summary-move-article (&optional n to-newsgroup
7001 select-method action)
7002 "Move the current article to a different newsgroup.
7003 If N is a positive number, move the N next articles.
7004 If N is a negative number, move the N previous articles.
7005 If N is nil and any articles have been marked with the process mark,
7006 move those articles instead.
7007 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7008 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7009 re-spool using this method.
7011 For this function to work, both the current newsgroup and the
7012 newsgroup that you want to move to have to support the `request-move'
7013 and `request-accept' functions."
7016 (setq action 'move))
7017 ;; Disable marking as read.
7018 (let (gnus-mark-article-hook)
7019 (save-window-excursion
7020 (gnus-summary-select-article)))
7021 ;; Check whether the source group supports the required functions.
7022 (cond ((and (eq action 'move)
7023 (not (gnus-check-backend-function
7024 'request-move-article gnus-newsgroup-name)))
7025 (error "The current group does not support article moving"))
7026 ((and (eq action 'crosspost)
7027 (not (gnus-check-backend-function
7028 'request-replace-article gnus-newsgroup-name)))
7029 (error "The current group does not support article editing")))
7030 (let ((articles (gnus-summary-work-articles n))
7031 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7032 (names '((move "Move" "Moving")
7033 (copy "Copy" "Copying")
7034 (crosspost "Crosspost" "Crossposting")))
7035 (copy-buf (save-excursion
7036 (nnheader-set-temp-buffer " *copy article*")))
7037 art-group to-method new-xref article to-groups)
7038 (unless (assq action names)
7039 (error "Unknown action %s" action))
7040 ;; Read the newsgroup name.
7041 (when (and (not to-newsgroup)
7042 (not select-method))
7044 (gnus-read-move-group-name
7045 (cadr (assq action names))
7046 (symbol-value (intern (format "gnus-current-%s-group" action)))
7048 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7049 (setq to-method (or select-method
7050 (gnus-group-name-to-method to-newsgroup)))
7051 ;; Check the method we are to move this article to...
7052 (unless (gnus-check-backend-function
7053 'request-accept-article (car to-method))
7054 (error "%s does not support article copying" (car to-method)))
7055 (unless (gnus-check-server to-method)
7056 (error "Can't open server %s" (car to-method)))
7057 (gnus-message 6 "%s to %s: %s..."
7058 (caddr (assq action names))
7059 (or (car select-method) to-newsgroup) articles)
7061 (setq article (pop articles))
7065 ;; Move the article.
7067 ;; Remove this article from future suppression.
7068 (gnus-dup-unsuppress-article article)
7069 (gnus-request-move-article
7070 article ; Article to move
7071 gnus-newsgroup-name ; From newsgroup
7072 (nth 1 (gnus-find-method-for-group
7073 gnus-newsgroup-name)) ; Server
7074 (list 'gnus-request-accept-article
7075 to-newsgroup (list 'quote select-method)
7076 (not articles)) ; Accept form
7077 (not articles))) ; Only save nov last time
7078 ;; Copy the article.
7081 (set-buffer copy-buf)
7082 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7083 (gnus-request-accept-article
7084 to-newsgroup select-method (not articles) t))))
7085 ;; Crosspost the article.
7086 ((eq action 'crosspost)
7087 (let ((xref (message-tokenize-header
7088 (mail-header-xref (gnus-summary-article-header article))
7090 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7093 (setq xref (list (system-name))))
7096 (mapconcat 'identity
7097 (delete "Xref:" (delete new-xref xref))
7101 (set-buffer copy-buf)
7102 ;; First put the article in the destination group.
7103 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7104 (when (consp (setq art-group
7105 (gnus-request-accept-article
7106 to-newsgroup select-method (not articles))))
7107 (setq new-xref (concat new-xref " " (car art-group)
7108 ":" (cdr art-group)))
7109 ;; Now we have the new Xrefs header, so we insert
7110 ;; it and replace the new article.
7111 (nnheader-replace-header "Xref" new-xref)
7112 (gnus-request-replace-article
7113 (cdr art-group) to-newsgroup (current-buffer))
7117 (gnus-message 1 "Couldn't %s article %s"
7118 (cadr (assq action names)) article))
7119 ((and (eq art-group 'junk)
7121 (gnus-summary-mark-article article gnus-canceled-mark)
7122 (gnus-message 4 "Deleted article %s" article))
7124 (let* ((pto-group (gnus-group-prefixed-name
7125 (car art-group) to-method))
7127 (gnus-gethash pto-group gnus-newsrc-hashtb))
7128 (info (nth 2 entry))
7129 (to-group (gnus-info-group info)))
7130 ;; Update the group that has been moved to.
7132 (memq action '(move copy)))
7133 (unless (member to-group to-groups)
7134 (push to-group to-groups))
7136 (unless (memq article gnus-newsgroup-unreads)
7138 info (gnus-add-to-range (gnus-info-read info)
7139 (list (cdr art-group)))))
7141 ;; Copy any marks over to the new group.
7142 (let ((marks gnus-article-mark-lists)
7143 (to-article (cdr art-group)))
7145 ;; See whether the article is to be put in the cache.
7146 (when gnus-use-cache
7147 (gnus-cache-possibly-enter-article
7149 (let ((header (copy-sequence
7150 (gnus-summary-article-header article))))
7151 (mail-header-set-number header to-article)
7153 (memq article gnus-newsgroup-marked)
7154 (memq article gnus-newsgroup-dormant)
7155 (memq article gnus-newsgroup-unreads)))
7157 (when (and (equal to-group gnus-newsgroup-name)
7158 (not (memq article gnus-newsgroup-unreads)))
7159 ;; Mark this article as read in this group.
7160 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7161 (setcdr (gnus-active to-group) to-article)
7162 (setcdr gnus-newsgroup-active to-article))
7165 (when (memq article (symbol-value
7166 (intern (format "gnus-newsgroup-%s"
7168 ;; If the other group is the same as this group,
7169 ;; then we have to add the mark to the list.
7170 (when (equal to-group gnus-newsgroup-name)
7171 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7174 (intern (format "gnus-newsgroup-%s"
7176 ;; Copy the marks to other group.
7177 (gnus-add-marked-articles
7178 to-group (cdar marks) (list to-article) info))
7179 (setq marks (cdr marks)))
7182 (concat "(gnus-group-set-info '"
7183 (gnus-prin1-to-string (gnus-get-info to-group))
7186 ;; Update the Xref header in this article to point to
7187 ;; the new crossposted article we have just created.
7188 (when (eq action 'crosspost)
7190 (set-buffer copy-buf)
7191 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7192 (nnheader-replace-header "Xref" new-xref)
7193 (gnus-request-replace-article
7194 article gnus-newsgroup-name (current-buffer)))))
7196 ;;;!!!Why is this necessary?
7197 (set-buffer gnus-summary-buffer)
7199 (gnus-summary-goto-subject article)
7200 (when (eq action 'move)
7201 (gnus-summary-mark-article article gnus-canceled-mark))))
7202 (gnus-summary-remove-process-mark article))
7203 ;; Re-activate all groups that have been moved to.
7206 (set-buffer gnus-group-buffer)
7207 (when (gnus-group-goto-group (car to-groups) t)
7208 (gnus-group-get-new-news-this-group 1 t))
7211 (gnus-kill-buffer copy-buf)
7212 (gnus-summary-position-point)
7213 (gnus-set-mode-line 'summary)))
7215 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7216 "Move the current article to a different newsgroup.
7217 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7218 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7219 re-spool using this method."
7221 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7223 (defun gnus-summary-crosspost-article (&optional n)
7224 "Crosspost the current article to some other group."
7226 (gnus-summary-move-article n nil nil 'crosspost))
7228 (defcustom gnus-summary-respool-default-method nil
7229 "Default method for respooling an article.
7230 If nil, use to the current newsgroup method."
7231 :type '(choice (gnus-select-method :value (nnml ""))
7233 :group 'gnus-summary-mail)
7235 (defun gnus-summary-respool-article (&optional n method)
7236 "Respool the current article.
7237 The article will be squeezed through the mail spooling process again,
7238 which means that it will be put in some mail newsgroup or other
7239 depending on `nnmail-split-methods'.
7240 If N is a positive number, respool the N next articles.
7241 If N is a negative number, respool the N previous articles.
7242 If N is nil and any articles have been marked with the process mark,
7243 respool those articles instead.
7245 Respooling can be done both from mail groups and \"real\" newsgroups.
7246 In the former case, the articles in question will be moved from the
7247 current group into whatever groups they are destined to. In the
7248 latter case, they will be copied into the relevant groups."
7250 (list current-prefix-arg
7251 (let* ((methods (gnus-methods-using 'respool))
7253 (symbol-name (or gnus-summary-respool-default-method
7254 (car (gnus-find-method-for-group
7255 gnus-newsgroup-name)))))
7257 (gnus-completing-read
7258 methname "What backend do you want to use when respooling?"
7259 methods nil t nil 'gnus-mail-method-history))
7262 ((zerop (length (setq ms (gnus-servers-using-backend
7264 (list (intern method) ""))
7268 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7269 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7272 (error "No method given for respooling"))
7273 (if (assoc (symbol-name
7274 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7275 (gnus-methods-using 'respool))
7276 (gnus-summary-move-article n nil method)
7277 (gnus-summary-copy-article n nil method)))
7279 (defun gnus-summary-import-article (file)
7280 "Import an arbitrary file into a mail newsgroup."
7281 (interactive "fImport file: ")
7282 (let ((group gnus-newsgroup-name)
7283 (now (current-time))
7285 (unless (gnus-check-backend-function 'request-accept-article group)
7286 (error "%s does not support article importing" group))
7287 (or (file-readable-p file)
7288 (not (file-regular-p file))
7289 (error "Can't read %s" file))
7291 (set-buffer (gnus-get-buffer-create " *import file*"))
7293 (insert-file-contents file)
7294 (goto-char (point-min))
7295 (unless (nnheader-article-p)
7296 ;; This doesn't look like an article, so we fudge some headers.
7297 (setq atts (file-attributes file)
7298 lines (count-lines (point-min) (point-max)))
7299 (insert "From: " (read-string "From: ") "\n"
7300 "Subject: " (read-string "Subject: ") "\n"
7301 "Date: " (message-make-date (nth 5 atts))
7303 "Message-ID: " (message-make-message-id) "\n"
7304 "Lines: " (int-to-string lines) "\n"
7305 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7306 (gnus-request-accept-article group nil t)
7307 (kill-buffer (current-buffer)))))
7309 (defun gnus-summary-article-posted-p ()
7310 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7311 This will be the case if the article has both been mailed and posted."
7313 (let ((id (mail-header-references (gnus-summary-article-header)))
7314 (gnus-override-method
7315 (or gnus-refer-article-method gnus-select-method)))
7316 (if (gnus-request-head id "")
7317 (gnus-message 2 "The current message was found on %s"
7318 gnus-override-method)
7319 (gnus-message 2 "The current message couldn't be found on %s"
7320 gnus-override-method)
7323 (defun gnus-summary-expire-articles (&optional now)
7324 "Expire all articles that are marked as expirable in the current group."
7326 (when (gnus-check-backend-function
7327 'request-expire-articles gnus-newsgroup-name)
7328 ;; This backend supports expiry.
7329 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7330 (expirable (if total
7332 ;; We need to update the info for
7333 ;; this group for `gnus-list-of-read-articles'
7334 ;; to give us the right answer.
7335 (gnus-run-hooks 'gnus-exit-group-hook)
7336 (gnus-summary-update-info)
7337 (gnus-list-of-read-articles gnus-newsgroup-name))
7338 (setq gnus-newsgroup-expirable
7339 (sort gnus-newsgroup-expirable '<))))
7340 (expiry-wait (if now 'immediate
7341 (gnus-group-find-parameter
7342 gnus-newsgroup-name 'expiry-wait)))
7345 ;; There are expirable articles in this group, so we run them
7346 ;; through the expiry process.
7347 (gnus-message 6 "Expiring articles...")
7348 ;; The list of articles that weren't expired is returned.
7351 (let ((nnmail-expiry-wait-function nil)
7352 (nnmail-expiry-wait expiry-wait))
7353 (setq es (gnus-request-expire-articles
7354 expirable gnus-newsgroup-name)))
7355 (setq es (gnus-request-expire-articles
7356 expirable gnus-newsgroup-name))))
7358 (setq gnus-newsgroup-expirable es))
7359 ;; We go through the old list of expirable, and mark all
7360 ;; really expired articles as nonexistent.
7361 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7362 (let ((gnus-use-cache nil))
7364 (unless (memq (car expirable) es)
7365 (when (gnus-data-find (car expirable))
7366 (gnus-summary-mark-article
7367 (car expirable) gnus-canceled-mark)))
7368 (setq expirable (cdr expirable)))))
7369 (gnus-message 6 "Expiring articles...done")))))
7371 (defun gnus-summary-expire-articles-now ()
7372 "Expunge all expirable articles in the current group.
7373 This means that *all* articles that are marked as expirable will be
7374 deleted forever, right now."
7376 (or gnus-expert-user
7378 "Are you really, really, really sure you want to delete all these messages? ")
7380 (gnus-summary-expire-articles t))
7382 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7383 (defun gnus-summary-delete-article (&optional n)
7384 "Delete the N next (mail) articles.
7385 This command actually deletes articles. This is not a marking
7386 command. The article will disappear forever from your life, never to
7388 If N is negative, delete backwards.
7389 If N is nil and articles have been marked with the process mark,
7390 delete these instead."
7392 (unless (gnus-check-backend-function 'request-expire-articles
7393 gnus-newsgroup-name)
7394 (error "The current newsgroup does not support article deletion"))
7395 ;; Compute the list of articles to delete.
7396 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7398 (if (and gnus-novice-user
7399 (not (gnus-yes-or-no-p
7400 (format "Do you really want to delete %s forever? "
7401 (if (> (length articles) 1)
7402 (format "these %s articles" (length articles))
7405 ;; Delete the articles.
7406 (setq not-deleted (gnus-request-expire-articles
7407 articles gnus-newsgroup-name 'force))
7409 (gnus-summary-remove-process-mark (car articles))
7410 ;; The backend might not have been able to delete the article
7412 (unless (memq (car articles) not-deleted)
7413 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7414 (setq articles (cdr articles)))
7416 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7417 (gnus-summary-position-point)
7418 (gnus-set-mode-line 'summary)
7421 (defun gnus-summary-edit-article (&optional force)
7422 "Edit the current article.
7423 This will have permanent effect only in mail groups.
7424 If FORCE is non-nil, allow editing of articles even in read-only
7428 (set-buffer gnus-summary-buffer)
7429 (gnus-set-global-variables)
7430 (when (and (not force)
7431 (gnus-group-read-only-p))
7432 (error "The current newsgroup does not support article editing"))
7433 ;; Select article if needed.
7434 (unless (eq (gnus-summary-article-number)
7435 gnus-current-article)
7436 (gnus-summary-select-article t))
7437 (gnus-article-date-original)
7438 (gnus-article-edit-article
7439 `(lambda (no-highlight)
7440 (gnus-summary-edit-article-done
7441 ,(or (mail-header-references gnus-current-headers) "")
7442 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7444 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7446 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7448 "Make edits to the current article permanent."
7450 ;; Replace the article.
7451 (let ((buf (current-buffer)))
7454 (if (and (not read-only)
7455 (not (gnus-request-replace-article
7456 (cdr gnus-article-current) (car gnus-article-current)
7458 (not gnus-article-decoded-p))))
7459 (error "Couldn't replace article")
7460 ;; Update the summary buffer.
7462 (equal (message-tokenize-header references " ")
7463 (message-tokenize-header
7464 (or (message-fetch-field "references") "") " ")))
7465 ;; We only have to update this line.
7468 (message-narrow-to-head)
7469 (let ((head (buffer-string))
7472 (insert (format "211 %d Article retrieved.\n"
7473 (cdr gnus-article-current)))
7476 (let ((nntp-server-buffer (current-buffer)))
7477 (setq header (car (gnus-get-newsgroup-headers
7479 (set-buffer gnus-summary-buffer)
7480 gnus-newsgroup-dependencies)
7483 (set-buffer gnus-summary-buffer)
7484 (gnus-data-set-header
7485 (gnus-data-find (cdr gnus-article-current))
7487 (gnus-summary-update-article-line
7488 (cdr gnus-article-current) header))))))
7490 (set-buffer (or buffer gnus-summary-buffer))
7491 (gnus-summary-update-article (cdr gnus-article-current)))
7492 ;; Prettify the article buffer again.
7493 (unless no-highlight
7495 (set-buffer gnus-article-buffer)
7496 (gnus-run-hooks 'gnus-article-display-hook)
7497 (set-buffer gnus-original-article-buffer)
7498 (gnus-request-article
7499 (cdr gnus-article-current)
7500 (car gnus-article-current) (current-buffer))))
7501 ;; Prettify the summary buffer line.
7502 (when (gnus-visual-p 'summary-highlight 'highlight)
7503 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7505 (defun gnus-summary-edit-wash (key)
7506 "Perform editing command KEY in the article buffer."
7510 (message "%s" (concat (this-command-keys) "- "))
7513 (gnus-summary-edit-article)
7514 (execute-kbd-macro (concat (this-command-keys) key))
7515 (gnus-article-edit-done))
7519 (defun gnus-summary-respool-query (&optional silent trace)
7520 "Query where the respool algorithm would put this article."
7522 (let (gnus-mark-article-hook)
7523 (gnus-summary-select-article)
7525 (set-buffer gnus-original-article-buffer)
7527 (message-narrow-to-head)
7528 (let ((groups (nnmail-article-group 'identity trace)))
7531 (message "This message would go to %s"
7532 (mapconcat 'car groups ", "))
7533 (message "This message would go to no groups"))
7536 (defun gnus-summary-respool-trace ()
7537 "Trace where the respool algorithm would put this article.
7538 Display a buffer showing all fancy splitting patterns which matched."
7540 (gnus-summary-respool-query nil t))
7542 ;; Summary marking commands.
7544 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7545 "Mark articles which has the same subject as read, and then select the next.
7546 If UNMARK is positive, remove any kind of mark.
7547 If UNMARK is negative, tick articles."
7550 (setq unmark (prefix-numeric-value unmark)))
7552 (gnus-summary-mark-same-subject
7553 (gnus-summary-article-subject) unmark)))
7554 ;; Select next unread article. If auto-select-same mode, should
7555 ;; select the first unread article.
7556 (gnus-summary-next-article t (and gnus-auto-select-same
7557 (gnus-summary-article-subject)))
7558 (gnus-message 7 "%d article%s marked as %s"
7559 count (if (= count 1) " is" "s are")
7560 (if unmark "unread" "read"))))
7562 (defun gnus-summary-kill-same-subject (&optional unmark)
7563 "Mark articles which has the same subject as read.
7564 If UNMARK is positive, remove any kind of mark.
7565 If UNMARK is negative, tick articles."
7568 (setq unmark (prefix-numeric-value unmark)))
7570 (gnus-summary-mark-same-subject
7571 (gnus-summary-article-subject) unmark)))
7572 ;; If marked as read, go to next unread subject.
7574 ;; Go to next unread subject.
7575 (gnus-summary-next-subject 1 t))
7576 (gnus-message 7 "%d articles are marked as %s"
7577 count (if unmark "unread" "read"))))
7579 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7580 "Mark articles with same SUBJECT as read, and return marked number.
7581 If optional argument UNMARK is positive, remove any kinds of marks.
7582 If optional argument UNMARK is negative, mark articles as unread instead."
7586 ((null unmark) ; Mark as read.
7589 (gnus-summary-mark-article-as-read gnus-killed-mark)
7590 (gnus-summary-show-thread) t)
7591 (gnus-summary-find-subject subject))
7592 (setq count (1+ count))))
7593 ((> unmark 0) ; Tick.
7596 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7597 (gnus-summary-show-thread) t)
7598 (gnus-summary-find-subject subject))
7599 (setq count (1+ count))))
7600 (t ; Mark as unread.
7603 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7604 (gnus-summary-show-thread) t)
7605 (gnus-summary-find-subject subject))
7606 (setq count (1+ count)))))
7607 (gnus-set-mode-line 'summary)
7608 ;; Return the number of marked articles.
7611 (defun gnus-summary-mark-as-processable (n &optional unmark)
7612 "Set the process mark on the next N articles.
7613 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7614 the process mark instead. The difference between N and the actual
7615 number of articles marked is returned."
7617 (let ((backward (< n 0))
7622 (gnus-summary-remove-process-mark
7623 (gnus-summary-article-number))
7624 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7625 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7628 (gnus-message 7 "No more articles"))
7629 (gnus-summary-recenter)
7630 (gnus-summary-position-point)
7633 (defun gnus-summary-unmark-as-processable (n)
7634 "Remove the process mark from the next N articles.
7635 If N is negative, unmark backward instead. The difference between N and
7636 the actual number of articles unmarked is returned."
7638 (gnus-summary-mark-as-processable n t))
7640 (defun gnus-summary-unmark-all-processable ()
7641 "Remove the process mark from all articles."
7644 (while gnus-newsgroup-processable
7645 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7646 (gnus-summary-position-point))
7648 (defun gnus-summary-mark-as-expirable (n)
7649 "Mark N articles forward as expirable.
7650 If N is negative, mark backward instead. The difference between N and
7651 the actual number of articles marked is returned."
7653 (gnus-summary-mark-forward n gnus-expirable-mark))
7655 (defun gnus-summary-mark-article-as-replied (article)
7656 "Mark ARTICLE replied and update the summary line."
7657 (push article gnus-newsgroup-replied)
7658 (let ((buffer-read-only nil))
7659 (when (gnus-summary-goto-subject article nil t)
7660 (gnus-summary-update-secondary-mark article))))
7662 (defun gnus-summary-set-bookmark (article)
7663 "Set a bookmark in current article."
7664 (interactive (list (gnus-summary-article-number)))
7665 (when (or (not (get-buffer gnus-article-buffer))
7666 (not gnus-current-article)
7667 (not gnus-article-current)
7668 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7669 (error "No current article selected"))
7670 ;; Remove old bookmark, if one exists.
7671 (let ((old (assq article gnus-newsgroup-bookmarks)))
7673 (setq gnus-newsgroup-bookmarks
7674 (delq old gnus-newsgroup-bookmarks))))
7675 ;; Set the new bookmark, which is on the form
7676 ;; (article-number . line-number-in-body).
7680 (set-buffer gnus-article-buffer)
7684 (goto-char (point-min))
7685 (search-forward "\n\n" nil t)
7688 gnus-newsgroup-bookmarks)
7689 (gnus-message 6 "A bookmark has been added to the current article."))
7691 (defun gnus-summary-remove-bookmark (article)
7692 "Remove the bookmark from the current article."
7693 (interactive (list (gnus-summary-article-number)))
7694 ;; Remove old bookmark, if one exists.
7695 (let ((old (assq article gnus-newsgroup-bookmarks)))
7698 (setq gnus-newsgroup-bookmarks
7699 (delq old gnus-newsgroup-bookmarks))
7700 (gnus-message 6 "Removed bookmark."))
7701 (gnus-message 6 "No bookmark in current article."))))
7703 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7704 (defun gnus-summary-mark-as-dormant (n)
7705 "Mark N articles forward as dormant.
7706 If N is negative, mark backward instead. The difference between N and
7707 the actual number of articles marked is returned."
7709 (gnus-summary-mark-forward n gnus-dormant-mark))
7711 (defun gnus-summary-set-process-mark (article)
7712 "Set the process mark on ARTICLE and update the summary line."
7713 (setq gnus-newsgroup-processable
7715 (delq article gnus-newsgroup-processable)))
7716 (when (gnus-summary-goto-subject article)
7717 (gnus-summary-show-thread)
7718 (gnus-summary-goto-subject article)
7719 (gnus-summary-update-secondary-mark article)))
7721 (defun gnus-summary-remove-process-mark (article)
7722 "Remove the process mark from ARTICLE and update the summary line."
7723 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7724 (when (gnus-summary-goto-subject article)
7725 (gnus-summary-show-thread)
7726 (gnus-summary-goto-subject article)
7727 (gnus-summary-update-secondary-mark article)))
7729 (defun gnus-summary-set-saved-mark (article)
7730 "Set the process mark on ARTICLE and update the summary line."
7731 (push article gnus-newsgroup-saved)
7732 (when (gnus-summary-goto-subject article)
7733 (gnus-summary-update-secondary-mark article)))
7735 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7736 "Mark N articles as read forwards.
7737 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7738 The difference between N and the actual number of articles marked is
7741 (gnus-summary-show-thread)
7742 (let ((backward (< n 0))
7743 (gnus-summary-goto-unread
7744 (and gnus-summary-goto-unread
7745 (not (eq gnus-summary-goto-unread 'never))
7746 (not (memq mark (list gnus-unread-mark
7747 gnus-ticked-mark gnus-dormant-mark)))))
7749 (mark (or mark gnus-del-mark)))
7751 (gnus-summary-mark-article nil mark no-expire)
7752 (zerop (gnus-summary-next-subject
7754 (and gnus-summary-goto-unread
7755 (not (eq gnus-summary-goto-unread 'never)))
7759 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7760 (gnus-summary-recenter)
7761 (gnus-summary-position-point)
7762 (gnus-set-mode-line 'summary)
7765 (defun gnus-summary-mark-article-as-read (mark)
7766 "Mark the current article quickly as read with MARK."
7767 (let ((article (gnus-summary-article-number)))
7768 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7769 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7770 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7771 (push (cons article mark) gnus-newsgroup-reads)
7772 ;; Possibly remove from cache, if that is used.
7773 (when gnus-use-cache
7774 (gnus-cache-enter-remove-article article))
7775 ;; Allow the backend to change the mark.
7776 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7777 ;; Check for auto-expiry.
7778 (when (and gnus-newsgroup-auto-expire
7779 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7780 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7781 (= mark gnus-ancient-mark)
7782 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7783 (= mark gnus-duplicate-mark)))
7784 (setq mark gnus-expirable-mark)
7785 ;; Let the backend know about the mark change.
7786 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7787 (push article gnus-newsgroup-expirable))
7788 ;; Set the mark in the buffer.
7789 (gnus-summary-update-mark mark 'unread)
7792 (defun gnus-summary-mark-article-as-unread (mark)
7793 "Mark the current article quickly as unread with MARK."
7794 (let* ((article (gnus-summary-article-number))
7795 (old-mark (gnus-summary-article-mark article)))
7796 ;; Allow the backend to change the mark.
7797 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7798 (if (eq mark old-mark)
7802 (gnus-error 1 "Can't mark negative article numbers")
7804 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7805 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7806 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7807 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7808 (cond ((= mark gnus-ticked-mark)
7809 (push article gnus-newsgroup-marked))
7810 ((= mark gnus-dormant-mark)
7811 (push article gnus-newsgroup-dormant))
7813 (push article gnus-newsgroup-unreads)))
7814 (gnus-pull article gnus-newsgroup-reads)
7816 ;; See whether the article is to be put in the cache.
7818 (vectorp (gnus-summary-article-header article))
7820 (gnus-cache-possibly-enter-article
7821 gnus-newsgroup-name article
7822 (gnus-summary-article-header article)
7823 (= mark gnus-ticked-mark)
7824 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7827 (gnus-summary-update-mark mark 'unread)
7830 (defun gnus-summary-mark-article (&optional article mark no-expire)
7831 "Mark ARTICLE with MARK. MARK can be any character.
7832 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7833 `??' (dormant) and `?E' (expirable).
7834 If MARK is nil, then the default character `?D' is used.
7835 If ARTICLE is nil, then the article on the current line will be
7837 ;; The mark might be a string.
7838 (when (stringp mark)
7839 (setq mark (aref mark 0)))
7840 ;; If no mark is given, then we check auto-expiring.
7841 (and (not no-expire)
7842 gnus-newsgroup-auto-expire
7844 (and (gnus-characterp mark)
7845 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
7846 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
7847 (= mark gnus-read-mark) (= mark gnus-souped-mark)
7848 (= mark gnus-duplicate-mark))))
7849 (setq mark gnus-expirable-mark))
7850 (let* ((mark (or mark gnus-del-mark))
7851 (article (or article (gnus-summary-article-number)))
7852 (old-mark (gnus-summary-article-mark article)))
7853 ;; Allow the backend to change the mark.
7854 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7855 (if (eq mark old-mark)
7858 (error "No article on current line"))
7859 (if (not (if (or (= mark gnus-unread-mark)
7860 (= mark gnus-ticked-mark)
7861 (= mark gnus-dormant-mark))
7862 (gnus-mark-article-as-unread article mark)
7863 (gnus-mark-article-as-read article mark)))
7865 ;; See whether the article is to be put in the cache.
7867 (not (= mark gnus-canceled-mark))
7868 (vectorp (gnus-summary-article-header article))
7870 (gnus-cache-possibly-enter-article
7871 gnus-newsgroup-name article
7872 (gnus-summary-article-header article)
7873 (= mark gnus-ticked-mark)
7874 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7876 (when (gnus-summary-goto-subject article nil t)
7877 (let ((buffer-read-only nil))
7878 (gnus-summary-show-thread)
7880 (gnus-summary-update-mark mark 'unread)
7883 (defun gnus-summary-update-secondary-mark (article)
7884 "Update the secondary (read, process, cache) mark."
7885 (gnus-summary-update-mark
7886 (cond ((memq article gnus-newsgroup-processable)
7888 ((memq article gnus-newsgroup-cached)
7890 ((memq article gnus-newsgroup-replied)
7892 ((memq article gnus-newsgroup-saved)
7894 (t gnus-unread-mark))
7896 (when (gnus-visual-p 'summary-highlight 'highlight)
7897 (gnus-run-hooks 'gnus-summary-update-hook))
7900 (defun gnus-summary-update-mark (mark type)
7901 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7902 (buffer-read-only nil))
7903 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7905 (when (looking-at "\r")
7907 (when (<= (+ forward (point)) (point-max))
7908 ;; Go to the right position on the line.
7909 (goto-char (+ forward (point)))
7910 ;; Replace the old mark with the new mark.
7911 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7912 ;; Optionally update the marks by some user rule.
7913 (when (eq type 'unread)
7915 (gnus-data-find (gnus-summary-article-number)) mark)
7916 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
7918 (defun gnus-mark-article-as-read (article &optional mark)
7919 "Enter ARTICLE in the pertinent lists and remove it from others."
7920 ;; Make the article expirable.
7921 (let ((mark (or mark gnus-del-mark)))
7922 (if (= mark gnus-expirable-mark)
7923 (push article gnus-newsgroup-expirable)
7924 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7925 ;; Remove from unread and marked lists.
7926 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7927 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7928 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7929 (push (cons article mark) gnus-newsgroup-reads)
7930 ;; Possibly remove from cache, if that is used.
7931 (when gnus-use-cache
7932 (gnus-cache-enter-remove-article article))
7935 (defun gnus-mark-article-as-unread (article &optional mark)
7936 "Enter ARTICLE in the pertinent lists and remove it from others."
7937 (let ((mark (or mark gnus-ticked-mark)))
7940 (gnus-error 1 "Can't mark negative article numbers")
7942 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
7943 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
7944 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
7945 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7947 ;; Unsuppress duplicates?
7948 (when gnus-suppress-duplicates
7949 (gnus-dup-unsuppress-article article))
7951 (cond ((= mark gnus-ticked-mark)
7952 (push article gnus-newsgroup-marked))
7953 ((= mark gnus-dormant-mark)
7954 (push article gnus-newsgroup-dormant))
7956 (push article gnus-newsgroup-unreads)))
7957 (gnus-pull article gnus-newsgroup-reads)
7960 (defalias 'gnus-summary-mark-as-unread-forward
7961 'gnus-summary-tick-article-forward)
7962 (make-obsolete 'gnus-summary-mark-as-unread-forward
7963 'gnus-summary-tick-article-forward)
7964 (defun gnus-summary-tick-article-forward (n)
7965 "Tick N articles forwards.
7966 If N is negative, tick backwards instead.
7967 The difference between N and the number of articles ticked is returned."
7969 (gnus-summary-mark-forward n gnus-ticked-mark))
7971 (defalias 'gnus-summary-mark-as-unread-backward
7972 'gnus-summary-tick-article-backward)
7973 (make-obsolete 'gnus-summary-mark-as-unread-backward
7974 'gnus-summary-tick-article-backward)
7975 (defun gnus-summary-tick-article-backward (n)
7976 "Tick N articles backwards.
7977 The difference between N and the number of articles ticked is returned."
7979 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
7981 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7982 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
7983 (defun gnus-summary-tick-article (&optional article clear-mark)
7984 "Mark current article as unread.
7985 Optional 1st argument ARTICLE specifies article number to be marked as unread.
7986 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
7988 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
7991 (defun gnus-summary-mark-as-read-forward (n)
7992 "Mark N articles as read forwards.
7993 If N is negative, mark backwards instead.
7994 The difference between N and the actual number of articles marked is
7997 (gnus-summary-mark-forward n gnus-del-mark t))
7999 (defun gnus-summary-mark-as-read-backward (n)
8000 "Mark the N articles as read backwards.
8001 The difference between N and the actual number of articles marked is
8004 (gnus-summary-mark-forward (- n) gnus-del-mark t))
8006 (defun gnus-summary-mark-as-read (&optional article mark)
8007 "Mark current article as read.
8008 ARTICLE specifies the article to be marked as read.
8009 MARK specifies a string to be inserted at the beginning of the line."
8010 (gnus-summary-mark-article article mark))
8012 (defun gnus-summary-clear-mark-forward (n)
8013 "Clear marks from N articles forward.
8014 If N is negative, clear backward instead.
8015 The difference between N and the number of marks cleared is returned."
8017 (gnus-summary-mark-forward n gnus-unread-mark))
8019 (defun gnus-summary-clear-mark-backward (n)
8020 "Clear marks from N articles backward.
8021 The difference between N and the number of marks cleared is returned."
8023 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8025 (defun gnus-summary-mark-unread-as-read ()
8026 "Intended to be used by `gnus-summary-mark-article-hook'."
8027 (when (memq gnus-current-article gnus-newsgroup-unreads)
8028 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8030 (defun gnus-summary-mark-read-and-unread-as-read ()
8031 "Intended to be used by `gnus-summary-mark-article-hook'."
8032 (let ((mark (gnus-summary-article-mark)))
8033 (when (or (gnus-unread-mark-p mark)
8034 (gnus-read-mark-p mark))
8035 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8037 (defun gnus-summary-mark-region-as-read (point mark all)
8038 "Mark all unread articles between point and mark as read.
8039 If given a prefix, mark all articles between point and mark as read,
8040 even ticked and dormant ones."
8041 (interactive "r\nP")
8050 (memq (setq article (gnus-summary-article-number))
8051 gnus-newsgroup-unreads))
8052 (gnus-summary-mark-article article gnus-del-mark))
8054 (gnus-summary-find-next))))))
8056 (defun gnus-summary-mark-below (score mark)
8057 "Mark articles with score less than SCORE with MARK."
8058 (interactive "P\ncMark: ")
8059 (setq score (if score
8060 (prefix-numeric-value score)
8061 (or gnus-summary-default-score 0)))
8063 (set-buffer gnus-summary-buffer)
8064 (goto-char (point-min))
8067 (and (< (gnus-summary-article-score) score)
8068 (gnus-summary-mark-article nil mark))
8069 (gnus-summary-find-next)))))
8071 (defun gnus-summary-kill-below (&optional score)
8072 "Mark articles with score below SCORE as read."
8074 (gnus-summary-mark-below score gnus-killed-mark))
8076 (defun gnus-summary-clear-above (&optional score)
8077 "Clear all marks from articles with score above SCORE."
8079 (gnus-summary-mark-above score gnus-unread-mark))
8081 (defun gnus-summary-tick-above (&optional score)
8082 "Tick all articles with score above SCORE."
8084 (gnus-summary-mark-above score gnus-ticked-mark))
8086 (defun gnus-summary-mark-above (score mark)
8087 "Mark articles with score over SCORE with MARK."
8088 (interactive "P\ncMark: ")
8089 (setq score (if score
8090 (prefix-numeric-value score)
8091 (or gnus-summary-default-score 0)))
8093 (set-buffer gnus-summary-buffer)
8094 (goto-char (point-min))
8096 (when (> (gnus-summary-article-score) score)
8097 (gnus-summary-mark-article nil mark))
8099 (gnus-summary-find-next)))))
8101 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8102 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8103 (defun gnus-summary-limit-include-expunged (&optional no-error)
8104 "Display all the hidden articles that were expunged for low scores."
8106 (let ((buffer-read-only nil))
8107 (let ((scored gnus-newsgroup-scored)
8110 (unless (gnus-summary-goto-subject (caar scored))
8111 (and (setq h (gnus-summary-article-header (caar scored)))
8112 (< (cdar scored) gnus-summary-expunge-below)
8114 (setq scored (cdr scored)))
8116 (when (not no-error)
8117 (error "No expunged articles hidden"))
8118 (goto-char (point-min))
8119 (gnus-summary-prepare-unthreaded (nreverse headers))
8120 (goto-char (point-min))
8121 (gnus-summary-position-point)
8124 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8125 "Mark all unread articles in this newsgroup as read.
8126 If prefix argument ALL is non-nil, ticked and dormant articles will
8127 also be marked as read.
8128 If QUIETLY is non-nil, no questions will be asked.
8129 If TO-HERE is non-nil, it should be a point in the buffer. All
8130 articles before this point will be marked as read.
8131 Note that this function will only catch up the unread article
8132 in the current summary buffer limitation.
8133 The number of articles marked as read is returned."
8138 (not gnus-interactive-catchup) ;Without confirmation?
8142 "Mark absolutely all articles as read? "
8143 "Mark all unread articles as read? ")))
8145 (not gnus-newsgroup-adaptive)
8146 (not gnus-newsgroup-auto-expire)
8147 (not gnus-suppress-duplicates)
8148 (or (not gnus-use-cache)
8149 (eq gnus-use-cache 'passive)))
8152 (setq gnus-newsgroup-marked nil
8153 gnus-newsgroup-dormant nil))
8154 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8155 ;; We actually mark all articles as canceled, which we
8156 ;; have to do when using auto-expiry or adaptive scoring.
8157 (gnus-summary-show-all-threads)
8158 (when (gnus-summary-first-subject (not all) t)
8160 (if to-here (< (point) to-here) t)
8161 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8162 (gnus-summary-find-next (not all) nil nil t))))
8163 (gnus-set-mode-line 'summary))
8165 (gnus-summary-position-point)))
8167 (defun gnus-summary-catchup-to-here (&optional all)
8168 "Mark all unticked articles before the current one as read.
8169 If ALL is non-nil, also mark ticked and dormant articles as read."
8172 (gnus-save-hidden-threads
8173 (let ((beg (point)))
8174 ;; We check that there are unread articles.
8175 (when (or all (gnus-summary-find-prev))
8176 (gnus-summary-catchup all t beg)))))
8177 (gnus-summary-position-point))
8179 (defun gnus-summary-catchup-all (&optional quietly)
8180 "Mark all articles in this newsgroup as read."
8182 (gnus-summary-catchup t quietly))
8184 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8185 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8186 If prefix argument ALL is non-nil, all articles are marked as read."
8188 (when (gnus-summary-catchup all quietly nil 'fast)
8189 ;; Select next newsgroup or exit.
8190 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8191 (eq gnus-auto-select-next 'quietly))
8192 (gnus-summary-next-group nil)
8193 (gnus-summary-exit))))
8195 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8196 "Mark all articles in this newsgroup as read, and then exit."
8198 (gnus-summary-catchup-and-exit t quietly))
8200 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8201 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8202 "Mark all articles in this group as read and select the next group.
8203 If given a prefix, mark all articles, unread as well as ticked, as
8207 (gnus-summary-catchup all))
8208 (gnus-summary-next-article t nil nil t))
8210 ;; Thread-based commands.
8212 (defun gnus-summary-articles-in-thread (&optional article)
8213 "Return a list of all articles in the current thread.
8214 If ARTICLE is non-nil, return all articles in the thread that starts
8216 (let* ((article (or article (gnus-summary-article-number)))
8217 (data (gnus-data-find-list article))
8218 (top-level (gnus-data-level (car data)))
8220 (cond ((null gnus-thread-operation-ignore-subject)
8221 (gnus-simplify-subject-re
8222 (mail-header-subject (gnus-data-header (car data)))))
8223 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8224 (gnus-simplify-subject-fuzzy
8225 (mail-header-subject (gnus-data-header (car data)))))
8227 (end-point (save-excursion
8228 (if (gnus-summary-go-to-next-thread)
8229 (point) (point-max))))
8232 (< (gnus-data-pos (car data)) end-point))
8233 (when (or (not top-subject)
8234 (string= top-subject
8235 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8236 (gnus-simplify-subject-fuzzy
8237 (mail-header-subject
8238 (gnus-data-header (car data))))
8239 (gnus-simplify-subject-re
8240 (mail-header-subject
8241 (gnus-data-header (car data)))))))
8242 (push (gnus-data-number (car data)) articles))
8243 (unless (and (setq data (cdr data))
8244 (> (gnus-data-level (car data)) top-level))
8246 ;; Return the list of articles.
8247 (nreverse articles)))
8249 (defun gnus-summary-rethread-current ()
8250 "Rethread the thread the current article is part of."
8252 (let* ((gnus-show-threads t)
8253 (article (gnus-summary-article-number))
8254 (id (mail-header-id (gnus-summary-article-header)))
8255 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8257 (error "No article on the current line"))
8258 (gnus-rebuild-thread id)
8259 (gnus-summary-goto-subject article)))
8261 (defun gnus-summary-reparent-thread ()
8262 "Make the current article child of the marked (or previous) article.
8264 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8265 is non-nil or the Subject: of both articles are the same."
8267 (unless (not (gnus-group-read-only-p))
8268 (error "The current newsgroup does not support article editing"))
8269 (unless (<= (length gnus-newsgroup-processable) 1)
8270 (error "No more than one article may be marked"))
8271 (save-window-excursion
8272 (let ((gnus-article-buffer " *reparent*")
8273 (current-article (gnus-summary-article-number))
8274 ;; First grab the marked article, otherwise one line up.
8275 (parent-article (if (not (null gnus-newsgroup-processable))
8276 (car gnus-newsgroup-processable)
8278 (if (eq (forward-line -1) 0)
8279 (gnus-summary-article-number)
8280 (error "Beginning of summary buffer"))))))
8281 (unless (not (eq current-article parent-article))
8282 (error "An article may not be self-referential"))
8283 (let ((message-id (mail-header-id
8284 (gnus-summary-article-header parent-article))))
8285 (unless (and message-id (not (equal message-id "")))
8286 (error "No message-id in desired parent"))
8287 ;; We don't want the article to be marked as read.
8288 (let (gnus-mark-article-hook)
8289 (gnus-summary-select-article t t nil current-article))
8290 (set-buffer gnus-original-article-buffer)
8291 (let ((buf (format "%s" (buffer-string))))
8294 (goto-char (point-min))
8295 (if (re-search-forward "^References: " nil t)
8297 (re-search-forward "^[^ \t]" nil t)
8300 (insert " " message-id))
8301 (insert "References: " message-id "\n"))
8302 (unless (gnus-request-replace-article
8303 current-article (car gnus-article-current)
8305 (error "Couldn't replace article"))))
8306 (set-buffer gnus-summary-buffer)
8307 (gnus-summary-unmark-all-processable)
8308 (gnus-summary-update-article current-article)
8309 (gnus-summary-rethread-current)
8310 (gnus-message 3 "Article %d is now the child of article %d"
8311 current-article parent-article)))))
8313 (defun gnus-summary-toggle-threads (&optional arg)
8314 "Toggle showing conversation threads.
8315 If ARG is positive number, turn showing conversation threads on."
8317 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8318 (setq gnus-show-threads
8319 (if (null arg) (not gnus-show-threads)
8320 (> (prefix-numeric-value arg) 0)))
8321 (gnus-summary-prepare)
8322 (gnus-summary-goto-subject current)
8323 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8324 (gnus-summary-position-point)))
8326 (defun gnus-summary-show-all-threads ()
8330 (let ((buffer-read-only nil))
8331 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8332 (gnus-summary-position-point))
8334 (defun gnus-summary-show-thread ()
8335 "Show thread subtrees.
8336 Returns nil if no thread was there to be shown."
8338 (let ((buffer-read-only nil)
8340 ;; first goto end then to beg, to have point at beg after let
8341 (end (progn (end-of-line) (point)))
8342 (beg (progn (beginning-of-line) (point))))
8344 ;; Any hidden lines here?
8345 (search-forward "\r" end t)
8346 (subst-char-in-region beg end ?\^M ?\n t)
8348 (gnus-summary-position-point))))
8350 (defun gnus-summary-hide-all-threads ()
8351 "Hide all thread subtrees."
8354 (goto-char (point-min))
8355 (gnus-summary-hide-thread)
8356 (while (zerop (gnus-summary-next-thread 1 t))
8357 (gnus-summary-hide-thread)))
8358 (gnus-summary-position-point))
8360 (defun gnus-summary-hide-thread ()
8361 "Hide thread subtrees.
8362 Returns nil if no threads were there to be hidden."
8364 (let ((buffer-read-only nil)
8366 (article (gnus-summary-article-number)))
8368 ;; Go forward until either the buffer ends or the subthread
8370 (when (and (not (eobp))
8371 (or (zerop (gnus-summary-next-thread 1 t))
8372 (goto-char (point-max))))
8374 (if (and (> (point) start)
8375 (search-backward "\n" start t))
8377 (subst-char-in-region start (point) ?\n ?\^M)
8378 (gnus-summary-goto-subject article))
8381 ;;(gnus-summary-position-point)
8384 (defun gnus-summary-go-to-next-thread (&optional previous)
8385 "Go to the same level (or less) next thread.
8386 If PREVIOUS is non-nil, go to previous thread instead.
8387 Return the article number moved to, or nil if moving was impossible."
8388 (let ((level (gnus-summary-thread-level))
8389 (way (if previous -1 1))
8392 (while (and (not (eobp))
8393 (< level (gnus-summary-thread-level)))
8401 (gnus-summary-article-number)
8404 (defun gnus-summary-next-thread (n &optional silent)
8405 "Go to the same level next N'th thread.
8406 If N is negative, search backward instead.
8407 Returns the difference between N and the number of skips actually
8410 If SILENT, don't output messages."
8412 (let ((backward (< n 0))
8415 (gnus-summary-go-to-next-thread backward))
8418 (gnus-summary-position-point))
8419 (when (and (not silent) (/= 0 n))
8420 (gnus-message 7 "No more threads"))
8423 (defun gnus-summary-prev-thread (n)
8424 "Go to the same level previous N'th thread.
8425 Returns the difference between N and the number of skips actually
8428 (gnus-summary-next-thread (- n)))
8430 (defun gnus-summary-go-down-thread ()
8431 "Go down one level in the current thread."
8432 (let ((children (gnus-summary-article-children)))
8434 (gnus-summary-goto-subject (car children)))))
8436 (defun gnus-summary-go-up-thread ()
8437 "Go up one level in the current thread."
8438 (let ((parent (gnus-summary-article-parent)))
8440 (gnus-summary-goto-subject parent))))
8442 (defun gnus-summary-down-thread (n)
8443 "Go down thread N steps.
8444 If N is negative, go up instead.
8445 Returns the difference between N and how many steps down that were
8451 (if up (gnus-summary-go-up-thread)
8452 (gnus-summary-go-down-thread)))
8454 (gnus-summary-position-point)
8456 (gnus-message 7 "Can't go further"))
8459 (defun gnus-summary-up-thread (n)
8460 "Go up thread N steps.
8461 If N is negative, go up instead.
8462 Returns the difference between N and how many steps down that were
8465 (gnus-summary-down-thread (- n)))
8467 (defun gnus-summary-top-thread ()
8468 "Go to the top of the thread."
8470 (while (gnus-summary-go-up-thread))
8471 (gnus-summary-article-number))
8473 (defun gnus-summary-kill-thread (&optional unmark)
8474 "Mark articles under current thread as read.
8475 If the prefix argument is positive, remove any kinds of marks.
8476 If the prefix argument is negative, tick articles instead."
8479 (setq unmark (prefix-numeric-value unmark)))
8480 (let ((articles (gnus-summary-articles-in-thread)))
8482 ;; Expand the thread.
8483 (gnus-summary-show-thread)
8484 ;; Mark all the articles.
8486 (gnus-summary-goto-subject (car articles))
8487 (cond ((null unmark)
8488 (gnus-summary-mark-article-as-read gnus-killed-mark))
8490 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8492 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8493 (setq articles (cdr articles))))
8494 ;; Hide killed subtrees.
8496 gnus-thread-hide-killed
8497 (gnus-summary-hide-thread))
8498 ;; If marked as read, go to next unread subject.
8500 ;; Go to next unread subject.
8501 (gnus-summary-next-subject 1 t)))
8502 (gnus-set-mode-line 'summary))
8504 ;; Summary sorting commands
8506 (defun gnus-summary-sort-by-number (&optional reverse)
8507 "Sort the summary buffer by article number.
8508 Argument REVERSE means reverse order."
8510 (gnus-summary-sort 'number reverse))
8512 (defun gnus-summary-sort-by-author (&optional reverse)
8513 "Sort the summary buffer by author name alphabetically.
8514 If case-fold-search is non-nil, case of letters is ignored.
8515 Argument REVERSE means reverse order."
8517 (gnus-summary-sort 'author reverse))
8519 (defun gnus-summary-sort-by-subject (&optional reverse)
8520 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8521 If case-fold-search is non-nil, case of letters is ignored.
8522 Argument REVERSE means reverse order."
8524 (gnus-summary-sort 'subject reverse))
8526 (defun gnus-summary-sort-by-date (&optional reverse)
8527 "Sort the summary buffer by date.
8528 Argument REVERSE means reverse order."
8530 (gnus-summary-sort 'date reverse))
8532 (defun gnus-summary-sort-by-score (&optional reverse)
8533 "Sort the summary buffer by score.
8534 Argument REVERSE means reverse order."
8536 (gnus-summary-sort 'score reverse))
8538 (defun gnus-summary-sort-by-lines (&optional reverse)
8539 "Sort the summary buffer by article length.
8540 Argument REVERSE means reverse order."
8542 (gnus-summary-sort 'lines reverse))
8544 (defun gnus-summary-sort (predicate reverse)
8545 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8546 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8547 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8548 (gnus-thread-sort-functions
8554 (gnus-article-sort-functions
8559 (,article t2 t1)))))
8561 (gnus-summary-prepare-hook nil))
8562 ;; We do the sorting by regenerating the threads.
8563 (gnus-summary-prepare)
8564 ;; Hide subthreads if needed.
8565 (when (and gnus-show-threads gnus-thread-hide-subtree)
8566 (gnus-summary-hide-all-threads))))
8568 ;; Summary saving commands.
8570 (defun gnus-summary-save-article (&optional n not-saved)
8571 "Save the current article using the default saver function.
8572 If N is a positive number, save the N next articles.
8573 If N is a negative number, save the N previous articles.
8574 If N is nil and any articles have been marked with the process mark,
8575 save those articles instead.
8576 The variable `gnus-default-article-saver' specifies the saver function."
8578 (let* ((articles (gnus-summary-work-articles n))
8579 (save-buffer (save-excursion
8580 (nnheader-set-temp-buffer " *Gnus Save*")))
8581 (num (length articles))
8582 header article file)
8584 (setq header (gnus-summary-article-header
8585 (setq article (pop articles))))
8586 (if (not (vectorp header))
8587 ;; This is a pseudo-article.
8588 (if (assq 'name header)
8589 (gnus-copy-file (cdr (assq 'name header)))
8590 (gnus-message 1 "Article %d is unsaveable" article))
8591 ;; This is a real article.
8592 (save-window-excursion
8593 (gnus-summary-select-article t nil nil article))
8595 (set-buffer save-buffer)
8597 (insert-buffer-substring gnus-original-article-buffer))
8598 (setq file (gnus-article-save save-buffer file num))
8599 (gnus-summary-remove-process-mark article)
8601 (gnus-summary-set-saved-mark article))))
8602 (gnus-kill-buffer save-buffer)
8603 (gnus-summary-position-point)
8604 (gnus-set-mode-line 'summary)
8607 (defun gnus-summary-pipe-output (&optional arg)
8608 "Pipe the current article to a subprocess.
8609 If N is a positive number, pipe the N next articles.
8610 If N is a negative number, pipe the N previous articles.
8611 If N is nil and any articles have been marked with the process mark,
8612 pipe those articles instead."
8614 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8615 (gnus-summary-save-article arg t))
8616 (gnus-configure-windows 'pipe))
8618 (defun gnus-summary-save-article-mail (&optional arg)
8619 "Append the current article to an mail file.
8620 If N is a positive number, save the N next articles.
8621 If N is a negative number, save the N previous articles.
8622 If N is nil and any articles have been marked with the process mark,
8623 save those articles instead."
8625 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8626 (gnus-summary-save-article arg)))
8628 (defun gnus-summary-save-article-rmail (&optional arg)
8629 "Append the current article to an rmail file.
8630 If N is a positive number, save the N next articles.
8631 If N is a negative number, save the N previous articles.
8632 If N is nil and any articles have been marked with the process mark,
8633 save those articles instead."
8635 (let ((gnus-default-article-saver 'rmail-output-to-rmail-file))
8636 (gnus-summary-save-article arg)))
8638 (defun gnus-summary-save-article-file (&optional arg)
8639 "Append the current article to a file.
8640 If N is a positive number, save the N next articles.
8641 If N is a negative number, save the N previous articles.
8642 If N is nil and any articles have been marked with the process mark,
8643 save those articles instead."
8645 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8646 (gnus-summary-save-article arg)))
8648 (defun gnus-summary-write-article-file (&optional arg)
8649 "Write the current article to a file, deleting the previous file.
8650 If N is a positive number, save the N next articles.
8651 If N is a negative number, save the N previous articles.
8652 If N is nil and any articles have been marked with the process mark,
8653 save those articles instead."
8655 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8656 (gnus-summary-save-article arg)))
8658 (defun gnus-summary-save-article-body-file (&optional arg)
8659 "Append the current article body to a file.
8660 If N is a positive number, save the N next articles.
8661 If N is a negative number, save the N previous articles.
8662 If N is nil and any articles have been marked with the process mark,
8663 save those articles instead."
8665 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8666 (gnus-summary-save-article arg)))
8668 (defun gnus-summary-pipe-message (program)
8669 "Pipe the current article through PROGRAM."
8670 (interactive "sProgram: ")
8671 (gnus-summary-select-article)
8672 (let ((mail-header-separator ""))
8673 (gnus-eval-in-buffer-window gnus-article-buffer
8676 (let ((start (window-start))
8678 (message-pipe-buffer-body program)
8679 (set-window-start (get-buffer-window (current-buffer)) start))))))
8681 (defun gnus-get-split-value (methods)
8682 "Return a value based on the split METHODS."
8683 (let (split-name method result match)
8686 (set-buffer gnus-original-article-buffer)
8688 (nnheader-narrow-to-headers)
8690 (goto-char (point-min))
8691 (setq method (pop methods))
8692 (setq match (car method))
8695 ;; Regular expression.
8697 (re-search-forward match nil t)))
8698 ((gnus-functionp match)
8702 (setq result (funcall match gnus-newsgroup-name))))
8707 (setq result (eval match)))))
8708 (setq split-name (append (cdr method) split-name))
8709 (cond ((stringp result)
8710 (push (expand-file-name
8711 result gnus-article-save-directory)
8714 (setq split-name (append result split-name)))))))))
8717 (defun gnus-valid-move-group-p (group)
8720 (symbol-value group)
8723 (car (gnus-find-method-for-group
8724 (symbol-name group))))
8725 gnus-valid-select-methods))))
8727 (defun gnus-read-move-group-name (prompt default articles prefix)
8728 "Read a group name."
8729 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8730 (minibuffer-confirm-incomplete nil) ; XEmacs
8734 (if (> (length articles) 1)
8735 (format "these %d articles" (length articles))
8740 (gnus-completing-read default prom
8742 'gnus-valid-move-group-p
8744 'gnus-group-history))
8745 ((= 1 (length split-name))
8746 (gnus-completing-read (car split-name) prom
8748 'gnus-valid-move-group-p
8750 'gnus-group-history))
8752 (gnus-completing-read nil prom
8753 (mapcar (lambda (el) (list el))
8754 (nreverse split-name))
8756 'gnus-group-history)))))
8758 (if (or (string= to-newsgroup "")
8759 (string= to-newsgroup prefix))
8760 (setq to-newsgroup default))
8761 (unless to-newsgroup
8762 (error "No group name entered"))
8763 (or (gnus-active to-newsgroup)
8764 (gnus-activate-group to-newsgroup)
8765 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8767 (or (and (gnus-request-create-group
8768 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8769 (gnus-activate-group to-newsgroup nil nil
8770 (gnus-group-name-to-method
8772 (error "Couldn't create group %s" to-newsgroup)))
8773 (error "No such group: %s" to-newsgroup)))
8776 ;; Summary extract commands
8778 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8779 (let ((buffer-read-only nil)
8780 (article (gnus-summary-article-number))
8782 (unless (gnus-summary-goto-subject article)
8783 (error "No such article: %d" article))
8784 (gnus-summary-position-point)
8785 ;; If all commands are to be bunched up on one line, we collect
8787 (unless gnus-view-pseudos-separately
8788 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8791 (setq action (cdr (assq 'action (car ps))))
8792 (setq files (list (cdr (assq 'name (car ps)))))
8793 (while (and ps (cdr ps)
8794 (string= (or action "1")
8795 (or (cdr (assq 'action (cadr ps))) "2")))
8796 (push (cdr (assq 'name (cadr ps))) files)
8797 (setcdr ps (cddr ps)))
8799 (when (not (string-match "%s" action))
8802 (when (assq 'execute (car ps))
8803 (setcdr (assq 'execute (car ps))
8804 (funcall (if (string-match "%s" action)
8813 (setq ps (cdr ps)))))
8814 (if (and gnus-view-pseudos (not not-view))
8816 (when (assq 'execute (car pslist))
8817 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8818 (eq gnus-view-pseudos 'not-confirm)))
8819 (setq pslist (cdr pslist)))
8822 (setq after-article (or (cdr (assq 'article (car pslist)))
8823 (gnus-summary-article-number)))
8824 (gnus-summary-goto-subject after-article)
8827 (insert " " (file-name-nondirectory
8828 (cdr (assq 'name (car pslist))))
8829 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8831 (forward-line -1) ; back to `b'
8832 (gnus-add-text-properties
8833 b (1- e) (list 'gnus-number gnus-reffed-article-number
8834 gnus-mouse-face-prop gnus-mouse-face))
8836 after-article gnus-reffed-article-number
8837 gnus-unread-mark b (car pslist) 0 (- e b))
8838 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8839 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8840 (setq pslist (cdr pslist)))))))
8842 (defun gnus-pseudos< (p1 p2)
8843 (let ((c1 (cdr (assq 'action p1)))
8844 (c2 (cdr (assq 'action p2))))
8845 (and c1 c2 (string< c1 c2))))
8847 (defun gnus-request-pseudo-article (props)
8848 (cond ((assq 'execute props)
8849 (gnus-execute-command (cdr (assq 'execute props)))))
8850 (let ((gnus-current-article (gnus-summary-article-number)))
8851 (gnus-run-hooks 'gnus-mark-article-hook)))
8853 (defun gnus-execute-command (command &optional automatic)
8855 (gnus-article-setup-buffer)
8856 (set-buffer gnus-article-buffer)
8857 (setq buffer-read-only nil)
8858 (let ((command (if automatic command
8859 (read-string "Command: " (cons command 0)))))
8861 (insert "$ " command "\n\n")
8862 (if gnus-view-pseudo-asynchronously
8863 (start-process "gnus-execute" (current-buffer) shell-file-name
8864 shell-command-switch command)
8865 (call-process shell-file-name nil t nil
8866 shell-command-switch command)))))
8868 ;; Summary kill commands.
8870 (defun gnus-summary-edit-global-kill (article)
8871 "Edit the \"global\" kill file."
8872 (interactive (list (gnus-summary-article-number)))
8873 (gnus-group-edit-global-kill article))
8875 (defun gnus-summary-edit-local-kill ()
8876 "Edit a local kill file applied to the current newsgroup."
8878 (setq gnus-current-headers (gnus-summary-article-header))
8879 (gnus-group-edit-local-kill
8880 (gnus-summary-article-number) gnus-newsgroup-name))
8884 (defun gnus-read-header (id &optional header)
8885 "Read the headers of article ID and enter them into the Gnus system."
8886 (let ((group gnus-newsgroup-name)
8887 (gnus-override-method
8888 (and (gnus-news-group-p gnus-newsgroup-name)
8889 gnus-refer-article-method))
8891 ;; First we check to see whether the header in question is already
8894 ;; This is a Message-ID.
8895 (setq header (or header (gnus-id-to-header id)))
8896 ;; This is an article number.
8897 (setq header (or header (gnus-summary-article-header id))))
8899 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8900 ;; We have found the header.
8902 ;; If this is a sparse article, we have to nix out its
8903 ;; previous entry in the thread hashtb.
8905 (gnus-summary-article-sparse-p (mail-header-number header)))
8906 (let* ((parent (gnus-parent-id (mail-header-references header)))
8907 (thread (and parent (gnus-id-to-thread parent))))
8909 (delq (assq header thread) thread))))
8910 ;; We have to really fetch the header to this article.
8912 (set-buffer nntp-server-buffer)
8913 (when (setq where (gnus-request-head id group))
8914 (nnheader-fold-continuation-lines)
8915 (goto-char (point-max))
8917 (goto-char (point-min))
8921 ((cdr where) (cdr where))
8922 (header (mail-header-number header))
8923 (t gnus-reffed-article-number))
8925 (insert " Article retrieved.\n"))
8927 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8928 () ; Malformed head.
8929 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8930 (when (and (stringp id)
8931 (not (string= (gnus-group-real-name group)
8933 ;; If we fetched by Message-ID and the article came
8934 ;; from a different group, we fudge some bogus article
8935 ;; numbers for this article.
8936 (mail-header-set-number header gnus-reffed-article-number))
8938 (set-buffer gnus-summary-buffer)
8939 (decf gnus-reffed-article-number)
8940 (gnus-remove-header (mail-header-number header))
8941 (push header gnus-newsgroup-headers)
8942 (setq gnus-current-headers header)
8943 (push (mail-header-number header) gnus-newsgroup-limit)))
8946 (defun gnus-remove-header (number)
8947 "Remove header NUMBER from `gnus-newsgroup-headers'."
8948 (if (and gnus-newsgroup-headers
8949 (= number (mail-header-number (car gnus-newsgroup-headers))))
8950 (pop gnus-newsgroup-headers)
8951 (let ((headers gnus-newsgroup-headers))
8952 (while (and (cdr headers)
8953 (not (= number (mail-header-number (cadr headers)))))
8956 (setcdr headers (cddr headers))))))
8959 ;;; summary highlights
8962 (defun gnus-highlight-selected-summary ()
8963 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
8964 ;; Highlight selected article in summary buffer
8965 (when gnus-summary-selected-face
8967 (let* ((beg (progn (beginning-of-line) (point)))
8968 (end (progn (end-of-line) (point)))
8969 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
8970 (from (if (get-text-property beg gnus-mouse-face-prop)
8972 (or (next-single-property-change
8973 beg gnus-mouse-face-prop nil end)
8978 (or (next-single-property-change
8979 from gnus-mouse-face-prop nil end)
8981 ;; If no mouse-face prop on line we will have to = from = end,
8982 ;; so we highlight the entire line instead.
8983 (when (= (+ to 2) from)
8986 (if gnus-newsgroup-selected-overlay
8987 ;; Move old overlay.
8989 gnus-newsgroup-selected-overlay from to (current-buffer))
8990 ;; Create new overlay.
8992 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
8993 'face gnus-summary-selected-face))))))
8995 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
8996 (defun gnus-summary-highlight-line ()
8997 "Highlight current line according to `gnus-summary-highlight'."
8998 (let* ((list gnus-summary-highlight)
9000 (end (progn (end-of-line) (point)))
9001 ;; now find out where the line starts and leave point there.
9002 (beg (progn (beginning-of-line) (point)))
9003 (article (gnus-summary-article-number))
9004 (score (or (cdr (assq (or article gnus-current-article)
9005 gnus-newsgroup-scored))
9006 gnus-summary-default-score 0))
9007 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9008 (inhibit-read-only t))
9009 ;; Eval the cars of the lists until we find a match.
9010 (let ((default gnus-summary-default-score))
9012 (not (eval (caar list))))
9013 (setq list (cdr list))))
9014 (let ((face (cdar list)))
9015 (unless (eq face (get-text-property beg 'face))
9016 (gnus-put-text-property-excluding-characters-with-faces
9018 (setq face (if (boundp face) (symbol-value face) face)))
9019 (when gnus-summary-highlight-line-function
9020 (funcall gnus-summary-highlight-line-function article face))))
9023 (defun gnus-update-read-articles (group unread &optional compute)
9024 "Update the list of read articles in GROUP."
9025 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9026 (entry (gnus-gethash group gnus-newsrc-hashtb))
9027 (info (nth 2 entry))
9029 (unread (sort (copy-sequence unread) '<))
9031 (if (or (not info) (not active))
9032 ;; There is no info on this group if it was, in fact,
9033 ;; killed. Gnus stores no information on killed groups, so
9034 ;; there's nothing to be done.
9035 ;; One could store the information somewhere temporarily,
9036 ;; perhaps... Hmmm...
9038 ;; Remove any negative articles numbers.
9039 (while (and unread (< (car unread) 0))
9040 (setq unread (cdr unread)))
9041 ;; Remove any expired article numbers
9042 (while (and unread (< (car unread) (car active)))
9043 (setq unread (cdr unread)))
9044 ;; Compute the ranges of read articles by looking at the list of
9047 (when (/= (car unread) prev)
9048 (push (if (= prev (1- (car unread))) prev
9049 (cons prev (1- (car unread))))
9051 (setq prev (1+ (car unread)))
9052 (setq unread (cdr unread)))
9053 (when (<= prev (cdr active))
9054 (push (cons prev (cdr active)) read))
9055 (setq read (if (> (length read) 1) (nreverse read) read))
9059 (set-buffer gnus-group-buffer)
9062 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9063 (gnus-info-set-read ',info ',(gnus-info-read info))
9064 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9065 (gnus-group-update-group ,group t))))
9066 ;; Enter this list into the group info.
9067 (gnus-info-set-read info read)
9068 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9069 (gnus-get-unread-articles-in-group info (gnus-active group))
9072 (defun gnus-offer-save-summaries ()
9073 "Offer to save all active summary buffers."
9075 (let ((buflist (buffer-list))
9077 ;; Go through all buffers and find all summaries.
9079 (and (setq bufname (buffer-name (car buflist)))
9080 (string-match "Summary" bufname)
9082 (set-buffer bufname)
9083 ;; We check that this is, indeed, a summary buffer.
9084 (and (eq major-mode 'gnus-summary-mode)
9085 ;; Also make sure this isn't bogus.
9086 gnus-newsgroup-prepared
9087 ;; Also make sure that this isn't a dead summary buffer.
9088 (not gnus-dead-summary-mode)))
9089 (push bufname buffers))
9090 (setq buflist (cdr buflist)))
9091 ;; Go through all these summary buffers and offer to save them.
9094 "Update summary buffer %s? "
9096 (switch-to-buffer buf)
9097 (gnus-summary-exit))
9104 (run-hooks 'gnus-sum-load-hook)
9106 ;;; gnus-sum.el ends here