1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
39 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
40 (autoload 'gnus-cache-write-active "gnus-cache")
42 (defcustom gnus-kill-summary-on-exit t
43 "*If non-nil, kill the summary buffer when you exit from it.
44 If nil, the summary will become a \"*Dead Summary*\" buffer, and
45 it will be killed sometime later."
46 :group 'gnus-summary-exit
49 (defcustom gnus-fetch-old-headers nil
50 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
51 If an unread article in the group refers to an older, already read (or
52 just marked as read) article, the old article will not normally be
53 displayed in the Summary buffer. If this variable is non-nil, Gnus
54 will attempt to grab the headers to the old articles, and thereby
55 build complete threads. If it has the value `some', only enough
56 headers to connect otherwise loose threads will be displayed. This
57 variable can also be a number. In that case, no more than that number
58 of old headers will be fetched. If it has the value `invisible', all
59 old headers will be fetched, but none will be displayed.
61 The server has to support NOV for any of this to work."
63 :type '(choice (const :tag "off" nil)
66 (sexp :menu-tag "other" t)))
68 (defcustom gnus-refer-thread-limit 200
69 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
70 If t, fetch all the available old headers."
73 (sexp :menu-tag "other" t)))
75 (defcustom gnus-summary-make-false-root 'adopt
76 "*nil means that Gnus won't gather loose threads.
77 If the root of a thread has expired or been read in a previous
78 session, the information necessary to build a complete thread has been
79 lost. Instead of having many small sub-threads from this original thread
80 scattered all over the summary buffer, Gnus can gather them.
82 If non-nil, Gnus will try to gather all loose sub-threads from an
83 original thread into one large thread.
85 If this variable is non-nil, it should be one of `none', `adopt',
88 If this variable is `none', Gnus will not make a false root, but just
89 present the sub-threads after another.
90 If this variable is `dummy', Gnus will create a dummy root that will
91 have all the sub-threads as children.
92 If this variable is `adopt', Gnus will make one of the \"children\"
93 the parent and mark all the step-children as such.
94 If this variable is `empty', the \"children\" are printed with empty
95 subject fields. (Or rather, they will be printed with a string
96 given by the `gnus-summary-same-subject' variable.)"
98 :type '(choice (const :tag "off" nil)
104 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
105 "*A regexp to match subjects to be excluded from loose thread gathering.
106 As loose thread gathering is done on subjects only, that means that
107 there can be many false gatherings performed. By rooting out certain
108 common subjects, gathering might become saner."
112 (defcustom gnus-summary-gather-subject-limit nil
113 "*Maximum length of subject comparisons when gathering loose threads.
114 Use nil to compare full subjects. Setting this variable to a low
115 number will help gather threads that have been corrupted by
116 newsreaders chopping off subject lines, but it might also mean that
117 unrelated articles that have subject that happen to begin with the
118 same few characters will be incorrectly gathered.
120 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
123 :type '(choice (const :tag "off" nil)
125 (sexp :menu-tag "on" t)))
127 (defcustom gnus-simplify-subject-functions nil
128 "List of functions taking a string argument that simplify subjects.
129 The functions are applied recursively.
131 Useful functions to put in this list include: `gnus-simplify-subject-re',
132 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
134 :type '(repeat function))
136 (defcustom gnus-simplify-ignored-prefixes nil
137 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
139 :type '(choice (const :tag "off" nil)
142 (defcustom gnus-build-sparse-threads nil
143 "*If non-nil, fill in the gaps in threads.
144 If `some', only fill in the gaps that are needed to tie loose threads
145 together. If `more', fill in all leaf nodes that Gnus can find. If
146 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
148 :type '(choice (const :tag "off" nil)
151 (sexp :menu-tag "all" t)))
153 (defcustom gnus-summary-thread-gathering-function
154 'gnus-gather-threads-by-subject
155 "*Function used for gathering loose threads.
156 There are two pre-defined functions: `gnus-gather-threads-by-subject',
157 which only takes Subjects into consideration; and
158 `gnus-gather-threads-by-references', which compared the References
159 headers of the articles to find matches."
161 :type '(radio (function-item gnus-gather-threads-by-subject)
162 (function-item gnus-gather-threads-by-references)
163 (function :tag "other")))
165 (defcustom gnus-summary-same-subject ""
166 "*String indicating that the current article has the same subject as the previous.
167 This variable will only be used if the value of
168 `gnus-summary-make-false-root' is `empty'."
169 :group 'gnus-summary-format
172 (defcustom gnus-summary-goto-unread t
173 "*If t, many commands will go to the next unread article.
174 This applies to marking commands as well as other commands that
175 \"naturally\" select the next article, like, for instance, `SPC' at
176 the end of an article.
178 If nil, the marking commands do NOT go to the next unread article
179 (they go to the next article instead). If `never', commands that
180 usually go to the next unread article, will go to the next article,
181 whether it is read or not."
182 :group 'gnus-summary-marks
183 :link '(custom-manual "(gnus)Setting Marks")
184 :type '(choice (const :tag "off" nil)
186 (sexp :menu-tag "on" t)))
188 (defcustom gnus-summary-default-score 0
189 "*Default article score level.
190 All scores generated by the score files will be added to this score.
191 If this variable is nil, scoring will be disabled."
192 :group 'gnus-score-default
193 :type '(choice (const :tag "disable")
196 (defcustom gnus-summary-zcore-fuzz 0
197 "*Fuzziness factor for the zcore in the summary buffer.
198 Articles with scores closer than this to `gnus-summary-default-score'
200 :group 'gnus-summary-format
203 (defcustom gnus-simplify-subject-fuzzy-regexp nil
204 "*Strings to be removed when doing fuzzy matches.
205 This can either be a regular expression or list of regular expressions
206 that will be removed from subject strings if fuzzy subject
207 simplification is selected."
209 :type '(repeat regexp))
211 (defcustom gnus-show-threads t
212 "*If non-nil, display threads in summary mode."
216 (defcustom gnus-thread-hide-subtree nil
217 "*If non-nil, hide all threads initially.
218 If threads are hidden, you have to run the command
219 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
220 to expose hidden threads."
224 (defcustom gnus-thread-hide-killed t
225 "*If non-nil, hide killed threads automatically."
229 (defcustom gnus-thread-ignore-subject t
230 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
231 If nil, articles that have different subjects from their parents will
232 start separate threads."
236 (defcustom gnus-thread-operation-ignore-subject t
237 "*If non-nil, subjects will be ignored when doing thread commands.
238 This affects commands like `gnus-summary-kill-thread' and
239 `gnus-summary-lower-thread'.
241 If this variable is nil, articles in the same thread with different
242 subjects will not be included in the operation in question. If this
243 variable is `fuzzy', only articles that have subjects that are fuzzily
244 equal will be included."
246 :type '(choice (const :tag "off" nil)
250 (defcustom gnus-thread-indent-level 4
251 "*Number that says how much each sub-thread should be indented."
255 (defcustom gnus-auto-extend-newsgroup t
256 "*If non-nil, extend newsgroup forward and backward when requested."
257 :group 'gnus-summary-choose
260 (defcustom gnus-auto-select-first t
261 "*If nil, don't select the first unread article when entering a group.
262 If this variable is `best', select the highest-scored unread article
263 in the group. If t, select the first unread article.
265 This variable can also be a function to place point on a likely
266 subject line. Useful values include `gnus-summary-first-unread-subject',
267 `gnus-summary-first-unread-article' and
268 `gnus-summary-best-unread-article'.
270 If you want to prevent automatic selection of the first unread article
271 in some newsgroups, set the variable to nil in
272 `gnus-select-group-hook'."
273 :group 'gnus-group-select
274 :type '(choice (const :tag "none" nil)
276 (sexp :menu-tag "first" t)
277 (function-item gnus-summary-first-unread-subject)
278 (function-item gnus-summary-first-unread-article)
279 (function-item gnus-summary-best-unread-article)))
281 (defcustom gnus-auto-select-next t
282 "*If non-nil, offer to go to the next group from the end of the previous.
283 If the value is t and the next newsgroup is empty, Gnus will exit
284 summary mode and go back to group mode. If the value is neither nil
285 nor t, Gnus will select the following unread newsgroup. In
286 particular, if the value is the symbol `quietly', the next unread
287 newsgroup will be selected without any confirmation, and if it is
288 `almost-quietly', the next group will be selected without any
289 confirmation if you are located on the last article in the group.
290 Finally, if this variable is `slightly-quietly', the `Z n' command
291 will go to the next group without confirmation."
292 :group 'gnus-summary-maneuvering
293 :type '(choice (const :tag "off" nil)
295 (const almost-quietly)
296 (const slightly-quietly)
297 (sexp :menu-tag "on" t)))
299 (defcustom gnus-auto-select-same nil
300 "*If non-nil, select the next article with the same subject.
301 If there are no more articles with the same subject, go to
302 the first unread article."
303 :group 'gnus-summary-maneuvering
306 (defcustom gnus-summary-check-current nil
307 "*If non-nil, consider the current article when moving.
308 The \"unread\" movement commands will stay on the same line if the
309 current article is unread."
310 :group 'gnus-summary-maneuvering
313 (defcustom gnus-auto-center-summary t
314 "*If non-nil, always center the current summary buffer.
315 In particular, if `vertical' do only vertical recentering. If non-nil
316 and non-`vertical', do both horizontal and vertical recentering."
317 :group 'gnus-summary-maneuvering
318 :type '(choice (const :tag "none" nil)
320 (integer :tag "height")
321 (sexp :menu-tag "both" t)))
323 (defcustom gnus-show-all-headers nil
324 "*If non-nil, don't hide any headers."
325 :group 'gnus-article-hiding
326 :group 'gnus-article-headers
329 (defcustom gnus-summary-ignore-duplicates nil
330 "*If non-nil, ignore articles with identical Message-ID headers."
334 (defcustom gnus-single-article-buffer t
335 "*If non-nil, display all articles in the same buffer.
336 If nil, each group will get its own article buffer."
337 :group 'gnus-article-various
340 (defcustom gnus-break-pages t
341 "*If non-nil, do page breaking on articles.
342 The page delimiter is specified by the `gnus-page-delimiter'
344 :group 'gnus-article-various
347 (defcustom gnus-move-split-methods nil
348 "*Variable used to suggest where articles are to be moved to.
349 It uses the same syntax as the `gnus-split-methods' variable."
350 :group 'gnus-summary-mail
351 :type '(repeat (choice (list :value (fun) function)
352 (cons :value ("" "") regexp (repeat string))
355 (defcustom gnus-unread-mark ? ;Whitespace
356 "*Mark used for unread articles."
357 :group 'gnus-summary-marks
360 (defcustom gnus-ticked-mark ?!
361 "*Mark used for ticked articles."
362 :group 'gnus-summary-marks
365 (defcustom gnus-dormant-mark ??
366 "*Mark used for dormant articles."
367 :group 'gnus-summary-marks
370 (defcustom gnus-del-mark ?r
371 "*Mark used for del'd articles."
372 :group 'gnus-summary-marks
375 (defcustom gnus-read-mark ?R
376 "*Mark used for read articles."
377 :group 'gnus-summary-marks
380 (defcustom gnus-expirable-mark ?E
381 "*Mark used for expirable articles."
382 :group 'gnus-summary-marks
385 (defcustom gnus-killed-mark ?K
386 "*Mark used for killed articles."
387 :group 'gnus-summary-marks
390 (defcustom gnus-souped-mark ?F
391 "*Mark used for killed articles."
392 :group 'gnus-summary-marks
395 (defcustom gnus-kill-file-mark ?X
396 "*Mark used for articles killed by kill files."
397 :group 'gnus-summary-marks
400 (defcustom gnus-low-score-mark ?Y
401 "*Mark used for articles with a low score."
402 :group 'gnus-summary-marks
405 (defcustom gnus-catchup-mark ?C
406 "*Mark used for articles that are caught up."
407 :group 'gnus-summary-marks
410 (defcustom gnus-replied-mark ?A
411 "*Mark used for articles that have been replied to."
412 :group 'gnus-summary-marks
415 (defcustom gnus-cached-mark ?*
416 "*Mark used for articles that are in the cache."
417 :group 'gnus-summary-marks
420 (defcustom gnus-saved-mark ?S
421 "*Mark used for articles that have been saved to."
422 :group 'gnus-summary-marks
425 (defcustom gnus-ancient-mark ?O
426 "*Mark used for ancient articles."
427 :group 'gnus-summary-marks
430 (defcustom gnus-sparse-mark ?Q
431 "*Mark used for sparsely reffed articles."
432 :group 'gnus-summary-marks
435 (defcustom gnus-canceled-mark ?G
436 "*Mark used for canceled articles."
437 :group 'gnus-summary-marks
440 (defcustom gnus-duplicate-mark ?M
441 "*Mark used for duplicate articles."
442 :group 'gnus-summary-marks
445 (defcustom gnus-undownloaded-mark ?@
446 "*Mark used for articles that weren't downloaded."
447 :group 'gnus-summary-marks
450 (defcustom gnus-downloadable-mark ?%
451 "*Mark used for articles that are to be downloaded."
452 :group 'gnus-summary-marks
455 (defcustom gnus-unsendable-mark ?=
456 "*Mark used for articles that won't be sent."
457 :group 'gnus-summary-marks
460 (defcustom gnus-score-over-mark ?+
461 "*Score mark used for articles with high scores."
462 :group 'gnus-summary-marks
465 (defcustom gnus-score-below-mark ?-
466 "*Score mark used for articles with low scores."
467 :group 'gnus-summary-marks
470 (defcustom gnus-empty-thread-mark ? ;Whitespace
471 "*There is no thread under the article."
472 :group 'gnus-summary-marks
475 (defcustom gnus-not-empty-thread-mark ?=
476 "*There is a thread under the article."
477 :group 'gnus-summary-marks
480 (defcustom gnus-view-pseudo-asynchronously nil
481 "*If non-nil, Gnus will view pseudo-articles asynchronously."
482 :group 'gnus-extract-view
485 (defcustom gnus-auto-expirable-marks
486 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
487 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
488 gnus-souped-mark gnus-duplicate-mark)
489 "*The list of marks converted into expiration if a group is auto-expirable."
491 :type '(repeat character))
493 (defcustom gnus-inhibit-user-auto-expire t
494 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
498 (defcustom gnus-view-pseudos nil
499 "*If `automatic', pseudo-articles will be viewed automatically.
500 If `not-confirm', pseudos will be viewed automatically, and the user
501 will not be asked to confirm the command."
502 :group 'gnus-extract-view
503 :type '(choice (const :tag "off" nil)
505 (const not-confirm)))
507 (defcustom gnus-view-pseudos-separately t
508 "*If non-nil, one pseudo-article will be created for each file to be viewed.
509 If nil, all files that use the same viewing command will be given as a
510 list of parameters to that command."
511 :group 'gnus-extract-view
514 (defcustom gnus-insert-pseudo-articles t
515 "*If non-nil, insert pseudo-articles when decoding articles."
516 :group 'gnus-extract-view
519 (defcustom gnus-summary-dummy-line-format
521 "*The format specification for the dummy roots in the summary buffer.
522 It works along the same lines as a normal formatting string,
523 with some simple extensions.
526 :group 'gnus-threading
529 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
530 "*The format specification for the summary mode line.
531 It works along the same lines as a normal formatting string,
532 with some simple extensions:
535 %p Unprefixed group name
536 %A Current article number
537 %z Current article score
539 %U Number of unread articles in the group
540 %e Number of unselected articles in the group
541 %Z A string with unread/unselected article counts
542 %g Shortish group name
543 %S Subject of the current article
545 %s Current score file name
546 %d Number of dormant articles
547 %r Number of articles that have been marked as read in this session
548 %E Number of articles expunged by the score files"
549 :group 'gnus-summary-format
552 (defcustom gnus-list-identifiers nil
553 "Regexp that matches list identifiers to be removed from subject.
554 This can also be a list of regexps."
555 :group 'gnus-summary-format
556 :group 'gnus-article-hiding
557 :type '(choice (const :tag "none" nil)
559 (repeat :value (".*") regexp)))
561 (defcustom gnus-summary-mark-below 0
562 "*Mark all articles with a score below this variable as read.
563 This variable is local to each summary buffer and usually set by the
565 :group 'gnus-score-default
568 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
569 "*List of functions used for sorting articles in the summary buffer.
570 This variable is only used when not using a threaded display."
571 :group 'gnus-summary-sort
572 :type '(repeat (choice (function-item gnus-article-sort-by-number)
573 (function-item gnus-article-sort-by-author)
574 (function-item gnus-article-sort-by-subject)
575 (function-item gnus-article-sort-by-date)
576 (function-item gnus-article-sort-by-score)
577 (function :tag "other"))))
579 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
580 "*List of functions used for sorting threads in the summary buffer.
581 By default, threads are sorted by article number.
583 Each function takes two threads and return non-nil if the first thread
584 should be sorted before the other. If you use more than one function,
585 the primary sort function should be the last. You should probably
586 always include `gnus-thread-sort-by-number' in the list of sorting
587 functions -- preferably first.
589 Ready-made functions include `gnus-thread-sort-by-number',
590 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
591 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
592 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
593 :group 'gnus-summary-sort
594 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
595 (function-item gnus-thread-sort-by-author)
596 (function-item gnus-thread-sort-by-subject)
597 (function-item gnus-thread-sort-by-date)
598 (function-item gnus-thread-sort-by-score)
599 (function-item gnus-thread-sort-by-total-score)
600 (function :tag "other"))))
602 (defcustom gnus-thread-score-function '+
603 "*Function used for calculating the total score of a thread.
605 The function is called with the scores of the article and each
606 subthread and should then return the score of the thread.
608 Some functions you can use are `+', `max', or `min'."
609 :group 'gnus-summary-sort
612 (defcustom gnus-summary-expunge-below nil
613 "All articles that have a score less than this variable will be expunged.
614 This variable is local to the summary buffers."
615 :group 'gnus-score-default
616 :type '(choice (const :tag "off" nil)
619 (defcustom gnus-thread-expunge-below nil
620 "All threads that have a total score less than this variable will be expunged.
621 See `gnus-thread-score-function' for en explanation of what a
624 This variable is local to the summary buffers."
625 :group 'gnus-threading
626 :group 'gnus-score-default
627 :type '(choice (const :tag "off" nil)
630 (defcustom gnus-summary-mode-hook nil
631 "*A hook for Gnus summary mode.
632 This hook is run before any variables are set in the summary buffer."
633 :group 'gnus-summary-various
636 (defcustom gnus-summary-menu-hook nil
637 "*Hook run after the creation of the summary mode menu."
638 :group 'gnus-summary-visual
641 (defcustom gnus-summary-exit-hook nil
642 "*A hook called on exit from the summary buffer.
643 It will be called with point in the group buffer."
644 :group 'gnus-summary-exit
647 (defcustom gnus-summary-prepare-hook nil
648 "*A hook called after the summary buffer has been generated.
649 If you want to modify the summary buffer, you can use this hook."
650 :group 'gnus-summary-various
653 (defcustom gnus-summary-prepared-hook nil
654 "*A hook called as the last thing after the summary buffer has been generated."
655 :group 'gnus-summary-various
658 (defcustom gnus-summary-generate-hook nil
659 "*A hook run just before generating the summary buffer.
660 This hook is commonly used to customize threading variables and the
662 :group 'gnus-summary-various
665 (defcustom gnus-select-group-hook nil
666 "*A hook called when a newsgroup is selected.
668 If you'd like to simplify subjects like the
669 `gnus-summary-next-same-subject' command does, you can use the
672 (setq gnus-select-group-hook
675 (mapcar (lambda (header)
676 (mail-header-set-subject
678 (gnus-simplify-subject
679 (mail-header-subject header) 're-only)))
680 gnus-newsgroup-headers))))"
681 :group 'gnus-group-select
684 (defcustom gnus-select-article-hook nil
685 "*A hook called when an article is selected."
686 :group 'gnus-summary-choose
689 (defcustom gnus-visual-mark-article-hook
690 (list 'gnus-highlight-selected-summary)
691 "*Hook run after selecting an article in the summary buffer.
692 It is meant to be used for highlighting the article in some way. It
693 is not run if `gnus-visual' is nil."
694 :group 'gnus-summary-visual
697 (defcustom gnus-parse-headers-hook nil
698 "*A hook called before parsing the headers."
702 (defcustom gnus-exit-group-hook nil
703 "*A hook called when exiting summary mode.
704 This hook is not called from the non-updating exit commands like `Q'."
708 (defcustom gnus-summary-update-hook
709 (list 'gnus-summary-highlight-line)
710 "*A hook called when a summary line is changed.
711 The hook will not be called if `gnus-visual' is nil.
713 The default function `gnus-summary-highlight-line' will
714 highlight the line according to the `gnus-summary-highlight'
716 :group 'gnus-summary-visual
719 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
720 "*A hook called when an article is selected for the first time.
721 The hook is intended to mark an article as read (or unread)
722 automatically when it is selected."
723 :group 'gnus-summary-choose
726 (defcustom gnus-group-no-more-groups-hook nil
727 "*A hook run when returning to group mode having no more (unread) groups."
728 :group 'gnus-group-select
731 (defcustom gnus-ps-print-hook nil
732 "*A hook run before ps-printing something from Gnus."
736 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
737 "Face used for highlighting the current article in the summary buffer."
738 :group 'gnus-summary-visual
741 (defcustom gnus-summary-highlight
742 '(((= mark gnus-canceled-mark)
743 . gnus-summary-cancelled-face)
744 ((and (> score default)
745 (or (= mark gnus-dormant-mark)
746 (= mark gnus-ticked-mark)))
747 . gnus-summary-high-ticked-face)
748 ((and (< score default)
749 (or (= mark gnus-dormant-mark)
750 (= mark gnus-ticked-mark)))
751 . gnus-summary-low-ticked-face)
752 ((or (= mark gnus-dormant-mark)
753 (= mark gnus-ticked-mark))
754 . gnus-summary-normal-ticked-face)
755 ((and (> score default) (= mark gnus-ancient-mark))
756 . gnus-summary-high-ancient-face)
757 ((and (< score default) (= mark gnus-ancient-mark))
758 . gnus-summary-low-ancient-face)
759 ((= mark gnus-ancient-mark)
760 . gnus-summary-normal-ancient-face)
761 ((and (> score default) (= mark gnus-unread-mark))
762 . gnus-summary-high-unread-face)
763 ((and (< score default) (= mark gnus-unread-mark))
764 . gnus-summary-low-unread-face)
765 ((= mark gnus-unread-mark)
766 . gnus-summary-normal-unread-face)
767 ((and (> score default) (memq mark (list gnus-downloadable-mark
768 gnus-undownloaded-mark)))
769 . gnus-summary-high-unread-face)
770 ((and (< score default) (memq mark (list gnus-downloadable-mark
771 gnus-undownloaded-mark)))
772 . gnus-summary-low-unread-face)
773 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
774 . gnus-summary-normal-unread-face)
776 . gnus-summary-high-read-face)
778 . gnus-summary-low-read-face)
780 . gnus-summary-normal-read-face))
781 "*Controls the highlighting of summary buffer lines.
783 A list of (FORM . FACE) pairs. When deciding how a a particular
784 summary line should be displayed, each form is evaluated. The content
785 of the face field after the first true form is used. You can change
786 how those summary lines are displayed, by editing the face field.
788 You can use the following variables in the FORM field.
790 score: The articles score
791 default: The default article score.
792 below: The score below which articles are automatically marked as read.
793 mark: The articles mark."
794 :group 'gnus-summary-visual
795 :type '(repeat (cons (sexp :tag "Form" nil)
798 (defcustom gnus-alter-header-function nil
799 "Function called to allow alteration of article header structures.
800 The function is called with one parameter, the article header vector,
801 which it may alter in any way.")
803 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
804 "Variable that says which function should be used to decode a string with encoded words.")
806 (defcustom gnus-extra-headers nil
807 "*Extra headers to parse."
809 :type '(repeat symbol))
811 (defcustom gnus-ignored-from-addresses
812 (and user-mail-address (regexp-quote user-mail-address))
813 "*Regexp of From headers that may be suppressed in favor of To headers."
817 (defcustom gnus-group-charset-alist
818 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
819 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
820 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
821 ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit)
822 ("^relcom\\>" koi8-r)
824 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
825 ("^israel\\>" iso-8859-1)
827 ("^alt.chinese.text.big5\\>" chinese-big5)
828 ("^soc.culture.vietnamese\\>" vietnamese-viqr)
829 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
831 "Alist of regexps (to match group names) and default charsets to be used when reading."
832 :type '(repeat (list (regexp :tag "Group")
833 (symbol :tag "Charset")))
834 :group 'gnus-charset)
836 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
837 "List of charsets that should be ignored.
838 When these charsets are used in the \"charset\" parameter, the
839 default charset will be used instead."
840 :type '(repeat symbol)
841 :group 'gnus-charset)
843 (defcustom gnus-group-ignored-charsets-alist
844 '(("alt\\.chinese\\.text" iso-8859-1))
845 "Alist of regexps (to match group names) and charsets that should be ignored.
846 When these charsets are used in the \"charset\" parameter, the
847 default charset will be used instead."
848 :type '(repeat (cons (regexp :tag "Group")
850 :group 'gnus-charset)
852 (defcustom gnus-group-highlight-words-alist nil
853 "Alist of group regexps and highlight regexps.
854 This variable uses the same syntax as `gnus-emphasis-alist'."
855 :type '(repeat (cons (regexp :tag "Group")
856 (repeat (list (regexp :tag "Highlight regexp")
857 (number :tag "Group for entire word" 0)
858 (number :tag "Group for displayed part" 0)
860 gnus-emphasis-highlight-words)))))
861 :group 'gnus-summary-visual)
863 (defcustom gnus-summary-show-article-charset-alist
865 "Alist of number and charset.
866 The article will be shown with the charset corresponding to the
868 For example: ((1 . cn-gb-2312) (2 . big5))."
869 :type '(repeat (cons (number :tag "Argument" 1)
870 (symbol :tag "Charset")))
871 :group 'gnus-charset)
873 (defcustom gnus-preserve-marks t
874 "Whether marks are preserved when moving, copying and respooling messages."
876 :group 'gnus-summary-marks)
878 (defcustom gnus-alter-articles-to-read-function nil
879 "Function to be called to alter the list of articles to be selected."
881 :group 'gnus-summary)
883 (defcustom gnus-orphan-score nil
884 "*All orphans get this score added. Set in the score file."
885 :group 'gnus-score-default
886 :type '(choice (const nil)
889 (defcustom gnus-summary-save-parts-default-mime "image/.*"
890 "*A regexp to match MIME parts when saving multiple parts of a message
891 with gnus-summary-save-parts (X m). This regexp will be used by default
892 when prompting the user for which type of files to save."
897 ;;; Internal variables
899 (defvar gnus-article-mime-handles nil)
900 (defvar gnus-article-decoded-p nil)
901 (defvar gnus-article-charset nil)
902 (defvar gnus-article-ignored-charsets nil)
903 (defvar gnus-scores-exclude-files nil)
904 (defvar gnus-page-broken nil)
905 (defvar gnus-inhibit-mime-unbuttonizing nil)
907 (defvar gnus-original-article nil)
908 (defvar gnus-article-internal-prepare-hook nil)
909 (defvar gnus-newsgroup-process-stack nil)
911 (defvar gnus-thread-indent-array nil)
912 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
913 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
914 "Function called to sort the articles within a thread after it has been gathered together.")
916 (defvar gnus-summary-save-parts-type-history nil)
917 (defvar gnus-summary-save-parts-last-directory nil)
919 ;; Avoid highlighting in kill files.
920 (defvar gnus-summary-inhibit-highlight nil)
921 (defvar gnus-newsgroup-selected-overlay nil)
922 (defvar gnus-inhibit-limiting nil)
923 (defvar gnus-newsgroup-adaptive-score-file nil)
924 (defvar gnus-current-score-file nil)
925 (defvar gnus-current-move-group nil)
926 (defvar gnus-current-copy-group nil)
927 (defvar gnus-current-crosspost-group nil)
929 (defvar gnus-newsgroup-dependencies nil)
930 (defvar gnus-newsgroup-adaptive nil)
931 (defvar gnus-summary-display-article-function nil)
932 (defvar gnus-summary-highlight-line-function nil
933 "Function called after highlighting a summary line.")
935 (defvar gnus-summary-line-format-alist
936 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
937 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
938 (?s gnus-tmp-subject-or-nil ?s)
939 (?n gnus-tmp-name ?s)
940 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
942 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
944 (?F gnus-tmp-from ?s)
945 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
946 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
947 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
948 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
949 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
950 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
951 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
952 (?L gnus-tmp-lines ?d)
953 (?I gnus-tmp-indentation ?s)
954 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
955 (?R gnus-tmp-replied ?c)
956 (?\[ gnus-tmp-opening-bracket ?c)
957 (?\] gnus-tmp-closing-bracket ?c)
958 (?\> (make-string gnus-tmp-level ? ) ?s)
959 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
960 (?i gnus-tmp-score ?d)
961 (?z gnus-tmp-score-char ?c)
962 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
963 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
964 (?U gnus-tmp-unread ?c)
965 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
966 (?t (gnus-summary-number-of-articles-in-thread
967 (and (boundp 'thread) (car thread)) gnus-tmp-level)
969 (?e (gnus-summary-number-of-articles-in-thread
970 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
972 (?u gnus-tmp-user-defined ?s)
973 (?P (gnus-pick-line-number) ?d))
974 "An alist of format specifications that can appear in summary lines.
975 These are paired with what variables they correspond with, along with
976 the type of the variable (string, integer, character, etc).")
978 (defvar gnus-summary-dummy-line-format-alist
979 `((?S gnus-tmp-subject ?s)
980 (?N gnus-tmp-number ?d)
981 (?u gnus-tmp-user-defined ?s)))
983 (defvar gnus-summary-mode-line-format-alist
984 `((?G gnus-tmp-group-name ?s)
985 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
986 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
987 (?A gnus-tmp-article-number ?d)
988 (?Z gnus-tmp-unread-and-unselected ?s)
990 (?U gnus-tmp-unread-and-unticked ?d)
991 (?S gnus-tmp-subject ?s)
992 (?e gnus-tmp-unselected ?d)
993 (?u gnus-tmp-user-defined ?s)
994 (?d (length gnus-newsgroup-dormant) ?d)
995 (?t (length gnus-newsgroup-marked) ?d)
996 (?r (length gnus-newsgroup-reads) ?d)
997 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
998 (?E gnus-newsgroup-expunged-tally ?d)
999 (?s (gnus-current-score-file-nondirectory) ?s)))
1001 (defvar gnus-last-search-regexp nil
1002 "Default regexp for article search command.")
1004 (defvar gnus-last-shell-command nil
1005 "Default shell command on article.")
1007 (defvar gnus-newsgroup-begin nil)
1008 (defvar gnus-newsgroup-end nil)
1009 (defvar gnus-newsgroup-last-rmail nil)
1010 (defvar gnus-newsgroup-last-mail nil)
1011 (defvar gnus-newsgroup-last-folder nil)
1012 (defvar gnus-newsgroup-last-file nil)
1013 (defvar gnus-newsgroup-auto-expire nil)
1014 (defvar gnus-newsgroup-active nil)
1016 (defvar gnus-newsgroup-data nil)
1017 (defvar gnus-newsgroup-data-reverse nil)
1018 (defvar gnus-newsgroup-limit nil)
1019 (defvar gnus-newsgroup-limits nil)
1021 (defvar gnus-newsgroup-unreads nil
1022 "List of unread articles in the current newsgroup.")
1024 (defvar gnus-newsgroup-unselected nil
1025 "List of unselected unread articles in the current newsgroup.")
1027 (defvar gnus-newsgroup-reads nil
1028 "Alist of read articles and article marks in the current newsgroup.")
1030 (defvar gnus-newsgroup-expunged-tally nil)
1032 (defvar gnus-newsgroup-marked nil
1033 "List of ticked articles in the current newsgroup (a subset of unread art).")
1035 (defvar gnus-newsgroup-killed nil
1036 "List of ranges of articles that have been through the scoring process.")
1038 (defvar gnus-newsgroup-cached nil
1039 "List of articles that come from the article cache.")
1041 (defvar gnus-newsgroup-saved nil
1042 "List of articles that have been saved.")
1044 (defvar gnus-newsgroup-kill-headers nil)
1046 (defvar gnus-newsgroup-replied nil
1047 "List of articles that have been replied to in the current newsgroup.")
1049 (defvar gnus-newsgroup-expirable nil
1050 "List of articles in the current newsgroup that can be expired.")
1052 (defvar gnus-newsgroup-processable nil
1053 "List of articles in the current newsgroup that can be processed.")
1055 (defvar gnus-newsgroup-downloadable nil
1056 "List of articles in the current newsgroup that can be processed.")
1058 (defvar gnus-newsgroup-undownloaded nil
1059 "List of articles in the current newsgroup that haven't been downloaded..")
1061 (defvar gnus-newsgroup-unsendable nil
1062 "List of articles in the current newsgroup that won't be sent.")
1064 (defvar gnus-newsgroup-bookmarks nil
1065 "List of articles in the current newsgroup that have bookmarks.")
1067 (defvar gnus-newsgroup-dormant nil
1068 "List of dormant articles in the current newsgroup.")
1070 (defvar gnus-newsgroup-scored nil
1071 "List of scored articles in the current newsgroup.")
1073 (defvar gnus-newsgroup-headers nil
1074 "List of article headers in the current newsgroup.")
1076 (defvar gnus-newsgroup-threads nil)
1078 (defvar gnus-newsgroup-prepared nil
1079 "Whether the current group has been prepared properly.")
1081 (defvar gnus-newsgroup-ancient nil
1082 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1084 (defvar gnus-newsgroup-sparse nil)
1086 (defvar gnus-current-article nil)
1087 (defvar gnus-article-current nil)
1088 (defvar gnus-current-headers nil)
1089 (defvar gnus-have-all-headers nil)
1090 (defvar gnus-last-article nil)
1091 (defvar gnus-newsgroup-history nil)
1092 (defvar gnus-newsgroup-charset nil)
1093 (defvar gnus-newsgroup-ephemeral-charset nil)
1094 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1096 (defconst gnus-summary-local-variables
1097 '(gnus-newsgroup-name
1098 gnus-newsgroup-begin gnus-newsgroup-end
1099 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1100 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1101 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1102 gnus-newsgroup-unselected gnus-newsgroup-marked
1103 gnus-newsgroup-reads gnus-newsgroup-saved
1104 gnus-newsgroup-replied gnus-newsgroup-expirable
1105 gnus-newsgroup-processable gnus-newsgroup-killed
1106 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1107 gnus-newsgroup-unsendable
1108 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1109 gnus-newsgroup-headers gnus-newsgroup-threads
1110 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1111 gnus-current-article gnus-current-headers gnus-have-all-headers
1112 gnus-last-article gnus-article-internal-prepare-hook
1113 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1114 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1115 gnus-thread-expunge-below
1116 gnus-score-alist gnus-current-score-file
1117 (gnus-summary-expunge-below . global)
1118 (gnus-summary-mark-below . global)
1119 (gnus-orphan-score . global)
1120 gnus-newsgroup-active gnus-scores-exclude-files
1121 gnus-newsgroup-history gnus-newsgroup-ancient
1122 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1123 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1124 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1125 (gnus-newsgroup-expunged-tally . 0)
1126 gnus-cache-removable-articles gnus-newsgroup-cached
1127 gnus-newsgroup-data gnus-newsgroup-data-reverse
1128 gnus-newsgroup-limit gnus-newsgroup-limits
1129 gnus-newsgroup-charset)
1130 "Variables that are buffer-local to the summary buffers.")
1132 (defvar gnus-newsgroup-variables nil
1133 "Variables that have separate values in the newsgroups.")
1135 ;; Byte-compiler warning.
1136 (defvar gnus-article-mode-map)
1140 (defvar gnus-decode-encoded-word-methods
1141 '(mail-decode-encoded-word-string)
1142 "List of methods used to decode encoded words.
1144 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1145 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1146 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1147 whose names match REGEXP.
1150 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1151 mail-decode-encoded-word-string
1152 (\"chinese\" . rfc1843-decode-string))")
1154 (defvar gnus-decode-encoded-word-methods-cache nil)
1156 (defun gnus-multi-decode-encoded-word-string (string)
1157 "Apply the functions from `gnus-encoded-word-methods' that match."
1158 (unless (and gnus-decode-encoded-word-methods-cache
1159 (eq gnus-newsgroup-name
1160 (car gnus-decode-encoded-word-methods-cache)))
1161 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1164 (nconc gnus-decode-encoded-word-methods-cache (list x))
1165 (if (and gnus-newsgroup-name
1166 (string-match (car x) gnus-newsgroup-name))
1167 (nconc gnus-decode-encoded-word-methods-cache
1169 gnus-decode-encoded-word-methods))
1170 (let ((xlist gnus-decode-encoded-word-methods-cache))
1173 (setq string (funcall (pop xlist) string))))
1176 ;; Subject simplification.
1178 (defun gnus-simplify-whitespace (str)
1179 "Remove excessive whitespace from STR."
1182 (while (string-match "[ \t][ \t]+" mystr)
1183 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1185 (substring mystr (match-end 0)))))
1187 (when (string-match "^[ \t]+" mystr)
1188 (setq mystr (substring mystr (match-end 0))))
1190 (when (string-match "[ \t]+$" mystr)
1191 (setq mystr (substring mystr 0 (match-beginning 0))))
1194 (defsubst gnus-simplify-subject-re (subject)
1195 "Remove \"Re:\" from subject lines."
1196 (if (string-match "^[Rr][Ee]: *" subject)
1197 (substring subject (match-end 0))
1200 (defun gnus-simplify-subject (subject &optional re-only)
1201 "Remove `Re:' and words in parentheses.
1202 If RE-ONLY is non-nil, strip leading `Re:'s only."
1203 (let ((case-fold-search t)) ;Ignore case.
1204 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1205 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1206 (setq subject (substring subject (match-end 0))))
1207 ;; Remove uninteresting prefixes.
1208 (when (and (not re-only)
1209 gnus-simplify-ignored-prefixes
1210 (string-match gnus-simplify-ignored-prefixes subject))
1211 (setq subject (substring subject (match-end 0))))
1212 ;; Remove words in parentheses from end.
1214 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1215 (setq subject (substring subject 0 (match-beginning 0)))))
1216 ;; Return subject string.
1219 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1221 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1222 (goto-char (point-min))
1223 (while (re-search-forward regexp nil t)
1224 (replace-match (or newtext ""))))
1226 (defun gnus-simplify-buffer-fuzzy ()
1227 "Simplify string in the buffer fuzzily.
1228 The string in the accessible portion of the current buffer is simplified.
1229 It is assumed to be a single-line subject.
1230 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1231 matter is removed. Additional things can be deleted by setting
1232 `gnus-simplify-subject-fuzzy-regexp'."
1233 (let ((case-fold-search t)
1235 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1237 (while (not (eq modified-tick (buffer-modified-tick)))
1238 (setq modified-tick (buffer-modified-tick))
1240 ((listp gnus-simplify-subject-fuzzy-regexp)
1241 (mapcar 'gnus-simplify-buffer-fuzzy-step
1242 gnus-simplify-subject-fuzzy-regexp))
1243 (gnus-simplify-subject-fuzzy-regexp
1244 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1245 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1246 (gnus-simplify-buffer-fuzzy-step
1247 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1248 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1250 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1251 (gnus-simplify-buffer-fuzzy-step " +" " ")
1252 (gnus-simplify-buffer-fuzzy-step " $")
1253 (gnus-simplify-buffer-fuzzy-step "^ +")))
1255 (defun gnus-simplify-subject-fuzzy (subject)
1256 "Simplify a subject string fuzzily.
1257 See `gnus-simplify-buffer-fuzzy' for details."
1259 (gnus-set-work-buffer)
1260 (let ((case-fold-search t))
1261 ;; Remove uninteresting prefixes.
1262 (when (and gnus-simplify-ignored-prefixes
1263 (string-match gnus-simplify-ignored-prefixes subject))
1264 (setq subject (substring subject (match-end 0))))
1266 (inline (gnus-simplify-buffer-fuzzy))
1269 (defsubst gnus-simplify-subject-fully (subject)
1270 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1272 (gnus-simplify-subject-functions
1273 (gnus-map-function gnus-simplify-subject-functions subject))
1274 ((null gnus-summary-gather-subject-limit)
1275 (gnus-simplify-subject-re subject))
1276 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1277 (gnus-simplify-subject-fuzzy subject))
1278 ((numberp gnus-summary-gather-subject-limit)
1279 (gnus-limit-string (gnus-simplify-subject-re subject)
1280 gnus-summary-gather-subject-limit))
1284 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1285 "Check whether two subjects are equal.
1286 If optional argument simple-first is t, first argument is already
1289 ((null simple-first)
1290 (equal (gnus-simplify-subject-fully s1)
1291 (gnus-simplify-subject-fully s2)))
1294 (gnus-simplify-subject-fully s2)))))
1296 (defun gnus-summary-bubble-group ()
1297 "Increase the score of the current group.
1298 This is a handy function to add to `gnus-summary-exit-hook' to
1299 increase the score of each group you read."
1300 (gnus-group-add-score gnus-newsgroup-name))
1304 ;;; Gnus summary mode
1307 (put 'gnus-summary-mode 'mode-class 'special)
1310 ;; Non-orthogonal keys
1312 (gnus-define-keys gnus-summary-mode-map
1313 " " gnus-summary-next-page
1314 "\177" gnus-summary-prev-page
1315 [delete] gnus-summary-prev-page
1316 [backspace] gnus-summary-prev-page
1317 "\r" gnus-summary-scroll-up
1318 "\M-\r" gnus-summary-scroll-down
1319 "n" gnus-summary-next-unread-article
1320 "p" gnus-summary-prev-unread-article
1321 "N" gnus-summary-next-article
1322 "P" gnus-summary-prev-article
1323 "\M-\C-n" gnus-summary-next-same-subject
1324 "\M-\C-p" gnus-summary-prev-same-subject
1325 "\M-n" gnus-summary-next-unread-subject
1326 "\M-p" gnus-summary-prev-unread-subject
1327 "." gnus-summary-first-unread-article
1328 "," gnus-summary-best-unread-article
1329 "\M-s" gnus-summary-search-article-forward
1330 "\M-r" gnus-summary-search-article-backward
1331 "<" gnus-summary-beginning-of-article
1332 ">" gnus-summary-end-of-article
1333 "j" gnus-summary-goto-article
1334 "^" gnus-summary-refer-parent-article
1335 "\M-^" gnus-summary-refer-article
1336 "u" gnus-summary-tick-article-forward
1337 "!" gnus-summary-tick-article-forward
1338 "U" gnus-summary-tick-article-backward
1339 "d" gnus-summary-mark-as-read-forward
1340 "D" gnus-summary-mark-as-read-backward
1341 "E" gnus-summary-mark-as-expirable
1342 "\M-u" gnus-summary-clear-mark-forward
1343 "\M-U" gnus-summary-clear-mark-backward
1344 "k" gnus-summary-kill-same-subject-and-select
1345 "\C-k" gnus-summary-kill-same-subject
1346 "\M-\C-k" gnus-summary-kill-thread
1347 "\M-\C-l" gnus-summary-lower-thread
1348 "e" gnus-summary-edit-article
1349 "#" gnus-summary-mark-as-processable
1350 "\M-#" gnus-summary-unmark-as-processable
1351 "\M-\C-t" gnus-summary-toggle-threads
1352 "\M-\C-s" gnus-summary-show-thread
1353 "\M-\C-h" gnus-summary-hide-thread
1354 "\M-\C-f" gnus-summary-next-thread
1355 "\M-\C-b" gnus-summary-prev-thread
1356 [(meta down)] gnus-summary-next-thread
1357 [(meta up)] gnus-summary-prev-thread
1358 "\M-\C-u" gnus-summary-up-thread
1359 "\M-\C-d" gnus-summary-down-thread
1360 "&" gnus-summary-execute-command
1361 "c" gnus-summary-catchup-and-exit
1362 "\C-w" gnus-summary-mark-region-as-read
1363 "\C-t" gnus-summary-toggle-truncation
1364 "?" gnus-summary-mark-as-dormant
1365 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1366 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1367 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1368 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1369 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1370 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1371 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1372 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1373 "=" gnus-summary-expand-window
1374 "\C-x\C-s" gnus-summary-reselect-current-group
1375 "\M-g" gnus-summary-rescan-group
1376 "w" gnus-summary-stop-page-breaking
1377 "\C-c\C-r" gnus-summary-caesar-message
1378 "f" gnus-summary-followup
1379 "F" gnus-summary-followup-with-original
1380 "C" gnus-summary-cancel-article
1381 "r" gnus-summary-reply
1382 "R" gnus-summary-reply-with-original
1383 "\C-c\C-f" gnus-summary-mail-forward
1384 "o" gnus-summary-save-article
1385 "\C-o" gnus-summary-save-article-mail
1386 "|" gnus-summary-pipe-output
1387 "\M-k" gnus-summary-edit-local-kill
1388 "\M-K" gnus-summary-edit-global-kill
1390 "\C-c\C-d" gnus-summary-describe-group
1391 "q" gnus-summary-exit
1392 "Q" gnus-summary-exit-no-update
1393 "\C-c\C-i" gnus-info-find-node
1394 gnus-mouse-2 gnus-mouse-pick-article
1395 "m" gnus-summary-mail-other-window
1396 "a" gnus-summary-post-news
1397 "x" gnus-summary-limit-to-unread
1398 "s" gnus-summary-isearch-article
1399 "t" gnus-summary-toggle-header
1400 "g" gnus-summary-show-article
1401 "l" gnus-summary-goto-last-article
1402 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1403 "\C-d" gnus-summary-enter-digest-group
1404 "\M-\C-d" gnus-summary-read-document
1405 "\M-\C-e" gnus-summary-edit-parameters
1406 "\M-\C-a" gnus-summary-customize-parameters
1408 "*" gnus-cache-enter-article
1409 "\M-*" gnus-cache-remove-article
1410 "\M-&" gnus-summary-universal-argument
1411 "\C-l" gnus-recenter
1412 "I" gnus-summary-increase-score
1413 "L" gnus-summary-lower-score
1414 "\M-i" gnus-symbolic-argument
1415 "h" gnus-summary-select-article-buffer
1417 "b" gnus-article-view-part
1418 "\M-t" gnus-summary-toggle-display-buttonized
1420 "V" gnus-summary-score-map
1421 "X" gnus-uu-extract-map
1422 "S" gnus-summary-send-map)
1424 ;; Sort of orthogonal keymap
1425 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1426 "t" gnus-summary-tick-article-forward
1427 "!" gnus-summary-tick-article-forward
1428 "d" gnus-summary-mark-as-read-forward
1429 "r" gnus-summary-mark-as-read-forward
1430 "c" gnus-summary-clear-mark-forward
1431 " " gnus-summary-clear-mark-forward
1432 "e" gnus-summary-mark-as-expirable
1433 "x" gnus-summary-mark-as-expirable
1434 "?" gnus-summary-mark-as-dormant
1435 "b" gnus-summary-set-bookmark
1436 "B" gnus-summary-remove-bookmark
1437 "#" gnus-summary-mark-as-processable
1438 "\M-#" gnus-summary-unmark-as-processable
1439 "S" gnus-summary-limit-include-expunged
1440 "C" gnus-summary-catchup
1441 "H" gnus-summary-catchup-to-here
1442 "\C-c" gnus-summary-catchup-all
1443 "k" gnus-summary-kill-same-subject-and-select
1444 "K" gnus-summary-kill-same-subject
1445 "P" gnus-uu-mark-map)
1447 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1448 "c" gnus-summary-clear-above
1449 "u" gnus-summary-tick-above
1450 "m" gnus-summary-mark-above
1451 "k" gnus-summary-kill-below)
1453 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1454 "/" gnus-summary-limit-to-subject
1455 "n" gnus-summary-limit-to-articles
1456 "w" gnus-summary-pop-limit
1457 "s" gnus-summary-limit-to-subject
1458 "a" gnus-summary-limit-to-author
1459 "u" gnus-summary-limit-to-unread
1460 "m" gnus-summary-limit-to-marks
1461 "M" gnus-summary-limit-exclude-marks
1462 "v" gnus-summary-limit-to-score
1463 "*" gnus-summary-limit-include-cached
1464 "D" gnus-summary-limit-include-dormant
1465 "T" gnus-summary-limit-include-thread
1466 "d" gnus-summary-limit-exclude-dormant
1467 "t" gnus-summary-limit-to-age
1468 "x" gnus-summary-limit-to-extra
1469 "E" gnus-summary-limit-include-expunged
1470 "c" gnus-summary-limit-exclude-childless-dormant
1471 "C" gnus-summary-limit-mark-excluded-as-read)
1473 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1474 "n" gnus-summary-next-unread-article
1475 "p" gnus-summary-prev-unread-article
1476 "N" gnus-summary-next-article
1477 "P" gnus-summary-prev-article
1478 "\C-n" gnus-summary-next-same-subject
1479 "\C-p" gnus-summary-prev-same-subject
1480 "\M-n" gnus-summary-next-unread-subject
1481 "\M-p" gnus-summary-prev-unread-subject
1482 "f" gnus-summary-first-unread-article
1483 "b" gnus-summary-best-unread-article
1484 "j" gnus-summary-goto-article
1485 "g" gnus-summary-goto-subject
1486 "l" gnus-summary-goto-last-article
1487 "o" gnus-summary-pop-article)
1489 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1490 "k" gnus-summary-kill-thread
1491 "l" gnus-summary-lower-thread
1492 "i" gnus-summary-raise-thread
1493 "T" gnus-summary-toggle-threads
1494 "t" gnus-summary-rethread-current
1495 "^" gnus-summary-reparent-thread
1496 "s" gnus-summary-show-thread
1497 "S" gnus-summary-show-all-threads
1498 "h" gnus-summary-hide-thread
1499 "H" gnus-summary-hide-all-threads
1500 "n" gnus-summary-next-thread
1501 "p" gnus-summary-prev-thread
1502 "u" gnus-summary-up-thread
1503 "o" gnus-summary-top-thread
1504 "d" gnus-summary-down-thread
1505 "#" gnus-uu-mark-thread
1506 "\M-#" gnus-uu-unmark-thread)
1508 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1509 "g" gnus-summary-prepare
1510 "c" gnus-summary-insert-cached-articles)
1512 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1513 "c" gnus-summary-catchup-and-exit
1514 "C" gnus-summary-catchup-all-and-exit
1515 "E" gnus-summary-exit-no-update
1516 "Q" gnus-summary-exit
1517 "Z" gnus-summary-exit
1518 "n" gnus-summary-catchup-and-goto-next-group
1519 "R" gnus-summary-reselect-current-group
1520 "G" gnus-summary-rescan-group
1521 "N" gnus-summary-next-group
1522 "s" gnus-summary-save-newsrc
1523 "P" gnus-summary-prev-group)
1525 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1526 " " gnus-summary-next-page
1527 "n" gnus-summary-next-page
1528 "\177" gnus-summary-prev-page
1529 [delete] gnus-summary-prev-page
1530 "p" gnus-summary-prev-page
1531 "\r" gnus-summary-scroll-up
1532 "\M-\r" gnus-summary-scroll-down
1533 "<" gnus-summary-beginning-of-article
1534 ">" gnus-summary-end-of-article
1535 "b" gnus-summary-beginning-of-article
1536 "e" gnus-summary-end-of-article
1537 "^" gnus-summary-refer-parent-article
1538 "r" gnus-summary-refer-parent-article
1539 "D" gnus-summary-enter-digest-group
1540 "R" gnus-summary-refer-references
1541 "T" gnus-summary-refer-thread
1542 "g" gnus-summary-show-article
1543 "s" gnus-summary-isearch-article
1544 "P" gnus-summary-print-article
1545 "t" gnus-article-babel)
1547 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1548 "b" gnus-article-add-buttons
1549 "B" gnus-article-add-buttons-to-head
1550 "o" gnus-article-treat-overstrike
1551 "e" gnus-article-emphasize
1552 "w" gnus-article-fill-cited-article
1553 "Q" gnus-article-fill-long-lines
1554 "C" gnus-article-capitalize-sentences
1555 "c" gnus-article-remove-cr
1556 "q" gnus-article-de-quoted-unreadable
1557 "6" gnus-article-de-base64-unreadable
1558 "Z" gnus-article-decode-HZ
1559 "h" gnus-article-wash-html
1560 "s" gnus-summary-force-verify-and-decrypt
1561 "f" gnus-article-display-x-face
1562 "l" gnus-summary-stop-page-breaking
1563 "r" gnus-summary-caesar-message
1564 "t" gnus-summary-toggle-header
1565 "v" gnus-summary-verbose-headers
1566 "H" gnus-article-strip-headers-in-body
1567 "d" gnus-article-treat-dumbquotes)
1569 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1570 "a" gnus-article-hide
1571 "h" gnus-article-hide-headers
1572 "b" gnus-article-hide-boring-headers
1573 "s" gnus-article-hide-signature
1574 "c" gnus-article-hide-citation
1575 "C" gnus-article-hide-citation-in-followups
1576 "l" gnus-article-hide-list-identifiers
1577 "p" gnus-article-hide-pgp
1578 "B" gnus-article-strip-banner
1579 "P" gnus-article-hide-pem
1580 "\C-c" gnus-article-hide-citation-maybe)
1582 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1583 "a" gnus-article-highlight
1584 "h" gnus-article-highlight-headers
1585 "c" gnus-article-highlight-citation
1586 "s" gnus-article-highlight-signature)
1588 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1589 "w" gnus-article-decode-mime-words
1590 "c" gnus-article-decode-charset
1591 "v" gnus-mime-view-all-parts
1592 "b" gnus-article-view-part)
1594 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1595 "z" gnus-article-date-ut
1596 "u" gnus-article-date-ut
1597 "l" gnus-article-date-local
1598 "e" gnus-article-date-lapsed
1599 "o" gnus-article-date-original
1600 "i" gnus-article-date-iso8601
1601 "s" gnus-article-date-user)
1603 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1604 "t" gnus-article-remove-trailing-blank-lines
1605 "l" gnus-article-strip-leading-blank-lines
1606 "m" gnus-article-strip-multiple-blank-lines
1607 "a" gnus-article-strip-blank-lines
1608 "A" gnus-article-strip-all-blank-lines
1609 "s" gnus-article-strip-leading-space
1610 "e" gnus-article-strip-trailing-space)
1612 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1614 "f" gnus-summary-fetch-faq
1615 "d" gnus-summary-describe-group
1616 "h" gnus-summary-describe-briefly
1617 "i" gnus-info-find-node)
1619 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1620 "e" gnus-summary-expire-articles
1621 "\M-\C-e" gnus-summary-expire-articles-now
1622 "\177" gnus-summary-delete-article
1623 [delete] gnus-summary-delete-article
1624 [backspace] gnus-summary-delete-article
1625 "m" gnus-summary-move-article
1626 "r" gnus-summary-respool-article
1627 "w" gnus-summary-edit-article
1628 "c" gnus-summary-copy-article
1629 "B" gnus-summary-crosspost-article
1630 "q" gnus-summary-respool-query
1631 "t" gnus-summary-respool-trace
1632 "i" gnus-summary-import-article
1633 "p" gnus-summary-article-posted-p)
1635 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1636 "o" gnus-summary-save-article
1637 "m" gnus-summary-save-article-mail
1638 "F" gnus-summary-write-article-file
1639 "r" gnus-summary-save-article-rmail
1640 "f" gnus-summary-save-article-file
1641 "b" gnus-summary-save-article-body-file
1642 "h" gnus-summary-save-article-folder
1643 "v" gnus-summary-save-article-vm
1644 "p" gnus-summary-pipe-output
1645 "s" gnus-soup-add-article)
1647 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1648 "b" gnus-summary-display-buttonized
1649 "m" gnus-summary-repair-multipart
1650 "v" gnus-article-view-part
1651 "o" gnus-article-save-part
1652 "c" gnus-article-copy-part
1653 "e" gnus-article-externalize-part
1654 "i" gnus-article-inline-part
1655 "|" gnus-article-pipe-part))
1657 (defun gnus-summary-make-menu-bar ()
1658 (gnus-turn-off-edit-menu 'summary)
1660 (unless (boundp 'gnus-summary-misc-menu)
1663 gnus-summary-kill-menu gnus-summary-mode-map ""
1668 ["Enter score..." gnus-summary-score-entry t]
1669 ["Customize" gnus-score-customize t])
1670 (gnus-make-score-map 'increase)
1671 (gnus-make-score-map 'lower)
1673 ["Kill below" gnus-summary-kill-below t]
1674 ["Mark above" gnus-summary-mark-above t]
1675 ["Tick above" gnus-summary-tick-above t]
1676 ["Clear above" gnus-summary-clear-above t])
1677 ["Current score" gnus-summary-current-score t]
1678 ["Set score" gnus-summary-set-score t]
1679 ["Switch current score file..." gnus-score-change-score-file t]
1680 ["Set mark below..." gnus-score-set-mark-below t]
1681 ["Set expunge below..." gnus-score-set-expunge-below t]
1682 ["Edit current score file" gnus-score-edit-current-scores t]
1683 ["Edit score file" gnus-score-edit-file t]
1684 ["Trace score" gnus-score-find-trace t]
1685 ["Find words" gnus-score-find-favourite-words t]
1686 ["Rescore buffer" gnus-summary-rescore t]
1687 ["Increase score..." gnus-summary-increase-score t]
1688 ["Lower score..." gnus-summary-lower-score t]))))
1690 ;; Define both the Article menu in the summary buffer and the equivalent
1691 ;; Commands menu in the article buffer here for consistency.
1694 ["All" gnus-article-hide t]
1695 ["Headers" gnus-article-hide-headers t]
1696 ["Signature" gnus-article-hide-signature t]
1697 ["Citation" gnus-article-hide-citation t]
1698 ["List identifiers" gnus-article-hide-list-identifiers t]
1699 ["PGP" gnus-article-hide-pgp t]
1700 ["Banner" gnus-article-strip-banner t]
1701 ["Boring headers" gnus-article-hide-boring-headers t])
1703 ["All" gnus-article-highlight t]
1704 ["Headers" gnus-article-highlight-headers t]
1705 ["Signature" gnus-article-highlight-signature t]
1706 ["Citation" gnus-article-highlight-citation t])
1708 ["Words" gnus-article-decode-mime-words t]
1709 ["Charset" gnus-article-decode-charset t]
1710 ["QP" gnus-article-de-quoted-unreadable t]
1711 ["Base64" gnus-article-de-base64-unreadable t]
1712 ["View all" gnus-mime-view-all-parts t]
1713 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt])
1715 ["Local" gnus-article-date-local t]
1716 ["ISO8601" gnus-article-date-iso8601 t]
1717 ["UT" gnus-article-date-ut t]
1718 ["Original" gnus-article-date-original t]
1719 ["Lapsed" gnus-article-date-lapsed t]
1720 ["User-defined" gnus-article-date-user t])
1723 ["Leading" gnus-article-strip-leading-blank-lines t]
1724 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1725 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1726 ["All of the above" gnus-article-strip-blank-lines t]
1727 ["All" gnus-article-strip-all-blank-lines t]
1728 ["Leading space" gnus-article-strip-leading-space t]
1729 ["Trailing space" gnus-article-strip-trailing-space t])
1730 ["Overstrike" gnus-article-treat-overstrike t]
1731 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1732 ["Emphasis" gnus-article-emphasize t]
1733 ["Word wrap" gnus-article-fill-cited-article t]
1734 ["Fill long lines" gnus-article-fill-long-lines t]
1735 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1736 ["CR" gnus-article-remove-cr t]
1737 ["Show X-Face" gnus-article-display-x-face t]
1738 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1739 ["Base64" gnus-article-de-base64-unreadable t]
1740 ["Rot 13" gnus-summary-caesar-message t]
1741 ["Unix pipe" gnus-summary-pipe-message t]
1742 ["Add buttons" gnus-article-add-buttons t]
1743 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1744 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1745 ["Verbose header" gnus-summary-verbose-headers t]
1746 ["Toggle header" gnus-summary-toggle-header t]
1747 ["Html" gnus-article-wash-html t]
1748 ["HZ" gnus-article-decode-HZ t])
1750 ["Save in default format" gnus-summary-save-article t]
1751 ["Save in file" gnus-summary-save-article-file t]
1752 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1753 ["Save in MH folder" gnus-summary-save-article-folder t]
1754 ["Save in VM folder" gnus-summary-save-article-vm t]
1755 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1756 ["Save body in file" gnus-summary-save-article-body-file t]
1757 ["Pipe through a filter" gnus-summary-pipe-output t]
1758 ["Add to SOUP packet" gnus-soup-add-article t]
1759 ["Print" gnus-summary-print-article t])
1761 ["Respool article..." gnus-summary-respool-article t]
1762 ["Move article..." gnus-summary-move-article
1763 (gnus-check-backend-function
1764 'request-move-article gnus-newsgroup-name)]
1765 ["Copy article..." gnus-summary-copy-article t]
1766 ["Crosspost article..." gnus-summary-crosspost-article
1767 (gnus-check-backend-function
1768 'request-replace-article gnus-newsgroup-name)]
1769 ["Import file..." gnus-summary-import-article t]
1770 ["Check if posted" gnus-summary-article-posted-p t]
1771 ["Edit article" gnus-summary-edit-article
1772 (not (gnus-group-read-only-p))]
1773 ["Delete article" gnus-summary-delete-article
1774 (gnus-check-backend-function
1775 'request-expire-articles gnus-newsgroup-name)]
1776 ["Query respool" gnus-summary-respool-query t]
1777 ["Trace respool" gnus-summary-respool-trace t]
1778 ["Delete expirable articles" gnus-summary-expire-articles-now
1779 (gnus-check-backend-function
1780 'request-expire-articles gnus-newsgroup-name)])
1782 ["Uudecode" gnus-uu-decode-uu t]
1783 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1784 ["Unshar" gnus-uu-decode-unshar t]
1785 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1786 ["Save" gnus-uu-decode-save t]
1787 ["Binhex" gnus-uu-decode-binhex t]
1788 ["Postscript" gnus-uu-decode-postscript t])
1790 ["Enter article" gnus-cache-enter-article t]
1791 ["Remove article" gnus-cache-remove-article t])
1792 ["Translate" gnus-article-babel t]
1793 ["Select article buffer" gnus-summary-select-article-buffer t]
1794 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1795 ["Isearch article..." gnus-summary-isearch-article t]
1796 ["Beginning of the article" gnus-summary-beginning-of-article t]
1797 ["End of the article" gnus-summary-end-of-article t]
1798 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1799 ["Fetch referenced articles" gnus-summary-refer-references t]
1800 ["Fetch current thread" gnus-summary-refer-thread t]
1801 ["Fetch article with id..." gnus-summary-refer-article t]
1802 ["Redisplay" gnus-summary-show-article t])))
1804 gnus-summary-article-menu gnus-summary-mode-map ""
1805 (cons "Article" innards))
1808 gnus-article-commands-menu gnus-article-mode-map ""
1809 (cons "Commands" innards)))
1812 gnus-summary-thread-menu gnus-summary-mode-map ""
1814 ["Toggle threading" gnus-summary-toggle-threads t]
1815 ["Hide threads" gnus-summary-hide-all-threads t]
1816 ["Show threads" gnus-summary-show-all-threads t]
1817 ["Hide thread" gnus-summary-hide-thread t]
1818 ["Show thread" gnus-summary-show-thread t]
1819 ["Go to next thread" gnus-summary-next-thread t]
1820 ["Go to previous thread" gnus-summary-prev-thread t]
1821 ["Go down thread" gnus-summary-down-thread t]
1822 ["Go up thread" gnus-summary-up-thread t]
1823 ["Top of thread" gnus-summary-top-thread t]
1824 ["Mark thread as read" gnus-summary-kill-thread t]
1825 ["Lower thread score" gnus-summary-lower-thread t]
1826 ["Raise thread score" gnus-summary-raise-thread t]
1827 ["Rethread current" gnus-summary-rethread-current t]))
1830 gnus-summary-post-menu gnus-summary-mode-map ""
1832 ["Post an article" gnus-summary-post-news t]
1833 ["Followup" gnus-summary-followup t]
1834 ["Followup and yank" gnus-summary-followup-with-original t]
1835 ["Supersede article" gnus-summary-supersede-article t]
1836 ["Cancel article" gnus-summary-cancel-article t]
1837 ["Reply" gnus-summary-reply t]
1838 ["Reply and yank" gnus-summary-reply-with-original t]
1839 ["Wide reply" gnus-summary-wide-reply t]
1840 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1841 ["Mail forward" gnus-summary-mail-forward t]
1842 ["Post forward" gnus-summary-post-forward t]
1843 ["Digest and mail" gnus-uu-digest-mail-forward t]
1844 ["Digest and post" gnus-uu-digest-post-forward t]
1845 ["Resend message" gnus-summary-resend-message t]
1846 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1847 ["Send a mail" gnus-summary-mail-other-window t]
1848 ["Uuencode and post" gnus-uu-post-news t]
1849 ["Followup via news" gnus-summary-followup-to-mail t]
1850 ["Followup via news and yank"
1851 gnus-summary-followup-to-mail-with-original t]
1853 ;;["Send" gnus-summary-send-draft t]
1854 ;;["Send bounced" gnus-resend-bounced-mail t])
1858 gnus-summary-misc-menu gnus-summary-mode-map ""
1861 ["Mark as read" gnus-summary-mark-as-read-forward t]
1862 ["Mark same subject and select"
1863 gnus-summary-kill-same-subject-and-select t]
1864 ["Mark same subject" gnus-summary-kill-same-subject t]
1865 ["Catchup" gnus-summary-catchup t]
1866 ["Catchup all" gnus-summary-catchup-all t]
1867 ["Catchup to here" gnus-summary-catchup-to-here t]
1868 ["Catchup region" gnus-summary-mark-region-as-read t]
1869 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1871 ["Tick" gnus-summary-tick-article-forward t]
1872 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1873 ["Remove marks" gnus-summary-clear-mark-forward t]
1874 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1875 ["Set bookmark" gnus-summary-set-bookmark t]
1876 ["Remove bookmark" gnus-summary-remove-bookmark t])
1878 ["Marks..." gnus-summary-limit-to-marks t]
1879 ["Subject..." gnus-summary-limit-to-subject t]
1880 ["Author..." gnus-summary-limit-to-author t]
1881 ["Age..." gnus-summary-limit-to-age t]
1882 ["Extra..." gnus-summary-limit-to-extra t]
1883 ["Score" gnus-summary-limit-to-score t]
1884 ["Unread" gnus-summary-limit-to-unread t]
1885 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1886 ["Articles" gnus-summary-limit-to-articles t]
1887 ["Pop limit" gnus-summary-pop-limit t]
1888 ["Show dormant" gnus-summary-limit-include-dormant t]
1889 ["Hide childless dormant"
1890 gnus-summary-limit-exclude-childless-dormant t]
1891 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1892 ["Hide marked" gnus-summary-limit-exclude-marks t]
1893 ["Show expunged" gnus-summary-show-all-expunged t])
1895 ["Set mark" gnus-summary-mark-as-processable t]
1896 ["Remove mark" gnus-summary-unmark-as-processable t]
1897 ["Remove all marks" gnus-summary-unmark-all-processable t]
1898 ["Mark above" gnus-uu-mark-over t]
1899 ["Mark series" gnus-uu-mark-series t]
1900 ["Mark region" gnus-uu-mark-region t]
1901 ["Unmark region" gnus-uu-unmark-region t]
1902 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1903 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1904 ["Mark all" gnus-uu-mark-all t]
1905 ["Mark buffer" gnus-uu-mark-buffer t]
1906 ["Mark sparse" gnus-uu-mark-sparse t]
1907 ["Mark thread" gnus-uu-mark-thread t]
1908 ["Unmark thread" gnus-uu-unmark-thread t]
1909 ("Process Mark Sets"
1910 ["Kill" gnus-summary-kill-process-mark t]
1911 ["Yank" gnus-summary-yank-process-mark
1912 gnus-newsgroup-process-stack]
1913 ["Save" gnus-summary-save-process-mark t]))
1915 ["Page forward" gnus-summary-next-page t]
1916 ["Page backward" gnus-summary-prev-page t]
1917 ["Line forward" gnus-summary-scroll-up t])
1919 ["Next unread article" gnus-summary-next-unread-article t]
1920 ["Previous unread article" gnus-summary-prev-unread-article t]
1921 ["Next article" gnus-summary-next-article t]
1922 ["Previous article" gnus-summary-prev-article t]
1923 ["Next unread subject" gnus-summary-next-unread-subject t]
1924 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1925 ["Next article same subject" gnus-summary-next-same-subject t]
1926 ["Previous article same subject" gnus-summary-prev-same-subject t]
1927 ["First unread article" gnus-summary-first-unread-article t]
1928 ["Best unread article" gnus-summary-best-unread-article t]
1929 ["Go to subject number..." gnus-summary-goto-subject t]
1930 ["Go to article number..." gnus-summary-goto-article t]
1931 ["Go to the last article" gnus-summary-goto-last-article t]
1932 ["Pop article off history" gnus-summary-pop-article t])
1934 ["Sort by number" gnus-summary-sort-by-number t]
1935 ["Sort by author" gnus-summary-sort-by-author t]
1936 ["Sort by subject" gnus-summary-sort-by-subject t]
1937 ["Sort by date" gnus-summary-sort-by-date t]
1938 ["Sort by score" gnus-summary-sort-by-score t]
1939 ["Sort by lines" gnus-summary-sort-by-lines t]
1940 ["Sort by characters" gnus-summary-sort-by-chars t])
1942 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1943 ["Describe group" gnus-summary-describe-group t]
1944 ["Read manual" gnus-info-find-node t])
1946 ["Pick and read" gnus-pick-mode t]
1947 ["Binary" gnus-binary-mode t])
1949 ["Regenerate" gnus-summary-prepare t]
1950 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1951 ["Toggle threading" gnus-summary-toggle-threads t])
1952 ["Filter articles..." gnus-summary-execute-command t]
1953 ["Run command on subjects..." gnus-summary-universal-argument t]
1954 ["Search articles forward..." gnus-summary-search-article-forward t]
1955 ["Search articles backward..." gnus-summary-search-article-backward t]
1956 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1957 ["Expand window" gnus-summary-expand-window t]
1958 ["Expire expirable articles" gnus-summary-expire-articles
1959 (gnus-check-backend-function
1960 'request-expire-articles gnus-newsgroup-name)]
1961 ["Edit local kill file" gnus-summary-edit-local-kill t]
1962 ["Edit main kill file" gnus-summary-edit-global-kill t]
1963 ["Edit group parameters" gnus-summary-edit-parameters t]
1964 ["Customize group parameters" gnus-summary-customize-parameters t]
1965 ["Send a bug report" gnus-bug t]
1967 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1968 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1969 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1970 ["Exit group" gnus-summary-exit t]
1971 ["Exit group without updating" gnus-summary-exit-no-update t]
1972 ["Exit and goto next group" gnus-summary-next-group t]
1973 ["Exit and goto prev group" gnus-summary-prev-group t]
1974 ["Reselect group" gnus-summary-reselect-current-group t]
1975 ["Rescan group" gnus-summary-rescan-group t]
1976 ["Update dribble" gnus-summary-save-newsrc t])))
1978 (gnus-run-hooks 'gnus-summary-menu-hook)))
1980 (defun gnus-score-set-default (var value)
1981 "A version of set that updates the GNU Emacs menu-bar."
1983 ;; It is the message that forces the active status to be updated.
1986 (defun gnus-make-score-map (type)
1987 "Make a summary score map of type TYPE."
1990 (let ((headers '(("author" "from" string)
1991 ("subject" "subject" string)
1992 ("article body" "body" string)
1993 ("article head" "head" string)
1994 ("xref" "xref" string)
1995 ("extra header" "extra" string)
1996 ("lines" "lines" number)
1997 ("followups to author" "followup" string)))
1998 (types '((number ("less than" <)
2001 (string ("substring" s)
2005 (perms '(("temporary" (current-time-string))
2013 (if (eq type 'lower)
2018 (setq header (car headers))
2024 (let ((ts (cdr (assoc (nth 2 header) types)))
2040 'gnus-summary-score-entry
2042 (if (or (string= (nth 1 header)
2044 (string= (nth 1 header)
2047 (list 'gnus-summary-header
2049 (list 'quote (nth 1 (car ts)))
2050 (list 'gnus-score-delta-default
2057 (list (nreverse outp))))
2060 (list (nreverse outt))))
2062 (setq headers (cdr headers)))
2063 (list (nreverse outh))))))))
2067 (defun gnus-summary-mode (&optional group)
2068 "Major mode for reading articles.
2070 All normal editing commands are switched off.
2071 \\<gnus-summary-mode-map>
2072 Each line in this buffer represents one article. To read an
2073 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2074 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2077 You can also post articles and send mail from this buffer. To
2078 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2079 of an article, type `\\[gnus-summary-reply]'.
2081 There are approx. one gazillion commands you can execute in this
2082 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2084 The following commands are available:
2086 \\{gnus-summary-mode-map}"
2088 (when (gnus-visual-p 'summary-menu 'menu)
2089 (gnus-summary-make-menu-bar))
2090 (kill-all-local-variables)
2091 (gnus-summary-make-local-variables)
2092 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2093 (gnus-summary-make-local-variables))
2094 (gnus-make-thread-indent-array)
2095 (gnus-simplify-mode-line)
2096 (setq major-mode 'gnus-summary-mode)
2097 (setq mode-name "Summary")
2098 (make-local-variable 'minor-mode-alist)
2099 (use-local-map gnus-summary-mode-map)
2100 (buffer-disable-undo)
2101 (setq buffer-read-only t) ;Disable modification
2102 (setq truncate-lines t)
2103 (setq selective-display t)
2104 (setq selective-display-ellipses t) ;Display `...'
2105 (gnus-summary-set-display-table)
2106 (gnus-set-default-directory)
2107 (setq gnus-newsgroup-name group)
2108 (make-local-variable 'gnus-summary-line-format)
2109 (make-local-variable 'gnus-summary-line-format-spec)
2110 (make-local-variable 'gnus-summary-dummy-line-format)
2111 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2112 (make-local-variable 'gnus-summary-mark-positions)
2113 (make-local-hook 'pre-command-hook)
2114 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2115 (gnus-run-hooks 'gnus-summary-mode-hook)
2116 (mm-enable-multibyte-mule4)
2117 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2118 (gnus-update-summary-mark-positions))
2120 (defun gnus-summary-make-local-variables ()
2121 "Make all the local summary buffer variables."
2123 (dolist (local gnus-summary-local-variables)
2126 (if (eq (cdr local) 'global)
2127 ;; Copy the global value of the variable.
2128 (setq global (symbol-value (car local)))
2129 ;; Use the value from the list.
2130 (setq global (eval (cdr local))))
2131 (set (make-local-variable (car local)) global))
2132 ;; Simple nil-valued local variable.
2133 (set (make-local-variable local) nil)))))
2135 (defun gnus-summary-clear-local-variables ()
2136 (let ((locals gnus-summary-local-variables))
2138 (if (consp (car locals))
2139 (and (vectorp (caar locals))
2140 (set (caar locals) nil))
2141 (and (vectorp (car locals))
2142 (set (car locals) nil)))
2143 (setq locals (cdr locals)))))
2145 ;; Summary data functions.
2147 (defmacro gnus-data-number (data)
2150 (defmacro gnus-data-set-number (data number)
2151 `(setcar ,data ,number))
2153 (defmacro gnus-data-mark (data)
2156 (defmacro gnus-data-set-mark (data mark)
2157 `(setcar (nthcdr 1 ,data) ,mark))
2159 (defmacro gnus-data-pos (data)
2162 (defmacro gnus-data-set-pos (data pos)
2163 `(setcar (nthcdr 2 ,data) ,pos))
2165 (defmacro gnus-data-header (data)
2168 (defmacro gnus-data-set-header (data header)
2169 `(setf (nth 3 ,data) ,header))
2171 (defmacro gnus-data-level (data)
2174 (defmacro gnus-data-unread-p (data)
2175 `(= (nth 1 ,data) gnus-unread-mark))
2177 (defmacro gnus-data-read-p (data)
2178 `(/= (nth 1 ,data) gnus-unread-mark))
2180 (defmacro gnus-data-pseudo-p (data)
2181 `(consp (nth 3 ,data)))
2183 (defmacro gnus-data-find (number)
2184 `(assq ,number gnus-newsgroup-data))
2186 (defmacro gnus-data-find-list (number &optional data)
2187 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2188 (memq (assq ,number bdata)
2191 (defmacro gnus-data-make (number mark pos header level)
2192 `(list ,number ,mark ,pos ,header ,level))
2194 (defun gnus-data-enter (after-article number mark pos header level offset)
2195 (let ((data (gnus-data-find-list after-article)))
2197 (error "No such article: %d" after-article))
2198 (setcdr data (cons (gnus-data-make number mark pos header level)
2200 (setq gnus-newsgroup-data-reverse nil)
2201 (gnus-data-update-list (cddr data) offset)))
2203 (defun gnus-data-enter-list (after-article list &optional offset)
2205 (let ((data (and after-article (gnus-data-find-list after-article)))
2209 (let ((odata gnus-newsgroup-data))
2210 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2212 (gnus-data-update-list odata offset)))
2213 ;; Find the last element in the list to be spliced into the main
2216 (setq list (cdr list)))
2219 (setcdr list gnus-newsgroup-data)
2220 (setq gnus-newsgroup-data ilist)
2222 (gnus-data-update-list (cdr list) offset)))
2223 (setcdr list (cdr data))
2226 (gnus-data-update-list (cdr list) offset))))
2227 (setq gnus-newsgroup-data-reverse nil))))
2229 (defun gnus-data-remove (article &optional offset)
2230 (let ((data gnus-newsgroup-data))
2231 (if (= (gnus-data-number (car data)) article)
2233 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2234 gnus-newsgroup-data-reverse nil)
2236 (gnus-data-update-list gnus-newsgroup-data offset)))
2238 (when (= (gnus-data-number (cadr data)) article)
2239 (setcdr data (cddr data))
2241 (gnus-data-update-list (cdr data) offset))
2243 gnus-newsgroup-data-reverse nil))
2244 (setq data (cdr data))))))
2246 (defmacro gnus-data-list (backward)
2248 (or gnus-newsgroup-data-reverse
2249 (setq gnus-newsgroup-data-reverse
2250 (reverse gnus-newsgroup-data)))
2251 gnus-newsgroup-data))
2253 (defun gnus-data-update-list (data offset)
2254 "Add OFFSET to the POS of all data entries in DATA."
2255 (setq gnus-newsgroup-data-reverse nil)
2257 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2258 (setq data (cdr data))))
2260 (defun gnus-summary-article-pseudo-p (article)
2261 "Say whether this article is a pseudo article or not."
2262 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2264 (defmacro gnus-summary-article-sparse-p (article)
2265 "Say whether this article is a sparse article or not."
2266 `(memq ,article gnus-newsgroup-sparse))
2268 (defmacro gnus-summary-article-ancient-p (article)
2269 "Say whether this article is a sparse article or not."
2270 `(memq ,article gnus-newsgroup-ancient))
2272 (defun gnus-article-parent-p (number)
2273 "Say whether this article is a parent or not."
2274 (let ((data (gnus-data-find-list number)))
2275 (and (cdr data) ; There has to be an article after...
2276 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2277 (gnus-data-level (nth 1 data))))))
2279 (defun gnus-article-children (number)
2280 "Return a list of all children to NUMBER."
2281 (let* ((data (gnus-data-find-list number))
2282 (level (gnus-data-level (car data)))
2284 (setq data (cdr data))
2286 (= (gnus-data-level (car data)) (1+ level)))
2287 (push (gnus-data-number (car data)) children)
2288 (setq data (cdr data)))
2291 (defmacro gnus-summary-skip-intangible ()
2292 "If the current article is intangible, then jump to a different article."
2293 '(let ((to (get-text-property (point) 'gnus-intangible)))
2294 (and to (gnus-summary-goto-subject to))))
2296 (defmacro gnus-summary-article-intangible-p ()
2297 "Say whether this article is intangible or not."
2298 '(get-text-property (point) 'gnus-intangible))
2300 (defun gnus-article-read-p (article)
2301 "Say whether ARTICLE is read or not."
2302 (not (or (memq article gnus-newsgroup-marked)
2303 (memq article gnus-newsgroup-unreads)
2304 (memq article gnus-newsgroup-unselected)
2305 (memq article gnus-newsgroup-dormant))))
2307 ;; Some summary mode macros.
2309 (defmacro gnus-summary-article-number ()
2310 "The article number of the article on the current line.
2311 If there isn's an article number here, then we return the current
2314 (gnus-summary-skip-intangible)
2315 (or (get-text-property (point) 'gnus-number)
2316 (gnus-summary-last-subject))))
2318 (defmacro gnus-summary-article-header (&optional number)
2319 "Return the header of article NUMBER."
2320 `(gnus-data-header (gnus-data-find
2321 ,(or number '(gnus-summary-article-number)))))
2323 (defmacro gnus-summary-thread-level (&optional number)
2324 "Return the level of thread that starts with article NUMBER."
2325 `(if (and (eq gnus-summary-make-false-root 'dummy)
2326 (get-text-property (point) 'gnus-intangible))
2328 (gnus-data-level (gnus-data-find
2329 ,(or number '(gnus-summary-article-number))))))
2331 (defmacro gnus-summary-article-mark (&optional number)
2332 "Return the mark of article NUMBER."
2333 `(gnus-data-mark (gnus-data-find
2334 ,(or number '(gnus-summary-article-number)))))
2336 (defmacro gnus-summary-article-pos (&optional number)
2337 "Return the position of the line of article NUMBER."
2338 `(gnus-data-pos (gnus-data-find
2339 ,(or number '(gnus-summary-article-number)))))
2341 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2342 (defmacro gnus-summary-article-subject (&optional number)
2343 "Return current subject string or nil if nothing."
2346 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2347 '(gnus-data-header (assq (gnus-summary-article-number)
2348 gnus-newsgroup-data)))))
2351 (mail-header-subject headers))))
2353 (defmacro gnus-summary-article-score (&optional number)
2354 "Return current article score."
2355 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2356 gnus-newsgroup-scored))
2357 gnus-summary-default-score 0))
2359 (defun gnus-summary-article-children (&optional number)
2360 "Return a list of article numbers that are children of article NUMBER."
2361 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2362 (level (gnus-data-level (car data)))
2364 (while (and (setq data (cdr data))
2365 (> (setq l (gnus-data-level (car data))) level))
2366 (and (= (1+ level) l)
2367 (push (gnus-data-number (car data))
2369 (nreverse children)))
2371 (defun gnus-summary-article-parent (&optional number)
2372 "Return the article number of the parent of article NUMBER."
2373 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2374 (gnus-data-list t)))
2375 (level (gnus-data-level (car data))))
2377 () ; This is a root.
2378 ;; We search until we find an article with a level less than
2379 ;; this one. That function has to be the parent.
2380 (while (and (setq data (cdr data))
2381 (not (< (gnus-data-level (car data)) level))))
2382 (and data (gnus-data-number (car data))))))
2384 (defun gnus-unread-mark-p (mark)
2385 "Say whether MARK is the unread mark."
2386 (= mark gnus-unread-mark))
2388 (defun gnus-read-mark-p (mark)
2389 "Say whether MARK is one of the marks that mark as read.
2390 This is all marks except unread, ticked, dormant, and expirable."
2391 (not (or (= mark gnus-unread-mark)
2392 (= mark gnus-ticked-mark)
2393 (= mark gnus-dormant-mark)
2394 (= mark gnus-expirable-mark))))
2396 (defmacro gnus-article-mark (number)
2397 "Return the MARK of article NUMBER.
2398 This macro should only be used when computing the mark the \"first\"
2399 time; i.e., when generating the summary lines. After that,
2400 `gnus-summary-article-mark' should be used to examine the
2403 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2404 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2405 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2406 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2407 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2408 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2409 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2410 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2411 gnus-ancient-mark))))
2413 ;; Saving hidden threads.
2415 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2416 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2418 (defmacro gnus-save-hidden-threads (&rest forms)
2419 "Save hidden threads, eval FORMS, and restore the hidden threads."
2420 (let ((config (make-symbol "config")))
2421 `(let ((,config (gnus-hidden-threads-configuration)))
2425 (gnus-restore-hidden-threads-configuration ,config)))))
2427 (defun gnus-data-compute-positions ()
2428 "Compute the positions of all articles."
2429 (setq gnus-newsgroup-data-reverse nil)
2430 (let ((data gnus-newsgroup-data))
2432 (gnus-save-hidden-threads
2433 (gnus-summary-show-all-threads)
2434 (goto-char (point-min))
2436 (while (get-text-property (point) 'gnus-intangible)
2438 (gnus-data-set-pos (car data) (+ (point) 3))
2439 (setq data (cdr data))
2440 (forward-line 1))))))
2442 (defun gnus-hidden-threads-configuration ()
2443 "Return the current hidden threads configuration."
2446 (goto-char (point-min))
2447 (while (search-forward "\r" nil t)
2448 (push (1- (point)) config))
2451 (defun gnus-restore-hidden-threads-configuration (config)
2452 "Restore hidden threads configuration from CONFIG."
2454 (let (point buffer-read-only)
2455 (while (setq point (pop config))
2456 (when (and (< point (point-max))
2458 (eq (char-after) ?\n))
2459 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2461 ;; Various summary mode internalish functions.
2463 (defun gnus-mouse-pick-article (e)
2466 (gnus-summary-next-page nil t))
2468 (defun gnus-summary-set-display-table ()
2469 "Change the display table.
2470 Odd characters have a tendency to mess
2471 up nicely formatted displays - we make all possible glyphs
2472 display only a single character."
2474 ;; We start from the standard display table, if any.
2475 (let ((table (or (copy-sequence standard-display-table)
2476 (make-display-table)))
2478 ;; Nix out all the control chars...
2479 (while (>= (setq i (1- i)) 0)
2480 (aset table i [??]))
2481 ;; ... but not newline and cr, of course. (cr is necessary for the
2482 ;; selective display).
2483 (aset table ?\n nil)
2484 (aset table ?\r nil)
2485 ;; We keep TAB as well.
2486 (aset table ?\t nil)
2487 ;; We nix out any glyphs over 126 that are not set already.
2489 (while (>= (setq i (1- i)) 127)
2490 ;; Only modify if the entry is nil.
2491 (unless (aref table i)
2492 (aset table i [??]))))
2493 (setq buffer-display-table table)))
2495 (defun gnus-summary-setup-buffer (group)
2496 "Initialize summary buffer."
2497 (let ((buffer (concat "*Summary " group "*")))
2498 (if (get-buffer buffer)
2501 (setq gnus-summary-buffer (current-buffer))
2502 (not gnus-newsgroup-prepared))
2503 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2504 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2505 (gnus-summary-mode group)
2507 (gnus-carpal-setup-buffer 'summary))
2508 (unless gnus-single-article-buffer
2509 (make-local-variable 'gnus-article-buffer)
2510 (make-local-variable 'gnus-article-current)
2511 (make-local-variable 'gnus-original-article-buffer))
2512 (setq gnus-newsgroup-name group)
2515 (defun gnus-set-global-variables ()
2516 "Set the global equivalents of the buffer-local variables.
2517 They are set to the latest values they had. These reflect the summary
2518 buffer that was in action when the last article was fetched."
2519 (when (eq major-mode 'gnus-summary-mode)
2520 (setq gnus-summary-buffer (current-buffer))
2521 (let ((name gnus-newsgroup-name)
2522 (marked gnus-newsgroup-marked)
2523 (unread gnus-newsgroup-unreads)
2524 (headers gnus-current-headers)
2525 (data gnus-newsgroup-data)
2526 (summary gnus-summary-buffer)
2527 (article-buffer gnus-article-buffer)
2528 (original gnus-original-article-buffer)
2529 (gac gnus-article-current)
2530 (reffed gnus-reffed-article-number)
2531 (score-file gnus-current-score-file)
2532 (default-charset gnus-newsgroup-charset)
2534 (let ((locals gnus-newsgroup-variables))
2536 (if (consp (car locals))
2537 (push (eval (caar locals)) vlist)
2538 (push (eval (car locals)) vlist))
2539 (setq locals (cdr locals)))
2540 (setq vlist (nreverse vlist)))
2542 (set-buffer gnus-group-buffer)
2543 (setq gnus-newsgroup-name name
2544 gnus-newsgroup-marked marked
2545 gnus-newsgroup-unreads unread
2546 gnus-current-headers headers
2547 gnus-newsgroup-data data
2548 gnus-article-current gac
2549 gnus-summary-buffer summary
2550 gnus-article-buffer article-buffer
2551 gnus-original-article-buffer original
2552 gnus-reffed-article-number reffed
2553 gnus-current-score-file score-file
2554 gnus-newsgroup-charset default-charset)
2555 (let ((locals gnus-newsgroup-variables))
2557 (if (consp (car locals))
2558 (set (caar locals) (pop vlist))
2559 (set (car locals) (pop vlist)))
2560 (setq locals (cdr locals))))
2561 ;; The article buffer also has local variables.
2562 (when (gnus-buffer-live-p gnus-article-buffer)
2563 (set-buffer gnus-article-buffer)
2564 (setq gnus-summary-buffer summary))))))
2566 (defun gnus-summary-article-unread-p (article)
2567 "Say whether ARTICLE is unread or not."
2568 (memq article gnus-newsgroup-unreads))
2570 (defun gnus-summary-first-article-p (&optional article)
2571 "Return whether ARTICLE is the first article in the buffer."
2572 (if (not (setq article (or article (gnus-summary-article-number))))
2574 (eq article (caar gnus-newsgroup-data))))
2576 (defun gnus-summary-last-article-p (&optional article)
2577 "Return whether ARTICLE is the last article in the buffer."
2578 (if (not (setq article (or article (gnus-summary-article-number))))
2579 ;; All non-existent numbers are the last article. :-)
2581 (not (cdr (gnus-data-find-list article)))))
2583 (defun gnus-make-thread-indent-array ()
2585 (unless (and gnus-thread-indent-array
2586 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2587 (setq gnus-thread-indent-array (make-vector 201 "")
2588 gnus-thread-indent-array-level gnus-thread-indent-level)
2590 (aset gnus-thread-indent-array n
2591 (make-string (* n gnus-thread-indent-level) ? ))
2594 (defun gnus-update-summary-mark-positions ()
2595 "Compute where the summary marks are to go."
2597 (when (gnus-buffer-exists-p gnus-summary-buffer)
2598 (set-buffer gnus-summary-buffer))
2599 (let ((gnus-replied-mark 129)
2600 (gnus-score-below-mark 130)
2601 (gnus-score-over-mark 130)
2602 (gnus-download-mark 131)
2603 (spec gnus-summary-line-format-spec)
2606 (gnus-set-work-buffer)
2607 (let ((gnus-summary-line-format-spec spec)
2608 (gnus-newsgroup-downloadable '((0 . t))))
2609 (gnus-summary-insert-line
2610 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2611 (goto-char (point-min))
2612 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2614 (goto-char (point-min))
2615 (push (cons 'replied (and (search-forward "\201" nil t)
2618 (goto-char (point-min))
2619 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2621 (goto-char (point-min))
2622 (push (cons 'download
2623 (and (search-forward "\203" nil t) (- (point) 2)))
2625 (setq gnus-summary-mark-positions pos))))
2627 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2628 "Insert a dummy root in the summary buffer."
2630 (gnus-add-text-properties
2631 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2632 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2634 (defun gnus-summary-from-or-to-or-newsgroups (header)
2635 (let ((to (cdr (assq 'To (mail-header-extra header))))
2636 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2637 (mail-parse-charset gnus-newsgroup-charset)
2638 (mail-parse-ignored-charsets
2639 (save-excursion (set-buffer gnus-summary-buffer)
2640 gnus-newsgroup-ignored-charsets)))
2643 gnus-ignored-from-addresses
2644 (string-match gnus-ignored-from-addresses
2645 (mail-header-from header)))
2647 (or (car (funcall gnus-extract-address-components
2649 gnus-decode-encoded-word-function to)))
2650 (funcall gnus-decode-encoded-word-function to))))
2652 gnus-ignored-from-addresses
2653 (string-match gnus-ignored-from-addresses
2654 (mail-header-from header)))
2655 (concat "=> " newsgroups))
2657 (or (car (funcall gnus-extract-address-components
2658 (mail-header-from header)))
2659 (mail-header-from header))))))
2661 (defun gnus-summary-insert-line (gnus-tmp-header
2662 gnus-tmp-level gnus-tmp-current
2663 gnus-tmp-unread gnus-tmp-replied
2664 gnus-tmp-expirable gnus-tmp-subject-or-nil
2665 &optional gnus-tmp-dummy gnus-tmp-score
2667 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2668 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2669 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2670 (gnus-tmp-score-char
2671 (if (or (null gnus-summary-default-score)
2672 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2673 gnus-summary-zcore-fuzz))
2675 (if (< gnus-tmp-score gnus-summary-default-score)
2676 gnus-score-below-mark gnus-score-over-mark)))
2678 (cond (gnus-tmp-process gnus-process-mark)
2679 ((memq gnus-tmp-current gnus-newsgroup-cached)
2681 (gnus-tmp-replied gnus-replied-mark)
2682 ((memq gnus-tmp-current gnus-newsgroup-saved)
2684 (t gnus-unread-mark)))
2685 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2688 ((string-match "<[^>]+> *$" gnus-tmp-from)
2689 (let ((beg (match-beginning 0)))
2690 (or (and (string-match "^\".+\"" gnus-tmp-from)
2691 (substring gnus-tmp-from 1 (1- (match-end 0))))
2692 (substring gnus-tmp-from 0 beg))))
2693 ((string-match "(.+)" gnus-tmp-from)
2694 (substring gnus-tmp-from
2695 (1+ (match-beginning 0)) (1- (match-end 0))))
2697 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2698 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2699 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2700 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2701 (buffer-read-only nil))
2702 (when (string= gnus-tmp-name "")
2703 (setq gnus-tmp-name gnus-tmp-from))
2704 (unless (numberp gnus-tmp-lines)
2705 (setq gnus-tmp-lines 0))
2706 (gnus-put-text-property
2708 (progn (eval gnus-summary-line-format-spec) (point))
2709 'gnus-number gnus-tmp-number)
2710 (when (gnus-visual-p 'summary-highlight 'highlight)
2712 (gnus-run-hooks 'gnus-summary-update-hook)
2715 (defun gnus-summary-update-line (&optional dont-update)
2716 "Update summary line after change."
2717 (when (and gnus-summary-default-score
2718 (not gnus-summary-inhibit-highlight))
2719 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2720 (article (gnus-summary-article-number))
2721 (score (gnus-summary-article-score article)))
2723 (if (and gnus-summary-mark-below
2724 (< (gnus-summary-article-score)
2725 gnus-summary-mark-below))
2726 ;; This article has a low score, so we mark it as read.
2727 (when (memq article gnus-newsgroup-unreads)
2728 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2729 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2730 ;; This article was previously marked as read on account
2731 ;; of a low score, but now it has risen, so we mark it as
2733 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2734 (gnus-summary-update-mark
2735 (if (or (null gnus-summary-default-score)
2736 (<= (abs (- score gnus-summary-default-score))
2737 gnus-summary-zcore-fuzz))
2739 (if (< score gnus-summary-default-score)
2740 gnus-score-below-mark gnus-score-over-mark))
2742 ;; Do visual highlighting.
2743 (when (gnus-visual-p 'summary-highlight 'highlight)
2744 (gnus-run-hooks 'gnus-summary-update-hook)))))
2746 (defvar gnus-tmp-new-adopts nil)
2748 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2749 "Return the number of articles in THREAD.
2750 This may be 0 in some cases -- if none of the articles in
2751 the thread are to be displayed."
2753 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2755 ((not (listp thread))
2757 ((and (consp thread) (cdr thread))
2760 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2763 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2766 (when (and level (zerop level) gnus-tmp-new-adopts)
2769 'gnus-summary-number-of-articles-in-thread
2770 gnus-tmp-new-adopts))))
2772 (if (> number 1) gnus-not-empty-thread-mark
2773 gnus-empty-thread-mark)
2776 (defun gnus-summary-set-local-parameters (group)
2777 "Go through the local params of GROUP and set all variable specs in that list."
2778 (let ((params (gnus-group-find-parameter group))
2781 (setq elem (car params)
2782 params (cdr params))
2783 (and (consp elem) ; Has to be a cons.
2784 (consp (cdr elem)) ; The cdr has to be a list.
2785 (symbolp (car elem)) ; Has to be a symbol in there.
2786 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2787 (ignore-errors ; So we set it.
2788 (make-local-variable (car elem))
2789 (set (car elem) (eval (nth 1 elem))))))))
2791 (defun gnus-summary-read-group (group &optional show-all no-article
2792 kill-buffer no-display backward
2794 "Start reading news in newsgroup GROUP.
2795 If SHOW-ALL is non-nil, already read articles are also listed.
2796 If NO-ARTICLE is non-nil, no article is selected initially.
2797 If NO-DISPLAY, don't generate a summary buffer."
2801 (let ((gnus-auto-select-next nil))
2802 (or (gnus-summary-read-group-1
2803 group show-all no-article
2804 kill-buffer no-display
2807 select-articles nil)))))
2808 (eq gnus-auto-select-next 'quietly))
2809 (set-buffer gnus-group-buffer)
2810 ;; The entry function called above goes to the next
2811 ;; group automatically, so we go two groups back
2812 ;; if we are searching for the previous group.
2814 (gnus-group-prev-unread-group 2))
2815 (if (not (equal group (gnus-group-group-name)))
2816 (setq group (gnus-group-group-name))
2820 (defun gnus-summary-read-group-1 (group show-all no-article
2821 kill-buffer no-display
2822 &optional select-articles)
2823 ;; Killed foreign groups can't be entered.
2824 (when (and (not (gnus-group-native-p group))
2825 (not (gnus-gethash group gnus-newsrc-hashtb)))
2826 (error "Dead non-native groups can't be entered"))
2827 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2828 (let* ((new-group (gnus-summary-setup-buffer group))
2829 (quit-config (gnus-group-quit-config group))
2830 (did-select (and new-group (gnus-select-newsgroup
2831 group show-all select-articles))))
2833 ;; This summary buffer exists already, so we just select it.
2835 (gnus-set-global-variables)
2837 (gnus-kill-or-deaden-summary kill-buffer))
2838 (gnus-configure-windows 'summary 'force)
2839 (gnus-set-mode-line 'summary)
2840 (gnus-summary-position-point)
2843 ;; We couldn't select this group.
2845 (when (and (eq major-mode 'gnus-summary-mode)
2846 (not (equal (current-buffer) kill-buffer)))
2847 (kill-buffer (current-buffer))
2848 (if (not quit-config)
2850 ;; Update the info -- marks might need to be removed,
2852 (gnus-summary-update-info)
2853 (set-buffer gnus-group-buffer)
2854 (gnus-group-jump-to-group group)
2855 (gnus-group-next-unread-group 1))
2856 (gnus-handle-ephemeral-exit quit-config)))
2857 (gnus-message 3 "Can't select group")
2859 ;; The user did a `C-g' while prompting for number of articles,
2860 ;; so we exit this group.
2861 ((eq did-select 'quit)
2862 (and (eq major-mode 'gnus-summary-mode)
2863 (not (equal (current-buffer) kill-buffer))
2864 (kill-buffer (current-buffer)))
2866 (gnus-kill-or-deaden-summary kill-buffer))
2867 (if (not quit-config)
2869 (set-buffer gnus-group-buffer)
2870 (gnus-group-jump-to-group group)
2871 (gnus-group-next-unread-group 1)
2872 (gnus-configure-windows 'group 'force))
2873 (gnus-handle-ephemeral-exit quit-config))
2874 ;; Finally signal the quit.
2876 ;; The group was successfully selected.
2878 (gnus-set-global-variables)
2879 ;; Save the active value in effect when the group was entered.
2880 (setq gnus-newsgroup-active
2882 (gnus-active gnus-newsgroup-name)))
2883 ;; You can change the summary buffer in some way with this hook.
2884 (gnus-run-hooks 'gnus-select-group-hook)
2885 ;; Set any local variables in the group parameters.
2886 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2887 (gnus-update-format-specifications
2888 nil 'summary 'summary-mode 'summary-dummy)
2889 (gnus-update-summary-mark-positions)
2890 ;; Do score processing.
2891 (when gnus-use-scoring
2892 (gnus-possibly-score-headers))
2893 ;; Check whether to fill in the gaps in the threads.
2894 (when gnus-build-sparse-threads
2895 (gnus-build-sparse-threads))
2896 ;; Find the initial limit.
2897 (if gnus-show-threads
2899 (let ((gnus-newsgroup-dormant nil))
2900 (gnus-summary-initial-limit show-all))
2901 (gnus-summary-initial-limit show-all))
2902 ;; When untreaded, all articles are always shown.
2903 (setq gnus-newsgroup-limit
2905 (lambda (header) (mail-header-number header))
2906 gnus-newsgroup-headers)))
2907 ;; Generate the summary buffer.
2909 (gnus-summary-prepare))
2910 (when gnus-use-trees
2911 (gnus-tree-open group)
2912 (setq gnus-summary-highlight-line-function
2913 'gnus-tree-highlight-article))
2914 ;; If the summary buffer is empty, but there are some low-scored
2915 ;; articles or some excluded dormants, we include these in the
2917 (when (and (zerop (buffer-size))
2919 (cond (gnus-newsgroup-dormant
2920 (gnus-summary-limit-include-dormant))
2921 ((and gnus-newsgroup-scored show-all)
2922 (gnus-summary-limit-include-expunged t))))
2923 ;; Function `gnus-apply-kill-file' must be called in this hook.
2924 (gnus-run-hooks 'gnus-apply-kill-hook)
2925 (if (and (zerop (buffer-size))
2928 ;; This newsgroup is empty.
2929 (gnus-summary-catchup-and-exit nil t)
2930 (gnus-message 6 "No unread news")
2932 (gnus-kill-or-deaden-summary kill-buffer))
2933 ;; Return nil from this function.
2935 ;; Hide conversation thread subtrees. We cannot do this in
2936 ;; gnus-summary-prepare-hook since kill processing may not
2937 ;; work with hidden articles.
2938 (and gnus-show-threads
2939 gnus-thread-hide-subtree
2940 (gnus-summary-hide-all-threads))
2942 (gnus-kill-or-deaden-summary kill-buffer))
2943 ;; Show first unread article if requested.
2944 (if (and (not no-article)
2946 gnus-newsgroup-unreads
2947 gnus-auto-select-first)
2949 (gnus-configure-windows 'summary)
2951 ((eq gnus-auto-select-first 'best)
2952 (gnus-summary-best-unread-article))
2953 ((eq gnus-auto-select-first t)
2954 (gnus-summary-first-unread-article))
2955 ((gnus-functionp gnus-auto-select-first)
2956 (funcall gnus-auto-select-first))))
2957 ;; Don't select any articles, just move point to the first
2958 ;; article in the group.
2959 (goto-char (point-min))
2960 (gnus-summary-position-point)
2961 (gnus-configure-windows 'summary 'force)
2962 (gnus-set-mode-line 'summary))
2963 (when (get-buffer-window gnus-group-buffer t)
2964 ;; Gotta use windows, because recenter does weird stuff if
2965 ;; the current buffer ain't the displayed window.
2966 (let ((owin (selected-window)))
2967 (select-window (get-buffer-window gnus-group-buffer t))
2968 (when (gnus-group-goto-group group)
2970 (select-window owin)))
2971 ;; Mark this buffer as "prepared".
2972 (setq gnus-newsgroup-prepared t)
2973 (gnus-run-hooks 'gnus-summary-prepared-hook)
2976 (defun gnus-summary-prepare ()
2977 "Generate the summary buffer."
2979 (let ((buffer-read-only nil))
2981 (setq gnus-newsgroup-data nil
2982 gnus-newsgroup-data-reverse nil)
2983 (gnus-run-hooks 'gnus-summary-generate-hook)
2984 ;; Generate the buffer, either with threads or without.
2985 (when gnus-newsgroup-headers
2986 (gnus-summary-prepare-threads
2987 (if gnus-show-threads
2988 (gnus-sort-gathered-threads
2989 (funcall gnus-summary-thread-gathering-function
2991 (gnus-cut-threads (gnus-make-threads)))))
2992 ;; Unthreaded display.
2993 (gnus-sort-articles gnus-newsgroup-headers))))
2994 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2995 ;; Call hooks for modifying summary buffer.
2996 (goto-char (point-min))
2997 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2999 (defsubst gnus-general-simplify-subject (subject)
3000 "Simply subject by the same rules as gnus-gather-threads-by-subject."
3003 ;; Truncate the subject.
3004 (gnus-simplify-subject-functions
3005 (gnus-map-function gnus-simplify-subject-functions subject))
3006 ((numberp gnus-summary-gather-subject-limit)
3007 (setq subject (gnus-simplify-subject-re subject))
3008 (if (> (length subject) gnus-summary-gather-subject-limit)
3009 (substring subject 0 gnus-summary-gather-subject-limit)
3011 ;; Fuzzily simplify it.
3012 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3013 (gnus-simplify-subject-fuzzy subject))
3014 ;; Just remove the leading "Re:".
3016 (gnus-simplify-subject-re subject))))
3018 (if (and gnus-summary-gather-exclude-subject
3019 (string-match gnus-summary-gather-exclude-subject subject))
3020 nil ; This article shouldn't be gathered
3023 (defun gnus-summary-simplify-subject-query ()
3024 "Query where the respool algorithm would put this article."
3026 (gnus-summary-select-article)
3027 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3029 (defun gnus-gather-threads-by-subject (threads)
3030 "Gather threads by looking at Subject headers."
3031 (if (not gnus-summary-make-false-root)
3033 (let ((hashtb (gnus-make-hashtable 1024))
3036 subject hthread whole-subject)
3038 (setq subject (gnus-general-simplify-subject
3039 (setq whole-subject (mail-header-subject
3042 (if (setq hthread (gnus-gethash subject hashtb))
3044 ;; We enter a dummy root into the thread, if we
3045 ;; haven't done that already.
3046 (unless (stringp (caar hthread))
3047 (setcar hthread (list whole-subject (car hthread))))
3048 ;; We add this new gathered thread to this gathered
3050 (setcdr (car hthread)
3051 (nconc (cdar hthread) (list (car threads))))
3052 ;; Remove it from the list of threads.
3053 (setcdr prev (cdr threads))
3054 (setq threads prev))
3055 ;; Enter this thread into the hash table.
3056 (gnus-sethash subject threads hashtb)))
3058 (setq threads (cdr threads)))
3061 (defun gnus-gather-threads-by-references (threads)
3062 "Gather threads by looking at References headers."
3063 (let ((idhashtb (gnus-make-hashtable 1024))
3064 (thhashtb (gnus-make-hashtable 1024))
3067 ids references id gthread gid entered ref)
3069 (when (setq references (mail-header-references (caar threads)))
3070 (setq id (mail-header-id (caar threads))
3071 ids (gnus-split-references references)
3073 (while (setq ref (pop ids))
3074 (setq ids (delete ref ids))
3075 (if (not (setq gid (gnus-gethash ref idhashtb)))
3077 (gnus-sethash ref id idhashtb)
3078 (gnus-sethash id threads thhashtb))
3079 (setq gthread (gnus-gethash gid thhashtb))
3081 ;; We enter a dummy root into the thread, if we
3082 ;; haven't done that already.
3083 (unless (stringp (caar gthread))
3084 (setcar gthread (list (mail-header-subject (caar gthread))
3086 ;; We add this new gathered thread to this gathered
3088 (setcdr (car gthread)
3089 (nconc (cdar gthread) (list (car threads)))))
3090 ;; Add it into the thread hash table.
3091 (gnus-sethash id gthread thhashtb)
3093 ;; Remove it from the list of threads.
3094 (setcdr prev (cdr threads))
3095 (setq threads prev))))
3097 (setq threads (cdr threads)))
3100 (defun gnus-sort-gathered-threads (threads)
3101 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3102 (let ((result threads))
3104 (when (stringp (caar threads))
3105 (setcdr (car threads)
3106 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3107 (setq threads (cdr threads)))
3110 (defun gnus-thread-loop-p (root thread)
3111 "Say whether ROOT is in THREAD."
3112 (let ((stack (list thread))
3115 (while (setq thread (pop stack))
3116 (setq th (cdr thread))
3118 (not (eq (caar th) root)))
3121 ;; We have found a loop.
3123 (setcdr thread (delq (car th) (cdr thread)))
3124 (if (boundp (setq ref-dep (intern "none"
3125 gnus-newsgroup-dependencies)))
3126 (setcdr (symbol-value ref-dep)
3127 (nconc (cdr (symbol-value ref-dep))
3129 (set ref-dep (list nil (car th))))
3132 ;; Push all the subthreads onto the stack.
3133 (push (cdr thread) stack)))
3136 (defun gnus-make-threads ()
3137 "Go through the dependency hashtb and find the roots. Return all threads."
3139 (while (catch 'infloop
3142 ;; Deal with self-referencing References loops.
3143 (when (and (car (symbol-value refs))
3150 (car (symbol-value refs)) thread))
3151 (cdr (symbol-value refs)))))))
3154 (unless (car (symbol-value refs))
3155 ;; These threads do not refer back to any other articles,
3156 ;; so they're roots.
3157 (setq threads (append (cdr (symbol-value refs)) threads))))
3158 gnus-newsgroup-dependencies)))
3161 ;; Build the thread tree.
3162 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3163 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3165 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3166 if it was already present.
3168 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3169 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3170 Message-IDs will be renamed be renamed to a unique Message-ID before
3173 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3174 (let* ((id (mail-header-id header))
3175 (id-dep (and id (intern id dependencies)))
3176 ref ref-dep ref-header)
3177 ;; Enter this `header' in the `dependencies' table.
3181 ;; The first two cases do the normal part: enter a new `header'
3182 ;; in the `dependencies' table.
3183 ((not (boundp id-dep))
3184 (set id-dep (list header)))
3185 ((null (car (symbol-value id-dep)))
3186 (setcar (symbol-value id-dep) header))
3188 ;; From here the `header' was already present in the
3189 ;; `dependencies' table.
3191 ;; Overrides an existing entry;
3192 ;; just set the header part of the entry.
3193 (setcar (symbol-value id-dep) header))
3195 ;; Renames the existing `header' to a unique Message-ID.
3196 ((not gnus-summary-ignore-duplicates)
3197 ;; An article with this Message-ID has already been seen.
3198 ;; We rename the Message-ID.
3199 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3201 (mail-header-set-id header id))
3203 ;; The last case ignores an existing entry, except it adds any
3204 ;; additional Xrefs (in case the two articles came from different
3206 ;; Also sets `header' to `nil' meaning that the `dependencies'
3207 ;; table was *not* modified.
3209 (mail-header-set-xref
3210 (car (symbol-value id-dep))
3211 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3213 (or (mail-header-xref header) "")))
3217 ;; First check if that we are not creating a References loop.
3218 (setq ref (gnus-parent-id (mail-header-references header)))
3220 (setq ref-dep (intern-soft ref dependencies))
3222 (setq ref-header (car (symbol-value ref-dep))))
3223 (if (string= id ref)
3224 ;; Yuk! This is a reference loop. Make the article be a
3227 (mail-header-set-references (car (symbol-value id-dep)) "none")
3229 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3230 (setq ref (gnus-parent-id (mail-header-references header)))
3231 (setq ref-dep (intern (or ref "none") dependencies))
3232 (if (boundp ref-dep)
3233 (setcdr (symbol-value ref-dep)
3234 (nconc (cdr (symbol-value ref-dep))
3235 (list (symbol-value id-dep))))
3236 (set ref-dep (list nil (symbol-value id-dep)))))
3239 (defun gnus-build-sparse-threads ()
3240 (let ((headers gnus-newsgroup-headers)
3241 (mail-parse-charset gnus-newsgroup-charset)
3242 (gnus-summary-ignore-duplicates t)
3243 header references generation relations
3244 subject child end new-child date)
3245 ;; First we create an alist of generations/relations, where
3246 ;; generations is how much we trust the relation, and the relation
3248 (gnus-message 7 "Making sparse threads...")
3250 (nnheader-set-temp-buffer " *gnus sparse threads*")
3251 (while (setq header (pop headers))
3252 (when (and (setq references (mail-header-references header))
3253 (not (string= references "")))
3255 (setq child (mail-header-id header)
3256 subject (mail-header-subject header)
3257 date (mail-header-date header)
3259 (while (search-backward ">" nil t)
3260 (setq end (1+ (point)))
3261 (when (search-backward "<" nil t)
3262 (setq new-child (buffer-substring (point) end))
3263 (push (list (incf generation)
3264 child (setq child new-child)
3268 (push (list (1+ generation) child nil subject) relations))
3270 (kill-buffer (current-buffer)))
3271 ;; Sort over trustworthiness.
3274 (when (gnus-dependencies-add-header
3275 (make-full-mail-header
3276 gnus-reffed-article-number
3277 (nth 3 relation) "" (or (nth 4 relation) "")
3279 (or (nth 2 relation) "") 0 0 "")
3280 gnus-newsgroup-dependencies nil)
3281 (push gnus-reffed-article-number gnus-newsgroup-limit)
3282 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3283 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3284 gnus-newsgroup-reads)
3285 (decf gnus-reffed-article-number)))
3286 (sort relations 'car-less-than-car))
3287 (gnus-message 7 "Making sparse threads...done")))
3289 (defun gnus-build-old-threads ()
3290 ;; Look at all the articles that refer back to old articles, and
3291 ;; fetch the headers for the articles that aren't there. This will
3292 ;; build complete threads - if the roots haven't been expired by the
3294 (let ((mail-parse-charset gnus-newsgroup-charset)
3298 (when (not (car (symbol-value refs)))
3299 (setq heads (cdr (symbol-value refs)))
3301 (if (memq (mail-header-number (caar heads))
3302 gnus-newsgroup-dormant)
3303 (setq heads (cdr heads))
3304 (setq id (symbol-name refs))
3305 (while (and (setq id (gnus-build-get-header id))
3306 (not (car (gnus-id-to-thread id)))))
3307 (setq heads nil)))))
3308 gnus-newsgroup-dependencies)))
3310 ;; This function has to be called with point after the article number
3311 ;; on the beginning of the line.
3312 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3313 (let ((eol (gnus-point-at-eol))
3314 (buffer (current-buffer))
3317 ;; overview: [num subject from date id refs chars lines misc]
3320 (narrow-to-region (point) eol)
3325 (make-full-mail-header
3327 (funcall gnus-decode-encoded-word-function
3328 (nnheader-nov-field)) ; subject
3329 (funcall gnus-decode-encoded-word-function
3330 (nnheader-nov-field)) ; from
3331 (nnheader-nov-field) ; date
3332 (nnheader-nov-read-message-id) ; id
3333 (nnheader-nov-field) ; refs
3334 (nnheader-nov-read-integer) ; chars
3335 (nnheader-nov-read-integer) ; lines
3337 (if (looking-at "Xref: ")
3338 (goto-char (match-end 0)))
3339 (nnheader-nov-field)) ; Xref
3340 (nnheader-nov-parse-extra)))) ; extra
3344 (when gnus-alter-header-function
3345 (funcall gnus-alter-header-function header))
3346 (gnus-dependencies-add-header header dependencies force-new)))
3348 (defun gnus-build-get-header (id)
3349 "Look through the buffer of NOV lines and find the header to ID.
3350 Enter this line into the dependencies hash table, and return
3351 the id of the parent article (if any)."
3352 (let ((deps gnus-newsgroup-dependencies)
3356 (set-buffer nntp-server-buffer)
3357 (let ((case-fold-search nil))
3358 (goto-char (point-min))
3359 (while (and (not found)
3360 (search-forward id nil t))
3362 (setq found (looking-at
3363 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3364 (regexp-quote id))))
3365 (or found (beginning-of-line 2)))
3369 (setq header (gnus-nov-parse-line
3370 (read (current-buffer)) deps))
3371 (gnus-parent-id (mail-header-references header))))))
3373 (let ((number (mail-header-number header)))
3374 (push number gnus-newsgroup-limit)
3375 (push header gnus-newsgroup-headers)
3376 (if (memq number gnus-newsgroup-unselected)
3378 (push number gnus-newsgroup-unreads)
3379 (setq gnus-newsgroup-unselected
3380 (delq number gnus-newsgroup-unselected)))
3381 (push number gnus-newsgroup-ancient)))))))
3383 (defun gnus-build-all-threads ()
3384 "Read all the headers."
3385 (let ((gnus-summary-ignore-duplicates t)
3386 (mail-parse-charset gnus-newsgroup-charset)
3387 (dependencies gnus-newsgroup-dependencies)
3390 (set-buffer nntp-server-buffer)
3391 (let ((case-fold-search nil))
3392 (goto-char (point-min))
3395 (setq article (read (current-buffer))
3396 header (gnus-nov-parse-line article dependencies)))
3399 (set-buffer gnus-summary-buffer)
3400 (push header gnus-newsgroup-headers)
3401 (if (memq (setq article (mail-header-number header))
3402 gnus-newsgroup-unselected)
3404 (push article gnus-newsgroup-unreads)
3405 (setq gnus-newsgroup-unselected
3406 (delq article gnus-newsgroup-unselected)))
3407 (push article gnus-newsgroup-ancient)))
3408 (forward-line 1)))))))
3410 (defun gnus-summary-update-article-line (article header)
3411 "Update the line for ARTICLE using HEADERS."
3412 (let* ((id (mail-header-id header))
3413 (thread (gnus-id-to-thread id)))
3415 (error "Article in no thread"))
3416 ;; Update the thread.
3417 (setcar thread header)
3418 (gnus-summary-goto-subject article)
3419 (let* ((datal (gnus-data-find-list article))
3421 (length (when (cdr datal)
3422 (- (gnus-data-pos data)
3423 (gnus-data-pos (cadr datal)))))
3424 (buffer-read-only nil)
3425 (level (gnus-summary-thread-level)))
3427 (gnus-summary-insert-line
3428 header level nil (gnus-article-mark article)
3429 (memq article gnus-newsgroup-replied)
3430 (memq article gnus-newsgroup-expirable)
3431 ;; Only insert the Subject string when it's different
3432 ;; from the previous Subject string.
3437 (mail-header-subject
3440 (gnus-data-find-list
3442 (gnus-data-list t)))))
3443 ;; Error on the side of excessive subjects.
3445 (mail-header-subject header)))
3447 (mail-header-subject header))
3448 nil (cdr (assq article gnus-newsgroup-scored))
3449 (memq article gnus-newsgroup-processable))
3451 (gnus-data-update-list
3452 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3454 (defun gnus-summary-update-article (article &optional iheader)
3455 "Update ARTICLE in the summary buffer."
3456 (set-buffer gnus-summary-buffer)
3457 (let* ((header (gnus-summary-article-header article))
3458 (id (mail-header-id header))
3459 (data (gnus-data-find article))
3460 (thread (gnus-id-to-thread id))
3461 (references (mail-header-references header))
3465 (when (and references
3466 (not (equal "" references)))
3469 (buffer-read-only nil)
3475 (delq thread parent)))
3476 (if (gnus-summary-insert-subject id header)
3477 ;; Set the (possibly) new article number in the data structure.
3478 (gnus-data-set-number data (gnus-id-to-article id))
3482 (defun gnus-rebuild-thread (id &optional line)
3483 "Rebuild the thread containing ID.
3484 If LINE, insert the rebuilt thread starting on line LINE."
3485 (let ((buffer-read-only nil)
3486 old-pos current thread data)
3487 (if (not gnus-show-threads)
3488 (setq thread (list (car (gnus-id-to-thread id))))
3489 ;; Get the thread this article is part of.
3490 (setq thread (gnus-remove-thread id)))
3491 (setq old-pos (gnus-point-at-bol))
3492 (setq current (save-excursion
3493 (and (zerop (forward-line -1))
3494 (gnus-summary-article-number))))
3495 ;; If this is a gathered thread, we have to go some re-gathering.
3496 (when (stringp (car thread))
3497 (let ((subject (car thread))
3499 (setq thread (cdr thread))
3501 (unless (memq (setq thr (gnus-id-to-thread
3503 (mail-header-id (caar thread)))))
3506 (setq thread (cdr thread)))
3507 ;; We now have all (unique) roots.
3508 (if (= (length roots) 1)
3509 ;; All the loose roots are now one solid root.
3510 (setq thread (car roots))
3511 (setq thread (cons subject (gnus-sort-threads roots))))))
3513 ;; We then insert this thread into the summary buffer.
3515 (goto-char (point-min))
3516 (forward-line (1- line)))
3517 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3518 (if gnus-show-threads
3519 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3520 (gnus-summary-prepare-unthreaded thread))
3521 (setq data (nreverse gnus-newsgroup-data))
3522 (setq threads gnus-newsgroup-threads))
3523 ;; We splice the new data into the data structure.
3524 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3525 ;;!!! then we want to insert at the beginning of the buffer.
3526 ;;!!! That happens to be true with Gnus now, but that may
3527 ;;!!! change in the future. Perhaps.
3528 (gnus-data-enter-list
3529 (if line nil current) data (- (point) old-pos))
3530 (setq gnus-newsgroup-threads
3531 (nconc threads gnus-newsgroup-threads))
3532 (gnus-data-compute-positions))))
3534 (defun gnus-number-to-header (number)
3535 "Return the header for article NUMBER."
3536 (let ((headers gnus-newsgroup-headers))
3538 (not (= number (mail-header-number (car headers)))))
3543 (defun gnus-parent-headers (in-headers &optional generation)
3544 "Return the headers of the GENERATIONeth parent of HEADERS."
3546 (setq generation 1))
3548 (headers in-headers)
3551 (not (zerop generation))
3552 (setq references (mail-header-references headers)))
3553 (setq headers (if (and references
3554 (setq parent (gnus-parent-id references)))
3555 (car (gnus-id-to-thread parent))
3558 (and (not (eq headers in-headers))
3561 (defun gnus-id-to-thread (id)
3562 "Return the (sub-)thread where ID appears."
3563 (gnus-gethash id gnus-newsgroup-dependencies))
3565 (defun gnus-id-to-article (id)
3566 "Return the article number of ID."
3567 (let ((thread (gnus-id-to-thread id)))
3570 (mail-header-number (car thread)))))
3572 (defun gnus-id-to-header (id)
3573 "Return the article headers of ID."
3574 (car (gnus-id-to-thread id)))
3576 (defun gnus-article-displayed-root-p (article)
3577 "Say whether ARTICLE is a root(ish) article."
3578 (let ((level (gnus-summary-thread-level article))
3579 (refs (mail-header-references (gnus-summary-article-header article)))
3585 ((null (gnus-parent-id refs)) t)
3587 (null (setq particle (gnus-id-to-article
3588 (gnus-parent-id refs))))
3589 (null (gnus-summary-thread-level particle)))))))
3591 (defun gnus-root-id (id)
3592 "Return the id of the root of the thread where ID appears."
3594 (while (and id (setq prev (car (gnus-id-to-thread id))))
3596 id (gnus-parent-id (mail-header-references prev))))
3599 (defun gnus-articles-in-thread (thread)
3600 "Return the list of articles in THREAD."
3601 (cons (mail-header-number (car thread))
3602 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3604 (defun gnus-remove-thread (id &optional dont-remove)
3605 "Remove the thread that has ID in it."
3606 (let (headers thread last-id)
3607 ;; First go up in this thread until we find the root.
3608 (setq last-id (gnus-root-id id)
3609 headers (message-flatten-list (gnus-id-to-thread last-id)))
3610 ;; We have now found the real root of this thread. It might have
3611 ;; been gathered into some loose thread, so we have to search
3612 ;; through the threads to find the thread we wanted.
3613 (let ((threads gnus-newsgroup-threads)
3616 (setq sub (car threads))
3617 (if (stringp (car sub))
3618 ;; This is a gathered thread, so we look at the roots
3619 ;; below it to find whether this article is in this
3622 (setq sub (cdr sub))
3624 (when (member (caar sub) headers)
3625 (setq thread (car threads)
3628 (setq sub (cdr sub))))
3629 ;; It's an ordinary thread, so we check it.
3630 (when (eq (car sub) (car headers))
3633 (setq threads (cdr threads)))
3634 ;; If this article is in no thread, then it's a root.
3637 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3638 (setq thread (gnus-id-to-thread last-id)))
3641 thread ; We return this thread.
3643 (if (stringp (car thread))
3645 ;; If we use dummy roots, then we have to remove the
3646 ;; dummy root as well.
3647 (when (eq gnus-summary-make-false-root 'dummy)
3648 ;; We go to the dummy root by going to
3649 ;; the first sub-"thread", and then one line up.
3650 (gnus-summary-goto-article
3651 (mail-header-number (caadr thread)))
3654 (gnus-data-compute-positions))
3655 (setq thread (cdr thread))
3657 (gnus-remove-thread-1 (car thread))
3658 (setq thread (cdr thread))))
3659 (gnus-remove-thread-1 thread))))))))
3661 (defun gnus-remove-thread-1 (thread)
3662 "Remove the thread THREAD recursively."
3663 (let ((number (mail-header-number (pop thread)))
3665 (setq thread (reverse thread))
3667 (gnus-remove-thread-1 (pop thread)))
3668 (when (setq d (gnus-data-find number))
3669 (goto-char (gnus-data-pos d))
3670 (gnus-summary-show-thread)
3673 (- (gnus-point-at-bol)
3675 (1+ (gnus-point-at-eol))
3676 (gnus-delete-line)))))))
3678 (defun gnus-sort-threads-1 (threads func)
3679 (sort (mapcar (lambda (thread)
3682 (gnus-sort-threads-1 (cdr thread) func))))
3685 (defun gnus-sort-threads (threads)
3687 (if (not gnus-thread-sort-functions)
3689 (gnus-message 8 "Sorting threads...")
3691 (gnus-sort-threads-1
3693 (gnus-make-sort-function gnus-thread-sort-functions))
3694 (gnus-message 8 "Sorting threads...done"))))
3696 (defun gnus-sort-articles (articles)
3698 (when gnus-article-sort-functions
3699 (gnus-message 7 "Sorting articles...")
3701 (setq gnus-newsgroup-headers
3702 (sort articles (gnus-make-sort-function
3703 gnus-article-sort-functions)))
3704 (gnus-message 7 "Sorting articles...done"))))
3706 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3707 (defmacro gnus-thread-header (thread)
3708 "Return header of first article in THREAD.
3709 Note that THREAD must never, ever be anything else than a variable -
3710 using some other form will lead to serious barfage."
3711 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3712 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3713 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3716 (defsubst gnus-article-sort-by-number (h1 h2)
3717 "Sort articles by article number."
3718 (< (mail-header-number h1)
3719 (mail-header-number h2)))
3721 (defun gnus-thread-sort-by-number (h1 h2)
3722 "Sort threads by root article number."
3723 (gnus-article-sort-by-number
3724 (gnus-thread-header h1) (gnus-thread-header h2)))
3726 (defsubst gnus-article-sort-by-lines (h1 h2)
3727 "Sort articles by article Lines header."
3728 (< (mail-header-lines h1)
3729 (mail-header-lines h2)))
3731 (defun gnus-thread-sort-by-lines (h1 h2)
3732 "Sort threads by root article Lines header."
3733 (gnus-article-sort-by-lines
3734 (gnus-thread-header h1) (gnus-thread-header h2)))
3736 (defsubst gnus-article-sort-by-chars (h1 h2)
3737 "Sort articles by octet length."
3738 (< (mail-header-chars h1)
3739 (mail-header-chars h2)))
3741 (defun gnus-thread-sort-by-chars (h1 h2)
3742 "Sort threads by root article octet length."
3743 (gnus-article-sort-by-chars
3744 (gnus-thread-header h1) (gnus-thread-header h2)))
3746 (defsubst gnus-article-sort-by-author (h1 h2)
3747 "Sort articles by root author."
3749 (let ((extract (funcall
3750 gnus-extract-address-components
3751 (mail-header-from h1))))
3752 (or (car extract) (cadr extract) ""))
3753 (let ((extract (funcall
3754 gnus-extract-address-components
3755 (mail-header-from h2))))
3756 (or (car extract) (cadr extract) ""))))
3758 (defun gnus-thread-sort-by-author (h1 h2)
3759 "Sort threads by root author."
3760 (gnus-article-sort-by-author
3761 (gnus-thread-header h1) (gnus-thread-header h2)))
3763 (defsubst gnus-article-sort-by-subject (h1 h2)
3764 "Sort articles by root subject."
3766 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3767 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3769 (defun gnus-thread-sort-by-subject (h1 h2)
3770 "Sort threads by root subject."
3771 (gnus-article-sort-by-subject
3772 (gnus-thread-header h1) (gnus-thread-header h2)))
3774 (defsubst gnus-article-sort-by-date (h1 h2)
3775 "Sort articles by root article date."
3777 (gnus-date-get-time (mail-header-date h1))
3778 (gnus-date-get-time (mail-header-date h2))))
3780 (defun gnus-thread-sort-by-date (h1 h2)
3781 "Sort threads by root article date."
3782 (gnus-article-sort-by-date
3783 (gnus-thread-header h1) (gnus-thread-header h2)))
3785 (defsubst gnus-article-sort-by-score (h1 h2)
3786 "Sort articles by root article score.
3787 Unscored articles will be counted as having a score of zero."
3788 (> (or (cdr (assq (mail-header-number h1)
3789 gnus-newsgroup-scored))
3790 gnus-summary-default-score 0)
3791 (or (cdr (assq (mail-header-number h2)
3792 gnus-newsgroup-scored))
3793 gnus-summary-default-score 0)))
3795 (defun gnus-thread-sort-by-score (h1 h2)
3796 "Sort threads by root article score."
3797 (gnus-article-sort-by-score
3798 (gnus-thread-header h1) (gnus-thread-header h2)))
3800 (defun gnus-thread-sort-by-total-score (h1 h2)
3801 "Sort threads by the sum of all scores in the thread.
3802 Unscored articles will be counted as having a score of zero."
3803 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3805 (defun gnus-thread-total-score (thread)
3806 ;; This function find the total score of THREAD.
3807 (cond ((null thread)
3810 (if (stringp (car thread))
3811 (apply gnus-thread-score-function 0
3812 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3813 (gnus-thread-total-score-1 thread)))
3815 (gnus-thread-total-score-1 (list thread)))))
3817 (defun gnus-thread-total-score-1 (root)
3818 ;; This function find the total score of the thread below ROOT.
3819 (setq root (car root))
3820 (apply gnus-thread-score-function
3822 (mapcar 'gnus-thread-total-score
3823 (cdr (gnus-id-to-thread (mail-header-id root))))
3824 (when (> (mail-header-number root) 0)
3825 (list (or (cdr (assq (mail-header-number root)
3826 gnus-newsgroup-scored))
3827 gnus-summary-default-score 0))))
3828 (list gnus-summary-default-score)
3831 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3832 (defvar gnus-tmp-prev-subject nil)
3833 (defvar gnus-tmp-false-parent nil)
3834 (defvar gnus-tmp-root-expunged nil)
3835 (defvar gnus-tmp-dummy-line nil)
3837 (defvar gnus-tmp-header)
3838 (defun gnus-extra-header (type &optional header)
3839 "Return the extra header of TYPE."
3840 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3843 (defun gnus-summary-prepare-threads (threads)
3844 "Prepare summary buffer from THREADS and indentation LEVEL.
3845 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3846 or a straight list of headers."
3847 (gnus-message 7 "Generating summary...")
3849 (setq gnus-newsgroup-threads threads)
3852 (let ((gnus-tmp-level 0)
3853 (default-score (or gnus-summary-default-score 0))
3854 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3855 thread number subject stack state gnus-tmp-gathered beg-match
3856 new-roots gnus-tmp-new-adopts thread-end
3857 gnus-tmp-header gnus-tmp-unread
3858 gnus-tmp-replied gnus-tmp-subject-or-nil
3859 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3860 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3861 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3863 (setq gnus-tmp-prev-subject nil)
3865 (if (vectorp (car threads))
3866 ;; If this is a straight (sic) list of headers, then a
3867 ;; threaded summary display isn't required, so we just create
3868 ;; an unthreaded one.
3869 (gnus-summary-prepare-unthreaded threads)
3871 ;; Do the threaded display.
3873 (while (or threads stack gnus-tmp-new-adopts new-roots)
3875 (if (and (= gnus-tmp-level 0)
3878 (not gnus-tmp-false-parent)
3879 (or gnus-tmp-new-adopts new-roots))
3880 (if gnus-tmp-new-adopts
3881 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3882 thread (list (car gnus-tmp-new-adopts))
3883 gnus-tmp-header (caar thread)
3884 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3886 (setq thread (list (car new-roots))
3887 gnus-tmp-header (caar thread)
3888 new-roots (cdr new-roots))))
3891 ;; If there are some threads, we do them before the
3892 ;; threads on the stack.
3893 (setq thread threads
3894 gnus-tmp-header (caar thread))
3895 ;; There were no current threads, so we pop something off
3897 (setq state (car stack)
3898 gnus-tmp-level (car state)
3901 gnus-tmp-header (caar thread))))
3903 (setq gnus-tmp-false-parent nil)
3904 (setq gnus-tmp-root-expunged nil)
3905 (setq thread-end nil)
3907 (if (stringp gnus-tmp-header)
3908 ;; The header is a dummy root.
3910 ((eq gnus-summary-make-false-root 'adopt)
3911 ;; We let the first article adopt the rest.
3912 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3914 (setq gnus-tmp-gathered
3916 (lambda (h) (mail-header-number (car h)))
3919 (setq thread (cons (list (caar thread)
3922 (setq gnus-tmp-level -1
3923 gnus-tmp-false-parent t))
3924 ((eq gnus-summary-make-false-root 'empty)
3925 ;; We print adopted articles with empty subject fields.
3926 (setq gnus-tmp-gathered
3928 (lambda (h) (mail-header-number (car h)))
3931 (setq gnus-tmp-level -1))
3932 ((eq gnus-summary-make-false-root 'dummy)
3933 ;; We remember that we probably want to output a dummy
3935 (setq gnus-tmp-dummy-line gnus-tmp-header)
3936 (setq gnus-tmp-prev-subject gnus-tmp-header))
3938 ;; We do not make a root for the gathered
3939 ;; sub-threads at all.
3940 (setq gnus-tmp-level -1)))
3942 (setq number (mail-header-number gnus-tmp-header)
3943 subject (mail-header-subject gnus-tmp-header))
3946 ;; If the thread has changed subject, we might want to make
3947 ;; this subthread into a root.
3948 ((and (null gnus-thread-ignore-subject)
3949 (not (zerop gnus-tmp-level))
3950 gnus-tmp-prev-subject
3952 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3953 (setq new-roots (nconc new-roots (list (car thread)))
3955 gnus-tmp-header nil))
3956 ;; If the article lies outside the current limit,
3957 ;; then we do not display it.
3958 ((not (memq number gnus-newsgroup-limit))
3959 (setq gnus-tmp-gathered
3961 (lambda (h) (mail-header-number (car h)))
3964 (setq gnus-tmp-new-adopts (if (cdar thread)
3965 (append gnus-tmp-new-adopts
3967 gnus-tmp-new-adopts)
3969 gnus-tmp-header nil)
3970 (when (zerop gnus-tmp-level)
3971 (setq gnus-tmp-root-expunged t)))
3972 ;; Perhaps this article is to be marked as read?
3973 ((and gnus-summary-mark-below
3974 (< (or (cdr (assq number gnus-newsgroup-scored))
3976 gnus-summary-mark-below)
3977 ;; Don't touch sparse articles.
3978 (not (gnus-summary-article-sparse-p number))
3979 (not (gnus-summary-article-ancient-p number)))
3980 (setq gnus-newsgroup-unreads
3981 (delq number gnus-newsgroup-unreads))
3982 (if gnus-newsgroup-auto-expire
3983 (push number gnus-newsgroup-expirable)
3984 (push (cons number gnus-low-score-mark)
3985 gnus-newsgroup-reads))))
3987 (when gnus-tmp-header
3988 ;; We may have an old dummy line to output before this
3990 (when (and gnus-tmp-dummy-line
3993 (mail-header-subject gnus-tmp-header)))
3994 (gnus-summary-insert-dummy-line
3995 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3996 (setq gnus-tmp-dummy-line nil))
3998 ;; Compute the mark.
3999 (setq gnus-tmp-unread (gnus-article-mark number))
4001 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4002 gnus-tmp-header gnus-tmp-level)
4003 gnus-newsgroup-data)
4005 ;; Actually insert the line.
4007 gnus-tmp-subject-or-nil
4009 ((and gnus-thread-ignore-subject
4010 gnus-tmp-prev-subject
4011 (not (inline (gnus-subject-equal
4012 gnus-tmp-prev-subject subject))))
4014 ((zerop gnus-tmp-level)
4015 (if (and (eq gnus-summary-make-false-root 'empty)
4016 (memq number gnus-tmp-gathered)
4017 gnus-tmp-prev-subject
4018 (inline (gnus-subject-equal
4019 gnus-tmp-prev-subject subject)))
4020 gnus-summary-same-subject
4022 (t gnus-summary-same-subject)))
4023 (if (and (eq gnus-summary-make-false-root 'adopt)
4024 (= gnus-tmp-level 1)
4025 (memq number gnus-tmp-gathered))
4026 (setq gnus-tmp-opening-bracket ?\<
4027 gnus-tmp-closing-bracket ?\>)
4028 (setq gnus-tmp-opening-bracket ?\[
4029 gnus-tmp-closing-bracket ?\]))
4031 gnus-tmp-indentation
4032 (aref gnus-thread-indent-array gnus-tmp-level)
4033 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4034 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4035 gnus-summary-default-score 0)
4037 (if (or (null gnus-summary-default-score)
4038 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4039 gnus-summary-zcore-fuzz))
4041 (if (< gnus-tmp-score gnus-summary-default-score)
4042 gnus-score-below-mark gnus-score-over-mark))
4044 (cond ((memq number gnus-newsgroup-processable)
4046 ((memq number gnus-newsgroup-cached)
4048 ((memq number gnus-newsgroup-replied)
4050 ((memq number gnus-newsgroup-saved)
4052 (t gnus-unread-mark))
4053 gnus-tmp-from (mail-header-from gnus-tmp-header)
4056 ((string-match "<[^>]+> *$" gnus-tmp-from)
4057 (setq beg-match (match-beginning 0))
4058 (or (and (string-match "^\".+\"" gnus-tmp-from)
4059 (substring gnus-tmp-from 1 (1- (match-end 0))))
4060 (substring gnus-tmp-from 0 beg-match)))
4061 ((string-match "(.+)" gnus-tmp-from)
4062 (substring gnus-tmp-from
4063 (1+ (match-beginning 0)) (1- (match-end 0))))
4065 (when (string= gnus-tmp-name "")
4066 (setq gnus-tmp-name gnus-tmp-from))
4067 (unless (numberp gnus-tmp-lines)
4068 (setq gnus-tmp-lines 0))
4069 (gnus-put-text-property
4071 (progn (eval gnus-summary-line-format-spec) (point))
4072 'gnus-number number)
4075 (gnus-run-hooks 'gnus-summary-update-hook)
4078 (setq gnus-tmp-prev-subject subject)))
4080 (when (nth 1 thread)
4081 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4082 (incf gnus-tmp-level)
4083 (setq threads (if thread-end nil (cdar thread)))
4085 (setq gnus-tmp-level 0)))))
4086 (gnus-message 7 "Generating summary...done"))
4088 (defun gnus-summary-prepare-unthreaded (headers)
4089 "Generate an unthreaded summary buffer based on HEADERS."
4090 (let (header number mark)
4095 ;; We may have to root out some bad articles...
4096 (when (memq (setq number (mail-header-number
4097 (setq header (pop headers))))
4098 gnus-newsgroup-limit)
4099 ;; Mark article as read when it has a low score.
4100 (when (and gnus-summary-mark-below
4101 (< (or (cdr (assq number gnus-newsgroup-scored))
4102 gnus-summary-default-score 0)
4103 gnus-summary-mark-below)
4104 (not (gnus-summary-article-ancient-p number)))
4105 (setq gnus-newsgroup-unreads
4106 (delq number gnus-newsgroup-unreads))
4107 (if gnus-newsgroup-auto-expire
4108 (push number gnus-newsgroup-expirable)
4109 (push (cons number gnus-low-score-mark)
4110 gnus-newsgroup-reads)))
4112 (setq mark (gnus-article-mark number))
4113 (push (gnus-data-make number mark (1+ (point)) header 0)
4114 gnus-newsgroup-data)
4115 (gnus-summary-insert-line
4117 mark (memq number gnus-newsgroup-replied)
4118 (memq number gnus-newsgroup-expirable)
4119 (mail-header-subject header) nil
4120 (cdr (assq number gnus-newsgroup-scored))
4121 (memq number gnus-newsgroup-processable))))))
4123 (defun gnus-summary-remove-list-identifiers ()
4124 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4125 (let ((regexp (if (stringp gnus-list-identifiers)
4126 gnus-list-identifiers
4127 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4128 (dolist (header gnus-newsgroup-headers)
4129 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4130 " *\\)\\)+\\(Re: +\\)?\\)")
4131 (mail-header-subject header))
4132 (mail-header-set-subject
4133 header (concat (substring (mail-header-subject header)
4134 0 (match-beginning 1))
4136 (match-string 3 (mail-header-subject header))
4137 (match-string 5 (mail-header-subject header)))
4138 (substring (mail-header-subject header)
4139 (match-end 1))))))))
4141 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4142 "Select newsgroup GROUP.
4143 If READ-ALL is non-nil, all articles in the group are selected.
4144 If SELECT-ARTICLES, only select those articles from GROUP."
4145 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4146 ;;!!! Dirty hack; should be removed.
4147 (gnus-summary-ignore-duplicates
4148 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4150 gnus-summary-ignore-duplicates))
4151 (info (nth 2 entry))
4152 articles fetched-articles cached)
4154 (unless (gnus-check-server
4155 (setq gnus-current-select-method
4156 (gnus-find-method-for-group group)))
4157 (error "Couldn't open server"))
4159 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4160 (gnus-activate-group group) ; Or we can activate it...
4161 (progn ; Or we bug out.
4162 (when (equal major-mode 'gnus-summary-mode)
4163 (kill-buffer (current-buffer)))
4164 (error "Couldn't request group %s: %s"
4165 group (gnus-status-message group))))
4167 (unless (gnus-request-group group t)
4168 (when (equal major-mode 'gnus-summary-mode)
4169 (kill-buffer (current-buffer)))
4170 (error "Couldn't request group %s: %s"
4171 group (gnus-status-message group)))
4173 (setq gnus-newsgroup-name group)
4174 (setq gnus-newsgroup-unselected nil)
4175 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4176 (gnus-summary-setup-default-charset)
4178 ;; Adjust and set lists of article marks.
4180 (gnus-adjust-marked-articles info))
4182 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4183 (when (gnus-virtual-group-p group)
4184 (setq cached gnus-newsgroup-cached))
4186 (setq gnus-newsgroup-unreads
4187 (gnus-set-difference
4188 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4189 gnus-newsgroup-dormant))
4191 (setq gnus-newsgroup-processable nil)
4193 (gnus-update-read-articles group gnus-newsgroup-unreads)
4195 (if (setq articles select-articles)
4196 (setq gnus-newsgroup-unselected
4197 (gnus-sorted-intersection
4198 gnus-newsgroup-unreads
4199 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4200 (setq articles (gnus-articles-to-read group read-all)))
4204 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4206 ((eq articles 0) nil)
4208 ;; Init the dependencies hash table.
4209 (setq gnus-newsgroup-dependencies
4210 (gnus-make-hashtable (length articles)))
4211 (gnus-set-global-variables)
4212 ;; Retrieve the headers and read them in.
4213 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4214 (setq gnus-newsgroup-headers
4216 (setq gnus-headers-retrieved-by
4217 (gnus-retrieve-headers
4218 articles gnus-newsgroup-name
4219 ;; We might want to fetch old headers, but
4220 ;; not if there is only 1 article.
4222 (not (eq gnus-fetch-old-headers 'some))
4223 (not (numberp gnus-fetch-old-headers)))
4224 (> (length articles) 1))
4225 gnus-fetch-old-headers))))
4226 (gnus-get-newsgroup-headers-xover
4227 articles nil nil gnus-newsgroup-name t)
4228 (gnus-get-newsgroup-headers)))
4229 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4231 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4233 (setq gnus-newsgroup-cached cached))
4235 ;; Suppress duplicates?
4236 (when gnus-suppress-duplicates
4237 (gnus-dup-suppress-articles))
4239 ;; Set the initial limit.
4240 (setq gnus-newsgroup-limit (copy-sequence articles))
4241 ;; Remove canceled articles from the list of unread articles.
4242 (setq gnus-newsgroup-unreads
4243 (gnus-set-sorted-intersection
4244 gnus-newsgroup-unreads
4245 (setq fetched-articles
4246 (mapcar (lambda (headers) (mail-header-number headers))
4247 gnus-newsgroup-headers))))
4248 ;; Removed marked articles that do not exist.
4249 (gnus-update-missing-marks
4250 (gnus-sorted-complement fetched-articles articles))
4251 ;; We might want to build some more threads first.
4252 (when (and gnus-fetch-old-headers
4253 (eq gnus-headers-retrieved-by 'nov))
4254 (if (eq gnus-fetch-old-headers 'invisible)
4255 (gnus-build-all-threads)
4256 (gnus-build-old-threads)))
4257 ;; Let the Gnus agent mark articles as read.
4259 (gnus-agent-get-undownloaded-list))
4260 ;; Remove list identifiers from subject
4261 (when gnus-list-identifiers
4262 (gnus-summary-remove-list-identifiers))
4263 ;; Check whether auto-expire is to be done in this group.
4264 (setq gnus-newsgroup-auto-expire
4265 (gnus-group-auto-expirable-p group))
4266 ;; Set up the article buffer now, if necessary.
4267 (unless gnus-single-article-buffer
4268 (gnus-article-setup-buffer))
4269 ;; First and last article in this newsgroup.
4270 (when gnus-newsgroup-headers
4271 (setq gnus-newsgroup-begin
4272 (mail-header-number (car gnus-newsgroup-headers))
4275 (gnus-last-element gnus-newsgroup-headers))))
4276 ;; GROUP is successfully selected.
4277 (or gnus-newsgroup-headers t)))))
4279 (defun gnus-articles-to-read (group &optional read-all)
4280 "Find out what articles the user wants to read."
4282 ;; Select all articles if `read-all' is non-nil, or if there
4283 ;; are no unread articles.
4285 (and (zerop (length gnus-newsgroup-marked))
4286 (zerop (length gnus-newsgroup-unreads)))
4287 (eq (gnus-group-find-parameter group 'display)
4290 (gnus-uncompress-range (gnus-active group))
4291 (gnus-cache-articles-in-group group))
4292 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4293 (copy-sequence gnus-newsgroup-unreads))
4295 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4296 (scored (length scored-list))
4297 (number (length articles))
4298 (marked (+ (length gnus-newsgroup-marked)
4299 (length gnus-newsgroup-dormant)))
4307 ((and (or (<= scored marked) (= scored number))
4308 (numberp gnus-large-newsgroup)
4309 (> number gnus-large-newsgroup))
4313 "How many articles from %s (default %d): "
4314 (gnus-limit-string gnus-newsgroup-name 35)
4316 (if (string-match "^[ \t]*$" input) number input)))
4317 ((and (> scored marked) (< scored number)
4318 (> (- scored number) 20))
4321 (format "%s %s (%d scored, %d total): "
4322 "How many articles from"
4323 group scored number))))
4324 (if (string-match "^[ \t]*$" input)
4328 (message "Quit getting the articles to read")
4330 (setq select (if (stringp select) (string-to-number select) select))
4331 (if (or (null select) (zerop select))
4333 (if (and (not (zerop scored)) (<= (abs select) scored))
4335 (setq articles (sort scored-list '<))
4336 (setq number (length articles)))
4337 (setq articles (copy-sequence articles)))
4339 (when (< (abs select) number)
4341 ;; Select the N oldest articles.
4342 (setcdr (nthcdr (1- (abs select)) articles) nil)
4343 ;; Select the N most recent articles.
4344 (setq articles (nthcdr (- number select) articles))))
4345 (setq gnus-newsgroup-unselected
4346 (gnus-sorted-intersection
4347 gnus-newsgroup-unreads
4348 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4349 (when gnus-alter-articles-to-read-function
4350 (setq gnus-newsgroup-unreads
4352 (funcall gnus-alter-articles-to-read-function
4353 gnus-newsgroup-name gnus-newsgroup-unreads)
4357 (defun gnus-killed-articles (killed articles)
4360 (when (inline (gnus-member-of-range (car articles) killed))
4361 (push (car articles) out))
4362 (setq articles (cdr articles)))
4365 (defun gnus-uncompress-marks (marks)
4366 "Uncompress the mark ranges in MARKS."
4367 (let ((uncompressed '(score bookmark))
4370 (if (memq (caar marks) uncompressed)
4371 (push (car marks) out)
4372 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4373 (setq marks (cdr marks)))
4376 (defun gnus-adjust-marked-articles (info)
4377 "Set all article lists and remove all marks that are no longer valid."
4378 (let* ((marked-lists (gnus-info-marks info))
4379 (active (gnus-active (gnus-info-group info)))
4382 (types gnus-article-mark-lists)
4383 (uncompressed '(score bookmark killed))
4384 marks var articles article mark)
4387 (setq marks (pop marked-lists))
4388 (set (setq var (intern (format "gnus-newsgroup-%s"
4389 (car (rassq (setq mark (car marks))
4391 (if (memq (car marks) uncompressed) (cdr marks)
4392 (gnus-uncompress-range (cdr marks))))
4394 (setq articles (symbol-value var))
4396 ;; All articles have to be subsets of the active articles.
4398 ;; Adjust "simple" lists.
4399 ((memq mark '(tick dormant expire reply save))
4401 (when (or (< (setq article (pop articles)) min) (> article max))
4402 (set var (delq article (symbol-value var))))))
4404 ((memq mark uncompressed)
4405 (when (not (listp (cdr (symbol-value var))))
4406 (set var (list (symbol-value var))))
4407 (when (not (listp (cdr articles)))
4408 (setq articles (list articles)))
4410 (when (or (not (consp (setq article (pop articles))))
4411 (< (car article) min)
4412 (> (car article) max))
4413 (set var (delq article (symbol-value var))))))))))
4415 (defun gnus-update-missing-marks (missing)
4416 "Go through the list of MISSING articles and remove them from the mark lists."
4418 (let ((types gnus-article-mark-lists)
4420 ;; Go through all types.
4422 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4423 (when (symbol-value var)
4424 ;; This list has articles. So we delete all missing articles
4428 (set var (delq (pop m) (symbol-value var)))))))))
4430 (defun gnus-update-marks ()
4431 "Enter the various lists of marked articles into the newsgroup info list."
4432 (let ((types gnus-article-mark-lists)
4433 (info (gnus-get-info gnus-newsgroup-name))
4434 (uncompressed '(score bookmark killed))
4435 type list newmarked symbol delta-marks)
4437 ;; Add all marks lists to the list of marks lists.
4438 (while (setq type (pop types))
4439 (setq list (symbol-value
4441 (intern (format "gnus-newsgroup-%s"
4445 ;; Get rid of the entries of the articles that have the
4447 (when (and (eq (cdr type) 'score)
4451 (prev (cons nil list))
4454 (if (or (not (consp (car arts)))
4455 (= (cdar arts) gnus-summary-default-score))
4456 (setcdr prev (cdr arts))
4458 (setq arts (cdr arts)))
4459 (setq list (cdr all)))))
4461 (unless (memq (cdr type) uncompressed)
4462 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
4464 (when (gnus-check-backend-function
4465 'request-set-mark gnus-newsgroup-name)
4466 ;; propagate flags to server, with the following exceptions:
4467 ;; uncompressed:s are not proper flags (they are cons cells)
4468 ;; cache is a internal gnus flag
4469 ;; download are local to one gnus installation (well)
4470 ;; unsend are for nndraft groups only
4471 ;; xxx: generality of this? this suits nnimap anyway
4472 (unless (memq (cdr type) (append '(cache download unsend)
4474 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4475 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
4476 (add (gnus-remove-from-range
4477 (gnus-copy-sequence list) old)))
4479 (push (list add 'add (list (cdr type))) delta-marks))
4481 (push (list del 'del (list (cdr type))) delta-marks)))))
4484 (push (cons (cdr type) list) newmarked)))
4487 (unless (gnus-check-group gnus-newsgroup-name)
4488 (error "Can't open server for %s" gnus-newsgroup-name))
4489 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4491 ;; Enter these new marks into the info of the group.
4493 (setcar (nthcdr 3 info) newmarked)
4494 ;; Add the marks lists to the end of the info.
4496 (setcdr (nthcdr 2 info) (list newmarked))))
4498 ;; Cut off the end of the info if there's nothing else there.
4502 (when (nthcdr (decf i) info)
4503 (setcdr (nthcdr i info) nil)))))))
4505 (defun gnus-set-mode-line (where)
4506 "Set the mode line of the article or summary buffers.
4507 If WHERE is `summary', the summary mode line format will be used."
4508 ;; Is this mode line one we keep updated?
4509 (when (and (memq where gnus-updated-mode-lines)
4511 (intern (format "gnus-%s-mode-line-format-spec" where))))
4514 ;; We evaluate this in the summary buffer since these
4515 ;; variables are buffer-local to that buffer.
4516 (set-buffer gnus-summary-buffer)
4517 ;; We bind all these variables that are used in the `eval' form
4519 (let* ((mformat (symbol-value
4521 (format "gnus-%s-mode-line-format-spec" where))))
4522 (gnus-tmp-group-name (gnus-group-name-decode
4524 (gnus-group-name-charset
4526 gnus-newsgroup-name)))
4527 (gnus-tmp-article-number (or gnus-current-article 0))
4528 (gnus-tmp-unread gnus-newsgroup-unreads)
4529 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4530 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4531 (gnus-tmp-unread-and-unselected
4532 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4533 (zerop gnus-tmp-unselected))
4535 ((zerop gnus-tmp-unselected)
4536 (format "{%d more}" gnus-tmp-unread-and-unticked))
4537 (t (format "{%d(+%d) more}"
4538 gnus-tmp-unread-and-unticked
4539 gnus-tmp-unselected))))
4541 (if (and gnus-current-headers
4542 (vectorp gnus-current-headers))
4543 (gnus-mode-string-quote
4544 (mail-header-subject gnus-current-headers))
4546 bufname-length max-len
4547 gnus-tmp-header);; passed as argument to any user-format-funcs
4548 (setq mode-string (eval mformat))
4549 (setq bufname-length (if (string-match "%b" mode-string)
4552 (if (eq where 'summary)
4554 (get-buffer gnus-article-buffer))))
4557 (setq max-len (max 4 (if gnus-mode-non-string-length
4559 gnus-mode-non-string-length
4561 (length mode-string))))
4562 ;; We might have to chop a bit of the string off...
4563 (when (> (length mode-string) max-len)
4565 (concat (truncate-string-to-width mode-string (- max-len 3))
4567 ;; Pad the mode string a bit.
4568 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4569 ;; Update the mode line.
4570 (setq mode-line-buffer-identification
4571 (gnus-mode-line-buffer-identification (list mode-string)))
4572 (set-buffer-modified-p t))))
4574 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4575 "Go through the HEADERS list and add all Xrefs to a hash table.
4576 The resulting hash table is returned, or nil if no Xrefs were found."
4577 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4578 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4579 (xref-hashtb (gnus-make-hashtable))
4580 start group entry number xrefs header)
4582 (setq header (pop headers))
4583 (when (and (setq xrefs (mail-header-xref header))
4584 (not (memq (setq number (mail-header-number header))
4587 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4588 (setq start (match-end 0))
4589 (setq group (if prefix
4590 (concat prefix (substring xrefs (match-beginning 1)
4592 (substring xrefs (match-beginning 1) (match-end 1))))
4594 (string-to-int (substring xrefs (match-beginning 2)
4596 (if (setq entry (gnus-gethash group xref-hashtb))
4597 (setcdr entry (cons number (cdr entry)))
4598 (gnus-sethash group (cons number nil) xref-hashtb)))))
4599 (and start xref-hashtb)))
4601 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4602 "Look through all the headers and mark the Xrefs as read."
4603 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4604 name entry info xref-hashtb idlist method nth4)
4606 (set-buffer gnus-group-buffer)
4607 (when (setq xref-hashtb
4608 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4611 (unless (string= from-newsgroup (setq name (symbol-name group)))
4612 (setq idlist (symbol-value group))
4613 ;; Dead groups are not updated.
4615 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4617 (when (stringp (setq nth4 (gnus-info-method info)))
4618 (setq nth4 (gnus-server-to-method nth4))))
4619 ;; Only do the xrefs if the group has the same
4620 ;; select method as the group we have just read.
4621 (or (gnus-methods-equal-p
4622 nth4 (gnus-find-method-for-group from-newsgroup))
4624 (equal nth4 (setq method (gnus-find-method-for-group
4626 (and (equal (car nth4) (car method))
4627 (equal (nth 1 nth4) (nth 1 method))))
4628 gnus-use-cross-reference
4629 (or (not (eq gnus-use-cross-reference t))
4631 ;; Only do cross-references on subscribed
4632 ;; groups, if that is what is wanted.
4633 (<= (gnus-info-level info) gnus-level-subscribed))
4634 (gnus-group-make-articles-read name idlist))))
4637 (defun gnus-compute-read-articles (group articles)
4638 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4639 (info (nth 2 entry))
4640 (active (gnus-active group))
4643 ;; First peel off all invalid article numbers.
4645 (let ((ids articles)
4647 (while (setq id (pop ids))
4648 (when (and first (> id (cdr active)))
4649 ;; We'll end up in this situation in one particular
4650 ;; obscure situation. If you re-scan a group and get
4651 ;; a new article that is cross-posted to a different
4652 ;; group that has not been re-scanned, you might get
4653 ;; crossposted article that has a higher number than
4654 ;; Gnus believes possible. So we re-activate this
4655 ;; group as well. This might mean doing the
4656 ;; crossposting thingy will *increase* the number
4657 ;; of articles in some groups. Tsk, tsk.
4658 (setq active (or (gnus-activate-group group) active)))
4659 (when (or (> id (cdr active))
4660 (< id (car active)))
4661 (setq articles (delq id articles))))))
4662 ;; If the read list is nil, we init it.
4664 (null (gnus-info-read info))
4666 (setq ninfo (cons 1 (1- (car active))))
4667 (setq ninfo (gnus-info-read info)))
4668 ;; Then we add the read articles to the range.
4670 ninfo (setq articles (sort articles '<))))))
4672 (defun gnus-group-make-articles-read (group articles)
4673 "Update the info of GROUP to say that ARTICLES are read."
4675 (entry (gnus-gethash group gnus-newsrc-hashtb))
4676 (info (nth 2 entry))
4677 (active (gnus-active group))
4680 (setq range (gnus-compute-read-articles group articles))
4682 (set-buffer gnus-group-buffer)
4685 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4686 (gnus-info-set-read ',info ',(gnus-info-read info))
4687 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4688 (gnus-group-update-group ,group t))))
4689 ;; Add the read articles to the range.
4690 (gnus-info-set-read info range)
4691 ;; Then we have to re-compute how many unread
4692 ;; articles there are in this group.
4696 (setq num (- (1+ (cdr active)) (car active))))
4697 ((not (listp (cdr range)))
4698 (setq num (- (cdr active) (- (1+ (cdr range))
4702 (if (numberp (car range))
4704 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4705 (setq range (cdr range)))
4706 (setq num (- (cdr active) num))))
4707 ;; Update the number of unread articles.
4709 ;; Update the group buffer.
4710 (gnus-group-update-group group t)))))
4712 (defvar gnus-newsgroup-none-id 0)
4714 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4715 (let ((cur nntp-server-buffer)
4718 (save-excursion (set-buffer gnus-summary-buffer)
4719 gnus-newsgroup-dependencies)))
4721 (mail-parse-charset gnus-newsgroup-charset)
4722 (mail-parse-ignored-charsets
4723 (save-excursion (condition-case nil
4724 (set-buffer gnus-summary-buffer)
4726 gnus-newsgroup-ignored-charsets)))
4728 (set-buffer nntp-server-buffer)
4729 ;; Translate all TAB characters into SPACE characters.
4730 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4731 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4732 (gnus-run-hooks 'gnus-parse-headers-hook)
4733 (let ((case-fold-search t)
4734 in-reply-to header p lines chars)
4735 (goto-char (point-min))
4736 ;; Search to the beginning of the next header. Error messages
4737 ;; do not begin with 2 or 3.
4738 (while (re-search-forward "^[23][0-9]+ " nil t)
4741 ;; This implementation of this function, with nine
4742 ;; search-forwards instead of the one re-search-forward and
4743 ;; a case (which basically was the old function) is actually
4744 ;; about twice as fast, even though it looks messier. You
4745 ;; can't have everything, I guess. Speed and elegance
4746 ;; doesn't always go hand in hand.
4755 (narrow-to-region (point)
4756 (or (and (search-forward "\n.\n" nil t)
4762 (if (search-forward "\nsubject: " nil t)
4763 (funcall gnus-decode-encoded-word-function
4764 (nnheader-header-value))
4769 (if (or (search-forward "\nfrom: " nil t)
4770 (search-forward "\nfrom:" nil t))
4771 (funcall gnus-decode-encoded-word-function
4772 (nnheader-header-value))
4777 (if (search-forward "\ndate: " nil t)
4778 (nnheader-header-value) ""))
4782 (setq id (if (re-search-forward
4783 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4784 ;; We do it this way to make sure the Message-ID
4785 ;; is (somewhat) syntactically valid.
4786 (buffer-substring (match-beginning 1)
4788 ;; If there was no message-id, we just fake one
4789 ;; to make subsequent routines simpler.
4790 (nnheader-generate-fake-message-id))))
4794 (if (search-forward "\nreferences: " nil t)
4798 (nnheader-header-value)
4803 (search-backward ">" end t)
4806 (search-backward "<" end t)
4808 ;; Get the references from the in-reply-to header if there
4809 ;; were no references and the in-reply-to header looks
4811 (if (and (search-forward "\nin-reply-to: " nil t)
4812 (setq in-reply-to (nnheader-header-value))
4813 (string-match "<[^>]+>" in-reply-to))
4815 (setq ref (substring in-reply-to (match-beginning 0)
4817 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4818 (setq ref2 (substring in-reply-to (match-beginning 0)
4820 (when (> (length ref2) (length ref))
4827 (if (search-forward "\nchars: " nil t)
4828 (if (numberp (setq chars (ignore-errors (read cur))))
4834 (if (search-forward "\nlines: " nil t)
4835 (if (numberp (setq lines (ignore-errors (read cur))))
4841 (and (search-forward "\nxref: " nil t)
4842 (nnheader-header-value)))
4844 (when gnus-extra-headers
4845 (let ((extra gnus-extra-headers)
4849 (when (search-forward
4850 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4851 (push (cons (car extra) (nnheader-header-value))
4855 (when (equal id ref)
4858 (when gnus-alter-header-function
4859 (funcall gnus-alter-header-function header)
4860 (setq id (mail-header-id header)
4861 ref (gnus-parent-id (mail-header-references header))))
4864 (gnus-dependencies-add-header
4865 header dependencies force-new))
4866 (push header headers))
4867 (goto-char (point-max))
4869 (nreverse headers)))))
4871 ;; Goes through the xover lines and returns a list of vectors
4872 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4873 force-new dependencies
4874 group also-fetch-heads)
4875 "Parse the news overview data in the server buffer.
4876 Return a list of headers that match SEQUENCE (see
4877 `nntp-retrieve-headers')."
4878 ;; Get the Xref when the users reads the articles since most/some
4879 ;; NNTP servers do not include Xrefs when using XOVER.
4880 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4881 (let ((mail-parse-charset gnus-newsgroup-charset)
4882 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
4883 (cur nntp-server-buffer)
4884 (dependencies (or dependencies gnus-newsgroup-dependencies))
4885 number headers header)
4887 (set-buffer nntp-server-buffer)
4888 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4889 ;; Allow the user to mangle the headers before parsing them.
4890 (gnus-run-hooks 'gnus-parse-headers-hook)
4891 (goto-char (point-min))
4894 (while (and sequence (not (eobp)))
4895 (setq number (read cur))
4896 (while (and sequence
4897 (< (car sequence) number))
4898 (setq sequence (cdr sequence)))
4900 (eq number (car sequence))
4902 (setq sequence (cdr sequence))
4903 (setq header (inline
4904 (gnus-nov-parse-line
4905 number dependencies force-new))))
4906 (push header headers))
4909 (gnus-error 4 "Strange nov line (%d)"
4910 (count-lines (point-min) (point)))))
4912 ;; A common bug in inn is that if you have posted an article and
4913 ;; then retrieves the active file, it will answer correctly --
4914 ;; the new article is included. However, a NOV entry for the
4915 ;; article may not have been generated yet, so this may fail.
4916 ;; We work around this problem by retrieving the last few
4917 ;; headers using HEAD.
4918 (if (or (not also-fetch-heads)
4920 ;; We (probably) got all the headers.
4922 (let ((gnus-nov-is-evil t))
4925 (when (gnus-retrieve-headers sequence group)
4926 (gnus-get-newsgroup-headers))))))))
4928 (defun gnus-article-get-xrefs ()
4929 "Fill in the Xref value in `gnus-current-headers', if necessary.
4930 This is meant to be called in `gnus-article-internal-prepare-hook'."
4931 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4932 gnus-current-headers)))
4933 (or (not gnus-use-cross-reference)
4935 (and (mail-header-xref headers)
4936 (not (string= (mail-header-xref headers) "")))
4937 (let ((case-fold-search t)
4940 (nnheader-narrow-to-headers)
4941 (goto-char (point-min))
4942 (when (or (and (not (eobp))
4943 (eq (downcase (char-after)) ?x)
4944 (looking-at "Xref:"))
4945 (search-forward "\nXref:" nil t))
4946 (goto-char (1+ (match-end 0)))
4947 (setq xref (buffer-substring (point)
4948 (progn (end-of-line) (point))))
4949 (mail-header-set-xref headers xref)))))))
4951 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4952 "Find article ID and insert the summary line for that article.
4953 OLD-HEADER can either be a header or a line number to insert
4954 the subject line on."
4955 (let* ((line (and (numberp old-header) old-header))
4956 (old-header (and (vectorp old-header) old-header))
4957 (header (cond ((and old-header use-old-header)
4960 (gnus-number-to-header id))
4961 (gnus-number-to-header id))
4963 (gnus-read-header id))))
4964 (number (and (numberp id) id))
4967 ;; Rebuild the thread that this article is part of and go to the
4968 ;; article we have fetched.
4969 (when (and (not gnus-show-threads)
4972 (setq d (gnus-data-find (mail-header-number old-header))))
4973 (goto-char (gnus-data-pos d))
4976 (- (gnus-point-at-bol)
4978 (1+ (gnus-point-at-eol))
4979 (gnus-delete-line))))))
4981 (mail-header-set-number header (mail-header-number old-header)))
4982 (setq gnus-newsgroup-sparse
4983 (delq (setq number (mail-header-number header))
4984 gnus-newsgroup-sparse))
4985 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4986 (push number gnus-newsgroup-limit)
4987 (gnus-rebuild-thread (mail-header-id header) line)
4988 (gnus-summary-goto-subject number nil t))
4989 (when (and (numberp number)
4991 ;; We have to update the boundaries even if we can't fetch the
4992 ;; article if ID is a number -- so that the next `P' or `N'
4993 ;; command will fetch the previous (or next) article even
4994 ;; if the one we tried to fetch this time has been canceled.
4995 (when (> number gnus-newsgroup-end)
4996 (setq gnus-newsgroup-end number))
4997 (when (< number gnus-newsgroup-begin)
4998 (setq gnus-newsgroup-begin number))
4999 (setq gnus-newsgroup-unselected
5000 (delq number gnus-newsgroup-unselected)))
5001 ;; Report back a success?
5002 (and header (mail-header-number header))))
5004 ;;; Process/prefix in the summary buffer
5006 (defun gnus-summary-work-articles (n)
5007 "Return a list of articles to be worked upon.
5008 The prefix argument, the list of process marked articles, and the
5009 current article will be taken into consideration."
5011 (set-buffer gnus-summary-buffer)
5014 ;; A numerical prefix has been given.
5015 (setq n (prefix-numeric-value n))
5016 (let ((backward (< n 0))
5017 (n (abs (prefix-numeric-value n)))
5022 (push (setq article (gnus-summary-article-number))
5025 (gnus-summary-find-prev nil article)
5026 (gnus-summary-find-next nil article)))
5028 (nreverse articles)))
5029 ((and (gnus-region-active-p) (mark))
5030 (message "region active")
5031 ;; Work on the region between point and mark.
5032 (let ((max (max (point) (mark)))
5035 (goto-char (min (min (point) (mark))))
5038 (push (setq article (gnus-summary-article-number)) articles)
5039 (gnus-summary-find-next nil article)
5041 (nreverse articles))))
5042 (gnus-newsgroup-processable
5043 ;; There are process-marked articles present.
5044 ;; Save current state.
5045 (gnus-summary-save-process-mark)
5047 (reverse gnus-newsgroup-processable))
5049 ;; Just return the current article.
5050 (list (gnus-summary-article-number))))))
5052 (defmacro gnus-summary-iterate (arg &rest forms)
5053 "Iterate over the process/prefixed articles and do FORMS.
5054 ARG is the interactive prefix given to the command. FORMS will be
5055 executed with point over the summary line of the articles."
5056 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
5057 `(let ((,articles (gnus-summary-work-articles ,arg)))
5059 (gnus-summary-goto-subject (car ,articles))
5063 (put 'gnus-summary-iterate 'lisp-indent-function 1)
5064 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
5066 (defun gnus-summary-save-process-mark ()
5067 "Push the current set of process marked articles on the stack."
5069 (push (copy-sequence gnus-newsgroup-processable)
5070 gnus-newsgroup-process-stack))
5072 (defun gnus-summary-kill-process-mark ()
5073 "Push the current set of process marked articles on the stack and unmark."
5075 (gnus-summary-save-process-mark)
5076 (gnus-summary-unmark-all-processable))
5078 (defun gnus-summary-yank-process-mark ()
5079 "Pop the last process mark state off the stack and restore it."
5081 (unless gnus-newsgroup-process-stack
5082 (error "Empty mark stack"))
5083 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
5085 (defun gnus-summary-process-mark-set (set)
5086 "Make SET into the current process marked articles."
5087 (gnus-summary-unmark-all-processable)
5089 (gnus-summary-set-process-mark (pop set))))
5091 ;;; Searching and stuff
5093 (defun gnus-summary-search-group (&optional backward use-level)
5094 "Search for next unread newsgroup.
5095 If optional argument BACKWARD is non-nil, search backward instead."
5097 (set-buffer gnus-group-buffer)
5098 (when (gnus-group-search-forward
5099 backward nil (if use-level (gnus-group-group-level) nil))
5100 (gnus-group-group-name))))
5102 (defun gnus-summary-best-group (&optional exclude-group)
5103 "Find the name of the best unread group.
5104 If EXCLUDE-GROUP, do not go to this group."
5106 (set-buffer gnus-group-buffer)
5108 (gnus-group-best-unread-group exclude-group))))
5110 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
5111 (if backward (gnus-summary-find-prev)
5112 (let* ((dummy (gnus-summary-article-intangible-p))
5113 (article (or article (gnus-summary-article-number)))
5114 (arts (gnus-data-find-list article))
5116 (when (and (not dummy)
5117 (or (not gnus-summary-check-current)
5119 (not (gnus-data-unread-p (car arts)))))
5120 (setq arts (cdr arts)))
5125 (when (or (and undownloaded
5126 (eq gnus-undownloaded-mark
5127 (gnus-data-mark (car arts))))
5128 (gnus-data-unread-p (car arts)))
5129 (setq result (car arts)
5131 (setq arts (cdr arts)))
5134 (goto-char (gnus-data-pos result))
5135 (gnus-data-number result)))))
5137 (defun gnus-summary-find-prev (&optional unread article)
5138 (let* ((eobp (eobp))
5139 (article (or article (gnus-summary-article-number)))
5140 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
5142 (when (and (not eobp)
5143 (or (not gnus-summary-check-current)
5145 (not (gnus-data-unread-p (car arts)))))
5146 (setq arts (cdr arts)))
5151 (when (gnus-data-unread-p (car arts))
5152 (setq result (car arts)
5154 (setq arts (cdr arts)))
5157 (goto-char (gnus-data-pos result))
5158 (gnus-data-number result))))
5160 (defun gnus-summary-find-subject (subject &optional unread backward article)
5161 (let* ((simp-subject (gnus-simplify-subject-fully subject))
5162 (article (or article (gnus-summary-article-number)))
5163 (articles (gnus-data-list backward))
5164 (arts (gnus-data-find-list article articles))
5166 (when (or (not gnus-summary-check-current)
5168 (not (gnus-data-unread-p (car arts))))
5169 (setq arts (cdr arts)))
5171 (and (or (not unread)
5172 (gnus-data-unread-p (car arts)))
5173 (vectorp (gnus-data-header (car arts)))
5175 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
5176 (setq result (car arts)
5178 (setq arts (cdr arts)))
5180 (goto-char (gnus-data-pos result))
5181 (gnus-data-number result))))
5183 (defun gnus-summary-search-forward (&optional unread subject backward)
5184 "Search forward for an article.
5185 If UNREAD, look for unread articles. If SUBJECT, look for
5186 articles with that subject. If BACKWARD, search backward instead."
5187 (cond (subject (gnus-summary-find-subject subject unread backward))
5188 (backward (gnus-summary-find-prev unread))
5189 (t (gnus-summary-find-next unread))))
5191 (defun gnus-recenter (&optional n)
5192 "Center point in window and redisplay frame.
5193 Also do horizontal recentering."
5195 (when (and gnus-auto-center-summary
5196 (not (eq gnus-auto-center-summary 'vertical)))
5197 (gnus-horizontal-recenter))
5200 (defun gnus-summary-recenter ()
5201 "Center point in the summary window.
5202 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5203 displayed, no centering will be performed."
5204 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5205 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5207 (let* ((top (cond ((< (window-height) 4) 0)
5208 ((< (window-height) 7) 1)
5209 (t (if (numberp gnus-auto-center-summary)
5210 gnus-auto-center-summary
5212 (height (1- (window-height)))
5213 (bottom (save-excursion (goto-char (point-max))
5214 (forward-line (- height))
5216 (window (get-buffer-window (current-buffer))))
5217 ;; The user has to want it.
5218 (when gnus-auto-center-summary
5219 (when (get-buffer-window gnus-article-buffer)
5220 ;; Only do recentering when the article buffer is displayed,
5221 ;; Set the window start to either `bottom', which is the biggest
5222 ;; possible valid number, or the second line from the top,
5223 ;; whichever is the least.
5225 window (min bottom (save-excursion
5226 (forward-line (- top)) (point)))
5228 ;; Do horizontal recentering while we're at it.
5229 (when (and (get-buffer-window (current-buffer) t)
5230 (not (eq gnus-auto-center-summary 'vertical)))
5231 (let ((selected (selected-window)))
5232 (select-window (get-buffer-window (current-buffer) t))
5233 (gnus-summary-position-point)
5234 (gnus-horizontal-recenter)
5235 (select-window selected))))))
5237 (defun gnus-summary-jump-to-group (newsgroup)
5238 "Move point to NEWSGROUP in group mode buffer."
5239 ;; Keep update point of group mode buffer if visible.
5240 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5241 (save-window-excursion
5242 ;; Take care of tree window mode.
5243 (when (get-buffer-window gnus-group-buffer)
5244 (pop-to-buffer gnus-group-buffer))
5245 (gnus-group-jump-to-group newsgroup))
5247 ;; Take care of tree window mode.
5248 (if (get-buffer-window gnus-group-buffer)
5249 (pop-to-buffer gnus-group-buffer)
5250 (set-buffer gnus-group-buffer))
5251 (gnus-group-jump-to-group newsgroup))))
5253 ;; This function returns a list of article numbers based on the
5254 ;; difference between the ranges of read articles in this group and
5255 ;; the range of active articles.
5256 (defun gnus-list-of-unread-articles (group)
5257 (let* ((read (gnus-info-read (gnus-get-info group)))
5258 (active (or (gnus-active group) (gnus-activate-group group)))
5261 ;; If none are read, then all are unread.
5263 (setq first (car active))
5264 ;; If the range of read articles is a single range, then the
5265 ;; first unread article is the article after the last read
5266 ;; article. Sounds logical, doesn't it?
5267 (if (and (not (listp (cdr read)))
5268 (or (< (car read) (car active))
5269 (progn (setq read (list read))
5271 (setq first (max (car active) (1+ (cdr read))))
5272 ;; `read' is a list of ranges.
5273 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5276 (setq first (car active)))
5279 (while (< first nlast)
5281 (setq first (1+ first))))
5282 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5283 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5284 (setq read (cdr read)))))
5285 ;; And add the last unread articles.
5286 (while (<= first last)
5288 (setq first (1+ first)))
5289 ;; Return the list of unread articles.
5290 (delq 0 (nreverse unread))))
5292 (defun gnus-list-of-read-articles (group)
5293 "Return a list of unread, unticked and non-dormant articles."
5294 (let* ((info (gnus-get-info group))
5295 (marked (gnus-info-marks info))
5296 (active (gnus-active group)))
5298 (gnus-set-difference
5299 (gnus-sorted-complement
5300 (gnus-uncompress-range active)
5301 (gnus-list-of-unread-articles group))
5303 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5304 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5306 ;; Various summary commands
5308 (defun gnus-summary-select-article-buffer ()
5309 "Reconfigure windows to show article buffer."
5311 (if (not (gnus-buffer-live-p gnus-article-buffer))
5312 (error "There is no article buffer for this summary buffer")
5313 (gnus-configure-windows 'article)
5314 (select-window (get-buffer-window gnus-article-buffer))))
5316 (defun gnus-summary-universal-argument (arg)
5317 "Perform any operation on all articles that are process/prefixed."
5319 (let ((articles (gnus-summary-work-articles arg))
5326 (substitute-command-keys
5327 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
5329 (gnus-error 1 "Undefined key")
5332 (gnus-summary-goto-subject (setq article (pop articles)))
5333 (let (gnus-newsgroup-processable)
5334 (command-execute func))
5335 (gnus-summary-remove-process-mark article)))))
5336 (gnus-summary-position-point))
5338 (defun gnus-summary-toggle-truncation (&optional arg)
5339 "Toggle truncation of summary lines.
5340 With arg, turn line truncation on iff arg is positive."
5342 (setq truncate-lines
5343 (if (null arg) (not truncate-lines)
5344 (> (prefix-numeric-value arg) 0)))
5347 (defun gnus-summary-reselect-current-group (&optional all rescan)
5348 "Exit and then reselect the current newsgroup.
5349 The prefix argument ALL means to select all articles."
5351 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5352 (error "Ephemeral groups can't be reselected"))
5353 (let ((current-subject (gnus-summary-article-number))
5354 (group gnus-newsgroup-name))
5355 (setq gnus-newsgroup-begin nil)
5357 ;; We have to adjust the point of group mode buffer because
5358 ;; point was moved to the next unread newsgroup by exiting.
5359 (gnus-summary-jump-to-group group)
5362 (gnus-group-get-new-news-this-group 1)))
5363 (gnus-group-read-group all t)
5364 (gnus-summary-goto-subject current-subject nil t)))
5366 (defun gnus-summary-rescan-group (&optional all)
5367 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5369 (gnus-summary-reselect-current-group all t))
5371 (defun gnus-summary-update-info (&optional non-destructive)
5373 (let ((group gnus-newsgroup-name))
5375 (when gnus-newsgroup-kill-headers
5376 (setq gnus-newsgroup-killed
5377 (gnus-compress-sequence
5379 (gnus-set-sorted-intersection
5380 (gnus-uncompress-range gnus-newsgroup-killed)
5381 (setq gnus-newsgroup-unselected
5382 (sort gnus-newsgroup-unselected '<)))
5383 (setq gnus-newsgroup-unreads
5384 (sort gnus-newsgroup-unreads '<)))
5386 (unless (listp (cdr gnus-newsgroup-killed))
5387 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5388 (let ((headers gnus-newsgroup-headers))
5389 ;; Set the new ranges of read articles.
5391 (set-buffer gnus-group-buffer)
5392 (gnus-undo-force-boundary))
5393 (gnus-update-read-articles
5394 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5395 ;; Set the current article marks.
5396 (let ((gnus-newsgroup-scored
5397 (if (and (not gnus-save-score)
5398 (not non-destructive))
5400 gnus-newsgroup-scored)))
5402 (gnus-update-marks)))
5403 ;; Do the cross-ref thing.
5404 (when gnus-use-cross-reference
5405 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5406 ;; Do not switch windows but change the buffer to work.
5407 (set-buffer gnus-group-buffer)
5408 (unless (gnus-ephemeral-group-p group)
5409 (gnus-group-update-group group)))))))
5411 (defun gnus-summary-save-newsrc (&optional force)
5412 "Save the current number of read/marked articles in the dribble buffer.
5413 The dribble buffer will then be saved.
5414 If FORCE (the prefix), also save the .newsrc file(s)."
5416 (gnus-summary-update-info t)
5418 (gnus-save-newsrc-file)
5419 (gnus-dribble-save)))
5421 (defun gnus-summary-exit (&optional temporary)
5422 "Exit reading current newsgroup, and then return to group selection mode.
5423 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
5425 (gnus-set-global-variables)
5426 (when (gnus-buffer-live-p gnus-article-buffer)
5428 (set-buffer gnus-article-buffer)
5429 (mm-destroy-parts gnus-article-mime-handles)
5430 ;; Set it to nil for safety reason.
5431 (setq gnus-article-mime-handle-alist nil)
5432 (setq gnus-article-mime-handles nil)))
5433 (gnus-kill-save-kill-buffer)
5434 (gnus-async-halt-prefetch)
5435 (let* ((group gnus-newsgroup-name)
5436 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5439 (buf (current-buffer)))
5441 ;; Do adaptive scoring, and possibly save score files.
5442 (when gnus-newsgroup-adaptive
5443 (gnus-score-adaptive))
5444 (when gnus-use-scoring
5446 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5447 ;; If we have several article buffers, we kill them at exit.
5448 (unless gnus-single-article-buffer
5449 (gnus-kill-buffer gnus-original-article-buffer)
5450 (setq gnus-article-current nil))
5451 (when gnus-use-cache
5452 (gnus-cache-possibly-remove-articles)
5453 (gnus-cache-save-buffers))
5454 (gnus-async-prefetch-remove-group group)
5455 (when gnus-suppress-duplicates
5456 (gnus-dup-enter-articles))
5457 (when gnus-use-trees
5458 (gnus-tree-close group))
5459 (when gnus-use-cache
5460 (gnus-cache-write-active))
5461 ;; Remove entries for this group.
5462 (nnmail-purge-split-history (gnus-group-real-name group))
5463 ;; Make all changes in this group permanent.
5465 (gnus-run-hooks 'gnus-exit-group-hook)
5466 (gnus-summary-update-info))
5467 (gnus-close-group group)
5468 ;; Make sure where we were, and go to next newsgroup.
5469 (set-buffer gnus-group-buffer)
5471 (gnus-group-jump-to-group group))
5472 (gnus-run-hooks 'gnus-summary-exit-hook)
5473 (unless (or quit-config
5474 ;; If this group has disappeared from the summary
5475 ;; buffer, don't skip forwards.
5476 (not (string= group (gnus-group-group-name))))
5477 (gnus-group-next-unread-group 1))
5478 (setq group-point (point))
5481 ;; If we have several article buffers, we kill them at exit.
5482 (unless gnus-single-article-buffer
5483 (gnus-kill-buffer gnus-article-buffer)
5484 (gnus-kill-buffer gnus-original-article-buffer)
5485 (setq gnus-article-current nil))
5487 (if (not gnus-kill-summary-on-exit)
5488 (gnus-deaden-summary)
5489 ;; We set all buffer-local variables to nil. It is unclear why
5490 ;; this is needed, but if we don't, buffer-local variables are
5491 ;; not garbage-collected, it seems. This would the lead to en
5492 ;; ever-growing Emacs.
5493 (gnus-summary-clear-local-variables)
5494 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
5495 (gnus-summary-clear-local-variables))
5496 (when (get-buffer gnus-article-buffer)
5497 (bury-buffer gnus-article-buffer))
5498 ;; We clear the global counterparts of the buffer-local
5499 ;; variables as well, just to be on the safe side.
5500 (set-buffer gnus-group-buffer)
5501 (gnus-summary-clear-local-variables)
5502 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
5503 (gnus-summary-clear-local-variables))
5504 ;; Return to group mode buffer.
5505 (when (eq mode 'gnus-summary-mode)
5506 (gnus-kill-buffer buf)))
5507 (setq gnus-current-select-method gnus-select-method)
5508 (pop-to-buffer gnus-group-buffer)
5509 (if (not quit-config)
5511 (goto-char group-point)
5512 (gnus-configure-windows 'group 'force))
5513 (gnus-handle-ephemeral-exit quit-config))
5514 ;; Clear the current group name.
5516 (setq gnus-newsgroup-name nil)))))
5518 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5519 (defun gnus-summary-exit-no-update (&optional no-questions)
5520 "Quit reading current newsgroup without updating read article info."
5522 (let* ((group gnus-newsgroup-name)
5523 (quit-config (gnus-group-quit-config group)))
5524 (when (or no-questions
5526 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5527 (gnus-async-halt-prefetch)
5529 (delq 'gnus-summary-expire-articles
5530 (copy-sequence gnus-summary-prepare-exit-hook)))
5531 (when (gnus-buffer-live-p gnus-article-buffer)
5533 (set-buffer gnus-article-buffer)
5534 (mm-destroy-parts gnus-article-mime-handles)
5535 ;; Set it to nil for safety reason.
5536 (setq gnus-article-mime-handle-alist nil)
5537 (setq gnus-article-mime-handles nil)))
5538 ;; If we have several article buffers, we kill them at exit.
5539 (unless gnus-single-article-buffer
5540 (gnus-kill-buffer gnus-article-buffer)
5541 (gnus-kill-buffer gnus-original-article-buffer)
5542 (setq gnus-article-current nil))
5543 (if (not gnus-kill-summary-on-exit)
5544 (gnus-deaden-summary)
5545 (gnus-close-group group)
5546 (gnus-summary-clear-local-variables)
5547 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
5548 (gnus-summary-clear-local-variables))
5549 (set-buffer gnus-group-buffer)
5550 (gnus-summary-clear-local-variables)
5551 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
5552 (gnus-summary-clear-local-variables))
5553 (when (get-buffer gnus-summary-buffer)
5554 (kill-buffer gnus-summary-buffer)))
5555 (unless gnus-single-article-buffer
5556 (setq gnus-article-current nil))
5557 (when gnus-use-trees
5558 (gnus-tree-close group))
5559 (gnus-async-prefetch-remove-group group)
5560 (when (get-buffer gnus-article-buffer)
5561 (bury-buffer gnus-article-buffer))
5562 ;; Return to the group buffer.
5563 (gnus-configure-windows 'group 'force)
5564 ;; Clear the current group name.
5565 (setq gnus-newsgroup-name nil)
5566 (when (equal (gnus-group-group-name) group)
5567 (gnus-group-next-unread-group 1))
5569 (gnus-handle-ephemeral-exit quit-config)))))
5571 (defun gnus-handle-ephemeral-exit (quit-config)
5572 "Handle movement when leaving an ephemeral group.
5573 The state which existed when entering the ephemeral is reset."
5574 (if (not (buffer-name (car quit-config)))
5575 (gnus-configure-windows 'group 'force)
5576 (set-buffer (car quit-config))
5577 (cond ((eq major-mode 'gnus-summary-mode)
5578 (gnus-set-global-variables))
5579 ((eq major-mode 'gnus-article-mode)
5581 ;; The `gnus-summary-buffer' variable may point
5582 ;; to the old summary buffer when using a single
5584 (unless (gnus-buffer-live-p gnus-summary-buffer)
5585 (set-buffer gnus-group-buffer))
5586 (set-buffer gnus-summary-buffer)
5587 (gnus-set-global-variables))))
5588 (if (or (eq (cdr quit-config) 'article)
5589 (eq (cdr quit-config) 'pick))
5591 ;; The current article may be from the ephemeral group
5592 ;; thus it is best that we reload this article
5593 (gnus-summary-show-article)
5594 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5595 (gnus-configure-windows 'pick 'force)
5596 (gnus-configure-windows (cdr quit-config) 'force)))
5597 (gnus-configure-windows (cdr quit-config) 'force))
5598 (when (eq major-mode 'gnus-summary-mode)
5599 (gnus-summary-next-subject 1 nil t)
5600 (gnus-summary-recenter)
5601 (gnus-summary-position-point))))
5605 (defvar gnus-dead-summary-mode-map nil)
5607 (unless gnus-dead-summary-mode-map
5608 (setq gnus-dead-summary-mode-map (make-keymap))
5609 (suppress-keymap gnus-dead-summary-mode-map)
5610 (substitute-key-definition
5611 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5612 (let ((keys '("\C-d" "\r" "\177" [delete])))
5614 (define-key gnus-dead-summary-mode-map
5615 (pop keys) 'gnus-summary-wake-up-the-dead))))
5617 (defvar gnus-dead-summary-mode nil
5618 "Minor mode for Gnus summary buffers.")
5620 (defun gnus-dead-summary-mode (&optional arg)
5621 "Minor mode for Gnus summary buffers."
5623 (when (eq major-mode 'gnus-summary-mode)
5624 (make-local-variable 'gnus-dead-summary-mode)
5625 (setq gnus-dead-summary-mode
5626 (if (null arg) (not gnus-dead-summary-mode)
5627 (> (prefix-numeric-value arg) 0)))
5628 (when gnus-dead-summary-mode
5629 (gnus-add-minor-mode
5630 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5632 (defun gnus-deaden-summary ()
5633 "Make the current summary buffer into a dead summary buffer."
5634 ;; Kill any previous dead summary buffer.
5635 (when (and gnus-dead-summary
5636 (buffer-name gnus-dead-summary))
5638 (set-buffer gnus-dead-summary)
5639 (when gnus-dead-summary-mode
5640 (kill-buffer (current-buffer)))))
5641 ;; Make this the current dead summary.
5642 (setq gnus-dead-summary (current-buffer))
5643 (gnus-dead-summary-mode 1)
5644 (let ((name (buffer-name)))
5645 (when (string-match "Summary" name)
5647 (concat (substring name 0 (match-beginning 0)) "Dead "
5648 (substring name (match-beginning 0)))
5652 (defun gnus-kill-or-deaden-summary (buffer)
5653 "Kill or deaden the summary BUFFER."
5655 (when (and (buffer-name buffer)
5656 (not gnus-single-article-buffer))
5659 (gnus-kill-buffer gnus-article-buffer)
5660 (gnus-kill-buffer gnus-original-article-buffer)))
5661 (cond (gnus-kill-summary-on-exit
5662 (when (and gnus-use-trees
5663 (gnus-buffer-exists-p buffer))
5666 (gnus-tree-close gnus-newsgroup-name)))
5667 (gnus-kill-buffer buffer))
5668 ((gnus-buffer-exists-p buffer)
5671 (gnus-deaden-summary))))))
5673 (defun gnus-summary-wake-up-the-dead (&rest args)
5674 "Wake up the dead summary buffer."
5676 (gnus-dead-summary-mode -1)
5677 (let ((name (buffer-name)))
5678 (when (string-match "Dead " name)
5680 (concat (substring name 0 (match-beginning 0))
5681 (substring name (match-end 0)))
5683 (gnus-message 3 "This dead summary is now alive again"))
5685 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5686 (defun gnus-summary-fetch-faq (&optional faq-dir)
5687 "Fetch the FAQ for the current group.
5688 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5692 (when current-prefix-arg
5694 "Faq dir: " (and (listp gnus-group-faq-directory)
5695 (mapcar (lambda (file) (list file))
5696 gnus-group-faq-directory))))))
5697 (let (gnus-faq-buffer)
5698 (when (setq gnus-faq-buffer
5699 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5700 (gnus-configure-windows 'summary-faq))))
5702 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5703 (defun gnus-summary-describe-group (&optional force)
5704 "Describe the current newsgroup."
5706 (gnus-group-describe-group force gnus-newsgroup-name))
5708 (defun gnus-summary-describe-briefly ()
5709 "Describe summary mode commands briefly."
5711 (gnus-message 6 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
5713 ;; Walking around group mode buffer from summary mode.
5715 (defun gnus-summary-next-group (&optional no-article target-group backward)
5716 "Exit current newsgroup and then select next unread newsgroup.
5717 If prefix argument NO-ARTICLE is non-nil, no article is selected
5718 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5719 previous group instead."
5721 ;; Stop pre-fetching.
5722 (gnus-async-halt-prefetch)
5723 (let ((current-group gnus-newsgroup-name)
5724 (current-buffer (current-buffer))
5726 ;; First we semi-exit this group to update Xrefs and all variables.
5727 ;; We can't do a real exit, because the window conf must remain
5728 ;; the same in case the user is prompted for info, and we don't
5729 ;; want the window conf to change before that...
5730 (gnus-summary-exit t)
5731 (while (not entered)
5732 ;; Then we find what group we are supposed to enter.
5733 (set-buffer gnus-group-buffer)
5734 (gnus-group-jump-to-group current-group)
5737 (if (eq gnus-keep-same-level 'best)
5738 (gnus-summary-best-group gnus-newsgroup-name)
5739 (gnus-summary-search-group backward gnus-keep-same-level))))
5740 (if (not target-group)
5741 ;; There are no further groups, so we return to the group
5744 (gnus-message 5 "Returning to the group buffer")
5746 (when (gnus-buffer-live-p current-buffer)
5747 (set-buffer current-buffer)
5748 (gnus-summary-exit))
5749 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5750 ;; We try to enter the target group.
5751 (gnus-group-jump-to-group target-group)
5752 (let ((unreads (gnus-group-group-unread)))
5753 (if (and (or (eq t unreads)
5754 (and unreads (not (zerop unreads))))
5755 (gnus-summary-read-group
5756 target-group nil no-article
5757 (and (buffer-name current-buffer) current-buffer)
5760 (setq current-group target-group
5761 target-group nil)))))))
5763 (defun gnus-summary-prev-group (&optional no-article)
5764 "Exit current newsgroup and then select previous unread newsgroup.
5765 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5767 (gnus-summary-next-group no-article nil t))
5769 ;; Walking around summary lines.
5771 (defun gnus-summary-first-subject (&optional unread undownloaded)
5772 "Go to the first unread subject.
5773 If UNREAD is non-nil, go to the first unread article.
5774 Returns the article selected or nil if there are no unread articles."
5779 ((null gnus-newsgroup-data)
5780 (gnus-message 3 "No articles in the group")
5782 ;; Pick the first article.
5784 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5785 (gnus-data-number (car gnus-newsgroup-data)))
5786 ;; No unread articles.
5787 ((null gnus-newsgroup-unreads)
5788 (gnus-message 3 "No more unread articles")
5790 ;; Find the first unread article.
5792 (let ((data gnus-newsgroup-data))
5794 (and (not (and undownloaded
5795 (eq gnus-undownloaded-mark
5796 (gnus-data-mark (car data)))))
5797 (not (gnus-data-unread-p (car data)))))
5798 (setq data (cdr data)))
5800 (goto-char (gnus-data-pos (car data)))
5801 (gnus-data-number (car data))))))
5802 (gnus-summary-position-point)))
5804 (defun gnus-summary-next-subject (n &optional unread dont-display)
5805 "Go to next N'th summary line.
5806 If N is negative, go to the previous N'th subject line.
5807 If UNREAD is non-nil, only unread articles are selected.
5808 The difference between N and the actual number of steps taken is
5811 (let ((backward (< n 0))
5815 (gnus-summary-find-prev unread)
5816 (gnus-summary-find-next unread)))
5817 (unless (zerop (setq n (1- n)))
5818 (gnus-summary-show-thread)))
5820 (gnus-message 7 "No more%s articles"
5821 (if unread " unread" "")))
5822 (unless dont-display
5823 (gnus-summary-recenter)
5824 (gnus-summary-position-point))
5827 (defun gnus-summary-next-unread-subject (n)
5828 "Go to next N'th unread summary line."
5830 (gnus-summary-next-subject n t))
5832 (defun gnus-summary-prev-subject (n &optional unread)
5833 "Go to previous N'th summary line.
5834 If optional argument UNREAD is non-nil, only unread article is selected."
5836 (gnus-summary-next-subject (- n) unread))
5838 (defun gnus-summary-prev-unread-subject (n)
5839 "Go to previous N'th unread summary line."
5841 (gnus-summary-next-subject (- n) t))
5843 (defun gnus-summary-goto-subject (article &optional force silent)
5844 "Go the subject line of ARTICLE.
5845 If FORCE, also allow jumping to articles not currently shown."
5846 (interactive "nArticle number: ")
5848 (data (gnus-data-find article)))
5849 ;; We read in the article if we have to.
5852 (gnus-summary-insert-subject
5854 (if (or (numberp force) (vectorp force)) force)
5856 (setq data (gnus-data-find article)))
5861 (gnus-message 3 "Can't find article %d" article))
5863 (goto-char (gnus-data-pos data))
5864 (gnus-summary-position-point)
5867 ;; Walking around summary lines with displaying articles.
5869 (defun gnus-summary-expand-window (&optional arg)
5870 "Make the summary buffer take up the entire Emacs frame.
5871 Given a prefix, will force an `article' buffer configuration."
5874 (gnus-configure-windows 'article 'force)
5875 (gnus-configure-windows 'summary 'force)))
5877 (defun gnus-summary-display-article (article &optional all-header)
5878 "Display ARTICLE in article buffer."
5879 (gnus-set-global-variables)
5880 (when (gnus-buffer-live-p gnus-article-buffer)
5881 (with-current-buffer gnus-article-buffer
5882 (setq gnus-article-charset gnus-newsgroup-charset)
5883 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
5884 (mm-enable-multibyte-mule4)))
5888 (if gnus-summary-display-article-function
5889 (funcall gnus-summary-display-article-function article all-header)
5890 (gnus-article-prepare article all-header))
5891 (gnus-run-hooks 'gnus-select-article-hook)
5892 (when (and gnus-current-article
5893 (not (zerop gnus-current-article)))
5894 (gnus-summary-goto-subject gnus-current-article))
5895 (gnus-summary-recenter)
5896 (when (and gnus-use-trees gnus-show-threads)
5897 (gnus-possibly-generate-tree article)
5898 (gnus-highlight-selected-tree article))
5899 ;; Successfully display article.
5900 (gnus-article-set-window-start
5901 (cdr (assq article gnus-newsgroup-bookmarks))))))
5903 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5904 "Select the current article.
5905 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5906 non-nil, the article will be re-fetched even if it already present in
5907 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5909 ;; Make sure we are in the summary buffer to work around bbdb bug.
5910 (unless (eq major-mode 'gnus-summary-mode)
5911 (set-buffer gnus-summary-buffer))
5912 (let ((article (or article (gnus-summary-article-number)))
5913 (all-headers (not (not all-headers))) ;Must be T or NIL.
5914 gnus-summary-display-article-function)
5916 (gnus-summary-article-pseudo-p article)
5917 (error "This is a pseudo-article"))
5919 (set-buffer gnus-summary-buffer)
5920 (if (or (and gnus-single-article-buffer
5921 (or (null gnus-current-article)
5922 (null gnus-article-current)
5923 (null (get-buffer gnus-article-buffer))
5924 (not (eq article (cdr gnus-article-current)))
5925 (not (equal (car gnus-article-current)
5926 gnus-newsgroup-name))))
5927 (and (not gnus-single-article-buffer)
5928 (or (null gnus-current-article)
5929 (not (eq gnus-current-article article))))
5931 ;; The requested article is different from the current article.
5933 (gnus-summary-display-article article all-headers)
5934 (when (gnus-buffer-live-p gnus-article-buffer)
5935 (with-current-buffer gnus-article-buffer
5936 (if (not gnus-article-decoded-p) ;; a local variable
5937 (mm-disable-multibyte-mule4))))
5938 (when (or all-headers gnus-show-all-headers)
5939 (gnus-article-show-all-headers))
5940 (gnus-article-set-window-start
5941 (cdr (assq article gnus-newsgroup-bookmarks)))
5943 (when (or all-headers gnus-show-all-headers)
5944 (gnus-article-show-all-headers))
5947 (defun gnus-summary-force-verify-and-decrypt ()
5949 (let ((mm-verify-option 'known)
5950 (mm-decrypt-option 'known))
5951 (gnus-summary-select-article nil 'force)))
5953 (defun gnus-summary-set-current-mark (&optional current-mark)
5954 "Obsolete function."
5957 (defun gnus-summary-next-article (&optional unread subject backward push)
5958 "Select the next article.
5959 If UNREAD, only unread articles are selected.
5960 If SUBJECT, only articles with SUBJECT are selected.
5961 If BACKWARD, the previous article is selected instead of the next."
5964 ;; Is there such an article?
5965 ((and (gnus-summary-search-forward unread subject backward)
5966 (or (gnus-summary-display-article (gnus-summary-article-number))
5967 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5968 (gnus-summary-position-point))
5969 ;; If not, we try the first unread, if that is wanted.
5971 gnus-auto-select-same
5972 (gnus-summary-first-unread-article))
5973 (gnus-summary-position-point)
5974 (gnus-message 6 "Wrapped"))
5975 ;; Try to get next/previous article not displayed in this group.
5976 ((and gnus-auto-extend-newsgroup
5977 (not unread) (not subject))
5978 (gnus-summary-goto-article
5979 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5980 nil (count-lines (point-min) (point))))
5981 ;; Go to next/previous group.
5983 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5984 (gnus-summary-jump-to-group gnus-newsgroup-name))
5985 (let ((cmd last-command-char)
5988 (set-buffer gnus-group-buffer)
5991 (if (eq gnus-keep-same-level 'best)
5992 (gnus-summary-best-group gnus-newsgroup-name)
5993 (gnus-summary-search-group backward gnus-keep-same-level))))
5994 ;; For some reason, the group window gets selected. We change
5996 (select-window (get-buffer-window (current-buffer)))
5997 ;; Select next unread newsgroup automagically.
5999 ((or (not gnus-auto-select-next)
6001 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
6002 ((or (eq gnus-auto-select-next 'quietly)
6003 (and (eq gnus-auto-select-next 'slightly-quietly)
6005 (and (eq gnus-auto-select-next 'almost-quietly)
6006 (gnus-summary-last-article-p)))
6008 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
6010 (gnus-message 7 "No more%s articles (%s)..."
6011 (if unread " unread" "")
6012 (if group (concat "selecting " group)
6014 (gnus-summary-next-group nil group backward)))
6016 (when (gnus-key-press-event-p last-input-event)
6017 (gnus-summary-walk-group-buffer
6018 gnus-newsgroup-name cmd unread backward point))))))))
6020 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
6021 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
6022 (?\C-p (gnus-group-prev-unread-group 1))))
6023 (cursor-in-echo-area t)
6024 keve key group ended)
6026 (set-buffer gnus-group-buffer)
6029 (if (eq gnus-keep-same-level 'best)
6030 (gnus-summary-best-group gnus-newsgroup-name)
6031 (gnus-summary-search-group backward gnus-keep-same-level))))
6034 5 "No more%s articles%s" (if unread " unread" "")
6036 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
6037 (format " (Type %s for %s [%s])"
6038 (single-key-description cmd) group
6039 (car (gnus-gethash group gnus-newsrc-hashtb)))
6040 (format " (Type %s to exit %s)"
6041 (single-key-description cmd)
6042 gnus-newsgroup-name)))
6043 ;; Confirm auto selection.
6044 (setq key (car (setq keve (gnus-read-event-char))))
6047 ((assq key keystrokes)
6048 (let ((obuf (current-buffer)))
6049 (switch-to-buffer gnus-group-buffer)
6051 (gnus-group-jump-to-group group))
6052 (eval (cadr (assq key keystrokes)))
6053 (setq group (gnus-group-group-name))
6054 (switch-to-buffer obuf))
6058 (gnus-ephemeral-group-p gnus-newsgroup-name))
6060 (gnus-summary-next-group nil group backward)))
6062 (push (cdr keve) unread-command-events))))))
6064 (defun gnus-summary-next-unread-article ()
6065 "Select unread article after current one."
6067 (gnus-summary-next-article
6068 (or (not (eq gnus-summary-goto-unread 'never))
6069 (gnus-summary-last-article-p (gnus-summary-article-number)))
6070 (and gnus-auto-select-same
6071 (gnus-summary-article-subject))))
6073 (defun gnus-summary-prev-article (&optional unread subject)
6074 "Select the article after the current one.
6075 If UNREAD is non-nil, only unread articles are selected."
6077 (gnus-summary-next-article unread subject t))
6079 (defun gnus-summary-prev-unread-article ()
6080 "Select unread article before current one."
6082 (gnus-summary-prev-article
6083 (or (not (eq gnus-summary-goto-unread 'never))
6084 (gnus-summary-first-article-p (gnus-summary-article-number)))
6085 (and gnus-auto-select-same
6086 (gnus-summary-article-subject))))
6088 (defun gnus-summary-next-page (&optional lines circular)
6089 "Show next page of the selected article.
6090 If at the end of the current article, select the next article.
6091 LINES says how many lines should be scrolled up.
6093 If CIRCULAR is non-nil, go to the start of the article instead of
6094 selecting the next article when reaching the end of the current
6097 (setq gnus-summary-buffer (current-buffer))
6098 (gnus-set-global-variables)
6099 (let ((article (gnus-summary-article-number))
6100 (article-window (get-buffer-window gnus-article-buffer t))
6102 ;; If the buffer is empty, we have no article.
6104 (error "No article to select"))
6105 (gnus-configure-windows 'article)
6106 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
6107 (if (and (eq gnus-summary-goto-unread 'never)
6108 (not (gnus-summary-last-article-p article)))
6109 (gnus-summary-next-article)
6110 (gnus-summary-next-unread-article))
6111 (if (or (null gnus-current-article)
6112 (null gnus-article-current)
6113 (/= article (cdr gnus-article-current))
6114 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6115 ;; Selected subject is different from current article's.
6116 (gnus-summary-display-article article)
6117 (when article-window
6118 (gnus-eval-in-buffer-window gnus-article-buffer
6119 (setq endp (gnus-article-next-page lines)))
6122 (gnus-summary-beginning-of-article))
6124 (gnus-message 3 "End of message"))
6126 (if (and (eq gnus-summary-goto-unread 'never)
6127 (not (gnus-summary-last-article-p article)))
6128 (gnus-summary-next-article)
6129 (gnus-summary-next-unread-article))))))))
6130 (gnus-summary-recenter)
6131 (gnus-summary-position-point)))
6133 (defun gnus-summary-prev-page (&optional lines move)
6134 "Show previous page of selected article.
6135 Argument LINES specifies lines to be scrolled down.
6136 If MOVE, move to the previous unread article if point is at
6137 the beginning of the buffer."
6139 (let ((article (gnus-summary-article-number))
6140 (article-window (get-buffer-window gnus-article-buffer t))
6142 (gnus-configure-windows 'article)
6143 (if (or (null gnus-current-article)
6144 (null gnus-article-current)
6145 (/= article (cdr gnus-article-current))
6146 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
6147 ;; Selected subject is different from current article's.
6148 (gnus-summary-display-article article)
6149 (gnus-summary-recenter)
6150 (when article-window
6151 (gnus-eval-in-buffer-window gnus-article-buffer
6152 (setq endp (gnus-article-prev-page lines)))
6153 (when (and move endp)
6155 (gnus-message 3 "Beginning of message"))
6157 (if (and (eq gnus-summary-goto-unread 'never)
6158 (not (gnus-summary-first-article-p article)))
6159 (gnus-summary-prev-article)
6160 (gnus-summary-prev-unread-article))))))))
6161 (gnus-summary-position-point))
6163 (defun gnus-summary-prev-page-or-article (&optional lines)
6164 "Show previous page of selected article.
6165 Argument LINES specifies lines to be scrolled down.
6166 If at the beginning of the article, go to the next article."
6168 (gnus-summary-prev-page lines t))
6170 (defun gnus-summary-scroll-up (lines)
6171 "Scroll up (or down) one line current article.
6172 Argument LINES specifies lines to be scrolled up (or down if negative)."
6174 (gnus-configure-windows 'article)
6175 (gnus-summary-show-thread)
6176 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
6177 (gnus-eval-in-buffer-window gnus-article-buffer
6179 (when (gnus-article-next-page lines)
6180 (gnus-message 3 "End of message")))
6182 (gnus-article-prev-page (- lines))))))
6183 (gnus-summary-recenter)
6184 (gnus-summary-position-point))
6186 (defun gnus-summary-scroll-down (lines)
6187 "Scroll down (or up) one line current article.
6188 Argument LINES specifies lines to be scrolled down (or up if negative)."
6190 (gnus-summary-scroll-up (- lines)))
6192 (defun gnus-summary-next-same-subject ()
6193 "Select next article which has the same subject as current one."
6195 (gnus-summary-next-article nil (gnus-summary-article-subject)))
6197 (defun gnus-summary-prev-same-subject ()
6198 "Select previous article which has the same subject as current one."
6200 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
6202 (defun gnus-summary-next-unread-same-subject ()
6203 "Select next unread article which has the same subject as current one."
6205 (gnus-summary-next-article t (gnus-summary-article-subject)))
6207 (defun gnus-summary-prev-unread-same-subject ()
6208 "Select previous unread article which has the same subject as current one."
6210 (gnus-summary-prev-article t (gnus-summary-article-subject)))
6212 (defun gnus-summary-first-unread-article ()
6213 "Select the first unread article.
6214 Return nil if there are no unread articles."
6217 (when (gnus-summary-first-subject t)
6218 (gnus-summary-show-thread)
6219 (gnus-summary-first-subject t)
6220 (gnus-summary-display-article (gnus-summary-article-number)))
6221 (gnus-summary-position-point)))
6223 (defun gnus-summary-first-unread-subject ()
6224 "Place the point on the subject line of the first unread article.
6225 Return nil if there are no unread articles."
6228 (when (gnus-summary-first-subject t)
6229 (gnus-summary-show-thread)
6230 (gnus-summary-first-subject t))
6231 (gnus-summary-position-point)))
6233 (defun gnus-summary-first-article ()
6234 "Select the first article.
6235 Return nil if there are no articles."
6238 (when (gnus-summary-first-subject)
6239 (gnus-summary-show-thread)
6240 (gnus-summary-first-subject)
6241 (gnus-summary-display-article (gnus-summary-article-number)))
6242 (gnus-summary-position-point)))
6244 (defun gnus-summary-best-unread-article ()
6245 "Select the unread article with the highest score."
6247 (let ((best -1000000)
6248 (data gnus-newsgroup-data)
6251 (and (gnus-data-unread-p (car data))
6253 (gnus-summary-article-score (gnus-data-number (car data))))
6256 article (gnus-data-number (car data))))
6257 (setq data (cdr data)))
6260 (gnus-summary-goto-article article)
6261 (error "No unread articles"))
6262 (gnus-summary-position-point))))
6264 (defun gnus-summary-last-subject ()
6265 "Go to the last displayed subject line in the group."
6266 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6268 (gnus-summary-goto-subject article))))
6270 (defun gnus-summary-goto-article (article &optional all-headers force)
6271 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6272 If ALL-HEADERS is non-nil, no header lines are hidden.
6273 If FORCE, go to the article even if it isn't displayed. If FORCE
6274 is a number, it is the line the article is to be displayed on."
6278 "Article number or Message-ID: "
6279 (mapcar (lambda (number) (list (int-to-string number)))
6280 gnus-newsgroup-limit))
6284 (if (and (stringp article)
6285 (string-match "@" article))
6286 (gnus-summary-refer-article article)
6287 (when (stringp article)
6288 (setq article (string-to-number article)))
6289 (if (gnus-summary-goto-subject article force)
6290 (gnus-summary-display-article article all-headers)
6291 (gnus-message 4 "Couldn't go to article %s" article) nil))
6292 (gnus-summary-position-point)))
6294 (defun gnus-summary-goto-last-article ()
6295 "Go to the previously read article."
6298 (when gnus-last-article
6299 (gnus-summary-goto-article gnus-last-article nil t))
6300 (gnus-summary-position-point)))
6302 (defun gnus-summary-pop-article (number)
6303 "Pop one article off the history and go to the previous.
6304 NUMBER articles will be popped off."
6307 (setq gnus-newsgroup-history
6308 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6310 (gnus-summary-goto-article (car to) nil t)
6311 (error "Article history empty")))
6312 (gnus-summary-position-point))
6314 ;; Summary commands and functions for limiting the summary buffer.
6316 (defun gnus-summary-limit-to-articles (n)
6317 "Limit the summary buffer to the next N articles.
6318 If not given a prefix, use the process marked articles instead."
6321 (let ((articles (gnus-summary-work-articles n)))
6322 (setq gnus-newsgroup-processable nil)
6323 (gnus-summary-limit articles))
6324 (gnus-summary-position-point)))
6326 (defun gnus-summary-pop-limit (&optional total)
6327 "Restore the previous limit.
6328 If given a prefix, remove all limits."
6331 (setq gnus-newsgroup-limits
6332 (list (mapcar (lambda (h) (mail-header-number h))
6333 gnus-newsgroup-headers))))
6334 (unless gnus-newsgroup-limits
6335 (error "No limit to pop"))
6337 (gnus-summary-limit nil 'pop)
6338 (gnus-summary-position-point)))
6340 (defun gnus-summary-limit-to-subject (subject &optional header)
6341 "Limit the summary buffer to articles that have subjects that match a regexp."
6342 (interactive "sLimit to subject (regexp): ")
6344 (setq header "subject"))
6345 (when (not (equal "" subject))
6347 (let ((articles (gnus-summary-find-matching
6348 (or header "subject") subject 'all)))
6350 (error "Found no matches for \"%s\"" subject))
6351 (gnus-summary-limit articles))
6352 (gnus-summary-position-point))))
6354 (defun gnus-summary-limit-to-author (from)
6355 "Limit the summary buffer to articles that have authors that match a regexp."
6356 (interactive "sLimit to author (regexp): ")
6357 (gnus-summary-limit-to-subject from "from"))
6359 (defun gnus-summary-limit-to-age (age &optional younger-p)
6360 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6361 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6362 articles that are younger than AGE days."
6364 (let ((younger current-prefix-arg)
6367 (while (not days-got)
6368 (setq days (if younger
6369 (read-string "Limit to articles within (in days): ")
6370 (read-string "Limit to articles old than (in days): ")))
6371 (when (> (length days) 0)
6372 (setq days (read days)))
6375 (message "Please enter a number.")
6377 (list days younger)))
6379 (let ((data gnus-newsgroup-data)
6380 (cutoff (days-to-time age))
6381 articles d date is-younger)
6382 (while (setq d (pop data))
6383 (when (and (vectorp (gnus-data-header d))
6384 (setq date (mail-header-date (gnus-data-header d))))
6385 (setq is-younger (time-less-p
6386 (time-since (condition-case ()
6393 (push (gnus-data-number d) articles))))
6394 (gnus-summary-limit (nreverse articles)))
6395 (gnus-summary-position-point)))
6397 (defun gnus-summary-limit-to-extra (header regexp)
6398 "Limit the summary buffer to articles that match an 'extra' header."
6402 (gnus-completing-read
6403 (symbol-name (car gnus-extra-headers))
6404 "Limit extra header:"
6406 (cons (symbol-name x) x))
6411 (read-string (format "Limit to header %s (regexp): " header)))))
6412 (when (not (equal "" regexp))
6414 (let ((articles (gnus-summary-find-matching
6415 (cons 'extra header) regexp 'all)))
6417 (error "Found no matches for \"%s\"" regexp))
6418 (gnus-summary-limit articles))
6419 (gnus-summary-position-point))))
6421 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6423 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6425 (defun gnus-summary-limit-to-unread (&optional all)
6426 "Limit the summary buffer to articles that are not marked as read.
6427 If ALL is non-nil, limit strictly to unread articles."
6430 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6431 (gnus-summary-limit-to-marks
6432 ;; Concat all the marks that say that an article is read and have
6434 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6435 gnus-killed-mark gnus-kill-file-mark
6436 gnus-low-score-mark gnus-expirable-mark
6437 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6438 gnus-duplicate-mark gnus-souped-mark)
6441 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6442 (make-obsolete 'gnus-summary-delete-marked-with
6443 'gnus-summary-limit-exlude-marks)
6445 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6446 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6447 If REVERSE, limit the summary buffer to articles that are marked
6448 with MARKS. MARKS can either be a string of marks or a list of marks.
6449 Returns how many articles were removed."
6450 (interactive "sMarks: ")
6451 (gnus-summary-limit-to-marks marks t))
6453 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6454 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6455 If REVERSE (the prefix), limit the summary buffer to articles that are
6456 not marked with MARKS. MARKS can either be a string of marks or a
6458 Returns how many articles were removed."
6459 (interactive "sMarks: \nP")
6461 (let ((data gnus-newsgroup-data)
6462 (marks (if (listp marks) marks
6463 (append marks nil))) ; Transform to list.
6466 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6467 (memq (gnus-data-mark (car data)) marks))
6468 (push (gnus-data-number (car data)) articles))
6469 (setq data (cdr data)))
6470 (gnus-summary-limit articles))
6471 (gnus-summary-position-point)))
6473 (defun gnus-summary-limit-to-score (&optional score)
6474 "Limit to articles with score at or above SCORE."
6476 (setq score (if score
6477 (prefix-numeric-value score)
6478 (or gnus-summary-default-score 0)))
6479 (let ((data gnus-newsgroup-data)
6482 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6484 (push (gnus-data-number (car data)) articles))
6485 (setq data (cdr data)))
6487 (gnus-summary-limit articles)
6488 (gnus-summary-position-point))))
6490 (defun gnus-summary-limit-include-thread (id)
6491 "Display all the hidden articles that in the current thread."
6492 (interactive (list (mail-header-id (gnus-summary-article-header))))
6493 (let ((articles (gnus-articles-in-thread
6494 (gnus-id-to-thread (gnus-root-id id)))))
6496 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6497 (gnus-summary-position-point))))
6499 (defun gnus-summary-limit-include-dormant ()
6500 "Display all the hidden articles that are marked as dormant.
6501 Note that this command only works on a subset of the articles currently
6502 fetched for this group."
6504 (unless gnus-newsgroup-dormant
6505 (error "There are no dormant articles in this group"))
6507 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6508 (gnus-summary-position-point)))
6510 (defun gnus-summary-limit-exclude-dormant ()
6511 "Hide all dormant articles."
6514 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6515 (gnus-summary-position-point)))
6517 (defun gnus-summary-limit-exclude-childless-dormant ()
6518 "Hide all dormant articles that have no children."
6520 (let ((data (gnus-data-list t))
6521 articles d children)
6522 ;; Find all articles that are either not dormant or have
6524 (while (setq d (pop data))
6525 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6527 (gnus-article-children (gnus-data-number d)))
6530 (when (memq (car children) articles)
6535 (push (gnus-data-number d) articles)))
6538 (gnus-summary-limit articles)
6539 (gnus-summary-position-point))))
6541 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6542 "Mark all unread excluded articles as read.
6543 If ALL, mark even excluded ticked and dormants as read."
6545 (let ((articles (gnus-sorted-complement
6547 (mapcar (lambda (h) (mail-header-number h))
6548 gnus-newsgroup-headers)
6550 (sort gnus-newsgroup-limit '<)))
6552 (setq gnus-newsgroup-unreads
6553 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6555 (setq gnus-newsgroup-dormant nil
6556 gnus-newsgroup-marked nil
6557 gnus-newsgroup-reads
6559 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6560 gnus-newsgroup-reads))
6561 (while (setq article (pop articles))
6562 (unless (or (memq article gnus-newsgroup-dormant)
6563 (memq article gnus-newsgroup-marked))
6564 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6566 (defun gnus-summary-limit (articles &optional pop)
6568 ;; We pop the previous limit off the stack and use that.
6569 (setq articles (car gnus-newsgroup-limits)
6570 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6571 ;; We use the new limit, so we push the old limit on the stack.
6572 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6574 (setq gnus-newsgroup-limit articles)
6575 (let ((total (length gnus-newsgroup-data))
6576 (data (gnus-data-find-list (gnus-summary-article-number)))
6577 (gnus-summary-mark-below nil) ; Inhibit this.
6579 ;; This will do all the work of generating the new summary buffer
6580 ;; according to the new limit.
6581 (gnus-summary-prepare)
6582 ;; Hide any threads, possibly.
6583 (and gnus-show-threads
6584 gnus-thread-hide-subtree
6585 (gnus-summary-hide-all-threads))
6586 ;; Try to return to the article you were at, or one in the
6589 ;; We try to find some article after the current one.
6591 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6594 (setq data (cdr data))))
6596 ;; If there is no data, that means that we were after the last
6597 ;; article. The same goes when we can't find any articles
6598 ;; after the current one.
6599 (goto-char (point-max))
6600 (gnus-summary-find-prev))
6601 (gnus-set-mode-line 'summary)
6602 ;; We return how many articles were removed from the summary
6603 ;; buffer as a result of the new limit.
6604 (- total (length gnus-newsgroup-data))))
6606 (defsubst gnus-invisible-cut-children (threads)
6609 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6614 (defsubst gnus-cut-thread (thread)
6615 "Go forwards in the thread until we find an article that we want to display."
6616 (when (or (eq gnus-fetch-old-headers 'some)
6617 (eq gnus-fetch-old-headers 'invisible)
6618 (numberp gnus-fetch-old-headers)
6619 (eq gnus-build-sparse-threads 'some)
6620 (eq gnus-build-sparse-threads 'more))
6621 ;; Deal with old-fetched headers and sparse threads.
6625 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6626 (gnus-summary-article-ancient-p
6627 (mail-header-number (car thread))))
6628 (if (or (<= (length (cdr thread)) 1)
6629 (eq gnus-fetch-old-headers 'invisible))
6630 (setq gnus-newsgroup-limit
6631 (delq (mail-header-number (car thread))
6632 gnus-newsgroup-limit)
6633 thread (cadr thread))
6634 (when (gnus-invisible-cut-children (cdr thread))
6635 (let ((th (cdr thread)))
6637 (if (memq (mail-header-number (caar th))
6638 gnus-newsgroup-limit)
6639 (setq thread (car th)
6641 (setq th (cdr th))))))))))
6644 (defun gnus-cut-threads (threads)
6645 "Cut off all uninteresting articles from the beginning of threads."
6646 (when (or (eq gnus-fetch-old-headers 'some)
6647 (eq gnus-fetch-old-headers 'invisible)
6648 (numberp gnus-fetch-old-headers)
6649 (eq gnus-build-sparse-threads 'some)
6650 (eq gnus-build-sparse-threads 'more))
6653 (setcar th (gnus-cut-thread (car th)))
6654 (setq th (cdr th)))))
6655 ;; Remove nixed out threads.
6658 (defun gnus-summary-initial-limit (&optional show-if-empty)
6659 "Figure out what the initial limit is supposed to be on group entry.
6660 This entails weeding out unwanted dormants, low-scored articles,
6661 fetch-old-headers verbiage, and so on."
6662 ;; Most groups have nothing to remove.
6663 (if (or gnus-inhibit-limiting
6664 (and (null gnus-newsgroup-dormant)
6665 (not (eq gnus-fetch-old-headers 'some))
6666 (not (numberp gnus-fetch-old-headers))
6667 (not (eq gnus-fetch-old-headers 'invisible))
6668 (null gnus-summary-expunge-below)
6669 (not (eq gnus-build-sparse-threads 'some))
6670 (not (eq gnus-build-sparse-threads 'more))
6671 (null gnus-thread-expunge-below)
6672 (not gnus-use-nocem)))
6674 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6675 (setq gnus-newsgroup-limit nil)
6678 (unless (car (symbol-value node))
6679 ;; These threads have no parents -- they are roots.
6680 (let ((nodes (cdr (symbol-value node)))
6683 (if (and gnus-thread-expunge-below
6684 (< (gnus-thread-total-score (car nodes))
6685 gnus-thread-expunge-below))
6686 (gnus-expunge-thread (pop nodes))
6687 (setq thread (pop nodes))
6688 (gnus-summary-limit-children thread))))))
6689 gnus-newsgroup-dependencies)
6690 ;; If this limitation resulted in an empty group, we might
6691 ;; pop the previous limit and use it instead.
6692 (when (and (not gnus-newsgroup-limit)
6694 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6695 gnus-newsgroup-limit))
6697 (defun gnus-summary-limit-children (thread)
6698 "Return 1 if this subthread is visible and 0 if it is not."
6699 ;; First we get the number of visible children to this thread. This
6700 ;; is done by recursing down the thread using this function, so this
6701 ;; will really go down to a leaf article first, before slowly
6702 ;; working its way up towards the root.
6706 (apply '+ (mapcar 'gnus-summary-limit-children
6709 (number (mail-header-number (car thread)))
6712 (not (memq number gnus-newsgroup-marked))
6714 ;; If this article is dormant and has absolutely no visible
6715 ;; children, then this article isn't visible.
6716 (and (memq number gnus-newsgroup-dormant)
6718 ;; If this is "fetch-old-headered" and there is no
6719 ;; visible children, then we don't want this article.
6720 (and (or (eq gnus-fetch-old-headers 'some)
6721 (numberp gnus-fetch-old-headers))
6722 (gnus-summary-article-ancient-p number)
6724 ;; If this is "fetch-old-headered" and `invisible', then
6725 ;; we don't want this article.
6726 (and (eq gnus-fetch-old-headers 'invisible)
6727 (gnus-summary-article-ancient-p number))
6728 ;; If this is a sparsely inserted article with no children,
6729 ;; we don't want it.
6730 (and (eq gnus-build-sparse-threads 'some)
6731 (gnus-summary-article-sparse-p number)
6733 ;; If we use expunging, and this article is really
6734 ;; low-scored, then we don't want this article.
6735 (when (and gnus-summary-expunge-below
6737 (or (cdr (assq number gnus-newsgroup-scored))
6738 gnus-summary-default-score))
6739 gnus-summary-expunge-below))
6740 ;; We increase the expunge-tally here, but that has
6741 ;; nothing to do with the limits, really.
6742 (incf gnus-newsgroup-expunged-tally)
6743 ;; We also mark as read here, if that's wanted.
6744 (when (and gnus-summary-mark-below
6745 (< score gnus-summary-mark-below))
6746 (setq gnus-newsgroup-unreads
6747 (delq number gnus-newsgroup-unreads))
6748 (if gnus-newsgroup-auto-expire
6749 (push number gnus-newsgroup-expirable)
6750 (push (cons number gnus-low-score-mark)
6751 gnus-newsgroup-reads)))
6753 ;; Check NoCeM things.
6754 (if (and gnus-use-nocem
6755 (gnus-nocem-unwanted-article-p
6756 (mail-header-id (car thread))))
6758 (setq gnus-newsgroup-unreads
6759 (delq number gnus-newsgroup-unreads))
6761 ;; Nope, invisible article.
6763 ;; Ok, this article is to be visible, so we add it to the limit
6765 (push number gnus-newsgroup-limit)
6768 (defun gnus-expunge-thread (thread)
6769 "Mark all articles in THREAD as read."
6770 (let* ((number (mail-header-number (car thread))))
6771 (incf gnus-newsgroup-expunged-tally)
6772 ;; We also mark as read here, if that's wanted.
6773 (setq gnus-newsgroup-unreads
6774 (delq number gnus-newsgroup-unreads))
6775 (if gnus-newsgroup-auto-expire
6776 (push number gnus-newsgroup-expirable)
6777 (push (cons number gnus-low-score-mark)
6778 gnus-newsgroup-reads)))
6779 ;; Go recursively through all subthreads.
6780 (mapcar 'gnus-expunge-thread (cdr thread)))
6782 ;; Summary article oriented commands
6784 (defun gnus-summary-refer-parent-article (n)
6785 "Refer parent article N times.
6786 If N is negative, go to ancestor -N instead.
6787 The difference between N and the number of articles fetched is returned."
6791 (when (not (natnump n))
6796 (setq header (gnus-summary-article-header))
6797 (if (and (eq (mail-header-number header)
6798 (cdr gnus-article-current))
6799 (equal gnus-newsgroup-name
6800 (car gnus-article-current)))
6801 ;; If we try to find the parent of the currently
6802 ;; displayed article, then we take a look at the actual
6803 ;; References header, since this is slightly more
6804 ;; reliable than the References field we got from the
6807 (set-buffer gnus-original-article-buffer)
6808 (nnheader-narrow-to-headers)
6809 (unless (setq ref (message-fetch-field "references"))
6810 (setq ref (message-fetch-field "in-reply-to")))
6813 ;; It's not the current article, so we take a bet on
6814 ;; the value we got from the server.
6815 (mail-header-references header)))
6817 (not (equal ref "")))
6818 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6819 (gnus-message 1 "Couldn't find parent"))
6820 (gnus-message 1 "No references in article %d"
6821 (gnus-summary-article-number))
6824 (gnus-summary-position-point)
6827 (defun gnus-summary-refer-references ()
6828 "Fetch all articles mentioned in the References header.
6829 Return the number of articles fetched."
6831 (let ((ref (mail-header-references (gnus-summary-article-header)))
6832 (current (gnus-summary-article-number))
6836 (error "No References in the current article")
6837 ;; For each Message-ID in the References header...
6838 (while (string-match "<[^>]*>" ref)
6840 ;; ... fetch that article.
6841 (gnus-summary-refer-article
6842 (prog1 (match-string 0 ref)
6843 (setq ref (substring ref (match-end 0))))))
6844 (gnus-summary-goto-subject current)
6845 (gnus-summary-position-point)
6848 (defun gnus-summary-refer-thread (&optional limit)
6849 "Fetch all articles in the current thread.
6850 If LIMIT (the numerical prefix), fetch that many old headers instead
6851 of what's specified by the `gnus-refer-thread-limit' variable."
6853 (let ((id (mail-header-id (gnus-summary-article-header)))
6854 (limit (if limit (prefix-numeric-value limit)
6855 gnus-refer-thread-limit)))
6856 ;; We want to fetch LIMIT *old* headers, but we also have to
6857 ;; re-fetch all the headers in the current buffer, because many of
6858 ;; them may be undisplayed. So we adjust LIMIT.
6859 (when (numberp limit)
6860 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6861 (unless (eq gnus-fetch-old-headers 'invisible)
6862 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6863 ;; Retrieve the headers and read them in.
6864 (if (eq (gnus-retrieve-headers
6865 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6867 (gnus-build-all-threads)
6868 (error "Can't fetch thread from backends that don't support NOV"))
6869 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6870 (gnus-summary-limit-include-thread id)))
6872 (defun gnus-summary-refer-article (message-id)
6873 "Fetch an article specified by MESSAGE-ID."
6874 (interactive "sMessage-ID: ")
6875 (when (and (stringp message-id)
6876 (not (zerop (length message-id))))
6877 ;; Construct the correct Message-ID if necessary.
6878 ;; Suggested by tale@pawl.rpi.edu.
6879 (unless (string-match "^<" message-id)
6880 (setq message-id (concat "<" message-id)))
6881 (unless (string-match ">$" message-id)
6882 (setq message-id (concat message-id ">")))
6883 (let* ((header (gnus-id-to-header message-id))
6885 (gnus-summary-article-sparse-p
6886 (mail-header-number header))
6887 (memq (mail-header-number header)
6888 gnus-newsgroup-limit)))
6891 ;; If the article is present in the buffer we just go to it.
6893 (or (not (gnus-summary-article-sparse-p
6894 (mail-header-number header)))
6897 (gnus-summary-goto-article
6898 (mail-header-number header) nil t)
6900 (gnus-summary-update-article (mail-header-number header)))))
6902 ;; We fetch the article.
6904 (dolist (gnus-override-method (gnus-refer-article-methods))
6905 (gnus-check-server gnus-override-method)
6906 ;; Fetch the header, and display the article.
6907 (when (setq number (gnus-summary-insert-subject message-id))
6908 (gnus-summary-select-article nil nil nil number)
6910 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
6912 (defun gnus-refer-article-methods ()
6913 "Return a list of referrable methods."
6915 ;; No method, so we default to current and native.
6916 ((null gnus-refer-article-method)
6917 (list gnus-current-select-method gnus-select-method))
6919 ((eq 'current gnus-refer-article-method)
6920 (list gnus-current-select-method))
6921 ;; List of select methods.
6922 ((not (and (symbolp (car gnus-refer-article-method))
6923 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
6925 (dolist (method gnus-refer-article-method)
6926 (push (if (eq 'current method)
6927 gnus-current-select-method
6931 ;; One single select method.
6933 (list gnus-refer-article-method))))
6935 (defun gnus-summary-edit-parameters ()
6936 "Edit the group parameters of the current group."
6938 (gnus-group-edit-group gnus-newsgroup-name 'params))
6940 (defun gnus-summary-customize-parameters ()
6941 "Customize the group parameters of the current group."
6943 (gnus-group-customize gnus-newsgroup-name))
6945 (defun gnus-summary-enter-digest-group (&optional force)
6946 "Enter an nndoc group based on the current article.
6947 If FORCE, force a digest interpretation. If not, try
6948 to guess what the document format is."
6950 (let ((conf gnus-current-window-configuration))
6952 (gnus-summary-select-article))
6953 (setq gnus-current-window-configuration conf)
6954 (let* ((name (format "%s-%d"
6955 (gnus-group-prefixed-name
6956 gnus-newsgroup-name (list 'nndoc ""))
6958 (set-buffer gnus-summary-buffer)
6959 gnus-current-article)))
6960 (ogroup gnus-newsgroup-name)
6961 (params (append (gnus-info-params (gnus-get-info ogroup))
6962 (list (cons 'to-group ogroup))
6963 (list (cons 'save-article-group ogroup))))
6964 (case-fold-search t)
6965 (buf (current-buffer))
6968 (set-buffer gnus-original-article-buffer)
6969 ;; Have the digest group inherit the main mail address of
6970 ;; the parent article.
6971 (when (setq to-address (or (message-fetch-field "reply-to")
6972 (message-fetch-field "from")))
6973 (setq params (append
6974 (list (cons 'to-address
6975 (funcall gnus-decode-encoded-word-function
6977 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6978 (insert-buffer-substring gnus-original-article-buffer)
6979 ;; Remove lines that may lead nndoc to misinterpret the
6982 (goto-char (point-min))
6983 (or (search-forward "\n\n" nil t) (point)))
6984 (goto-char (point-min))
6985 (delete-matching-lines "^Path:\\|^From ")
6988 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
6989 (gnus-newsgroup-ephemeral-ignored-charsets
6990 gnus-newsgroup-ignored-charsets))
6991 (gnus-group-read-ephemeral-group
6992 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6994 ,(if force 'mbox 'guess))) t))
6995 ;; Make all postings to this group go to the parent group.
6996 (nconc (gnus-info-params (gnus-get-info name))
6998 ;; Couldn't select this doc group.
6999 (switch-to-buffer buf)
7000 (gnus-set-global-variables)
7001 (gnus-configure-windows 'summary)
7002 (gnus-message 3 "Article couldn't be entered?"))
7003 (kill-buffer dig)))))
7005 (defun gnus-summary-read-document (n)
7006 "Open a new group based on the current article(s).
7007 This will allow you to read digests and other similar
7008 documents as newsgroups.
7009 Obeys the standard process/prefix convention."
7011 (let* ((articles (gnus-summary-work-articles n))
7012 (ogroup gnus-newsgroup-name)
7013 (params (append (gnus-info-params (gnus-get-info ogroup))
7014 (list (cons 'to-group ogroup))))
7015 article group egroup groups vgroup)
7016 (while (setq article (pop articles))
7017 (setq group (format "%s-%d" gnus-newsgroup-name article))
7018 (gnus-summary-remove-process-mark article)
7019 (when (gnus-summary-display-article article)
7022 (insert-buffer-substring gnus-original-article-buffer)
7023 ;; Remove some headers that may lead nndoc to make
7025 (message-narrow-to-head)
7026 (goto-char (point-min))
7027 (delete-matching-lines "^\\(Path\\):\\|^From ")
7030 (gnus-group-read-ephemeral-group
7031 group `(nndoc ,group (nndoc-address ,(current-buffer))
7032 (nndoc-article-type guess))
7035 ;; Make all postings to this group go to the parent group.
7036 (nconc (gnus-info-params (gnus-get-info egroup))
7038 (push egroup groups))
7039 ;; Couldn't select this doc group.
7040 (gnus-error 3 "Article couldn't be entered"))))))
7041 ;; Now we have selected all the documents.
7044 (error "None of the articles could be interpreted as documents"))
7045 ((gnus-group-read-ephemeral-group
7046 (setq vgroup (format
7047 "nnvirtual:%s-%s" gnus-newsgroup-name
7048 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
7049 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
7051 (cons (current-buffer) 'summary)))
7053 (error "Couldn't select virtual nndoc group")))))
7055 (defun gnus-summary-isearch-article (&optional regexp-p)
7056 "Do incremental search forward on the current article.
7057 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
7059 (gnus-summary-select-article)
7060 (gnus-configure-windows 'article)
7061 (gnus-eval-in-buffer-window gnus-article-buffer
7064 (isearch-forward regexp-p))))
7066 (defun gnus-summary-search-article-forward (regexp &optional backward)
7067 "Search for an article containing REGEXP forward.
7068 If BACKWARD, search backward instead."
7071 (format "Search article %s (regexp%s): "
7072 (if current-prefix-arg "backward" "forward")
7073 (if gnus-last-search-regexp
7074 (concat ", default " gnus-last-search-regexp)
7076 current-prefix-arg))
7077 (if (string-equal regexp "")
7078 (setq regexp (or gnus-last-search-regexp ""))
7079 (setq gnus-last-search-regexp regexp)
7080 (setq gnus-last-article gnus-current-article))
7081 (let ((gnus-last-article gnus-last-article))
7082 ;; Intentionally don't move the last article.
7083 (if (gnus-summary-search-article regexp backward)
7084 (gnus-summary-show-thread)
7085 (error "Search failed: \"%s\"" regexp))))
7087 (defun gnus-summary-search-article-backward (regexp)
7088 "Search for an article containing REGEXP backward."
7091 (format "Search article backward (regexp%s): "
7092 (if gnus-last-search-regexp
7093 (concat ", default " gnus-last-search-regexp)
7095 (gnus-summary-search-article-forward regexp 'backward))
7097 (defun gnus-summary-search-article (regexp &optional backward)
7098 "Search for an article containing REGEXP.
7099 Optional argument BACKWARD means do search for backward.
7100 `gnus-select-article-hook' is not called during the search."
7101 ;; We have to require this here to make sure that the following
7102 ;; dynamic binding isn't shadowed by autoloading.
7103 (require 'gnus-async)
7105 (let ((gnus-select-article-hook nil) ;Disable hook.
7106 (gnus-article-prepare-hook nil)
7107 (gnus-mark-article-hook nil) ;Inhibit marking as read.
7108 (gnus-use-article-prefetch nil)
7109 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
7110 (gnus-use-trees nil) ;Inhibit updating tree buffer.
7111 (sum (current-buffer))
7112 (gnus-display-mime-function nil)
7115 (gnus-save-hidden-threads
7116 (gnus-summary-select-article)
7117 (set-buffer gnus-article-buffer)
7118 (goto-char (window-point (get-buffer-window (current-buffer))))
7122 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
7124 (re-search-backward regexp nil t)
7125 (re-search-forward regexp nil t))
7126 ;; We found the regexp.
7131 (get-buffer-window (current-buffer))
7135 (get-buffer-window (current-buffer))
7138 (setq point (point)))
7139 ;; We didn't find it, so we go to the next article.
7142 (while (eq found 'not)
7143 (if (not (if backward (gnus-summary-find-prev)
7144 (gnus-summary-find-next)))
7145 ;; No more articles.
7147 ;; Select the next article and adjust point.
7148 (unless (gnus-summary-article-sparse-p
7149 (gnus-summary-article-number))
7151 (gnus-summary-select-article)
7152 (set-buffer gnus-article-buffer)
7154 (goto-char (if backward (point-max) (point-min))))))))
7155 (gnus-message 7 ""))
7156 ;; Return whether we found the regexp.
7157 (when (eq found 'found)
7159 (gnus-summary-show-thread)
7160 (gnus-summary-goto-subject gnus-current-article)
7161 (gnus-summary-position-point)
7164 (defun gnus-summary-find-matching (header regexp &optional backward unread
7166 "Return a list of all articles that match REGEXP on HEADER.
7167 The search stars on the current article and goes forwards unless
7168 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
7169 If UNREAD is non-nil, only unread articles will
7170 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
7171 in the comparisons."
7172 (let ((data (if (eq backward 'all) gnus-newsgroup-data
7173 (gnus-data-find-list
7174 (gnus-summary-article-number) (gnus-data-list backward))))
7175 (case-fold-search (not not-case-fold))
7178 (if (eq (car header) 'extra)
7181 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
7183 (error "%s is an invalid header" header))
7184 (unless (fboundp (intern (concat "mail-header-" header)))
7185 (error "%s is not a valid header" header))
7186 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
7189 (and (or (not unread) ; We want all articles...
7190 (gnus-data-unread-p d)) ; Or just unreads.
7191 (vectorp (gnus-data-header d)) ; It's not a pseudo.
7192 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
7193 (push (gnus-data-number d) articles)) ; Success!
7194 (setq data (cdr data)))
7195 (nreverse articles)))
7197 (defun gnus-summary-execute-command (header regexp command &optional backward)
7198 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
7199 If HEADER is an empty string (or nil), the match is done on the entire
7200 article. If BACKWARD (the prefix) is non-nil, search backward instead."
7202 (list (let ((completion-ignore-case t))
7205 (mapcar (lambda (string) (list string))
7206 '("Number" "Subject" "From" "Lines" "Date"
7207 "Message-ID" "Xref" "References" "Body"))
7208 nil 'require-match))
7209 (read-string "Regexp: ")
7210 (read-key-sequence "Command: ")
7211 current-prefix-arg))
7212 (when (equal header "Body")
7214 ;; Hidden thread subtrees must be searched as well.
7215 (gnus-summary-show-all-threads)
7216 ;; We don't want to change current point nor window configuration.
7218 (save-window-excursion
7219 (gnus-message 6 "Executing %s..." (key-description command))
7220 ;; We'd like to execute COMMAND interactively so as to give arguments.
7221 (gnus-execute header regexp
7222 `(call-interactively ',(key-binding command))
7224 (gnus-message 6 "Executing %s...done" (key-description command)))))
7226 (defun gnus-summary-beginning-of-article ()
7227 "Scroll the article back to the beginning."
7229 (gnus-summary-select-article)
7230 (gnus-configure-windows 'article)
7231 (gnus-eval-in-buffer-window gnus-article-buffer
7233 (goto-char (point-min))
7234 (when gnus-page-broken
7235 (gnus-narrow-to-page))))
7237 (defun gnus-summary-end-of-article ()
7238 "Scroll to the end of the article."
7240 (gnus-summary-select-article)
7241 (gnus-configure-windows 'article)
7242 (gnus-eval-in-buffer-window gnus-article-buffer
7244 (goto-char (point-max))
7246 (when gnus-page-broken
7247 (gnus-narrow-to-page))))
7249 (defun gnus-summary-print-article (&optional filename n)
7250 "Generate and print a PostScript image of the N next (mail) articles.
7252 If N is negative, print the N previous articles. If N is nil and articles
7253 have been marked with the process mark, print these instead.
7255 If the optional first argument FILENAME is nil, send the image to the
7256 printer. If FILENAME is a string, save the PostScript image in a file with
7257 that name. If FILENAME is a number, prompt the user for the name of the file
7259 (interactive (list (ps-print-preprint current-prefix-arg)
7260 current-prefix-arg))
7261 (dolist (article (gnus-summary-work-articles n))
7262 (gnus-summary-select-article nil nil 'pseudo article)
7263 (gnus-eval-in-buffer-window gnus-article-buffer
7264 (let ((buffer (generate-new-buffer " *print*")))
7267 (copy-to-buffer buffer (point-min) (point-max))
7269 (gnus-article-delete-invisible-text)
7270 (let ((ps-left-header
7273 (mail-header-subject gnus-current-headers) ")")
7275 (mail-header-from gnus-current-headers) ")")))
7278 "/pagenumberstring load"
7280 (mail-header-date gnus-current-headers) ")"))))
7281 (gnus-run-hooks 'gnus-ps-print-hook)
7283 (ps-print-buffer-with-faces filename))))
7284 (kill-buffer buffer))))))
7286 (defun gnus-summary-show-article (&optional arg)
7287 "Force re-fetching of the current article.
7288 If ARG (the prefix) is a number, show the article with the charset
7289 defined in `gnus-summary-show-article-charset-alist', or the charset
7291 If ARG (the prefix) is non-nil and not a number, show the raw article
7292 without any article massaging functions being run."
7296 (let ((gnus-newsgroup-charset
7297 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
7298 (read-coding-system "Charset: ")))
7299 (gnus-newsgroup-ignored-charsets 'gnus-all))
7300 (gnus-summary-select-article nil 'force)
7301 (let ((deps gnus-newsgroup-dependencies)
7304 (set-buffer gnus-original-article-buffer)
7306 (message-narrow-to-head)
7307 (setq head (buffer-string)))
7309 (insert (format "211 %d Article retrieved.\n"
7310 (cdr gnus-article-current)))
7313 (let ((nntp-server-buffer (current-buffer)))
7314 (setq header (car (gnus-get-newsgroup-headers deps t))))))
7315 (gnus-data-set-header
7316 (gnus-data-find (cdr gnus-article-current))
7318 (gnus-summary-update-article-line
7319 (cdr gnus-article-current) header))))
7321 ;; Select the article the normal way.
7322 (gnus-summary-select-article nil 'force))
7324 ;; We have to require this here to make sure that the following
7325 ;; dynamic binding isn't shadowed by autoloading.
7326 (require 'gnus-async)
7328 ;; Bind the article treatment functions to nil.
7329 (let ((gnus-have-all-headers t)
7330 gnus-article-prepare-hook
7331 gnus-article-decode-hook
7332 gnus-display-mime-function
7334 ;; Destroy any MIME parts.
7335 (when (gnus-buffer-live-p gnus-article-buffer)
7337 (set-buffer gnus-article-buffer)
7338 (mm-destroy-parts gnus-article-mime-handles)
7339 ;; Set it to nil for safety reason.
7340 (setq gnus-article-mime-handle-alist nil)
7341 (setq gnus-article-mime-handles nil)))
7342 (gnus-summary-select-article nil 'force))))
7343 (gnus-summary-goto-subject gnus-current-article)
7344 (gnus-summary-position-point))
7346 (defun gnus-summary-verbose-headers (&optional arg)
7347 "Toggle permanent full header display.
7348 If ARG is a positive number, turn header display on.
7349 If ARG is a negative number, turn header display off."
7351 (setq gnus-show-all-headers
7352 (cond ((or (not (numberp arg))
7354 (not gnus-show-all-headers))
7357 (gnus-summary-show-article))
7359 (defun gnus-summary-toggle-header (&optional arg)
7360 "Show the headers if they are hidden, or hide them if they are shown.
7361 If ARG is a positive number, show the entire header.
7362 If ARG is a negative number, hide the unwanted header lines."
7365 (set-buffer gnus-article-buffer)
7367 (let* ((buffer-read-only nil)
7368 (inhibit-point-motion-hooks t)
7374 (article-narrow-to-head)
7375 (gnus-article-hidden-text-p 'headers))))
7376 (goto-char (point-min))
7377 (when (search-forward "\n\n" nil t)
7378 (delete-region (point-min) (1- (point))))
7379 (goto-char (point-min))
7381 (set-buffer gnus-original-article-buffer)
7382 (goto-char (point-min))
7383 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7384 (insert-buffer-substring gnus-original-article-buffer 1 e)
7386 (narrow-to-region (point-min) (point))
7387 (article-decode-encoded-words)
7389 (let ((gnus-treat-hide-headers nil)
7390 (gnus-treat-hide-boring-headers nil))
7391 (setq gnus-article-wash-types
7392 (delq 'headers gnus-article-wash-types))
7393 (gnus-treat-article 'head))
7394 (gnus-treat-article 'head)))
7395 (gnus-set-mode-line 'article)))))
7397 (defun gnus-summary-show-all-headers ()
7398 "Make all header lines visible."
7400 (gnus-article-show-all-headers))
7402 (defun gnus-summary-caesar-message (&optional arg)
7403 "Caesar rotate the current article by 13.
7404 The numerical prefix specifies how many places to rotate each letter
7407 (gnus-summary-select-article)
7408 (let ((mail-header-separator ""))
7409 (gnus-eval-in-buffer-window gnus-article-buffer
7412 (let ((start (window-start))
7414 (message-caesar-buffer-body arg)
7415 (set-window-start (get-buffer-window (current-buffer)) start))))))
7417 (defun gnus-summary-stop-page-breaking ()
7418 "Stop page breaking in the current article."
7420 (gnus-summary-select-article)
7421 (gnus-eval-in-buffer-window gnus-article-buffer
7423 (when (gnus-visual-p 'page-marker)
7424 (let ((buffer-read-only nil))
7425 (gnus-remove-text-with-property 'gnus-prev)
7426 (gnus-remove-text-with-property 'gnus-next))
7427 (setq gnus-page-broken nil))))
7429 (defun gnus-summary-move-article (&optional n to-newsgroup
7430 select-method action)
7431 "Move the current article to a different newsgroup.
7432 If N is a positive number, move the N next articles.
7433 If N is a negative number, move the N previous articles.
7434 If N is nil and any articles have been marked with the process mark,
7435 move those articles instead.
7436 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7437 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7438 re-spool using this method.
7440 For this function to work, both the current newsgroup and the
7441 newsgroup that you want to move to have to support the `request-move'
7442 and `request-accept' functions.
7444 ACTION can be either `move' (the default), `crosspost' or `copy'."
7447 (setq action 'move))
7448 ;; Disable marking as read.
7449 (let (gnus-mark-article-hook)
7450 (save-window-excursion
7451 (gnus-summary-select-article)))
7452 ;; Check whether the source group supports the required functions.
7453 (cond ((and (eq action 'move)
7454 (not (gnus-check-backend-function
7455 'request-move-article gnus-newsgroup-name)))
7456 (error "The current group does not support article moving"))
7457 ((and (eq action 'crosspost)
7458 (not (gnus-check-backend-function
7459 'request-replace-article gnus-newsgroup-name)))
7460 (error "The current group does not support article editing")))
7461 (let ((articles (gnus-summary-work-articles n))
7462 (prefix (if (gnus-check-backend-function
7463 'request-move-article gnus-newsgroup-name)
7464 (gnus-group-real-prefix gnus-newsgroup-name)
7466 (names '((move "Move" "Moving")
7467 (copy "Copy" "Copying")
7468 (crosspost "Crosspost" "Crossposting")))
7469 (copy-buf (save-excursion
7470 (nnheader-set-temp-buffer " *copy article*")))
7471 art-group to-method new-xref article to-groups)
7472 (unless (assq action names)
7473 (error "Unknown action %s" action))
7474 ;; Read the newsgroup name.
7475 (when (and (not to-newsgroup)
7476 (not select-method))
7478 (gnus-read-move-group-name
7479 (cadr (assq action names))
7480 (symbol-value (intern (format "gnus-current-%s-group" action)))
7482 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7483 (setq to-method (or select-method
7484 (gnus-server-to-method
7485 (gnus-group-method to-newsgroup))))
7486 ;; Check the method we are to move this article to...
7487 (unless (gnus-check-backend-function
7488 'request-accept-article (car to-method))
7489 (error "%s does not support article copying" (car to-method)))
7490 (unless (gnus-check-server to-method)
7491 (error "Can't open server %s" (car to-method)))
7492 (gnus-message 6 "%s to %s: %s..."
7493 (caddr (assq action names))
7494 (or (car select-method) to-newsgroup) articles)
7496 (setq article (pop articles))
7500 ;; Move the article.
7502 ;; Remove this article from future suppression.
7503 (gnus-dup-unsuppress-article article)
7504 (gnus-request-move-article
7505 article ; Article to move
7506 gnus-newsgroup-name ; From newsgroup
7507 (nth 1 (gnus-find-method-for-group
7508 gnus-newsgroup-name)) ; Server
7509 (list 'gnus-request-accept-article
7510 to-newsgroup (list 'quote select-method)
7511 (not articles) t) ; Accept form
7512 (not articles))) ; Only save nov last time
7513 ;; Copy the article.
7516 (set-buffer copy-buf)
7517 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7518 (gnus-request-accept-article
7519 to-newsgroup select-method (not articles) t))))
7520 ;; Crosspost the article.
7521 ((eq action 'crosspost)
7522 (let ((xref (message-tokenize-header
7523 (mail-header-xref (gnus-summary-article-header article))
7525 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7528 (setq xref (list (system-name))))
7531 (mapconcat 'identity
7532 (delete "Xref:" (delete new-xref xref))
7536 (set-buffer copy-buf)
7537 ;; First put the article in the destination group.
7538 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7539 (when (consp (setq art-group
7540 (gnus-request-accept-article
7541 to-newsgroup select-method (not articles))))
7542 (setq new-xref (concat new-xref " " (car art-group)
7543 ":" (cdr art-group)))
7544 ;; Now we have the new Xrefs header, so we insert
7545 ;; it and replace the new article.
7546 (nnheader-replace-header "Xref" new-xref)
7547 (gnus-request-replace-article
7548 (cdr art-group) to-newsgroup (current-buffer))
7552 (gnus-message 1 "Couldn't %s article %s: %s"
7553 (cadr (assq action names)) article
7554 (nnheader-get-report (car to-method))))
7555 ((eq art-group 'junk)
7556 (when (eq action 'move)
7557 (gnus-summary-mark-article article gnus-canceled-mark)
7558 (gnus-message 4 "Deleted article %s" article)))
7560 (let* ((pto-group (gnus-group-prefixed-name
7561 (car art-group) to-method))
7563 (gnus-gethash pto-group gnus-newsrc-hashtb))
7564 (info (nth 2 entry))
7565 (to-group (gnus-info-group info))
7567 ;; Update the group that has been moved to.
7569 (memq action '(move copy)))
7570 (unless (member to-group to-groups)
7571 (push to-group to-groups))
7573 (unless (memq article gnus-newsgroup-unreads)
7574 (push 'read to-marks)
7576 info (gnus-add-to-range (gnus-info-read info)
7577 (list (cdr art-group)))))
7579 ;; See whether the article is to be put in the cache.
7580 (let ((marks gnus-article-mark-lists)
7581 (to-article (cdr art-group)))
7583 ;; Enter the article into the cache in the new group,
7584 ;; if that is required.
7585 (when gnus-use-cache
7586 (gnus-cache-possibly-enter-article
7588 (memq article gnus-newsgroup-marked)
7589 (memq article gnus-newsgroup-dormant)
7590 (memq article gnus-newsgroup-unreads)))
7592 (when gnus-preserve-marks
7593 ;; Copy any marks over to the new group.
7594 (when (and (equal to-group gnus-newsgroup-name)
7595 (not (memq article gnus-newsgroup-unreads)))
7596 ;; Mark this article as read in this group.
7597 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7598 (setcdr (gnus-active to-group) to-article)
7599 (setcdr gnus-newsgroup-active to-article))
7602 (when (memq article (symbol-value
7603 (intern (format "gnus-newsgroup-%s"
7605 (push (cdar marks) to-marks)
7606 ;; If the other group is the same as this group,
7607 ;; then we have to add the mark to the list.
7608 (when (equal to-group gnus-newsgroup-name)
7609 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7612 (intern (format "gnus-newsgroup-%s"
7614 ;; Copy the marks to other group.
7615 (gnus-add-marked-articles
7616 to-group (cdar marks) (list to-article) info))
7617 (setq marks (cdr marks)))
7619 (gnus-request-set-mark to-group (list (list (list to-article)
7624 (concat "(gnus-group-set-info '"
7625 (gnus-prin1-to-string (gnus-get-info to-group))
7628 ;; Update the Xref header in this article to point to
7629 ;; the new crossposted article we have just created.
7630 (when (eq action 'crosspost)
7632 (set-buffer copy-buf)
7633 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7634 (nnheader-replace-header "Xref" new-xref)
7635 (gnus-request-replace-article
7636 article gnus-newsgroup-name (current-buffer)))))
7638 ;;;!!!Why is this necessary?
7639 (set-buffer gnus-summary-buffer)
7641 (gnus-summary-goto-subject article)
7642 (when (eq action 'move)
7643 (gnus-summary-mark-article article gnus-canceled-mark))))
7644 (gnus-summary-remove-process-mark article))
7645 ;; Re-activate all groups that have been moved to.
7648 (set-buffer gnus-group-buffer)
7649 (when (gnus-group-goto-group (car to-groups) t)
7650 (gnus-group-get-new-news-this-group 1 t))
7653 (gnus-kill-buffer copy-buf)
7654 (gnus-summary-position-point)
7655 (gnus-set-mode-line 'summary)))
7657 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7658 "Move the current article to a different newsgroup.
7659 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7660 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7661 re-spool using this method."
7663 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7665 (defun gnus-summary-crosspost-article (&optional n)
7666 "Crosspost the current article to some other group."
7668 (gnus-summary-move-article n nil nil 'crosspost))
7670 (defcustom gnus-summary-respool-default-method nil
7671 "Default method for respooling an article.
7672 If nil, use to the current newsgroup method."
7673 :type '(choice (gnus-select-method :value (nnml ""))
7675 :group 'gnus-summary-mail)
7677 (defun gnus-summary-respool-article (&optional n method)
7678 "Respool the current article.
7679 The article will be squeezed through the mail spooling process again,
7680 which means that it will be put in some mail newsgroup or other
7681 depending on `nnmail-split-methods'.
7682 If N is a positive number, respool the N next articles.
7683 If N is a negative number, respool the N previous articles.
7684 If N is nil and any articles have been marked with the process mark,
7685 respool those articles instead.
7687 Respooling can be done both from mail groups and \"real\" newsgroups.
7688 In the former case, the articles in question will be moved from the
7689 current group into whatever groups they are destined to. In the
7690 latter case, they will be copied into the relevant groups."
7692 (list current-prefix-arg
7693 (let* ((methods (gnus-methods-using 'respool))
7695 (symbol-name (or gnus-summary-respool-default-method
7696 (car (gnus-find-method-for-group
7697 gnus-newsgroup-name)))))
7699 (gnus-completing-read
7700 methname "What backend do you want to use when respooling?"
7701 methods nil t nil 'gnus-mail-method-history))
7704 ((zerop (length (setq ms (gnus-servers-using-backend
7706 (list (intern method) ""))
7710 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7711 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7714 (error "No method given for respooling"))
7715 (if (assoc (symbol-name
7716 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7717 (gnus-methods-using 'respool))
7718 (gnus-summary-move-article n nil method)
7719 (gnus-summary-copy-article n nil method)))
7721 (defun gnus-summary-import-article (file)
7722 "Import an arbitrary file into a mail newsgroup."
7723 (interactive "fImport file: ")
7724 (let ((group gnus-newsgroup-name)
7725 (now (current-time))
7727 (unless (gnus-check-backend-function 'request-accept-article group)
7728 (error "%s does not support article importing" group))
7729 (or (file-readable-p file)
7730 (not (file-regular-p file))
7731 (error "Can't read %s" file))
7733 (set-buffer (gnus-get-buffer-create " *import file*"))
7735 (nnheader-insert-file-contents file)
7736 (goto-char (point-min))
7737 (unless (nnheader-article-p)
7738 ;; This doesn't look like an article, so we fudge some headers.
7739 (setq atts (file-attributes file)
7740 lines (count-lines (point-min) (point-max)))
7741 (insert "From: " (read-string "From: ") "\n"
7742 "Subject: " (read-string "Subject: ") "\n"
7743 "Date: " (message-make-date (nth 5 atts))
7745 "Message-ID: " (message-make-message-id) "\n"
7746 "Lines: " (int-to-string lines) "\n"
7747 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7748 (gnus-request-accept-article group nil t)
7749 (kill-buffer (current-buffer)))))
7751 (defun gnus-summary-article-posted-p ()
7752 "Say whether the current (mail) article is available from news as well.
7753 This will be the case if the article has both been mailed and posted."
7755 (let ((id (mail-header-references (gnus-summary-article-header)))
7756 (gnus-override-method (car (gnus-refer-article-methods))))
7757 (if (gnus-request-head id "")
7758 (gnus-message 2 "The current message was found on %s"
7759 gnus-override-method)
7760 (gnus-message 2 "The current message couldn't be found on %s"
7761 gnus-override-method)
7764 (defun gnus-summary-expire-articles (&optional now)
7765 "Expire all articles that are marked as expirable in the current group."
7767 (when (gnus-check-backend-function
7768 'request-expire-articles gnus-newsgroup-name)
7769 ;; This backend supports expiry.
7770 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7771 (expirable (if total
7773 ;; We need to update the info for
7774 ;; this group for `gnus-list-of-read-articles'
7775 ;; to give us the right answer.
7776 (gnus-run-hooks 'gnus-exit-group-hook)
7777 (gnus-summary-update-info)
7778 (gnus-list-of-read-articles gnus-newsgroup-name))
7779 (setq gnus-newsgroup-expirable
7780 (sort gnus-newsgroup-expirable '<))))
7781 (expiry-wait (if now 'immediate
7782 (gnus-group-find-parameter
7783 gnus-newsgroup-name 'expiry-wait)))
7784 (nnmail-expiry-target
7785 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
7786 nnmail-expiry-target))
7789 ;; There are expirable articles in this group, so we run them
7790 ;; through the expiry process.
7791 (gnus-message 6 "Expiring articles...")
7792 (unless (gnus-check-group gnus-newsgroup-name)
7793 (error "Can't open server for %s" gnus-newsgroup-name))
7794 ;; The list of articles that weren't expired is returned.
7797 (let ((nnmail-expiry-wait-function nil)
7798 (nnmail-expiry-wait expiry-wait))
7799 (setq es (gnus-request-expire-articles
7800 expirable gnus-newsgroup-name)))
7801 (setq es (gnus-request-expire-articles
7802 expirable gnus-newsgroup-name)))
7804 (setq gnus-newsgroup-expirable es))
7805 ;; We go through the old list of expirable, and mark all
7806 ;; really expired articles as nonexistent.
7807 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7808 (let ((gnus-use-cache nil))
7810 (unless (memq (car expirable) es)
7811 (when (gnus-data-find (car expirable))
7812 (gnus-summary-mark-article
7813 (car expirable) gnus-canceled-mark)))
7814 (setq expirable (cdr expirable))))))
7815 (gnus-message 6 "Expiring articles...done")))))
7817 (defun gnus-summary-expire-articles-now ()
7818 "Expunge all expirable articles in the current group.
7819 This means that *all* articles that are marked as expirable will be
7820 deleted forever, right now."
7822 (or gnus-expert-user
7824 "Are you really, really, really sure you want to delete all these messages? ")
7826 (gnus-summary-expire-articles t))
7828 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7829 (defun gnus-summary-delete-article (&optional n)
7830 "Delete the N next (mail) articles.
7831 This command actually deletes articles. This is not a marking
7832 command. The article will disappear forever from your life, never to
7834 If N is negative, delete backwards.
7835 If N is nil and articles have been marked with the process mark,
7836 delete these instead."
7838 (unless (gnus-check-backend-function 'request-expire-articles
7839 gnus-newsgroup-name)
7840 (error "The current newsgroup does not support article deletion"))
7841 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
7842 (error "Couldn't open server"))
7843 ;; Compute the list of articles to delete.
7844 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7846 (if (and gnus-novice-user
7847 (not (gnus-yes-or-no-p
7848 (format "Do you really want to delete %s forever? "
7849 (if (> (length articles) 1)
7850 (format "these %s articles" (length articles))
7853 ;; Delete the articles.
7854 (setq not-deleted (gnus-request-expire-articles
7855 articles gnus-newsgroup-name 'force))
7857 (gnus-summary-remove-process-mark (car articles))
7858 ;; The backend might not have been able to delete the article
7860 (unless (memq (car articles) not-deleted)
7861 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7862 (setq articles (cdr articles)))
7864 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7865 (gnus-summary-position-point)
7866 (gnus-set-mode-line 'summary)
7869 (defun gnus-summary-edit-article (&optional arg)
7870 "Edit the current article.
7871 This will have permanent effect only in mail groups.
7872 If ARG is nil, edit the decoded articles.
7873 If ARG is 1, edit the raw articles.
7874 If ARG is 2, edit the raw articles even in read-only groups.
7875 Otherwise, allow editing of articles even in read-only
7881 ((eq arg 1) (setq raw t))
7882 ((eq arg 2) (setq raw t
7885 (if (and raw (not force) (equal gnus-newsgroup-name "nndraft:drafts"))
7886 (error "Can't edit the raw article in group nndraft:drafts."))
7888 (set-buffer gnus-summary-buffer)
7889 (let ((mail-parse-charset gnus-newsgroup-charset)
7890 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
7891 (gnus-set-global-variables)
7892 (when (and (not force)
7893 (gnus-group-read-only-p))
7894 (error "The current newsgroup does not support article editing"))
7895 (gnus-summary-show-article t)
7896 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
7897 (with-current-buffer gnus-article-buffer
7898 (mm-enable-multibyte-mule4)))
7899 (if (equal gnus-newsgroup-name "nndraft:drafts")
7901 (gnus-article-edit-article
7904 (let ((mbl mml-buffer-list))
7905 (setq mml-buffer-list nil)
7907 (make-local-hook 'kill-buffer-hook)
7908 (let ((mbl1 mml-buffer-list))
7909 (setq mml-buffer-list mbl)
7910 (set (make-local-variable 'mml-buffer-list) mbl1))
7911 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
7912 `(lambda (no-highlight)
7913 (let ((mail-parse-charset ',gnus-newsgroup-charset)
7914 (message-options message-options)
7915 (message-options-set-recipient)
7916 (mail-parse-ignored-charsets
7917 ',gnus-newsgroup-ignored-charsets))
7918 ,(if (not raw) '(progn
7920 (mml-destroy-buffers)
7921 (remove-hook 'kill-buffer-hook
7922 'mml-destroy-buffers t)
7923 (kill-local-variable 'mml-buffer-list)))
7924 (gnus-summary-edit-article-done
7925 ,(or (mail-header-references gnus-current-headers) "")
7926 ,(gnus-group-read-only-p)
7927 ,gnus-summary-buffer no-highlight))))))))
7929 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7931 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7933 "Make edits to the current article permanent."
7936 ;; The buffer restriction contains the entire article if it exists.
7937 (when (article-goto-body)
7938 (let ((lines (count-lines (point) (point-max)))
7939 (length (- (point-max) (point)))
7940 (case-fold-search t)
7941 (body (copy-marker (point))))
7942 (goto-char (point-min))
7943 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
7944 (delete-region (match-beginning 1) (match-end 1))
7945 (insert (number-to-string length)))
7946 (goto-char (point-min))
7947 (when (re-search-forward
7948 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
7949 (delete-region (match-beginning 1) (match-end 1))
7950 (insert (number-to-string length)))
7951 (goto-char (point-min))
7952 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
7953 (delete-region (match-beginning 1) (match-end 1))
7954 (insert (number-to-string lines))))))
7955 ;; Replace the article.
7956 (let ((buf (current-buffer)))
7958 (insert-buffer-substring buf)
7960 (if (and (not read-only)
7961 (not (gnus-request-replace-article
7962 (cdr gnus-article-current) (car gnus-article-current)
7963 (current-buffer) t)))
7964 (error "Couldn't replace article")
7965 ;; Update the summary buffer.
7967 (equal (message-tokenize-header references " ")
7968 (message-tokenize-header
7969 (or (message-fetch-field "references") "") " ")))
7970 ;; We only have to update this line.
7973 (message-narrow-to-head)
7974 (let ((head (buffer-string))
7977 (insert (format "211 %d Article retrieved.\n"
7978 (cdr gnus-article-current)))
7981 (let ((nntp-server-buffer (current-buffer)))
7982 (setq header (car (gnus-get-newsgroup-headers
7984 (set-buffer gnus-summary-buffer)
7985 gnus-newsgroup-dependencies)
7988 (set-buffer gnus-summary-buffer)
7989 (gnus-data-set-header
7990 (gnus-data-find (cdr gnus-article-current))
7992 (gnus-summary-update-article-line
7993 (cdr gnus-article-current) header))))))
7995 (set-buffer (or buffer gnus-summary-buffer))
7996 (gnus-summary-update-article (cdr gnus-article-current)))
7997 ;; Prettify the article buffer again.
7998 (unless no-highlight
8000 (set-buffer gnus-article-buffer)
8001 ;;;!!! Fix this -- article should be rehighlighted.
8002 ;;;(gnus-run-hooks 'gnus-article-display-hook)
8003 (set-buffer gnus-original-article-buffer)
8004 (gnus-request-article
8005 (cdr gnus-article-current)
8006 (car gnus-article-current) (current-buffer))))
8007 ;; Prettify the summary buffer line.
8008 (when (gnus-visual-p 'summary-highlight 'highlight)
8009 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
8011 (defun gnus-summary-edit-wash (key)
8012 "Perform editing command KEY in the article buffer."
8016 (message "%s" (concat (this-command-keys) "- "))
8019 (gnus-summary-edit-article)
8020 (execute-kbd-macro (concat (this-command-keys) key))
8021 (gnus-article-edit-done))
8025 (defun gnus-summary-respool-query (&optional silent trace)
8026 "Query where the respool algorithm would put this article."
8028 (let (gnus-mark-article-hook)
8029 (gnus-summary-select-article)
8031 (set-buffer gnus-original-article-buffer)
8033 (message-narrow-to-head)
8034 (let ((groups (nnmail-article-group 'identity trace)))
8037 (message "This message would go to %s"
8038 (mapconcat 'car groups ", "))
8039 (message "This message would go to no groups"))
8042 (defun gnus-summary-respool-trace ()
8043 "Trace where the respool algorithm would put this article.
8044 Display a buffer showing all fancy splitting patterns which matched."
8046 (gnus-summary-respool-query nil t))
8048 ;; Summary marking commands.
8050 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
8051 "Mark articles which has the same subject as read, and then select the next.
8052 If UNMARK is positive, remove any kind of mark.
8053 If UNMARK is negative, tick articles."
8056 (setq unmark (prefix-numeric-value unmark)))
8058 (gnus-summary-mark-same-subject
8059 (gnus-summary-article-subject) unmark)))
8060 ;; Select next unread article. If auto-select-same mode, should
8061 ;; select the first unread article.
8062 (gnus-summary-next-article t (and gnus-auto-select-same
8063 (gnus-summary-article-subject)))
8064 (gnus-message 7 "%d article%s marked as %s"
8065 count (if (= count 1) " is" "s are")
8066 (if unmark "unread" "read"))))
8068 (defun gnus-summary-kill-same-subject (&optional unmark)
8069 "Mark articles which has the same subject as read.
8070 If UNMARK is positive, remove any kind of mark.
8071 If UNMARK is negative, tick articles."
8074 (setq unmark (prefix-numeric-value unmark)))
8076 (gnus-summary-mark-same-subject
8077 (gnus-summary-article-subject) unmark)))
8078 ;; If marked as read, go to next unread subject.
8080 ;; Go to next unread subject.
8081 (gnus-summary-next-subject 1 t))
8082 (gnus-message 7 "%d articles are marked as %s"
8083 count (if unmark "unread" "read"))))
8085 (defun gnus-summary-mark-same-subject (subject &optional unmark)
8086 "Mark articles with same SUBJECT as read, and return marked number.
8087 If optional argument UNMARK is positive, remove any kinds of marks.
8088 If optional argument UNMARK is negative, mark articles as unread instead."
8092 ((null unmark) ; Mark as read.
8095 (gnus-summary-mark-article-as-read gnus-killed-mark)
8096 (gnus-summary-show-thread) t)
8097 (gnus-summary-find-subject subject))
8098 (setq count (1+ count))))
8099 ((> unmark 0) ; Tick.
8102 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
8103 (gnus-summary-show-thread) t)
8104 (gnus-summary-find-subject subject))
8105 (setq count (1+ count))))
8106 (t ; Mark as unread.
8109 (gnus-summary-mark-article-as-unread gnus-unread-mark)
8110 (gnus-summary-show-thread) t)
8111 (gnus-summary-find-subject subject))
8112 (setq count (1+ count)))))
8113 (gnus-set-mode-line 'summary)
8114 ;; Return the number of marked articles.
8117 (defun gnus-summary-mark-as-processable (n &optional unmark)
8118 "Set the process mark on the next N articles.
8119 If N is negative, mark backward instead. If UNMARK is non-nil, remove
8120 the process mark instead. The difference between N and the actual
8121 number of articles marked is returned."
8123 (let ((backward (< n 0))
8128 (gnus-summary-remove-process-mark
8129 (gnus-summary-article-number))
8130 (gnus-summary-set-process-mark (gnus-summary-article-number)))
8131 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
8134 (gnus-message 7 "No more articles"))
8135 (gnus-summary-recenter)
8136 (gnus-summary-position-point)
8139 (defun gnus-summary-unmark-as-processable (n)
8140 "Remove the process mark from the next N articles.
8141 If N is negative, unmark backward instead. The difference between N and
8142 the actual number of articles unmarked is returned."
8144 (gnus-summary-mark-as-processable n t))
8146 (defun gnus-summary-unmark-all-processable ()
8147 "Remove the process mark from all articles."
8150 (while gnus-newsgroup-processable
8151 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
8152 (gnus-summary-position-point))
8154 (defun gnus-summary-mark-as-expirable (n)
8155 "Mark N articles forward as expirable.
8156 If N is negative, mark backward instead. The difference between N and
8157 the actual number of articles marked is returned."
8159 (gnus-summary-mark-forward n gnus-expirable-mark))
8161 (defun gnus-summary-mark-article-as-replied (article)
8162 "Mark ARTICLE replied and update the summary line."
8163 (push article gnus-newsgroup-replied)
8164 (let ((buffer-read-only nil))
8165 (when (gnus-summary-goto-subject article nil t)
8166 (gnus-summary-update-secondary-mark article))))
8168 (defun gnus-summary-set-bookmark (article)
8169 "Set a bookmark in current article."
8170 (interactive (list (gnus-summary-article-number)))
8171 (when (or (not (get-buffer gnus-article-buffer))
8172 (not gnus-current-article)
8173 (not gnus-article-current)
8174 (not (equal gnus-newsgroup-name (car gnus-article-current))))
8175 (error "No current article selected"))
8176 ;; Remove old bookmark, if one exists.
8177 (let ((old (assq article gnus-newsgroup-bookmarks)))
8179 (setq gnus-newsgroup-bookmarks
8180 (delq old gnus-newsgroup-bookmarks))))
8181 ;; Set the new bookmark, which is on the form
8182 ;; (article-number . line-number-in-body).
8186 (set-buffer gnus-article-buffer)
8190 (goto-char (point-min))
8191 (search-forward "\n\n" nil t)
8194 gnus-newsgroup-bookmarks)
8195 (gnus-message 6 "A bookmark has been added to the current article."))
8197 (defun gnus-summary-remove-bookmark (article)
8198 "Remove the bookmark from the current article."
8199 (interactive (list (gnus-summary-article-number)))
8200 ;; Remove old bookmark, if one exists.
8201 (let ((old (assq article gnus-newsgroup-bookmarks)))
8204 (setq gnus-newsgroup-bookmarks
8205 (delq old gnus-newsgroup-bookmarks))
8206 (gnus-message 6 "Removed bookmark."))
8207 (gnus-message 6 "No bookmark in current article."))))
8209 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8210 (defun gnus-summary-mark-as-dormant (n)
8211 "Mark N articles forward as dormant.
8212 If N is negative, mark backward instead. The difference between N and
8213 the actual number of articles marked is returned."
8215 (gnus-summary-mark-forward n gnus-dormant-mark))
8217 (defun gnus-summary-set-process-mark (article)
8218 "Set the process mark on ARTICLE and update the summary line."
8219 (setq gnus-newsgroup-processable
8221 (delq article gnus-newsgroup-processable)))
8222 (when (gnus-summary-goto-subject article)
8223 (gnus-summary-show-thread)
8224 (gnus-summary-goto-subject article)
8225 (gnus-summary-update-secondary-mark article)))
8227 (defun gnus-summary-remove-process-mark (article)
8228 "Remove the process mark from ARTICLE and update the summary line."
8229 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
8230 (when (gnus-summary-goto-subject article)
8231 (gnus-summary-show-thread)
8232 (gnus-summary-goto-subject article)
8233 (gnus-summary-update-secondary-mark article)))
8235 (defun gnus-summary-set-saved-mark (article)
8236 "Set the process mark on ARTICLE and update the summary line."
8237 (push article gnus-newsgroup-saved)
8238 (when (gnus-summary-goto-subject article)
8239 (gnus-summary-update-secondary-mark article)))
8241 (defun gnus-summary-mark-forward (n &optional mark no-expire)
8242 "Mark N articles as read forwards.
8243 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
8244 The difference between N and the actual number of articles marked is
8246 Iff NO-EXPIRE, auto-expiry will be inhibited."
8248 (gnus-summary-show-thread)
8249 (let ((backward (< n 0))
8250 (gnus-summary-goto-unread
8251 (and gnus-summary-goto-unread
8252 (not (eq gnus-summary-goto-unread 'never))
8253 (not (memq mark (list gnus-unread-mark
8254 gnus-ticked-mark gnus-dormant-mark)))))
8256 (mark (or mark gnus-del-mark)))
8258 (gnus-summary-mark-article nil mark no-expire)
8259 (zerop (gnus-summary-next-subject
8261 (and gnus-summary-goto-unread
8262 (not (eq gnus-summary-goto-unread 'never)))
8266 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
8267 (gnus-summary-recenter)
8268 (gnus-summary-position-point)
8269 (gnus-set-mode-line 'summary)
8272 (defun gnus-summary-mark-article-as-read (mark)
8273 "Mark the current article quickly as read with MARK."
8274 (let ((article (gnus-summary-article-number)))
8275 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8276 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8277 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8278 (push (cons article mark) gnus-newsgroup-reads)
8279 ;; Possibly remove from cache, if that is used.
8280 (when gnus-use-cache
8281 (gnus-cache-enter-remove-article article))
8282 ;; Allow the backend to change the mark.
8283 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8284 ;; Check for auto-expiry.
8285 (when (and gnus-newsgroup-auto-expire
8286 (memq mark gnus-auto-expirable-marks))
8287 (setq mark gnus-expirable-mark)
8288 ;; Let the backend know about the mark change.
8289 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8290 (push article gnus-newsgroup-expirable))
8291 ;; Set the mark in the buffer.
8292 (gnus-summary-update-mark mark 'unread)
8295 (defun gnus-summary-mark-article-as-unread (mark)
8296 "Mark the current article quickly as unread with MARK."
8297 (let* ((article (gnus-summary-article-number))
8298 (old-mark (gnus-summary-article-mark article)))
8299 ;; Allow the backend to change the mark.
8300 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8301 (if (eq mark old-mark)
8305 (gnus-error 1 "Can't mark negative article numbers")
8307 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8308 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8309 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
8310 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
8311 (cond ((= mark gnus-ticked-mark)
8312 (push article gnus-newsgroup-marked))
8313 ((= mark gnus-dormant-mark)
8314 (push article gnus-newsgroup-dormant))
8316 (push article gnus-newsgroup-unreads)))
8317 (gnus-pull article gnus-newsgroup-reads)
8319 ;; See whether the article is to be put in the cache.
8321 (vectorp (gnus-summary-article-header article))
8323 (gnus-cache-possibly-enter-article
8324 gnus-newsgroup-name article
8325 (= mark gnus-ticked-mark)
8326 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8329 (gnus-summary-update-mark mark 'unread)
8332 (defun gnus-summary-mark-article (&optional article mark no-expire)
8333 "Mark ARTICLE with MARK. MARK can be any character.
8334 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
8335 `??' (dormant) and `?E' (expirable).
8336 If MARK is nil, then the default character `?r' is used.
8337 If ARTICLE is nil, then the article on the current line will be
8339 Iff NO-EXPIRE, auto-expiry will be inhibited."
8340 ;; The mark might be a string.
8341 (when (stringp mark)
8342 (setq mark (aref mark 0)))
8343 ;; If no mark is given, then we check auto-expiring.
8345 (setq mark gnus-del-mark))
8346 (when (and (not no-expire)
8347 gnus-newsgroup-auto-expire
8348 (memq mark gnus-auto-expirable-marks))
8349 (setq mark gnus-expirable-mark))
8350 (let ((article (or article (gnus-summary-article-number)))
8351 (old-mark (gnus-summary-article-mark article)))
8352 ;; Allow the backend to change the mark.
8353 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
8354 (if (eq mark old-mark)
8357 (error "No article on current line"))
8358 (if (not (if (or (= mark gnus-unread-mark)
8359 (= mark gnus-ticked-mark)
8360 (= mark gnus-dormant-mark))
8361 (gnus-mark-article-as-unread article mark)
8362 (gnus-mark-article-as-read article mark)))
8364 ;; See whether the article is to be put in the cache.
8366 (not (= mark gnus-canceled-mark))
8367 (vectorp (gnus-summary-article-header article))
8369 (gnus-cache-possibly-enter-article
8370 gnus-newsgroup-name article
8371 (= mark gnus-ticked-mark)
8372 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
8374 (when (gnus-summary-goto-subject article nil t)
8375 (let ((buffer-read-only nil))
8376 (gnus-summary-show-thread)
8378 (gnus-summary-update-mark mark 'unread)
8381 (defun gnus-summary-update-secondary-mark (article)
8382 "Update the secondary (read, process, cache) mark."
8383 (gnus-summary-update-mark
8384 (cond ((memq article gnus-newsgroup-processable)
8386 ((memq article gnus-newsgroup-cached)
8388 ((memq article gnus-newsgroup-replied)
8390 ((memq article gnus-newsgroup-saved)
8392 (t gnus-unread-mark))
8394 (when (gnus-visual-p 'summary-highlight 'highlight)
8395 (gnus-run-hooks 'gnus-summary-update-hook))
8398 (defun gnus-summary-update-mark (mark type)
8399 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
8400 (buffer-read-only nil))
8401 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
8403 (when (looking-at "\r")
8405 (when (<= (+ forward (point)) (point-max))
8406 ;; Go to the right position on the line.
8407 (goto-char (+ forward (point)))
8408 ;; Replace the old mark with the new mark.
8409 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
8410 ;; Optionally update the marks by some user rule.
8411 (when (eq type 'unread)
8413 (gnus-data-find (gnus-summary-article-number)) mark)
8414 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
8416 (defun gnus-mark-article-as-read (article &optional mark)
8417 "Enter ARTICLE in the pertinent lists and remove it from others."
8418 ;; Make the article expirable.
8419 (let ((mark (or mark gnus-del-mark)))
8420 (if (= mark gnus-expirable-mark)
8421 (push article gnus-newsgroup-expirable)
8422 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
8423 ;; Remove from unread and marked lists.
8424 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8425 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8426 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8427 (push (cons article mark) gnus-newsgroup-reads)
8428 ;; Possibly remove from cache, if that is used.
8429 (when gnus-use-cache
8430 (gnus-cache-enter-remove-article article))
8433 (defun gnus-mark-article-as-unread (article &optional mark)
8434 "Enter ARTICLE in the pertinent lists and remove it from others."
8435 (let ((mark (or mark gnus-ticked-mark)))
8438 (gnus-error 1 "Can't mark negative article numbers")
8440 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8441 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8442 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8443 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8445 ;; Unsuppress duplicates?
8446 (when gnus-suppress-duplicates
8447 (gnus-dup-unsuppress-article article))
8449 (cond ((= mark gnus-ticked-mark)
8450 (push article gnus-newsgroup-marked))
8451 ((= mark gnus-dormant-mark)
8452 (push article gnus-newsgroup-dormant))
8454 (push article gnus-newsgroup-unreads)))
8455 (gnus-pull article gnus-newsgroup-reads)
8458 (defalias 'gnus-summary-mark-as-unread-forward
8459 'gnus-summary-tick-article-forward)
8460 (make-obsolete 'gnus-summary-mark-as-unread-forward
8461 'gnus-summary-tick-article-forward)
8462 (defun gnus-summary-tick-article-forward (n)
8463 "Tick N articles forwards.
8464 If N is negative, tick backwards instead.
8465 The difference between N and the number of articles ticked is returned."
8467 (gnus-summary-mark-forward n gnus-ticked-mark))
8469 (defalias 'gnus-summary-mark-as-unread-backward
8470 'gnus-summary-tick-article-backward)
8471 (make-obsolete 'gnus-summary-mark-as-unread-backward
8472 'gnus-summary-tick-article-backward)
8473 (defun gnus-summary-tick-article-backward (n)
8474 "Tick N articles backwards.
8475 The difference between N and the number of articles ticked is returned."
8477 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8479 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8480 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8481 (defun gnus-summary-tick-article (&optional article clear-mark)
8482 "Mark current article as unread.
8483 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8484 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8486 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8489 (defun gnus-summary-mark-as-read-forward (n)
8490 "Mark N articles as read forwards.
8491 If N is negative, mark backwards instead.
8492 The difference between N and the actual number of articles marked is
8495 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8497 (defun gnus-summary-mark-as-read-backward (n)
8498 "Mark the N articles as read backwards.
8499 The difference between N and the actual number of articles marked is
8502 (gnus-summary-mark-forward
8503 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8505 (defun gnus-summary-mark-as-read (&optional article mark)
8506 "Mark current article as read.
8507 ARTICLE specifies the article to be marked as read.
8508 MARK specifies a string to be inserted at the beginning of the line."
8509 (gnus-summary-mark-article article mark))
8511 (defun gnus-summary-clear-mark-forward (n)
8512 "Clear marks from N articles forward.
8513 If N is negative, clear backward instead.
8514 The difference between N and the number of marks cleared is returned."
8516 (gnus-summary-mark-forward n gnus-unread-mark))
8518 (defun gnus-summary-clear-mark-backward (n)
8519 "Clear marks from N articles backward.
8520 The difference between N and the number of marks cleared is returned."
8522 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8524 (defun gnus-summary-mark-unread-as-read ()
8525 "Intended to be used by `gnus-summary-mark-article-hook'."
8526 (when (memq gnus-current-article gnus-newsgroup-unreads)
8527 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8529 (defun gnus-summary-mark-read-and-unread-as-read ()
8530 "Intended to be used by `gnus-summary-mark-article-hook'."
8531 (let ((mark (gnus-summary-article-mark)))
8532 (when (or (gnus-unread-mark-p mark)
8533 (gnus-read-mark-p mark))
8534 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8536 (defun gnus-summary-mark-region-as-read (point mark all)
8537 "Mark all unread articles between point and mark as read.
8538 If given a prefix, mark all articles between point and mark as read,
8539 even ticked and dormant ones."
8540 (interactive "r\nP")
8549 (memq (setq article (gnus-summary-article-number))
8550 gnus-newsgroup-unreads))
8551 (gnus-summary-mark-article article gnus-del-mark))
8553 (gnus-summary-find-next))))))
8555 (defun gnus-summary-mark-below (score mark)
8556 "Mark articles with score less than SCORE with MARK."
8557 (interactive "P\ncMark: ")
8558 (setq score (if score
8559 (prefix-numeric-value score)
8560 (or gnus-summary-default-score 0)))
8562 (set-buffer gnus-summary-buffer)
8563 (goto-char (point-min))
8566 (and (< (gnus-summary-article-score) score)
8567 (gnus-summary-mark-article nil mark))
8568 (gnus-summary-find-next)))))
8570 (defun gnus-summary-kill-below (&optional score)
8571 "Mark articles with score below SCORE as read."
8573 (gnus-summary-mark-below score gnus-killed-mark))
8575 (defun gnus-summary-clear-above (&optional score)
8576 "Clear all marks from articles with score above SCORE."
8578 (gnus-summary-mark-above score gnus-unread-mark))
8580 (defun gnus-summary-tick-above (&optional score)
8581 "Tick all articles with score above SCORE."
8583 (gnus-summary-mark-above score gnus-ticked-mark))
8585 (defun gnus-summary-mark-above (score mark)
8586 "Mark articles with score over SCORE with MARK."
8587 (interactive "P\ncMark: ")
8588 (setq score (if score
8589 (prefix-numeric-value score)
8590 (or gnus-summary-default-score 0)))
8592 (set-buffer gnus-summary-buffer)
8593 (goto-char (point-min))
8595 (when (> (gnus-summary-article-score) score)
8596 (gnus-summary-mark-article nil mark))
8598 (gnus-summary-find-next)))))
8600 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8601 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8602 (defun gnus-summary-limit-include-expunged (&optional no-error)
8603 "Display all the hidden articles that were expunged for low scores."
8605 (let ((buffer-read-only nil))
8606 (let ((scored gnus-newsgroup-scored)
8609 (unless (gnus-summary-goto-subject (caar scored))
8610 (and (setq h (gnus-summary-article-header (caar scored)))
8611 (< (cdar scored) gnus-summary-expunge-below)
8613 (setq scored (cdr scored)))
8615 (when (not no-error)
8616 (error "No expunged articles hidden"))
8617 (goto-char (point-min))
8618 (gnus-summary-prepare-unthreaded (nreverse headers))
8619 (goto-char (point-min))
8620 (gnus-summary-position-point)
8623 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8624 "Mark all unread articles in this newsgroup as read.
8625 If prefix argument ALL is non-nil, ticked and dormant articles will
8626 also be marked as read.
8627 If QUIETLY is non-nil, no questions will be asked.
8628 If TO-HERE is non-nil, it should be a point in the buffer. All
8629 articles before this point will be marked as read.
8630 Note that this function will only catch up the unread article
8631 in the current summary buffer limitation.
8632 The number of articles marked as read is returned."
8637 (not gnus-interactive-catchup) ;Without confirmation?
8641 "Mark absolutely all articles as read? "
8642 "Mark all unread articles as read? ")))
8644 (not gnus-newsgroup-adaptive)
8645 (not gnus-newsgroup-auto-expire)
8646 (not gnus-suppress-duplicates)
8647 (or (not gnus-use-cache)
8648 (eq gnus-use-cache 'passive)))
8651 (setq gnus-newsgroup-marked nil
8652 gnus-newsgroup-dormant nil))
8653 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8654 ;; We actually mark all articles as canceled, which we
8655 ;; have to do when using auto-expiry or adaptive scoring.
8656 (gnus-summary-show-all-threads)
8657 (when (gnus-summary-first-subject (not all) t)
8659 (if to-here (< (point) to-here) t)
8660 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8661 (gnus-summary-find-next (not all) nil nil t))))
8662 (gnus-set-mode-line 'summary))
8664 (gnus-summary-position-point)))
8666 (defun gnus-summary-catchup-to-here (&optional all)
8667 "Mark all unticked articles before the current one as read.
8668 If ALL is non-nil, also mark ticked and dormant articles as read."
8671 (gnus-save-hidden-threads
8672 (let ((beg (point)))
8673 ;; We check that there are unread articles.
8674 (when (or all (gnus-summary-find-prev))
8675 (gnus-summary-catchup all t beg)))))
8676 (gnus-summary-position-point))
8678 (defun gnus-summary-catchup-all (&optional quietly)
8679 "Mark all articles in this newsgroup as read."
8681 (gnus-summary-catchup t quietly))
8683 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8684 "Mark all unread articles in this group as read, then exit.
8685 If prefix argument ALL is non-nil, all articles are marked as read."
8687 (when (gnus-summary-catchup all quietly nil 'fast)
8688 ;; Select next newsgroup or exit.
8689 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8690 (eq gnus-auto-select-next 'quietly))
8691 (gnus-summary-next-group nil)
8692 (gnus-summary-exit))))
8694 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8695 "Mark all articles in this newsgroup as read, and then exit."
8697 (gnus-summary-catchup-and-exit t quietly))
8699 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8700 "Mark all articles in this group as read and select the next group.
8701 If given a prefix, mark all articles, unread as well as ticked, as
8705 (gnus-summary-catchup all))
8706 (gnus-summary-next-group))
8712 (defmacro gnus-with-article (article &rest forms)
8713 "Select ARTICLE and perform FORMS in the original article buffer.
8714 Then replace the article with the result."
8716 ;; We don't want the article to be marked as read.
8717 (let (gnus-mark-article-hook)
8718 (gnus-summary-select-article t t nil ,article))
8719 (set-buffer gnus-original-article-buffer)
8721 (if (not (gnus-check-backend-function
8722 'request-replace-article (car gnus-article-current)))
8723 (gnus-message 5 "Read-only group; not replacing")
8724 (unless (gnus-request-replace-article
8725 ,article (car gnus-article-current)
8727 (error "Couldn't replace article")))
8728 ;; The cache and backlog have to be flushed somewhat.
8729 (when gnus-keep-backlog
8730 (gnus-backlog-remove-article
8731 (car gnus-article-current) (cdr gnus-article-current)))
8732 (when gnus-use-cache
8733 (gnus-cache-update-article
8734 (car gnus-article-current) (cdr gnus-article-current)))))
8736 (put 'gnus-with-article 'lisp-indent-function 1)
8737 (put 'gnus-with-article 'edebug-form-spec '(form body))
8739 ;; Thread-based commands.
8741 (defun gnus-summary-articles-in-thread (&optional article)
8742 "Return a list of all articles in the current thread.
8743 If ARTICLE is non-nil, return all articles in the thread that starts
8745 (let* ((article (or article (gnus-summary-article-number)))
8746 (data (gnus-data-find-list article))
8747 (top-level (gnus-data-level (car data)))
8749 (cond ((null gnus-thread-operation-ignore-subject)
8750 (gnus-simplify-subject-re
8751 (mail-header-subject (gnus-data-header (car data)))))
8752 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8753 (gnus-simplify-subject-fuzzy
8754 (mail-header-subject (gnus-data-header (car data)))))
8756 (end-point (save-excursion
8757 (if (gnus-summary-go-to-next-thread)
8758 (point) (point-max))))
8761 (< (gnus-data-pos (car data)) end-point))
8762 (when (or (not top-subject)
8763 (string= top-subject
8764 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8765 (gnus-simplify-subject-fuzzy
8766 (mail-header-subject
8767 (gnus-data-header (car data))))
8768 (gnus-simplify-subject-re
8769 (mail-header-subject
8770 (gnus-data-header (car data)))))))
8771 (push (gnus-data-number (car data)) articles))
8772 (unless (and (setq data (cdr data))
8773 (> (gnus-data-level (car data)) top-level))
8775 ;; Return the list of articles.
8776 (nreverse articles)))
8778 (defun gnus-summary-rethread-current ()
8779 "Rethread the thread the current article is part of."
8781 (let* ((gnus-show-threads t)
8782 (article (gnus-summary-article-number))
8783 (id (mail-header-id (gnus-summary-article-header)))
8784 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8786 (error "No article on the current line"))
8787 (gnus-rebuild-thread id)
8788 (gnus-summary-goto-subject article)))
8790 (defun gnus-summary-reparent-thread ()
8791 "Make the current article child of the marked (or previous) article.
8793 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8794 is non-nil or the Subject: of both articles are the same."
8796 (unless (not (gnus-group-read-only-p))
8797 (error "The current newsgroup does not support article editing"))
8798 (unless (<= (length gnus-newsgroup-processable) 1)
8799 (error "No more than one article may be marked"))
8800 (save-window-excursion
8801 (let ((gnus-article-buffer " *reparent*")
8802 (current-article (gnus-summary-article-number))
8803 ;; First grab the marked article, otherwise one line up.
8804 (parent-article (if (not (null gnus-newsgroup-processable))
8805 (car gnus-newsgroup-processable)
8807 (if (eq (forward-line -1) 0)
8808 (gnus-summary-article-number)
8809 (error "Beginning of summary buffer"))))))
8810 (unless (not (eq current-article parent-article))
8811 (error "An article may not be self-referential"))
8812 (let ((message-id (mail-header-id
8813 (gnus-summary-article-header parent-article))))
8814 (unless (and message-id (not (equal message-id "")))
8815 (error "No message-id in desired parent"))
8816 (gnus-with-article current-article
8818 (goto-char (point-min))
8819 (message-narrow-to-head)
8820 (if (re-search-forward "^References: " nil t)
8822 (re-search-forward "^[^ \t]" nil t)
8825 (insert " " message-id))
8826 (insert "References: " message-id "\n"))))
8827 (set-buffer gnus-summary-buffer)
8828 (gnus-summary-unmark-all-processable)
8829 (gnus-summary-update-article current-article)
8830 (gnus-summary-rethread-current)
8831 (gnus-message 3 "Article %d is now the child of article %d"
8832 current-article parent-article)))))
8834 (defun gnus-summary-toggle-threads (&optional arg)
8835 "Toggle showing conversation threads.
8836 If ARG is positive number, turn showing conversation threads on."
8838 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8839 (setq gnus-show-threads
8840 (if (null arg) (not gnus-show-threads)
8841 (> (prefix-numeric-value arg) 0)))
8842 (gnus-summary-prepare)
8843 (gnus-summary-goto-subject current)
8844 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8845 (gnus-summary-position-point)))
8847 (defun gnus-summary-show-all-threads ()
8851 (let ((buffer-read-only nil))
8852 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8853 (gnus-summary-position-point))
8855 (defun gnus-summary-show-thread ()
8856 "Show thread subtrees.
8857 Returns nil if no thread was there to be shown."
8859 (let ((buffer-read-only nil)
8861 ;; first goto end then to beg, to have point at beg after let
8862 (end (progn (end-of-line) (point)))
8863 (beg (progn (beginning-of-line) (point))))
8865 ;; Any hidden lines here?
8866 (search-forward "\r" end t)
8867 (subst-char-in-region beg end ?\^M ?\n t)
8869 (gnus-summary-position-point))))
8871 (defun gnus-summary-hide-all-threads ()
8872 "Hide all thread subtrees."
8875 (goto-char (point-min))
8876 (gnus-summary-hide-thread)
8877 (while (zerop (gnus-summary-next-thread 1 t))
8878 (gnus-summary-hide-thread)))
8879 (gnus-summary-position-point))
8881 (defun gnus-summary-hide-thread ()
8882 "Hide thread subtrees.
8883 Returns nil if no threads were there to be hidden."
8885 (let ((buffer-read-only nil)
8887 (article (gnus-summary-article-number)))
8889 ;; Go forward until either the buffer ends or the subthread
8891 (when (and (not (eobp))
8892 (or (zerop (gnus-summary-next-thread 1 t))
8893 (goto-char (point-max))))
8895 (if (and (> (point) start)
8896 (search-backward "\n" start t))
8898 (subst-char-in-region start (point) ?\n ?\^M)
8899 (gnus-summary-goto-subject article))
8903 (defun gnus-summary-go-to-next-thread (&optional previous)
8904 "Go to the same level (or less) next thread.
8905 If PREVIOUS is non-nil, go to previous thread instead.
8906 Return the article number moved to, or nil if moving was impossible."
8907 (let ((level (gnus-summary-thread-level))
8908 (way (if previous -1 1))
8911 (while (and (not (eobp))
8912 (< level (gnus-summary-thread-level)))
8920 (gnus-summary-article-number)
8923 (defun gnus-summary-next-thread (n &optional silent)
8924 "Go to the same level next N'th thread.
8925 If N is negative, search backward instead.
8926 Returns the difference between N and the number of skips actually
8929 If SILENT, don't output messages."
8931 (let ((backward (< n 0))
8934 (gnus-summary-go-to-next-thread backward))
8937 (gnus-summary-position-point))
8938 (when (and (not silent) (/= 0 n))
8939 (gnus-message 7 "No more threads"))
8942 (defun gnus-summary-prev-thread (n)
8943 "Go to the same level previous N'th thread.
8944 Returns the difference between N and the number of skips actually
8947 (gnus-summary-next-thread (- n)))
8949 (defun gnus-summary-go-down-thread ()
8950 "Go down one level in the current thread."
8951 (let ((children (gnus-summary-article-children)))
8953 (gnus-summary-goto-subject (car children)))))
8955 (defun gnus-summary-go-up-thread ()
8956 "Go up one level in the current thread."
8957 (let ((parent (gnus-summary-article-parent)))
8959 (gnus-summary-goto-subject parent))))
8961 (defun gnus-summary-down-thread (n)
8962 "Go down thread N steps.
8963 If N is negative, go up instead.
8964 Returns the difference between N and how many steps down that were
8970 (if up (gnus-summary-go-up-thread)
8971 (gnus-summary-go-down-thread)))
8973 (gnus-summary-position-point)
8975 (gnus-message 7 "Can't go further"))
8978 (defun gnus-summary-up-thread (n)
8979 "Go up thread N steps.
8980 If N is negative, go up instead.
8981 Returns the difference between N and how many steps down that were
8984 (gnus-summary-down-thread (- n)))
8986 (defun gnus-summary-top-thread ()
8987 "Go to the top of the thread."
8989 (while (gnus-summary-go-up-thread))
8990 (gnus-summary-article-number))
8992 (defun gnus-summary-kill-thread (&optional unmark)
8993 "Mark articles under current thread as read.
8994 If the prefix argument is positive, remove any kinds of marks.
8995 If the prefix argument is negative, tick articles instead."
8998 (setq unmark (prefix-numeric-value unmark)))
8999 (let ((articles (gnus-summary-articles-in-thread)))
9001 ;; Expand the thread.
9002 (gnus-summary-show-thread)
9003 ;; Mark all the articles.
9005 (gnus-summary-goto-subject (car articles))
9006 (cond ((null unmark)
9007 (gnus-summary-mark-article-as-read gnus-killed-mark))
9009 (gnus-summary-mark-article-as-unread gnus-unread-mark))
9011 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
9012 (setq articles (cdr articles))))
9013 ;; Hide killed subtrees.
9015 gnus-thread-hide-killed
9016 (gnus-summary-hide-thread))
9017 ;; If marked as read, go to next unread subject.
9019 ;; Go to next unread subject.
9020 (gnus-summary-next-subject 1 t)))
9021 (gnus-set-mode-line 'summary))
9023 ;; Summary sorting commands
9025 (defun gnus-summary-sort-by-number (&optional reverse)
9026 "Sort the summary buffer by article number.
9027 Argument REVERSE means reverse order."
9029 (gnus-summary-sort 'number reverse))
9031 (defun gnus-summary-sort-by-author (&optional reverse)
9032 "Sort the summary buffer by author name alphabetically.
9033 If `case-fold-search' is non-nil, case of letters is ignored.
9034 Argument REVERSE means reverse order."
9036 (gnus-summary-sort 'author reverse))
9038 (defun gnus-summary-sort-by-subject (&optional reverse)
9039 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
9040 If `case-fold-search' is non-nil, case of letters is ignored.
9041 Argument REVERSE means reverse order."
9043 (gnus-summary-sort 'subject reverse))
9045 (defun gnus-summary-sort-by-date (&optional reverse)
9046 "Sort the summary buffer by date.
9047 Argument REVERSE means reverse order."
9049 (gnus-summary-sort 'date reverse))
9051 (defun gnus-summary-sort-by-score (&optional reverse)
9052 "Sort the summary buffer by score.
9053 Argument REVERSE means reverse order."
9055 (gnus-summary-sort 'score reverse))
9057 (defun gnus-summary-sort-by-lines (&optional reverse)
9058 "Sort the summary buffer by the number of lines.
9059 Argument REVERSE means reverse order."
9061 (gnus-summary-sort 'lines reverse))
9063 (defun gnus-summary-sort-by-chars (&optional reverse)
9064 "Sort the summary buffer by article length.
9065 Argument REVERSE means reverse order."
9067 (gnus-summary-sort 'chars reverse))
9069 (defun gnus-summary-sort (predicate reverse)
9070 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
9071 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
9072 (article (intern (format "gnus-article-sort-by-%s" predicate)))
9073 (gnus-thread-sort-functions
9078 (gnus-sort-gathered-threads-function
9079 gnus-thread-sort-functions)
9080 (gnus-article-sort-functions
9086 (gnus-summary-prepare-hook nil))
9087 ;; We do the sorting by regenerating the threads.
9088 (gnus-summary-prepare)
9089 ;; Hide subthreads if needed.
9090 (when (and gnus-show-threads gnus-thread-hide-subtree)
9091 (gnus-summary-hide-all-threads))))
9093 ;; Summary saving commands.
9095 (defun gnus-summary-save-article (&optional n not-saved)
9096 "Save the current article using the default saver function.
9097 If N is a positive number, save the N next articles.
9098 If N is a negative number, save the N previous articles.
9099 If N is nil and any articles have been marked with the process mark,
9100 save those articles instead.
9101 The variable `gnus-default-article-saver' specifies the saver function."
9103 (let* ((articles (gnus-summary-work-articles n))
9104 (save-buffer (save-excursion
9105 (nnheader-set-temp-buffer " *Gnus Save*")))
9106 (num (length articles))
9108 (dolist (article articles)
9109 (setq header (gnus-summary-article-header article))
9110 (if (not (vectorp header))
9111 ;; This is a pseudo-article.
9112 (if (assq 'name header)
9113 (gnus-copy-file (cdr (assq 'name header)))
9114 (gnus-message 1 "Article %d is unsaveable" article))
9115 ;; This is a real article.
9116 (save-window-excursion
9117 (gnus-summary-select-article t nil nil article))
9119 (set-buffer save-buffer)
9121 (insert-buffer-substring gnus-original-article-buffer))
9122 (setq file (gnus-article-save save-buffer file num))
9123 (gnus-summary-remove-process-mark article)
9125 (gnus-summary-set-saved-mark article))))
9126 (gnus-kill-buffer save-buffer)
9127 (gnus-summary-position-point)
9128 (gnus-set-mode-line 'summary)
9131 (defun gnus-summary-pipe-output (&optional arg)
9132 "Pipe the current article to a subprocess.
9133 If N is a positive number, pipe the N next articles.
9134 If N is a negative number, pipe the N previous articles.
9135 If N is nil and any articles have been marked with the process mark,
9136 pipe those articles instead."
9138 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
9139 (gnus-summary-save-article arg t))
9140 (gnus-configure-windows 'pipe))
9142 (defun gnus-summary-save-article-mail (&optional arg)
9143 "Append the current article to an mail file.
9144 If N is a positive number, save the N next articles.
9145 If N is a negative number, save the N previous articles.
9146 If N is nil and any articles have been marked with the process mark,
9147 save those articles instead."
9149 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
9150 (gnus-summary-save-article arg)))
9152 (defun gnus-summary-save-article-rmail (&optional arg)
9153 "Append the current article to an rmail file.
9154 If N is a positive number, save the N next articles.
9155 If N is a negative number, save the N previous articles.
9156 If N is nil and any articles have been marked with the process mark,
9157 save those articles instead."
9159 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
9160 (gnus-summary-save-article arg)))
9162 (defun gnus-summary-save-article-file (&optional arg)
9163 "Append the current article to a file.
9164 If N is a positive number, save the N next articles.
9165 If N is a negative number, save the N previous articles.
9166 If N is nil and any articles have been marked with the process mark,
9167 save those articles instead."
9169 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
9170 (gnus-summary-save-article arg)))
9172 (defun gnus-summary-write-article-file (&optional arg)
9173 "Write the current article to a file, deleting the previous file.
9174 If N is a positive number, save the N next articles.
9175 If N is a negative number, save the N previous articles.
9176 If N is nil and any articles have been marked with the process mark,
9177 save those articles instead."
9179 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
9180 (gnus-summary-save-article arg)))
9182 (defun gnus-summary-save-article-body-file (&optional arg)
9183 "Append the current article body to a file.
9184 If N is a positive number, save the N next articles.
9185 If N is a negative number, save the N previous articles.
9186 If N is nil and any articles have been marked with the process mark,
9187 save those articles instead."
9189 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
9190 (gnus-summary-save-article arg)))
9192 (defun gnus-summary-pipe-message (program)
9193 "Pipe the current article through PROGRAM."
9194 (interactive "sProgram: ")
9195 (gnus-summary-select-article)
9196 (let ((mail-header-separator ""))
9197 (gnus-eval-in-buffer-window gnus-article-buffer
9200 (let ((start (window-start))
9202 (message-pipe-buffer-body program)
9203 (set-window-start (get-buffer-window (current-buffer)) start))))))
9205 (defun gnus-get-split-value (methods)
9206 "Return a value based on the split METHODS."
9207 (let (split-name method result match)
9210 (set-buffer gnus-original-article-buffer)
9212 (nnheader-narrow-to-headers)
9213 (while (and methods (not split-name))
9214 (goto-char (point-min))
9215 (setq method (pop methods))
9216 (setq match (car method))
9219 ;; Regular expression.
9221 (re-search-forward match nil t)))
9222 ((gnus-functionp match)
9226 (setq result (funcall match gnus-newsgroup-name))))
9231 (setq result (eval match)))))
9232 (setq split-name (cdr method))
9233 (cond ((stringp result)
9234 (push (expand-file-name
9235 result gnus-article-save-directory)
9238 (setq split-name (append result split-name)))))))))
9239 (nreverse split-name)))
9241 (defun gnus-valid-move-group-p (group)
9244 (symbol-value group)
9245 (gnus-get-function (gnus-find-method-for-group
9246 (symbol-name group)) 'request-accept-article t)))
9248 (defun gnus-read-move-group-name (prompt default articles prefix)
9249 "Read a group name."
9250 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
9251 (minibuffer-confirm-incomplete nil) ; XEmacs
9255 (if (> (length articles) 1)
9256 (format "these %d articles" (length articles))
9261 (gnus-completing-read default prom
9263 'gnus-valid-move-group-p
9265 'gnus-group-history))
9266 ((= 1 (length split-name))
9267 (gnus-completing-read (car split-name) prom
9269 'gnus-valid-move-group-p
9271 'gnus-group-history))
9273 (gnus-completing-read nil prom
9274 (mapcar (lambda (el) (list el))
9275 (nreverse split-name))
9277 'gnus-group-history))))
9278 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
9280 (if (or (string= to-newsgroup "")
9281 (string= to-newsgroup prefix))
9282 (setq to-newsgroup default))
9283 (unless to-newsgroup
9284 (error "No group name entered"))
9285 (or (gnus-active to-newsgroup)
9286 (gnus-activate-group to-newsgroup nil nil to-method)
9287 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
9289 (or (and (gnus-request-create-group to-newsgroup to-method)
9290 (gnus-activate-group
9291 to-newsgroup nil nil to-method)
9292 (gnus-subscribe-group to-newsgroup))
9293 (error "Couldn't create group %s" to-newsgroup)))
9294 (error "No such group: %s" to-newsgroup)))
9297 (defun gnus-summary-save-parts (type dir n &optional reverse)
9298 "Save parts matching TYPE to DIR.
9299 If REVERSE, save parts that do not match TYPE."
9301 (list (read-string "Save parts of type: "
9302 (or (car gnus-summary-save-parts-type-history)
9303 gnus-summary-save-parts-default-mime)
9304 'gnus-summary-save-parts-type-history)
9305 (setq gnus-summary-save-parts-last-directory
9306 (read-file-name "Save to directory: "
9307 gnus-summary-save-parts-last-directory
9309 current-prefix-arg))
9310 (gnus-summary-iterate n
9311 (let ((gnus-display-mime-function nil)
9312 (gnus-inhibit-treatment t))
9313 (gnus-summary-select-article))
9315 (set-buffer gnus-article-buffer)
9316 (let ((handles (or gnus-article-mime-handles
9317 (mm-dissect-buffer) (mm-uu-dissect))))
9319 (gnus-summary-save-parts-1 type dir handles reverse)
9320 (unless gnus-article-mime-handles ;; Don't destroy this case.
9321 (mm-destroy-parts handles)))))))
9323 (defun gnus-summary-save-parts-1 (type dir handle reverse)
9324 (if (stringp (car handle))
9325 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
9328 (not (string-match type (mm-handle-media-type handle)))
9329 (string-match type (mm-handle-media-type handle)))
9330 (let ((file (expand-file-name
9331 (file-name-nondirectory
9333 (mail-content-type-get
9334 (mm-handle-disposition handle) 'filename)
9335 (concat gnus-newsgroup-name
9336 "." (number-to-string
9337 (cdr gnus-article-current)))))
9339 (unless (file-exists-p file)
9340 (mm-save-part-to-file handle file))))))
9342 ;; Summary extract commands
9344 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
9345 (let ((buffer-read-only nil)
9346 (article (gnus-summary-article-number))
9348 (unless (gnus-summary-goto-subject article)
9349 (error "No such article: %d" article))
9350 (gnus-summary-position-point)
9351 ;; If all commands are to be bunched up on one line, we collect
9353 (unless gnus-view-pseudos-separately
9354 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
9357 (setq action (cdr (assq 'action (car ps))))
9358 (setq files (list (cdr (assq 'name (car ps)))))
9359 (while (and ps (cdr ps)
9360 (string= (or action "1")
9361 (or (cdr (assq 'action (cadr ps))) "2")))
9362 (push (cdr (assq 'name (cadr ps))) files)
9363 (setcdr ps (cddr ps)))
9365 (when (not (string-match "%s" action))
9368 (when (assq 'execute (car ps))
9369 (setcdr (assq 'execute (car ps))
9370 (funcall (if (string-match "%s" action)
9379 (setq ps (cdr ps)))))
9380 (if (and gnus-view-pseudos (not not-view))
9382 (when (assq 'execute (car pslist))
9383 (gnus-execute-command (cdr (assq 'execute (car pslist)))
9384 (eq gnus-view-pseudos 'not-confirm)))
9385 (setq pslist (cdr pslist)))
9388 (setq after-article (or (cdr (assq 'article (car pslist)))
9389 (gnus-summary-article-number)))
9390 (gnus-summary-goto-subject after-article)
9393 (insert " " (file-name-nondirectory
9394 (cdr (assq 'name (car pslist))))
9395 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
9397 (forward-line -1) ; back to `b'
9398 (gnus-add-text-properties
9399 b (1- e) (list 'gnus-number gnus-reffed-article-number
9400 gnus-mouse-face-prop gnus-mouse-face))
9402 after-article gnus-reffed-article-number
9403 gnus-unread-mark b (car pslist) 0 (- e b))
9404 (push gnus-reffed-article-number gnus-newsgroup-unreads)
9405 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
9406 (setq pslist (cdr pslist)))))))
9408 (defun gnus-pseudos< (p1 p2)
9409 (let ((c1 (cdr (assq 'action p1)))
9410 (c2 (cdr (assq 'action p2))))
9411 (and c1 c2 (string< c1 c2))))
9413 (defun gnus-request-pseudo-article (props)
9414 (cond ((assq 'execute props)
9415 (gnus-execute-command (cdr (assq 'execute props)))))
9416 (let ((gnus-current-article (gnus-summary-article-number)))
9417 (gnus-run-hooks 'gnus-mark-article-hook)))
9419 (defun gnus-execute-command (command &optional automatic)
9421 (gnus-article-setup-buffer)
9422 (set-buffer gnus-article-buffer)
9423 (setq buffer-read-only nil)
9424 (let ((command (if automatic command
9425 (read-string "Command: " (cons command 0)))))
9427 (insert "$ " command "\n\n")
9428 (if gnus-view-pseudo-asynchronously
9429 (start-process "gnus-execute" (current-buffer) shell-file-name
9430 shell-command-switch command)
9431 (call-process shell-file-name nil t nil
9432 shell-command-switch command)))))
9434 ;; Summary kill commands.
9436 (defun gnus-summary-edit-global-kill (article)
9437 "Edit the \"global\" kill file."
9438 (interactive (list (gnus-summary-article-number)))
9439 (gnus-group-edit-global-kill article))
9441 (defun gnus-summary-edit-local-kill ()
9442 "Edit a local kill file applied to the current newsgroup."
9444 (setq gnus-current-headers (gnus-summary-article-header))
9445 (gnus-group-edit-local-kill
9446 (gnus-summary-article-number) gnus-newsgroup-name))
9450 (defun gnus-read-header (id &optional header)
9451 "Read the headers of article ID and enter them into the Gnus system."
9452 (let ((group gnus-newsgroup-name)
9453 (gnus-override-method
9455 gnus-override-method
9456 (and (gnus-news-group-p gnus-newsgroup-name)
9457 (car (gnus-refer-article-methods)))))
9459 ;; First we check to see whether the header in question is already
9462 ;; This is a Message-ID.
9463 (setq header (or header (gnus-id-to-header id)))
9464 ;; This is an article number.
9465 (setq header (or header (gnus-summary-article-header id))))
9467 (not (gnus-summary-article-sparse-p (mail-header-number header))))
9468 ;; We have found the header.
9470 ;; If this is a sparse article, we have to nix out its
9471 ;; previous entry in the thread hashtb.
9473 (gnus-summary-article-sparse-p (mail-header-number header)))
9474 (let* ((parent (gnus-parent-id (mail-header-references header)))
9475 (thread (and parent (gnus-id-to-thread parent))))
9477 (delq (assq header thread) thread))))
9478 ;; We have to really fetch the header to this article.
9480 (set-buffer nntp-server-buffer)
9481 (when (setq where (gnus-request-head id group))
9482 (nnheader-fold-continuation-lines)
9483 (goto-char (point-max))
9485 (goto-char (point-min))
9489 ((cdr where) (cdr where))
9490 (header (mail-header-number header))
9491 (t gnus-reffed-article-number))
9493 (insert " Article retrieved.\n"))
9495 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
9496 () ; Malformed head.
9497 (unless (gnus-summary-article-sparse-p (mail-header-number header))
9498 (when (and (stringp id)
9499 (not (string= (gnus-group-real-name group)
9501 ;; If we fetched by Message-ID and the article came
9502 ;; from a different group, we fudge some bogus article
9503 ;; numbers for this article.
9504 (mail-header-set-number header gnus-reffed-article-number))
9506 (set-buffer gnus-summary-buffer)
9507 (decf gnus-reffed-article-number)
9508 (gnus-remove-header (mail-header-number header))
9509 (push header gnus-newsgroup-headers)
9510 (setq gnus-current-headers header)
9511 (push (mail-header-number header) gnus-newsgroup-limit)))
9514 (defun gnus-remove-header (number)
9515 "Remove header NUMBER from `gnus-newsgroup-headers'."
9516 (if (and gnus-newsgroup-headers
9517 (= number (mail-header-number (car gnus-newsgroup-headers))))
9518 (pop gnus-newsgroup-headers)
9519 (let ((headers gnus-newsgroup-headers))
9520 (while (and (cdr headers)
9521 (not (= number (mail-header-number (cadr headers)))))
9524 (setcdr headers (cddr headers))))))
9527 ;;; summary highlights
9530 (defun gnus-highlight-selected-summary ()
9531 "Highlight selected article in summary buffer."
9532 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9533 (when gnus-summary-selected-face
9535 (let* ((beg (progn (beginning-of-line) (point)))
9536 (end (progn (end-of-line) (point)))
9537 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9538 (from (if (get-text-property beg gnus-mouse-face-prop)
9540 (or (next-single-property-change
9541 beg gnus-mouse-face-prop nil end)
9546 (or (next-single-property-change
9547 from gnus-mouse-face-prop nil end)
9549 ;; If no mouse-face prop on line we will have to = from = end,
9550 ;; so we highlight the entire line instead.
9551 (when (= (+ to 2) from)
9554 (if gnus-newsgroup-selected-overlay
9555 ;; Move old overlay.
9557 gnus-newsgroup-selected-overlay from to (current-buffer))
9558 ;; Create new overlay.
9560 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9561 'face gnus-summary-selected-face))))))
9563 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9564 (defun gnus-summary-highlight-line ()
9565 "Highlight current line according to `gnus-summary-highlight'."
9566 (let* ((list gnus-summary-highlight)
9568 (end (progn (end-of-line) (point)))
9569 ;; now find out where the line starts and leave point there.
9570 (beg (progn (beginning-of-line) (point)))
9571 (article (gnus-summary-article-number))
9572 (score (or (cdr (assq (or article gnus-current-article)
9573 gnus-newsgroup-scored))
9574 gnus-summary-default-score 0))
9575 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9576 (inhibit-read-only t))
9577 ;; Eval the cars of the lists until we find a match.
9578 (let ((default gnus-summary-default-score))
9580 (not (eval (caar list))))
9581 (setq list (cdr list))))
9582 (let ((face (cdar list)))
9583 (unless (eq face (get-text-property beg 'face))
9584 (gnus-put-text-property-excluding-characters-with-faces
9586 (setq face (if (boundp face) (symbol-value face) face)))
9587 (when gnus-summary-highlight-line-function
9588 (funcall gnus-summary-highlight-line-function article face))))
9591 (defun gnus-update-read-articles (group unread &optional compute)
9592 "Update the list of read articles in GROUP."
9593 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9594 (entry (gnus-gethash group gnus-newsrc-hashtb))
9595 (info (nth 2 entry))
9597 (unread (sort (copy-sequence unread) '<))
9599 (if (or (not info) (not active))
9600 ;; There is no info on this group if it was, in fact,
9601 ;; killed. Gnus stores no information on killed groups, so
9602 ;; there's nothing to be done.
9603 ;; One could store the information somewhere temporarily,
9604 ;; perhaps... Hmmm...
9606 ;; Remove any negative articles numbers.
9607 (while (and unread (< (car unread) 0))
9608 (setq unread (cdr unread)))
9609 ;; Remove any expired article numbers
9610 (while (and unread (< (car unread) (car active)))
9611 (setq unread (cdr unread)))
9612 ;; Compute the ranges of read articles by looking at the list of
9615 (when (/= (car unread) prev)
9616 (push (if (= prev (1- (car unread))) prev
9617 (cons prev (1- (car unread))))
9619 (setq prev (1+ (car unread)))
9620 (setq unread (cdr unread)))
9621 (when (<= prev (cdr active))
9622 (push (cons prev (cdr active)) read))
9623 (setq read (if (> (length read) 1) (nreverse read) read))
9628 ;; Propagate the read marks to the backend.
9629 (when (gnus-check-backend-function 'request-set-mark group)
9630 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9631 (add (gnus-remove-from-range read (gnus-info-read info))))
9633 (unless (gnus-check-group group)
9634 (error "Can't open server for %s" group))
9635 (gnus-request-set-mark
9636 group (delq nil (list (if add (list add 'add '(read)))
9637 (if del (list del 'del '(read))))))
9639 `(gnus-request-set-mark
9642 (if del (list del 'add '(read)))
9643 (if add (list add 'del '(read))))))))))
9644 (set-buffer gnus-group-buffer)
9647 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9648 (gnus-info-set-read ',info ',(gnus-info-read info))
9649 (gnus-get-unread-articles-in-group ',info
9650 (gnus-active ,group))
9651 (gnus-group-update-group ,group t)
9653 ;; Enter this list into the group info.
9654 (gnus-info-set-read info read)
9655 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9656 (gnus-get-unread-articles-in-group info (gnus-active group))
9659 (defun gnus-offer-save-summaries ()
9660 "Offer to save all active summary buffers."
9662 (let ((buflist (buffer-list))
9664 ;; Go through all buffers and find all summaries.
9666 (and (setq bufname (buffer-name (car buflist)))
9667 (string-match "Summary" bufname)
9669 (set-buffer bufname)
9670 ;; We check that this is, indeed, a summary buffer.
9671 (and (eq major-mode 'gnus-summary-mode)
9672 ;; Also make sure this isn't bogus.
9673 gnus-newsgroup-prepared
9674 ;; Also make sure that this isn't a dead summary buffer.
9675 (not gnus-dead-summary-mode)))
9676 (push bufname buffers))
9677 (setq buflist (cdr buflist)))
9678 ;; Go through all these summary buffers and offer to save them.
9681 "Update summary buffer %s? "
9683 (switch-to-buffer buf)
9684 (gnus-summary-exit))
9687 (defun gnus-summary-setup-default-charset ()
9688 "Setup newsgroup default charset."
9689 (if (equal gnus-newsgroup-name "nndraft:drafts")
9690 (setq gnus-newsgroup-charset nil)
9691 (let* ((name (and gnus-newsgroup-name
9692 (gnus-group-real-name gnus-newsgroup-name)))
9694 (or gnus-newsgroup-ephemeral-ignored-charsets
9696 (and gnus-newsgroup-name
9697 (or (gnus-group-find-parameter gnus-newsgroup-name
9698 'ignored-charsets t)
9699 (let ((alist gnus-group-ignored-charsets-alist)
9700 elem (charsets nil))
9701 (while (setq elem (pop alist))
9703 (string-match (car elem) name))
9705 charsets (cdr elem))))
9707 gnus-newsgroup-ignored-charsets))))
9708 (setq gnus-newsgroup-charset
9709 (or gnus-newsgroup-ephemeral-charset
9710 (and gnus-newsgroup-name
9711 (or (gnus-group-find-parameter gnus-newsgroup-name 'charset)
9712 (let ((alist gnus-group-charset-alist)
9714 (while (setq elem (pop alist))
9716 (string-match (car elem) name))
9718 charset (cadr elem))))
9720 gnus-default-charset))
9721 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
9722 ignored-charsets))))
9728 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9729 "Display the current article buffer fully MIME-buttonized.
9730 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9731 treated as multipart/mixed."
9734 (let ((gnus-unbuttonized-mime-types nil)
9735 (gnus-mime-display-multipart-as-mixed show-all-parts))
9736 (gnus-summary-show-article)))
9738 (defun gnus-summary-repair-multipart (article)
9739 "Add a Content-Type header to a multipart article without one."
9740 (interactive (list (gnus-summary-article-number)))
9741 (gnus-with-article article
9742 (message-narrow-to-head)
9743 (goto-char (point-max))
9745 (when (search-forward "\n--" nil t)
9746 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9747 (message-narrow-to-head)
9748 (message-remove-header "Mime-Version")
9749 (message-remove-header "Content-Type")
9750 (goto-char (point-max))
9751 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9753 (insert "Mime-Version: 1.0\n")
9755 (let (gnus-mark-article-hook)
9756 (gnus-summary-select-article t t nil article)))
9758 (defun gnus-summary-toggle-display-buttonized ()
9759 "Toggle the buttonizing of the article buffer."
9762 (if (setq gnus-inhibit-mime-unbuttonizing
9763 (not gnus-inhibit-mime-unbuttonizing))
9764 (let ((gnus-unbuttonized-mime-types nil))
9765 (gnus-summary-show-article))
9766 (gnus-summary-show-article)))
9769 ;;; Generic summary marking commands
9772 (defvar gnus-summary-marking-alist
9773 '((read gnus-del-mark "d")
9774 (unread gnus-unread-mark "u")
9775 (ticked gnus-ticked-mark "!")
9776 (dormant gnus-dormant-mark "?")
9777 (expirable gnus-expirable-mark "e"))
9778 "An alist of names/marks/keystrokes.")
9780 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
9781 (defvar gnus-summary-mark-map)
9783 (defun gnus-summary-make-all-marking-commands ()
9784 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
9785 (dolist (elem gnus-summary-marking-alist)
9786 (apply 'gnus-summary-make-marking-command elem)))
9788 (defun gnus-summary-make-marking-command (name mark keystroke)
9789 (let ((map (make-sparse-keymap)))
9790 (define-key gnus-summary-generic-mark-map keystroke map)
9791 (dolist (lway `((next "next" next nil "n")
9792 (next-unread "next unread" next t "N")
9793 (prev "previous" prev nil "p")
9794 (prev-unread "previous unread" prev t "P")
9795 (nomove "" nil nil ,keystroke)))
9796 (let ((func (gnus-summary-make-marking-command-1
9797 mark (car lway) lway name)))
9798 (setq func (eval func))
9799 (define-key map (nth 4 lway) func)))))
9801 (defun gnus-summary-make-marking-command-1 (mark way lway name)
9803 (format "gnus-summary-put-mark-as-%s%s"
9804 name (if (eq way 'nomove)
9806 (concat "-" (symbol-name way)))))
9809 "Mark the current article as %s%s.
9810 If N, the prefix, then repeat N times.
9811 If N is negative, move in reverse order.
9812 The difference between N and the actual number of articles marked is
9816 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
9818 (defun gnus-summary-generic-mark (n mark move unread)
9819 "Mark N articles with MARK."
9820 (unless (eq major-mode 'gnus-summary-mode)
9821 (error "This command can only be used in the summary buffer"))
9822 (gnus-summary-show-thread)
9826 ((eq move 'prev) -1)
9832 nummove (* -1 nummove))))
9834 (gnus-summary-mark-article nil mark)
9835 (zerop (gnus-summary-next-subject nummove unread t)))
9838 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
9839 (gnus-summary-recenter)
9840 (gnus-summary-position-point)
9841 (gnus-set-mode-line 'summary)
9844 (gnus-summary-make-all-marking-commands)
9850 (run-hooks 'gnus-sum-load-hook)
9852 ;;; gnus-sum.el ends here