1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
28 (eval-when-compile (require 'cl))
38 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
40 (defcustom gnus-kill-summary-on-exit t
41 "*If non-nil, kill the summary buffer when you exit from it.
42 If nil, the summary will become a \"*Dead Summary*\" buffer, and
43 it will be killed sometime later."
44 :group 'gnus-summary-exit
47 (defcustom gnus-fetch-old-headers nil
48 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
49 If an unread article in the group refers to an older, already read (or
50 just marked as read) article, the old article will not normally be
51 displayed in the Summary buffer. If this variable is non-nil, Gnus
52 will attempt to grab the headers to the old articles, and thereby
53 build complete threads. If it has the value `some', only enough
54 headers to connect otherwise loose threads will be displayed. This
55 variable can also be a number. In that case, no more than that number
56 of old headers will be fetched. If it has the value `invisible', all
57 old headers will be fetched, but none will be displayed.
59 The server has to support NOV for any of this to work."
61 :type '(choice (const :tag "off" nil)
64 (sexp :menu-tag "other" t)))
66 (defcustom gnus-refer-thread-limit 200
67 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
68 If t, fetch all the available old headers."
71 (sexp :menu-tag "other" t)))
73 (defcustom gnus-summary-make-false-root 'adopt
74 "*nil means that Gnus won't gather loose threads.
75 If the root of a thread has expired or been read in a previous
76 session, the information necessary to build a complete thread has been
77 lost. Instead of having many small sub-threads from this original thread
78 scattered all over the summary buffer, Gnus can gather them.
80 If non-nil, Gnus will try to gather all loose sub-threads from an
81 original thread into one large thread.
83 If this variable is non-nil, it should be one of `none', `adopt',
86 If this variable is `none', Gnus will not make a false root, but just
87 present the sub-threads after another.
88 If this variable is `dummy', Gnus will create a dummy root that will
89 have all the sub-threads as children.
90 If this variable is `adopt', Gnus will make one of the \"children\"
91 the parent and mark all the step-children as such.
92 If this variable is `empty', the \"children\" are printed with empty
93 subject fields. (Or rather, they will be printed with a string
94 given by the `gnus-summary-same-subject' variable.)"
96 :type '(choice (const :tag "off" nil)
102 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
103 "*A regexp to match subjects to be excluded from loose thread gathering.
104 As loose thread gathering is done on subjects only, that means that
105 there can be many false gatherings performed. By rooting out certain
106 common subjects, gathering might become saner."
110 (defcustom gnus-summary-gather-subject-limit nil
111 "*Maximum length of subject comparisons when gathering loose threads.
112 Use nil to compare full subjects. Setting this variable to a low
113 number will help gather threads that have been corrupted by
114 newsreaders chopping off subject lines, but it might also mean that
115 unrelated articles that have subject that happen to begin with the
116 same few characters will be incorrectly gathered.
118 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
121 :type '(choice (const :tag "off" nil)
123 (sexp :menu-tag "on" t)))
125 (defcustom gnus-simplify-subject-functions nil
126 "List of functions taking a string argument that simplify subjects.
127 The functions are applied recursively.
129 Useful functions to put in this list include: `gnus-simplify-subject-re',
130 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
132 :type '(repeat function))
134 (defcustom gnus-simplify-ignored-prefixes nil
135 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
137 :type '(choice (const :tag "off" nil)
140 (defcustom gnus-build-sparse-threads nil
141 "*If non-nil, fill in the gaps in threads.
142 If `some', only fill in the gaps that are needed to tie loose threads
143 together. If `more', fill in all leaf nodes that Gnus can find. If
144 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
146 :type '(choice (const :tag "off" nil)
149 (sexp :menu-tag "all" t)))
151 (defcustom gnus-summary-thread-gathering-function
152 'gnus-gather-threads-by-subject
153 "*Function used for gathering loose threads.
154 There are two pre-defined functions: `gnus-gather-threads-by-subject',
155 which only takes Subjects into consideration; and
156 `gnus-gather-threads-by-references', which compared the References
157 headers of the articles to find matches."
159 :type '(radio (function-item gnus-gather-threads-by-subject)
160 (function-item gnus-gather-threads-by-references)
161 (function :tag "other")))
163 (defcustom gnus-summary-same-subject ""
164 "*String indicating that the current article has the same subject as the previous.
165 This variable will only be used if the value of
166 `gnus-summary-make-false-root' is `empty'."
167 :group 'gnus-summary-format
170 (defcustom gnus-summary-goto-unread t
171 "*If t, marking commands will go to the next unread article.
172 If `never', commands that usually go to the next unread article, will
173 go to the next article, whether it is read or not.
174 If nil, only the marking commands will go to the next (un)read article."
175 :group 'gnus-summary-marks
176 :link '(custom-manual "(gnus)Setting Marks")
177 :type '(choice (const :tag "off" nil)
179 (sexp :menu-tag "on" t)))
181 (defcustom gnus-summary-default-score 0
182 "*Default article score level.
183 All scores generated by the score files will be added to this score.
184 If this variable is nil, scoring will be disabled."
185 :group 'gnus-score-default
186 :type '(choice (const :tag "disable")
189 (defcustom gnus-summary-zcore-fuzz 0
190 "*Fuzziness factor for the zcore in the summary buffer.
191 Articles with scores closer than this to `gnus-summary-default-score'
193 :group 'gnus-summary-format
196 (defcustom gnus-simplify-subject-fuzzy-regexp nil
197 "*Strings to be removed when doing fuzzy matches.
198 This can either be a regular expression or list of regular expressions
199 that will be removed from subject strings if fuzzy subject
200 simplification is selected."
202 :type '(repeat regexp))
204 (defcustom gnus-show-threads t
205 "*If non-nil, display threads in summary mode."
209 (defcustom gnus-thread-hide-subtree nil
210 "*If non-nil, hide all threads initially.
211 If threads are hidden, you have to run the command
212 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
213 to expose hidden threads."
217 (defcustom gnus-thread-hide-killed t
218 "*If non-nil, hide killed threads automatically."
222 (defcustom gnus-thread-ignore-subject t
223 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
224 If nil, articles that have different subjects from their parents will
225 start separate threads."
229 (defcustom gnus-thread-operation-ignore-subject t
230 "*If non-nil, subjects will be ignored when doing thread commands.
231 This affects commands like `gnus-summary-kill-thread' and
232 `gnus-summary-lower-thread'.
234 If this variable is nil, articles in the same thread with different
235 subjects will not be included in the operation in question. If this
236 variable is `fuzzy', only articles that have subjects that are fuzzily
237 equal will be included."
239 :type '(choice (const :tag "off" nil)
243 (defcustom gnus-thread-indent-level 4
244 "*Number that says how much each sub-thread should be indented."
248 (defcustom gnus-auto-extend-newsgroup t
249 "*If non-nil, extend newsgroup forward and backward when requested."
250 :group 'gnus-summary-choose
253 (defcustom gnus-auto-select-first t
254 "*If nil, don't select the first unread article when entering a group.
255 If this variable is `best', select the highest-scored unread article
256 in the group. If t, select the first unread article.
258 This variable can also be a function to place point on a likely
259 subject line. Useful values include `gnus-summary-first-unread-subject',
260 `gnus-summary-first-unread-article' and
261 `gnus-summary-best-unread-article'.
263 If you want to prevent automatic selection of the first unread article
264 in some newsgroups, set the variable to nil in
265 `gnus-select-group-hook'."
266 :group 'gnus-group-select
267 :type '(choice (const :tag "none" nil)
269 (sexp :menu-tag "first" t)
270 (function-item gnus-summary-first-unread-subject)
271 (function-item gnus-summary-first-unread-article)
272 (function-item gnus-summary-best-unread-article)))
274 (defcustom gnus-auto-select-next t
275 "*If non-nil, offer to go to the next group from the end of the previous.
276 If the value is t and the next newsgroup is empty, Gnus will exit
277 summary mode and go back to group mode. If the value is neither nil
278 nor t, Gnus will select the following unread newsgroup. In
279 particular, if the value is the symbol `quietly', the next unread
280 newsgroup will be selected without any confirmation, and if it is
281 `almost-quietly', the next group will be selected without any
282 confirmation if you are located on the last article in the group.
283 Finally, if this variable is `slightly-quietly', the `Z n' command
284 will go to the next group without confirmation."
285 :group 'gnus-summary-maneuvering
286 :type '(choice (const :tag "off" nil)
288 (const almost-quietly)
289 (const slightly-quietly)
290 (sexp :menu-tag "on" t)))
292 (defcustom gnus-auto-select-same nil
293 "*If non-nil, select the next article with the same subject.
294 If there are no more articles with the same subject, go to
295 the first unread article."
296 :group 'gnus-summary-maneuvering
299 (defcustom gnus-summary-check-current nil
300 "*If non-nil, consider the current article when moving.
301 The \"unread\" movement commands will stay on the same line if the
302 current article is unread."
303 :group 'gnus-summary-maneuvering
306 (defcustom gnus-auto-center-summary t
307 "*If non-nil, always center the current summary buffer.
308 In particular, if `vertical' do only vertical recentering. If non-nil
309 and non-`vertical', do both horizontal and vertical recentering."
310 :group 'gnus-summary-maneuvering
311 :type '(choice (const :tag "none" nil)
313 (integer :tag "height")
314 (sexp :menu-tag "both" t)))
316 (defcustom gnus-show-all-headers nil
317 "*If non-nil, don't hide any headers."
318 :group 'gnus-article-hiding
319 :group 'gnus-article-headers
322 (defcustom gnus-summary-ignore-duplicates nil
323 "*If non-nil, ignore articles with identical Message-ID headers."
327 (defcustom gnus-single-article-buffer t
328 "*If non-nil, display all articles in the same buffer.
329 If nil, each group will get its own article buffer."
330 :group 'gnus-article-various
333 (defcustom gnus-break-pages t
334 "*If non-nil, do page breaking on articles.
335 The page delimiter is specified by the `gnus-page-delimiter'
337 :group 'gnus-article-various
340 (defcustom gnus-move-split-methods nil
341 "*Variable used to suggest where articles are to be moved to.
342 It uses the same syntax as the `gnus-split-methods' variable."
343 :group 'gnus-summary-mail
344 :type '(repeat (choice (list :value (fun) function)
345 (cons :value ("" "") regexp (repeat string))
348 (defcustom gnus-unread-mark ? ;Whitespace
349 "*Mark used for unread articles."
350 :group 'gnus-summary-marks
353 (defcustom gnus-ticked-mark ?!
354 "*Mark used for ticked articles."
355 :group 'gnus-summary-marks
358 (defcustom gnus-dormant-mark ??
359 "*Mark used for dormant articles."
360 :group 'gnus-summary-marks
363 (defcustom gnus-del-mark ?r
364 "*Mark used for del'd articles."
365 :group 'gnus-summary-marks
368 (defcustom gnus-read-mark ?R
369 "*Mark used for read articles."
370 :group 'gnus-summary-marks
373 (defcustom gnus-expirable-mark ?E
374 "*Mark used for expirable articles."
375 :group 'gnus-summary-marks
378 (defcustom gnus-killed-mark ?K
379 "*Mark used for killed articles."
380 :group 'gnus-summary-marks
383 (defcustom gnus-souped-mark ?F
384 "*Mark used for killed articles."
385 :group 'gnus-summary-marks
388 (defcustom gnus-kill-file-mark ?X
389 "*Mark used for articles killed by kill files."
390 :group 'gnus-summary-marks
393 (defcustom gnus-low-score-mark ?Y
394 "*Mark used for articles with a low score."
395 :group 'gnus-summary-marks
398 (defcustom gnus-catchup-mark ?C
399 "*Mark used for articles that are caught up."
400 :group 'gnus-summary-marks
403 (defcustom gnus-replied-mark ?A
404 "*Mark used for articles that have been replied to."
405 :group 'gnus-summary-marks
408 (defcustom gnus-cached-mark ?*
409 "*Mark used for articles that are in the cache."
410 :group 'gnus-summary-marks
413 (defcustom gnus-saved-mark ?S
414 "*Mark used for articles that have been saved to."
415 :group 'gnus-summary-marks
418 (defcustom gnus-ancient-mark ?O
419 "*Mark used for ancient articles."
420 :group 'gnus-summary-marks
423 (defcustom gnus-sparse-mark ?Q
424 "*Mark used for sparsely reffed articles."
425 :group 'gnus-summary-marks
428 (defcustom gnus-canceled-mark ?G
429 "*Mark used for canceled articles."
430 :group 'gnus-summary-marks
433 (defcustom gnus-duplicate-mark ?M
434 "*Mark used for duplicate articles."
435 :group 'gnus-summary-marks
438 (defcustom gnus-undownloaded-mark ?@
439 "*Mark used for articles that weren't downloaded."
440 :group 'gnus-summary-marks
443 (defcustom gnus-downloadable-mark ?%
444 "*Mark used for articles that are to be downloaded."
445 :group 'gnus-summary-marks
448 (defcustom gnus-unsendable-mark ?=
449 "*Mark used for articles that won't be sent."
450 :group 'gnus-summary-marks
453 (defcustom gnus-score-over-mark ?+
454 "*Score mark used for articles with high scores."
455 :group 'gnus-summary-marks
458 (defcustom gnus-score-below-mark ?-
459 "*Score mark used for articles with low scores."
460 :group 'gnus-summary-marks
463 (defcustom gnus-empty-thread-mark ? ;Whitespace
464 "*There is no thread under the article."
465 :group 'gnus-summary-marks
468 (defcustom gnus-not-empty-thread-mark ?=
469 "*There is a thread under the article."
470 :group 'gnus-summary-marks
473 (defcustom gnus-view-pseudo-asynchronously nil
474 "*If non-nil, Gnus will view pseudo-articles asynchronously."
475 :group 'gnus-extract-view
478 (defcustom gnus-auto-expirable-marks
479 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
480 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
481 gnus-souped-mark gnus-duplicate-mark)
482 "*The list of marks converted into expiration if a group is auto-expirable."
484 :type '(repeat character))
486 (defcustom gnus-inhibit-user-auto-expire t
487 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
491 (defcustom gnus-view-pseudos nil
492 "*If `automatic', pseudo-articles will be viewed automatically.
493 If `not-confirm', pseudos will be viewed automatically, and the user
494 will not be asked to confirm the command."
495 :group 'gnus-extract-view
496 :type '(choice (const :tag "off" nil)
498 (const not-confirm)))
500 (defcustom gnus-view-pseudos-separately t
501 "*If non-nil, one pseudo-article will be created for each file to be viewed.
502 If nil, all files that use the same viewing command will be given as a
503 list of parameters to that command."
504 :group 'gnus-extract-view
507 (defcustom gnus-insert-pseudo-articles t
508 "*If non-nil, insert pseudo-articles when decoding articles."
509 :group 'gnus-extract-view
512 (defcustom gnus-summary-dummy-line-format
514 "*The format specification for the dummy roots in the summary buffer.
515 It works along the same lines as a normal formatting string,
516 with some simple extensions.
519 :group 'gnus-threading
522 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
523 "*The format specification for the summary mode line.
524 It works along the same lines as a normal formatting string,
525 with some simple extensions:
528 %p Unprefixed group name
529 %A Current article number
530 %z Current article score
532 %U Number of unread articles in the group
533 %e Number of unselected articles in the group
534 %Z A string with unread/unselected article counts
535 %g Shortish group name
536 %S Subject of the current article
538 %s Current score file name
539 %d Number of dormant articles
540 %r Number of articles that have been marked as read in this session
541 %E Number of articles expunged by the score files"
542 :group 'gnus-summary-format
545 (defcustom gnus-summary-mark-below 0
546 "*Mark all articles with a score below this variable as read.
547 This variable is local to each summary buffer and usually set by the
549 :group 'gnus-score-default
552 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
553 "*List of functions used for sorting articles in the summary buffer.
554 This variable is only used when not using a threaded display."
555 :group 'gnus-summary-sort
556 :type '(repeat (choice (function-item gnus-article-sort-by-number)
557 (function-item gnus-article-sort-by-author)
558 (function-item gnus-article-sort-by-subject)
559 (function-item gnus-article-sort-by-date)
560 (function-item gnus-article-sort-by-score)
561 (function :tag "other"))))
563 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
564 "*List of functions used for sorting threads in the summary buffer.
565 By default, threads are sorted by article number.
567 Each function takes two threads and return non-nil if the first thread
568 should be sorted before the other. If you use more than one function,
569 the primary sort function should be the last. You should probably
570 always include `gnus-thread-sort-by-number' in the list of sorting
571 functions -- preferably first.
573 Ready-made functions include `gnus-thread-sort-by-number',
574 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
575 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
576 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
577 :group 'gnus-summary-sort
578 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
579 (function-item gnus-thread-sort-by-author)
580 (function-item gnus-thread-sort-by-subject)
581 (function-item gnus-thread-sort-by-date)
582 (function-item gnus-thread-sort-by-score)
583 (function-item gnus-thread-sort-by-total-score)
584 (function :tag "other"))))
586 (defcustom gnus-thread-score-function '+
587 "*Function used for calculating the total score of a thread.
589 The function is called with the scores of the article and each
590 subthread and should then return the score of the thread.
592 Some functions you can use are `+', `max', or `min'."
593 :group 'gnus-summary-sort
596 (defcustom gnus-summary-expunge-below nil
597 "All articles that have a score less than this variable will be expunged.
598 This variable is local to the summary buffers."
599 :group 'gnus-score-default
600 :type '(choice (const :tag "off" nil)
603 (defcustom gnus-thread-expunge-below nil
604 "All threads that have a total score less than this variable will be expunged.
605 See `gnus-thread-score-function' for en explanation of what a
608 This variable is local to the summary buffers."
609 :group 'gnus-treading
610 :group 'gnus-score-default
611 :type '(choice (const :tag "off" nil)
614 (defcustom gnus-summary-mode-hook nil
615 "*A hook for Gnus summary mode.
616 This hook is run before any variables are set in the summary buffer."
617 :group 'gnus-summary-various
620 (defcustom gnus-summary-menu-hook nil
621 "*Hook run after the creation of the summary mode menu."
622 :group 'gnus-summary-visual
625 (defcustom gnus-summary-exit-hook nil
626 "*A hook called on exit from the summary buffer.
627 It will be called with point in the group buffer."
628 :group 'gnus-summary-exit
631 (defcustom gnus-summary-prepare-hook nil
632 "*A hook called after the summary buffer has been generated.
633 If you want to modify the summary buffer, you can use this hook."
634 :group 'gnus-summary-various
637 (defcustom gnus-summary-prepared-hook nil
638 "*A hook called as the last thing after the summary buffer has been generated."
639 :group 'gnus-summary-various
642 (defcustom gnus-summary-generate-hook nil
643 "*A hook run just before generating the summary buffer.
644 This hook is commonly used to customize threading variables and the
646 :group 'gnus-summary-various
649 (defcustom gnus-select-group-hook nil
650 "*A hook called when a newsgroup is selected.
652 If you'd like to simplify subjects like the
653 `gnus-summary-next-same-subject' command does, you can use the
656 (setq gnus-select-group-hook
659 (mapcar (lambda (header)
660 (mail-header-set-subject
662 (gnus-simplify-subject
663 (mail-header-subject header) 're-only)))
664 gnus-newsgroup-headers))))"
665 :group 'gnus-group-select
668 (defcustom gnus-select-article-hook nil
669 "*A hook called when an article is selected."
670 :group 'gnus-summary-choose
673 (defcustom gnus-visual-mark-article-hook
674 (list 'gnus-highlight-selected-summary)
675 "*Hook run after selecting an article in the summary buffer.
676 It is meant to be used for highlighting the article in some way. It
677 is not run if `gnus-visual' is nil."
678 :group 'gnus-summary-visual
681 (defcustom gnus-parse-headers-hook nil
682 "*A hook called before parsing the headers."
686 (defcustom gnus-exit-group-hook nil
687 "*A hook called when exiting (not quitting) summary mode."
691 (defcustom gnus-summary-update-hook
692 (list 'gnus-summary-highlight-line)
693 "*A hook called when a summary line is changed.
694 The hook will not be called if `gnus-visual' is nil.
696 The default function `gnus-summary-highlight-line' will
697 highlight the line according to the `gnus-summary-highlight'
699 :group 'gnus-summary-visual
702 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
703 "*A hook called when an article is selected for the first time.
704 The hook is intended to mark an article as read (or unread)
705 automatically when it is selected."
706 :group 'gnus-summary-choose
709 (defcustom gnus-group-no-more-groups-hook nil
710 "*A hook run when returning to group mode having no more (unread) groups."
711 :group 'gnus-group-select
714 (defcustom gnus-ps-print-hook nil
715 "*A hook run before ps-printing something from Gnus."
719 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
720 "Face used for highlighting the current article in the summary buffer."
721 :group 'gnus-summary-visual
724 (defcustom gnus-summary-highlight
725 '(((= mark gnus-canceled-mark)
726 . gnus-summary-cancelled-face)
727 ((and (> score default)
728 (or (= mark gnus-dormant-mark)
729 (= mark gnus-ticked-mark)))
730 . gnus-summary-high-ticked-face)
731 ((and (< score default)
732 (or (= mark gnus-dormant-mark)
733 (= mark gnus-ticked-mark)))
734 . gnus-summary-low-ticked-face)
735 ((or (= mark gnus-dormant-mark)
736 (= mark gnus-ticked-mark))
737 . gnus-summary-normal-ticked-face)
738 ((and (> score default) (= mark gnus-ancient-mark))
739 . gnus-summary-high-ancient-face)
740 ((and (< score default) (= mark gnus-ancient-mark))
741 . gnus-summary-low-ancient-face)
742 ((= mark gnus-ancient-mark)
743 . gnus-summary-normal-ancient-face)
744 ((and (> score default) (= mark gnus-unread-mark))
745 . gnus-summary-high-unread-face)
746 ((and (< score default) (= mark gnus-unread-mark))
747 . gnus-summary-low-unread-face)
748 ((= mark gnus-unread-mark)
749 . gnus-summary-normal-unread-face)
750 ((and (> score default) (memq mark (list gnus-downloadable-mark
751 gnus-undownloaded-mark)))
752 . gnus-summary-high-unread-face)
753 ((and (< score default) (memq mark (list gnus-downloadable-mark
754 gnus-undownloaded-mark)))
755 . gnus-summary-low-unread-face)
756 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
757 . gnus-summary-normal-unread-face)
759 . gnus-summary-high-read-face)
761 . gnus-summary-low-read-face)
763 . gnus-summary-normal-read-face))
764 "*Controls the highlighting of summary buffer lines.
766 A list of (FORM . FACE) pairs. When deciding how a a particular
767 summary line should be displayed, each form is evaluated. The content
768 of the face field after the first true form is used. You can change
769 how those summary lines are displayed, by editing the face field.
771 You can use the following variables in the FORM field.
773 score: The articles score
774 default: The default article score.
775 below: The score below which articles are automatically marked as read.
776 mark: The articles mark."
777 :group 'gnus-summary-visual
778 :type '(repeat (cons (sexp :tag "Form" nil)
781 (defcustom gnus-alter-header-function nil
782 "Function called to allow alteration of article header structures.
783 The function is called with one parameter, the article header vector,
784 which it may alter in any way.")
786 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
787 "Variable that says which function should be used to decode a string with encoded words.")
789 (defcustom gnus-extra-headers nil
790 "*Extra headers to parse."
792 :type '(repeat symbol))
794 (defcustom gnus-ignored-from-addresses
795 (and user-mail-address (regexp-quote user-mail-address))
796 "*Regexp of From headers that may be suppressed in favor of To headers."
800 (defcustom gnus-group-charset-alist
801 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
802 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
803 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
804 ("^relcom\\>" koi8-r)
806 "Alist of regexps (to match group names) and default charsets to be used."
807 :type '(repeat (list (regexp :tag "Group")
808 (symbol :tag "Charset")))
809 :group 'gnus-charset)
811 ;;; Internal variables
813 (defvar gnus-article-mime-handles nil)
814 (defvar gnus-article-decoded-p nil)
815 (defvar gnus-scores-exclude-files nil)
816 (defvar gnus-page-broken nil)
817 (defvar gnus-inhibit-mime-unbuttonizing nil)
819 (defvar gnus-original-article nil)
820 (defvar gnus-article-internal-prepare-hook nil)
821 (defvar gnus-newsgroup-process-stack nil)
823 (defvar gnus-thread-indent-array nil)
824 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
826 ;; Avoid highlighting in kill files.
827 (defvar gnus-summary-inhibit-highlight nil)
828 (defvar gnus-newsgroup-selected-overlay nil)
829 (defvar gnus-inhibit-limiting nil)
830 (defvar gnus-newsgroup-adaptive-score-file nil)
831 (defvar gnus-current-score-file nil)
832 (defvar gnus-current-move-group nil)
833 (defvar gnus-current-copy-group nil)
834 (defvar gnus-current-crosspost-group nil)
836 (defvar gnus-newsgroup-dependencies nil)
837 (defvar gnus-newsgroup-adaptive nil)
838 (defvar gnus-summary-display-article-function nil)
839 (defvar gnus-summary-highlight-line-function nil
840 "Function called after highlighting a summary line.")
842 (defvar gnus-summary-line-format-alist
843 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
844 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
845 (?s gnus-tmp-subject-or-nil ?s)
846 (?n gnus-tmp-name ?s)
847 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
849 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
851 (?F gnus-tmp-from ?s)
852 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
853 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
854 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
855 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
856 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
857 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
858 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
859 (?L gnus-tmp-lines ?d)
860 (?I gnus-tmp-indentation ?s)
861 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
862 (?R gnus-tmp-replied ?c)
863 (?\[ gnus-tmp-opening-bracket ?c)
864 (?\] gnus-tmp-closing-bracket ?c)
865 (?\> (make-string gnus-tmp-level ? ) ?s)
866 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
867 (?i gnus-tmp-score ?d)
868 (?z gnus-tmp-score-char ?c)
869 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
870 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
871 (?U gnus-tmp-unread ?c)
872 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
873 (?t (gnus-summary-number-of-articles-in-thread
874 (and (boundp 'thread) (car thread)) gnus-tmp-level)
876 (?e (gnus-summary-number-of-articles-in-thread
877 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
879 (?u gnus-tmp-user-defined ?s)
880 (?P (gnus-pick-line-number) ?d))
881 "An alist of format specifications that can appear in summary lines,
882 and what variables they correspond with, along with the type of the
883 variable (string, integer, character, etc).")
885 (defvar gnus-summary-dummy-line-format-alist
886 `((?S gnus-tmp-subject ?s)
887 (?N gnus-tmp-number ?d)
888 (?u gnus-tmp-user-defined ?s)))
890 (defvar gnus-summary-mode-line-format-alist
891 `((?G gnus-tmp-group-name ?s)
892 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
893 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
894 (?A gnus-tmp-article-number ?d)
895 (?Z gnus-tmp-unread-and-unselected ?s)
897 (?U gnus-tmp-unread-and-unticked ?d)
898 (?S gnus-tmp-subject ?s)
899 (?e gnus-tmp-unselected ?d)
900 (?u gnus-tmp-user-defined ?s)
901 (?d (length gnus-newsgroup-dormant) ?d)
902 (?t (length gnus-newsgroup-marked) ?d)
903 (?r (length gnus-newsgroup-reads) ?d)
904 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
905 (?E gnus-newsgroup-expunged-tally ?d)
906 (?s (gnus-current-score-file-nondirectory) ?s)))
908 (defvar gnus-last-search-regexp nil
909 "Default regexp for article search command.")
911 (defvar gnus-last-shell-command nil
912 "Default shell command on article.")
914 (defvar gnus-newsgroup-begin nil)
915 (defvar gnus-newsgroup-end nil)
916 (defvar gnus-newsgroup-last-rmail nil)
917 (defvar gnus-newsgroup-last-mail nil)
918 (defvar gnus-newsgroup-last-folder nil)
919 (defvar gnus-newsgroup-last-file nil)
920 (defvar gnus-newsgroup-auto-expire nil)
921 (defvar gnus-newsgroup-active nil)
923 (defvar gnus-newsgroup-data nil)
924 (defvar gnus-newsgroup-data-reverse nil)
925 (defvar gnus-newsgroup-limit nil)
926 (defvar gnus-newsgroup-limits nil)
928 (defvar gnus-newsgroup-unreads nil
929 "List of unread articles in the current newsgroup.")
931 (defvar gnus-newsgroup-unselected nil
932 "List of unselected unread articles in the current newsgroup.")
934 (defvar gnus-newsgroup-reads nil
935 "Alist of read articles and article marks in the current newsgroup.")
937 (defvar gnus-newsgroup-expunged-tally nil)
939 (defvar gnus-newsgroup-marked nil
940 "List of ticked articles in the current newsgroup (a subset of unread art).")
942 (defvar gnus-newsgroup-killed nil
943 "List of ranges of articles that have been through the scoring process.")
945 (defvar gnus-newsgroup-cached nil
946 "List of articles that come from the article cache.")
948 (defvar gnus-newsgroup-saved nil
949 "List of articles that have been saved.")
951 (defvar gnus-newsgroup-kill-headers nil)
953 (defvar gnus-newsgroup-replied nil
954 "List of articles that have been replied to in the current newsgroup.")
956 (defvar gnus-newsgroup-expirable nil
957 "List of articles in the current newsgroup that can be expired.")
959 (defvar gnus-newsgroup-processable nil
960 "List of articles in the current newsgroup that can be processed.")
962 (defvar gnus-newsgroup-downloadable nil
963 "List of articles in the current newsgroup that can be processed.")
965 (defvar gnus-newsgroup-undownloaded nil
966 "List of articles in the current newsgroup that haven't been downloaded..")
968 (defvar gnus-newsgroup-unsendable nil
969 "List of articles in the current newsgroup that won't be sent.")
971 (defvar gnus-newsgroup-bookmarks nil
972 "List of articles in the current newsgroup that have bookmarks.")
974 (defvar gnus-newsgroup-dormant nil
975 "List of dormant articles in the current newsgroup.")
977 (defvar gnus-newsgroup-scored nil
978 "List of scored articles in the current newsgroup.")
980 (defvar gnus-newsgroup-headers nil
981 "List of article headers in the current newsgroup.")
983 (defvar gnus-newsgroup-threads nil)
985 (defvar gnus-newsgroup-prepared nil
986 "Whether the current group has been prepared properly.")
988 (defvar gnus-newsgroup-ancient nil
989 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
991 (defvar gnus-newsgroup-sparse nil)
993 (defvar gnus-current-article nil)
994 (defvar gnus-article-current nil)
995 (defvar gnus-current-headers nil)
996 (defvar gnus-have-all-headers nil)
997 (defvar gnus-last-article nil)
998 (defvar gnus-newsgroup-history nil)
999 (defvar gnus-newsgroup-charset nil)
1001 (defconst gnus-summary-local-variables
1002 '(gnus-newsgroup-name
1003 gnus-newsgroup-begin gnus-newsgroup-end
1004 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1005 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1006 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1007 gnus-newsgroup-unselected gnus-newsgroup-marked
1008 gnus-newsgroup-reads gnus-newsgroup-saved
1009 gnus-newsgroup-replied gnus-newsgroup-expirable
1010 gnus-newsgroup-processable gnus-newsgroup-killed
1011 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1012 gnus-newsgroup-unsendable
1013 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1014 gnus-newsgroup-headers gnus-newsgroup-threads
1015 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1016 gnus-current-article gnus-current-headers gnus-have-all-headers
1017 gnus-last-article gnus-article-internal-prepare-hook
1018 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1019 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1020 gnus-thread-expunge-below
1021 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
1022 (gnus-summary-mark-below . global)
1023 gnus-newsgroup-active gnus-scores-exclude-files
1024 gnus-newsgroup-history gnus-newsgroup-ancient
1025 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1026 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1027 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1028 (gnus-newsgroup-expunged-tally . 0)
1029 gnus-cache-removable-articles gnus-newsgroup-cached
1030 gnus-newsgroup-data gnus-newsgroup-data-reverse
1031 gnus-newsgroup-limit gnus-newsgroup-limits
1032 gnus-newsgroup-charset)
1033 "Variables that are buffer-local to the summary buffers.")
1035 ;; Byte-compiler warning.
1036 (defvar gnus-article-mode-map)
1040 (defvar gnus-decode-encoded-word-methods
1041 '(mail-decode-encoded-word-string)
1042 "List of methods used to decode encoded words.
1044 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1045 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1046 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1047 whose names match REGEXP.
1050 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1051 mail-decode-encoded-word-string
1052 (\"chinese\" . rfc1843-decode-string))
1055 (defvar gnus-decode-encoded-word-methods-cache nil)
1057 (defun gnus-multi-decode-encoded-word-string (string)
1058 "Apply the functions from `gnus-encoded-word-methods' that match."
1059 (unless (and gnus-decode-encoded-word-methods-cache
1060 (eq gnus-newsgroup-name
1061 (car gnus-decode-encoded-word-methods-cache)))
1062 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1065 (nconc gnus-decode-encoded-word-methods-cache (list x))
1066 (if (and gnus-newsgroup-name
1067 (string-match (car x) gnus-newsgroup-name))
1068 (nconc gnus-decode-encoded-word-methods-cache
1070 gnus-decode-encoded-word-methods))
1071 (let ((xlist gnus-decode-encoded-word-methods-cache))
1074 (setq string (funcall (pop xlist) string))))
1077 ;; Subject simplification.
1079 (defun gnus-simplify-whitespace (str)
1080 "Remove excessive whitespace."
1083 (while (string-match "[ \t][ \t]+" mystr)
1084 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1086 (substring mystr (match-end 0)))))
1088 (when (string-match "^[ \t]+" mystr)
1089 (setq mystr (substring mystr (match-end 0))))
1091 (when (string-match "[ \t]+$" mystr)
1092 (setq mystr (substring mystr 0 (match-beginning 0))))
1095 (defsubst gnus-simplify-subject-re (subject)
1096 "Remove \"Re:\" from subject lines."
1097 (if (string-match "^[Rr][Ee]: *" subject)
1098 (substring subject (match-end 0))
1101 (defun gnus-simplify-subject (subject &optional re-only)
1102 "Remove `Re:' and words in parentheses.
1103 If RE-ONLY is non-nil, strip leading `Re:'s only."
1104 (let ((case-fold-search t)) ;Ignore case.
1105 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1106 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1107 (setq subject (substring subject (match-end 0))))
1108 ;; Remove uninteresting prefixes.
1109 (when (and (not re-only)
1110 gnus-simplify-ignored-prefixes
1111 (string-match gnus-simplify-ignored-prefixes subject))
1112 (setq subject (substring subject (match-end 0))))
1113 ;; Remove words in parentheses from end.
1115 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1116 (setq subject (substring subject 0 (match-beginning 0)))))
1117 ;; Return subject string.
1120 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1122 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1123 (goto-char (point-min))
1124 (while (re-search-forward regexp nil t)
1125 (replace-match (or newtext ""))))
1127 (defun gnus-simplify-buffer-fuzzy ()
1128 "Simplify string in the buffer fuzzily.
1129 The string in the accessible portion of the current buffer is simplified.
1130 It is assumed to be a single-line subject.
1131 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1132 matter is removed. Additional things can be deleted by setting
1133 gnus-simplify-subject-fuzzy-regexp."
1134 (let ((case-fold-search t)
1136 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1138 (while (not (eq modified-tick (buffer-modified-tick)))
1139 (setq modified-tick (buffer-modified-tick))
1141 ((listp gnus-simplify-subject-fuzzy-regexp)
1142 (mapcar 'gnus-simplify-buffer-fuzzy-step
1143 gnus-simplify-subject-fuzzy-regexp))
1144 (gnus-simplify-subject-fuzzy-regexp
1145 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1146 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1147 (gnus-simplify-buffer-fuzzy-step
1148 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1149 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1151 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1152 (gnus-simplify-buffer-fuzzy-step " +" " ")
1153 (gnus-simplify-buffer-fuzzy-step " $")
1154 (gnus-simplify-buffer-fuzzy-step "^ +")))
1156 (defun gnus-simplify-subject-fuzzy (subject)
1157 "Simplify a subject string fuzzily.
1158 See `gnus-simplify-buffer-fuzzy' for details."
1160 (gnus-set-work-buffer)
1161 (let ((case-fold-search t))
1162 ;; Remove uninteresting prefixes.
1163 (when (and gnus-simplify-ignored-prefixes
1164 (string-match gnus-simplify-ignored-prefixes subject))
1165 (setq subject (substring subject (match-end 0))))
1167 (inline (gnus-simplify-buffer-fuzzy))
1170 (defsubst gnus-simplify-subject-fully (subject)
1171 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1173 (gnus-simplify-subject-functions
1174 (gnus-map-function gnus-simplify-subject-functions subject))
1175 ((null gnus-summary-gather-subject-limit)
1176 (gnus-simplify-subject-re subject))
1177 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1178 (gnus-simplify-subject-fuzzy subject))
1179 ((numberp gnus-summary-gather-subject-limit)
1180 (gnus-limit-string (gnus-simplify-subject-re subject)
1181 gnus-summary-gather-subject-limit))
1185 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1186 "Check whether two subjects are equal.
1187 If optional argument simple-first is t, first argument is already
1190 ((null simple-first)
1191 (equal (gnus-simplify-subject-fully s1)
1192 (gnus-simplify-subject-fully s2)))
1195 (gnus-simplify-subject-fully s2)))))
1197 (defun gnus-summary-bubble-group ()
1198 "Increase the score of the current group.
1199 This is a handy function to add to `gnus-summary-exit-hook' to
1200 increase the score of each group you read."
1201 (gnus-group-add-score gnus-newsgroup-name))
1205 ;;; Gnus summary mode
1208 (put 'gnus-summary-mode 'mode-class 'special)
1211 ;; Non-orthogonal keys
1213 (gnus-define-keys gnus-summary-mode-map
1214 " " gnus-summary-next-page
1215 "\177" gnus-summary-prev-page
1216 [delete] gnus-summary-prev-page
1217 [backspace] gnus-summary-prev-page
1218 "\r" gnus-summary-scroll-up
1219 "\M-\r" gnus-summary-scroll-down
1220 "n" gnus-summary-next-unread-article
1221 "p" gnus-summary-prev-unread-article
1222 "N" gnus-summary-next-article
1223 "P" gnus-summary-prev-article
1224 "\M-\C-n" gnus-summary-next-same-subject
1225 "\M-\C-p" gnus-summary-prev-same-subject
1226 "\M-n" gnus-summary-next-unread-subject
1227 "\M-p" gnus-summary-prev-unread-subject
1228 "." gnus-summary-first-unread-article
1229 "," gnus-summary-best-unread-article
1230 "\M-s" gnus-summary-search-article-forward
1231 "\M-r" gnus-summary-search-article-backward
1232 "<" gnus-summary-beginning-of-article
1233 ">" gnus-summary-end-of-article
1234 "j" gnus-summary-goto-article
1235 "^" gnus-summary-refer-parent-article
1236 "\M-^" gnus-summary-refer-article
1237 "u" gnus-summary-tick-article-forward
1238 "!" gnus-summary-tick-article-forward
1239 "U" gnus-summary-tick-article-backward
1240 "d" gnus-summary-mark-as-read-forward
1241 "D" gnus-summary-mark-as-read-backward
1242 "E" gnus-summary-mark-as-expirable
1243 "\M-u" gnus-summary-clear-mark-forward
1244 "\M-U" gnus-summary-clear-mark-backward
1245 "k" gnus-summary-kill-same-subject-and-select
1246 "\C-k" gnus-summary-kill-same-subject
1247 "\M-\C-k" gnus-summary-kill-thread
1248 "\M-\C-l" gnus-summary-lower-thread
1249 "e" gnus-summary-edit-article
1250 "#" gnus-summary-mark-as-processable
1251 "\M-#" gnus-summary-unmark-as-processable
1252 "\M-\C-t" gnus-summary-toggle-threads
1253 "\M-\C-s" gnus-summary-show-thread
1254 "\M-\C-h" gnus-summary-hide-thread
1255 "\M-\C-f" gnus-summary-next-thread
1256 "\M-\C-b" gnus-summary-prev-thread
1257 "\M-\C-u" gnus-summary-up-thread
1258 "\M-\C-d" gnus-summary-down-thread
1259 "&" gnus-summary-execute-command
1260 "c" gnus-summary-catchup-and-exit
1261 "\C-w" gnus-summary-mark-region-as-read
1262 "\C-t" gnus-summary-toggle-truncation
1263 "?" gnus-summary-mark-as-dormant
1264 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1265 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1266 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1267 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1268 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1269 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1270 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1271 "=" gnus-summary-expand-window
1272 "\C-x\C-s" gnus-summary-reselect-current-group
1273 "\M-g" gnus-summary-rescan-group
1274 "w" gnus-summary-stop-page-breaking
1275 "\C-c\C-r" gnus-summary-caesar-message
1276 "f" gnus-summary-followup
1277 "F" gnus-summary-followup-with-original
1278 "C" gnus-summary-cancel-article
1279 "r" gnus-summary-reply
1280 "R" gnus-summary-reply-with-original
1281 "\C-c\C-f" gnus-summary-mail-forward
1282 "o" gnus-summary-save-article
1283 "\C-o" gnus-summary-save-article-mail
1284 "|" gnus-summary-pipe-output
1285 "\M-k" gnus-summary-edit-local-kill
1286 "\M-K" gnus-summary-edit-global-kill
1288 "\C-c\C-d" gnus-summary-describe-group
1289 "q" gnus-summary-exit
1290 "Q" gnus-summary-exit-no-update
1291 "\C-c\C-i" gnus-info-find-node
1292 gnus-mouse-2 gnus-mouse-pick-article
1293 "m" gnus-summary-mail-other-window
1294 "a" gnus-summary-post-news
1295 "x" gnus-summary-limit-to-unread
1296 "s" gnus-summary-isearch-article
1297 "t" gnus-article-hide-headers
1298 "g" gnus-summary-show-article
1299 "l" gnus-summary-goto-last-article
1300 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1301 "\C-d" gnus-summary-enter-digest-group
1302 "\M-\C-d" gnus-summary-read-document
1303 "\M-\C-e" gnus-summary-edit-parameters
1304 "\M-\C-g" gnus-summary-customize-parameters
1306 "*" gnus-cache-enter-article
1307 "\M-*" gnus-cache-remove-article
1308 "\M-&" gnus-summary-universal-argument
1309 "\C-l" gnus-recenter
1310 "I" gnus-summary-increase-score
1311 "L" gnus-summary-lower-score
1312 "\M-i" gnus-symbolic-argument
1313 "h" gnus-summary-select-article-buffer
1315 "b" gnus-article-view-part
1316 "\M-t" gnus-summary-toggle-display-buttonized
1318 "V" gnus-summary-score-map
1319 "X" gnus-uu-extract-map
1320 "S" gnus-summary-send-map)
1322 ;; Sort of orthogonal keymap
1323 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1324 "t" gnus-summary-tick-article-forward
1325 "!" gnus-summary-tick-article-forward
1326 "d" gnus-summary-mark-as-read-forward
1327 "r" gnus-summary-mark-as-read-forward
1328 "c" gnus-summary-clear-mark-forward
1329 " " gnus-summary-clear-mark-forward
1330 "e" gnus-summary-mark-as-expirable
1331 "x" gnus-summary-mark-as-expirable
1332 "?" gnus-summary-mark-as-dormant
1333 "b" gnus-summary-set-bookmark
1334 "B" gnus-summary-remove-bookmark
1335 "#" gnus-summary-mark-as-processable
1336 "\M-#" gnus-summary-unmark-as-processable
1337 "S" gnus-summary-limit-include-expunged
1338 "C" gnus-summary-catchup
1339 "H" gnus-summary-catchup-to-here
1340 "\C-c" gnus-summary-catchup-all
1341 "k" gnus-summary-kill-same-subject-and-select
1342 "K" gnus-summary-kill-same-subject
1343 "P" gnus-uu-mark-map)
1345 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1346 "c" gnus-summary-clear-above
1347 "u" gnus-summary-tick-above
1348 "m" gnus-summary-mark-above
1349 "k" gnus-summary-kill-below)
1351 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1352 "/" gnus-summary-limit-to-subject
1353 "n" gnus-summary-limit-to-articles
1354 "w" gnus-summary-pop-limit
1355 "s" gnus-summary-limit-to-subject
1356 "a" gnus-summary-limit-to-author
1357 "u" gnus-summary-limit-to-unread
1358 "m" gnus-summary-limit-to-marks
1359 "v" gnus-summary-limit-to-score
1360 "*" gnus-summary-limit-include-cached
1361 "D" gnus-summary-limit-include-dormant
1362 "T" gnus-summary-limit-include-thread
1363 "d" gnus-summary-limit-exclude-dormant
1364 "t" gnus-summary-limit-to-age
1365 "E" gnus-summary-limit-include-expunged
1366 "c" gnus-summary-limit-exclude-childless-dormant
1367 "C" gnus-summary-limit-mark-excluded-as-read)
1369 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1370 "n" gnus-summary-next-unread-article
1371 "p" gnus-summary-prev-unread-article
1372 "N" gnus-summary-next-article
1373 "P" gnus-summary-prev-article
1374 "\C-n" gnus-summary-next-same-subject
1375 "\C-p" gnus-summary-prev-same-subject
1376 "\M-n" gnus-summary-next-unread-subject
1377 "\M-p" gnus-summary-prev-unread-subject
1378 "f" gnus-summary-first-unread-article
1379 "b" gnus-summary-best-unread-article
1380 "j" gnus-summary-goto-article
1381 "g" gnus-summary-goto-subject
1382 "l" gnus-summary-goto-last-article
1383 "o" gnus-summary-pop-article)
1385 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1386 "k" gnus-summary-kill-thread
1387 "l" gnus-summary-lower-thread
1388 "i" gnus-summary-raise-thread
1389 "T" gnus-summary-toggle-threads
1390 "t" gnus-summary-rethread-current
1391 "^" gnus-summary-reparent-thread
1392 "s" gnus-summary-show-thread
1393 "S" gnus-summary-show-all-threads
1394 "h" gnus-summary-hide-thread
1395 "H" gnus-summary-hide-all-threads
1396 "n" gnus-summary-next-thread
1397 "p" gnus-summary-prev-thread
1398 "u" gnus-summary-up-thread
1399 "o" gnus-summary-top-thread
1400 "d" gnus-summary-down-thread
1401 "#" gnus-uu-mark-thread
1402 "\M-#" gnus-uu-unmark-thread)
1404 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1405 "g" gnus-summary-prepare
1406 "c" gnus-summary-insert-cached-articles)
1408 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1409 "c" gnus-summary-catchup-and-exit
1410 "C" gnus-summary-catchup-all-and-exit
1411 "E" gnus-summary-exit-no-update
1412 "Q" gnus-summary-exit
1413 "Z" gnus-summary-exit
1414 "n" gnus-summary-catchup-and-goto-next-group
1415 "R" gnus-summary-reselect-current-group
1416 "G" gnus-summary-rescan-group
1417 "N" gnus-summary-next-group
1418 "s" gnus-summary-save-newsrc
1419 "P" gnus-summary-prev-group)
1421 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1422 " " gnus-summary-next-page
1423 "n" gnus-summary-next-page
1424 "\177" gnus-summary-prev-page
1425 [delete] gnus-summary-prev-page
1426 "p" gnus-summary-prev-page
1427 "\r" gnus-summary-scroll-up
1428 "\M-\r" gnus-summary-scroll-down
1429 "<" gnus-summary-beginning-of-article
1430 ">" gnus-summary-end-of-article
1431 "b" gnus-summary-beginning-of-article
1432 "e" gnus-summary-end-of-article
1433 "^" gnus-summary-refer-parent-article
1434 "r" gnus-summary-refer-parent-article
1435 "R" gnus-summary-refer-references
1436 "T" gnus-summary-refer-thread
1437 "g" gnus-summary-show-article
1438 "s" gnus-summary-isearch-article
1439 "P" gnus-summary-print-article)
1441 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1442 "b" gnus-article-add-buttons
1443 "B" gnus-article-add-buttons-to-head
1444 "o" gnus-article-treat-overstrike
1445 "e" gnus-article-emphasize
1446 "w" gnus-article-fill-cited-article
1447 "c" gnus-article-remove-cr
1448 "q" gnus-article-de-quoted-unreadable
1449 "f" gnus-article-display-x-face
1450 "l" gnus-summary-stop-page-breaking
1451 "r" gnus-summary-caesar-message
1452 "t" gnus-article-hide-headers
1453 "v" gnus-summary-verbose-headers
1454 "h" gnus-article-treat-html
1455 "d" gnus-article-treat-dumbquotes)
1457 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1458 "a" gnus-article-hide
1459 "h" gnus-article-hide-headers
1460 "b" gnus-article-hide-boring-headers
1461 "s" gnus-article-hide-signature
1462 "c" gnus-article-hide-citation
1463 "C" gnus-article-hide-citation-in-followups
1464 "p" gnus-article-hide-pgp
1465 "P" gnus-article-hide-pem
1466 "\C-c" gnus-article-hide-citation-maybe)
1468 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1469 "a" gnus-article-highlight
1470 "h" gnus-article-highlight-headers
1471 "c" gnus-article-highlight-citation
1472 "s" gnus-article-highlight-signature)
1474 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1475 "w" gnus-article-decode-mime-words
1476 "c" gnus-article-decode-charset
1477 "v" gnus-mime-view-all-parts
1478 "b" gnus-article-view-part)
1480 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1481 "z" gnus-article-date-ut
1482 "u" gnus-article-date-ut
1483 "l" gnus-article-date-local
1484 "e" gnus-article-date-lapsed
1485 "o" gnus-article-date-original
1486 "i" gnus-article-date-iso8601
1487 "s" gnus-article-date-user)
1489 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1490 "t" gnus-article-remove-trailing-blank-lines
1491 "l" gnus-article-strip-leading-blank-lines
1492 "m" gnus-article-strip-multiple-blank-lines
1493 "a" gnus-article-strip-blank-lines
1494 "A" gnus-article-strip-all-blank-lines
1495 "s" gnus-article-strip-leading-space
1496 "e" gnus-article-strip-trailing-space)
1498 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1500 "f" gnus-summary-fetch-faq
1501 "d" gnus-summary-describe-group
1502 "h" gnus-summary-describe-briefly
1503 "i" gnus-info-find-node)
1505 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1506 "e" gnus-summary-expire-articles
1507 "\M-\C-e" gnus-summary-expire-articles-now
1508 "\177" gnus-summary-delete-article
1509 [delete] gnus-summary-delete-article
1510 "m" gnus-summary-move-article
1511 "r" gnus-summary-respool-article
1512 "w" gnus-summary-edit-article
1513 "c" gnus-summary-copy-article
1514 "B" gnus-summary-crosspost-article
1515 "q" gnus-summary-respool-query
1516 "t" gnus-summary-respool-trace
1517 "i" gnus-summary-import-article
1518 "p" gnus-summary-article-posted-p)
1520 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1521 "o" gnus-summary-save-article
1522 "m" gnus-summary-save-article-mail
1523 "F" gnus-summary-write-article-file
1524 "r" gnus-summary-save-article-rmail
1525 "f" gnus-summary-save-article-file
1526 "b" gnus-summary-save-article-body-file
1527 "h" gnus-summary-save-article-folder
1528 "v" gnus-summary-save-article-vm
1529 "p" gnus-summary-pipe-output
1530 "s" gnus-soup-add-article)
1532 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1533 "b" gnus-summary-display-buttonized
1534 "m" gnus-summary-repair-multipart
1535 "v" gnus-article-view-part
1536 "o" gnus-article-save-part
1537 "c" gnus-article-copy-part
1538 "e" gnus-article-externalize-part
1539 "|" gnus-article-pipe-part)
1542 (defun gnus-summary-make-menu-bar ()
1543 (gnus-turn-off-edit-menu 'summary)
1545 (unless (boundp 'gnus-summary-misc-menu)
1548 gnus-summary-kill-menu gnus-summary-mode-map ""
1553 ["Enter score..." gnus-summary-score-entry t]
1554 ["Customize" gnus-score-customize t])
1555 (gnus-make-score-map 'increase)
1556 (gnus-make-score-map 'lower)
1558 ["Kill below" gnus-summary-kill-below t]
1559 ["Mark above" gnus-summary-mark-above t]
1560 ["Tick above" gnus-summary-tick-above t]
1561 ["Clear above" gnus-summary-clear-above t])
1562 ["Current score" gnus-summary-current-score t]
1563 ["Set score" gnus-summary-set-score t]
1564 ["Switch current score file..." gnus-score-change-score-file t]
1565 ["Set mark below..." gnus-score-set-mark-below t]
1566 ["Set expunge below..." gnus-score-set-expunge-below t]
1567 ["Edit current score file" gnus-score-edit-current-scores t]
1568 ["Edit score file" gnus-score-edit-file t]
1569 ["Trace score" gnus-score-find-trace t]
1570 ["Find words" gnus-score-find-favourite-words t]
1571 ["Rescore buffer" gnus-summary-rescore t]
1572 ["Increase score..." gnus-summary-increase-score t]
1573 ["Lower score..." gnus-summary-lower-score t]))))
1575 ;; Define both the Article menu in the summary buffer and the equivalent
1576 ;; Commands menu in the article buffer here for consistency.
1579 ["All" gnus-article-hide t]
1580 ["Headers" gnus-article-hide-headers t]
1581 ["Signature" gnus-article-hide-signature t]
1582 ["Citation" gnus-article-hide-citation t]
1583 ["PGP" gnus-article-hide-pgp t]
1584 ["Boring headers" gnus-article-hide-boring-headers t])
1586 ["All" gnus-article-highlight t]
1587 ["Headers" gnus-article-highlight-headers t]
1588 ["Signature" gnus-article-highlight-signature t]
1589 ["Citation" gnus-article-highlight-citation t])
1591 ["Words" gnus-article-decode-mime-words t]
1592 ["Charset" gnus-article-decode-charset t]
1593 ["QP" gnus-article-de-quoted-unreadable t]
1594 ["View all" gnus-mime-view-all-parts t])
1596 ["Local" gnus-article-date-local t]
1597 ["ISO8601" gnus-article-date-iso8601 t]
1598 ["UT" gnus-article-date-ut t]
1599 ["Original" gnus-article-date-original t]
1600 ["Lapsed" gnus-article-date-lapsed t]
1601 ["User-defined" gnus-article-date-user t])
1604 ["Leading" gnus-article-strip-leading-blank-lines t]
1605 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1606 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1607 ["All of the above" gnus-article-strip-blank-lines t]
1608 ["All" gnus-article-strip-all-blank-lines t]
1609 ["Leading space" gnus-article-strip-leading-space t]
1610 ["Trailing space" gnus-article-strip-trailing-space t])
1611 ["Overstrike" gnus-article-treat-overstrike t]
1612 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1613 ["Emphasis" gnus-article-emphasize t]
1614 ["Word wrap" gnus-article-fill-cited-article t]
1615 ["CR" gnus-article-remove-cr t]
1616 ["Show X-Face" gnus-article-display-x-face t]
1617 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1618 ["UnHTMLize" gnus-article-treat-html t]
1619 ["Rot 13" gnus-summary-caesar-message t]
1620 ["Unix pipe" gnus-summary-pipe-message t]
1621 ["Add buttons" gnus-article-add-buttons t]
1622 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1623 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1624 ["Verbose header" gnus-summary-verbose-headers t]
1625 ["Toggle header" gnus-summary-toggle-header t])
1627 ["Save in default format" gnus-summary-save-article t]
1628 ["Save in file" gnus-summary-save-article-file t]
1629 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1630 ["Save in MH folder" gnus-summary-save-article-folder t]
1631 ["Save in VM folder" gnus-summary-save-article-vm t]
1632 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1633 ["Save body in file" gnus-summary-save-article-body-file t]
1634 ["Pipe through a filter" gnus-summary-pipe-output t]
1635 ["Add to SOUP packet" gnus-soup-add-article t]
1636 ["Print" gnus-summary-print-article t])
1638 ["Respool article..." gnus-summary-respool-article t]
1639 ["Move article..." gnus-summary-move-article
1640 (gnus-check-backend-function
1641 'request-move-article gnus-newsgroup-name)]
1642 ["Copy article..." gnus-summary-copy-article t]
1643 ["Crosspost article..." gnus-summary-crosspost-article
1644 (gnus-check-backend-function
1645 'request-replace-article gnus-newsgroup-name)]
1646 ["Import file..." gnus-summary-import-article t]
1647 ["Check if posted" gnus-summary-article-posted-p t]
1648 ["Edit article" gnus-summary-edit-article
1649 (not (gnus-group-read-only-p))]
1650 ["Delete article" gnus-summary-delete-article
1651 (gnus-check-backend-function
1652 'request-expire-articles gnus-newsgroup-name)]
1653 ["Query respool" gnus-summary-respool-query t]
1654 ["Trace respool" gnus-summary-respool-trace t]
1655 ["Delete expirable articles" gnus-summary-expire-articles-now
1656 (gnus-check-backend-function
1657 'request-expire-articles gnus-newsgroup-name)])
1659 ["Uudecode" gnus-uu-decode-uu t]
1660 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1661 ["Unshar" gnus-uu-decode-unshar t]
1662 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1663 ["Save" gnus-uu-decode-save t]
1664 ["Binhex" gnus-uu-decode-binhex t]
1665 ["Postscript" gnus-uu-decode-postscript t])
1667 ["Enter article" gnus-cache-enter-article t]
1668 ["Remove article" gnus-cache-remove-article t])
1669 ["Select article buffer" gnus-summary-select-article-buffer t]
1670 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1671 ["Isearch article..." gnus-summary-isearch-article t]
1672 ["Beginning of the article" gnus-summary-beginning-of-article t]
1673 ["End of the article" gnus-summary-end-of-article t]
1674 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1675 ["Fetch referenced articles" gnus-summary-refer-references t]
1676 ["Fetch current thread" gnus-summary-refer-thread t]
1677 ["Fetch article with id..." gnus-summary-refer-article t]
1678 ["Redisplay" gnus-summary-show-article t])))
1680 gnus-summary-article-menu gnus-summary-mode-map ""
1681 (cons "Article" innards))
1684 gnus-article-commands-menu gnus-article-mode-map ""
1685 (cons "Commands" innards)))
1688 gnus-summary-thread-menu gnus-summary-mode-map ""
1690 ["Toggle threading" gnus-summary-toggle-threads t]
1691 ["Hide threads" gnus-summary-hide-all-threads t]
1692 ["Show threads" gnus-summary-show-all-threads t]
1693 ["Hide thread" gnus-summary-hide-thread t]
1694 ["Show thread" gnus-summary-show-thread t]
1695 ["Go to next thread" gnus-summary-next-thread t]
1696 ["Go to previous thread" gnus-summary-prev-thread t]
1697 ["Go down thread" gnus-summary-down-thread t]
1698 ["Go up thread" gnus-summary-up-thread t]
1699 ["Top of thread" gnus-summary-top-thread t]
1700 ["Mark thread as read" gnus-summary-kill-thread t]
1701 ["Lower thread score" gnus-summary-lower-thread t]
1702 ["Raise thread score" gnus-summary-raise-thread t]
1703 ["Rethread current" gnus-summary-rethread-current t]
1707 gnus-summary-post-menu gnus-summary-mode-map ""
1709 ["Post an article" gnus-summary-post-news t]
1710 ["Followup" gnus-summary-followup t]
1711 ["Followup and yank" gnus-summary-followup-with-original t]
1712 ["Supersede article" gnus-summary-supersede-article t]
1713 ["Cancel article" gnus-summary-cancel-article t]
1714 ["Reply" gnus-summary-reply t]
1715 ["Reply and yank" gnus-summary-reply-with-original t]
1716 ["Wide reply" gnus-summary-wide-reply t]
1717 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1718 ["Mail forward" gnus-summary-mail-forward t]
1719 ["Post forward" gnus-summary-post-forward t]
1720 ["Digest and mail" gnus-uu-digest-mail-forward t]
1721 ["Digest and post" gnus-uu-digest-post-forward t]
1722 ["Resend message" gnus-summary-resend-message t]
1723 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1724 ["Send a mail" gnus-summary-mail-other-window t]
1725 ["Uuencode and post" gnus-uu-post-news t]
1726 ["Followup via news" gnus-summary-followup-to-mail t]
1727 ["Followup via news and yank"
1728 gnus-summary-followup-to-mail-with-original t]
1730 ;;["Send" gnus-summary-send-draft t]
1731 ;;["Send bounced" gnus-resend-bounced-mail t])
1735 gnus-summary-misc-menu gnus-summary-mode-map ""
1738 ["Mark as read" gnus-summary-mark-as-read-forward t]
1739 ["Mark same subject and select"
1740 gnus-summary-kill-same-subject-and-select t]
1741 ["Mark same subject" gnus-summary-kill-same-subject t]
1742 ["Catchup" gnus-summary-catchup t]
1743 ["Catchup all" gnus-summary-catchup-all t]
1744 ["Catchup to here" gnus-summary-catchup-to-here t]
1745 ["Catchup region" gnus-summary-mark-region-as-read t]
1746 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1748 ["Tick" gnus-summary-tick-article-forward t]
1749 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1750 ["Remove marks" gnus-summary-clear-mark-forward t]
1751 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1752 ["Set bookmark" gnus-summary-set-bookmark t]
1753 ["Remove bookmark" gnus-summary-remove-bookmark t])
1755 ["Marks..." gnus-summary-limit-to-marks t]
1756 ["Subject..." gnus-summary-limit-to-subject t]
1757 ["Author..." gnus-summary-limit-to-author t]
1758 ["Age..." gnus-summary-limit-to-age t]
1759 ["Score" gnus-summary-limit-to-score t]
1760 ["Unread" gnus-summary-limit-to-unread t]
1761 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1762 ["Articles" gnus-summary-limit-to-articles t]
1763 ["Pop limit" gnus-summary-pop-limit t]
1764 ["Show dormant" gnus-summary-limit-include-dormant t]
1765 ["Hide childless dormant"
1766 gnus-summary-limit-exclude-childless-dormant t]
1767 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1768 ["Show expunged" gnus-summary-show-all-expunged t])
1770 ["Set mark" gnus-summary-mark-as-processable t]
1771 ["Remove mark" gnus-summary-unmark-as-processable t]
1772 ["Remove all marks" gnus-summary-unmark-all-processable t]
1773 ["Mark above" gnus-uu-mark-over t]
1774 ["Mark series" gnus-uu-mark-series t]
1775 ["Mark region" gnus-uu-mark-region t]
1776 ["Unmark region" gnus-uu-unmark-region t]
1777 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1778 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1779 ["Mark all" gnus-uu-mark-all t]
1780 ["Mark buffer" gnus-uu-mark-buffer t]
1781 ["Mark sparse" gnus-uu-mark-sparse t]
1782 ["Mark thread" gnus-uu-mark-thread t]
1783 ["Unmark thread" gnus-uu-unmark-thread t]
1784 ("Process Mark Sets"
1785 ["Kill" gnus-summary-kill-process-mark t]
1786 ["Yank" gnus-summary-yank-process-mark
1787 gnus-newsgroup-process-stack]
1788 ["Save" gnus-summary-save-process-mark t]))
1790 ["Page forward" gnus-summary-next-page t]
1791 ["Page backward" gnus-summary-prev-page t]
1792 ["Line forward" gnus-summary-scroll-up t])
1794 ["Next unread article" gnus-summary-next-unread-article t]
1795 ["Previous unread article" gnus-summary-prev-unread-article t]
1796 ["Next article" gnus-summary-next-article t]
1797 ["Previous article" gnus-summary-prev-article t]
1798 ["Next unread subject" gnus-summary-next-unread-subject t]
1799 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1800 ["Next article same subject" gnus-summary-next-same-subject t]
1801 ["Previous article same subject" gnus-summary-prev-same-subject t]
1802 ["First unread article" gnus-summary-first-unread-article t]
1803 ["Best unread article" gnus-summary-best-unread-article t]
1804 ["Go to subject number..." gnus-summary-goto-subject t]
1805 ["Go to article number..." gnus-summary-goto-article t]
1806 ["Go to the last article" gnus-summary-goto-last-article t]
1807 ["Pop article off history" gnus-summary-pop-article t])
1809 ["Sort by number" gnus-summary-sort-by-number t]
1810 ["Sort by author" gnus-summary-sort-by-author t]
1811 ["Sort by subject" gnus-summary-sort-by-subject t]
1812 ["Sort by date" gnus-summary-sort-by-date t]
1813 ["Sort by score" gnus-summary-sort-by-score t]
1814 ["Sort by lines" gnus-summary-sort-by-lines t])
1816 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1817 ["Describe group" gnus-summary-describe-group t]
1818 ["Read manual" gnus-info-find-node t])
1820 ["Pick and read" gnus-pick-mode t]
1821 ["Binary" gnus-binary-mode t])
1823 ["Regenerate" gnus-summary-prepare t]
1824 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1825 ["Toggle threading" gnus-summary-toggle-threads t])
1826 ["Filter articles..." gnus-summary-execute-command t]
1827 ["Run command on subjects..." gnus-summary-universal-argument t]
1828 ["Search articles forward..." gnus-summary-search-article-forward t]
1829 ["Search articles backward..." gnus-summary-search-article-backward t]
1830 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1831 ["Expand window" gnus-summary-expand-window t]
1832 ["Expire expirable articles" gnus-summary-expire-articles
1833 (gnus-check-backend-function
1834 'request-expire-articles gnus-newsgroup-name)]
1835 ["Edit local kill file" gnus-summary-edit-local-kill t]
1836 ["Edit main kill file" gnus-summary-edit-global-kill t]
1837 ["Edit group parameters" gnus-summary-edit-parameters t]
1838 ["Customize group parameters" gnus-summary-customize-parameters t]
1839 ["Send a bug report" gnus-bug t]
1841 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1842 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1843 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1844 ["Exit group" gnus-summary-exit t]
1845 ["Exit group without updating" gnus-summary-exit-no-update t]
1846 ["Exit and goto next group" gnus-summary-next-group t]
1847 ["Exit and goto prev group" gnus-summary-prev-group t]
1848 ["Reselect group" gnus-summary-reselect-current-group t]
1849 ["Rescan group" gnus-summary-rescan-group t]
1850 ["Update dribble" gnus-summary-save-newsrc t])))
1852 (gnus-run-hooks 'gnus-summary-menu-hook)))
1854 (defun gnus-score-set-default (var value)
1855 "A version of set that updates the GNU Emacs menu-bar."
1857 ;; It is the message that forces the active status to be updated.
1860 (defun gnus-make-score-map (type)
1861 "Make a summary score map of type TYPE."
1864 (let ((headers '(("author" "from" string)
1865 ("subject" "subject" string)
1866 ("article body" "body" string)
1867 ("article head" "head" string)
1868 ("xref" "xref" string)
1869 ("extra header" "extra" string)
1870 ("lines" "lines" number)
1871 ("followups to author" "followup" string)))
1872 (types '((number ("less than" <)
1875 (string ("substring" s)
1879 (perms '(("temporary" (current-time-string))
1887 (if (eq type 'lower)
1892 (setq header (car headers))
1898 (let ((ts (cdr (assoc (nth 2 header) types)))
1914 'gnus-summary-score-entry
1916 (if (or (string= (nth 1 header)
1918 (string= (nth 1 header)
1921 (list 'gnus-summary-header
1923 (list 'quote (nth 1 (car ts)))
1924 (list 'gnus-score-default nil)
1930 (list (nreverse outp))))
1933 (list (nreverse outt))))
1935 (setq headers (cdr headers)))
1936 (list (nreverse outh))))))))
1940 (defun gnus-summary-mode (&optional group)
1941 "Major mode for reading articles.
1943 All normal editing commands are switched off.
1944 \\<gnus-summary-mode-map>
1945 Each line in this buffer represents one article. To read an
1946 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1947 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1950 You can also post articles and send mail from this buffer. To
1951 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1952 of an article, type `\\[gnus-summary-reply]'.
1954 There are approx. one gazillion commands you can execute in this
1955 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1957 The following commands are available:
1959 \\{gnus-summary-mode-map}"
1961 (when (gnus-visual-p 'summary-menu 'menu)
1962 (gnus-summary-make-menu-bar))
1963 (kill-all-local-variables)
1964 (gnus-summary-make-local-variables)
1965 (gnus-make-thread-indent-array)
1966 (gnus-simplify-mode-line)
1967 (setq major-mode 'gnus-summary-mode)
1968 (setq mode-name "Summary")
1969 (make-local-variable 'minor-mode-alist)
1970 (use-local-map gnus-summary-mode-map)
1971 (buffer-disable-undo)
1972 (setq buffer-read-only t) ;Disable modification
1973 (setq truncate-lines t)
1974 (setq selective-display t)
1975 (setq selective-display-ellipses t) ;Display `...'
1976 (gnus-summary-set-display-table)
1977 (gnus-set-default-directory)
1978 (setq gnus-newsgroup-name group)
1979 (make-local-variable 'gnus-summary-line-format)
1980 (make-local-variable 'gnus-summary-line-format-spec)
1981 (make-local-variable 'gnus-summary-dummy-line-format)
1982 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1983 (make-local-variable 'gnus-summary-mark-positions)
1984 (make-local-hook 'post-command-hook)
1985 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1986 (make-local-hook 'pre-command-hook)
1987 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1988 (gnus-run-hooks 'gnus-summary-mode-hook)
1989 (mm-enable-multibyte)
1990 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1991 (gnus-update-summary-mark-positions))
1993 (defun gnus-summary-make-local-variables ()
1994 "Make all the local summary buffer variables."
1995 (let ((locals gnus-summary-local-variables)
1997 (while (setq local (pop locals))
2000 (if (eq (cdr local) 'global)
2001 ;; Copy the global value of the variable.
2002 (setq global (symbol-value (car local)))
2003 ;; Use the value from the list.
2004 (setq global (eval (cdr local))))
2005 (make-local-variable (car local))
2006 (set (car local) global))
2007 ;; Simple nil-valued local variable.
2008 (make-local-variable local)
2011 (defun gnus-summary-clear-local-variables ()
2012 (let ((locals gnus-summary-local-variables))
2014 (if (consp (car locals))
2015 (and (vectorp (caar locals))
2016 (set (caar locals) nil))
2017 (and (vectorp (car locals))
2018 (set (car locals) nil)))
2019 (setq locals (cdr locals)))))
2021 ;; Summary data functions.
2023 (defmacro gnus-data-number (data)
2026 (defmacro gnus-data-set-number (data number)
2027 `(setcar ,data ,number))
2029 (defmacro gnus-data-mark (data)
2032 (defmacro gnus-data-set-mark (data mark)
2033 `(setcar (nthcdr 1 ,data) ,mark))
2035 (defmacro gnus-data-pos (data)
2038 (defmacro gnus-data-set-pos (data pos)
2039 `(setcar (nthcdr 2 ,data) ,pos))
2041 (defmacro gnus-data-header (data)
2044 (defmacro gnus-data-set-header (data header)
2045 `(setf (nth 3 ,data) ,header))
2047 (defmacro gnus-data-level (data)
2050 (defmacro gnus-data-unread-p (data)
2051 `(= (nth 1 ,data) gnus-unread-mark))
2053 (defmacro gnus-data-read-p (data)
2054 `(/= (nth 1 ,data) gnus-unread-mark))
2056 (defmacro gnus-data-pseudo-p (data)
2057 `(consp (nth 3 ,data)))
2059 (defmacro gnus-data-find (number)
2060 `(assq ,number gnus-newsgroup-data))
2062 (defmacro gnus-data-find-list (number &optional data)
2063 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2064 (memq (assq ,number bdata)
2067 (defmacro gnus-data-make (number mark pos header level)
2068 `(list ,number ,mark ,pos ,header ,level))
2070 (defun gnus-data-enter (after-article number mark pos header level offset)
2071 (let ((data (gnus-data-find-list after-article)))
2073 (error "No such article: %d" after-article))
2074 (setcdr data (cons (gnus-data-make number mark pos header level)
2076 (setq gnus-newsgroup-data-reverse nil)
2077 (gnus-data-update-list (cddr data) offset)))
2079 (defun gnus-data-enter-list (after-article list &optional offset)
2081 (let ((data (and after-article (gnus-data-find-list after-article)))
2085 (let ((odata gnus-newsgroup-data))
2086 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2088 (gnus-data-update-list odata offset)))
2089 ;; Find the last element in the list to be spliced into the main
2092 (setq list (cdr list)))
2095 (setcdr list gnus-newsgroup-data)
2096 (setq gnus-newsgroup-data ilist)
2098 (gnus-data-update-list (cdr list) offset)))
2099 (setcdr list (cdr data))
2102 (gnus-data-update-list (cdr list) offset))))
2103 (setq gnus-newsgroup-data-reverse nil))))
2105 (defun gnus-data-remove (article &optional offset)
2106 (let ((data gnus-newsgroup-data))
2107 (if (= (gnus-data-number (car data)) article)
2109 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2110 gnus-newsgroup-data-reverse nil)
2112 (gnus-data-update-list gnus-newsgroup-data offset)))
2114 (when (= (gnus-data-number (cadr data)) article)
2115 (setcdr data (cddr data))
2117 (gnus-data-update-list (cdr data) offset))
2119 gnus-newsgroup-data-reverse nil))
2120 (setq data (cdr data))))))
2122 (defmacro gnus-data-list (backward)
2124 (or gnus-newsgroup-data-reverse
2125 (setq gnus-newsgroup-data-reverse
2126 (reverse gnus-newsgroup-data)))
2127 gnus-newsgroup-data))
2129 (defun gnus-data-update-list (data offset)
2130 "Add OFFSET to the POS of all data entries in DATA."
2131 (setq gnus-newsgroup-data-reverse nil)
2133 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2134 (setq data (cdr data))))
2136 (defun gnus-summary-article-pseudo-p (article)
2137 "Say whether this article is a pseudo article or not."
2138 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2140 (defmacro gnus-summary-article-sparse-p (article)
2141 "Say whether this article is a sparse article or not."
2142 `(memq ,article gnus-newsgroup-sparse))
2144 (defmacro gnus-summary-article-ancient-p (article)
2145 "Say whether this article is a sparse article or not."
2146 `(memq ,article gnus-newsgroup-ancient))
2148 (defun gnus-article-parent-p (number)
2149 "Say whether this article is a parent or not."
2150 (let ((data (gnus-data-find-list number)))
2151 (and (cdr data) ; There has to be an article after...
2152 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2153 (gnus-data-level (nth 1 data))))))
2155 (defun gnus-article-children (number)
2156 "Return a list of all children to NUMBER."
2157 (let* ((data (gnus-data-find-list number))
2158 (level (gnus-data-level (car data)))
2160 (setq data (cdr data))
2162 (= (gnus-data-level (car data)) (1+ level)))
2163 (push (gnus-data-number (car data)) children)
2164 (setq data (cdr data)))
2167 (defmacro gnus-summary-skip-intangible ()
2168 "If the current article is intangible, then jump to a different article."
2169 '(let ((to (get-text-property (point) 'gnus-intangible)))
2170 (and to (gnus-summary-goto-subject to))))
2172 (defmacro gnus-summary-article-intangible-p ()
2173 "Say whether this article is intangible or not."
2174 '(get-text-property (point) 'gnus-intangible))
2176 (defun gnus-article-read-p (article)
2177 "Say whether ARTICLE is read or not."
2178 (not (or (memq article gnus-newsgroup-marked)
2179 (memq article gnus-newsgroup-unreads)
2180 (memq article gnus-newsgroup-unselected)
2181 (memq article gnus-newsgroup-dormant))))
2183 ;; Some summary mode macros.
2185 (defmacro gnus-summary-article-number ()
2186 "The article number of the article on the current line.
2187 If there isn's an article number here, then we return the current
2190 (gnus-summary-skip-intangible)
2191 (or (get-text-property (point) 'gnus-number)
2192 (gnus-summary-last-subject))))
2194 (defmacro gnus-summary-article-header (&optional number)
2195 "Return the header of article NUMBER."
2196 `(gnus-data-header (gnus-data-find
2197 ,(or number '(gnus-summary-article-number)))))
2199 (defmacro gnus-summary-thread-level (&optional number)
2200 "Return the level of thread that starts with article NUMBER."
2201 `(if (and (eq gnus-summary-make-false-root 'dummy)
2202 (get-text-property (point) 'gnus-intangible))
2204 (gnus-data-level (gnus-data-find
2205 ,(or number '(gnus-summary-article-number))))))
2207 (defmacro gnus-summary-article-mark (&optional number)
2208 "Return the mark of article NUMBER."
2209 `(gnus-data-mark (gnus-data-find
2210 ,(or number '(gnus-summary-article-number)))))
2212 (defmacro gnus-summary-article-pos (&optional number)
2213 "Return the position of the line of article NUMBER."
2214 `(gnus-data-pos (gnus-data-find
2215 ,(or number '(gnus-summary-article-number)))))
2217 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2218 (defmacro gnus-summary-article-subject (&optional number)
2219 "Return current subject string or nil if nothing."
2222 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2223 '(gnus-data-header (assq (gnus-summary-article-number)
2224 gnus-newsgroup-data)))))
2227 (mail-header-subject headers))))
2229 (defmacro gnus-summary-article-score (&optional number)
2230 "Return current article score."
2231 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2232 gnus-newsgroup-scored))
2233 gnus-summary-default-score 0))
2235 (defun gnus-summary-article-children (&optional number)
2236 "Return a list of article numbers that are children of article NUMBER."
2237 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2238 (level (gnus-data-level (car data)))
2240 (while (and (setq data (cdr data))
2241 (> (setq l (gnus-data-level (car data))) level))
2242 (and (= (1+ level) l)
2243 (push (gnus-data-number (car data))
2245 (nreverse children)))
2247 (defun gnus-summary-article-parent (&optional number)
2248 "Return the article number of the parent of article NUMBER."
2249 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2250 (gnus-data-list t)))
2251 (level (gnus-data-level (car data))))
2253 () ; This is a root.
2254 ;; We search until we find an article with a level less than
2255 ;; this one. That function has to be the parent.
2256 (while (and (setq data (cdr data))
2257 (not (< (gnus-data-level (car data)) level))))
2258 (and data (gnus-data-number (car data))))))
2260 (defun gnus-unread-mark-p (mark)
2261 "Say whether MARK is the unread mark."
2262 (= mark gnus-unread-mark))
2264 (defun gnus-read-mark-p (mark)
2265 "Say whether MARK is one of the marks that mark as read.
2266 This is all marks except unread, ticked, dormant, and expirable."
2267 (not (or (= mark gnus-unread-mark)
2268 (= mark gnus-ticked-mark)
2269 (= mark gnus-dormant-mark)
2270 (= mark gnus-expirable-mark))))
2272 (defmacro gnus-article-mark (number)
2273 "Return the MARK of article NUMBER.
2274 This macro should only be used when computing the mark the \"first\"
2275 time; i.e., when generating the summary lines. After that,
2276 `gnus-summary-article-mark' should be used to examine the
2279 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2280 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2281 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2282 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2283 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2284 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2285 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2286 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2287 gnus-ancient-mark))))
2289 ;; Saving hidden threads.
2291 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2292 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2294 (defmacro gnus-save-hidden-threads (&rest forms)
2295 "Save hidden threads, eval FORMS, and restore the hidden threads."
2296 (let ((config (make-symbol "config")))
2297 `(let ((,config (gnus-hidden-threads-configuration)))
2301 (gnus-restore-hidden-threads-configuration ,config)))))
2303 (defun gnus-data-compute-positions ()
2304 "Compute the positions of all articles."
2305 (setq gnus-newsgroup-data-reverse nil)
2306 (let ((data gnus-newsgroup-data))
2308 (gnus-save-hidden-threads
2309 (gnus-summary-show-all-threads)
2310 (goto-char (point-min))
2312 (while (get-text-property (point) 'gnus-intangible)
2314 (gnus-data-set-pos (car data) (+ (point) 3))
2315 (setq data (cdr data))
2316 (forward-line 1))))))
2318 (defun gnus-hidden-threads-configuration ()
2319 "Return the current hidden threads configuration."
2322 (goto-char (point-min))
2323 (while (search-forward "\r" nil t)
2324 (push (1- (point)) config))
2327 (defun gnus-restore-hidden-threads-configuration (config)
2328 "Restore hidden threads configuration from CONFIG."
2329 (let (point buffer-read-only)
2330 (while (setq point (pop config))
2331 (when (and (< point (point-max))
2333 (eq (char-after) ?\n))
2334 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2336 ;; Various summary mode internalish functions.
2338 (defun gnus-mouse-pick-article (e)
2341 (gnus-summary-next-page nil t))
2343 (defun gnus-summary-set-display-table ()
2344 ;; Change the display table. Odd characters have a tendency to mess
2345 ;; up nicely formatted displays - we make all possible glyphs
2346 ;; display only a single character.
2348 ;; We start from the standard display table, if any.
2349 (let ((table (or (copy-sequence standard-display-table)
2350 (make-display-table)))
2352 ;; Nix out all the control chars...
2353 (while (>= (setq i (1- i)) 0)
2354 (aset table i [??]))
2355 ;; ... but not newline and cr, of course. (cr is necessary for the
2356 ;; selective display).
2357 (aset table ?\n nil)
2358 (aset table ?\r nil)
2359 ;; We keep TAB as well.
2360 (aset table ?\t nil)
2361 ;; We nix out any glyphs over 126 that are not set already.
2363 (while (>= (setq i (1- i)) 127)
2364 ;; Only modify if the entry is nil.
2365 (unless (aref table i)
2366 (aset table i [??]))))
2367 (setq buffer-display-table table)))
2369 (defun gnus-summary-setup-buffer (group)
2370 "Initialize summary buffer."
2371 (let ((buffer (concat "*Summary " group "*")))
2372 (if (get-buffer buffer)
2375 (setq gnus-summary-buffer (current-buffer))
2376 (not gnus-newsgroup-prepared))
2377 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2378 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2379 (gnus-summary-mode group)
2381 (gnus-carpal-setup-buffer 'summary))
2382 (unless gnus-single-article-buffer
2383 (make-local-variable 'gnus-article-buffer)
2384 (make-local-variable 'gnus-article-current)
2385 (make-local-variable 'gnus-original-article-buffer))
2386 (setq gnus-newsgroup-name group)
2389 (defun gnus-set-global-variables ()
2390 ;; Set the global equivalents of the summary buffer-local variables
2391 ;; to the latest values they had. These reflect the summary buffer
2392 ;; that was in action when the last article was fetched.
2393 (when (eq major-mode 'gnus-summary-mode)
2394 (setq gnus-summary-buffer (current-buffer))
2395 (let ((name gnus-newsgroup-name)
2396 (marked gnus-newsgroup-marked)
2397 (unread gnus-newsgroup-unreads)
2398 (headers gnus-current-headers)
2399 (data gnus-newsgroup-data)
2400 (summary gnus-summary-buffer)
2401 (article-buffer gnus-article-buffer)
2402 (original gnus-original-article-buffer)
2403 (gac gnus-article-current)
2404 (reffed gnus-reffed-article-number)
2405 (score-file gnus-current-score-file)
2406 (default-charset gnus-newsgroup-charset))
2408 (set-buffer gnus-group-buffer)
2409 (setq gnus-newsgroup-name name
2410 gnus-newsgroup-marked marked
2411 gnus-newsgroup-unreads unread
2412 gnus-current-headers headers
2413 gnus-newsgroup-data data
2414 gnus-article-current gac
2415 gnus-summary-buffer summary
2416 gnus-article-buffer article-buffer
2417 gnus-original-article-buffer original
2418 gnus-reffed-article-number reffed
2419 gnus-current-score-file score-file
2420 gnus-newsgroup-charset default-charset)
2421 ;; The article buffer also has local variables.
2422 (when (gnus-buffer-live-p gnus-article-buffer)
2423 (set-buffer gnus-article-buffer)
2424 (setq gnus-summary-buffer summary))))))
2426 (defun gnus-summary-article-unread-p (article)
2427 "Say whether ARTICLE is unread or not."
2428 (memq article gnus-newsgroup-unreads))
2430 (defun gnus-summary-first-article-p (&optional article)
2431 "Return whether ARTICLE is the first article in the buffer."
2432 (if (not (setq article (or article (gnus-summary-article-number))))
2434 (eq article (caar gnus-newsgroup-data))))
2436 (defun gnus-summary-last-article-p (&optional article)
2437 "Return whether ARTICLE is the last article in the buffer."
2438 (if (not (setq article (or article (gnus-summary-article-number))))
2439 ;; All non-existent numbers are the last article. :-)
2441 (not (cdr (gnus-data-find-list article)))))
2443 (defun gnus-make-thread-indent-array ()
2445 (unless (and gnus-thread-indent-array
2446 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2447 (setq gnus-thread-indent-array (make-vector 201 "")
2448 gnus-thread-indent-array-level gnus-thread-indent-level)
2450 (aset gnus-thread-indent-array n
2451 (make-string (* n gnus-thread-indent-level) ? ))
2454 (defun gnus-update-summary-mark-positions ()
2455 "Compute where the summary marks are to go."
2457 (when (gnus-buffer-exists-p gnus-summary-buffer)
2458 (set-buffer gnus-summary-buffer))
2459 (let ((gnus-replied-mark 129)
2460 (gnus-score-below-mark 130)
2461 (gnus-score-over-mark 130)
2462 (gnus-download-mark 131)
2463 (spec gnus-summary-line-format-spec)
2466 (gnus-set-work-buffer)
2467 (let ((gnus-summary-line-format-spec spec)
2468 (gnus-newsgroup-downloadable '((0 . t))))
2469 (gnus-summary-insert-line
2470 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2471 (goto-char (point-min))
2472 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2474 (goto-char (point-min))
2475 (push (cons 'replied (and (search-forward "\201" nil t)
2478 (goto-char (point-min))
2479 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2481 (goto-char (point-min))
2482 (push (cons 'download
2483 (and (search-forward "\203" nil t) (- (point) 2)))
2485 (setq gnus-summary-mark-positions pos))))
2487 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2488 "Insert a dummy root in the summary buffer."
2490 (gnus-add-text-properties
2491 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2492 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2494 (defun gnus-summary-from-or-to-or-newsgroups (header)
2495 (let ((to (cdr (assq 'To (mail-header-extra header))))
2496 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2497 (mail-parse-charset gnus-newsgroup-charset))
2500 gnus-ignored-from-addresses
2501 (string-match gnus-ignored-from-addresses
2502 (mail-header-from header)))
2504 (or (car (funcall gnus-extract-address-components
2506 gnus-decode-encoded-word-function to)))
2507 (funcall gnus-decode-encoded-word-function to))))
2509 gnus-ignored-from-addresses
2510 (string-match gnus-ignored-from-addresses
2511 (mail-header-from header)))
2512 (concat "=> " newsgroups))
2514 (or (car (funcall gnus-extract-address-components
2515 (mail-header-from header)))
2516 (mail-header-from header))))))
2518 (defun gnus-summary-insert-line (gnus-tmp-header
2519 gnus-tmp-level gnus-tmp-current
2520 gnus-tmp-unread gnus-tmp-replied
2521 gnus-tmp-expirable gnus-tmp-subject-or-nil
2522 &optional gnus-tmp-dummy gnus-tmp-score
2524 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2525 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2526 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2527 (gnus-tmp-score-char
2528 (if (or (null gnus-summary-default-score)
2529 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2530 gnus-summary-zcore-fuzz))
2532 (if (< gnus-tmp-score gnus-summary-default-score)
2533 gnus-score-below-mark gnus-score-over-mark)))
2535 (cond (gnus-tmp-process gnus-process-mark)
2536 ((memq gnus-tmp-current gnus-newsgroup-cached)
2538 (gnus-tmp-replied gnus-replied-mark)
2539 ((memq gnus-tmp-current gnus-newsgroup-saved)
2541 (t gnus-unread-mark)))
2542 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2545 ((string-match "<[^>]+> *$" gnus-tmp-from)
2546 (let ((beg (match-beginning 0)))
2547 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2548 (substring gnus-tmp-from (1+ (match-beginning 0))
2549 (1- (match-end 0))))
2550 (substring gnus-tmp-from 0 beg))))
2551 ((string-match "(.+)" gnus-tmp-from)
2552 (substring gnus-tmp-from
2553 (1+ (match-beginning 0)) (1- (match-end 0))))
2555 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2556 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2557 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2558 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2559 (buffer-read-only nil))
2560 (when (string= gnus-tmp-name "")
2561 (setq gnus-tmp-name gnus-tmp-from))
2562 (unless (numberp gnus-tmp-lines)
2563 (setq gnus-tmp-lines 0))
2564 (gnus-put-text-property
2566 (progn (eval gnus-summary-line-format-spec) (point))
2567 'gnus-number gnus-tmp-number)
2568 (when (gnus-visual-p 'summary-highlight 'highlight)
2570 (gnus-run-hooks 'gnus-summary-update-hook)
2573 (defun gnus-summary-update-line (&optional dont-update)
2574 ;; Update summary line after change.
2575 (when (and gnus-summary-default-score
2576 (not gnus-summary-inhibit-highlight))
2577 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2578 (article (gnus-summary-article-number))
2579 (score (gnus-summary-article-score article)))
2581 (if (and gnus-summary-mark-below
2582 (< (gnus-summary-article-score)
2583 gnus-summary-mark-below))
2584 ;; This article has a low score, so we mark it as read.
2585 (when (memq article gnus-newsgroup-unreads)
2586 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2587 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2588 ;; This article was previously marked as read on account
2589 ;; of a low score, but now it has risen, so we mark it as
2591 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2592 (gnus-summary-update-mark
2593 (if (or (null gnus-summary-default-score)
2594 (<= (abs (- score gnus-summary-default-score))
2595 gnus-summary-zcore-fuzz))
2597 (if (< score gnus-summary-default-score)
2598 gnus-score-below-mark gnus-score-over-mark))
2600 ;; Do visual highlighting.
2601 (when (gnus-visual-p 'summary-highlight 'highlight)
2602 (gnus-run-hooks 'gnus-summary-update-hook)))))
2604 (defvar gnus-tmp-new-adopts nil)
2606 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2607 "Return the number of articles in THREAD.
2608 This may be 0 in some cases -- if none of the articles in
2609 the thread are to be displayed."
2611 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2613 ((not (listp thread))
2615 ((and (consp thread) (cdr thread))
2618 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2621 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2624 (when (and level (zerop level) gnus-tmp-new-adopts)
2627 'gnus-summary-number-of-articles-in-thread
2628 gnus-tmp-new-adopts))))
2630 (if (> number 1) gnus-not-empty-thread-mark
2631 gnus-empty-thread-mark)
2634 (defun gnus-summary-set-local-parameters (group)
2635 "Go through the local params of GROUP and set all variable specs in that list."
2636 (let ((params (gnus-group-find-parameter group))
2639 (setq elem (car params)
2640 params (cdr params))
2641 (and (consp elem) ; Has to be a cons.
2642 (consp (cdr elem)) ; The cdr has to be a list.
2643 (symbolp (car elem)) ; Has to be a symbol in there.
2644 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2645 (ignore-errors ; So we set it.
2646 (make-local-variable (car elem))
2647 (set (car elem) (eval (nth 1 elem))))))))
2649 (defun gnus-summary-read-group (group &optional show-all no-article
2650 kill-buffer no-display backward
2652 "Start reading news in newsgroup GROUP.
2653 If SHOW-ALL is non-nil, already read articles are also listed.
2654 If NO-ARTICLE is non-nil, no article is selected initially.
2655 If NO-DISPLAY, don't generate a summary buffer."
2659 (let ((gnus-auto-select-next nil))
2660 (or (gnus-summary-read-group-1
2661 group show-all no-article
2662 kill-buffer no-display
2665 select-articles nil)))))
2666 (eq gnus-auto-select-next 'quietly))
2667 (set-buffer gnus-group-buffer)
2668 ;; The entry function called above goes to the next
2669 ;; group automatically, so we go two groups back
2670 ;; if we are searching for the previous group.
2672 (gnus-group-prev-unread-group 2))
2673 (if (not (equal group (gnus-group-group-name)))
2674 (setq group (gnus-group-group-name))
2678 (defun gnus-summary-read-group-1 (group show-all no-article
2679 kill-buffer no-display
2680 &optional select-articles)
2681 ;; Killed foreign groups can't be entered.
2682 (when (and (not (gnus-group-native-p group))
2683 (not (gnus-gethash group gnus-newsrc-hashtb)))
2684 (error "Dead non-native groups can't be entered"))
2685 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2686 (let* ((new-group (gnus-summary-setup-buffer group))
2687 (quit-config (gnus-group-quit-config group))
2688 (did-select (and new-group (gnus-select-newsgroup
2689 group show-all select-articles))))
2691 ;; This summary buffer exists already, so we just select it.
2693 (gnus-set-global-variables)
2695 (gnus-kill-or-deaden-summary kill-buffer))
2696 (gnus-configure-windows 'summary 'force)
2697 (gnus-set-mode-line 'summary)
2698 (gnus-summary-position-point)
2701 ;; We couldn't select this group.
2703 (when (and (eq major-mode 'gnus-summary-mode)
2704 (not (equal (current-buffer) kill-buffer)))
2705 (kill-buffer (current-buffer))
2706 (if (not quit-config)
2708 ;; Update the info -- marks might need to be removed,
2710 (gnus-summary-update-info)
2711 (set-buffer gnus-group-buffer)
2712 (gnus-group-jump-to-group group)
2713 (gnus-group-next-unread-group 1))
2714 (gnus-handle-ephemeral-exit quit-config)))
2715 (gnus-message 3 "Can't select group")
2717 ;; The user did a `C-g' while prompting for number of articles,
2718 ;; so we exit this group.
2719 ((eq did-select 'quit)
2720 (and (eq major-mode 'gnus-summary-mode)
2721 (not (equal (current-buffer) kill-buffer))
2722 (kill-buffer (current-buffer)))
2724 (gnus-kill-or-deaden-summary kill-buffer))
2725 (if (not quit-config)
2727 (set-buffer gnus-group-buffer)
2728 (gnus-group-jump-to-group group)
2729 (gnus-group-next-unread-group 1)
2730 (gnus-configure-windows 'group 'force))
2731 (gnus-handle-ephemeral-exit quit-config))
2732 ;; Finally signal the quit.
2734 ;; The group was successfully selected.
2736 (gnus-set-global-variables)
2737 ;; Save the active value in effect when the group was entered.
2738 (setq gnus-newsgroup-active
2740 (gnus-active gnus-newsgroup-name)))
2741 ;; You can change the summary buffer in some way with this hook.
2742 (gnus-run-hooks 'gnus-select-group-hook)
2743 ;; Set any local variables in the group parameters.
2744 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2745 (gnus-update-format-specifications
2746 nil 'summary 'summary-mode 'summary-dummy)
2747 ;; Do score processing.
2748 (when gnus-use-scoring
2749 (gnus-possibly-score-headers))
2750 ;; Check whether to fill in the gaps in the threads.
2751 (when gnus-build-sparse-threads
2752 (gnus-build-sparse-threads))
2753 ;; Find the initial limit.
2754 (if gnus-show-threads
2756 (let ((gnus-newsgroup-dormant nil))
2757 (gnus-summary-initial-limit show-all))
2758 (gnus-summary-initial-limit show-all))
2759 (setq gnus-newsgroup-limit
2761 (lambda (header) (mail-header-number header))
2762 gnus-newsgroup-headers)))
2763 ;; Generate the summary buffer.
2765 (gnus-summary-prepare))
2766 (when gnus-use-trees
2767 (gnus-tree-open group)
2768 (setq gnus-summary-highlight-line-function
2769 'gnus-tree-highlight-article))
2770 ;; If the summary buffer is empty, but there are some low-scored
2771 ;; articles or some excluded dormants, we include these in the
2773 (when (and (zerop (buffer-size))
2775 (cond (gnus-newsgroup-dormant
2776 (gnus-summary-limit-include-dormant))
2777 ((and gnus-newsgroup-scored show-all)
2778 (gnus-summary-limit-include-expunged t))))
2779 ;; Function `gnus-apply-kill-file' must be called in this hook.
2780 (gnus-run-hooks 'gnus-apply-kill-hook)
2781 (if (and (zerop (buffer-size))
2784 ;; This newsgroup is empty.
2785 (gnus-summary-catchup-and-exit nil t)
2786 (gnus-message 6 "No unread news")
2788 (gnus-kill-or-deaden-summary kill-buffer))
2789 ;; Return nil from this function.
2791 ;; Hide conversation thread subtrees. We cannot do this in
2792 ;; gnus-summary-prepare-hook since kill processing may not
2793 ;; work with hidden articles.
2794 (and gnus-show-threads
2795 gnus-thread-hide-subtree
2796 (gnus-summary-hide-all-threads))
2798 (gnus-kill-or-deaden-summary kill-buffer))
2799 ;; Show first unread article if requested.
2800 (if (and (not no-article)
2802 gnus-newsgroup-unreads
2803 gnus-auto-select-first)
2805 (gnus-configure-windows 'summary)
2807 ((eq gnus-auto-select-first 'best)
2808 (gnus-summary-best-unread-article))
2809 ((eq gnus-auto-select-first t)
2810 (gnus-summary-first-unread-article))
2811 ((gnus-functionp gnus-auto-select-first)
2812 (funcall gnus-auto-select-first))))
2813 ;; Don't select any articles, just move point to the first
2814 ;; article in the group.
2815 (goto-char (point-min))
2816 (gnus-summary-position-point)
2817 (gnus-configure-windows 'summary 'force)
2818 (gnus-set-mode-line 'summary))
2819 (when (get-buffer-window gnus-group-buffer t)
2820 ;; Gotta use windows, because recenter does weird stuff if
2821 ;; the current buffer ain't the displayed window.
2822 (let ((owin (selected-window)))
2823 (select-window (get-buffer-window gnus-group-buffer t))
2824 (when (gnus-group-goto-group group)
2826 (select-window owin)))
2827 ;; Mark this buffer as "prepared".
2828 (setq gnus-newsgroup-prepared t)
2829 (gnus-run-hooks 'gnus-summary-prepared-hook)
2832 (defun gnus-summary-prepare ()
2833 "Generate the summary buffer."
2835 (let ((buffer-read-only nil))
2837 (setq gnus-newsgroup-data nil
2838 gnus-newsgroup-data-reverse nil)
2839 (gnus-run-hooks 'gnus-summary-generate-hook)
2840 ;; Generate the buffer, either with threads or without.
2841 (when gnus-newsgroup-headers
2842 (gnus-summary-prepare-threads
2843 (if gnus-show-threads
2844 (gnus-sort-gathered-threads
2845 (funcall gnus-summary-thread-gathering-function
2847 (gnus-cut-threads (gnus-make-threads)))))
2848 ;; Unthreaded display.
2849 (gnus-sort-articles gnus-newsgroup-headers))))
2850 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2851 ;; Call hooks for modifying summary buffer.
2852 (goto-char (point-min))
2853 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2855 (defsubst gnus-general-simplify-subject (subject)
2856 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2859 ;; Truncate the subject.
2860 (gnus-simplify-subject-functions
2861 (gnus-map-function gnus-simplify-subject-functions subject))
2862 ((numberp gnus-summary-gather-subject-limit)
2863 (setq subject (gnus-simplify-subject-re subject))
2864 (if (> (length subject) gnus-summary-gather-subject-limit)
2865 (substring subject 0 gnus-summary-gather-subject-limit)
2867 ;; Fuzzily simplify it.
2868 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2869 (gnus-simplify-subject-fuzzy subject))
2870 ;; Just remove the leading "Re:".
2872 (gnus-simplify-subject-re subject))))
2874 (if (and gnus-summary-gather-exclude-subject
2875 (string-match gnus-summary-gather-exclude-subject subject))
2876 nil ; This article shouldn't be gathered
2879 (defun gnus-summary-simplify-subject-query ()
2880 "Query where the respool algorithm would put this article."
2882 (gnus-summary-select-article)
2883 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2885 (defun gnus-gather-threads-by-subject (threads)
2886 "Gather threads by looking at Subject headers."
2887 (if (not gnus-summary-make-false-root)
2889 (let ((hashtb (gnus-make-hashtable 1024))
2892 subject hthread whole-subject)
2894 (setq subject (gnus-general-simplify-subject
2895 (setq whole-subject (mail-header-subject
2898 (if (setq hthread (gnus-gethash subject hashtb))
2900 ;; We enter a dummy root into the thread, if we
2901 ;; haven't done that already.
2902 (unless (stringp (caar hthread))
2903 (setcar hthread (list whole-subject (car hthread))))
2904 ;; We add this new gathered thread to this gathered
2906 (setcdr (car hthread)
2907 (nconc (cdar hthread) (list (car threads))))
2908 ;; Remove it from the list of threads.
2909 (setcdr prev (cdr threads))
2910 (setq threads prev))
2911 ;; Enter this thread into the hash table.
2912 (gnus-sethash subject threads hashtb)))
2914 (setq threads (cdr threads)))
2917 (defun gnus-gather-threads-by-references (threads)
2918 "Gather threads by looking at References headers."
2919 (let ((idhashtb (gnus-make-hashtable 1024))
2920 (thhashtb (gnus-make-hashtable 1024))
2923 ids references id gthread gid entered ref)
2925 (when (setq references (mail-header-references (caar threads)))
2926 (setq id (mail-header-id (caar threads))
2927 ids (gnus-split-references references)
2929 (while (setq ref (pop ids))
2930 (setq ids (delete ref ids))
2931 (if (not (setq gid (gnus-gethash ref idhashtb)))
2933 (gnus-sethash ref id idhashtb)
2934 (gnus-sethash id threads thhashtb))
2935 (setq gthread (gnus-gethash gid thhashtb))
2937 ;; We enter a dummy root into the thread, if we
2938 ;; haven't done that already.
2939 (unless (stringp (caar gthread))
2940 (setcar gthread (list (mail-header-subject (caar gthread))
2942 ;; We add this new gathered thread to this gathered
2944 (setcdr (car gthread)
2945 (nconc (cdar gthread) (list (car threads)))))
2946 ;; Add it into the thread hash table.
2947 (gnus-sethash id gthread thhashtb)
2949 ;; Remove it from the list of threads.
2950 (setcdr prev (cdr threads))
2951 (setq threads prev))))
2953 (setq threads (cdr threads)))
2956 (defun gnus-sort-gathered-threads (threads)
2957 "Sort subtreads inside each gathered thread by article number."
2958 (let ((result threads))
2960 (when (stringp (caar threads))
2961 (setcdr (car threads)
2962 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2963 (setq threads (cdr threads)))
2966 (defun gnus-thread-loop-p (root thread)
2967 "Say whether ROOT is in THREAD."
2968 (let ((stack (list thread))
2971 (while (setq thread (pop stack))
2972 (setq th (cdr thread))
2974 (not (eq (caar th) root)))
2977 ;; We have found a loop.
2979 (setcdr thread (delq (car th) (cdr thread)))
2980 (if (boundp (setq ref-dep (intern "none"
2981 gnus-newsgroup-dependencies)))
2982 (setcdr (symbol-value ref-dep)
2983 (nconc (cdr (symbol-value ref-dep))
2985 (set ref-dep (list nil (car th))))
2988 ;; Push all the subthreads onto the stack.
2989 (push (cdr thread) stack)))
2992 (defun gnus-make-threads ()
2993 "Go through the dependency hashtb and find the roots. Return all threads."
2995 (while (catch 'infloop
2998 ;; Deal with self-referencing References loops.
2999 (when (and (car (symbol-value refs))
3006 (car (symbol-value refs)) thread))
3007 (cdr (symbol-value refs)))))))
3010 (unless (car (symbol-value refs))
3011 ;; These threads do not refer back to any other articles,
3012 ;; so they're roots.
3013 (setq threads (append (cdr (symbol-value refs)) threads))))
3014 gnus-newsgroup-dependencies)))
3017 ;; Build the thread tree.
3018 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3019 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3021 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3022 if it was already present.
3024 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3025 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3026 Message-IDs will be renamed be renamed to a unique Message-ID before
3029 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3030 (let* ((id (mail-header-id header))
3031 (id-dep (and id (intern id dependencies)))
3032 ref ref-dep ref-header)
3033 ;; Enter this `header' in the `dependencies' table.
3037 ;; The first two cases do the normal part: enter a new `header'
3038 ;; in the `dependencies' table.
3039 ((not (boundp id-dep))
3040 (set id-dep (list header)))
3041 ((null (car (symbol-value id-dep)))
3042 (setcar (symbol-value id-dep) header))
3044 ;; From here the `header' was already present in the
3045 ;; `dependencies' table.
3047 ;; Overrides an existing entry;
3048 ;; just set the header part of the entry.
3049 (setcar (symbol-value id-dep) header))
3051 ;; Renames the existing `header' to a unique Message-ID.
3052 ((not gnus-summary-ignore-duplicates)
3053 ;; An article with this Message-ID has already been seen.
3054 ;; We rename the Message-ID.
3055 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3057 (mail-header-set-id header id))
3059 ;; The last case ignores an existing entry, except it adds any
3060 ;; additional Xrefs (in case the two articles came from different
3062 ;; Also sets `header' to `nil' meaning that the `dependencies'
3063 ;; table was *not* modified.
3065 (mail-header-set-xref
3066 (car (symbol-value id-dep))
3067 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3069 (or (mail-header-xref header) "")))
3073 ;; First check if that we are not creating a References loop.
3074 (setq ref (gnus-parent-id (mail-header-references header)))
3076 (setq ref-dep (intern-soft ref dependencies))
3078 (setq ref-header (car (symbol-value ref-dep))))
3079 (if (string= id ref)
3080 ;; Yuk! This is a reference loop. Make the article be a
3083 (mail-header-set-references (car (symbol-value id-dep)) "none")
3085 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3086 (setq ref (gnus-parent-id (mail-header-references header)))
3087 (setq ref-dep (intern (or ref "none") dependencies))
3088 (if (boundp ref-dep)
3089 (setcdr (symbol-value ref-dep)
3090 (nconc (cdr (symbol-value ref-dep))
3091 (list (symbol-value id-dep))))
3092 (set ref-dep (list nil (symbol-value id-dep)))))
3095 (defun gnus-build-sparse-threads ()
3096 (let ((headers gnus-newsgroup-headers)
3097 (gnus-summary-ignore-duplicates t)
3098 header references generation relations
3099 subject child end new-child date)
3100 ;; First we create an alist of generations/relations, where
3101 ;; generations is how much we trust the relation, and the relation
3103 (gnus-message 7 "Making sparse threads...")
3105 (nnheader-set-temp-buffer " *gnus sparse threads*")
3106 (while (setq header (pop headers))
3107 (when (and (setq references (mail-header-references header))
3108 (not (string= references "")))
3110 (setq child (mail-header-id header)
3111 subject (mail-header-subject header)
3112 date (mail-header-date header)
3114 (while (search-backward ">" nil t)
3115 (setq end (1+ (point)))
3116 (when (search-backward "<" nil t)
3117 (setq new-child (buffer-substring (point) end))
3118 (push (list (incf generation)
3119 child (setq child new-child)
3123 (push (list (1+ generation) child nil subject) relations))
3125 (kill-buffer (current-buffer)))
3126 ;; Sort over trustworthiness.
3129 (when (gnus-dependencies-add-header
3130 (make-full-mail-header
3131 gnus-reffed-article-number
3132 (nth 3 relation) "" (or (nth 4 relation) "")
3134 (or (nth 2 relation) "") 0 0 "")
3135 gnus-newsgroup-dependencies nil)
3136 (push gnus-reffed-article-number gnus-newsgroup-limit)
3137 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3138 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3139 gnus-newsgroup-reads)
3140 (decf gnus-reffed-article-number)))
3141 (sort relations 'car-less-than-car))
3142 (gnus-message 7 "Making sparse threads...done")))
3144 (defun gnus-build-old-threads ()
3145 ;; Look at all the articles that refer back to old articles, and
3146 ;; fetch the headers for the articles that aren't there. This will
3147 ;; build complete threads - if the roots haven't been expired by the
3152 (when (not (car (symbol-value refs)))
3153 (setq heads (cdr (symbol-value refs)))
3155 (if (memq (mail-header-number (caar heads))
3156 gnus-newsgroup-dormant)
3157 (setq heads (cdr heads))
3158 (setq id (symbol-name refs))
3159 (while (and (setq id (gnus-build-get-header id))
3160 (not (car (gnus-id-to-thread id)))))
3161 (setq heads nil)))))
3162 gnus-newsgroup-dependencies)))
3164 (defmacro gnus-nov-read-integer ()
3166 (if (eq (char-after) ?\t)
3168 (let ((num (ignore-errors (read buffer))))
3169 (if (numberp num) num 0)))
3171 (search-forward "\t" eol 'move))))
3173 (defmacro gnus-nov-skip-field ()
3174 '(search-forward "\t" eol 'move))
3176 (defmacro gnus-nov-field ()
3177 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
3179 (defmacro gnus-nov-parse-extra ()
3181 (while (not (memq (char-after) '(?\n nil)))
3182 (setq string (gnus-nov-field))
3183 (when (string-match "^\\([^ :]+\\): " string)
3184 (push (cons (intern (match-string 1 string))
3185 (substring string (match-end 0)))
3189 ;; This function has to be called with point after the article number
3190 ;; on the beginning of the line.
3191 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3192 (let ((eol (gnus-point-at-eol))
3193 (buffer (current-buffer))
3196 ;; overview: [num subject from date id refs chars lines misc]
3199 (narrow-to-region (point) eol)
3204 (make-full-mail-header
3206 (funcall gnus-decode-encoded-word-function
3207 (gnus-nov-field)) ; subject
3208 (funcall gnus-decode-encoded-word-function
3209 (gnus-nov-field)) ; from
3210 (gnus-nov-field) ; date
3211 (or (gnus-nov-field)
3212 (nnheader-generate-fake-message-id)) ; id
3213 (gnus-nov-field) ; refs
3214 (gnus-nov-read-integer) ; chars
3215 (gnus-nov-read-integer) ; lines
3216 (unless (eq (char-after) ?\n)
3217 (gnus-nov-field)) ; misc
3218 (gnus-nov-parse-extra)))) ; extra
3222 (when gnus-alter-header-function
3223 (funcall gnus-alter-header-function header))
3224 (gnus-dependencies-add-header header dependencies force-new)))
3226 (defun gnus-build-get-header (id)
3227 ;; Look through the buffer of NOV lines and find the header to
3228 ;; ID. Enter this line into the dependencies hash table, and return
3229 ;; the id of the parent article (if any).
3230 (let ((deps gnus-newsgroup-dependencies)
3234 (set-buffer nntp-server-buffer)
3235 (let ((case-fold-search nil))
3236 (goto-char (point-min))
3237 (while (and (not found)
3238 (search-forward id nil t))
3240 (setq found (looking-at
3241 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3242 (regexp-quote id))))
3243 (or found (beginning-of-line 2)))
3247 (setq header (gnus-nov-parse-line
3248 (read (current-buffer)) deps))
3249 (gnus-parent-id (mail-header-references header))))))
3251 (let ((number (mail-header-number header)))
3252 (push number gnus-newsgroup-limit)
3253 (push header gnus-newsgroup-headers)
3254 (if (memq number gnus-newsgroup-unselected)
3256 (push number gnus-newsgroup-unreads)
3257 (setq gnus-newsgroup-unselected
3258 (delq number gnus-newsgroup-unselected)))
3259 (push number gnus-newsgroup-ancient)))))))
3261 (defun gnus-build-all-threads ()
3262 "Read all the headers."
3263 (let ((gnus-summary-ignore-duplicates t)
3264 (dependencies gnus-newsgroup-dependencies)
3267 (set-buffer nntp-server-buffer)
3268 (let ((case-fold-search nil))
3269 (goto-char (point-min))
3272 (setq article (read (current-buffer))
3273 header (gnus-nov-parse-line
3274 article dependencies)))
3277 (set-buffer gnus-summary-buffer)
3278 (push header gnus-newsgroup-headers)
3279 (if (memq (setq article (mail-header-number header))
3280 gnus-newsgroup-unselected)
3282 (push article gnus-newsgroup-unreads)
3283 (setq gnus-newsgroup-unselected
3284 (delq article gnus-newsgroup-unselected)))
3285 (push article gnus-newsgroup-ancient)))
3286 (forward-line 1)))))))
3288 (defun gnus-summary-update-article-line (article header)
3289 "Update the line for ARTICLE using HEADERS."
3290 (let* ((id (mail-header-id header))
3291 (thread (gnus-id-to-thread id)))
3293 (error "Article in no thread"))
3294 ;; Update the thread.
3295 (setcar thread header)
3296 (gnus-summary-goto-subject article)
3297 (let* ((datal (gnus-data-find-list article))
3299 (length (when (cdr datal)
3300 (- (gnus-data-pos data)
3301 (gnus-data-pos (cadr datal)))))
3302 (buffer-read-only nil)
3303 (level (gnus-summary-thread-level)))
3305 (gnus-summary-insert-line
3306 header level nil (gnus-article-mark article)
3307 (memq article gnus-newsgroup-replied)
3308 (memq article gnus-newsgroup-expirable)
3309 ;; Only insert the Subject string when it's different
3310 ;; from the previous Subject string.
3311 (if (gnus-subject-equal
3313 (mail-header-subject
3316 (gnus-data-find-list
3318 (gnus-data-list t)))))
3319 ;; Error on the side of excessive subjects.
3321 (mail-header-subject header))
3323 (mail-header-subject header))
3324 nil (cdr (assq article gnus-newsgroup-scored))
3325 (memq article gnus-newsgroup-processable))
3327 (gnus-data-update-list
3328 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3330 (defun gnus-summary-update-article (article &optional iheader)
3331 "Update ARTICLE in the summary buffer."
3332 (set-buffer gnus-summary-buffer)
3333 (let* ((header (gnus-summary-article-header article))
3334 (id (mail-header-id header))
3335 (data (gnus-data-find article))
3336 (thread (gnus-id-to-thread id))
3337 (references (mail-header-references header))
3341 (when (and references
3342 (not (equal "" references)))
3345 (buffer-read-only nil)
3351 (delq thread parent)))
3352 (if (gnus-summary-insert-subject id header)
3353 ;; Set the (possibly) new article number in the data structure.
3354 (gnus-data-set-number data (gnus-id-to-article id))
3358 (defun gnus-rebuild-thread (id &optional line)
3359 "Rebuild the thread containing ID.
3360 If LINE, insert the rebuilt thread starting on line LINE."
3361 (let ((buffer-read-only nil)
3362 old-pos current thread data)
3363 (if (not gnus-show-threads)
3364 (setq thread (list (car (gnus-id-to-thread id))))
3365 ;; Get the thread this article is part of.
3366 (setq thread (gnus-remove-thread id)))
3367 (setq old-pos (gnus-point-at-bol))
3368 (setq current (save-excursion
3369 (and (zerop (forward-line -1))
3370 (gnus-summary-article-number))))
3371 ;; If this is a gathered thread, we have to go some re-gathering.
3372 (when (stringp (car thread))
3373 (let ((subject (car thread))
3375 (setq thread (cdr thread))
3377 (unless (memq (setq thr (gnus-id-to-thread
3379 (mail-header-id (caar thread)))))
3382 (setq thread (cdr thread)))
3383 ;; We now have all (unique) roots.
3384 (if (= (length roots) 1)
3385 ;; All the loose roots are now one solid root.
3386 (setq thread (car roots))
3387 (setq thread (cons subject (gnus-sort-threads roots))))))
3389 ;; We then insert this thread into the summary buffer.
3391 (goto-char (point-min))
3392 (forward-line (1- line)))
3393 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3394 (if gnus-show-threads
3395 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3396 (gnus-summary-prepare-unthreaded thread))
3397 (setq data (nreverse gnus-newsgroup-data))
3398 (setq threads gnus-newsgroup-threads))
3399 ;; We splice the new data into the data structure.
3400 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3401 ;;!!! then we want to insert at the beginning of the buffer.
3402 ;;!!! That happens to be true with Gnus now, but that may
3403 ;;!!! change in the future. Perhaps.
3404 (gnus-data-enter-list
3405 (if line nil current) data (- (point) old-pos))
3406 (setq gnus-newsgroup-threads
3407 (nconc threads gnus-newsgroup-threads))
3408 (gnus-data-compute-positions))))
3410 (defun gnus-number-to-header (number)
3411 "Return the header for article NUMBER."
3412 (let ((headers gnus-newsgroup-headers))
3414 (not (= number (mail-header-number (car headers)))))
3419 (defun gnus-parent-headers (in-headers &optional generation)
3420 "Return the headers of the GENERATIONeth parent of HEADERS."
3422 (setq generation 1))
3424 (headers in-headers)
3427 (not (zerop generation))
3428 (setq references (mail-header-references headers)))
3429 (setq headers (if (and references
3430 (setq parent (gnus-parent-id references)))
3431 (car (gnus-id-to-thread parent))
3434 (and (not (eq headers in-headers))
3437 (defun gnus-id-to-thread (id)
3438 "Return the (sub-)thread where ID appears."
3439 (gnus-gethash id gnus-newsgroup-dependencies))
3441 (defun gnus-id-to-article (id)
3442 "Return the article number of ID."
3443 (let ((thread (gnus-id-to-thread id)))
3446 (mail-header-number (car thread)))))
3448 (defun gnus-id-to-header (id)
3449 "Return the article headers of ID."
3450 (car (gnus-id-to-thread id)))
3452 (defun gnus-article-displayed-root-p (article)
3453 "Say whether ARTICLE is a root(ish) article."
3454 (let ((level (gnus-summary-thread-level article))
3455 (refs (mail-header-references (gnus-summary-article-header article)))
3461 ((null (gnus-parent-id refs)) t)
3463 (null (setq particle (gnus-id-to-article
3464 (gnus-parent-id refs))))
3465 (null (gnus-summary-thread-level particle)))))))
3467 (defun gnus-root-id (id)
3468 "Return the id of the root of the thread where ID appears."
3470 (while (and id (setq prev (car (gnus-id-to-thread id))))
3472 id (gnus-parent-id (mail-header-references prev))))
3475 (defun gnus-articles-in-thread (thread)
3476 "Return the list of articles in THREAD."
3477 (cons (mail-header-number (car thread))
3478 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3480 (defun gnus-remove-thread (id &optional dont-remove)
3481 "Remove the thread that has ID in it."
3482 (let (headers thread last-id)
3483 ;; First go up in this thread until we find the root.
3484 (setq last-id (gnus-root-id id)
3485 headers (message-flatten-list (gnus-id-to-thread last-id)))
3486 ;; We have now found the real root of this thread. It might have
3487 ;; been gathered into some loose thread, so we have to search
3488 ;; through the threads to find the thread we wanted.
3489 (let ((threads gnus-newsgroup-threads)
3492 (setq sub (car threads))
3493 (if (stringp (car sub))
3494 ;; This is a gathered thread, so we look at the roots
3495 ;; below it to find whether this article is in this
3498 (setq sub (cdr sub))
3500 (when (member (caar sub) headers)
3501 (setq thread (car threads)
3504 (setq sub (cdr sub))))
3505 ;; It's an ordinary thread, so we check it.
3506 (when (eq (car sub) (car headers))
3509 (setq threads (cdr threads)))
3510 ;; If this article is in no thread, then it's a root.
3513 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3514 (setq thread (gnus-id-to-thread last-id)))
3517 thread ; We return this thread.
3519 (if (stringp (car thread))
3521 ;; If we use dummy roots, then we have to remove the
3522 ;; dummy root as well.
3523 (when (eq gnus-summary-make-false-root 'dummy)
3524 ;; We go to the dummy root by going to
3525 ;; the first sub-"thread", and then one line up.
3526 (gnus-summary-goto-article
3527 (mail-header-number (caadr thread)))
3530 (gnus-data-compute-positions))
3531 (setq thread (cdr thread))
3533 (gnus-remove-thread-1 (car thread))
3534 (setq thread (cdr thread))))
3535 (gnus-summary-show-all-threads)
3536 (gnus-remove-thread-1 thread))))))))
3538 (defun gnus-remove-thread-1 (thread)
3539 "Remove the thread THREAD recursively."
3540 (let ((number (mail-header-number (pop thread)))
3542 (setq thread (reverse thread))
3544 (gnus-remove-thread-1 (pop thread)))
3545 (when (setq d (gnus-data-find number))
3546 (goto-char (gnus-data-pos d))
3549 (- (gnus-point-at-bol)
3551 (1+ (gnus-point-at-eol))
3552 (gnus-delete-line)))))))
3554 (defun gnus-sort-threads (threads)
3556 (if (not gnus-thread-sort-functions)
3558 (gnus-message 8 "Sorting threads...")
3560 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3561 (gnus-message 8 "Sorting threads...done"))))
3563 (defun gnus-sort-articles (articles)
3565 (when gnus-article-sort-functions
3566 (gnus-message 7 "Sorting articles...")
3568 (setq gnus-newsgroup-headers
3569 (sort articles (gnus-make-sort-function
3570 gnus-article-sort-functions)))
3571 (gnus-message 7 "Sorting articles...done"))))
3573 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3574 (defmacro gnus-thread-header (thread)
3575 ;; Return header of first article in THREAD.
3576 ;; Note that THREAD must never, ever be anything else than a variable -
3577 ;; using some other form will lead to serious barfage.
3578 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3579 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3580 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3583 (defsubst gnus-article-sort-by-number (h1 h2)
3584 "Sort articles by article number."
3585 (< (mail-header-number h1)
3586 (mail-header-number h2)))
3588 (defun gnus-thread-sort-by-number (h1 h2)
3589 "Sort threads by root article number."
3590 (gnus-article-sort-by-number
3591 (gnus-thread-header h1) (gnus-thread-header h2)))
3593 (defsubst gnus-article-sort-by-lines (h1 h2)
3594 "Sort articles by article Lines header."
3595 (< (mail-header-lines h1)
3596 (mail-header-lines h2)))
3598 (defun gnus-thread-sort-by-lines (h1 h2)
3599 "Sort threads by root article Lines header."
3600 (gnus-article-sort-by-lines
3601 (gnus-thread-header h1) (gnus-thread-header h2)))
3603 (defsubst gnus-article-sort-by-author (h1 h2)
3604 "Sort articles by root author."
3606 (let ((extract (funcall
3607 gnus-extract-address-components
3608 (mail-header-from h1))))
3609 (or (car extract) (cadr extract) ""))
3610 (let ((extract (funcall
3611 gnus-extract-address-components
3612 (mail-header-from h2))))
3613 (or (car extract) (cadr extract) ""))))
3615 (defun gnus-thread-sort-by-author (h1 h2)
3616 "Sort threads by root author."
3617 (gnus-article-sort-by-author
3618 (gnus-thread-header h1) (gnus-thread-header h2)))
3620 (defsubst gnus-article-sort-by-subject (h1 h2)
3621 "Sort articles by root subject."
3623 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3624 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3626 (defun gnus-thread-sort-by-subject (h1 h2)
3627 "Sort threads by root subject."
3628 (gnus-article-sort-by-subject
3629 (gnus-thread-header h1) (gnus-thread-header h2)))
3631 (defsubst gnus-article-sort-by-date (h1 h2)
3632 "Sort articles by root article date."
3634 (gnus-date-get-time (mail-header-date h1))
3635 (gnus-date-get-time (mail-header-date h2))))
3637 (defun gnus-thread-sort-by-date (h1 h2)
3638 "Sort threads by root article date."
3639 (gnus-article-sort-by-date
3640 (gnus-thread-header h1) (gnus-thread-header h2)))
3642 (defsubst gnus-article-sort-by-score (h1 h2)
3643 "Sort articles by root article score.
3644 Unscored articles will be counted as having a score of zero."
3645 (> (or (cdr (assq (mail-header-number h1)
3646 gnus-newsgroup-scored))
3647 gnus-summary-default-score 0)
3648 (or (cdr (assq (mail-header-number h2)
3649 gnus-newsgroup-scored))
3650 gnus-summary-default-score 0)))
3652 (defun gnus-thread-sort-by-score (h1 h2)
3653 "Sort threads by root article score."
3654 (gnus-article-sort-by-score
3655 (gnus-thread-header h1) (gnus-thread-header h2)))
3657 (defun gnus-thread-sort-by-total-score (h1 h2)
3658 "Sort threads by the sum of all scores in the thread.
3659 Unscored articles will be counted as having a score of zero."
3660 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3662 (defun gnus-thread-total-score (thread)
3663 ;; This function find the total score of THREAD.
3664 (cond ((null thread)
3667 (if (stringp (car thread))
3668 (apply gnus-thread-score-function 0
3669 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3670 (gnus-thread-total-score-1 thread)))
3672 (gnus-thread-total-score-1 (list thread)))))
3674 (defun gnus-thread-total-score-1 (root)
3675 ;; This function find the total score of the thread below ROOT.
3676 (setq root (car root))
3677 (apply gnus-thread-score-function
3679 (mapcar 'gnus-thread-total-score
3680 (cdr (gnus-id-to-thread (mail-header-id root))))
3681 (when (> (mail-header-number root) 0)
3682 (list (or (cdr (assq (mail-header-number root)
3683 gnus-newsgroup-scored))
3684 gnus-summary-default-score 0))))
3685 (list gnus-summary-default-score)
3688 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3689 (defvar gnus-tmp-prev-subject nil)
3690 (defvar gnus-tmp-false-parent nil)
3691 (defvar gnus-tmp-root-expunged nil)
3692 (defvar gnus-tmp-dummy-line nil)
3694 (defvar gnus-tmp-header)
3695 (defun gnus-extra-header (type &optional header)
3696 "Return the extra header of TYPE."
3697 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3700 (defun gnus-summary-prepare-threads (threads)
3701 "Prepare summary buffer from THREADS and indentation LEVEL.
3702 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3703 or a straight list of headers."
3704 (gnus-message 7 "Generating summary...")
3706 (setq gnus-newsgroup-threads threads)
3709 (let ((gnus-tmp-level 0)
3710 (default-score (or gnus-summary-default-score 0))
3711 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3712 thread number subject stack state gnus-tmp-gathered beg-match
3713 new-roots gnus-tmp-new-adopts thread-end
3714 gnus-tmp-header gnus-tmp-unread
3715 gnus-tmp-replied gnus-tmp-subject-or-nil
3716 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3717 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3718 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3720 (setq gnus-tmp-prev-subject nil)
3722 (if (vectorp (car threads))
3723 ;; If this is a straight (sic) list of headers, then a
3724 ;; threaded summary display isn't required, so we just create
3725 ;; an unthreaded one.
3726 (gnus-summary-prepare-unthreaded threads)
3728 ;; Do the threaded display.
3730 (while (or threads stack gnus-tmp-new-adopts new-roots)
3732 (if (and (= gnus-tmp-level 0)
3735 (not gnus-tmp-false-parent)
3736 (or gnus-tmp-new-adopts new-roots))
3737 (if gnus-tmp-new-adopts
3738 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3739 thread (list (car gnus-tmp-new-adopts))
3740 gnus-tmp-header (caar thread)
3741 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3743 (setq thread (list (car new-roots))
3744 gnus-tmp-header (caar thread)
3745 new-roots (cdr new-roots))))
3748 ;; If there are some threads, we do them before the
3749 ;; threads on the stack.
3750 (setq thread threads
3751 gnus-tmp-header (caar thread))
3752 ;; There were no current threads, so we pop something off
3754 (setq state (car stack)
3755 gnus-tmp-level (car state)
3758 gnus-tmp-header (caar thread))))
3760 (setq gnus-tmp-false-parent nil)
3761 (setq gnus-tmp-root-expunged nil)
3762 (setq thread-end nil)
3764 (if (stringp gnus-tmp-header)
3765 ;; The header is a dummy root.
3767 ((eq gnus-summary-make-false-root 'adopt)
3768 ;; We let the first article adopt the rest.
3769 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3771 (setq gnus-tmp-gathered
3773 (lambda (h) (mail-header-number (car h)))
3776 (setq thread (cons (list (caar thread)
3779 (setq gnus-tmp-level -1
3780 gnus-tmp-false-parent t))
3781 ((eq gnus-summary-make-false-root 'empty)
3782 ;; We print adopted articles with empty subject fields.
3783 (setq gnus-tmp-gathered
3785 (lambda (h) (mail-header-number (car h)))
3788 (setq gnus-tmp-level -1))
3789 ((eq gnus-summary-make-false-root 'dummy)
3790 ;; We remember that we probably want to output a dummy
3792 (setq gnus-tmp-dummy-line gnus-tmp-header)
3793 (setq gnus-tmp-prev-subject gnus-tmp-header))
3795 ;; We do not make a root for the gathered
3796 ;; sub-threads at all.
3797 (setq gnus-tmp-level -1)))
3799 (setq number (mail-header-number gnus-tmp-header)
3800 subject (mail-header-subject gnus-tmp-header))
3803 ;; If the thread has changed subject, we might want to make
3804 ;; this subthread into a root.
3805 ((and (null gnus-thread-ignore-subject)
3806 (not (zerop gnus-tmp-level))
3807 gnus-tmp-prev-subject
3809 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3810 (setq new-roots (nconc new-roots (list (car thread)))
3812 gnus-tmp-header nil))
3813 ;; If the article lies outside the current limit,
3814 ;; then we do not display it.
3815 ((not (memq number gnus-newsgroup-limit))
3816 (setq gnus-tmp-gathered
3818 (lambda (h) (mail-header-number (car h)))
3821 (setq gnus-tmp-new-adopts (if (cdar thread)
3822 (append gnus-tmp-new-adopts
3824 gnus-tmp-new-adopts)
3826 gnus-tmp-header nil)
3827 (when (zerop gnus-tmp-level)
3828 (setq gnus-tmp-root-expunged t)))
3829 ;; Perhaps this article is to be marked as read?
3830 ((and gnus-summary-mark-below
3831 (< (or (cdr (assq number gnus-newsgroup-scored))
3833 gnus-summary-mark-below)
3834 ;; Don't touch sparse articles.
3835 (not (gnus-summary-article-sparse-p number))
3836 (not (gnus-summary-article-ancient-p number)))
3837 (setq gnus-newsgroup-unreads
3838 (delq number gnus-newsgroup-unreads))
3839 (if gnus-newsgroup-auto-expire
3840 (push number gnus-newsgroup-expirable)
3841 (push (cons number gnus-low-score-mark)
3842 gnus-newsgroup-reads))))
3844 (when gnus-tmp-header
3845 ;; We may have an old dummy line to output before this
3847 (when (and gnus-tmp-dummy-line
3850 (mail-header-subject gnus-tmp-header)))
3851 (gnus-summary-insert-dummy-line
3852 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3853 (setq gnus-tmp-dummy-line nil))
3855 ;; Compute the mark.
3856 (setq gnus-tmp-unread (gnus-article-mark number))
3858 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3859 gnus-tmp-header gnus-tmp-level)
3860 gnus-newsgroup-data)
3862 ;; Actually insert the line.
3864 gnus-tmp-subject-or-nil
3866 ((and gnus-thread-ignore-subject
3867 gnus-tmp-prev-subject
3868 (not (inline (gnus-subject-equal
3869 gnus-tmp-prev-subject subject))))
3871 ((zerop gnus-tmp-level)
3872 (if (and (eq gnus-summary-make-false-root 'empty)
3873 (memq number gnus-tmp-gathered)
3874 gnus-tmp-prev-subject
3875 (inline (gnus-subject-equal
3876 gnus-tmp-prev-subject subject)))
3877 gnus-summary-same-subject
3879 (t gnus-summary-same-subject)))
3880 (if (and (eq gnus-summary-make-false-root 'adopt)
3881 (= gnus-tmp-level 1)
3882 (memq number gnus-tmp-gathered))
3883 (setq gnus-tmp-opening-bracket ?\<
3884 gnus-tmp-closing-bracket ?\>)
3885 (setq gnus-tmp-opening-bracket ?\[
3886 gnus-tmp-closing-bracket ?\]))
3888 gnus-tmp-indentation
3889 (aref gnus-thread-indent-array gnus-tmp-level)
3890 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
3891 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
3892 gnus-summary-default-score 0)
3894 (if (or (null gnus-summary-default-score)
3895 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3896 gnus-summary-zcore-fuzz))
3898 (if (< gnus-tmp-score gnus-summary-default-score)
3899 gnus-score-below-mark gnus-score-over-mark))
3901 (cond ((memq number gnus-newsgroup-processable)
3903 ((memq number gnus-newsgroup-cached)
3905 ((memq number gnus-newsgroup-replied)
3907 ((memq number gnus-newsgroup-saved)
3909 (t gnus-unread-mark))
3910 gnus-tmp-from (mail-header-from gnus-tmp-header)
3913 ((string-match "<[^>]+> *$" gnus-tmp-from)
3914 (setq beg-match (match-beginning 0))
3915 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
3916 (substring gnus-tmp-from (1+ (match-beginning 0))
3917 (1- (match-end 0))))
3918 (substring gnus-tmp-from 0 beg-match)))
3919 ((string-match "(.+)" gnus-tmp-from)
3920 (substring gnus-tmp-from
3921 (1+ (match-beginning 0)) (1- (match-end 0))))
3923 (when (string= gnus-tmp-name "")
3924 (setq gnus-tmp-name gnus-tmp-from))
3925 (unless (numberp gnus-tmp-lines)
3926 (setq gnus-tmp-lines 0))
3927 (gnus-put-text-property
3929 (progn (eval gnus-summary-line-format-spec) (point))
3930 'gnus-number number)
3933 (gnus-run-hooks 'gnus-summary-update-hook)
3936 (setq gnus-tmp-prev-subject subject)))
3938 (when (nth 1 thread)
3939 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
3940 (incf gnus-tmp-level)
3941 (setq threads (if thread-end nil (cdar thread)))
3943 (setq gnus-tmp-level 0)))))
3944 (gnus-message 7 "Generating summary...done"))
3946 (defun gnus-summary-prepare-unthreaded (headers)
3947 "Generate an unthreaded summary buffer based on HEADERS."
3948 (let (header number mark)
3953 ;; We may have to root out some bad articles...
3954 (when (memq (setq number (mail-header-number
3955 (setq header (pop headers))))
3956 gnus-newsgroup-limit)
3957 ;; Mark article as read when it has a low score.
3958 (when (and gnus-summary-mark-below
3959 (< (or (cdr (assq number gnus-newsgroup-scored))
3960 gnus-summary-default-score 0)
3961 gnus-summary-mark-below)
3962 (not (gnus-summary-article-ancient-p number)))
3963 (setq gnus-newsgroup-unreads
3964 (delq number gnus-newsgroup-unreads))
3965 (if gnus-newsgroup-auto-expire
3966 (push number gnus-newsgroup-expirable)
3967 (push (cons number gnus-low-score-mark)
3968 gnus-newsgroup-reads)))
3970 (setq mark (gnus-article-mark number))
3971 (push (gnus-data-make number mark (1+ (point)) header 0)
3972 gnus-newsgroup-data)
3973 (gnus-summary-insert-line
3975 mark (memq number gnus-newsgroup-replied)
3976 (memq number gnus-newsgroup-expirable)
3977 (mail-header-subject header) nil
3978 (cdr (assq number gnus-newsgroup-scored))
3979 (memq number gnus-newsgroup-processable))))))
3981 (defun gnus-select-newsgroup (group &optional read-all select-articles)
3982 "Select newsgroup GROUP.
3983 If READ-ALL is non-nil, all articles in the group are selected.
3984 If SELECT-ARTICLES, only select those articles from GROUP."
3985 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3986 ;;!!! Dirty hack; should be removed.
3987 (gnus-summary-ignore-duplicates
3988 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3990 gnus-summary-ignore-duplicates))
3991 (info (nth 2 entry))
3992 articles fetched-articles cached)
3994 (unless (gnus-check-server
3995 (setq gnus-current-select-method
3996 (gnus-find-method-for-group group)))
3997 (error "Couldn't open server"))
3999 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4000 (gnus-activate-group group) ; Or we can activate it...
4001 (progn ; Or we bug out.
4002 (when (equal major-mode 'gnus-summary-mode)
4003 (kill-buffer (current-buffer)))
4004 (error "Couldn't request group %s: %s"
4005 group (gnus-status-message group))))
4007 (unless (gnus-request-group group t)
4008 (when (equal major-mode 'gnus-summary-mode)
4009 (kill-buffer (current-buffer)))
4010 (error "Couldn't request group %s: %s"
4011 group (gnus-status-message group)))
4013 (setq gnus-newsgroup-name group)
4014 (setq gnus-newsgroup-unselected nil)
4015 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4016 (gnus-summary-setup-default-charset)
4018 ;; Adjust and set lists of article marks.
4020 (gnus-adjust-marked-articles info))
4022 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4023 (when (gnus-virtual-group-p group)
4024 (setq cached gnus-newsgroup-cached))
4026 (setq gnus-newsgroup-unreads
4027 (gnus-set-difference
4028 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4029 gnus-newsgroup-dormant))
4031 (setq gnus-newsgroup-processable nil)
4033 (gnus-update-read-articles group gnus-newsgroup-unreads)
4035 (if (setq articles select-articles)
4036 (setq gnus-newsgroup-unselected
4037 (gnus-sorted-intersection
4038 gnus-newsgroup-unreads
4039 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4040 (setq articles (gnus-articles-to-read group read-all)))
4044 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4046 ((eq articles 0) nil)
4048 ;; Init the dependencies hash table.
4049 (setq gnus-newsgroup-dependencies
4050 (gnus-make-hashtable (length articles)))
4051 (gnus-set-global-variables)
4052 ;; Retrieve the headers and read them in.
4053 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4054 (setq gnus-newsgroup-headers
4056 (setq gnus-headers-retrieved-by
4057 (gnus-retrieve-headers
4058 articles gnus-newsgroup-name
4059 ;; We might want to fetch old headers, but
4060 ;; not if there is only 1 article.
4062 (not (eq gnus-fetch-old-headers 'some))
4063 (not (numberp gnus-fetch-old-headers)))
4064 (> (length articles) 1))
4065 gnus-fetch-old-headers))))
4066 (gnus-get-newsgroup-headers-xover
4067 articles nil nil gnus-newsgroup-name t)
4068 (gnus-get-newsgroup-headers)))
4069 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4071 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4073 (setq gnus-newsgroup-cached cached))
4075 ;; Suppress duplicates?
4076 (when gnus-suppress-duplicates
4077 (gnus-dup-suppress-articles))
4079 ;; Set the initial limit.
4080 (setq gnus-newsgroup-limit (copy-sequence articles))
4081 ;; Remove canceled articles from the list of unread articles.
4082 (setq gnus-newsgroup-unreads
4083 (gnus-set-sorted-intersection
4084 gnus-newsgroup-unreads
4085 (setq fetched-articles
4086 (mapcar (lambda (headers) (mail-header-number headers))
4087 gnus-newsgroup-headers))))
4088 ;; Removed marked articles that do not exist.
4089 (gnus-update-missing-marks
4090 (gnus-sorted-complement fetched-articles articles))
4091 ;; We might want to build some more threads first.
4092 (when (and gnus-fetch-old-headers
4093 (eq gnus-headers-retrieved-by 'nov))
4094 (if (eq gnus-fetch-old-headers 'invisible)
4095 (gnus-build-all-threads)
4096 (gnus-build-old-threads)))
4097 ;; Let the Gnus agent mark articles as read.
4099 (gnus-agent-get-undownloaded-list))
4100 ;; Check whether auto-expire is to be done in this group.
4101 (setq gnus-newsgroup-auto-expire
4102 (gnus-group-auto-expirable-p group))
4103 ;; Set up the article buffer now, if necessary.
4104 (unless gnus-single-article-buffer
4105 (gnus-article-setup-buffer))
4106 ;; First and last article in this newsgroup.
4107 (when gnus-newsgroup-headers
4108 (setq gnus-newsgroup-begin
4109 (mail-header-number (car gnus-newsgroup-headers))
4112 (gnus-last-element gnus-newsgroup-headers))))
4113 ;; GROUP is successfully selected.
4114 (or gnus-newsgroup-headers t)))))
4116 (defun gnus-articles-to-read (group &optional read-all)
4117 ;; Find out what articles the user wants to read.
4119 ;; Select all articles if `read-all' is non-nil, or if there
4120 ;; are no unread articles.
4122 (and (zerop (length gnus-newsgroup-marked))
4123 (zerop (length gnus-newsgroup-unreads)))
4124 (eq (gnus-group-find-parameter group 'display)
4126 (gnus-uncompress-range (gnus-active group))
4127 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4128 (copy-sequence gnus-newsgroup-unreads))
4130 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4131 (scored (length scored-list))
4132 (number (length articles))
4133 (marked (+ (length gnus-newsgroup-marked)
4134 (length gnus-newsgroup-dormant)))
4142 ((and (or (<= scored marked) (= scored number))
4143 (numberp gnus-large-newsgroup)
4144 (> number gnus-large-newsgroup))
4148 "How many articles from %s (default %d): "
4149 (gnus-limit-string gnus-newsgroup-name 35)
4151 (if (string-match "^[ \t]*$" input) number input)))
4152 ((and (> scored marked) (< scored number)
4153 (> (- scored number) 20))
4156 (format "%s %s (%d scored, %d total): "
4157 "How many articles from"
4158 group scored number))))
4159 (if (string-match "^[ \t]*$" input)
4163 (setq select (if (stringp select) (string-to-number select) select))
4164 (if (or (null select) (zerop select))
4166 (if (and (not (zerop scored)) (<= (abs select) scored))
4168 (setq articles (sort scored-list '<))
4169 (setq number (length articles)))
4170 (setq articles (copy-sequence articles)))
4172 (when (< (abs select) number)
4174 ;; Select the N oldest articles.
4175 (setcdr (nthcdr (1- (abs select)) articles) nil)
4176 ;; Select the N most recent articles.
4177 (setq articles (nthcdr (- number select) articles))))
4178 (setq gnus-newsgroup-unselected
4179 (gnus-sorted-intersection
4180 gnus-newsgroup-unreads
4181 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4184 (defun gnus-killed-articles (killed articles)
4187 (when (inline (gnus-member-of-range (car articles) killed))
4188 (push (car articles) out))
4189 (setq articles (cdr articles)))
4192 (defun gnus-uncompress-marks (marks)
4193 "Uncompress the mark ranges in MARKS."
4194 (let ((uncompressed '(score bookmark))
4197 (if (memq (caar marks) uncompressed)
4198 (push (car marks) out)
4199 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4200 (setq marks (cdr marks)))
4203 (defun gnus-adjust-marked-articles (info)
4204 "Set all article lists and remove all marks that are no longer valid."
4205 (let* ((marked-lists (gnus-info-marks info))
4206 (active (gnus-active (gnus-info-group info)))
4209 (types gnus-article-mark-lists)
4210 (uncompressed '(score bookmark killed))
4211 marks var articles article mark)
4214 (setq marks (pop marked-lists))
4215 (set (setq var (intern (format "gnus-newsgroup-%s"
4216 (car (rassq (setq mark (car marks))
4218 (if (memq (car marks) uncompressed) (cdr marks)
4219 (gnus-uncompress-range (cdr marks))))
4221 (setq articles (symbol-value var))
4223 ;; All articles have to be subsets of the active articles.
4225 ;; Adjust "simple" lists.
4226 ((memq mark '(tick dormant expire reply save))
4228 (when (or (< (setq article (pop articles)) min) (> article max))
4229 (set var (delq article (symbol-value var))))))
4231 ((memq mark uncompressed)
4232 (when (not (listp (cdr (symbol-value var))))
4233 (set var (list (symbol-value var))))
4234 (when (not (listp (cdr articles)))
4235 (setq articles (list articles)))
4237 (when (or (not (consp (setq article (pop articles))))
4238 (< (car article) min)
4239 (> (car article) max))
4240 (set var (delq article (symbol-value var))))))))))
4242 (defun gnus-update-missing-marks (missing)
4243 "Go through the list of MISSING articles and remove them from the mark lists."
4245 (let ((types gnus-article-mark-lists)
4247 ;; Go through all types.
4249 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
4250 (when (symbol-value var)
4251 ;; This list has articles. So we delete all missing articles
4255 (set var (delq (pop m) (symbol-value var)))))))))
4257 (defun gnus-update-marks ()
4258 "Enter the various lists of marked articles into the newsgroup info list."
4259 (let ((types gnus-article-mark-lists)
4260 (info (gnus-get-info gnus-newsgroup-name))
4261 (uncompressed '(score bookmark killed))
4262 type list newmarked symbol delta-marks)
4264 ;; Add all marks lists that are non-nil to the list of marks lists.
4265 (while (setq type (pop types))
4266 (when (setq list (symbol-value
4268 (intern (format "gnus-newsgroup-%s"
4271 ;; Get rid of the entries of the articles that have the
4273 (when (and (eq (cdr type) 'score)
4277 (prev (cons nil list))
4280 (if (or (not (consp (car arts)))
4281 (= (cdar arts) gnus-summary-default-score))
4282 (setcdr prev (cdr arts))
4284 (setq arts (cdr arts)))
4285 (setq list (cdr all))))
4287 (when (gnus-check-backend-function 'request-set-mark
4288 gnus-newsgroup-name)
4289 ;; score & bookmark are not proper flags (they are cons cells)
4290 ;; cache is a internal gnus flag
4291 (unless (memq (cdr type) '(cache score bookmark))
4292 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
4293 (del (gnus-remove-from-range old list))
4294 (add (gnus-remove-from-range list old)))
4296 (push (list add 'add (list (cdr type))) delta-marks))
4298 (push (list del 'del (list (cdr type))) delta-marks)))))
4300 (push (cons (cdr type)
4301 (if (memq (cdr type) uncompressed) list
4302 (gnus-compress-sequence
4303 (set symbol (sort list '<)) t)))
4307 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
4309 ;; Enter these new marks into the info of the group.
4311 (setcar (nthcdr 3 info) newmarked)
4312 ;; Add the marks lists to the end of the info.
4314 (setcdr (nthcdr 2 info) (list newmarked))))
4316 ;; Cut off the end of the info if there's nothing else there.
4320 (when (nthcdr (decf i) info)
4321 (setcdr (nthcdr i info) nil)))))))
4323 (defun gnus-set-mode-line (where)
4324 "This function sets the mode line of the article or summary buffers.
4325 If WHERE is `summary', the summary mode line format will be used."
4326 ;; Is this mode line one we keep updated?
4327 (when (and (memq where gnus-updated-mode-lines)
4329 (intern (format "gnus-%s-mode-line-format-spec" where))))
4332 ;; We evaluate this in the summary buffer since these
4333 ;; variables are buffer-local to that buffer.
4334 (set-buffer gnus-summary-buffer)
4335 ;; We bind all these variables that are used in the `eval' form
4337 (let* ((mformat (symbol-value
4339 (format "gnus-%s-mode-line-format-spec" where))))
4340 (gnus-tmp-group-name gnus-newsgroup-name)
4341 (gnus-tmp-article-number (or gnus-current-article 0))
4342 (gnus-tmp-unread gnus-newsgroup-unreads)
4343 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
4344 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
4345 (gnus-tmp-unread-and-unselected
4346 (cond ((and (zerop gnus-tmp-unread-and-unticked)
4347 (zerop gnus-tmp-unselected))
4349 ((zerop gnus-tmp-unselected)
4350 (format "{%d more}" gnus-tmp-unread-and-unticked))
4351 (t (format "{%d(+%d) more}"
4352 gnus-tmp-unread-and-unticked
4353 gnus-tmp-unselected))))
4355 (if (and gnus-current-headers
4356 (vectorp gnus-current-headers))
4357 (gnus-mode-string-quote
4358 (mail-header-subject gnus-current-headers))
4360 bufname-length max-len
4361 gnus-tmp-header);; passed as argument to any user-format-funcs
4362 (setq mode-string (eval mformat))
4363 (setq bufname-length (if (string-match "%b" mode-string)
4366 (if (eq where 'summary)
4368 (get-buffer gnus-article-buffer))))
4371 (setq max-len (max 4 (if gnus-mode-non-string-length
4373 gnus-mode-non-string-length
4375 (length mode-string))))
4376 ;; We might have to chop a bit of the string off...
4377 (when (> (length mode-string) max-len)
4379 (concat (truncate-string-to-width mode-string (- max-len 3))
4381 ;; Pad the mode string a bit.
4382 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
4383 ;; Update the mode line.
4384 (setq mode-line-buffer-identification
4385 (gnus-mode-line-buffer-identification (list mode-string)))
4386 (set-buffer-modified-p t))))
4388 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
4389 "Go through the HEADERS list and add all Xrefs to a hash table.
4390 The resulting hash table is returned, or nil if no Xrefs were found."
4391 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
4392 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
4393 (xref-hashtb (gnus-make-hashtable))
4394 start group entry number xrefs header)
4396 (setq header (pop headers))
4397 (when (and (setq xrefs (mail-header-xref header))
4398 (not (memq (setq number (mail-header-number header))
4401 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
4402 (setq start (match-end 0))
4403 (setq group (if prefix
4404 (concat prefix (substring xrefs (match-beginning 1)
4406 (substring xrefs (match-beginning 1) (match-end 1))))
4408 (string-to-int (substring xrefs (match-beginning 2)
4410 (if (setq entry (gnus-gethash group xref-hashtb))
4411 (setcdr entry (cons number (cdr entry)))
4412 (gnus-sethash group (cons number nil) xref-hashtb)))))
4413 (and start xref-hashtb)))
4415 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
4416 "Look through all the headers and mark the Xrefs as read."
4417 (let ((virtual (gnus-virtual-group-p from-newsgroup))
4418 name entry info xref-hashtb idlist method nth4)
4420 (set-buffer gnus-group-buffer)
4421 (when (setq xref-hashtb
4422 (gnus-create-xref-hashtb from-newsgroup headers unreads))
4425 (unless (string= from-newsgroup (setq name (symbol-name group)))
4426 (setq idlist (symbol-value group))
4427 ;; Dead groups are not updated.
4429 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
4431 (when (stringp (setq nth4 (gnus-info-method info)))
4432 (setq nth4 (gnus-server-to-method nth4))))
4433 ;; Only do the xrefs if the group has the same
4434 ;; select method as the group we have just read.
4435 (or (gnus-methods-equal-p
4436 nth4 (gnus-find-method-for-group from-newsgroup))
4438 (equal nth4 (setq method (gnus-find-method-for-group
4440 (and (equal (car nth4) (car method))
4441 (equal (nth 1 nth4) (nth 1 method))))
4442 gnus-use-cross-reference
4443 (or (not (eq gnus-use-cross-reference t))
4445 ;; Only do cross-references on subscribed
4446 ;; groups, if that is what is wanted.
4447 (<= (gnus-info-level info) gnus-level-subscribed))
4448 (gnus-group-make-articles-read name idlist))))
4451 (defun gnus-compute-read-articles (group articles)
4452 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4453 (info (nth 2 entry))
4454 (active (gnus-active group))
4457 ;; First peel off all invalid article numbers.
4459 (let ((ids articles)
4461 (while (setq id (pop ids))
4462 (when (and first (> id (cdr active)))
4463 ;; We'll end up in this situation in one particular
4464 ;; obscure situation. If you re-scan a group and get
4465 ;; a new article that is cross-posted to a different
4466 ;; group that has not been re-scanned, you might get
4467 ;; crossposted article that has a higher number than
4468 ;; Gnus believes possible. So we re-activate this
4469 ;; group as well. This might mean doing the
4470 ;; crossposting thingy will *increase* the number
4471 ;; of articles in some groups. Tsk, tsk.
4472 (setq active (or (gnus-activate-group group) active)))
4473 (when (or (> id (cdr active))
4474 (< id (car active)))
4475 (setq articles (delq id articles))))))
4476 ;; If the read list is nil, we init it.
4478 (null (gnus-info-read info))
4480 (setq ninfo (cons 1 (1- (car active))))
4481 (setq ninfo (gnus-info-read info)))
4482 ;; Then we add the read articles to the range.
4484 ninfo (setq articles (sort articles '<))))))
4486 (defun gnus-group-make-articles-read (group articles)
4487 "Update the info of GROUP to say that ARTICLES are read."
4489 (entry (gnus-gethash group gnus-newsrc-hashtb))
4490 (info (nth 2 entry))
4491 (active (gnus-active group))
4494 (setq range (gnus-compute-read-articles group articles))
4496 (set-buffer gnus-group-buffer)
4499 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
4500 (gnus-info-set-read ',info ',(gnus-info-read info))
4501 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
4502 (gnus-group-update-group ,group t))))
4503 ;; Add the read articles to the range.
4504 (gnus-info-set-read info range)
4505 ;; Then we have to re-compute how many unread
4506 ;; articles there are in this group.
4510 (setq num (- (1+ (cdr active)) (car active))))
4511 ((not (listp (cdr range)))
4512 (setq num (- (cdr active) (- (1+ (cdr range))
4516 (if (numberp (car range))
4518 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
4519 (setq range (cdr range)))
4520 (setq num (- (cdr active) num))))
4521 ;; Update the number of unread articles.
4523 ;; Update the group buffer.
4524 (gnus-group-update-group group t)))))
4526 (defun gnus-methods-equal-p (m1 m2)
4527 (let ((m1 (or m1 gnus-select-method))
4528 (m2 (or m2 gnus-select-method)))
4530 (and (eq (car m1) (car m2))
4531 (or (not (memq 'address (assoc (symbol-name (car m1))
4532 gnus-valid-select-methods)))
4533 (equal (nth 1 m1) (nth 1 m2)))))))
4535 (defvar gnus-newsgroup-none-id 0)
4537 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
4538 (let ((cur nntp-server-buffer)
4541 (save-excursion (set-buffer gnus-summary-buffer)
4542 gnus-newsgroup-dependencies)))
4544 (mail-parse-charset gnus-newsgroup-charset))
4546 (set-buffer nntp-server-buffer)
4547 ;; Translate all TAB characters into SPACE characters.
4548 (subst-char-in-region (point-min) (point-max) ?\t ? t)
4549 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4550 (gnus-run-hooks 'gnus-parse-headers-hook)
4551 (let ((case-fold-search t)
4552 in-reply-to header p lines chars)
4553 (goto-char (point-min))
4554 ;; Search to the beginning of the next header. Error messages
4555 ;; do not begin with 2 or 3.
4556 (while (re-search-forward "^[23][0-9]+ " nil t)
4559 ;; This implementation of this function, with nine
4560 ;; search-forwards instead of the one re-search-forward and
4561 ;; a case (which basically was the old function) is actually
4562 ;; about twice as fast, even though it looks messier. You
4563 ;; can't have everything, I guess. Speed and elegance
4564 ;; doesn't always go hand in hand.
4573 (narrow-to-region (point)
4574 (or (and (search-forward "\n.\n" nil t)
4580 (if (search-forward "\nsubject: " nil t)
4581 (funcall gnus-decode-encoded-word-function
4582 (nnheader-header-value))
4587 (if (search-forward "\nfrom: " nil t)
4588 (funcall gnus-decode-encoded-word-function
4589 (nnheader-header-value))
4594 (if (search-forward "\ndate: " nil t)
4595 (nnheader-header-value) ""))
4599 (setq id (if (re-search-forward
4600 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
4601 ;; We do it this way to make sure the Message-ID
4602 ;; is (somewhat) syntactically valid.
4603 (buffer-substring (match-beginning 1)
4605 ;; If there was no message-id, we just fake one
4606 ;; to make subsequent routines simpler.
4607 (nnheader-generate-fake-message-id))))
4611 (if (search-forward "\nreferences: " nil t)
4615 (nnheader-header-value)
4620 (search-backward ">" end t)
4623 (search-backward "<" end t)
4625 ;; Get the references from the in-reply-to header if there
4626 ;; were no references and the in-reply-to header looks
4628 (if (and (search-forward "\nin-reply-to: " nil t)
4629 (setq in-reply-to (nnheader-header-value))
4630 (string-match "<[^>]+>" in-reply-to))
4632 (setq ref (substring in-reply-to (match-beginning 0)
4634 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
4635 (setq ref2 (substring in-reply-to (match-beginning 0)
4637 (when (> (length ref2) (length ref))
4644 (if (search-forward "\nchars: " nil t)
4645 (if (numberp (setq chars (ignore-errors (read cur))))
4651 (if (search-forward "\nlines: " nil t)
4652 (if (numberp (setq lines (ignore-errors (read cur))))
4658 (and (search-forward "\nxref: " nil t)
4659 (nnheader-header-value)))
4661 (when gnus-extra-headers
4662 (let ((extra gnus-extra-headers)
4666 (when (search-forward
4667 (concat "\n" (symbol-name (car extra)) ": ") nil t)
4668 (push (cons (car extra) (nnheader-header-value))
4672 (when (equal id ref)
4675 (when gnus-alter-header-function
4676 (funcall gnus-alter-header-function header)
4677 (setq id (mail-header-id header)
4678 ref (gnus-parent-id (mail-header-references header))))
4681 (gnus-dependencies-add-header
4682 header dependencies force-new))
4683 (push header headers))
4684 (goto-char (point-max))
4686 (nreverse headers)))))
4688 ;; Goes through the xover lines and returns a list of vectors
4689 (defun gnus-get-newsgroup-headers-xover (sequence &optional
4690 force-new dependencies
4691 group also-fetch-heads)
4692 "Parse the news overview data in the server buffer, and return a
4693 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
4694 ;; Get the Xref when the users reads the articles since most/some
4695 ;; NNTP servers do not include Xrefs when using XOVER.
4696 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
4697 (let ((mail-parse-charset gnus-newsgroup-charset)
4698 (cur nntp-server-buffer)
4699 (dependencies (or dependencies gnus-newsgroup-dependencies))
4700 number headers header)
4702 (set-buffer nntp-server-buffer)
4703 (subst-char-in-region (point-min) (point-max) ?\r ? t)
4704 ;; Allow the user to mangle the headers before parsing them.
4705 (gnus-run-hooks 'gnus-parse-headers-hook)
4706 (goto-char (point-min))
4709 (while (and sequence (not (eobp)))
4710 (setq number (read cur))
4711 (while (and sequence
4712 (< (car sequence) number))
4713 (setq sequence (cdr sequence)))
4715 (eq number (car sequence))
4717 (setq sequence (cdr sequence))
4718 (setq header (inline
4719 (gnus-nov-parse-line
4720 number dependencies force-new))))
4721 (push header headers))
4724 (gnus-error 4 "Strange nov line (%d)"
4725 (count-lines (point-min) (point)))))
4727 ;; A common bug in inn is that if you have posted an article and
4728 ;; then retrieves the active file, it will answer correctly --
4729 ;; the new article is included. However, a NOV entry for the
4730 ;; article may not have been generated yet, so this may fail.
4731 ;; We work around this problem by retrieving the last few
4732 ;; headers using HEAD.
4733 (if (or (not also-fetch-heads)
4735 ;; We (probably) got all the headers.
4737 (let ((gnus-nov-is-evil t))
4740 (when (gnus-retrieve-headers sequence group)
4741 (gnus-get-newsgroup-headers))))))))
4743 (defun gnus-article-get-xrefs ()
4744 "Fill in the Xref value in `gnus-current-headers', if necessary.
4745 This is meant to be called in `gnus-article-internal-prepare-hook'."
4746 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
4747 gnus-current-headers)))
4748 (or (not gnus-use-cross-reference)
4750 (and (mail-header-xref headers)
4751 (not (string= (mail-header-xref headers) "")))
4752 (let ((case-fold-search t)
4755 (nnheader-narrow-to-headers)
4756 (goto-char (point-min))
4757 (when (or (and (eq (downcase (char-after)) ?x)
4758 (looking-at "Xref:"))
4759 (search-forward "\nXref:" nil t))
4760 (goto-char (1+ (match-end 0)))
4761 (setq xref (buffer-substring (point)
4762 (progn (end-of-line) (point))))
4763 (mail-header-set-xref headers xref)))))))
4765 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
4766 "Find article ID and insert the summary line for that article.
4767 OLD-HEADER can either be a header or a line number to insert
4768 the subject line on."
4769 (let* ((line (and (numberp old-header) old-header))
4770 (old-header (and (vectorp old-header) old-header))
4771 (header (cond ((and old-header use-old-header)
4774 (gnus-number-to-header id))
4775 (gnus-number-to-header id))
4777 (gnus-read-header id))))
4778 (number (and (numberp id) id))
4781 ;; Rebuild the thread that this article is part of and go to the
4782 ;; article we have fetched.
4783 (when (and (not gnus-show-threads)
4786 (setq d (gnus-data-find (mail-header-number old-header))))
4787 (goto-char (gnus-data-pos d))
4790 (- (gnus-point-at-bol)
4792 (1+ (gnus-point-at-eol))
4793 (gnus-delete-line))))))
4795 (mail-header-set-number header (mail-header-number old-header)))
4796 (setq gnus-newsgroup-sparse
4797 (delq (setq number (mail-header-number header))
4798 gnus-newsgroup-sparse))
4799 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
4800 (push number gnus-newsgroup-limit)
4801 (gnus-rebuild-thread (mail-header-id header) line)
4802 (gnus-summary-goto-subject number nil t))
4803 (when (and (numberp number)
4805 ;; We have to update the boundaries even if we can't fetch the
4806 ;; article if ID is a number -- so that the next `P' or `N'
4807 ;; command will fetch the previous (or next) article even
4808 ;; if the one we tried to fetch this time has been canceled.
4809 (when (> number gnus-newsgroup-end)
4810 (setq gnus-newsgroup-end number))
4811 (when (< number gnus-newsgroup-begin)
4812 (setq gnus-newsgroup-begin number))
4813 (setq gnus-newsgroup-unselected
4814 (delq number gnus-newsgroup-unselected)))
4815 ;; Report back a success?
4816 (and header (mail-header-number header))))
4818 ;;; Process/prefix in the summary buffer
4820 (defun gnus-summary-work-articles (n)
4821 "Return a list of articles to be worked upon.
4822 The prefix argument, the list of process marked articles, and the
4823 current article will be taken into consideration."
4825 (set-buffer gnus-summary-buffer)
4828 ;; A numerical prefix has been given.
4829 (setq n (prefix-numeric-value n))
4830 (let ((backward (< n 0))
4831 (n (abs (prefix-numeric-value n)))
4836 (push (setq article (gnus-summary-article-number))
4839 (gnus-summary-find-prev nil article)
4840 (gnus-summary-find-next nil article)))
4842 (nreverse articles)))
4843 ((and (gnus-region-active-p) (mark))
4844 (message "region active")
4845 ;; Work on the region between point and mark.
4846 (let ((max (max (point) (mark)))
4849 (goto-char (min (min (point) (mark))))
4852 (push (setq article (gnus-summary-article-number)) articles)
4853 (gnus-summary-find-next nil article)
4855 (nreverse articles))))
4856 (gnus-newsgroup-processable
4857 ;; There are process-marked articles present.
4858 ;; Save current state.
4859 (gnus-summary-save-process-mark)
4861 (reverse gnus-newsgroup-processable))
4863 ;; Just return the current article.
4864 (list (gnus-summary-article-number))))))
4866 (defmacro gnus-summary-iterate (arg &rest forms)
4867 "Iterate over the process/prefixed articles and do FORMS.
4868 ARG is the interactive prefix given to the command. FORMS will be
4869 executed with point over the summary line of the articles."
4870 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
4871 `(let ((,articles (gnus-summary-work-articles ,arg)))
4873 (gnus-summary-goto-subject (car ,articles))
4876 (put 'gnus-summary-iterate 'lisp-indent-function 1)
4877 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
4879 (defun gnus-summary-save-process-mark ()
4880 "Push the current set of process marked articles on the stack."
4882 (push (copy-sequence gnus-newsgroup-processable)
4883 gnus-newsgroup-process-stack))
4885 (defun gnus-summary-kill-process-mark ()
4886 "Push the current set of process marked articles on the stack and unmark."
4888 (gnus-summary-save-process-mark)
4889 (gnus-summary-unmark-all-processable))
4891 (defun gnus-summary-yank-process-mark ()
4892 "Pop the last process mark state off the stack and restore it."
4894 (unless gnus-newsgroup-process-stack
4895 (error "Empty mark stack"))
4896 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
4898 (defun gnus-summary-process-mark-set (set)
4899 "Make SET into the current process marked articles."
4900 (gnus-summary-unmark-all-processable)
4902 (gnus-summary-set-process-mark (pop set))))
4904 ;;; Searching and stuff
4906 (defun gnus-summary-search-group (&optional backward use-level)
4907 "Search for next unread newsgroup.
4908 If optional argument BACKWARD is non-nil, search backward instead."
4910 (set-buffer gnus-group-buffer)
4911 (when (gnus-group-search-forward
4912 backward nil (if use-level (gnus-group-group-level) nil))
4913 (gnus-group-group-name))))
4915 (defun gnus-summary-best-group (&optional exclude-group)
4916 "Find the name of the best unread group.
4917 If EXCLUDE-GROUP, do not go to this group."
4919 (set-buffer gnus-group-buffer)
4921 (gnus-group-best-unread-group exclude-group))))
4923 (defun gnus-summary-find-next (&optional unread article backward undownloaded)
4924 (if backward (gnus-summary-find-prev)
4925 (let* ((dummy (gnus-summary-article-intangible-p))
4926 (article (or article (gnus-summary-article-number)))
4927 (arts (gnus-data-find-list article))
4929 (when (and (not dummy)
4930 (or (not gnus-summary-check-current)
4932 (not (gnus-data-unread-p (car arts)))))
4933 (setq arts (cdr arts)))
4938 (when (or (and undownloaded
4939 (eq gnus-undownloaded-mark
4940 (gnus-data-mark (car arts))))
4941 (gnus-data-unread-p (car arts)))
4942 (setq result (car arts)
4944 (setq arts (cdr arts)))
4947 (goto-char (gnus-data-pos result))
4948 (gnus-data-number result)))))
4950 (defun gnus-summary-find-prev (&optional unread article)
4951 (let* ((eobp (eobp))
4952 (article (or article (gnus-summary-article-number)))
4953 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
4955 (when (and (not eobp)
4956 (or (not gnus-summary-check-current)
4958 (not (gnus-data-unread-p (car arts)))))
4959 (setq arts (cdr arts)))
4964 (when (gnus-data-unread-p (car arts))
4965 (setq result (car arts)
4967 (setq arts (cdr arts)))
4970 (goto-char (gnus-data-pos result))
4971 (gnus-data-number result))))
4973 (defun gnus-summary-find-subject (subject &optional unread backward article)
4974 (let* ((simp-subject (gnus-simplify-subject-fully subject))
4975 (article (or article (gnus-summary-article-number)))
4976 (articles (gnus-data-list backward))
4977 (arts (gnus-data-find-list article articles))
4979 (when (or (not gnus-summary-check-current)
4981 (not (gnus-data-unread-p (car arts))))
4982 (setq arts (cdr arts)))
4984 (and (or (not unread)
4985 (gnus-data-unread-p (car arts)))
4986 (vectorp (gnus-data-header (car arts)))
4988 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
4989 (setq result (car arts)
4991 (setq arts (cdr arts)))
4993 (goto-char (gnus-data-pos result))
4994 (gnus-data-number result))))
4996 (defun gnus-summary-search-forward (&optional unread subject backward)
4997 "Search forward for an article.
4998 If UNREAD, look for unread articles. If SUBJECT, look for
4999 articles with that subject. If BACKWARD, search backward instead."
5000 (cond (subject (gnus-summary-find-subject subject unread backward))
5001 (backward (gnus-summary-find-prev unread))
5002 (t (gnus-summary-find-next unread))))
5004 (defun gnus-recenter (&optional n)
5005 "Center point in window and redisplay frame.
5006 Also do horizontal recentering."
5008 (when (and gnus-auto-center-summary
5009 (not (eq gnus-auto-center-summary 'vertical)))
5010 (gnus-horizontal-recenter))
5013 (defun gnus-summary-recenter ()
5014 "Center point in the summary window.
5015 If `gnus-auto-center-summary' is nil, or the article buffer isn't
5016 displayed, no centering will be performed."
5017 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
5018 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
5019 (let* ((top (cond ((< (window-height) 4) 0)
5020 ((< (window-height) 7) 1)
5021 (t (if (numberp gnus-auto-center-summary)
5022 gnus-auto-center-summary
5024 (height (1- (window-height)))
5025 (bottom (save-excursion (goto-char (point-max))
5026 (forward-line (- height))
5028 (window (get-buffer-window (current-buffer))))
5029 ;; The user has to want it.
5030 (when gnus-auto-center-summary
5031 (when (get-buffer-window gnus-article-buffer)
5032 ;; Only do recentering when the article buffer is displayed,
5033 ;; Set the window start to either `bottom', which is the biggest
5034 ;; possible valid number, or the second line from the top,
5035 ;; whichever is the least.
5037 window (min bottom (save-excursion
5038 (forward-line (- top)) (point)))))
5039 ;; Do horizontal recentering while we're at it.
5040 (when (and (get-buffer-window (current-buffer) t)
5041 (not (eq gnus-auto-center-summary 'vertical)))
5042 (let ((selected (selected-window)))
5043 (select-window (get-buffer-window (current-buffer) t))
5044 (gnus-summary-position-point)
5045 (gnus-horizontal-recenter)
5046 (select-window selected))))))
5048 (defun gnus-summary-jump-to-group (newsgroup)
5049 "Move point to NEWSGROUP in group mode buffer."
5050 ;; Keep update point of group mode buffer if visible.
5051 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
5052 (save-window-excursion
5053 ;; Take care of tree window mode.
5054 (when (get-buffer-window gnus-group-buffer)
5055 (pop-to-buffer gnus-group-buffer))
5056 (gnus-group-jump-to-group newsgroup))
5058 ;; Take care of tree window mode.
5059 (if (get-buffer-window gnus-group-buffer)
5060 (pop-to-buffer gnus-group-buffer)
5061 (set-buffer gnus-group-buffer))
5062 (gnus-group-jump-to-group newsgroup))))
5064 ;; This function returns a list of article numbers based on the
5065 ;; difference between the ranges of read articles in this group and
5066 ;; the range of active articles.
5067 (defun gnus-list-of-unread-articles (group)
5068 (let* ((read (gnus-info-read (gnus-get-info group)))
5069 (active (or (gnus-active group) (gnus-activate-group group)))
5072 ;; If none are read, then all are unread.
5074 (setq first (car active))
5075 ;; If the range of read articles is a single range, then the
5076 ;; first unread article is the article after the last read
5077 ;; article. Sounds logical, doesn't it?
5078 (if (not (listp (cdr read)))
5079 (setq first (max (car active) (1+ (cdr read))))
5080 ;; `read' is a list of ranges.
5081 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
5084 (setq first (car active)))
5087 (while (< first nlast)
5089 (setq first (1+ first))))
5090 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
5091 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
5092 (setq read (cdr read)))))
5093 ;; And add the last unread articles.
5094 (while (<= first last)
5096 (setq first (1+ first)))
5097 ;; Return the list of unread articles.
5098 (delq 0 (nreverse unread))))
5100 (defun gnus-list-of-read-articles (group)
5101 "Return a list of unread, unticked and non-dormant articles."
5102 (let* ((info (gnus-get-info group))
5103 (marked (gnus-info-marks info))
5104 (active (gnus-active group)))
5106 (gnus-set-difference
5107 (gnus-sorted-complement
5108 (gnus-uncompress-range active)
5109 (gnus-list-of-unread-articles group))
5111 (gnus-uncompress-range (cdr (assq 'dormant marked)))
5112 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
5114 ;; Various summary commands
5116 (defun gnus-summary-select-article-buffer ()
5117 "Reconfigure windows to show article buffer."
5119 (if (not (gnus-buffer-live-p gnus-article-buffer))
5120 (error "There is no article buffer for this summary buffer")
5121 (gnus-configure-windows 'article)
5122 (select-window (get-buffer-window gnus-article-buffer))))
5124 (defun gnus-summary-universal-argument (arg)
5125 "Perform any operation on all articles that are process/prefixed."
5127 (let ((articles (gnus-summary-work-articles arg))
5134 (substitute-command-keys
5135 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
5138 (gnus-error 1 "Undefined key")
5141 (gnus-summary-goto-subject (setq article (pop articles)))
5142 (let (gnus-newsgroup-processable)
5143 (command-execute func))
5144 (gnus-summary-remove-process-mark article)))))
5145 (gnus-summary-position-point))
5147 (defun gnus-summary-toggle-truncation (&optional arg)
5148 "Toggle truncation of summary lines.
5149 With arg, turn line truncation on iff arg is positive."
5151 (setq truncate-lines
5152 (if (null arg) (not truncate-lines)
5153 (> (prefix-numeric-value arg) 0)))
5156 (defun gnus-summary-reselect-current-group (&optional all rescan)
5157 "Exit and then reselect the current newsgroup.
5158 The prefix argument ALL means to select all articles."
5160 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
5161 (error "Ephemeral groups can't be reselected"))
5162 (let ((current-subject (gnus-summary-article-number))
5163 (group gnus-newsgroup-name))
5164 (setq gnus-newsgroup-begin nil)
5166 ;; We have to adjust the point of group mode buffer because
5167 ;; point was moved to the next unread newsgroup by exiting.
5168 (gnus-summary-jump-to-group group)
5171 (gnus-group-get-new-news-this-group 1)))
5172 (gnus-group-read-group all t)
5173 (gnus-summary-goto-subject current-subject nil t)))
5175 (defun gnus-summary-rescan-group (&optional all)
5176 "Exit the newsgroup, ask for new articles, and select the newsgroup."
5178 (gnus-summary-reselect-current-group all t))
5180 (defun gnus-summary-update-info (&optional non-destructive)
5182 (let ((group gnus-newsgroup-name))
5184 (when gnus-newsgroup-kill-headers
5185 (setq gnus-newsgroup-killed
5186 (gnus-compress-sequence
5188 (gnus-set-sorted-intersection
5189 (gnus-uncompress-range gnus-newsgroup-killed)
5190 (setq gnus-newsgroup-unselected
5191 (sort gnus-newsgroup-unselected '<)))
5192 (setq gnus-newsgroup-unreads
5193 (sort gnus-newsgroup-unreads '<)))
5195 (unless (listp (cdr gnus-newsgroup-killed))
5196 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
5197 (let ((headers gnus-newsgroup-headers))
5198 ;; Set the new ranges of read articles.
5200 (set-buffer gnus-group-buffer)
5201 (gnus-undo-force-boundary))
5202 (gnus-update-read-articles
5203 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
5204 ;; Set the current article marks.
5205 (let ((gnus-newsgroup-scored
5206 (if (and (not gnus-save-score)
5207 (not non-destructive))
5209 gnus-newsgroup-scored)))
5211 (gnus-update-marks)))
5212 ;; Do the cross-ref thing.
5213 (when gnus-use-cross-reference
5214 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
5215 ;; Do not switch windows but change the buffer to work.
5216 (set-buffer gnus-group-buffer)
5217 (unless (gnus-ephemeral-group-p group)
5218 (gnus-group-update-group group)))))))
5220 (defun gnus-summary-save-newsrc (&optional force)
5221 "Save the current number of read/marked articles in the dribble buffer.
5222 The dribble buffer will then be saved.
5223 If FORCE (the prefix), also save the .newsrc file(s)."
5225 (gnus-summary-update-info t)
5227 (gnus-save-newsrc-file)
5228 (gnus-dribble-save)))
5230 (defun gnus-summary-exit (&optional temporary)
5231 "Exit reading current newsgroup, and then return to group selection mode.
5232 gnus-exit-group-hook is called with no arguments if that value is non-nil."
5234 (gnus-set-global-variables)
5235 (when (gnus-buffer-live-p gnus-article-buffer)
5237 (set-buffer gnus-article-buffer)
5238 (mm-destroy-parts gnus-article-mime-handles)))
5239 (gnus-kill-save-kill-buffer)
5240 (gnus-async-halt-prefetch)
5241 (let* ((group gnus-newsgroup-name)
5242 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
5245 (buf (current-buffer)))
5247 ;; Do adaptive scoring, and possibly save score files.
5248 (when gnus-newsgroup-adaptive
5249 (gnus-score-adaptive))
5250 (when gnus-use-scoring
5252 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
5253 ;; If we have several article buffers, we kill them at exit.
5254 (unless gnus-single-article-buffer
5255 (gnus-kill-buffer gnus-original-article-buffer)
5256 (setq gnus-article-current nil))
5257 (when gnus-use-cache
5258 (gnus-cache-possibly-remove-articles)
5259 (gnus-cache-save-buffers))
5260 (gnus-async-prefetch-remove-group group)
5261 (when gnus-suppress-duplicates
5262 (gnus-dup-enter-articles))
5263 (when gnus-use-trees
5264 (gnus-tree-close group))
5265 ;; Remove entries for this group.
5266 (nnmail-purge-split-history (gnus-group-real-name group))
5267 ;; Make all changes in this group permanent.
5269 (gnus-run-hooks 'gnus-exit-group-hook)
5270 (gnus-summary-update-info))
5271 (gnus-close-group group)
5272 ;; Make sure where we were, and go to next newsgroup.
5273 (set-buffer gnus-group-buffer)
5275 (gnus-group-jump-to-group group))
5276 (gnus-run-hooks 'gnus-summary-exit-hook)
5277 (unless (or quit-config
5278 ;; If this group has disappeared from the summary
5279 ;; buffer, don't skip forwards.
5280 (not (string= group (gnus-group-group-name))))
5281 (gnus-group-next-unread-group 1))
5282 (setq group-point (point))
5285 ;; If we have several article buffers, we kill them at exit.
5286 (unless gnus-single-article-buffer
5287 (gnus-kill-buffer gnus-article-buffer)
5288 (gnus-kill-buffer gnus-original-article-buffer)
5289 (setq gnus-article-current nil))
5291 (if (not gnus-kill-summary-on-exit)
5292 (gnus-deaden-summary)
5293 ;; We set all buffer-local variables to nil. It is unclear why
5294 ;; this is needed, but if we don't, buffer-local variables are
5295 ;; not garbage-collected, it seems. This would the lead to en
5296 ;; ever-growing Emacs.
5297 (gnus-summary-clear-local-variables)
5298 (when (get-buffer gnus-article-buffer)
5299 (bury-buffer gnus-article-buffer))
5300 ;; We clear the global counterparts of the buffer-local
5301 ;; variables as well, just to be on the safe side.
5302 (set-buffer gnus-group-buffer)
5303 (gnus-summary-clear-local-variables)
5304 ;; Return to group mode buffer.
5305 (when (eq mode 'gnus-summary-mode)
5306 (gnus-kill-buffer buf)))
5307 (setq gnus-current-select-method gnus-select-method)
5308 (pop-to-buffer gnus-group-buffer)
5309 (if (not quit-config)
5311 (goto-char group-point)
5312 (gnus-configure-windows 'group 'force))
5313 (gnus-handle-ephemeral-exit quit-config))
5314 ;; Clear the current group name.
5316 (setq gnus-newsgroup-name nil)))))
5318 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
5319 (defun gnus-summary-exit-no-update (&optional no-questions)
5320 "Quit reading current newsgroup without updating read article info."
5322 (let* ((group gnus-newsgroup-name)
5323 (quit-config (gnus-group-quit-config group)))
5324 (when (or no-questions
5326 (gnus-y-or-n-p "Discard changes to this group and exit? "))
5327 (gnus-async-halt-prefetch)
5329 (delq 'gnus-summary-expire-articles
5330 (copy-list gnus-summary-prepare-exit-hook)))
5331 (when (gnus-buffer-live-p gnus-article-buffer)
5333 (set-buffer gnus-article-buffer)
5334 (mm-destroy-parts gnus-article-mime-handles)))
5335 ;; If we have several article buffers, we kill them at exit.
5336 (unless gnus-single-article-buffer
5337 (gnus-kill-buffer gnus-article-buffer)
5338 (gnus-kill-buffer gnus-original-article-buffer)
5339 (setq gnus-article-current nil))
5340 (if (not gnus-kill-summary-on-exit)
5341 (gnus-deaden-summary)
5342 (gnus-close-group group)
5343 (gnus-summary-clear-local-variables)
5344 (set-buffer gnus-group-buffer)
5345 (gnus-summary-clear-local-variables)
5346 (when (get-buffer gnus-summary-buffer)
5347 (kill-buffer gnus-summary-buffer)))
5348 (unless gnus-single-article-buffer
5349 (setq gnus-article-current nil))
5350 (when gnus-use-trees
5351 (gnus-tree-close group))
5352 (gnus-async-prefetch-remove-group group)
5353 (when (get-buffer gnus-article-buffer)
5354 (bury-buffer gnus-article-buffer))
5355 ;; Return to the group buffer.
5356 (gnus-configure-windows 'group 'force)
5357 ;; Clear the current group name.
5358 (setq gnus-newsgroup-name nil)
5359 (when (equal (gnus-group-group-name) group)
5360 (gnus-group-next-unread-group 1))
5362 (gnus-handle-ephemeral-exit quit-config)))))
5364 (defun gnus-handle-ephemeral-exit (quit-config)
5365 "Handle movement when leaving an ephemeral group.
5366 The state which existed when entering the ephemeral is reset."
5367 (if (not (buffer-name (car quit-config)))
5368 (gnus-configure-windows 'group 'force)
5369 (set-buffer (car quit-config))
5370 (cond ((eq major-mode 'gnus-summary-mode)
5371 (gnus-set-global-variables))
5372 ((eq major-mode 'gnus-article-mode)
5374 ;; The `gnus-summary-buffer' variable may point
5375 ;; to the old summary buffer when using a single
5377 (unless (gnus-buffer-live-p gnus-summary-buffer)
5378 (set-buffer gnus-group-buffer))
5379 (set-buffer gnus-summary-buffer)
5380 (gnus-set-global-variables))))
5381 (if (or (eq (cdr quit-config) 'article)
5382 (eq (cdr quit-config) 'pick))
5384 ;; The current article may be from the ephemeral group
5385 ;; thus it is best that we reload this article
5386 (gnus-summary-show-article)
5387 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
5388 (gnus-configure-windows 'pick 'force)
5389 (gnus-configure-windows (cdr quit-config) 'force)))
5390 (gnus-configure-windows (cdr quit-config) 'force))
5391 (when (eq major-mode 'gnus-summary-mode)
5392 (gnus-summary-next-subject 1 nil t)
5393 (gnus-summary-recenter)
5394 (gnus-summary-position-point))))
5398 (defvar gnus-dead-summary-mode-map nil)
5400 (unless gnus-dead-summary-mode-map
5401 (setq gnus-dead-summary-mode-map (make-keymap))
5402 (suppress-keymap gnus-dead-summary-mode-map)
5403 (substitute-key-definition
5404 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
5405 (let ((keys '("\C-d" "\r" "\177" [delete])))
5407 (define-key gnus-dead-summary-mode-map
5408 (pop keys) 'gnus-summary-wake-up-the-dead))))
5410 (defvar gnus-dead-summary-mode nil
5411 "Minor mode for Gnus summary buffers.")
5413 (defun gnus-dead-summary-mode (&optional arg)
5414 "Minor mode for Gnus summary buffers."
5416 (when (eq major-mode 'gnus-summary-mode)
5417 (make-local-variable 'gnus-dead-summary-mode)
5418 (setq gnus-dead-summary-mode
5419 (if (null arg) (not gnus-dead-summary-mode)
5420 (> (prefix-numeric-value arg) 0)))
5421 (when gnus-dead-summary-mode
5422 (gnus-add-minor-mode
5423 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
5425 (defun gnus-deaden-summary ()
5426 "Make the current summary buffer into a dead summary buffer."
5427 ;; Kill any previous dead summary buffer.
5428 (when (and gnus-dead-summary
5429 (buffer-name gnus-dead-summary))
5431 (set-buffer gnus-dead-summary)
5432 (when gnus-dead-summary-mode
5433 (kill-buffer (current-buffer)))))
5434 ;; Make this the current dead summary.
5435 (setq gnus-dead-summary (current-buffer))
5436 (gnus-dead-summary-mode 1)
5437 (let ((name (buffer-name)))
5438 (when (string-match "Summary" name)
5440 (concat (substring name 0 (match-beginning 0)) "Dead "
5441 (substring name (match-beginning 0)))
5444 (defun gnus-kill-or-deaden-summary (buffer)
5445 "Kill or deaden the summary BUFFER."
5447 (when (and (buffer-name buffer)
5448 (not gnus-single-article-buffer))
5451 (gnus-kill-buffer gnus-article-buffer)
5452 (gnus-kill-buffer gnus-original-article-buffer)))
5453 (cond (gnus-kill-summary-on-exit
5454 (when (and gnus-use-trees
5455 (gnus-buffer-exists-p buffer))
5458 (gnus-tree-close gnus-newsgroup-name)))
5459 (gnus-kill-buffer buffer))
5460 ((gnus-buffer-exists-p buffer)
5463 (gnus-deaden-summary))))))
5465 (defun gnus-summary-wake-up-the-dead (&rest args)
5466 "Wake up the dead summary buffer."
5468 (gnus-dead-summary-mode -1)
5469 (let ((name (buffer-name)))
5470 (when (string-match "Dead " name)
5472 (concat (substring name 0 (match-beginning 0))
5473 (substring name (match-end 0)))
5475 (gnus-message 3 "This dead summary is now alive again"))
5477 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
5478 (defun gnus-summary-fetch-faq (&optional faq-dir)
5479 "Fetch the FAQ for the current group.
5480 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
5484 (when current-prefix-arg
5486 "Faq dir: " (and (listp gnus-group-faq-directory)
5487 (mapcar (lambda (file) (list file))
5488 gnus-group-faq-directory))))))
5489 (let (gnus-faq-buffer)
5490 (when (setq gnus-faq-buffer
5491 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
5492 (gnus-configure-windows 'summary-faq))))
5494 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
5495 (defun gnus-summary-describe-group (&optional force)
5496 "Describe the current newsgroup."
5498 (gnus-group-describe-group force gnus-newsgroup-name))
5500 (defun gnus-summary-describe-briefly ()
5501 "Describe summary mode commands briefly."
5503 (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")))
5505 ;; Walking around group mode buffer from summary mode.
5507 (defun gnus-summary-next-group (&optional no-article target-group backward)
5508 "Exit current newsgroup and then select next unread newsgroup.
5509 If prefix argument NO-ARTICLE is non-nil, no article is selected
5510 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
5511 previous group instead."
5513 ;; Stop pre-fetching.
5514 (gnus-async-halt-prefetch)
5515 (let ((current-group gnus-newsgroup-name)
5516 (current-buffer (current-buffer))
5518 ;; First we semi-exit this group to update Xrefs and all variables.
5519 ;; We can't do a real exit, because the window conf must remain
5520 ;; the same in case the user is prompted for info, and we don't
5521 ;; want the window conf to change before that...
5522 (gnus-summary-exit t)
5523 (while (not entered)
5524 ;; Then we find what group we are supposed to enter.
5525 (set-buffer gnus-group-buffer)
5526 (gnus-group-jump-to-group current-group)
5529 (if (eq gnus-keep-same-level 'best)
5530 (gnus-summary-best-group gnus-newsgroup-name)
5531 (gnus-summary-search-group backward gnus-keep-same-level))))
5532 (if (not target-group)
5533 ;; There are no further groups, so we return to the group
5536 (gnus-message 5 "Returning to the group buffer")
5538 (when (gnus-buffer-live-p current-buffer)
5539 (set-buffer current-buffer)
5540 (gnus-summary-exit))
5541 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
5542 ;; We try to enter the target group.
5543 (gnus-group-jump-to-group target-group)
5544 (let ((unreads (gnus-group-group-unread)))
5545 (if (and (or (eq t unreads)
5546 (and unreads (not (zerop unreads))))
5547 (gnus-summary-read-group
5548 target-group nil no-article
5549 (and (buffer-name current-buffer) current-buffer)
5552 (setq current-group target-group
5553 target-group nil)))))))
5555 (defun gnus-summary-prev-group (&optional no-article)
5556 "Exit current newsgroup and then select previous unread newsgroup.
5557 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
5559 (gnus-summary-next-group no-article nil t))
5561 ;; Walking around summary lines.
5563 (defun gnus-summary-first-subject (&optional unread undownloaded)
5564 "Go to the first unread subject.
5565 If UNREAD is non-nil, go to the first unread article.
5566 Returns the article selected or nil if there are no unread articles."
5571 ((null gnus-newsgroup-data)
5572 (gnus-message 3 "No articles in the group")
5574 ;; Pick the first article.
5576 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
5577 (gnus-data-number (car gnus-newsgroup-data)))
5578 ;; No unread articles.
5579 ((null gnus-newsgroup-unreads)
5580 (gnus-message 3 "No more unread articles")
5582 ;; Find the first unread article.
5584 (let ((data gnus-newsgroup-data))
5586 (and (not (and undownloaded
5587 (eq gnus-undownloaded-mark
5588 (gnus-data-mark (car data)))))
5589 (not (gnus-data-unread-p (car data)))))
5590 (setq data (cdr data)))
5592 (goto-char (gnus-data-pos (car data)))
5593 (gnus-data-number (car data))))))
5594 (gnus-summary-position-point)))
5596 (defun gnus-summary-next-subject (n &optional unread dont-display)
5597 "Go to next N'th summary line.
5598 If N is negative, go to the previous N'th subject line.
5599 If UNREAD is non-nil, only unread articles are selected.
5600 The difference between N and the actual number of steps taken is
5603 (let ((backward (< n 0))
5607 (gnus-summary-find-prev unread)
5608 (gnus-summary-find-next unread)))
5609 (gnus-summary-show-thread)
5612 (gnus-message 7 "No more%s articles"
5613 (if unread " unread" "")))
5614 (unless dont-display
5615 (gnus-summary-recenter)
5616 (gnus-summary-position-point))
5619 (defun gnus-summary-next-unread-subject (n)
5620 "Go to next N'th unread summary line."
5622 (gnus-summary-next-subject n t))
5624 (defun gnus-summary-prev-subject (n &optional unread)
5625 "Go to previous N'th summary line.
5626 If optional argument UNREAD is non-nil, only unread article is selected."
5628 (gnus-summary-next-subject (- n) unread))
5630 (defun gnus-summary-prev-unread-subject (n)
5631 "Go to previous N'th unread summary line."
5633 (gnus-summary-next-subject (- n) t))
5635 (defun gnus-summary-goto-subject (article &optional force silent)
5636 "Go the subject line of ARTICLE.
5637 If FORCE, also allow jumping to articles not currently shown."
5638 (interactive "nArticle number: ")
5640 (data (gnus-data-find article)))
5641 ;; We read in the article if we have to.
5644 (gnus-summary-insert-subject
5646 (if (or (numberp force) (vectorp force)) force)
5648 (setq data (gnus-data-find article)))
5653 (gnus-message 3 "Can't find article %d" article))
5655 (goto-char (gnus-data-pos data))
5656 (gnus-summary-position-point)
5659 ;; Walking around summary lines with displaying articles.
5661 (defun gnus-summary-expand-window (&optional arg)
5662 "Make the summary buffer take up the entire Emacs frame.
5663 Given a prefix, will force an `article' buffer configuration."
5666 (gnus-configure-windows 'article 'force)
5667 (gnus-configure-windows 'summary 'force)))
5669 (defun gnus-summary-display-article (article &optional all-header)
5670 "Display ARTICLE in article buffer."
5671 (gnus-set-global-variables)
5675 (if gnus-summary-display-article-function
5676 (funcall gnus-summary-display-article-function article all-header)
5677 (gnus-article-prepare article all-header))
5678 (gnus-run-hooks 'gnus-select-article-hook)
5679 (when (and gnus-current-article
5680 (not (zerop gnus-current-article)))
5681 (gnus-summary-goto-subject gnus-current-article))
5682 (gnus-summary-recenter)
5683 (when (and gnus-use-trees gnus-show-threads)
5684 (gnus-possibly-generate-tree article)
5685 (gnus-highlight-selected-tree article))
5686 ;; Successfully display article.
5687 (gnus-article-set-window-start
5688 (cdr (assq article gnus-newsgroup-bookmarks))))))
5690 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
5691 "Select the current article.
5692 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
5693 non-nil, the article will be re-fetched even if it already present in
5694 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
5696 ;; Make sure we are in the summary buffer to work around bbdb bug.
5697 (unless (eq major-mode 'gnus-summary-mode)
5698 (set-buffer gnus-summary-buffer))
5699 (let ((article (or article (gnus-summary-article-number)))
5700 (all-headers (not (not all-headers))) ;Must be T or NIL.
5701 gnus-summary-display-article-function
5704 (gnus-summary-article-pseudo-p article)
5705 (error "This is a pseudo-article"))
5708 (set-buffer gnus-summary-buffer)
5709 (if (or (and gnus-single-article-buffer
5710 (or (null gnus-current-article)
5711 (null gnus-article-current)
5712 (null (get-buffer gnus-article-buffer))
5713 (not (eq article (cdr gnus-article-current)))
5714 (not (equal (car gnus-article-current)
5715 gnus-newsgroup-name))))
5716 (and (not gnus-single-article-buffer)
5717 (or (null gnus-current-article)
5718 (not (eq gnus-current-article article))))
5720 ;; The requested article is different from the current article.
5722 (gnus-summary-display-article article all-headers)
5724 (when (or all-headers gnus-show-all-headers)
5725 (gnus-article-show-all-headers))
5728 (gnus-article-set-window-start
5729 (cdr (assq article gnus-newsgroup-bookmarks)))))))
5731 (defun gnus-summary-set-current-mark (&optional current-mark)
5732 "Obsolete function."
5735 (defun gnus-summary-next-article (&optional unread subject backward push)
5736 "Select the next article.
5737 If UNREAD, only unread articles are selected.
5738 If SUBJECT, only articles with SUBJECT are selected.
5739 If BACKWARD, the previous article is selected instead of the next."
5742 ;; Is there such an article?
5743 ((and (gnus-summary-search-forward unread subject backward)
5744 (or (gnus-summary-display-article (gnus-summary-article-number))
5745 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
5746 (gnus-summary-position-point))
5747 ;; If not, we try the first unread, if that is wanted.
5749 gnus-auto-select-same
5750 (gnus-summary-first-unread-article))
5751 (gnus-summary-position-point)
5752 (gnus-message 6 "Wrapped"))
5753 ;; Try to get next/previous article not displayed in this group.
5754 ((and gnus-auto-extend-newsgroup
5755 (not unread) (not subject))
5756 (gnus-summary-goto-article
5757 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
5758 nil (count-lines (point-min) (point))))
5759 ;; Go to next/previous group.
5761 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
5762 (gnus-summary-jump-to-group gnus-newsgroup-name))
5763 (let ((cmd last-command-char)
5766 (set-buffer gnus-group-buffer)
5769 (if (eq gnus-keep-same-level 'best)
5770 (gnus-summary-best-group gnus-newsgroup-name)
5771 (gnus-summary-search-group backward gnus-keep-same-level))))
5772 ;; For some reason, the group window gets selected. We change
5774 (select-window (get-buffer-window (current-buffer)))
5775 ;; Select next unread newsgroup automagically.
5777 ((or (not gnus-auto-select-next)
5779 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
5780 ((or (eq gnus-auto-select-next 'quietly)
5781 (and (eq gnus-auto-select-next 'slightly-quietly)
5783 (and (eq gnus-auto-select-next 'almost-quietly)
5784 (gnus-summary-last-article-p)))
5786 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
5788 (gnus-message 7 "No more%s articles (%s)..."
5789 (if unread " unread" "")
5790 (if group (concat "selecting " group)
5792 (gnus-summary-next-group nil group backward)))
5794 (when (gnus-key-press-event-p last-input-event)
5795 (gnus-summary-walk-group-buffer
5796 gnus-newsgroup-name cmd unread backward point))))))))
5798 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
5799 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
5800 (?\C-p (gnus-group-prev-unread-group 1))))
5801 (cursor-in-echo-area t)
5802 keve key group ended)
5804 (set-buffer gnus-group-buffer)
5807 (if (eq gnus-keep-same-level 'best)
5808 (gnus-summary-best-group gnus-newsgroup-name)
5809 (gnus-summary-search-group backward gnus-keep-same-level))))
5812 5 "No more%s articles%s" (if unread " unread" "")
5814 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
5815 (format " (Type %s for %s [%s])"
5816 (single-key-description cmd) group
5817 (car (gnus-gethash group gnus-newsrc-hashtb)))
5818 (format " (Type %s to exit %s)"
5819 (single-key-description cmd)
5820 gnus-newsgroup-name)))
5821 ;; Confirm auto selection.
5822 (setq key (car (setq keve (gnus-read-event-char))))
5825 ((assq key keystrokes)
5826 (let ((obuf (current-buffer)))
5827 (switch-to-buffer gnus-group-buffer)
5829 (gnus-group-jump-to-group group))
5830 (eval (cadr (assq key keystrokes)))
5831 (setq group (gnus-group-group-name))
5832 (switch-to-buffer obuf))
5836 (gnus-ephemeral-group-p gnus-newsgroup-name))
5838 (gnus-summary-next-group nil group backward)))
5840 (push (cdr keve) unread-command-events))))))
5842 (defun gnus-summary-next-unread-article ()
5843 "Select unread article after current one."
5845 (gnus-summary-next-article
5846 (or (not (eq gnus-summary-goto-unread 'never))
5847 (gnus-summary-last-article-p (gnus-summary-article-number)))
5848 (and gnus-auto-select-same
5849 (gnus-summary-article-subject))))
5851 (defun gnus-summary-prev-article (&optional unread subject)
5852 "Select the article after the current one.
5853 If UNREAD is non-nil, only unread articles are selected."
5855 (gnus-summary-next-article unread subject t))
5857 (defun gnus-summary-prev-unread-article ()
5858 "Select unread article before current one."
5860 (gnus-summary-prev-article
5861 (or (not (eq gnus-summary-goto-unread 'never))
5862 (gnus-summary-first-article-p (gnus-summary-article-number)))
5863 (and gnus-auto-select-same
5864 (gnus-summary-article-subject))))
5866 (defun gnus-summary-next-page (&optional lines circular)
5867 "Show next page of the selected article.
5868 If at the end of the current article, select the next article.
5869 LINES says how many lines should be scrolled up.
5871 If CIRCULAR is non-nil, go to the start of the article instead of
5872 selecting the next article when reaching the end of the current
5875 (setq gnus-summary-buffer (current-buffer))
5876 (gnus-set-global-variables)
5877 (let ((article (gnus-summary-article-number))
5878 (article-window (get-buffer-window gnus-article-buffer t))
5880 ;; If the buffer is empty, we have no article.
5882 (error "No article to select"))
5883 (gnus-configure-windows 'article)
5884 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
5885 (if (and (eq gnus-summary-goto-unread 'never)
5886 (not (gnus-summary-last-article-p article)))
5887 (gnus-summary-next-article)
5888 (gnus-summary-next-unread-article))
5889 (if (or (null gnus-current-article)
5890 (null gnus-article-current)
5891 (/= article (cdr gnus-article-current))
5892 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5893 ;; Selected subject is different from current article's.
5894 (gnus-summary-display-article article)
5895 (when article-window
5896 (gnus-eval-in-buffer-window gnus-article-buffer
5897 (setq endp (gnus-article-next-page lines)))
5900 (gnus-summary-beginning-of-article))
5902 (gnus-message 3 "End of message"))
5904 (if (and (eq gnus-summary-goto-unread 'never)
5905 (not (gnus-summary-last-article-p article)))
5906 (gnus-summary-next-article)
5907 (gnus-summary-next-unread-article))))))))
5908 (gnus-summary-recenter)
5909 (gnus-summary-position-point)))
5911 (defun gnus-summary-prev-page (&optional lines move)
5912 "Show previous page of selected article.
5913 Argument LINES specifies lines to be scrolled down.
5914 If MOVE, move to the previous unread article if point is at
5915 the beginning of the buffer."
5917 (let ((article (gnus-summary-article-number))
5918 (article-window (get-buffer-window gnus-article-buffer t))
5920 (gnus-configure-windows 'article)
5921 (if (or (null gnus-current-article)
5922 (null gnus-article-current)
5923 (/= article (cdr gnus-article-current))
5924 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
5925 ;; Selected subject is different from current article's.
5926 (gnus-summary-display-article article)
5927 (gnus-summary-recenter)
5928 (when article-window
5929 (gnus-eval-in-buffer-window gnus-article-buffer
5930 (setq endp (gnus-article-prev-page lines)))
5931 (when (and move endp)
5933 (gnus-message 3 "Beginning of message"))
5935 (if (and (eq gnus-summary-goto-unread 'never)
5936 (not (gnus-summary-first-article-p article)))
5937 (gnus-summary-prev-article)
5938 (gnus-summary-prev-unread-article))))))))
5939 (gnus-summary-position-point))
5941 (defun gnus-summary-prev-page-or-article (&optional lines)
5942 "Show previous page of selected article.
5943 Argument LINES specifies lines to be scrolled down.
5944 If at the beginning of the article, go to the next article."
5946 (gnus-summary-prev-page lines t))
5948 (defun gnus-summary-scroll-up (lines)
5949 "Scroll up (or down) one line current article.
5950 Argument LINES specifies lines to be scrolled up (or down if negative)."
5952 (gnus-configure-windows 'article)
5953 (gnus-summary-show-thread)
5954 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
5955 (gnus-eval-in-buffer-window gnus-article-buffer
5957 (when (gnus-article-next-page lines)
5958 (gnus-message 3 "End of message")))
5960 (gnus-article-prev-page (- lines))))))
5961 (gnus-summary-recenter)
5962 (gnus-summary-position-point))
5964 (defun gnus-summary-scroll-down (lines)
5965 "Scroll down (or up) one line current article.
5966 Argument LINES specifies lines to be scrolled down (or up if negative)."
5968 (gnus-summary-scroll-up (- lines)))
5970 (defun gnus-summary-next-same-subject ()
5971 "Select next article which has the same subject as current one."
5973 (gnus-summary-next-article nil (gnus-summary-article-subject)))
5975 (defun gnus-summary-prev-same-subject ()
5976 "Select previous article which has the same subject as current one."
5978 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
5980 (defun gnus-summary-next-unread-same-subject ()
5981 "Select next unread article which has the same subject as current one."
5983 (gnus-summary-next-article t (gnus-summary-article-subject)))
5985 (defun gnus-summary-prev-unread-same-subject ()
5986 "Select previous unread article which has the same subject as current one."
5988 (gnus-summary-prev-article t (gnus-summary-article-subject)))
5990 (defun gnus-summary-first-unread-article ()
5991 "Select the first unread article.
5992 Return nil if there are no unread articles."
5995 (when (gnus-summary-first-subject t)
5996 (gnus-summary-show-thread)
5997 (gnus-summary-first-subject t)
5998 (gnus-summary-display-article (gnus-summary-article-number)))
5999 (gnus-summary-position-point)))
6001 (defun gnus-summary-first-unread-subject ()
6002 "Place the point on the subject line of the first unread article.
6003 Return nil if there are no unread articles."
6006 (when (gnus-summary-first-subject t)
6007 (gnus-summary-show-thread)
6008 (gnus-summary-first-subject t))
6009 (gnus-summary-position-point)))
6011 (defun gnus-summary-first-article ()
6012 "Select the first article.
6013 Return nil if there are no articles."
6016 (when (gnus-summary-first-subject)
6017 (gnus-summary-show-thread)
6018 (gnus-summary-first-subject)
6019 (gnus-summary-display-article (gnus-summary-article-number)))
6020 (gnus-summary-position-point)))
6022 (defun gnus-summary-best-unread-article ()
6023 "Select the unread article with the highest score."
6025 (let ((best -1000000)
6026 (data gnus-newsgroup-data)
6029 (and (gnus-data-unread-p (car data))
6031 (gnus-summary-article-score (gnus-data-number (car data))))
6034 article (gnus-data-number (car data))))
6035 (setq data (cdr data)))
6038 (gnus-summary-goto-article article)
6039 (error "No unread articles"))
6040 (gnus-summary-position-point))))
6042 (defun gnus-summary-last-subject ()
6043 "Go to the last displayed subject line in the group."
6044 (let ((article (gnus-data-number (car (gnus-data-list t)))))
6046 (gnus-summary-goto-subject article))))
6048 (defun gnus-summary-goto-article (article &optional all-headers force)
6049 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
6050 If ALL-HEADERS is non-nil, no header lines are hidden.
6051 If FORCE, go to the article even if it isn't displayed. If FORCE
6052 is a number, it is the line the article is to be displayed on."
6056 "Article number or Message-ID: "
6057 (mapcar (lambda (number) (list (int-to-string number)))
6058 gnus-newsgroup-limit))
6062 (if (and (stringp article)
6063 (string-match "@" article))
6064 (gnus-summary-refer-article article)
6065 (when (stringp article)
6066 (setq article (string-to-number article)))
6067 (if (gnus-summary-goto-subject article force)
6068 (gnus-summary-display-article article all-headers)
6069 (gnus-message 4 "Couldn't go to article %s" article) nil))
6070 (gnus-summary-position-point)))
6072 (defun gnus-summary-goto-last-article ()
6073 "Go to the previously read article."
6076 (when gnus-last-article
6077 (gnus-summary-goto-article gnus-last-article nil t))
6078 (gnus-summary-position-point)))
6080 (defun gnus-summary-pop-article (number)
6081 "Pop one article off the history and go to the previous.
6082 NUMBER articles will be popped off."
6085 (setq gnus-newsgroup-history
6086 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
6088 (gnus-summary-goto-article (car to) nil t)
6089 (error "Article history empty")))
6090 (gnus-summary-position-point))
6092 ;; Summary commands and functions for limiting the summary buffer.
6094 (defun gnus-summary-limit-to-articles (n)
6095 "Limit the summary buffer to the next N articles.
6096 If not given a prefix, use the process marked articles instead."
6099 (let ((articles (gnus-summary-work-articles n)))
6100 (setq gnus-newsgroup-processable nil)
6101 (gnus-summary-limit articles))
6102 (gnus-summary-position-point)))
6104 (defun gnus-summary-pop-limit (&optional total)
6105 "Restore the previous limit.
6106 If given a prefix, remove all limits."
6109 (setq gnus-newsgroup-limits
6110 (list (mapcar (lambda (h) (mail-header-number h))
6111 gnus-newsgroup-headers))))
6112 (unless gnus-newsgroup-limits
6113 (error "No limit to pop"))
6115 (gnus-summary-limit nil 'pop)
6116 (gnus-summary-position-point)))
6118 (defun gnus-summary-limit-to-subject (subject &optional header)
6119 "Limit the summary buffer to articles that have subjects that match a regexp."
6120 (interactive "sLimit to subject (regexp): ")
6122 (setq header "subject"))
6123 (when (not (equal "" subject))
6125 (let ((articles (gnus-summary-find-matching
6126 (or header "subject") subject 'all)))
6128 (error "Found no matches for \"%s\"" subject))
6129 (gnus-summary-limit articles))
6130 (gnus-summary-position-point))))
6132 (defun gnus-summary-limit-to-author (from)
6133 "Limit the summary buffer to articles that have authors that match a regexp."
6134 (interactive "sLimit to author (regexp): ")
6135 (gnus-summary-limit-to-subject from "from"))
6137 (defun gnus-summary-limit-to-age (age &optional younger-p)
6138 "Limit the summary buffer to articles that are older than (or equal) AGE days.
6139 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
6140 articles that are younger than AGE days."
6141 (interactive "nTime in days: \nP")
6143 (let ((data gnus-newsgroup-data)
6144 (cutoff (days-to-time age))
6145 articles d date is-younger)
6146 (while (setq d (pop data))
6147 (when (and (vectorp (gnus-data-header d))
6148 (setq date (mail-header-date (gnus-data-header d))))
6149 (setq is-younger (time-less-p
6150 (time-since (date-to-time date))
6155 (push (gnus-data-number d) articles))))
6156 (gnus-summary-limit (nreverse articles)))
6157 (gnus-summary-position-point)))
6159 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6161 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
6163 (defun gnus-summary-limit-to-unread (&optional all)
6164 "Limit the summary buffer to articles that are not marked as read.
6165 If ALL is non-nil, limit strictly to unread articles."
6168 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
6169 (gnus-summary-limit-to-marks
6170 ;; Concat all the marks that say that an article is read and have
6172 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
6173 gnus-killed-mark gnus-kill-file-mark
6174 gnus-low-score-mark gnus-expirable-mark
6175 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
6176 gnus-duplicate-mark gnus-souped-mark)
6179 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
6180 (make-obsolete 'gnus-summary-delete-marked-with
6181 'gnus-summary-limit-exlude-marks)
6183 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
6184 "Exclude articles that are marked with MARKS (e.g. \"DK\").
6185 If REVERSE, limit the summary buffer to articles that are marked
6186 with MARKS. MARKS can either be a string of marks or a list of marks.
6187 Returns how many articles were removed."
6188 (interactive "sMarks: ")
6189 (gnus-summary-limit-to-marks marks t))
6191 (defun gnus-summary-limit-to-marks (marks &optional reverse)
6192 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
6193 If REVERSE (the prefix), limit the summary buffer to articles that are
6194 not marked with MARKS. MARKS can either be a string of marks or a
6196 Returns how many articles were removed."
6197 (interactive "sMarks: \nP")
6199 (let ((data gnus-newsgroup-data)
6200 (marks (if (listp marks) marks
6201 (append marks nil))) ; Transform to list.
6204 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
6205 (memq (gnus-data-mark (car data)) marks))
6206 (push (gnus-data-number (car data)) articles))
6207 (setq data (cdr data)))
6208 (gnus-summary-limit articles))
6209 (gnus-summary-position-point)))
6211 (defun gnus-summary-limit-to-score (&optional score)
6212 "Limit to articles with score at or above SCORE."
6214 (setq score (if score
6215 (prefix-numeric-value score)
6216 (or gnus-summary-default-score 0)))
6217 (let ((data gnus-newsgroup-data)
6220 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
6222 (push (gnus-data-number (car data)) articles))
6223 (setq data (cdr data)))
6225 (gnus-summary-limit articles)
6226 (gnus-summary-position-point))))
6228 (defun gnus-summary-limit-include-thread (id)
6229 "Display all the hidden articles that in the current thread."
6230 (interactive (list (mail-header-id (gnus-summary-article-header))))
6231 (let ((articles (gnus-articles-in-thread
6232 (gnus-id-to-thread (gnus-root-id id)))))
6234 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
6235 (gnus-summary-position-point))))
6237 (defun gnus-summary-limit-include-dormant ()
6238 "Display all the hidden articles that are marked as dormant.
6239 Note that this command only works on a subset of the articles currently
6240 fetched for this group."
6242 (unless gnus-newsgroup-dormant
6243 (error "There are no dormant articles in this group"))
6245 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
6246 (gnus-summary-position-point)))
6248 (defun gnus-summary-limit-exclude-dormant ()
6249 "Hide all dormant articles."
6252 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
6253 (gnus-summary-position-point)))
6255 (defun gnus-summary-limit-exclude-childless-dormant ()
6256 "Hide all dormant articles that have no children."
6258 (let ((data (gnus-data-list t))
6259 articles d children)
6260 ;; Find all articles that are either not dormant or have
6262 (while (setq d (pop data))
6263 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
6265 (gnus-article-children (gnus-data-number d)))
6268 (when (memq (car children) articles)
6273 (push (gnus-data-number d) articles)))
6276 (gnus-summary-limit articles)
6277 (gnus-summary-position-point))))
6279 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
6280 "Mark all unread excluded articles as read.
6281 If ALL, mark even excluded ticked and dormants as read."
6283 (let ((articles (gnus-sorted-complement
6285 (mapcar (lambda (h) (mail-header-number h))
6286 gnus-newsgroup-headers)
6288 (sort gnus-newsgroup-limit '<)))
6290 (setq gnus-newsgroup-unreads
6291 (gnus-intersection gnus-newsgroup-unreads gnus-newsgroup-limit))
6293 (setq gnus-newsgroup-dormant nil
6294 gnus-newsgroup-marked nil
6295 gnus-newsgroup-reads
6297 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
6298 gnus-newsgroup-reads))
6299 (while (setq article (pop articles))
6300 (unless (or (memq article gnus-newsgroup-dormant)
6301 (memq article gnus-newsgroup-marked))
6302 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
6304 (defun gnus-summary-limit (articles &optional pop)
6306 ;; We pop the previous limit off the stack and use that.
6307 (setq articles (car gnus-newsgroup-limits)
6308 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
6309 ;; We use the new limit, so we push the old limit on the stack.
6310 (push gnus-newsgroup-limit gnus-newsgroup-limits))
6312 (setq gnus-newsgroup-limit articles)
6313 (let ((total (length gnus-newsgroup-data))
6314 (data (gnus-data-find-list (gnus-summary-article-number)))
6315 (gnus-summary-mark-below nil) ; Inhibit this.
6317 ;; This will do all the work of generating the new summary buffer
6318 ;; according to the new limit.
6319 (gnus-summary-prepare)
6320 ;; Hide any threads, possibly.
6321 (and gnus-show-threads
6322 gnus-thread-hide-subtree
6323 (gnus-summary-hide-all-threads))
6324 ;; Try to return to the article you were at, or one in the
6327 ;; We try to find some article after the current one.
6329 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
6332 (setq data (cdr data))))
6334 ;; If there is no data, that means that we were after the last
6335 ;; article. The same goes when we can't find any articles
6336 ;; after the current one.
6337 (goto-char (point-max))
6338 (gnus-summary-find-prev))
6339 (gnus-set-mode-line 'summary)
6340 ;; We return how many articles were removed from the summary
6341 ;; buffer as a result of the new limit.
6342 (- total (length gnus-newsgroup-data))))
6344 (defsubst gnus-invisible-cut-children (threads)
6347 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
6352 (defsubst gnus-cut-thread (thread)
6353 "Go forwards in the thread until we find an article that we want to display."
6354 (when (or (eq gnus-fetch-old-headers 'some)
6355 (eq gnus-fetch-old-headers 'invisible)
6356 (eq gnus-build-sparse-threads 'some)
6357 (eq gnus-build-sparse-threads 'more))
6358 ;; Deal with old-fetched headers and sparse threads.
6362 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
6363 (gnus-summary-article-ancient-p
6364 (mail-header-number (car thread))))
6365 (if (or (<= (length (cdr thread)) 1)
6366 (eq gnus-fetch-old-headers 'invisible))
6367 (setq gnus-newsgroup-limit
6368 (delq (mail-header-number (car thread))
6369 gnus-newsgroup-limit)
6370 thread (cadr thread))
6371 (when (gnus-invisible-cut-children (cdr thread))
6372 (let ((th (cdr thread)))
6374 (if (memq (mail-header-number (caar th))
6375 gnus-newsgroup-limit)
6376 (setq thread (car th)
6378 (setq th (cdr th))))))))))
6381 (defun gnus-cut-threads (threads)
6382 "Cut off all uninteresting articles from the beginning of threads."
6383 (when (or (eq gnus-fetch-old-headers 'some)
6384 (eq gnus-fetch-old-headers 'invisible)
6385 (eq gnus-build-sparse-threads 'some)
6386 (eq gnus-build-sparse-threads 'more))
6389 (setcar th (gnus-cut-thread (car th)))
6390 (setq th (cdr th)))))
6391 ;; Remove nixed out threads.
6394 (defun gnus-summary-initial-limit (&optional show-if-empty)
6395 "Figure out what the initial limit is supposed to be on group entry.
6396 This entails weeding out unwanted dormants, low-scored articles,
6397 fetch-old-headers verbiage, and so on."
6398 ;; Most groups have nothing to remove.
6399 (if (or gnus-inhibit-limiting
6400 (and (null gnus-newsgroup-dormant)
6401 (not (eq gnus-fetch-old-headers 'some))
6402 (not (eq gnus-fetch-old-headers 'invisible))
6403 (null gnus-summary-expunge-below)
6404 (not (eq gnus-build-sparse-threads 'some))
6405 (not (eq gnus-build-sparse-threads 'more))
6406 (null gnus-thread-expunge-below)
6407 (not gnus-use-nocem)))
6409 (push gnus-newsgroup-limit gnus-newsgroup-limits)
6410 (setq gnus-newsgroup-limit nil)
6413 (unless (car (symbol-value node))
6414 ;; These threads have no parents -- they are roots.
6415 (let ((nodes (cdr (symbol-value node)))
6418 (if (and gnus-thread-expunge-below
6419 (< (gnus-thread-total-score (car nodes))
6420 gnus-thread-expunge-below))
6421 (gnus-expunge-thread (pop nodes))
6422 (setq thread (pop nodes))
6423 (gnus-summary-limit-children thread))))))
6424 gnus-newsgroup-dependencies)
6425 ;; If this limitation resulted in an empty group, we might
6426 ;; pop the previous limit and use it instead.
6427 (when (and (not gnus-newsgroup-limit)
6429 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
6430 gnus-newsgroup-limit))
6432 (defun gnus-summary-limit-children (thread)
6433 "Return 1 if this subthread is visible and 0 if it is not."
6434 ;; First we get the number of visible children to this thread. This
6435 ;; is done by recursing down the thread using this function, so this
6436 ;; will really go down to a leaf article first, before slowly
6437 ;; working its way up towards the root.
6441 (apply '+ (mapcar 'gnus-summary-limit-children
6444 (number (mail-header-number (car thread)))
6447 (not (memq number gnus-newsgroup-marked))
6449 ;; If this article is dormant and has absolutely no visible
6450 ;; children, then this article isn't visible.
6451 (and (memq number gnus-newsgroup-dormant)
6453 ;; If this is "fetch-old-headered" and there is no
6454 ;; visible children, then we don't want this article.
6455 (and (eq gnus-fetch-old-headers 'some)
6456 (gnus-summary-article-ancient-p number)
6458 ;; If this is "fetch-old-headered" and `invisible', then
6459 ;; we don't want this article.
6460 (and (eq gnus-fetch-old-headers 'invisible)
6461 (gnus-summary-article-ancient-p number))
6462 ;; If this is a sparsely inserted article with no children,
6463 ;; we don't want it.
6464 (and (eq gnus-build-sparse-threads 'some)
6465 (gnus-summary-article-sparse-p number)
6467 ;; If we use expunging, and this article is really
6468 ;; low-scored, then we don't want this article.
6469 (when (and gnus-summary-expunge-below
6471 (or (cdr (assq number gnus-newsgroup-scored))
6472 gnus-summary-default-score))
6473 gnus-summary-expunge-below))
6474 ;; We increase the expunge-tally here, but that has
6475 ;; nothing to do with the limits, really.
6476 (incf gnus-newsgroup-expunged-tally)
6477 ;; We also mark as read here, if that's wanted.
6478 (when (and gnus-summary-mark-below
6479 (< score gnus-summary-mark-below))
6480 (setq gnus-newsgroup-unreads
6481 (delq number gnus-newsgroup-unreads))
6482 (if gnus-newsgroup-auto-expire
6483 (push number gnus-newsgroup-expirable)
6484 (push (cons number gnus-low-score-mark)
6485 gnus-newsgroup-reads)))
6487 ;; Check NoCeM things.
6488 (if (and gnus-use-nocem
6489 (gnus-nocem-unwanted-article-p
6490 (mail-header-id (car thread))))
6492 (setq gnus-newsgroup-unreads
6493 (delq number gnus-newsgroup-unreads))
6495 ;; Nope, invisible article.
6497 ;; Ok, this article is to be visible, so we add it to the limit
6499 (push number gnus-newsgroup-limit)
6502 (defun gnus-expunge-thread (thread)
6503 "Mark all articles in THREAD as read."
6504 (let* ((number (mail-header-number (car thread))))
6505 (incf gnus-newsgroup-expunged-tally)
6506 ;; We also mark as read here, if that's wanted.
6507 (setq gnus-newsgroup-unreads
6508 (delq number gnus-newsgroup-unreads))
6509 (if gnus-newsgroup-auto-expire
6510 (push number gnus-newsgroup-expirable)
6511 (push (cons number gnus-low-score-mark)
6512 gnus-newsgroup-reads)))
6513 ;; Go recursively through all subthreads.
6514 (mapcar 'gnus-expunge-thread (cdr thread)))
6516 ;; Summary article oriented commands
6518 (defun gnus-summary-refer-parent-article (n)
6519 "Refer parent article N times.
6520 If N is negative, go to ancestor -N instead.
6521 The difference between N and the number of articles fetched is returned."
6525 (when (not (natnump n))
6530 (setq header (gnus-summary-article-header))
6531 (if (and (eq (mail-header-number header)
6532 (cdr gnus-article-current))
6533 (equal gnus-newsgroup-name
6534 (car gnus-article-current)))
6535 ;; If we try to find the parent of the currently
6536 ;; displayed article, then we take a look at the actual
6537 ;; References header, since this is slightly more
6538 ;; reliable than the References field we got from the
6541 (set-buffer gnus-original-article-buffer)
6542 (nnheader-narrow-to-headers)
6543 (unless (setq ref (message-fetch-field "references"))
6544 (setq ref (message-fetch-field "in-reply-to")))
6547 ;; It's not the current article, so we take a bet on
6548 ;; the value we got from the server.
6549 (mail-header-references header)))
6551 (not (equal ref "")))
6552 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
6553 (gnus-message 1 "Couldn't find parent"))
6554 (gnus-message 1 "No references in article %d"
6555 (gnus-summary-article-number))
6558 (gnus-summary-position-point)
6561 (defun gnus-summary-refer-references ()
6562 "Fetch all articles mentioned in the References header.
6563 Return the number of articles fetched."
6565 (let ((ref (mail-header-references (gnus-summary-article-header)))
6566 (current (gnus-summary-article-number))
6570 (error "No References in the current article")
6571 ;; For each Message-ID in the References header...
6572 (while (string-match "<[^>]*>" ref)
6574 ;; ... fetch that article.
6575 (gnus-summary-refer-article
6576 (prog1 (match-string 0 ref)
6577 (setq ref (substring ref (match-end 0))))))
6578 (gnus-summary-goto-subject current)
6579 (gnus-summary-position-point)
6582 (defun gnus-summary-refer-thread (&optional limit)
6583 "Fetch all articles in the current thread.
6584 If LIMIT (the numerical prefix), fetch that many old headers instead
6585 of what's specified by the `gnus-refer-thread-limit' variable."
6587 (let ((id (mail-header-id (gnus-summary-article-header)))
6588 (limit (if limit (prefix-numeric-value limit)
6589 gnus-refer-thread-limit)))
6590 ;; We want to fetch LIMIT *old* headers, but we also have to
6591 ;; re-fetch all the headers in the current buffer, because many of
6592 ;; them may be undisplayed. So we adjust LIMIT.
6593 (when (numberp limit)
6594 (incf limit (- gnus-newsgroup-end gnus-newsgroup-begin)))
6595 (unless (eq gnus-fetch-old-headers 'invisible)
6596 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
6597 ;; Retrieve the headers and read them in.
6598 (if (eq (gnus-retrieve-headers
6599 (list gnus-newsgroup-end) gnus-newsgroup-name limit)
6601 (gnus-build-all-threads)
6602 (error "Can't fetch thread from backends that don't support NOV"))
6603 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
6604 (gnus-summary-limit-include-thread id)))
6606 (defun gnus-summary-refer-article (message-id &optional arg)
6607 "Fetch an article specified by MESSAGE-ID.
6608 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
6609 or `gnus-select-method', no matter what backend the article comes from."
6610 (interactive "sMessage-ID: \nP")
6611 (when (and (stringp message-id)
6612 (not (zerop (length message-id))))
6613 ;; Construct the correct Message-ID if necessary.
6614 ;; Suggested by tale@pawl.rpi.edu.
6615 (unless (string-match "^<" message-id)
6616 (setq message-id (concat "<" message-id)))
6617 (unless (string-match ">$" message-id)
6618 (setq message-id (concat message-id ">")))
6619 (let* ((header (gnus-id-to-header message-id))
6621 (gnus-summary-article-sparse-p
6622 (mail-header-number header))
6623 (memq (mail-header-number header)
6624 gnus-newsgroup-limit))))
6626 ;; If the article is present in the buffer we just go to it.
6628 (or (not (gnus-summary-article-sparse-p
6629 (mail-header-number header)))
6632 (gnus-summary-goto-article
6633 (mail-header-number header) nil t)
6635 (gnus-summary-update-article (mail-header-number header)))))
6637 ;; We fetch the article
6638 (let ((gnus-override-method
6639 (cond ((gnus-news-group-p gnus-newsgroup-name)
6640 gnus-refer-article-method)
6642 (or gnus-refer-article-method gnus-select-method))
6645 ;; Start the special refer-article method, if necessary.
6646 (when (and gnus-refer-article-method
6647 (gnus-news-group-p gnus-newsgroup-name))
6648 (gnus-check-server gnus-refer-article-method))
6649 ;; Fetch the header, and display the article.
6650 (if (setq number (gnus-summary-insert-subject message-id))
6651 (gnus-summary-select-article nil nil nil number)
6652 (gnus-message 3 "Couldn't fetch article %s" message-id))))))))
6654 (defun gnus-summary-edit-parameters ()
6655 "Edit the group parameters of the current group."
6657 (gnus-group-edit-group gnus-newsgroup-name 'params))
6659 (defun gnus-summary-customize-parameters ()
6660 "Customize the group parameters of the current group."
6662 (gnus-group-customize gnus-newsgroup-name))
6664 (defun gnus-summary-enter-digest-group (&optional force)
6665 "Enter an nndoc group based on the current article.
6666 If FORCE, force a digest interpretation. If not, try
6667 to guess what the document format is."
6669 (let ((conf gnus-current-window-configuration))
6671 (gnus-summary-select-article))
6672 (setq gnus-current-window-configuration conf)
6673 (let* ((name (format "%s-%d"
6674 (gnus-group-prefixed-name
6675 gnus-newsgroup-name (list 'nndoc ""))
6677 (set-buffer gnus-summary-buffer)
6678 gnus-current-article)))
6679 (ogroup gnus-newsgroup-name)
6680 (params (append (gnus-info-params (gnus-get-info ogroup))
6681 (list (cons 'to-group ogroup))
6682 (list (cons 'save-article-group ogroup))))
6683 (case-fold-search t)
6684 (buf (current-buffer))
6687 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6688 (insert-buffer-substring gnus-original-article-buffer)
6689 ;; Remove lines that may lead nndoc to misinterpret the
6692 (goto-char (point-min))
6693 (or (search-forward "\n\n" nil t) (point)))
6694 (goto-char (point-min))
6695 (delete-matching-lines "^\\(Path\\):\\|^From ")
6698 (if (gnus-group-read-ephemeral-group
6699 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
6701 ,(if force 'digest 'guess))) t)
6702 ;; Make all postings to this group go to the parent group.
6703 (nconc (gnus-info-params (gnus-get-info name))
6705 ;; Couldn't select this doc group.
6706 (switch-to-buffer buf)
6707 (gnus-set-global-variables)
6708 (gnus-configure-windows 'summary)
6709 (gnus-message 3 "Article couldn't be entered?"))
6710 (kill-buffer dig)))))
6712 (defun gnus-summary-read-document (n)
6713 "Open a new group based on the current article(s).
6714 This will allow you to read digests and other similar
6715 documents as newsgroups.
6716 Obeys the standard process/prefix convention."
6718 (let* ((articles (gnus-summary-work-articles n))
6719 (ogroup gnus-newsgroup-name)
6720 (params (append (gnus-info-params (gnus-get-info ogroup))
6721 (list (cons 'to-group ogroup))))
6722 article group egroup groups vgroup)
6723 (while (setq article (pop articles))
6724 (setq group (format "%s-%d" gnus-newsgroup-name article))
6725 (gnus-summary-remove-process-mark article)
6726 (when (gnus-summary-display-article article)
6729 (insert-buffer-substring gnus-original-article-buffer)
6730 ;; Remove some headers that may lead nndoc to make
6732 (message-narrow-to-head)
6733 (goto-char (point-min))
6734 (delete-matching-lines "^\\(Path\\):\\|^From ")
6737 (gnus-group-read-ephemeral-group
6738 group `(nndoc ,group (nndoc-address ,(current-buffer))
6739 (nndoc-article-type guess))
6742 ;; Make all postings to this group go to the parent group.
6743 (nconc (gnus-info-params (gnus-get-info egroup))
6745 (push egroup groups))
6746 ;; Couldn't select this doc group.
6747 (gnus-error 3 "Article couldn't be entered"))))))
6748 ;; Now we have selected all the documents.
6751 (error "None of the articles could be interpreted as documents"))
6752 ((gnus-group-read-ephemeral-group
6753 (setq vgroup (format
6754 "nnvirtual:%s-%s" gnus-newsgroup-name
6755 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
6756 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
6758 (cons (current-buffer) 'summary)))
6760 (error "Couldn't select virtual nndoc group")))))
6762 (defun gnus-summary-isearch-article (&optional regexp-p)
6763 "Do incremental search forward on the current article.
6764 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
6766 (gnus-summary-select-article)
6767 (gnus-configure-windows 'article)
6768 (gnus-eval-in-buffer-window gnus-article-buffer
6771 (isearch-forward regexp-p))))
6773 (defun gnus-summary-search-article-forward (regexp &optional backward)
6774 "Search for an article containing REGEXP forward.
6775 If BACKWARD, search backward instead."
6778 (format "Search article %s (regexp%s): "
6779 (if current-prefix-arg "backward" "forward")
6780 (if gnus-last-search-regexp
6781 (concat ", default " gnus-last-search-regexp)
6783 current-prefix-arg))
6784 (if (string-equal regexp "")
6785 (setq regexp (or gnus-last-search-regexp ""))
6786 (setq gnus-last-search-regexp regexp))
6787 (if (gnus-summary-search-article regexp backward)
6788 (gnus-summary-show-thread)
6789 (error "Search failed: \"%s\"" regexp)))
6791 (defun gnus-summary-search-article-backward (regexp)
6792 "Search for an article containing REGEXP backward."
6795 (format "Search article backward (regexp%s): "
6796 (if gnus-last-search-regexp
6797 (concat ", default " gnus-last-search-regexp)
6799 (gnus-summary-search-article-forward regexp 'backward))
6801 (defun gnus-summary-search-article (regexp &optional backward)
6802 "Search for an article containing REGEXP.
6803 Optional argument BACKWARD means do search for backward.
6804 `gnus-select-article-hook' is not called during the search."
6805 ;; We have to require this here to make sure that the following
6806 ;; dynamic binding isn't shadowed by autoloading.
6807 (require 'gnus-async)
6809 (let ((gnus-select-article-hook nil) ;Disable hook.
6810 (gnus-mark-article-hook nil) ;Inhibit marking as read.
6811 (gnus-use-article-prefetch nil)
6812 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
6813 (gnus-use-trees nil) ;Inhibit updating tree buffer.
6814 (sum (current-buffer))
6815 (gnus-display-mime-function nil)
6818 (gnus-save-hidden-threads
6819 (gnus-summary-select-article)
6820 (set-buffer gnus-article-buffer)
6824 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
6826 (re-search-backward regexp nil t)
6827 (re-search-forward regexp nil t))
6828 ;; We found the regexp.
6833 (get-buffer-window (current-buffer))
6837 (setq point (point)))
6838 ;; We didn't find it, so we go to the next article.
6841 (while (eq found 'not)
6842 (if (not (if backward (gnus-summary-find-prev)
6843 (gnus-summary-find-next)))
6844 ;; No more articles.
6846 ;; Select the next article and adjust point.
6847 (unless (gnus-summary-article-sparse-p
6848 (gnus-summary-article-number))
6850 (gnus-summary-select-article)
6851 (set-buffer gnus-article-buffer)
6853 (goto-char (if backward (point-max) (point-min))))))))
6854 (gnus-message 7 ""))
6855 ;; Return whether we found the regexp.
6856 (when (eq found 'found)
6858 (gnus-summary-show-thread)
6859 (gnus-summary-goto-subject gnus-current-article)
6860 (gnus-summary-position-point)
6863 (defun gnus-summary-find-matching (header regexp &optional backward unread
6865 "Return a list of all articles that match REGEXP on HEADER.
6866 The search stars on the current article and goes forwards unless
6867 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
6868 If UNREAD is non-nil, only unread articles will
6869 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
6870 in the comparisons."
6871 (let ((data (if (eq backward 'all) gnus-newsgroup-data
6872 (gnus-data-find-list
6873 (gnus-summary-article-number) (gnus-data-list backward))))
6874 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
6875 (case-fold-search (not not-case-fold))
6877 (unless (fboundp (intern (concat "mail-header-" header)))
6878 (error "%s is not a valid header" header))
6881 (and (or (not unread) ; We want all articles...
6882 (gnus-data-unread-p d)) ; Or just unreads.
6883 (vectorp (gnus-data-header d)) ; It's not a pseudo.
6884 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
6885 (push (gnus-data-number d) articles)) ; Success!
6886 (setq data (cdr data)))
6887 (nreverse articles)))
6889 (defun gnus-summary-execute-command (header regexp command &optional backward)
6890 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
6891 If HEADER is an empty string (or nil), the match is done on the entire
6892 article. If BACKWARD (the prefix) is non-nil, search backward instead."
6894 (list (let ((completion-ignore-case t))
6897 (mapcar (lambda (string) (list string))
6898 '("Number" "Subject" "From" "Lines" "Date"
6899 "Message-ID" "Xref" "References" "Body"))
6900 nil 'require-match))
6901 (read-string "Regexp: ")
6902 (read-key-sequence "Command: ")
6903 current-prefix-arg))
6904 (when (equal header "Body")
6906 ;; Hidden thread subtrees must be searched as well.
6907 (gnus-summary-show-all-threads)
6908 ;; We don't want to change current point nor window configuration.
6910 (save-window-excursion
6911 (gnus-message 6 "Executing %s..." (key-description command))
6912 ;; We'd like to execute COMMAND interactively so as to give arguments.
6913 (gnus-execute header regexp
6914 `(call-interactively ',(key-binding command))
6916 (gnus-message 6 "Executing %s...done" (key-description command)))))
6918 (defun gnus-summary-beginning-of-article ()
6919 "Scroll the article back to the beginning."
6921 (gnus-summary-select-article)
6922 (gnus-configure-windows 'article)
6923 (gnus-eval-in-buffer-window gnus-article-buffer
6925 (goto-char (point-min))
6926 (when gnus-page-broken
6927 (gnus-narrow-to-page))))
6929 (defun gnus-summary-end-of-article ()
6930 "Scroll to the end of the article."
6932 (gnus-summary-select-article)
6933 (gnus-configure-windows 'article)
6934 (gnus-eval-in-buffer-window gnus-article-buffer
6936 (goto-char (point-max))
6938 (when gnus-page-broken
6939 (gnus-narrow-to-page))))
6941 (defun gnus-summary-print-article (&optional filename n)
6942 "Generate and print a PostScript image of the N next (mail) articles.
6944 If N is negative, print the N previous articles. If N is nil and articles
6945 have been marked with the process mark, print these instead.
6947 If the optional second argument FILENAME is nil, send the image to the
6948 printer. If FILENAME is a string, save the PostScript image in a file with
6949 that name. If FILENAME is a number, prompt the user for the name of the file
6951 (interactive (list (ps-print-preprint current-prefix-arg)
6952 current-prefix-arg))
6953 (dolist (article (gnus-summary-work-articles n))
6954 (gnus-summary-select-article nil nil 'pseudo article)
6955 (gnus-eval-in-buffer-window gnus-article-buffer
6956 (let ((buffer (generate-new-buffer " *print*")))
6959 (copy-to-buffer buffer (point-min) (point-max))
6961 (gnus-article-delete-invisible-text)
6962 (let ((ps-left-header
6965 (mail-header-subject gnus-current-headers) ")")
6967 (mail-header-from gnus-current-headers) ")")))
6970 "/pagenumberstring load"
6972 (mail-header-date gnus-current-headers) ")"))))
6973 (gnus-run-hooks 'gnus-ps-print-hook)
6975 (ps-print-buffer-with-faces filename))))
6976 (kill-buffer buffer))))))
6978 (defun gnus-summary-show-article (&optional arg)
6979 "Force re-fetching of the current article.
6980 If ARG (the prefix) is non-nil, show the raw article without any
6981 article massaging functions being run."
6984 ;; Select the article the normal way.
6985 (gnus-summary-select-article nil 'force)
6986 ;; We have to require this here to make sure that the following
6987 ;; dynamic binding isn't shadowed by autoloading.
6988 (require 'gnus-async)
6990 ;; Bind the article treatment functions to nil.
6991 (let ((gnus-have-all-headers t)
6992 gnus-article-prepare-hook
6993 gnus-article-decode-hook
6994 gnus-display-mime-function
6997 ;; Destroy any MIME parts.
6998 (when (gnus-buffer-live-p gnus-article-buffer)
7000 (set-buffer gnus-article-buffer)
7001 (mm-destroy-parts gnus-article-mime-handles)))
7002 (gnus-summary-select-article nil 'force)))
7003 (gnus-summary-goto-subject gnus-current-article)
7004 (gnus-summary-position-point))
7006 (defun gnus-summary-verbose-headers (&optional arg)
7007 "Toggle permanent full header display.
7008 If ARG is a positive number, turn header display on.
7009 If ARG is a negative number, turn header display off."
7011 (setq gnus-show-all-headers
7012 (cond ((or (not (numberp arg))
7014 (not gnus-show-all-headers))
7017 (gnus-summary-show-article))
7019 (defun gnus-summary-toggle-header (&optional arg)
7020 "Show the headers if they are hidden, or hide them if they are shown.
7021 If ARG is a positive number, show the entire header.
7022 If ARG is a negative number, hide the unwanted header lines."
7025 (set-buffer gnus-article-buffer)
7026 (let* ((buffer-read-only nil)
7027 (inhibit-point-motion-hooks t)
7028 (hidden (text-property-any
7029 (goto-char (point-min)) (search-forward "\n\n")
7032 (goto-char (point-min))
7033 (when (search-forward "\n\n" nil t)
7034 (delete-region (point-min) (1- (point))))
7035 (goto-char (point-min))
7037 (set-buffer gnus-original-article-buffer)
7038 (goto-char (point-min))
7039 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
7040 (insert-buffer-substring gnus-original-article-buffer 1 e)
7041 (narrow-to-region (point-min) (point))
7042 (if (or (not hidden) (and (numberp arg) (< arg 0)))
7043 (let ((gnus-treat-hide-headers nil)
7044 (gnus-treat-hide-boring-headers nil))
7045 (gnus-treat-article 'head))
7046 (gnus-treat-article 'head)))))
7048 (defun gnus-summary-show-all-headers ()
7049 "Make all header lines visible."
7051 (gnus-article-show-all-headers))
7053 (defun gnus-summary-caesar-message (&optional arg)
7054 "Caesar rotate the current article by 13.
7055 The numerical prefix specifies how many places to rotate each letter
7058 (gnus-summary-select-article)
7059 (let ((mail-header-separator ""))
7060 (gnus-eval-in-buffer-window gnus-article-buffer
7063 (let ((start (window-start))
7065 (message-caesar-buffer-body arg)
7066 (set-window-start (get-buffer-window (current-buffer)) start))))))
7068 (defun gnus-summary-stop-page-breaking ()
7069 "Stop page breaking in the current article."
7071 (gnus-summary-select-article)
7072 (gnus-eval-in-buffer-window gnus-article-buffer
7074 (when (gnus-visual-p 'page-marker)
7075 (let ((buffer-read-only nil))
7076 (gnus-remove-text-with-property 'gnus-prev)
7077 (gnus-remove-text-with-property 'gnus-next))
7078 (setq gnus-page-broken nil))))
7080 (defun gnus-summary-move-article (&optional n to-newsgroup
7081 select-method action)
7082 "Move the current article to a different newsgroup.
7083 If N is a positive number, move the N next articles.
7084 If N is a negative number, move the N previous articles.
7085 If N is nil and any articles have been marked with the process mark,
7086 move those articles instead.
7087 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7088 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7089 re-spool using this method.
7091 For this function to work, both the current newsgroup and the
7092 newsgroup that you want to move to have to support the `request-move'
7093 and `request-accept' functions."
7096 (setq action 'move))
7097 ;; Disable marking as read.
7098 (let (gnus-mark-article-hook)
7099 (save-window-excursion
7100 (gnus-summary-select-article)))
7101 ;; Check whether the source group supports the required functions.
7102 (cond ((and (eq action 'move)
7103 (not (gnus-check-backend-function
7104 'request-move-article gnus-newsgroup-name)))
7105 (error "The current group does not support article moving"))
7106 ((and (eq action 'crosspost)
7107 (not (gnus-check-backend-function
7108 'request-replace-article gnus-newsgroup-name)))
7109 (error "The current group does not support article editing")))
7110 (let ((articles (gnus-summary-work-articles n))
7111 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
7112 (names '((move "Move" "Moving")
7113 (copy "Copy" "Copying")
7114 (crosspost "Crosspost" "Crossposting")))
7115 (copy-buf (save-excursion
7116 (nnheader-set-temp-buffer " *copy article*")))
7117 art-group to-method new-xref article to-groups)
7118 (unless (assq action names)
7119 (error "Unknown action %s" action))
7120 ;; Read the newsgroup name.
7121 (when (and (not to-newsgroup)
7122 (not select-method))
7124 (gnus-read-move-group-name
7125 (cadr (assq action names))
7126 (symbol-value (intern (format "gnus-current-%s-group" action)))
7128 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
7129 (setq to-method (or select-method
7130 (gnus-group-name-to-method to-newsgroup)))
7131 ;; Check the method we are to move this article to...
7132 (unless (gnus-check-backend-function
7133 'request-accept-article (car to-method))
7134 (error "%s does not support article copying" (car to-method)))
7135 (unless (gnus-check-server to-method)
7136 (error "Can't open server %s" (car to-method)))
7137 (gnus-message 6 "%s to %s: %s..."
7138 (caddr (assq action names))
7139 (or (car select-method) to-newsgroup) articles)
7141 (setq article (pop articles))
7145 ;; Move the article.
7147 ;; Remove this article from future suppression.
7148 (gnus-dup-unsuppress-article article)
7149 (gnus-request-move-article
7150 article ; Article to move
7151 gnus-newsgroup-name ; From newsgroup
7152 (nth 1 (gnus-find-method-for-group
7153 gnus-newsgroup-name)) ; Server
7154 (list 'gnus-request-accept-article
7155 to-newsgroup (list 'quote select-method)
7156 (not articles) t) ; Accept form
7157 (not articles))) ; Only save nov last time
7158 ;; Copy the article.
7161 (set-buffer copy-buf)
7162 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
7163 (gnus-request-accept-article
7164 to-newsgroup select-method (not articles) t))))
7165 ;; Crosspost the article.
7166 ((eq action 'crosspost)
7167 (let ((xref (message-tokenize-header
7168 (mail-header-xref (gnus-summary-article-header article))
7170 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
7173 (setq xref (list (system-name))))
7176 (mapconcat 'identity
7177 (delete "Xref:" (delete new-xref xref))
7181 (set-buffer copy-buf)
7182 ;; First put the article in the destination group.
7183 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7184 (when (consp (setq art-group
7185 (gnus-request-accept-article
7186 to-newsgroup select-method (not articles))))
7187 (setq new-xref (concat new-xref " " (car art-group)
7188 ":" (cdr art-group)))
7189 ;; Now we have the new Xrefs header, so we insert
7190 ;; it and replace the new article.
7191 (nnheader-replace-header "Xref" new-xref)
7192 (gnus-request-replace-article
7193 (cdr art-group) to-newsgroup (current-buffer))
7197 (gnus-message 1 "Couldn't %s article %s"
7198 (cadr (assq action names)) article))
7199 ((and (eq art-group 'junk)
7201 (gnus-summary-mark-article article gnus-canceled-mark)
7202 (gnus-message 4 "Deleted article %s" article))
7204 (let* ((pto-group (gnus-group-prefixed-name
7205 (car art-group) to-method))
7207 (gnus-gethash pto-group gnus-newsrc-hashtb))
7208 (info (nth 2 entry))
7209 (to-group (gnus-info-group info)))
7210 ;; Update the group that has been moved to.
7212 (memq action '(move copy)))
7213 (unless (member to-group to-groups)
7214 (push to-group to-groups))
7216 (unless (memq article gnus-newsgroup-unreads)
7218 info (gnus-add-to-range (gnus-info-read info)
7219 (list (cdr art-group)))))
7221 ;; Copy any marks over to the new group.
7222 (let ((marks gnus-article-mark-lists)
7223 (to-article (cdr art-group)))
7225 ;; See whether the article is to be put in the cache.
7226 (when gnus-use-cache
7227 (gnus-cache-possibly-enter-article
7229 (let ((header (copy-sequence
7230 (gnus-summary-article-header article))))
7231 (mail-header-set-number header to-article)
7233 (memq article gnus-newsgroup-marked)
7234 (memq article gnus-newsgroup-dormant)
7235 (memq article gnus-newsgroup-unreads)))
7237 (when (and (equal to-group gnus-newsgroup-name)
7238 (not (memq article gnus-newsgroup-unreads)))
7239 ;; Mark this article as read in this group.
7240 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
7241 (setcdr (gnus-active to-group) to-article)
7242 (setcdr gnus-newsgroup-active to-article))
7245 (when (memq article (symbol-value
7246 (intern (format "gnus-newsgroup-%s"
7248 ;; If the other group is the same as this group,
7249 ;; then we have to add the mark to the list.
7250 (when (equal to-group gnus-newsgroup-name)
7251 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
7254 (intern (format "gnus-newsgroup-%s"
7256 ;; Copy the marks to other group.
7257 (gnus-add-marked-articles
7258 to-group (cdar marks) (list to-article) info))
7259 (setq marks (cdr marks)))
7262 (concat "(gnus-group-set-info '"
7263 (gnus-prin1-to-string (gnus-get-info to-group))
7266 ;; Update the Xref header in this article to point to
7267 ;; the new crossposted article we have just created.
7268 (when (eq action 'crosspost)
7270 (set-buffer copy-buf)
7271 (gnus-request-article-this-buffer article gnus-newsgroup-name)
7272 (nnheader-replace-header "Xref" new-xref)
7273 (gnus-request-replace-article
7274 article gnus-newsgroup-name (current-buffer)))))
7276 ;;;!!!Why is this necessary?
7277 (set-buffer gnus-summary-buffer)
7279 (gnus-summary-goto-subject article)
7280 (when (eq action 'move)
7281 (gnus-summary-mark-article article gnus-canceled-mark))))
7282 (gnus-summary-remove-process-mark article))
7283 ;; Re-activate all groups that have been moved to.
7286 (set-buffer gnus-group-buffer)
7287 (when (gnus-group-goto-group (car to-groups) t)
7288 (gnus-group-get-new-news-this-group 1 t))
7291 (gnus-kill-buffer copy-buf)
7292 (gnus-summary-position-point)
7293 (gnus-set-mode-line 'summary)))
7295 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
7296 "Move the current article to a different newsgroup.
7297 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
7298 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
7299 re-spool using this method."
7301 (gnus-summary-move-article n to-newsgroup select-method 'copy))
7303 (defun gnus-summary-crosspost-article (&optional n)
7304 "Crosspost the current article to some other group."
7306 (gnus-summary-move-article n nil nil 'crosspost))
7308 (defcustom gnus-summary-respool-default-method nil
7309 "Default method for respooling an article.
7310 If nil, use to the current newsgroup method."
7311 :type '(choice (gnus-select-method :value (nnml ""))
7313 :group 'gnus-summary-mail)
7315 (defun gnus-summary-respool-article (&optional n method)
7316 "Respool the current article.
7317 The article will be squeezed through the mail spooling process again,
7318 which means that it will be put in some mail newsgroup or other
7319 depending on `nnmail-split-methods'.
7320 If N is a positive number, respool the N next articles.
7321 If N is a negative number, respool the N previous articles.
7322 If N is nil and any articles have been marked with the process mark,
7323 respool those articles instead.
7325 Respooling can be done both from mail groups and \"real\" newsgroups.
7326 In the former case, the articles in question will be moved from the
7327 current group into whatever groups they are destined to. In the
7328 latter case, they will be copied into the relevant groups."
7330 (list current-prefix-arg
7331 (let* ((methods (gnus-methods-using 'respool))
7333 (symbol-name (or gnus-summary-respool-default-method
7334 (car (gnus-find-method-for-group
7335 gnus-newsgroup-name)))))
7337 (gnus-completing-read
7338 methname "What backend do you want to use when respooling?"
7339 methods nil t nil 'gnus-mail-method-history))
7342 ((zerop (length (setq ms (gnus-servers-using-backend
7344 (list (intern method) ""))
7348 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
7349 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
7352 (error "No method given for respooling"))
7353 (if (assoc (symbol-name
7354 (car (gnus-find-method-for-group gnus-newsgroup-name)))
7355 (gnus-methods-using 'respool))
7356 (gnus-summary-move-article n nil method)
7357 (gnus-summary-copy-article n nil method)))
7359 (defun gnus-summary-import-article (file)
7360 "Import an arbitrary file into a mail newsgroup."
7361 (interactive "fImport file: ")
7362 (let ((group gnus-newsgroup-name)
7363 (now (current-time))
7365 (unless (gnus-check-backend-function 'request-accept-article group)
7366 (error "%s does not support article importing" group))
7367 (or (file-readable-p file)
7368 (not (file-regular-p file))
7369 (error "Can't read %s" file))
7371 (set-buffer (gnus-get-buffer-create " *import file*"))
7373 (insert-file-contents file)
7374 (goto-char (point-min))
7375 (unless (nnheader-article-p)
7376 ;; This doesn't look like an article, so we fudge some headers.
7377 (setq atts (file-attributes file)
7378 lines (count-lines (point-min) (point-max)))
7379 (insert "From: " (read-string "From: ") "\n"
7380 "Subject: " (read-string "Subject: ") "\n"
7381 "Date: " (message-make-date (nth 5 atts))
7383 "Message-ID: " (message-make-message-id) "\n"
7384 "Lines: " (int-to-string lines) "\n"
7385 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
7386 (gnus-request-accept-article group nil t)
7387 (kill-buffer (current-buffer)))))
7389 (defun gnus-summary-article-posted-p ()
7390 "Say whether the current (mail) article is available from `gnus-select-method' as well.
7391 This will be the case if the article has both been mailed and posted."
7393 (let ((id (mail-header-references (gnus-summary-article-header)))
7394 (gnus-override-method
7395 (or gnus-refer-article-method gnus-select-method)))
7396 (if (gnus-request-head id "")
7397 (gnus-message 2 "The current message was found on %s"
7398 gnus-override-method)
7399 (gnus-message 2 "The current message couldn't be found on %s"
7400 gnus-override-method)
7403 (defun gnus-summary-expire-articles (&optional now)
7404 "Expire all articles that are marked as expirable in the current group."
7406 (when (gnus-check-backend-function
7407 'request-expire-articles gnus-newsgroup-name)
7408 ;; This backend supports expiry.
7409 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
7410 (expirable (if total
7412 ;; We need to update the info for
7413 ;; this group for `gnus-list-of-read-articles'
7414 ;; to give us the right answer.
7415 (gnus-run-hooks 'gnus-exit-group-hook)
7416 (gnus-summary-update-info)
7417 (gnus-list-of-read-articles gnus-newsgroup-name))
7418 (setq gnus-newsgroup-expirable
7419 (sort gnus-newsgroup-expirable '<))))
7420 (expiry-wait (if now 'immediate
7421 (gnus-group-find-parameter
7422 gnus-newsgroup-name 'expiry-wait)))
7425 ;; There are expirable articles in this group, so we run them
7426 ;; through the expiry process.
7427 (gnus-message 6 "Expiring articles...")
7428 ;; The list of articles that weren't expired is returned.
7431 (let ((nnmail-expiry-wait-function nil)
7432 (nnmail-expiry-wait expiry-wait))
7433 (setq es (gnus-request-expire-articles
7434 expirable gnus-newsgroup-name)))
7435 (setq es (gnus-request-expire-articles
7436 expirable gnus-newsgroup-name))))
7438 (setq gnus-newsgroup-expirable es))
7439 ;; We go through the old list of expirable, and mark all
7440 ;; really expired articles as nonexistent.
7441 (unless (eq es expirable) ;If nothing was expired, we don't mark.
7442 (let ((gnus-use-cache nil))
7444 (unless (memq (car expirable) es)
7445 (when (gnus-data-find (car expirable))
7446 (gnus-summary-mark-article
7447 (car expirable) gnus-canceled-mark)))
7448 (setq expirable (cdr expirable)))))
7449 (gnus-message 6 "Expiring articles...done")))))
7451 (defun gnus-summary-expire-articles-now ()
7452 "Expunge all expirable articles in the current group.
7453 This means that *all* articles that are marked as expirable will be
7454 deleted forever, right now."
7456 (or gnus-expert-user
7458 "Are you really, really, really sure you want to delete all these messages? ")
7460 (gnus-summary-expire-articles t))
7462 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
7463 (defun gnus-summary-delete-article (&optional n)
7464 "Delete the N next (mail) articles.
7465 This command actually deletes articles. This is not a marking
7466 command. The article will disappear forever from your life, never to
7468 If N is negative, delete backwards.
7469 If N is nil and articles have been marked with the process mark,
7470 delete these instead."
7472 (unless (gnus-check-backend-function 'request-expire-articles
7473 gnus-newsgroup-name)
7474 (error "The current newsgroup does not support article deletion"))
7475 ;; Compute the list of articles to delete.
7476 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
7478 (if (and gnus-novice-user
7479 (not (gnus-yes-or-no-p
7480 (format "Do you really want to delete %s forever? "
7481 (if (> (length articles) 1)
7482 (format "these %s articles" (length articles))
7485 ;; Delete the articles.
7486 (setq not-deleted (gnus-request-expire-articles
7487 articles gnus-newsgroup-name 'force))
7489 (gnus-summary-remove-process-mark (car articles))
7490 ;; The backend might not have been able to delete the article
7492 (unless (memq (car articles) not-deleted)
7493 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
7494 (setq articles (cdr articles)))
7496 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
7497 (gnus-summary-position-point)
7498 (gnus-set-mode-line 'summary)
7501 (defun gnus-summary-edit-article (&optional force)
7502 "Edit the current article.
7503 This will have permanent effect only in mail groups.
7504 If FORCE is non-nil, allow editing of articles even in read-only
7508 (set-buffer gnus-summary-buffer)
7509 (gnus-set-global-variables)
7510 (when (and (not force)
7511 (gnus-group-read-only-p))
7512 (error "The current newsgroup does not support article editing"))
7513 ;; Select article if needed.
7514 (unless (eq (gnus-summary-article-number)
7515 gnus-current-article)
7516 (gnus-summary-select-article t))
7517 (gnus-article-date-original)
7518 (gnus-article-edit-article
7519 `(lambda (no-highlight)
7520 (gnus-summary-edit-article-done
7521 ,(or (mail-header-references gnus-current-headers) "")
7522 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))
7524 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
7526 (defun gnus-summary-edit-article-done (&optional references read-only buffer
7528 "Make edits to the current article permanent."
7530 ;; Replace the article.
7531 (let ((buf (current-buffer)))
7533 (insert-buffer-substring buf)
7534 (if (and (not read-only)
7535 (not (gnus-request-replace-article
7536 (cdr gnus-article-current) (car gnus-article-current)
7538 (not gnus-article-decoded-p))))
7539 (error "Couldn't replace article")
7540 ;; Update the summary buffer.
7542 (equal (message-tokenize-header references " ")
7543 (message-tokenize-header
7544 (or (message-fetch-field "references") "") " ")))
7545 ;; We only have to update this line.
7548 (message-narrow-to-head)
7549 (let ((head (buffer-string))
7552 (insert (format "211 %d Article retrieved.\n"
7553 (cdr gnus-article-current)))
7556 (let ((nntp-server-buffer (current-buffer)))
7557 (setq header (car (gnus-get-newsgroup-headers
7559 (set-buffer gnus-summary-buffer)
7560 gnus-newsgroup-dependencies)
7563 (set-buffer gnus-summary-buffer)
7564 (gnus-data-set-header
7565 (gnus-data-find (cdr gnus-article-current))
7567 (gnus-summary-update-article-line
7568 (cdr gnus-article-current) header))))))
7570 (set-buffer (or buffer gnus-summary-buffer))
7571 (gnus-summary-update-article (cdr gnus-article-current)))
7572 ;; Prettify the article buffer again.
7573 (unless no-highlight
7575 (set-buffer gnus-article-buffer)
7576 ;;;!!! Fix this -- article should be rehighlighted.
7577 ;;;(gnus-run-hooks 'gnus-article-display-hook)
7578 (set-buffer gnus-original-article-buffer)
7579 (gnus-request-article
7580 (cdr gnus-article-current)
7581 (car gnus-article-current) (current-buffer))))
7582 ;; Prettify the summary buffer line.
7583 (when (gnus-visual-p 'summary-highlight 'highlight)
7584 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
7586 (defun gnus-summary-edit-wash (key)
7587 "Perform editing command KEY in the article buffer."
7591 (message "%s" (concat (this-command-keys) "- "))
7594 (gnus-summary-edit-article)
7595 (execute-kbd-macro (concat (this-command-keys) key))
7596 (gnus-article-edit-done))
7600 (defun gnus-summary-respool-query (&optional silent trace)
7601 "Query where the respool algorithm would put this article."
7603 (let (gnus-mark-article-hook)
7604 (gnus-summary-select-article)
7606 (set-buffer gnus-original-article-buffer)
7608 (message-narrow-to-head)
7609 (let ((groups (nnmail-article-group 'identity trace)))
7612 (message "This message would go to %s"
7613 (mapconcat 'car groups ", "))
7614 (message "This message would go to no groups"))
7617 (defun gnus-summary-respool-trace ()
7618 "Trace where the respool algorithm would put this article.
7619 Display a buffer showing all fancy splitting patterns which matched."
7621 (gnus-summary-respool-query nil t))
7623 ;; Summary marking commands.
7625 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7626 "Mark articles which has the same subject as read, and then select the next.
7627 If UNMARK is positive, remove any kind of mark.
7628 If UNMARK is negative, tick articles."
7631 (setq unmark (prefix-numeric-value unmark)))
7633 (gnus-summary-mark-same-subject
7634 (gnus-summary-article-subject) unmark)))
7635 ;; Select next unread article. If auto-select-same mode, should
7636 ;; select the first unread article.
7637 (gnus-summary-next-article t (and gnus-auto-select-same
7638 (gnus-summary-article-subject)))
7639 (gnus-message 7 "%d article%s marked as %s"
7640 count (if (= count 1) " is" "s are")
7641 (if unmark "unread" "read"))))
7643 (defun gnus-summary-kill-same-subject (&optional unmark)
7644 "Mark articles which has the same subject as read.
7645 If UNMARK is positive, remove any kind of mark.
7646 If UNMARK is negative, tick articles."
7649 (setq unmark (prefix-numeric-value unmark)))
7651 (gnus-summary-mark-same-subject
7652 (gnus-summary-article-subject) unmark)))
7653 ;; If marked as read, go to next unread subject.
7655 ;; Go to next unread subject.
7656 (gnus-summary-next-subject 1 t))
7657 (gnus-message 7 "%d articles are marked as %s"
7658 count (if unmark "unread" "read"))))
7660 (defun gnus-summary-mark-same-subject (subject &optional unmark)
7661 "Mark articles with same SUBJECT as read, and return marked number.
7662 If optional argument UNMARK is positive, remove any kinds of marks.
7663 If optional argument UNMARK is negative, mark articles as unread instead."
7667 ((null unmark) ; Mark as read.
7670 (gnus-summary-mark-article-as-read gnus-killed-mark)
7671 (gnus-summary-show-thread) t)
7672 (gnus-summary-find-subject subject))
7673 (setq count (1+ count))))
7674 ((> unmark 0) ; Tick.
7677 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
7678 (gnus-summary-show-thread) t)
7679 (gnus-summary-find-subject subject))
7680 (setq count (1+ count))))
7681 (t ; Mark as unread.
7684 (gnus-summary-mark-article-as-unread gnus-unread-mark)
7685 (gnus-summary-show-thread) t)
7686 (gnus-summary-find-subject subject))
7687 (setq count (1+ count)))))
7688 (gnus-set-mode-line 'summary)
7689 ;; Return the number of marked articles.
7692 (defun gnus-summary-mark-as-processable (n &optional unmark)
7693 "Set the process mark on the next N articles.
7694 If N is negative, mark backward instead. If UNMARK is non-nil, remove
7695 the process mark instead. The difference between N and the actual
7696 number of articles marked is returned."
7698 (let ((backward (< n 0))
7703 (gnus-summary-remove-process-mark
7704 (gnus-summary-article-number))
7705 (gnus-summary-set-process-mark (gnus-summary-article-number)))
7706 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
7709 (gnus-message 7 "No more articles"))
7710 (gnus-summary-recenter)
7711 (gnus-summary-position-point)
7714 (defun gnus-summary-unmark-as-processable (n)
7715 "Remove the process mark from the next N articles.
7716 If N is negative, unmark backward instead. The difference between N and
7717 the actual number of articles unmarked is returned."
7719 (gnus-summary-mark-as-processable n t))
7721 (defun gnus-summary-unmark-all-processable ()
7722 "Remove the process mark from all articles."
7725 (while gnus-newsgroup-processable
7726 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
7727 (gnus-summary-position-point))
7729 (defun gnus-summary-mark-as-expirable (n)
7730 "Mark N articles forward as expirable.
7731 If N is negative, mark backward instead. The difference between N and
7732 the actual number of articles marked is returned."
7734 (gnus-summary-mark-forward n gnus-expirable-mark))
7736 (defun gnus-summary-mark-article-as-replied (article)
7737 "Mark ARTICLE replied and update the summary line."
7738 (push article gnus-newsgroup-replied)
7739 (let ((buffer-read-only nil))
7740 (when (gnus-summary-goto-subject article nil t)
7741 (gnus-summary-update-secondary-mark article))))
7743 (defun gnus-summary-set-bookmark (article)
7744 "Set a bookmark in current article."
7745 (interactive (list (gnus-summary-article-number)))
7746 (when (or (not (get-buffer gnus-article-buffer))
7747 (not gnus-current-article)
7748 (not gnus-article-current)
7749 (not (equal gnus-newsgroup-name (car gnus-article-current))))
7750 (error "No current article selected"))
7751 ;; Remove old bookmark, if one exists.
7752 (let ((old (assq article gnus-newsgroup-bookmarks)))
7754 (setq gnus-newsgroup-bookmarks
7755 (delq old gnus-newsgroup-bookmarks))))
7756 ;; Set the new bookmark, which is on the form
7757 ;; (article-number . line-number-in-body).
7761 (set-buffer gnus-article-buffer)
7765 (goto-char (point-min))
7766 (search-forward "\n\n" nil t)
7769 gnus-newsgroup-bookmarks)
7770 (gnus-message 6 "A bookmark has been added to the current article."))
7772 (defun gnus-summary-remove-bookmark (article)
7773 "Remove the bookmark from the current article."
7774 (interactive (list (gnus-summary-article-number)))
7775 ;; Remove old bookmark, if one exists.
7776 (let ((old (assq article gnus-newsgroup-bookmarks)))
7779 (setq gnus-newsgroup-bookmarks
7780 (delq old gnus-newsgroup-bookmarks))
7781 (gnus-message 6 "Removed bookmark."))
7782 (gnus-message 6 "No bookmark in current article."))))
7784 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
7785 (defun gnus-summary-mark-as-dormant (n)
7786 "Mark N articles forward as dormant.
7787 If N is negative, mark backward instead. The difference between N and
7788 the actual number of articles marked is returned."
7790 (gnus-summary-mark-forward n gnus-dormant-mark))
7792 (defun gnus-summary-set-process-mark (article)
7793 "Set the process mark on ARTICLE and update the summary line."
7794 (setq gnus-newsgroup-processable
7796 (delq article gnus-newsgroup-processable)))
7797 (when (gnus-summary-goto-subject article)
7798 (gnus-summary-show-thread)
7799 (gnus-summary-goto-subject article)
7800 (gnus-summary-update-secondary-mark article)))
7802 (defun gnus-summary-remove-process-mark (article)
7803 "Remove the process mark from ARTICLE and update the summary line."
7804 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
7805 (when (gnus-summary-goto-subject article)
7806 (gnus-summary-show-thread)
7807 (gnus-summary-goto-subject article)
7808 (gnus-summary-update-secondary-mark article)))
7810 (defun gnus-summary-set-saved-mark (article)
7811 "Set the process mark on ARTICLE and update the summary line."
7812 (push article gnus-newsgroup-saved)
7813 (when (gnus-summary-goto-subject article)
7814 (gnus-summary-update-secondary-mark article)))
7816 (defun gnus-summary-mark-forward (n &optional mark no-expire)
7817 "Mark N articles as read forwards.
7818 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
7819 The difference between N and the actual number of articles marked is
7822 (gnus-summary-show-thread)
7823 (let ((backward (< n 0))
7824 (gnus-summary-goto-unread
7825 (and gnus-summary-goto-unread
7826 (not (eq gnus-summary-goto-unread 'never))
7827 (not (memq mark (list gnus-unread-mark
7828 gnus-ticked-mark gnus-dormant-mark)))))
7830 (mark (or mark gnus-del-mark)))
7832 (gnus-summary-mark-article nil mark no-expire)
7833 (zerop (gnus-summary-next-subject
7835 (and gnus-summary-goto-unread
7836 (not (eq gnus-summary-goto-unread 'never)))
7840 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
7841 (gnus-summary-recenter)
7842 (gnus-summary-position-point)
7843 (gnus-set-mode-line 'summary)
7846 (defun gnus-summary-mark-article-as-read (mark)
7847 "Mark the current article quickly as read with MARK."
7848 (let ((article (gnus-summary-article-number)))
7849 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
7850 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7851 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7852 (push (cons article mark) gnus-newsgroup-reads)
7853 ;; Possibly remove from cache, if that is used.
7854 (when gnus-use-cache
7855 (gnus-cache-enter-remove-article article))
7856 ;; Allow the backend to change the mark.
7857 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7858 ;; Check for auto-expiry.
7859 (when (and gnus-newsgroup-auto-expire
7860 (memq mark gnus-auto-expirable-marks))
7861 (setq mark gnus-expirable-mark)
7862 ;; Let the backend know about the mark change.
7863 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7864 (push article gnus-newsgroup-expirable))
7865 ;; Set the mark in the buffer.
7866 (gnus-summary-update-mark mark 'unread)
7869 (defun gnus-summary-mark-article-as-unread (mark)
7870 "Mark the current article quickly as unread with MARK."
7871 (let* ((article (gnus-summary-article-number))
7872 (old-mark (gnus-summary-article-mark article)))
7873 ;; Allow the backend to change the mark.
7874 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7875 (if (eq mark old-mark)
7879 (gnus-error 1 "Can't mark negative article numbers")
7881 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
7882 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
7883 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
7884 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
7885 (cond ((= mark gnus-ticked-mark)
7886 (push article gnus-newsgroup-marked))
7887 ((= mark gnus-dormant-mark)
7888 (push article gnus-newsgroup-dormant))
7890 (push article gnus-newsgroup-unreads)))
7891 (gnus-pull article gnus-newsgroup-reads)
7893 ;; See whether the article is to be put in the cache.
7895 (vectorp (gnus-summary-article-header article))
7897 (gnus-cache-possibly-enter-article
7898 gnus-newsgroup-name article
7899 (gnus-summary-article-header article)
7900 (= mark gnus-ticked-mark)
7901 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7904 (gnus-summary-update-mark mark 'unread)
7907 (defun gnus-summary-mark-article (&optional article mark no-expire)
7908 "Mark ARTICLE with MARK. MARK can be any character.
7909 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
7910 `??' (dormant) and `?E' (expirable).
7911 If MARK is nil, then the default character `?r' is used.
7912 If ARTICLE is nil, then the article on the current line will be
7914 ;; The mark might be a string.
7915 (when (stringp mark)
7916 (setq mark (aref mark 0)))
7917 ;; If no mark is given, then we check auto-expiring.
7919 (setq mark gnus-del-mark))
7920 (when (and (not no-expire)
7921 gnus-newsgroup-auto-expire
7922 (memq mark gnus-auto-expirable-marks))
7923 (setq mark gnus-expirable-mark))
7924 (let ((article (or article (gnus-summary-article-number)))
7925 (old-mark (gnus-summary-article-mark article)))
7926 ;; Allow the backend to change the mark.
7927 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
7928 (if (eq mark old-mark)
7931 (error "No article on current line"))
7932 (if (not (if (or (= mark gnus-unread-mark)
7933 (= mark gnus-ticked-mark)
7934 (= mark gnus-dormant-mark))
7935 (gnus-mark-article-as-unread article mark)
7936 (gnus-mark-article-as-read article mark)))
7938 ;; See whether the article is to be put in the cache.
7940 (not (= mark gnus-canceled-mark))
7941 (vectorp (gnus-summary-article-header article))
7943 (gnus-cache-possibly-enter-article
7944 gnus-newsgroup-name article
7945 (gnus-summary-article-header article)
7946 (= mark gnus-ticked-mark)
7947 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
7949 (when (gnus-summary-goto-subject article nil t)
7950 (let ((buffer-read-only nil))
7951 (gnus-summary-show-thread)
7953 (gnus-summary-update-mark mark 'unread)
7956 (defun gnus-summary-update-secondary-mark (article)
7957 "Update the secondary (read, process, cache) mark."
7958 (gnus-summary-update-mark
7959 (cond ((memq article gnus-newsgroup-processable)
7961 ((memq article gnus-newsgroup-cached)
7963 ((memq article gnus-newsgroup-replied)
7965 ((memq article gnus-newsgroup-saved)
7967 (t gnus-unread-mark))
7969 (when (gnus-visual-p 'summary-highlight 'highlight)
7970 (gnus-run-hooks 'gnus-summary-update-hook))
7973 (defun gnus-summary-update-mark (mark type)
7974 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
7975 (buffer-read-only nil))
7976 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
7978 (when (looking-at "\r")
7980 (when (<= (+ forward (point)) (point-max))
7981 ;; Go to the right position on the line.
7982 (goto-char (+ forward (point)))
7983 ;; Replace the old mark with the new mark.
7984 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
7985 ;; Optionally update the marks by some user rule.
7986 (when (eq type 'unread)
7988 (gnus-data-find (gnus-summary-article-number)) mark)
7989 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
7991 (defun gnus-mark-article-as-read (article &optional mark)
7992 "Enter ARTICLE in the pertinent lists and remove it from others."
7993 ;; Make the article expirable.
7994 (let ((mark (or mark gnus-del-mark)))
7995 (if (= mark gnus-expirable-mark)
7996 (push article gnus-newsgroup-expirable)
7997 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
7998 ;; Remove from unread and marked lists.
7999 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8000 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
8001 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
8002 (push (cons article mark) gnus-newsgroup-reads)
8003 ;; Possibly remove from cache, if that is used.
8004 (when gnus-use-cache
8005 (gnus-cache-enter-remove-article article))
8008 (defun gnus-mark-article-as-unread (article &optional mark)
8009 "Enter ARTICLE in the pertinent lists and remove it from others."
8010 (let ((mark (or mark gnus-ticked-mark)))
8013 (gnus-error 1 "Can't mark negative article numbers")
8015 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
8016 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
8017 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
8018 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
8020 ;; Unsuppress duplicates?
8021 (when gnus-suppress-duplicates
8022 (gnus-dup-unsuppress-article article))
8024 (cond ((= mark gnus-ticked-mark)
8025 (push article gnus-newsgroup-marked))
8026 ((= mark gnus-dormant-mark)
8027 (push article gnus-newsgroup-dormant))
8029 (push article gnus-newsgroup-unreads)))
8030 (gnus-pull article gnus-newsgroup-reads)
8033 (defalias 'gnus-summary-mark-as-unread-forward
8034 'gnus-summary-tick-article-forward)
8035 (make-obsolete 'gnus-summary-mark-as-unread-forward
8036 'gnus-summary-tick-article-forward)
8037 (defun gnus-summary-tick-article-forward (n)
8038 "Tick N articles forwards.
8039 If N is negative, tick backwards instead.
8040 The difference between N and the number of articles ticked is returned."
8042 (gnus-summary-mark-forward n gnus-ticked-mark))
8044 (defalias 'gnus-summary-mark-as-unread-backward
8045 'gnus-summary-tick-article-backward)
8046 (make-obsolete 'gnus-summary-mark-as-unread-backward
8047 'gnus-summary-tick-article-backward)
8048 (defun gnus-summary-tick-article-backward (n)
8049 "Tick N articles backwards.
8050 The difference between N and the number of articles ticked is returned."
8052 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
8054 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8055 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
8056 (defun gnus-summary-tick-article (&optional article clear-mark)
8057 "Mark current article as unread.
8058 Optional 1st argument ARTICLE specifies article number to be marked as unread.
8059 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
8061 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
8064 (defun gnus-summary-mark-as-read-forward (n)
8065 "Mark N articles as read forwards.
8066 If N is negative, mark backwards instead.
8067 The difference between N and the actual number of articles marked is
8070 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
8072 (defun gnus-summary-mark-as-read-backward (n)
8073 "Mark the N articles as read backwards.
8074 The difference between N and the actual number of articles marked is
8077 (gnus-summary-mark-forward
8078 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
8080 (defun gnus-summary-mark-as-read (&optional article mark)
8081 "Mark current article as read.
8082 ARTICLE specifies the article to be marked as read.
8083 MARK specifies a string to be inserted at the beginning of the line."
8084 (gnus-summary-mark-article article mark))
8086 (defun gnus-summary-clear-mark-forward (n)
8087 "Clear marks from N articles forward.
8088 If N is negative, clear backward instead.
8089 The difference between N and the number of marks cleared is returned."
8091 (gnus-summary-mark-forward n gnus-unread-mark))
8093 (defun gnus-summary-clear-mark-backward (n)
8094 "Clear marks from N articles backward.
8095 The difference between N and the number of marks cleared is returned."
8097 (gnus-summary-mark-forward (- n) gnus-unread-mark))
8099 (defun gnus-summary-mark-unread-as-read ()
8100 "Intended to be used by `gnus-summary-mark-article-hook'."
8101 (when (memq gnus-current-article gnus-newsgroup-unreads)
8102 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
8104 (defun gnus-summary-mark-read-and-unread-as-read ()
8105 "Intended to be used by `gnus-summary-mark-article-hook'."
8106 (let ((mark (gnus-summary-article-mark)))
8107 (when (or (gnus-unread-mark-p mark)
8108 (gnus-read-mark-p mark))
8109 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
8111 (defun gnus-summary-mark-region-as-read (point mark all)
8112 "Mark all unread articles between point and mark as read.
8113 If given a prefix, mark all articles between point and mark as read,
8114 even ticked and dormant ones."
8115 (interactive "r\nP")
8124 (memq (setq article (gnus-summary-article-number))
8125 gnus-newsgroup-unreads))
8126 (gnus-summary-mark-article article gnus-del-mark))
8128 (gnus-summary-find-next))))))
8130 (defun gnus-summary-mark-below (score mark)
8131 "Mark articles with score less than SCORE with MARK."
8132 (interactive "P\ncMark: ")
8133 (setq score (if score
8134 (prefix-numeric-value score)
8135 (or gnus-summary-default-score 0)))
8137 (set-buffer gnus-summary-buffer)
8138 (goto-char (point-min))
8141 (and (< (gnus-summary-article-score) score)
8142 (gnus-summary-mark-article nil mark))
8143 (gnus-summary-find-next)))))
8145 (defun gnus-summary-kill-below (&optional score)
8146 "Mark articles with score below SCORE as read."
8148 (gnus-summary-mark-below score gnus-killed-mark))
8150 (defun gnus-summary-clear-above (&optional score)
8151 "Clear all marks from articles with score above SCORE."
8153 (gnus-summary-mark-above score gnus-unread-mark))
8155 (defun gnus-summary-tick-above (&optional score)
8156 "Tick all articles with score above SCORE."
8158 (gnus-summary-mark-above score gnus-ticked-mark))
8160 (defun gnus-summary-mark-above (score mark)
8161 "Mark articles with score over SCORE with MARK."
8162 (interactive "P\ncMark: ")
8163 (setq score (if score
8164 (prefix-numeric-value score)
8165 (or gnus-summary-default-score 0)))
8167 (set-buffer gnus-summary-buffer)
8168 (goto-char (point-min))
8170 (when (> (gnus-summary-article-score) score)
8171 (gnus-summary-mark-article nil mark))
8173 (gnus-summary-find-next)))))
8175 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
8176 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
8177 (defun gnus-summary-limit-include-expunged (&optional no-error)
8178 "Display all the hidden articles that were expunged for low scores."
8180 (let ((buffer-read-only nil))
8181 (let ((scored gnus-newsgroup-scored)
8184 (unless (gnus-summary-goto-subject (caar scored))
8185 (and (setq h (gnus-summary-article-header (caar scored)))
8186 (< (cdar scored) gnus-summary-expunge-below)
8188 (setq scored (cdr scored)))
8190 (when (not no-error)
8191 (error "No expunged articles hidden"))
8192 (goto-char (point-min))
8193 (gnus-summary-prepare-unthreaded (nreverse headers))
8194 (goto-char (point-min))
8195 (gnus-summary-position-point)
8198 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
8199 "Mark all unread articles in this newsgroup as read.
8200 If prefix argument ALL is non-nil, ticked and dormant articles will
8201 also be marked as read.
8202 If QUIETLY is non-nil, no questions will be asked.
8203 If TO-HERE is non-nil, it should be a point in the buffer. All
8204 articles before this point will be marked as read.
8205 Note that this function will only catch up the unread article
8206 in the current summary buffer limitation.
8207 The number of articles marked as read is returned."
8212 (not gnus-interactive-catchup) ;Without confirmation?
8216 "Mark absolutely all articles as read? "
8217 "Mark all unread articles as read? ")))
8219 (not gnus-newsgroup-adaptive)
8220 (not gnus-newsgroup-auto-expire)
8221 (not gnus-suppress-duplicates)
8222 (or (not gnus-use-cache)
8223 (eq gnus-use-cache 'passive)))
8226 (setq gnus-newsgroup-marked nil
8227 gnus-newsgroup-dormant nil))
8228 (setq gnus-newsgroup-unreads gnus-newsgroup-downloadable))
8229 ;; We actually mark all articles as canceled, which we
8230 ;; have to do when using auto-expiry or adaptive scoring.
8231 (gnus-summary-show-all-threads)
8232 (when (gnus-summary-first-subject (not all) t)
8234 (if to-here (< (point) to-here) t)
8235 (gnus-summary-mark-article-as-read gnus-catchup-mark)
8236 (gnus-summary-find-next (not all) nil nil t))))
8237 (gnus-set-mode-line 'summary))
8239 (gnus-summary-position-point)))
8241 (defun gnus-summary-catchup-to-here (&optional all)
8242 "Mark all unticked articles before the current one as read.
8243 If ALL is non-nil, also mark ticked and dormant articles as read."
8246 (gnus-save-hidden-threads
8247 (let ((beg (point)))
8248 ;; We check that there are unread articles.
8249 (when (or all (gnus-summary-find-prev))
8250 (gnus-summary-catchup all t beg)))))
8251 (gnus-summary-position-point))
8253 (defun gnus-summary-catchup-all (&optional quietly)
8254 "Mark all articles in this newsgroup as read."
8256 (gnus-summary-catchup t quietly))
8258 (defun gnus-summary-catchup-and-exit (&optional all quietly)
8259 "Mark all articles not marked as unread in this newsgroup as read, then exit.
8260 If prefix argument ALL is non-nil, all articles are marked as read."
8262 (when (gnus-summary-catchup all quietly nil 'fast)
8263 ;; Select next newsgroup or exit.
8264 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
8265 (eq gnus-auto-select-next 'quietly))
8266 (gnus-summary-next-group nil)
8267 (gnus-summary-exit))))
8269 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
8270 "Mark all articles in this newsgroup as read, and then exit."
8272 (gnus-summary-catchup-and-exit t quietly))
8274 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
8275 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
8276 "Mark all articles in this group as read and select the next group.
8277 If given a prefix, mark all articles, unread as well as ticked, as
8281 (gnus-summary-catchup all))
8282 (gnus-summary-next-article t nil nil t))
8284 ;; Thread-based commands.
8286 (defun gnus-summary-articles-in-thread (&optional article)
8287 "Return a list of all articles in the current thread.
8288 If ARTICLE is non-nil, return all articles in the thread that starts
8290 (let* ((article (or article (gnus-summary-article-number)))
8291 (data (gnus-data-find-list article))
8292 (top-level (gnus-data-level (car data)))
8294 (cond ((null gnus-thread-operation-ignore-subject)
8295 (gnus-simplify-subject-re
8296 (mail-header-subject (gnus-data-header (car data)))))
8297 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
8298 (gnus-simplify-subject-fuzzy
8299 (mail-header-subject (gnus-data-header (car data)))))
8301 (end-point (save-excursion
8302 (if (gnus-summary-go-to-next-thread)
8303 (point) (point-max))))
8306 (< (gnus-data-pos (car data)) end-point))
8307 (when (or (not top-subject)
8308 (string= top-subject
8309 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
8310 (gnus-simplify-subject-fuzzy
8311 (mail-header-subject
8312 (gnus-data-header (car data))))
8313 (gnus-simplify-subject-re
8314 (mail-header-subject
8315 (gnus-data-header (car data)))))))
8316 (push (gnus-data-number (car data)) articles))
8317 (unless (and (setq data (cdr data))
8318 (> (gnus-data-level (car data)) top-level))
8320 ;; Return the list of articles.
8321 (nreverse articles)))
8323 (defun gnus-summary-rethread-current ()
8324 "Rethread the thread the current article is part of."
8326 (let* ((gnus-show-threads t)
8327 (article (gnus-summary-article-number))
8328 (id (mail-header-id (gnus-summary-article-header)))
8329 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
8331 (error "No article on the current line"))
8332 (gnus-rebuild-thread id)
8333 (gnus-summary-goto-subject article)))
8335 (defun gnus-summary-reparent-thread ()
8336 "Make the current article child of the marked (or previous) article.
8338 Note that the re-threading will only work if `gnus-thread-ignore-subject'
8339 is non-nil or the Subject: of both articles are the same."
8341 (unless (not (gnus-group-read-only-p))
8342 (error "The current newsgroup does not support article editing"))
8343 (unless (<= (length gnus-newsgroup-processable) 1)
8344 (error "No more than one article may be marked"))
8345 (save-window-excursion
8346 (let ((gnus-article-buffer " *reparent*")
8347 (current-article (gnus-summary-article-number))
8348 ;; First grab the marked article, otherwise one line up.
8349 (parent-article (if (not (null gnus-newsgroup-processable))
8350 (car gnus-newsgroup-processable)
8352 (if (eq (forward-line -1) 0)
8353 (gnus-summary-article-number)
8354 (error "Beginning of summary buffer"))))))
8355 (unless (not (eq current-article parent-article))
8356 (error "An article may not be self-referential"))
8357 (let ((message-id (mail-header-id
8358 (gnus-summary-article-header parent-article))))
8359 (unless (and message-id (not (equal message-id "")))
8360 (error "No message-id in desired parent"))
8361 (gnus-with-article current-article
8362 (goto-char (point-min))
8363 (if (re-search-forward "^References: " nil t)
8365 (re-search-forward "^[^ \t]" nil t)
8368 (insert " " message-id))
8369 (insert "References: " message-id "\n")))
8370 (set-buffer gnus-summary-buffer)
8371 (gnus-summary-unmark-all-processable)
8372 (gnus-summary-update-article current-article)
8373 (gnus-summary-rethread-current)
8374 (gnus-message 3 "Article %d is now the child of article %d"
8375 current-article parent-article)))))
8377 (defun gnus-summary-toggle-threads (&optional arg)
8378 "Toggle showing conversation threads.
8379 If ARG is positive number, turn showing conversation threads on."
8381 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
8382 (setq gnus-show-threads
8383 (if (null arg) (not gnus-show-threads)
8384 (> (prefix-numeric-value arg) 0)))
8385 (gnus-summary-prepare)
8386 (gnus-summary-goto-subject current)
8387 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
8388 (gnus-summary-position-point)))
8390 (defun gnus-summary-show-all-threads ()
8394 (let ((buffer-read-only nil))
8395 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
8396 (gnus-summary-position-point))
8398 (defun gnus-summary-show-thread ()
8399 "Show thread subtrees.
8400 Returns nil if no thread was there to be shown."
8402 (let ((buffer-read-only nil)
8404 ;; first goto end then to beg, to have point at beg after let
8405 (end (progn (end-of-line) (point)))
8406 (beg (progn (beginning-of-line) (point))))
8408 ;; Any hidden lines here?
8409 (search-forward "\r" end t)
8410 (subst-char-in-region beg end ?\^M ?\n t)
8412 (gnus-summary-position-point))))
8414 (defun gnus-summary-hide-all-threads ()
8415 "Hide all thread subtrees."
8418 (goto-char (point-min))
8419 (gnus-summary-hide-thread)
8420 (while (zerop (gnus-summary-next-thread 1 t))
8421 (gnus-summary-hide-thread)))
8422 (gnus-summary-position-point))
8424 (defun gnus-summary-hide-thread ()
8425 "Hide thread subtrees.
8426 Returns nil if no threads were there to be hidden."
8428 (let ((buffer-read-only nil)
8430 (article (gnus-summary-article-number)))
8432 ;; Go forward until either the buffer ends or the subthread
8434 (when (and (not (eobp))
8435 (or (zerop (gnus-summary-next-thread 1 t))
8436 (goto-char (point-max))))
8438 (if (and (> (point) start)
8439 (search-backward "\n" start t))
8441 (subst-char-in-region start (point) ?\n ?\^M)
8442 (gnus-summary-goto-subject article))
8445 ;;(gnus-summary-position-point)
8448 (defun gnus-summary-go-to-next-thread (&optional previous)
8449 "Go to the same level (or less) next thread.
8450 If PREVIOUS is non-nil, go to previous thread instead.
8451 Return the article number moved to, or nil if moving was impossible."
8452 (let ((level (gnus-summary-thread-level))
8453 (way (if previous -1 1))
8456 (while (and (not (eobp))
8457 (< level (gnus-summary-thread-level)))
8465 (gnus-summary-article-number)
8468 (defun gnus-summary-next-thread (n &optional silent)
8469 "Go to the same level next N'th thread.
8470 If N is negative, search backward instead.
8471 Returns the difference between N and the number of skips actually
8474 If SILENT, don't output messages."
8476 (let ((backward (< n 0))
8479 (gnus-summary-go-to-next-thread backward))
8482 (gnus-summary-position-point))
8483 (when (and (not silent) (/= 0 n))
8484 (gnus-message 7 "No more threads"))
8487 (defun gnus-summary-prev-thread (n)
8488 "Go to the same level previous N'th thread.
8489 Returns the difference between N and the number of skips actually
8492 (gnus-summary-next-thread (- n)))
8494 (defun gnus-summary-go-down-thread ()
8495 "Go down one level in the current thread."
8496 (let ((children (gnus-summary-article-children)))
8498 (gnus-summary-goto-subject (car children)))))
8500 (defun gnus-summary-go-up-thread ()
8501 "Go up one level in the current thread."
8502 (let ((parent (gnus-summary-article-parent)))
8504 (gnus-summary-goto-subject parent))))
8506 (defun gnus-summary-down-thread (n)
8507 "Go down thread N steps.
8508 If N is negative, go up instead.
8509 Returns the difference between N and how many steps down that were
8515 (if up (gnus-summary-go-up-thread)
8516 (gnus-summary-go-down-thread)))
8518 (gnus-summary-position-point)
8520 (gnus-message 7 "Can't go further"))
8523 (defun gnus-summary-up-thread (n)
8524 "Go up thread N steps.
8525 If N is negative, go up instead.
8526 Returns the difference between N and how many steps down that were
8529 (gnus-summary-down-thread (- n)))
8531 (defun gnus-summary-top-thread ()
8532 "Go to the top of the thread."
8534 (while (gnus-summary-go-up-thread))
8535 (gnus-summary-article-number))
8537 (defun gnus-summary-kill-thread (&optional unmark)
8538 "Mark articles under current thread as read.
8539 If the prefix argument is positive, remove any kinds of marks.
8540 If the prefix argument is negative, tick articles instead."
8543 (setq unmark (prefix-numeric-value unmark)))
8544 (let ((articles (gnus-summary-articles-in-thread)))
8546 ;; Expand the thread.
8547 (gnus-summary-show-thread)
8548 ;; Mark all the articles.
8550 (gnus-summary-goto-subject (car articles))
8551 (cond ((null unmark)
8552 (gnus-summary-mark-article-as-read gnus-killed-mark))
8554 (gnus-summary-mark-article-as-unread gnus-unread-mark))
8556 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
8557 (setq articles (cdr articles))))
8558 ;; Hide killed subtrees.
8560 gnus-thread-hide-killed
8561 (gnus-summary-hide-thread))
8562 ;; If marked as read, go to next unread subject.
8564 ;; Go to next unread subject.
8565 (gnus-summary-next-subject 1 t)))
8566 (gnus-set-mode-line 'summary))
8568 ;; Summary sorting commands
8570 (defun gnus-summary-sort-by-number (&optional reverse)
8571 "Sort the summary buffer by article number.
8572 Argument REVERSE means reverse order."
8574 (gnus-summary-sort 'number reverse))
8576 (defun gnus-summary-sort-by-author (&optional reverse)
8577 "Sort the summary buffer by author name alphabetically.
8578 If case-fold-search is non-nil, case of letters is ignored.
8579 Argument REVERSE means reverse order."
8581 (gnus-summary-sort 'author reverse))
8583 (defun gnus-summary-sort-by-subject (&optional reverse)
8584 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
8585 If case-fold-search is non-nil, case of letters is ignored.
8586 Argument REVERSE means reverse order."
8588 (gnus-summary-sort 'subject reverse))
8590 (defun gnus-summary-sort-by-date (&optional reverse)
8591 "Sort the summary buffer by date.
8592 Argument REVERSE means reverse order."
8594 (gnus-summary-sort 'date reverse))
8596 (defun gnus-summary-sort-by-score (&optional reverse)
8597 "Sort the summary buffer by score.
8598 Argument REVERSE means reverse order."
8600 (gnus-summary-sort 'score reverse))
8602 (defun gnus-summary-sort-by-lines (&optional reverse)
8603 "Sort the summary buffer by article length.
8604 Argument REVERSE means reverse order."
8606 (gnus-summary-sort 'lines reverse))
8608 (defun gnus-summary-sort (predicate reverse)
8609 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
8610 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
8611 (article (intern (format "gnus-article-sort-by-%s" predicate)))
8612 (gnus-thread-sort-functions
8617 (gnus-article-sort-functions
8623 (gnus-summary-prepare-hook nil))
8624 ;; We do the sorting by regenerating the threads.
8625 (gnus-summary-prepare)
8626 ;; Hide subthreads if needed.
8627 (when (and gnus-show-threads gnus-thread-hide-subtree)
8628 (gnus-summary-hide-all-threads))))
8630 ;; Summary saving commands.
8632 (defun gnus-summary-save-article (&optional n not-saved)
8633 "Save the current article using the default saver function.
8634 If N is a positive number, save the N next articles.
8635 If N is a negative number, save the N previous articles.
8636 If N is nil and any articles have been marked with the process mark,
8637 save those articles instead.
8638 The variable `gnus-default-article-saver' specifies the saver function."
8640 (let* ((articles (gnus-summary-work-articles n))
8641 (save-buffer (save-excursion
8642 (nnheader-set-temp-buffer " *Gnus Save*")))
8643 (num (length articles))
8644 header article file)
8646 (setq header (gnus-summary-article-header
8647 (setq article (pop articles))))
8648 (if (not (vectorp header))
8649 ;; This is a pseudo-article.
8650 (if (assq 'name header)
8651 (gnus-copy-file (cdr (assq 'name header)))
8652 (gnus-message 1 "Article %d is unsaveable" article))
8653 ;; This is a real article.
8654 (save-window-excursion
8655 (gnus-summary-select-article t nil nil article))
8657 (set-buffer save-buffer)
8659 (insert-buffer-substring gnus-original-article-buffer))
8660 (setq file (gnus-article-save save-buffer file num))
8661 (gnus-summary-remove-process-mark article)
8663 (gnus-summary-set-saved-mark article))))
8664 (gnus-kill-buffer save-buffer)
8665 (gnus-summary-position-point)
8666 (gnus-set-mode-line 'summary)
8669 (defun gnus-summary-pipe-output (&optional arg)
8670 "Pipe the current article to a subprocess.
8671 If N is a positive number, pipe the N next articles.
8672 If N is a negative number, pipe the N previous articles.
8673 If N is nil and any articles have been marked with the process mark,
8674 pipe those articles instead."
8676 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
8677 (gnus-summary-save-article arg t))
8678 (gnus-configure-windows 'pipe))
8680 (defun gnus-summary-save-article-mail (&optional arg)
8681 "Append the current article to an mail file.
8682 If N is a positive number, save the N next articles.
8683 If N is a negative number, save the N previous articles.
8684 If N is nil and any articles have been marked with the process mark,
8685 save those articles instead."
8687 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
8688 (gnus-summary-save-article arg)))
8690 (defun gnus-summary-save-article-rmail (&optional arg)
8691 "Append the current article to an rmail file.
8692 If N is a positive number, save the N next articles.
8693 If N is a negative number, save the N previous articles.
8694 If N is nil and any articles have been marked with the process mark,
8695 save those articles instead."
8697 (let ((gnus-default-article-saver 'rmail-output-to-rmail-file))
8698 (gnus-summary-save-article arg)))
8700 (defun gnus-summary-save-article-file (&optional arg)
8701 "Append the current article to a file.
8702 If N is a positive number, save the N next articles.
8703 If N is a negative number, save the N previous articles.
8704 If N is nil and any articles have been marked with the process mark,
8705 save those articles instead."
8707 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
8708 (gnus-summary-save-article arg)))
8710 (defun gnus-summary-write-article-file (&optional arg)
8711 "Write the current article to a file, deleting the previous file.
8712 If N is a positive number, save the N next articles.
8713 If N is a negative number, save the N previous articles.
8714 If N is nil and any articles have been marked with the process mark,
8715 save those articles instead."
8717 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
8718 (gnus-summary-save-article arg)))
8720 (defun gnus-summary-save-article-body-file (&optional arg)
8721 "Append the current article body to a file.
8722 If N is a positive number, save the N next articles.
8723 If N is a negative number, save the N previous articles.
8724 If N is nil and any articles have been marked with the process mark,
8725 save those articles instead."
8727 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
8728 (gnus-summary-save-article arg)))
8730 (defun gnus-summary-pipe-message (program)
8731 "Pipe the current article through PROGRAM."
8732 (interactive "sProgram: ")
8733 (gnus-summary-select-article)
8734 (let ((mail-header-separator ""))
8735 (gnus-eval-in-buffer-window gnus-article-buffer
8738 (let ((start (window-start))
8740 (message-pipe-buffer-body program)
8741 (set-window-start (get-buffer-window (current-buffer)) start))))))
8743 (defun gnus-get-split-value (methods)
8744 "Return a value based on the split METHODS."
8745 (let (split-name method result match)
8748 (set-buffer gnus-original-article-buffer)
8750 (nnheader-narrow-to-headers)
8752 (goto-char (point-min))
8753 (setq method (pop methods))
8754 (setq match (car method))
8757 ;; Regular expression.
8759 (re-search-forward match nil t)))
8760 ((gnus-functionp match)
8764 (setq result (funcall match gnus-newsgroup-name))))
8769 (setq result (eval match)))))
8770 (setq split-name (append (cdr method) split-name))
8771 (cond ((stringp result)
8772 (push (expand-file-name
8773 result gnus-article-save-directory)
8776 (setq split-name (append result split-name)))))))))
8779 (defun gnus-valid-move-group-p (group)
8782 (symbol-value group)
8785 (car (gnus-find-method-for-group
8786 (symbol-name group))))
8787 gnus-valid-select-methods))))
8789 (defun gnus-read-move-group-name (prompt default articles prefix)
8790 "Read a group name."
8791 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
8792 (minibuffer-confirm-incomplete nil) ; XEmacs
8796 (if (> (length articles) 1)
8797 (format "these %d articles" (length articles))
8802 (gnus-completing-read default prom
8804 'gnus-valid-move-group-p
8806 'gnus-group-history))
8807 ((= 1 (length split-name))
8808 (gnus-completing-read (car split-name) prom
8810 'gnus-valid-move-group-p
8812 'gnus-group-history))
8814 (gnus-completing-read nil prom
8815 (mapcar (lambda (el) (list el))
8816 (nreverse split-name))
8818 'gnus-group-history)))))
8820 (if (or (string= to-newsgroup "")
8821 (string= to-newsgroup prefix))
8822 (setq to-newsgroup default))
8823 (unless to-newsgroup
8824 (error "No group name entered"))
8825 (or (gnus-active to-newsgroup)
8826 (gnus-activate-group to-newsgroup)
8827 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
8829 (or (and (gnus-request-create-group
8830 to-newsgroup (gnus-group-name-to-method to-newsgroup))
8831 (gnus-activate-group to-newsgroup nil nil
8832 (gnus-group-name-to-method
8834 (error "Couldn't create group %s" to-newsgroup)))
8835 (error "No such group: %s" to-newsgroup)))
8838 ;; Summary extract commands
8840 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
8841 (let ((buffer-read-only nil)
8842 (article (gnus-summary-article-number))
8844 (unless (gnus-summary-goto-subject article)
8845 (error "No such article: %d" article))
8846 (gnus-summary-position-point)
8847 ;; If all commands are to be bunched up on one line, we collect
8849 (unless gnus-view-pseudos-separately
8850 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
8853 (setq action (cdr (assq 'action (car ps))))
8854 (setq files (list (cdr (assq 'name (car ps)))))
8855 (while (and ps (cdr ps)
8856 (string= (or action "1")
8857 (or (cdr (assq 'action (cadr ps))) "2")))
8858 (push (cdr (assq 'name (cadr ps))) files)
8859 (setcdr ps (cddr ps)))
8861 (when (not (string-match "%s" action))
8864 (when (assq 'execute (car ps))
8865 (setcdr (assq 'execute (car ps))
8866 (funcall (if (string-match "%s" action)
8875 (setq ps (cdr ps)))))
8876 (if (and gnus-view-pseudos (not not-view))
8878 (when (assq 'execute (car pslist))
8879 (gnus-execute-command (cdr (assq 'execute (car pslist)))
8880 (eq gnus-view-pseudos 'not-confirm)))
8881 (setq pslist (cdr pslist)))
8884 (setq after-article (or (cdr (assq 'article (car pslist)))
8885 (gnus-summary-article-number)))
8886 (gnus-summary-goto-subject after-article)
8889 (insert " " (file-name-nondirectory
8890 (cdr (assq 'name (car pslist))))
8891 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
8893 (forward-line -1) ; back to `b'
8894 (gnus-add-text-properties
8895 b (1- e) (list 'gnus-number gnus-reffed-article-number
8896 gnus-mouse-face-prop gnus-mouse-face))
8898 after-article gnus-reffed-article-number
8899 gnus-unread-mark b (car pslist) 0 (- e b))
8900 (push gnus-reffed-article-number gnus-newsgroup-unreads)
8901 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
8902 (setq pslist (cdr pslist)))))))
8904 (defun gnus-pseudos< (p1 p2)
8905 (let ((c1 (cdr (assq 'action p1)))
8906 (c2 (cdr (assq 'action p2))))
8907 (and c1 c2 (string< c1 c2))))
8909 (defun gnus-request-pseudo-article (props)
8910 (cond ((assq 'execute props)
8911 (gnus-execute-command (cdr (assq 'execute props)))))
8912 (let ((gnus-current-article (gnus-summary-article-number)))
8913 (gnus-run-hooks 'gnus-mark-article-hook)))
8915 (defun gnus-execute-command (command &optional automatic)
8917 (gnus-article-setup-buffer)
8918 (set-buffer gnus-article-buffer)
8919 (setq buffer-read-only nil)
8920 (let ((command (if automatic command
8921 (read-string "Command: " (cons command 0)))))
8923 (insert "$ " command "\n\n")
8924 (if gnus-view-pseudo-asynchronously
8925 (start-process "gnus-execute" (current-buffer) shell-file-name
8926 shell-command-switch command)
8927 (call-process shell-file-name nil t nil
8928 shell-command-switch command)))))
8930 ;; Summary kill commands.
8932 (defun gnus-summary-edit-global-kill (article)
8933 "Edit the \"global\" kill file."
8934 (interactive (list (gnus-summary-article-number)))
8935 (gnus-group-edit-global-kill article))
8937 (defun gnus-summary-edit-local-kill ()
8938 "Edit a local kill file applied to the current newsgroup."
8940 (setq gnus-current-headers (gnus-summary-article-header))
8941 (gnus-group-edit-local-kill
8942 (gnus-summary-article-number) gnus-newsgroup-name))
8946 (defun gnus-read-header (id &optional header)
8947 "Read the headers of article ID and enter them into the Gnus system."
8948 (let ((group gnus-newsgroup-name)
8949 (gnus-override-method
8950 (and (gnus-news-group-p gnus-newsgroup-name)
8951 gnus-refer-article-method))
8953 ;; First we check to see whether the header in question is already
8956 ;; This is a Message-ID.
8957 (setq header (or header (gnus-id-to-header id)))
8958 ;; This is an article number.
8959 (setq header (or header (gnus-summary-article-header id))))
8961 (not (gnus-summary-article-sparse-p (mail-header-number header))))
8962 ;; We have found the header.
8964 ;; If this is a sparse article, we have to nix out its
8965 ;; previous entry in the thread hashtb.
8967 (gnus-summary-article-sparse-p (mail-header-number header)))
8968 (let* ((parent (gnus-parent-id (mail-header-references header)))
8969 (thread (and parent (gnus-id-to-thread parent))))
8971 (delq (assq header thread) thread))))
8972 ;; We have to really fetch the header to this article.
8974 (set-buffer nntp-server-buffer)
8975 (when (setq where (gnus-request-head id group))
8976 (nnheader-fold-continuation-lines)
8977 (goto-char (point-max))
8979 (goto-char (point-min))
8983 ((cdr where) (cdr where))
8984 (header (mail-header-number header))
8985 (t gnus-reffed-article-number))
8987 (insert " Article retrieved.\n"))
8989 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
8990 () ; Malformed head.
8991 (unless (gnus-summary-article-sparse-p (mail-header-number header))
8992 (when (and (stringp id)
8993 (not (string= (gnus-group-real-name group)
8995 ;; If we fetched by Message-ID and the article came
8996 ;; from a different group, we fudge some bogus article
8997 ;; numbers for this article.
8998 (mail-header-set-number header gnus-reffed-article-number))
9000 (set-buffer gnus-summary-buffer)
9001 (decf gnus-reffed-article-number)
9002 (gnus-remove-header (mail-header-number header))
9003 (push header gnus-newsgroup-headers)
9004 (setq gnus-current-headers header)
9005 (push (mail-header-number header) gnus-newsgroup-limit)))
9008 (defun gnus-remove-header (number)
9009 "Remove header NUMBER from `gnus-newsgroup-headers'."
9010 (if (and gnus-newsgroup-headers
9011 (= number (mail-header-number (car gnus-newsgroup-headers))))
9012 (pop gnus-newsgroup-headers)
9013 (let ((headers gnus-newsgroup-headers))
9014 (while (and (cdr headers)
9015 (not (= number (mail-header-number (cadr headers)))))
9018 (setcdr headers (cddr headers))))))
9021 ;;; summary highlights
9024 (defun gnus-highlight-selected-summary ()
9025 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
9026 ;; Highlight selected article in summary buffer
9027 (when gnus-summary-selected-face
9029 (let* ((beg (progn (beginning-of-line) (point)))
9030 (end (progn (end-of-line) (point)))
9031 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
9032 (from (if (get-text-property beg gnus-mouse-face-prop)
9034 (or (next-single-property-change
9035 beg gnus-mouse-face-prop nil end)
9040 (or (next-single-property-change
9041 from gnus-mouse-face-prop nil end)
9043 ;; If no mouse-face prop on line we will have to = from = end,
9044 ;; so we highlight the entire line instead.
9045 (when (= (+ to 2) from)
9048 (if gnus-newsgroup-selected-overlay
9049 ;; Move old overlay.
9051 gnus-newsgroup-selected-overlay from to (current-buffer))
9052 ;; Create new overlay.
9054 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
9055 'face gnus-summary-selected-face))))))
9057 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
9058 (defun gnus-summary-highlight-line ()
9059 "Highlight current line according to `gnus-summary-highlight'."
9060 (let* ((list gnus-summary-highlight)
9062 (end (progn (end-of-line) (point)))
9063 ;; now find out where the line starts and leave point there.
9064 (beg (progn (beginning-of-line) (point)))
9065 (article (gnus-summary-article-number))
9066 (score (or (cdr (assq (or article gnus-current-article)
9067 gnus-newsgroup-scored))
9068 gnus-summary-default-score 0))
9069 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
9070 (inhibit-read-only t))
9071 ;; Eval the cars of the lists until we find a match.
9072 (let ((default gnus-summary-default-score))
9074 (not (eval (caar list))))
9075 (setq list (cdr list))))
9076 (let ((face (cdar list)))
9077 (unless (eq face (get-text-property beg 'face))
9078 (gnus-put-text-property-excluding-characters-with-faces
9080 (setq face (if (boundp face) (symbol-value face) face)))
9081 (when gnus-summary-highlight-line-function
9082 (funcall gnus-summary-highlight-line-function article face))))
9085 (defun gnus-update-read-articles (group unread &optional compute)
9086 "Update the list of read articles in GROUP."
9087 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
9088 (entry (gnus-gethash group gnus-newsrc-hashtb))
9089 (info (nth 2 entry))
9091 (unread (sort (copy-sequence unread) '<))
9093 (if (or (not info) (not active))
9094 ;; There is no info on this group if it was, in fact,
9095 ;; killed. Gnus stores no information on killed groups, so
9096 ;; there's nothing to be done.
9097 ;; One could store the information somewhere temporarily,
9098 ;; perhaps... Hmmm...
9100 ;; Remove any negative articles numbers.
9101 (while (and unread (< (car unread) 0))
9102 (setq unread (cdr unread)))
9103 ;; Remove any expired article numbers
9104 (while (and unread (< (car unread) (car active)))
9105 (setq unread (cdr unread)))
9106 ;; Compute the ranges of read articles by looking at the list of
9109 (when (/= (car unread) prev)
9110 (push (if (= prev (1- (car unread))) prev
9111 (cons prev (1- (car unread))))
9113 (setq prev (1+ (car unread)))
9114 (setq unread (cdr unread)))
9115 (when (<= prev (cdr active))
9116 (push (cons prev (cdr active)) read))
9117 (setq read (if (> (length read) 1) (nreverse read) read))
9121 (set-buffer gnus-group-buffer)
9124 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
9125 (gnus-info-set-read ',info ',(gnus-info-read info))
9126 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
9127 (gnus-group-update-group ,group t))))
9128 ;; Propagate the read marks to the backend.
9129 (if (gnus-check-backend-function 'request-set-mark group)
9130 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
9131 (add (gnus-remove-from-range read (gnus-info-read info))))
9133 (gnus-request-set-mark
9134 group (delq nil (list (if add (list add 'add '(read)))
9135 (if del (list del 'del '(read)))))))))
9136 ;; Enter this list into the group info.
9137 (gnus-info-set-read info read)
9138 ;; Set the number of unread articles in gnus-newsrc-hashtb.
9139 (gnus-get-unread-articles-in-group info (gnus-active group))
9142 (defun gnus-offer-save-summaries ()
9143 "Offer to save all active summary buffers."
9145 (let ((buflist (buffer-list))
9147 ;; Go through all buffers and find all summaries.
9149 (and (setq bufname (buffer-name (car buflist)))
9150 (string-match "Summary" bufname)
9152 (set-buffer bufname)
9153 ;; We check that this is, indeed, a summary buffer.
9154 (and (eq major-mode 'gnus-summary-mode)
9155 ;; Also make sure this isn't bogus.
9156 gnus-newsgroup-prepared
9157 ;; Also make sure that this isn't a dead summary buffer.
9158 (not gnus-dead-summary-mode)))
9159 (push bufname buffers))
9160 (setq buflist (cdr buflist)))
9161 ;; Go through all these summary buffers and offer to save them.
9164 "Update summary buffer %s? "
9166 (switch-to-buffer buf)
9167 (gnus-summary-exit))
9170 (defun gnus-summary-setup-default-charset ()
9171 "Setup newsgroup default charset."
9172 (let ((name (and gnus-newsgroup-name
9173 (gnus-group-real-name gnus-newsgroup-name))))
9174 (setq gnus-newsgroup-charset
9175 (or (and gnus-newsgroup-name
9176 (or (gnus-group-find-parameter gnus-newsgroup-name 'charset)
9177 (let ((alist gnus-group-charset-alist)
9179 (while (setq elem (pop alist))
9181 (string-match (car elem) name))
9183 charset (cadr elem))))
9185 gnus-default-charset))))
9191 (defun gnus-summary-display-buttonized (&optional show-all-parts)
9192 "Display the current article buffer fully MIME-buttonized.
9193 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
9194 treated as multipart/mixed."
9197 (let ((gnus-unbuttonized-mime-types nil)
9198 (gnus-mime-display-multipart-as-mixed show-all-parts))
9199 (gnus-summary-show-article)))
9201 (defun gnus-summary-repair-multipart (article)
9202 "Add a Content-Type header to a multipart article without one."
9203 (interactive (list (gnus-summary-article-number)))
9204 (gnus-with-article article
9205 (message-narrow-to-head)
9206 (goto-char (point-max))
9208 (when (search-forward "\n--" nil t)
9209 (let ((separator (buffer-substring (point) (gnus-point-at-eol))))
9210 (message-narrow-to-head)
9211 (message-remove-header "Mime-Version")
9212 (message-remove-header "Content-Type")
9213 (goto-char (point-max))
9214 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
9216 (insert "Mime-Version: 1.0\n")
9218 (let (gnus-mark-article-hook)
9219 (gnus-summary-select-article t t nil article)))
9221 (defun gnus-summary-toggle-display-buttonized ()
9222 "Toggle the buttonizing of the article buffer."
9225 (if (setq gnus-inhibit-mime-unbuttonizing
9226 (not gnus-inhibit-mime-unbuttonizing))
9227 (let ((gnus-unbuttonized-mime-types nil))
9228 (gnus-summary-show-article))
9229 (gnus-summary-show-article)))
9235 (run-hooks 'gnus-sum-load-hook)
9237 ;;; gnus-sum.el ends here